formal-verification

Are there any provable real-world languages? (scala?)

大憨熊 提交于 2019-12-02 15:42:59
I was taught about formal systems at university, but I was disappointed how they didn't seem to be used in the real word. I like the idea of being able to know that some code (object, function, whatever) works, not by testing, but by proof . I'm sure we're all familiar with the parallels that don't exist between physical engineering and software engineering (steel behaves predictably, software can do anything - who knows!), and I would love to know if there are any languages that can be use in the real word (is asking for a web framework too much to ask?) I've heard interesting things about

Can Haskell functions be proved/model-checked/verified with correctness properties?

落爺英雄遲暮 提交于 2019-12-02 13:54:22
Continuing on from ideas in: Are there any provable real-world languages? I don't know about you, but I'm sick of writing code that I can't guarantee. After asking the above question and getting a phenomenal response (Thanks all!) I have decided to narrow my search for a provable, pragmatic, approach to Haskell . I chose Haskell because it is actually useful (there are many web frameworks written for it, this seems a good benchmark) AND I think it is strict enough, functionally , that it might be provable, or at least allow the testing of invariants. Here's what I want (and have been unable to

How to compare two LTLs?

限于喜欢 提交于 2019-12-02 09:04:37
问题 How can I compare two LTLs to see if one can contradict each other? I ask this because I have a hierarchical state machine and LTLs describing the behavior in each state. I need to know if a local LTL can contradict a global LTL. I saw in the Article 'Feature Specification and Automated Conflict Detection' that two LTLs properties f and g are inconsistent iff L(f) intersection L(g) is empty. And this is exactly the model checking question with f as the program and ¬g as the property. Can

Is it possible to cast a bitvector of one bit into a boolean variable in SMTLib2?

て烟熏妆下的殇ゞ 提交于 2019-12-01 21:22:18
I want to have a boolean variable that test if, e.g., the third bit of a bit vector is 0. The theory of bitvector allows to extract 1 bit as a bitvector, but not a boolean type. I wonder if I can do this cast. Thank you. === Update === I'm sorry if my question is not clear. But the answer of Nikolaj Bjorner is how to test a certain bit of a bit vector. While I want to assign the value of the first bit of a bit vector to a variable. I try to modify the example as follows: (declare-fun x () (_ BitVec 5)) (declare-fun bit0 () Bool) (assert (= (= #b1 ((_ extract 0 0) x)) bit0 )) (check-sat) And z3

Most efficient way to represent memory buffers in Z3

萝らか妹 提交于 2019-11-30 15:34:04
I would like to model fixed-size memory buffers and their access operations in Z3. The size of the buffers can be anywhere from a couple of bytes to hundreds of bytes. The standard way employed by several existing tools (e.g., KLEE) is to create array variables over the domain and range of bitvectors. Each memory buffer gets such an array and memory reads/writes are encoded using select / store operations. Alas, in my benchmarks, when using this approach, Z3(*) appears to be consistently slower than STP. Before analyzing the queries in more detail to figure out what's going on, I wanted to

Most efficient way to represent memory buffers in Z3

拈花ヽ惹草 提交于 2019-11-29 23:03:08
问题 I would like to model fixed-size memory buffers and their access operations in Z3. The size of the buffers can be anywhere from a couple of bytes to hundreds of bytes. The standard way employed by several existing tools (e.g., KLEE) is to create array variables over the domain and range of bitvectors. Each memory buffer gets such an array and memory reads/writes are encoded using select / store operations. Alas, in my benchmarks, when using this approach, Z3(*) appears to be consistently

atomic sequences in Promela. Contradictory in documentation

廉价感情. 提交于 2019-11-29 16:49:30
Here, http://spinroot.com/spin/Man/Manual.html , it is written that: In Promela there is also another way to avoid the test and set problem: atomic sequences. By prefixing a sequence of statements enclosed in curly braces with the keyword atomic the user can indicate that the sequence is to be executed as one indivisible unit, non-interleaved with any other processes. It causes a run-time error if any statement, other than the first statement, blocks in an atomic sequence . This is how we can use atomic sequences to protect the concurrent access to the global variable state in the earlier

Dafny: What does no terms found to trigger on mean?

大憨熊 提交于 2019-11-29 11:56:27
I am getting a warning in Dafny which says that my quantifiers have No terms found to trigger on. What I am trying to do for my code is to find the largest number that has a square value that is less than or equal to the given natural number 'n'. Here is the code I came up with so far: method sqrt(n : nat) returns (r: int) // square less than or equal to n ensures (r * r) <= n // largest number ensures forall i :: 0 <= i < r ==> (i * i) < (r * r) { var i := 0; // increasing number r := 0; while ((i*i) <= n) invariant (r*r) <= n invariant forall k :: 0 <= k < r ==> (k*k) < (r*r) decreases n - i

printing internal solver formulas in z3

旧巷老猫 提交于 2019-11-29 10:26:53
The theorem proving tool z3 is taking a lot of time to solve a formula, which I believe it should be able to handle easily. To understand this better and possibly optimize my input to z3, I wanted to see the internal constraints that z3 generates as part of its solving process. How do I print the formula that z3 produces for its back-end solvers, when using z3 from the command line? Leonardo de Moura Z3 command line tool does not have such option. Moreover, Z3 contains several solvers and pre-processing steps. It is unclear which step would be useful for you. The Z3 source code is available at

Dafny: What does no terms found to trigger on mean?

痴心易碎 提交于 2019-11-28 05:58:09
问题 I am getting a warning in Dafny which says that my quantifiers have No terms found to trigger on. What I am trying to do for my code is to find the largest number that has a square value that is less than or equal to the given natural number 'n'. Here is the code I came up with so far: method sqrt(n : nat) returns (r: int) // square less than or equal to n ensures (r * r) <= n // largest number ensures forall i :: 0 <= i < r ==> (i * i) < (r * r) { var i := 0; // increasing number r := 0;