theorem-proving

Coq simpl for Program Fixpoint

有些话、适合烂在心里 提交于 2019-11-30 03:37:27
问题 is there anything like the tactic simpl for Program Fixpoint s? In particular, how can one proof the following trivial statement? Program Fixpoint bla (n:nat) {measure n} := match n with | 0 => 0 | S n' => S (bla n') end. Lemma obvious: forall n, bla n = n. induction n. reflexivity. (* I'm stuck here. For a normal fixpoint, I could for instance use simpl. rewrite IHn. reflexivity. But here, I couldn't find a tactic transforming bla (S n) to S (bla n).*) Obviously, there is no Program Fixpoint

Z3: Extracting existential model-values

核能气质少年 提交于 2019-11-29 15:42:22
I'm playing around with Z3's QBVF solver, and wondering if it's possible to extract values from an existential assertion. To wit, let's say I have the following: (assert (exists ((x (_ BitVec 16))) (forall ((y (_ BitVec 16))) (bvuge y x)))) This basically says that there is a "least" 16-bit unsigned value. Then, I can say: (check-sat) (get-model) And Z3-3.0 happily responds: sat (model (define-fun x!0 () (_ BitVec 16) #x0000) ) Which is really cool. But what I want to do is to be able to extract pieces of that model via get-value. Unsurprisingly, none of the following seem to work (get-value

Z3 Theorem Prover: Pythagorean Theorem (Non-Linear Artithmetic)

旧巷老猫 提交于 2019-11-29 12:02:02
Wherefore? The usecase context in which my problem occures I define 3 random item of a triangle. Microsoft Z3 should output: Are the constraints satisfiabe or are there invalid input values? A model for all the other triangle items where all the variables are assigned to concrete values. In order to constrain the items i need to assert triangle equalities - i wanted to start out with the Pythagorean Theorem ( (h_c² + p² = b²) ^ (h_c² + q² = a²) ). The Problem I know that Microsoft Z3 has only limited capabilities to solve non-linear arithematic problems. But even some hand calculators are able

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

Is it possible to program and check invariants in Haskell?

不想你离开。 提交于 2019-11-28 15:44:50
问题 When I write an algorithm I usually write down invariants in comments. For example, one function might return an ordered list, and the other one expect that a list would be ordered. I'm aware that theorem provers exists, but I have no experience using them. I also believe that smart compiler [sic!] can make use of them to optimize the program. So, is it possible to write down invariants and make compiler check them? 回答1: Well, the answer is yes and no. There's no way to just write an

Z3: Extracting existential model-values

若如初见. 提交于 2019-11-28 09:28:46
问题 I'm playing around with Z3's QBVF solver, and wondering if it's possible to extract values from an existential assertion. To wit, let's say I have the following: (assert (exists ((x (_ BitVec 16))) (forall ((y (_ BitVec 16))) (bvuge y x)))) This basically says that there is a "least" 16-bit unsigned value. Then, I can say: (check-sat) (get-model) And Z3-3.0 happily responds: sat (model (define-fun x!0 () (_ BitVec 16) #x0000) ) Which is really cool. But what I want to do is to be able to

Z3: finding all satisfying models

☆樱花仙子☆ 提交于 2019-11-26 10:41:47
I am trying to retrieve all possible models for some first-order theory using Z3, an SMT solver developed by Microsoft Research. Here is a minimal working example: (declare-const f Bool) (assert (or (= f true) (= f false))) In this propositional case there are two satisfying assignments: f->true and f->false . Because Z3 (and SMT solvers in general) will only try to find one satisfying model, finding all solutions is not directly possible. Here I found a useful command called (next-sat) , but it seems that the latest version of Z3 no longer supports this. This is bit unfortunate for me, and in

Z3: finding all satisfying models

风流意气都作罢 提交于 2019-11-26 02:01:05
问题 I am trying to retrieve all possible models for some first-order theory using Z3, an SMT solver developed by Microsoft Research. Here is a minimal working example: (declare-const f Bool) (assert (or (= f true) (= f false))) In this propositional case there are two satisfying assignments: f->true and f->false . Because Z3 (and SMT solvers in general) will only try to find one satisfying model, finding all solutions is not directly possible. Here I found a useful command called (next-sat) , but