author | wenzelm |
Tue, 11 May 2021 20:19:07 +0200 | |
changeset 73675 | 6c56f2ebe157 |
parent 73389 | f3378101f555 |
child 74048 | a0c9fc9c7dbe |
permissions | -rw-r--r-- |
58061 | 1 |
(* Title: HOL/SMT.thy |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
2 |
Author: Sascha Boehme, TU Muenchen |
66551 | 3 |
Author: Jasmin Blanchette, VU Amsterdam |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
4 |
*) |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
5 |
|
61626 | 6 |
section \<open>Bindings to Satisfiability Modulo Theories (SMT) solvers based on SMT-LIB 2\<close> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
7 |
|
58061 | 8 |
theory SMT |
72458
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
9 |
imports Divides Numeral_Simprocs |
66551 | 10 |
keywords "smt_status" :: diag |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
11 |
begin |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
12 |
|
60758 | 13 |
subsection \<open>A skolemization tactic and proof method\<close> |
58481 | 14 |
|
15 |
lemma choices: |
|
16 |
"\<And>Q. \<forall>x. \<exists>y ya. Q x y ya \<Longrightarrow> \<exists>f fa. \<forall>x. Q x (f x) (fa x)" |
|
17 |
"\<And>Q. \<forall>x. \<exists>y ya yb. Q x y ya yb \<Longrightarrow> \<exists>f fa fb. \<forall>x. Q x (f x) (fa x) (fb x)" |
|
18 |
"\<And>Q. \<forall>x. \<exists>y ya yb yc. Q x y ya yb yc \<Longrightarrow> \<exists>f fa fb fc. \<forall>x. Q x (f x) (fa x) (fb x) (fc x)" |
|
58598 | 19 |
"\<And>Q. \<forall>x. \<exists>y ya yb yc yd. Q x y ya yb yc yd \<Longrightarrow> |
20 |
\<exists>f fa fb fc fd. \<forall>x. Q x (f x) (fa x) (fb x) (fc x) (fd x)" |
|
21 |
"\<And>Q. \<forall>x. \<exists>y ya yb yc yd ye. Q x y ya yb yc yd ye \<Longrightarrow> |
|
22 |
\<exists>f fa fb fc fd fe. \<forall>x. Q x (f x) (fa x) (fb x) (fc x) (fd x) (fe x)" |
|
23 |
"\<And>Q. \<forall>x. \<exists>y ya yb yc yd ye yf. Q x y ya yb yc yd ye yf \<Longrightarrow> |
|
24 |
\<exists>f fa fb fc fd fe ff. \<forall>x. Q x (f x) (fa x) (fb x) (fc x) (fd x) (fe x) (ff x)" |
|
25 |
"\<And>Q. \<forall>x. \<exists>y ya yb yc yd ye yf yg. Q x y ya yb yc yd ye yf yg \<Longrightarrow> |
|
26 |
\<exists>f fa fb fc fd fe ff fg. \<forall>x. Q x (f x) (fa x) (fb x) (fc x) (fd x) (fe x) (ff x) (fg x)" |
|
58481 | 27 |
by metis+ |
28 |
||
29 |
lemma bchoices: |
|
30 |
"\<And>Q. \<forall>x \<in> S. \<exists>y ya. Q x y ya \<Longrightarrow> \<exists>f fa. \<forall>x \<in> S. Q x (f x) (fa x)" |
|
31 |
"\<And>Q. \<forall>x \<in> S. \<exists>y ya yb. Q x y ya yb \<Longrightarrow> \<exists>f fa fb. \<forall>x \<in> S. Q x (f x) (fa x) (fb x)" |
|
32 |
"\<And>Q. \<forall>x \<in> S. \<exists>y ya yb yc. Q x y ya yb yc \<Longrightarrow> \<exists>f fa fb fc. \<forall>x \<in> S. Q x (f x) (fa x) (fb x) (fc x)" |
|
58598 | 33 |
"\<And>Q. \<forall>x \<in> S. \<exists>y ya yb yc yd. Q x y ya yb yc yd \<Longrightarrow> |
34 |
\<exists>f fa fb fc fd. \<forall>x \<in> S. Q x (f x) (fa x) (fb x) (fc x) (fd x)" |
|
35 |
"\<And>Q. \<forall>x \<in> S. \<exists>y ya yb yc yd ye. Q x y ya yb yc yd ye \<Longrightarrow> |
|
36 |
\<exists>f fa fb fc fd fe. \<forall>x \<in> S. Q x (f x) (fa x) (fb x) (fc x) (fd x) (fe x)" |
|
37 |
"\<And>Q. \<forall>x \<in> S. \<exists>y ya yb yc yd ye yf. Q x y ya yb yc yd ye yf \<Longrightarrow> |
|
38 |
\<exists>f fa fb fc fd fe ff. \<forall>x \<in> S. Q x (f x) (fa x) (fb x) (fc x) (fd x) (fe x) (ff x)" |
|
39 |
"\<And>Q. \<forall>x \<in> S. \<exists>y ya yb yc yd ye yf yg. Q x y ya yb yc yd ye yf yg \<Longrightarrow> |
|
40 |
\<exists>f fa fb fc fd fe ff fg. \<forall>x \<in> S. Q x (f x) (fa x) (fb x) (fc x) (fd x) (fe x) (ff x) (fg x)" |
|
58481 | 41 |
by metis+ |
42 |
||
60758 | 43 |
ML \<open> |
58481 | 44 |
fun moura_tac ctxt = |
45 |
Atomize_Elim.atomize_elim_tac ctxt THEN' |
|
46 |
SELECT_GOAL (Clasimp.auto_tac (ctxt addSIs @{thms choice choices bchoice bchoices}) THEN |
|
58598 | 47 |
ALLGOALS (Metis_Tactic.metis_tac (take 1 ATP_Proof_Reconstruct.partial_type_encs) |
48 |
ATP_Proof_Reconstruct.default_metis_lam_trans ctxt [] ORELSE' |
|
49 |
blast_tac ctxt)) |
|
60758 | 50 |
\<close> |
58481 | 51 |
|
60758 | 52 |
method_setup moura = \<open> |
60201 | 53 |
Scan.succeed (SIMPLE_METHOD' o moura_tac) |
60758 | 54 |
\<close> "solve skolemization goals, especially those arising from Z3 proofs" |
58481 | 55 |
|
56 |
hide_fact (open) choices bchoices |
|
57 |
||
58 |
||
60758 | 59 |
subsection \<open>Triggers for quantifier instantiation\<close> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
60 |
|
60758 | 61 |
text \<open> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
62 |
Some SMT solvers support patterns as a quantifier instantiation |
57696
fb71c6f100f8
do not embed 'nat' into 'int's in 'smt2' method -- this is highly inefficient and decreases the Sledgehammer success rate significantly
blanchet
parents:
57246
diff
changeset
|
63 |
heuristics. Patterns may either be positive terms (tagged by "pat") |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
64 |
triggering quantifier instantiations -- when the solver finds a |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
65 |
term matching a positive pattern, it instantiates the corresponding |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
66 |
quantifier accordingly -- or negative terms (tagged by "nopat") |
57696
fb71c6f100f8
do not embed 'nat' into 'int's in 'smt2' method -- this is highly inefficient and decreases the Sledgehammer success rate significantly
blanchet
parents:
57246
diff
changeset
|
67 |
inhibiting quantifier instantiations. A list of patterns |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
68 |
of the same kind is called a multipattern, and all patterns in a |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
69 |
multipattern are considered conjunctively for quantifier instantiation. |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
70 |
A list of multipatterns is called a trigger, and their multipatterns |
57696
fb71c6f100f8
do not embed 'nat' into 'int's in 'smt2' method -- this is highly inefficient and decreases the Sledgehammer success rate significantly
blanchet
parents:
57246
diff
changeset
|
71 |
act disjunctively during quantifier instantiation. Each multipattern |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
72 |
should mention at least all quantified variables of the preceding |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
73 |
quantifier block. |
60758 | 74 |
\<close> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
75 |
|
57230 | 76 |
typedecl 'a symb_list |
77 |
||
78 |
consts |
|
79 |
Symb_Nil :: "'a symb_list" |
|
80 |
Symb_Cons :: "'a \<Rightarrow> 'a symb_list \<Rightarrow> 'a symb_list" |
|
81 |
||
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
82 |
typedecl pattern |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
83 |
|
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
84 |
consts |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
85 |
pat :: "'a \<Rightarrow> pattern" |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
86 |
nopat :: "'a \<Rightarrow> pattern" |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
87 |
|
57230 | 88 |
definition trigger :: "pattern symb_list symb_list \<Rightarrow> bool \<Rightarrow> bool" where |
89 |
"trigger _ P = P" |
|
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
90 |
|
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
91 |
|
60758 | 92 |
subsection \<open>Higher-order encoding\<close> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
93 |
|
60758 | 94 |
text \<open> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
95 |
Application is made explicit for constants occurring with varying |
57696
fb71c6f100f8
do not embed 'nat' into 'int's in 'smt2' method -- this is highly inefficient and decreases the Sledgehammer success rate significantly
blanchet
parents:
57246
diff
changeset
|
96 |
numbers of arguments. This is achieved by the introduction of the |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
97 |
following constant. |
60758 | 98 |
\<close> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
99 |
|
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
100 |
definition fun_app :: "'a \<Rightarrow> 'a" where "fun_app f = f" |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
101 |
|
60758 | 102 |
text \<open> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
103 |
Some solvers support a theory of arrays which can be used to encode |
57696
fb71c6f100f8
do not embed 'nat' into 'int's in 'smt2' method -- this is highly inefficient and decreases the Sledgehammer success rate significantly
blanchet
parents:
57246
diff
changeset
|
104 |
higher-order functions. The following set of lemmas specifies the |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
105 |
properties of such (extensional) arrays. |
60758 | 106 |
\<close> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
107 |
|
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
108 |
lemmas array_rules = ext fun_upd_apply fun_upd_same fun_upd_other fun_upd_upd fun_app_def |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
109 |
|
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
110 |
|
60758 | 111 |
subsection \<open>Normalization\<close> |
56103
6689512f3710
move lemmas to theory file, towards textual proof reconstruction
blanchet
parents:
56102
diff
changeset
|
112 |
|
6689512f3710
move lemmas to theory file, towards textual proof reconstruction
blanchet
parents:
56102
diff
changeset
|
113 |
lemma case_bool_if[abs_def]: "case_bool x y P = (if P then x else y)" |
6689512f3710
move lemmas to theory file, towards textual proof reconstruction
blanchet
parents:
56102
diff
changeset
|
114 |
by simp |
6689512f3710
move lemmas to theory file, towards textual proof reconstruction
blanchet
parents:
56102
diff
changeset
|
115 |
|
6689512f3710
move lemmas to theory file, towards textual proof reconstruction
blanchet
parents:
56102
diff
changeset
|
116 |
lemmas Ex1_def_raw = Ex1_def[abs_def] |
6689512f3710
move lemmas to theory file, towards textual proof reconstruction
blanchet
parents:
56102
diff
changeset
|
117 |
lemmas Ball_def_raw = Ball_def[abs_def] |
6689512f3710
move lemmas to theory file, towards textual proof reconstruction
blanchet
parents:
56102
diff
changeset
|
118 |
lemmas Bex_def_raw = Bex_def[abs_def] |
6689512f3710
move lemmas to theory file, towards textual proof reconstruction
blanchet
parents:
56102
diff
changeset
|
119 |
lemmas abs_if_raw = abs_if[abs_def] |
6689512f3710
move lemmas to theory file, towards textual proof reconstruction
blanchet
parents:
56102
diff
changeset
|
120 |
lemmas min_def_raw = min_def[abs_def] |
6689512f3710
move lemmas to theory file, towards textual proof reconstruction
blanchet
parents:
56102
diff
changeset
|
121 |
lemmas max_def_raw = max_def[abs_def] |
6689512f3710
move lemmas to theory file, towards textual proof reconstruction
blanchet
parents:
56102
diff
changeset
|
122 |
|
66817 | 123 |
lemma nat_zero_as_int: |
124 |
"0 = nat 0" |
|
125 |
by simp |
|
126 |
||
127 |
lemma nat_one_as_int: |
|
128 |
"1 = nat 1" |
|
129 |
by simp |
|
130 |
||
66298 | 131 |
lemma nat_numeral_as_int: "numeral = (\<lambda>i. nat (numeral i))" by simp |
67399 | 132 |
lemma nat_less_as_int: "(<) = (\<lambda>a b. int a < int b)" by simp |
133 |
lemma nat_leq_as_int: "(\<le>) = (\<lambda>a b. int a \<le> int b)" by simp |
|
66298 | 134 |
lemma Suc_as_int: "Suc = (\<lambda>a. nat (int a + 1))" by (rule ext) simp |
67399 | 135 |
lemma nat_plus_as_int: "(+) = (\<lambda>a b. nat (int a + int b))" by (rule ext)+ simp |
136 |
lemma nat_minus_as_int: "(-) = (\<lambda>a b. nat (int a - int b))" by (rule ext)+ simp |
|
69064
5840724b1d71
Prefix form of infix with * on either side no longer needs special treatment
nipkow
parents:
67972
diff
changeset
|
137 |
lemma nat_times_as_int: "(*) = (\<lambda>a b. nat (int a * int b))" by (simp add: nat_mult_distrib) |
67399 | 138 |
lemma nat_div_as_int: "(div) = (\<lambda>a b. nat (int a div int b))" by (simp add: nat_div_distrib) |
139 |
lemma nat_mod_as_int: "(mod) = (\<lambda>a b. nat (int a mod int b))" by (simp add: nat_mod_distrib) |
|
66298 | 140 |
|
141 |
lemma int_Suc: "int (Suc n) = int n + 1" by simp |
|
142 |
lemma int_plus: "int (n + m) = int n + int m" by (rule of_nat_add) |
|
143 |
lemma int_minus: "int (n - m) = int (nat (int n - int m))" by auto |
|
144 |
||
67972
959b0aed2ce5
avoid adding unnecessary quantified lemmas when embedding natural number terms into integer terms: quantified lemmas can cause Z3 to produce complex proofs that are hard to replay in Isabelle
boehmes
parents:
67399
diff
changeset
|
145 |
lemma nat_int_comparison: |
959b0aed2ce5
avoid adding unnecessary quantified lemmas when embedding natural number terms into integer terms: quantified lemmas can cause Z3 to produce complex proofs that are hard to replay in Isabelle
boehmes
parents:
67399
diff
changeset
|
146 |
fixes a b :: nat |
959b0aed2ce5
avoid adding unnecessary quantified lemmas when embedding natural number terms into integer terms: quantified lemmas can cause Z3 to produce complex proofs that are hard to replay in Isabelle
boehmes
parents:
67399
diff
changeset
|
147 |
shows "(a = b) = (int a = int b)" |
959b0aed2ce5
avoid adding unnecessary quantified lemmas when embedding natural number terms into integer terms: quantified lemmas can cause Z3 to produce complex proofs that are hard to replay in Isabelle
boehmes
parents:
67399
diff
changeset
|
148 |
and "(a < b) = (int a < int b)" |
959b0aed2ce5
avoid adding unnecessary quantified lemmas when embedding natural number terms into integer terms: quantified lemmas can cause Z3 to produce complex proofs that are hard to replay in Isabelle
boehmes
parents:
67399
diff
changeset
|
149 |
and "(a \<le> b) = (int a \<le> int b)" |
959b0aed2ce5
avoid adding unnecessary quantified lemmas when embedding natural number terms into integer terms: quantified lemmas can cause Z3 to produce complex proofs that are hard to replay in Isabelle
boehmes
parents:
67399
diff
changeset
|
150 |
by simp_all |
959b0aed2ce5
avoid adding unnecessary quantified lemmas when embedding natural number terms into integer terms: quantified lemmas can cause Z3 to produce complex proofs that are hard to replay in Isabelle
boehmes
parents:
67399
diff
changeset
|
151 |
|
959b0aed2ce5
avoid adding unnecessary quantified lemmas when embedding natural number terms into integer terms: quantified lemmas can cause Z3 to produce complex proofs that are hard to replay in Isabelle
boehmes
parents:
67399
diff
changeset
|
152 |
lemma int_ops: |
959b0aed2ce5
avoid adding unnecessary quantified lemmas when embedding natural number terms into integer terms: quantified lemmas can cause Z3 to produce complex proofs that are hard to replay in Isabelle
boehmes
parents:
67399
diff
changeset
|
153 |
fixes a b :: nat |
959b0aed2ce5
avoid adding unnecessary quantified lemmas when embedding natural number terms into integer terms: quantified lemmas can cause Z3 to produce complex proofs that are hard to replay in Isabelle
boehmes
parents:
67399
diff
changeset
|
154 |
shows "int 0 = 0" |
959b0aed2ce5
avoid adding unnecessary quantified lemmas when embedding natural number terms into integer terms: quantified lemmas can cause Z3 to produce complex proofs that are hard to replay in Isabelle
boehmes
parents:
67399
diff
changeset
|
155 |
and "int 1 = 1" |
959b0aed2ce5
avoid adding unnecessary quantified lemmas when embedding natural number terms into integer terms: quantified lemmas can cause Z3 to produce complex proofs that are hard to replay in Isabelle
boehmes
parents:
67399
diff
changeset
|
156 |
and "int (numeral n) = numeral n" |
959b0aed2ce5
avoid adding unnecessary quantified lemmas when embedding natural number terms into integer terms: quantified lemmas can cause Z3 to produce complex proofs that are hard to replay in Isabelle
boehmes
parents:
67399
diff
changeset
|
157 |
and "int (Suc a) = int a + 1" |
959b0aed2ce5
avoid adding unnecessary quantified lemmas when embedding natural number terms into integer terms: quantified lemmas can cause Z3 to produce complex proofs that are hard to replay in Isabelle
boehmes
parents:
67399
diff
changeset
|
158 |
and "int (a + b) = int a + int b" |
959b0aed2ce5
avoid adding unnecessary quantified lemmas when embedding natural number terms into integer terms: quantified lemmas can cause Z3 to produce complex proofs that are hard to replay in Isabelle
boehmes
parents:
67399
diff
changeset
|
159 |
and "int (a - b) = (if int a < int b then 0 else int a - int b)" |
959b0aed2ce5
avoid adding unnecessary quantified lemmas when embedding natural number terms into integer terms: quantified lemmas can cause Z3 to produce complex proofs that are hard to replay in Isabelle
boehmes
parents:
67399
diff
changeset
|
160 |
and "int (a * b) = int a * int b" |
959b0aed2ce5
avoid adding unnecessary quantified lemmas when embedding natural number terms into integer terms: quantified lemmas can cause Z3 to produce complex proofs that are hard to replay in Isabelle
boehmes
parents:
67399
diff
changeset
|
161 |
and "int (a div b) = int a div int b" |
959b0aed2ce5
avoid adding unnecessary quantified lemmas when embedding natural number terms into integer terms: quantified lemmas can cause Z3 to produce complex proofs that are hard to replay in Isabelle
boehmes
parents:
67399
diff
changeset
|
162 |
and "int (a mod b) = int a mod int b" |
959b0aed2ce5
avoid adding unnecessary quantified lemmas when embedding natural number terms into integer terms: quantified lemmas can cause Z3 to produce complex proofs that are hard to replay in Isabelle
boehmes
parents:
67399
diff
changeset
|
163 |
by (auto intro: zdiv_int zmod_int) |
959b0aed2ce5
avoid adding unnecessary quantified lemmas when embedding natural number terms into integer terms: quantified lemmas can cause Z3 to produce complex proofs that are hard to replay in Isabelle
boehmes
parents:
67399
diff
changeset
|
164 |
|
959b0aed2ce5
avoid adding unnecessary quantified lemmas when embedding natural number terms into integer terms: quantified lemmas can cause Z3 to produce complex proofs that are hard to replay in Isabelle
boehmes
parents:
67399
diff
changeset
|
165 |
lemma int_if: |
959b0aed2ce5
avoid adding unnecessary quantified lemmas when embedding natural number terms into integer terms: quantified lemmas can cause Z3 to produce complex proofs that are hard to replay in Isabelle
boehmes
parents:
67399
diff
changeset
|
166 |
fixes a b :: nat |
959b0aed2ce5
avoid adding unnecessary quantified lemmas when embedding natural number terms into integer terms: quantified lemmas can cause Z3 to produce complex proofs that are hard to replay in Isabelle
boehmes
parents:
67399
diff
changeset
|
167 |
shows "int (if P then a else b) = (if P then int a else int b)" |
959b0aed2ce5
avoid adding unnecessary quantified lemmas when embedding natural number terms into integer terms: quantified lemmas can cause Z3 to produce complex proofs that are hard to replay in Isabelle
boehmes
parents:
67399
diff
changeset
|
168 |
by simp |
959b0aed2ce5
avoid adding unnecessary quantified lemmas when embedding natural number terms into integer terms: quantified lemmas can cause Z3 to produce complex proofs that are hard to replay in Isabelle
boehmes
parents:
67399
diff
changeset
|
169 |
|
56103
6689512f3710
move lemmas to theory file, towards textual proof reconstruction
blanchet
parents:
56102
diff
changeset
|
170 |
|
60758 | 171 |
subsection \<open>Integer division and modulo for Z3\<close> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
172 |
|
60758 | 173 |
text \<open> |
61799 | 174 |
The following Z3-inspired definitions are overspecified for the case where \<open>l = 0\<close>. This |
175 |
Schönheitsfehler is corrected in the \<open>div_as_z3div\<close> and \<open>mod_as_z3mod\<close> theorems. |
|
60758 | 176 |
\<close> |
56102 | 177 |
|
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
178 |
definition z3div :: "int \<Rightarrow> int \<Rightarrow> int" where |
56102 | 179 |
"z3div k l = (if l \<ge> 0 then k div l else - (k div - l))" |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
180 |
|
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
181 |
definition z3mod :: "int \<Rightarrow> int \<Rightarrow> int" where |
56102 | 182 |
"z3mod k l = k mod (if l \<ge> 0 then l else - l)" |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
183 |
|
56101 | 184 |
lemma div_as_z3div: |
56102 | 185 |
"\<forall>k l. k div l = (if l = 0 then 0 else if l > 0 then z3div k l else z3div (- k) (- l))" |
56101 | 186 |
by (simp add: z3div_def) |
187 |
||
188 |
lemma mod_as_z3mod: |
|
56102 | 189 |
"\<forall>k l. k mod l = (if l = 0 then k else if l > 0 then z3mod k l else - z3mod (- k) (- l))" |
56101 | 190 |
by (simp add: z3mod_def) |
191 |
||
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
192 |
|
69205
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
193 |
subsection \<open>Extra theorems for veriT reconstruction\<close> |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
194 |
|
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
195 |
lemma verit_sko_forall: \<open>(\<forall>x. P x) \<longleftrightarrow> P (SOME x. \<not>P x)\<close> |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
196 |
using someI[of \<open>\<lambda>x. \<not>P x\<close>] |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
197 |
by auto |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
198 |
|
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
199 |
lemma verit_sko_forall': \<open>P (SOME x. \<not>P x) = A \<Longrightarrow> (\<forall>x. P x) = A\<close> |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
200 |
by (subst verit_sko_forall) |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
201 |
|
72458
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
202 |
lemma verit_sko_forall'': \<open>B = A \<Longrightarrow> (SOME x. P x) = A \<equiv> (SOME x. P x) = B\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
203 |
by auto |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
204 |
|
69205
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
205 |
lemma verit_sko_forall_indirect: \<open>x = (SOME x. \<not>P x) \<Longrightarrow> (\<forall>x. P x) \<longleftrightarrow> P x\<close> |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
206 |
using someI[of \<open>\<lambda>x. \<not>P x\<close>] |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
207 |
by auto |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
208 |
|
72458
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
209 |
lemma verit_sko_forall_indirect2: |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
210 |
\<open>x = (SOME x. \<not>P x) \<Longrightarrow> (\<And>x :: 'a. (P x = P' x)) \<Longrightarrow>(\<forall>x. P' x) \<longleftrightarrow> P x\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
211 |
using someI[of \<open>\<lambda>x. \<not>P x\<close>] |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
212 |
by auto |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
213 |
|
69205
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
214 |
lemma verit_sko_ex: \<open>(\<exists>x. P x) \<longleftrightarrow> P (SOME x. P x)\<close> |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
215 |
using someI[of \<open>\<lambda>x. P x\<close>] |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
216 |
by auto |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
217 |
|
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
218 |
lemma verit_sko_ex': \<open>P (SOME x. P x) = A \<Longrightarrow> (\<exists>x. P x) = A\<close> |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
219 |
by (subst verit_sko_ex) |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
220 |
|
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
221 |
lemma verit_sko_ex_indirect: \<open>x = (SOME x. P x) \<Longrightarrow> (\<exists>x. P x) \<longleftrightarrow> P x\<close> |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
222 |
using someI[of \<open>\<lambda>x. P x\<close>] |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
223 |
by auto |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
224 |
|
72458
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
225 |
lemma verit_sko_ex_indirect2: \<open>x = (SOME x. P x) \<Longrightarrow> (\<And>x. P x = P' x) \<Longrightarrow> (\<exists>x. P' x) \<longleftrightarrow> P x\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
226 |
using someI[of \<open>\<lambda>x. P x\<close>] |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
227 |
by auto |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
228 |
|
69205
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
229 |
lemma verit_Pure_trans: |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
230 |
\<open>P \<equiv> Q \<Longrightarrow> Q \<Longrightarrow> P\<close> |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
231 |
by auto |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
232 |
|
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
233 |
lemma verit_if_cong: |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
234 |
assumes \<open>b \<equiv> c\<close> |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
235 |
and \<open>c \<Longrightarrow> x \<equiv> u\<close> |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
236 |
and \<open>\<not> c \<Longrightarrow> y \<equiv> v\<close> |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
237 |
shows \<open>(if b then x else y) \<equiv> (if c then u else v)\<close> |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
238 |
using assms if_cong[of b c x u] by auto |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
239 |
|
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
240 |
lemma verit_if_weak_cong': |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
241 |
\<open>b \<equiv> c \<Longrightarrow> (if b then x else y) \<equiv> (if c then x else y)\<close> |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
242 |
by auto |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
243 |
|
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
244 |
lemma verit_or_neg: |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
245 |
\<open>(A \<Longrightarrow> B) \<Longrightarrow> B \<or> \<not>A\<close> |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
246 |
\<open>(\<not>A \<Longrightarrow> B) \<Longrightarrow> B \<or> A\<close> |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
247 |
by auto |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
248 |
|
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
249 |
lemma verit_subst_bool: \<open>P \<Longrightarrow> f True \<Longrightarrow> f P\<close> |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
250 |
by auto |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
251 |
|
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
252 |
lemma verit_and_pos: |
72513
75f5c63f6cfa
better handling of skolemization for Isar reconstruction in Sledgehammer for veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72458
diff
changeset
|
253 |
\<open>(a \<Longrightarrow> \<not>(b \<and> c) \<or> A) \<Longrightarrow> \<not>(a \<and> b \<and> c) \<or> A\<close> |
75f5c63f6cfa
better handling of skolemization for Isar reconstruction in Sledgehammer for veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72458
diff
changeset
|
254 |
\<open>(a \<Longrightarrow> b \<Longrightarrow> A) \<Longrightarrow> \<not>(a \<and> b) \<or> A\<close> |
69205
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
255 |
\<open>(a \<Longrightarrow> A) \<Longrightarrow> \<not>a \<or> A\<close> |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
256 |
\<open>(\<not>a \<Longrightarrow> A) \<Longrightarrow> a \<or> A\<close> |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
257 |
by blast+ |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
258 |
|
72458
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
259 |
lemma verit_or_pos: |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
260 |
\<open>A \<and> A' \<Longrightarrow> (c \<and> A) \<or> (\<not>c \<and> A')\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
261 |
\<open>A \<and> A' \<Longrightarrow> (\<not>c \<and> A) \<or> (c \<and> A')\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
262 |
by blast+ |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
263 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
264 |
|
69205
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
265 |
lemma verit_la_generic: |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
266 |
\<open>(a::int) \<le> x \<or> a = x \<or> a \<ge> x\<close> |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
267 |
by linarith |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
268 |
|
72458
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
269 |
lemma verit_bfun_elim: |
69205
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
270 |
\<open>(if b then P True else P False) = P b\<close> |
72458
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
271 |
\<open>(\<forall>b. P' b) = (P' False \<and> P' True)\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
272 |
\<open>(\<exists>b. P' b) = (P' False \<or> P' True)\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
273 |
by (cases b) (auto simp: all_bool_eq ex_bool_eq) |
69205
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
274 |
|
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
275 |
lemma verit_eq_true_simplify: |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
276 |
\<open>(P = True) \<equiv> P\<close> |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
277 |
by auto |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
278 |
|
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
279 |
lemma verit_and_neg: |
72513
75f5c63f6cfa
better handling of skolemization for Isar reconstruction in Sledgehammer for veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72458
diff
changeset
|
280 |
\<open>(a \<Longrightarrow> \<not>b \<or> A) \<Longrightarrow> \<not>(a \<and> b) \<or> A\<close> |
75f5c63f6cfa
better handling of skolemization for Isar reconstruction in Sledgehammer for veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72458
diff
changeset
|
281 |
\<open>(a \<Longrightarrow> A) \<Longrightarrow> \<not>a \<or> A\<close> |
75f5c63f6cfa
better handling of skolemization for Isar reconstruction in Sledgehammer for veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72458
diff
changeset
|
282 |
\<open>(\<not>a \<Longrightarrow> A) \<Longrightarrow> a \<or> A\<close> |
75f5c63f6cfa
better handling of skolemization for Isar reconstruction in Sledgehammer for veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72458
diff
changeset
|
283 |
by blast+ |
69205
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
284 |
|
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
285 |
lemma verit_forall_inst: |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
286 |
\<open>A \<longleftrightarrow> B \<Longrightarrow> \<not>A \<or> B\<close> |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
287 |
\<open>\<not>A \<longleftrightarrow> B \<Longrightarrow> A \<or> B\<close> |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
288 |
\<open>A \<longleftrightarrow> B \<Longrightarrow> \<not>B \<or> A\<close> |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
289 |
\<open>A \<longleftrightarrow> \<not>B \<Longrightarrow> B \<or> A\<close> |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
290 |
\<open>A \<longrightarrow> B \<Longrightarrow> \<not>A \<or> B\<close> |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
291 |
\<open>\<not>A \<longrightarrow> B \<Longrightarrow> A \<or> B\<close> |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
292 |
by blast+ |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
293 |
|
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
294 |
lemma verit_eq_transitive: |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
295 |
\<open>A = B \<Longrightarrow> B = C \<Longrightarrow> A = C\<close> |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
296 |
\<open>A = B \<Longrightarrow> C = B \<Longrightarrow> A = C\<close> |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
297 |
\<open>B = A \<Longrightarrow> B = C \<Longrightarrow> A = C\<close> |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
298 |
\<open>B = A \<Longrightarrow> C = B \<Longrightarrow> A = C\<close> |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
299 |
by auto |
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
300 |
|
72458
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
301 |
lemma verit_bool_simplify: |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
302 |
\<open>\<not>(P \<longrightarrow> Q) \<longleftrightarrow> P \<and> \<not>Q\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
303 |
\<open>\<not>(P \<or> Q) \<longleftrightarrow> \<not>P \<and> \<not>Q\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
304 |
\<open>\<not>(P \<and> Q) \<longleftrightarrow> \<not>P \<or> \<not>Q\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
305 |
\<open>(P \<longrightarrow> (Q \<longrightarrow> R)) \<longleftrightarrow> ((P \<and> Q) \<longrightarrow> R)\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
306 |
\<open>((P \<longrightarrow> Q) \<longrightarrow> Q) \<longleftrightarrow> P \<or> Q\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
307 |
\<open>(Q \<longleftrightarrow> (P \<or> Q)) \<longleftrightarrow> (P \<longrightarrow> Q)\<close> \<comment> \<open>This rule was inverted\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
308 |
\<open>P \<and> (P \<longrightarrow> Q) \<longleftrightarrow> P \<and> Q\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
309 |
\<open>(P \<longrightarrow> Q) \<and> P \<longleftrightarrow> P \<and> Q\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
310 |
(* \<comment>\<open>Additional rules:\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
311 |
* \<open>((P \<longrightarrow> Q) \<longrightarrow> P) \<longleftrightarrow> P\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
312 |
* \<open>((P \<longrightarrow> Q) \<longrightarrow> Q) \<longleftrightarrow> P \<or> Q\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
313 |
* \<open>(P \<longrightarrow> Q) \<or> P\<close> *) |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
314 |
unfolding not_imp imp_conjL |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
315 |
by auto |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
316 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
317 |
text \<open>We need the last equation for \<^term>\<open>\<not>(\<forall>a b. \<not>P a b)\<close>\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
318 |
lemma verit_connective_def: \<comment> \<open>the definition of XOR is missing |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
319 |
as the operator is not generated by Isabelle\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
320 |
\<open>(A = B) \<longleftrightarrow> ((A \<longrightarrow> B) \<and> (B \<longrightarrow> A))\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
321 |
\<open>(If A B C) = ((A \<longrightarrow> B) \<and> (\<not>A \<longrightarrow> C))\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
322 |
\<open>(\<exists>x. P x) \<longleftrightarrow> \<not>(\<forall>x. \<not>P x)\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
323 |
\<open>\<not>(\<exists>x. P x) \<longleftrightarrow> (\<forall>x. \<not>P x)\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
324 |
by auto |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
325 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
326 |
lemma verit_ite_simplify: |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
327 |
\<open>(If True B C) = B\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
328 |
\<open>(If False B C) = C\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
329 |
\<open>(If A' B B) = B\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
330 |
\<open>(If (\<not>A') B C) = (If A' C B)\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
331 |
\<open>(If c (If c A B) C) = (If c A C)\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
332 |
\<open>(If c C (If c A B)) = (If c C B)\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
333 |
\<open>(If A' True False) = A'\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
334 |
\<open>(If A' False True) \<longleftrightarrow> \<not>A'\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
335 |
\<open>(If A' True B') \<longleftrightarrow> A'\<or>B'\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
336 |
\<open>(If A' B' False) \<longleftrightarrow> A'\<and>B'\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
337 |
\<open>(If A' False B') \<longleftrightarrow> \<not>A'\<and>B'\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
338 |
\<open>(If A' B' True) \<longleftrightarrow> \<not>A'\<or>B'\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
339 |
\<open>x \<and> True \<longleftrightarrow> x\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
340 |
\<open>x \<or> False \<longleftrightarrow> x\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
341 |
for B C :: 'a and A' B' C' :: bool |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
342 |
by auto |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
343 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
344 |
lemma verit_and_simplify1: |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
345 |
\<open>True \<and> b \<longleftrightarrow> b\<close> \<open>b \<and> True \<longleftrightarrow> b\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
346 |
\<open>False \<and> b \<longleftrightarrow> False\<close> \<open>b \<and> False \<longleftrightarrow> False\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
347 |
\<open>(c \<and> \<not>c) \<longleftrightarrow> False\<close> \<open>(\<not>c \<and> c) \<longleftrightarrow> False\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
348 |
\<open>\<not>\<not>a = a\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
349 |
by auto |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
350 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
351 |
lemmas verit_and_simplify = conj_ac de_Morgan_conj disj_not1 |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
352 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
353 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
354 |
lemma verit_or_simplify_1: |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
355 |
\<open>False \<or> b \<longleftrightarrow> b\<close> \<open>b \<or> False \<longleftrightarrow> b\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
356 |
\<open>b \<or> \<not>b\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
357 |
\<open>\<not>b \<or> b\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
358 |
by auto |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
359 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
360 |
lemmas verit_or_simplify = disj_ac |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
361 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
362 |
lemma verit_not_simplify: |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
363 |
\<open>\<not> \<not>b \<longleftrightarrow> b\<close> \<open>\<not>True \<longleftrightarrow> False\<close> \<open>\<not>False \<longleftrightarrow> True\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
364 |
by auto |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
365 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
366 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
367 |
lemma verit_implies_simplify: |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
368 |
\<open>(\<not>a \<longrightarrow> \<not>b) \<longleftrightarrow> (b \<longrightarrow> a)\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
369 |
\<open>(False \<longrightarrow> a) \<longleftrightarrow> True\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
370 |
\<open>(a \<longrightarrow> True) \<longleftrightarrow> True\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
371 |
\<open>(True \<longrightarrow> a) \<longleftrightarrow> a\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
372 |
\<open>(a \<longrightarrow> False) \<longleftrightarrow> \<not>a\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
373 |
\<open>(a \<longrightarrow> a) \<longleftrightarrow> True\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
374 |
\<open>(\<not>a \<longrightarrow> a) \<longleftrightarrow> a\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
375 |
\<open>(a \<longrightarrow> \<not>a) \<longleftrightarrow> \<not>a\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
376 |
\<open>((a \<longrightarrow> b) \<longrightarrow> b) \<longleftrightarrow> a \<or> b\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
377 |
by auto |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
378 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
379 |
lemma verit_equiv_simplify: |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
380 |
\<open>((\<not>a) = (\<not>b)) \<longleftrightarrow> (a = b)\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
381 |
\<open>(a = a) \<longleftrightarrow> True\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
382 |
\<open>(a = (\<not>a)) \<longleftrightarrow> False\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
383 |
\<open>((\<not>a) = a) \<longleftrightarrow> False\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
384 |
\<open>(True = a) \<longleftrightarrow> a\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
385 |
\<open>(a = True) \<longleftrightarrow> a\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
386 |
\<open>(False = a) \<longleftrightarrow> \<not>a\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
387 |
\<open>(a = False) \<longleftrightarrow> \<not>a\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
388 |
\<open>\<not>\<not>a \<longleftrightarrow> a\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
389 |
\<open>(\<not> False) = True\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
390 |
for a b :: bool |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
391 |
by auto |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
392 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
393 |
lemmas verit_eq_simplify = |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
394 |
semiring_char_0_class.eq_numeral_simps eq_refl zero_neq_one num.simps |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
395 |
neg_equal_zero equal_neg_zero one_neq_zero neg_equal_iff_equal |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
396 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
397 |
lemma verit_minus_simplify: |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
398 |
\<open>(a :: 'a :: cancel_comm_monoid_add) - a = 0\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
399 |
\<open>(a :: 'a :: cancel_comm_monoid_add) - 0 = a\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
400 |
\<open>0 - (b :: 'b :: {group_add}) = -b\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
401 |
\<open>- (- (b :: 'b :: group_add)) = b\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
402 |
by auto |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
403 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
404 |
lemma verit_sum_simplify: |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
405 |
\<open>(a :: 'a :: cancel_comm_monoid_add) + 0 = a\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
406 |
by auto |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
407 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
408 |
lemmas verit_prod_simplify = |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
409 |
(* already included: |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
410 |
mult_zero_class.mult_zero_right |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
411 |
mult_zero_class.mult_zero_left *) |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
412 |
mult_1 |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
413 |
mult_1_right |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
414 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
415 |
lemma verit_comp_simplify1: |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
416 |
\<open>(a :: 'a ::order) < a \<longleftrightarrow> False\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
417 |
\<open>a \<le> a\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
418 |
\<open>\<not>(b' \<le> a') \<longleftrightarrow> (a' :: 'b :: linorder) < b'\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
419 |
by auto |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
420 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
421 |
lemmas verit_comp_simplify = |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
422 |
verit_comp_simplify1 |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
423 |
le_numeral_simps |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
424 |
le_num_simps |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
425 |
less_numeral_simps |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
426 |
less_num_simps |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
427 |
zero_less_one |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
428 |
zero_le_one |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
429 |
less_neg_numeral_simps |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
430 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
431 |
lemma verit_la_disequality: |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
432 |
\<open>(a :: 'a ::linorder) = b \<or> \<not>a \<le> b \<or> \<not>b \<le> a\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
433 |
by auto |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
434 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
435 |
context |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
436 |
begin |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
437 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
438 |
text \<open>For the reconstruction, we need to keep the order of the arguments.\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
439 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
440 |
named_theorems smt_arith_multiplication \<open>Theorems to reconstruct arithmetic theorems.\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
441 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
442 |
named_theorems smt_arith_combine \<open>Theorems to reconstruct arithmetic theorems.\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
443 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
444 |
named_theorems smt_arith_simplify \<open>Theorems to combine theorems in the LA procedure\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
445 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
446 |
lemmas [smt_arith_simplify] = |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
447 |
div_add dvd_numeral_simp divmod_steps less_num_simps le_num_simps if_True if_False divmod_cancel |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
448 |
dvd_mult dvd_mult2 less_irrefl prod.case numeral_plus_one divmod_step_eq order.refl le_zero_eq |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
449 |
le_numeral_simps less_numeral_simps mult.right_neutral simp_thms divides_aux_eq |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
450 |
mult_nonneg_nonneg dvd_imp_mod_0 dvd_add zero_less_one mod_mult_self4 numeral_mod_numeral |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
451 |
divmod_trivial prod.sel mult.left_neutral div_pos_pos_trivial arith_simps div_add div_mult_self1 |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
452 |
add_le_cancel_left add_le_same_cancel2 not_one_le_zero le_numeral_simps add_le_same_cancel1 |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
453 |
zero_neq_one zero_le_one le_num_simps add_Suc mod_div_trivial nat.distinct mult_minus_right |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
454 |
add.inverse_inverse distrib_left_numeral mult_num_simps numeral_times_numeral add_num_simps |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
455 |
divmod_steps rel_simps if_True if_False numeral_div_numeral divmod_cancel prod.case |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
456 |
add_num_simps one_plus_numeral fst_conv divmod_step_eq arith_simps sub_num_simps dbl_inc_simps |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
457 |
dbl_simps mult_1 add_le_cancel_right left_diff_distrib_numeral add_uminus_conv_diff zero_neq_one |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
458 |
zero_le_one One_nat_def add_Suc mod_div_trivial nat.distinct of_int_1 numerals numeral_One |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
459 |
of_int_numeral add_uminus_conv_diff zle_diff1_eq add_less_same_cancel2 minus_add_distrib |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
460 |
add_uminus_conv_diff mult.left_neutral semiring_class.distrib_right |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
461 |
add_diff_cancel_left' add_diff_eq ring_distribs mult_minus_left minus_diff_eq |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
462 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
463 |
lemma [smt_arith_simplify]: |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
464 |
\<open>\<not> (a' :: 'a :: linorder) < b' \<longleftrightarrow> b' \<le> a'\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
465 |
\<open>\<not> (a' :: 'a :: linorder) \<le> b' \<longleftrightarrow> b' < a'\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
466 |
\<open>(c::int) mod Numeral1 = 0\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
467 |
\<open>(a::nat) mod Numeral1 = 0\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
468 |
\<open>(c::int) div Numeral1 = c\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
469 |
\<open>a div Numeral1 = a\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
470 |
\<open>(c::int) mod 1 = 0\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
471 |
\<open>a mod 1 = 0\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
472 |
\<open>(c::int) div 1 = c\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
473 |
\<open>a div 1 = a\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
474 |
\<open>\<not>(a' \<noteq> b') \<longleftrightarrow> a' = b'\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
475 |
by auto |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
476 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
477 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
478 |
lemma div_mod_decomp: "A = (A div n) * n + (A mod n)" for A :: nat |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
479 |
by auto |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
480 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
481 |
lemma div_less_mono: |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
482 |
fixes A B :: nat |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
483 |
assumes "A < B" "0 < n" and |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
484 |
mod: "A mod n = 0""B mod n = 0" |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
485 |
shows "(A div n) < (B div n)" |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
486 |
proof - |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
487 |
show ?thesis |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
488 |
using assms(1) |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
489 |
apply (subst (asm) div_mod_decomp[of "A" n]) |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
490 |
apply (subst (asm) div_mod_decomp[of "B" n]) |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
491 |
unfolding mod |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
492 |
by (use assms(2,3) in \<open>auto simp: ac_simps\<close>) |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
493 |
qed |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
494 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
495 |
lemma verit_le_mono_div: |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
496 |
fixes A B :: nat |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
497 |
assumes "A < B" "0 < n" |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
498 |
shows "(A div n) + (if B mod n = 0 then 1 else 0) \<le> (B div n)" |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
499 |
by (auto simp: ac_simps Suc_leI assms less_mult_imp_div_less div_le_mono less_imp_le_nat) |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
500 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
501 |
lemmas [smt_arith_multiplication] = |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
502 |
verit_le_mono_div[THEN mult_le_mono1, unfolded add_mult_distrib] |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
503 |
div_le_mono[THEN mult_le_mono2, unfolded add_mult_distrib] |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
504 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
505 |
lemma div_mod_decomp_int: "A = (A div n) * n + (A mod n)" for A :: int |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
506 |
by auto |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
507 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
508 |
lemma zdiv_mono_strict: |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
509 |
fixes A B :: int |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
510 |
assumes "A < B" "0 < n" and |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
511 |
mod: "A mod n = 0""B mod n = 0" |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
512 |
shows "(A div n) < (B div n)" |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
513 |
proof - |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
514 |
show ?thesis |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
515 |
using assms(1) |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
516 |
apply (subst (asm) div_mod_decomp_int[of A n]) |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
517 |
apply (subst (asm) div_mod_decomp_int[of B n]) |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
518 |
unfolding mod |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
519 |
by (use assms(2,3) in \<open>auto simp: ac_simps\<close>) |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
520 |
qed |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
521 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
522 |
lemma verit_le_mono_div_int: |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
523 |
fixes A B :: int |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
524 |
assumes "A < B" "0 < n" |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
525 |
shows "(A div n) + (if B mod n = 0 then 1 else 0) \<le> (B div n)" |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
526 |
proof - |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
527 |
have f2: "B div n = A div n \<or> A div n < B div n" |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
528 |
by (metis (no_types) assms less_le zdiv_mono1) |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
529 |
have "B div n \<noteq> A div n \<or> B mod n \<noteq> 0" |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
530 |
using assms(1) by (metis Groups.add_ac(2) assms(2) eucl_rel_int eucl_rel_int_iff |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
531 |
group_cancel.rule0 le_add_same_cancel2 not_le) |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
532 |
then have "B mod n = 0 \<longrightarrow> A div n + (if B mod n = 0 then 1 else 0) \<le> B div n" |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
533 |
using f2 by (auto dest: zless_imp_add1_zle) |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
534 |
then show ?thesis |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
535 |
using assms zdiv_mono1 by auto |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
536 |
qed |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
537 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
538 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
539 |
lemma verit_less_mono_div_int2: |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
540 |
fixes A B :: int |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
541 |
assumes "A \<le> B" "0 < -n" |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
542 |
shows "(A div n) \<ge> (B div n)" |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
543 |
using assms(1) assms(2) zdiv_mono1_neg by auto |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
544 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
545 |
lemmas [smt_arith_multiplication] = |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
546 |
verit_le_mono_div_int[THEN mult_left_mono, unfolded int_distrib] |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
547 |
zdiv_mono1[THEN mult_left_mono, unfolded int_distrib] |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
548 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
549 |
lemmas [smt_arith_multiplication] = |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
550 |
arg_cong[of _ _ \<open>\<lambda>a :: nat. a div n * p\<close> for n p :: nat, THEN sym] |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
551 |
arg_cong[of _ _ \<open>\<lambda>a :: int. a div n * p\<close> for n p :: int, THEN sym] |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
552 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
553 |
lemma [smt_arith_combine]: |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
554 |
"a < b \<Longrightarrow> c < d \<Longrightarrow> a + c + 2 \<le> b + d" |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
555 |
"a < b \<Longrightarrow> c \<le> d \<Longrightarrow> a + c + 1 \<le> b + d" |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
556 |
"a \<le> b \<Longrightarrow> c < d \<Longrightarrow> a + c + 1 \<le> b + d" for a b c :: int |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
557 |
by auto |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
558 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
559 |
lemma [smt_arith_combine]: |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
560 |
"a < b \<Longrightarrow> c < d \<Longrightarrow> a + c + 2 \<le> b + d" |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
561 |
"a < b \<Longrightarrow> c \<le> d \<Longrightarrow> a + c + 1 \<le> b + d" |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
562 |
"a \<le> b \<Longrightarrow> c < d \<Longrightarrow> a + c + 1 \<le> b + d" for a b c :: nat |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
563 |
by auto |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
564 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
565 |
lemmas [smt_arith_combine] = |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
566 |
add_strict_mono |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
567 |
add_less_le_mono |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
568 |
add_mono |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
569 |
add_le_less_mono |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
570 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
571 |
lemma [smt_arith_combine]: |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
572 |
\<open>m < n \<Longrightarrow> c = d \<Longrightarrow> m + c < n + d\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
573 |
\<open>m \<le> n \<Longrightarrow> c = d \<Longrightarrow> m + c \<le> n + d\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
574 |
\<open>c = d \<Longrightarrow> m < n \<Longrightarrow> m + c < n + d\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
575 |
\<open>c = d \<Longrightarrow> m \<le> n \<Longrightarrow> m + c \<le> n + d\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
576 |
for m :: \<open>'a :: ordered_cancel_ab_semigroup_add\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
577 |
by (auto intro: ordered_cancel_ab_semigroup_add_class.add_strict_right_mono |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
578 |
ordered_ab_semigroup_add_class.add_right_mono) |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
579 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
580 |
lemma verit_negate_coefficient: |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
581 |
\<open>a \<le> (b :: 'a :: {ordered_ab_group_add}) \<Longrightarrow> -a \<ge> -b\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
582 |
\<open>a < b \<Longrightarrow> -a > -b\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
583 |
\<open>a = b \<Longrightarrow> -a = -b\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
584 |
by auto |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
585 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
586 |
end |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
587 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
588 |
lemma verit_ite_intro: |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
589 |
\<open>(if a then P (if a then a' else b') else Q) \<longleftrightarrow> (if a then P a' else Q)\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
590 |
\<open>(if a then P' else Q' (if a then a' else b')) \<longleftrightarrow> (if a then P' else Q' b')\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
591 |
\<open>A = f (if a then R else S) \<longleftrightarrow> (if a then A = f R else A = f S)\<close> |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
592 |
by auto |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
593 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
594 |
lemma verit_ite_if_cong: |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
595 |
fixes x y :: bool |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
596 |
assumes "b=c" |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
597 |
and "c \<equiv> True \<Longrightarrow> x = u" |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
598 |
and "c \<equiv> False \<Longrightarrow> y = v" |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
599 |
shows "(if b then x else y) \<equiv> (if c then u else v)" |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
600 |
proof - |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
601 |
have H: "(if b then x else y) = (if c then u else v)" |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
602 |
using assms by (auto split: if_splits) |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
603 |
|
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
604 |
show "(if b then x else y) \<equiv> (if c then u else v)" |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
605 |
by (subst H) auto |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
606 |
qed |
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
607 |
|
69205
8050734eee3e
add reconstruction by veriT in method smt
fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
69204
diff
changeset
|
608 |
|
60758 | 609 |
subsection \<open>Setup\<close> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
610 |
|
69605 | 611 |
ML_file \<open>Tools/SMT/smt_util.ML\<close> |
612 |
ML_file \<open>Tools/SMT/smt_failure.ML\<close> |
|
613 |
ML_file \<open>Tools/SMT/smt_config.ML\<close> |
|
614 |
ML_file \<open>Tools/SMT/smt_builtin.ML\<close> |
|
615 |
ML_file \<open>Tools/SMT/smt_datatypes.ML\<close> |
|
616 |
ML_file \<open>Tools/SMT/smt_normalize.ML\<close> |
|
617 |
ML_file \<open>Tools/SMT/smt_translate.ML\<close> |
|
618 |
ML_file \<open>Tools/SMT/smtlib.ML\<close> |
|
619 |
ML_file \<open>Tools/SMT/smtlib_interface.ML\<close> |
|
620 |
ML_file \<open>Tools/SMT/smtlib_proof.ML\<close> |
|
621 |
ML_file \<open>Tools/SMT/smtlib_isar.ML\<close> |
|
622 |
ML_file \<open>Tools/SMT/z3_proof.ML\<close> |
|
623 |
ML_file \<open>Tools/SMT/z3_isar.ML\<close> |
|
624 |
ML_file \<open>Tools/SMT/smt_solver.ML\<close> |
|
625 |
ML_file \<open>Tools/SMT/cvc4_interface.ML\<close> |
|
626 |
ML_file \<open>Tools/SMT/cvc4_proof_parse.ML\<close> |
|
627 |
ML_file \<open>Tools/SMT/verit_proof.ML\<close> |
|
628 |
ML_file \<open>Tools/SMT/verit_isar.ML\<close> |
|
629 |
ML_file \<open>Tools/SMT/verit_proof_parse.ML\<close> |
|
630 |
ML_file \<open>Tools/SMT/conj_disj_perm.ML\<close> |
|
631 |
ML_file \<open>Tools/SMT/smt_replay_methods.ML\<close> |
|
632 |
ML_file \<open>Tools/SMT/smt_replay.ML\<close> |
|
72458
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
633 |
ML_file \<open>Tools/SMT/smt_replay_arith.ML\<close> |
69605 | 634 |
ML_file \<open>Tools/SMT/z3_interface.ML\<close> |
635 |
ML_file \<open>Tools/SMT/z3_replay_rules.ML\<close> |
|
636 |
ML_file \<open>Tools/SMT/z3_replay_methods.ML\<close> |
|
637 |
ML_file \<open>Tools/SMT/z3_replay.ML\<close> |
|
638 |
ML_file \<open>Tools/SMT/verit_replay_methods.ML\<close> |
|
639 |
ML_file \<open>Tools/SMT/verit_replay.ML\<close> |
|
640 |
ML_file \<open>Tools/SMT/smt_systems.ML\<close> |
|
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
641 |
|
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
642 |
|
60758 | 643 |
subsection \<open>Configuration\<close> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
644 |
|
60758 | 645 |
text \<open> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
646 |
The current configuration can be printed by the command |
61799 | 647 |
\<open>smt_status\<close>, which shows the values of most options. |
60758 | 648 |
\<close> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
649 |
|
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
650 |
|
60758 | 651 |
subsection \<open>General configuration options\<close> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
652 |
|
60758 | 653 |
text \<open> |
61799 | 654 |
The option \<open>smt_solver\<close> can be used to change the target SMT |
655 |
solver. The possible values can be obtained from the \<open>smt_status\<close> |
|
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
656 |
command. |
60758 | 657 |
\<close> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
658 |
|
58061 | 659 |
declare [[smt_solver = z3]] |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
660 |
|
60758 | 661 |
text \<open> |
57696
fb71c6f100f8
do not embed 'nat' into 'int's in 'smt2' method -- this is highly inefficient and decreases the Sledgehammer success rate significantly
blanchet
parents:
57246
diff
changeset
|
662 |
Since SMT solvers are potentially nonterminating, there is a timeout |
fb71c6f100f8
do not embed 'nat' into 'int's in 'smt2' method -- this is highly inefficient and decreases the Sledgehammer success rate significantly
blanchet
parents:
57246
diff
changeset
|
663 |
(given in seconds) to restrict their runtime. |
60758 | 664 |
\<close> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
665 |
|
73389 | 666 |
declare [[smt_timeout = 0]] |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
667 |
|
60758 | 668 |
text \<open> |
57696
fb71c6f100f8
do not embed 'nat' into 'int's in 'smt2' method -- this is highly inefficient and decreases the Sledgehammer success rate significantly
blanchet
parents:
57246
diff
changeset
|
669 |
SMT solvers apply randomized heuristics. In case a problem is not |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
670 |
solvable by an SMT solver, changing the following option might help. |
60758 | 671 |
\<close> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
672 |
|
58061 | 673 |
declare [[smt_random_seed = 1]] |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
674 |
|
60758 | 675 |
text \<open> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
676 |
In general, the binding to SMT solvers runs as an oracle, i.e, the SMT |
57696
fb71c6f100f8
do not embed 'nat' into 'int's in 'smt2' method -- this is highly inefficient and decreases the Sledgehammer success rate significantly
blanchet
parents:
57246
diff
changeset
|
677 |
solvers are fully trusted without additional checks. The following |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
678 |
option can cause the SMT solver to run in proof-producing mode, giving |
57696
fb71c6f100f8
do not embed 'nat' into 'int's in 'smt2' method -- this is highly inefficient and decreases the Sledgehammer success rate significantly
blanchet
parents:
57246
diff
changeset
|
679 |
a checkable certificate. This is currently only implemented for Z3. |
60758 | 680 |
\<close> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
681 |
|
58061 | 682 |
declare [[smt_oracle = false]] |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
683 |
|
60758 | 684 |
text \<open> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
685 |
Each SMT solver provides several commandline options to tweak its |
57696
fb71c6f100f8
do not embed 'nat' into 'int's in 'smt2' method -- this is highly inefficient and decreases the Sledgehammer success rate significantly
blanchet
parents:
57246
diff
changeset
|
686 |
behaviour. They can be passed to the solver by setting the following |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
687 |
options. |
60758 | 688 |
\<close> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
689 |
|
58061 | 690 |
declare [[cvc3_options = ""]] |
66323
c41642bc1ebb
pass option recommended by Andy Reynolds to CVC4 1.5 (released) or better
blanchet
parents:
66298
diff
changeset
|
691 |
declare [[cvc4_options = "--full-saturate-quant --inst-when=full-last-call --inst-no-entail --term-db-mode=relevant --multi-trigger-linear"]] |
72458
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
692 |
declare [[verit_options = ""]] |
58061 | 693 |
declare [[z3_options = ""]] |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
694 |
|
60758 | 695 |
text \<open> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
696 |
The SMT method provides an inference mechanism to detect simple triggers |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
697 |
in quantified formulas, which might increase the number of problems |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
698 |
solvable by SMT solvers (note: triggers guide quantifier instantiations |
57696
fb71c6f100f8
do not embed 'nat' into 'int's in 'smt2' method -- this is highly inefficient and decreases the Sledgehammer success rate significantly
blanchet
parents:
57246
diff
changeset
|
699 |
in the SMT solver). To turn it on, set the following option. |
60758 | 700 |
\<close> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
701 |
|
58061 | 702 |
declare [[smt_infer_triggers = false]] |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
703 |
|
60758 | 704 |
text \<open> |
58360 | 705 |
Enable the following option to use built-in support for datatypes, |
706 |
codatatypes, and records in CVC4. Currently, this is implemented only |
|
707 |
in oracle mode. |
|
60758 | 708 |
\<close> |
58360 | 709 |
|
710 |
declare [[cvc4_extensions = false]] |
|
711 |
||
60758 | 712 |
text \<open> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
713 |
Enable the following option to use built-in support for div/mod, datatypes, |
57696
fb71c6f100f8
do not embed 'nat' into 'int's in 'smt2' method -- this is highly inefficient and decreases the Sledgehammer success rate significantly
blanchet
parents:
57246
diff
changeset
|
714 |
and records in Z3. Currently, this is implemented only in oracle mode. |
60758 | 715 |
\<close> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
716 |
|
58061 | 717 |
declare [[z3_extensions = false]] |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
718 |
|
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
719 |
|
60758 | 720 |
subsection \<open>Certificates\<close> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
721 |
|
60758 | 722 |
text \<open> |
61799 | 723 |
By setting the option \<open>smt_certificates\<close> to the name of a file, |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
724 |
all following applications of an SMT solver a cached in that file. |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
725 |
Any further application of the same SMT solver (using the very same |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
726 |
configuration) re-uses the cached certificate instead of invoking the |
57696
fb71c6f100f8
do not embed 'nat' into 'int's in 'smt2' method -- this is highly inefficient and decreases the Sledgehammer success rate significantly
blanchet
parents:
57246
diff
changeset
|
727 |
solver. An empty string disables caching certificates. |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
728 |
|
57696
fb71c6f100f8
do not embed 'nat' into 'int's in 'smt2' method -- this is highly inefficient and decreases the Sledgehammer success rate significantly
blanchet
parents:
57246
diff
changeset
|
729 |
The filename should be given as an explicit path. It is good |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
730 |
practice to use the name of the current theory (with ending |
61799 | 731 |
\<open>.certs\<close> instead of \<open>.thy\<close>) as the certificates file. |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
732 |
Certificate files should be used at most once in a certain theory context, |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
733 |
to avoid race conditions with other concurrent accesses. |
60758 | 734 |
\<close> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
735 |
|
58061 | 736 |
declare [[smt_certificates = ""]] |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
737 |
|
60758 | 738 |
text \<open> |
61799 | 739 |
The option \<open>smt_read_only_certificates\<close> controls whether only |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
740 |
stored certificates are should be used or invocation of an SMT solver |
61799 | 741 |
is allowed. When set to \<open>true\<close>, no SMT solver will ever be |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
742 |
invoked and only the existing certificates found in the configured |
61799 | 743 |
cache are used; when set to \<open>false\<close> and there is no cached |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
744 |
certificate for some proposition, then the configured SMT solver is |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
745 |
invoked. |
60758 | 746 |
\<close> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
747 |
|
58061 | 748 |
declare [[smt_read_only_certificates = false]] |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
749 |
|
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
750 |
|
60758 | 751 |
subsection \<open>Tracing\<close> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
752 |
|
60758 | 753 |
text \<open> |
57696
fb71c6f100f8
do not embed 'nat' into 'int's in 'smt2' method -- this is highly inefficient and decreases the Sledgehammer success rate significantly
blanchet
parents:
57246
diff
changeset
|
754 |
The SMT method, when applied, traces important information. To |
61799 | 755 |
make it entirely silent, set the following option to \<open>false\<close>. |
60758 | 756 |
\<close> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
757 |
|
58061 | 758 |
declare [[smt_verbose = true]] |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
759 |
|
60758 | 760 |
text \<open> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
761 |
For tracing the generated problem file given to the SMT solver as |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
762 |
well as the returned result of the solver, the option |
61799 | 763 |
\<open>smt_trace\<close> should be set to \<open>true\<close>. |
60758 | 764 |
\<close> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
765 |
|
58061 | 766 |
declare [[smt_trace = false]] |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
767 |
|
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
768 |
|
60758 | 769 |
subsection \<open>Schematic rules for Z3 proof reconstruction\<close> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
770 |
|
60758 | 771 |
text \<open> |
57696
fb71c6f100f8
do not embed 'nat' into 'int's in 'smt2' method -- this is highly inefficient and decreases the Sledgehammer success rate significantly
blanchet
parents:
57246
diff
changeset
|
772 |
Several prof rules of Z3 are not very well documented. There are two |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
773 |
lemma groups which can turn failing Z3 proof reconstruction attempts |
61799 | 774 |
into succeeding ones: the facts in \<open>z3_rule\<close> are tried prior to |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
775 |
any implemented reconstruction procedure for all uncertain Z3 proof |
61799 | 776 |
rules; the facts in \<open>z3_simp\<close> are only fed to invocations of |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
777 |
the simplifier when reconstructing theory-specific proof steps. |
60758 | 778 |
\<close> |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
779 |
|
58061 | 780 |
lemmas [z3_rule] = |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
781 |
refl eq_commute conj_commute disj_commute simp_thms nnf_simps |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
782 |
ring_distribs field_simps times_divide_eq_right times_divide_eq_left |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
783 |
if_True if_False not_not |
58776
95e58e04e534
use NO_MATCH-simproc for distribution rules in field_simps, otherwise field_simps on '(a / (c + d)) * (e + f)' can be non-terminating
hoelzl
parents:
58598
diff
changeset
|
784 |
NO_MATCH_def |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
785 |
|
58061 | 786 |
lemma [z3_rule]: |
57169 | 787 |
"(P \<and> Q) = (\<not> (\<not> P \<or> \<not> Q))" |
788 |
"(P \<and> Q) = (\<not> (\<not> Q \<or> \<not> P))" |
|
789 |
"(\<not> P \<and> Q) = (\<not> (P \<or> \<not> Q))" |
|
790 |
"(\<not> P \<and> Q) = (\<not> (\<not> Q \<or> P))" |
|
791 |
"(P \<and> \<not> Q) = (\<not> (\<not> P \<or> Q))" |
|
792 |
"(P \<and> \<not> Q) = (\<not> (Q \<or> \<not> P))" |
|
793 |
"(\<not> P \<and> \<not> Q) = (\<not> (P \<or> Q))" |
|
794 |
"(\<not> P \<and> \<not> Q) = (\<not> (Q \<or> P))" |
|
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
795 |
by auto |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
796 |
|
58061 | 797 |
lemma [z3_rule]: |
57169 | 798 |
"(P \<longrightarrow> Q) = (Q \<or> \<not> P)" |
799 |
"(\<not> P \<longrightarrow> Q) = (P \<or> Q)" |
|
800 |
"(\<not> P \<longrightarrow> Q) = (Q \<or> P)" |
|
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
801 |
"(True \<longrightarrow> P) = P" |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
802 |
"(P \<longrightarrow> True) = True" |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
803 |
"(False \<longrightarrow> P) = True" |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
804 |
"(P \<longrightarrow> P) = True" |
59037
650dcf624729
added Z3 reconstruction rule suggested by F. Maric
blanchet
parents:
59036
diff
changeset
|
805 |
"(\<not> (A \<longleftrightarrow> \<not> B)) \<longleftrightarrow> (A \<longleftrightarrow> B)" |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
806 |
by auto |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
807 |
|
58061 | 808 |
lemma [z3_rule]: |
67091 | 809 |
"((P = Q) \<longrightarrow> R) = (R \<or> (Q = (\<not> P)))" |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
810 |
by auto |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
811 |
|
58061 | 812 |
lemma [z3_rule]: |
57169 | 813 |
"(\<not> True) = False" |
814 |
"(\<not> False) = True" |
|
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
815 |
"(x = x) = True" |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
816 |
"(P = True) = P" |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
817 |
"(True = P) = P" |
57169 | 818 |
"(P = False) = (\<not> P)" |
819 |
"(False = P) = (\<not> P)" |
|
820 |
"((\<not> P) = P) = False" |
|
821 |
"(P = (\<not> P)) = False" |
|
822 |
"((\<not> P) = (\<not> Q)) = (P = Q)" |
|
823 |
"\<not> (P = (\<not> Q)) = (P = Q)" |
|
824 |
"\<not> ((\<not> P) = Q) = (P = Q)" |
|
825 |
"(P \<noteq> Q) = (Q = (\<not> P))" |
|
826 |
"(P = Q) = ((\<not> P \<or> Q) \<and> (P \<or> \<not> Q))" |
|
827 |
"(P \<noteq> Q) = ((\<not> P \<or> \<not> Q) \<and> (P \<or> Q))" |
|
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
828 |
by auto |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
829 |
|
58061 | 830 |
lemma [z3_rule]: |
57169 | 831 |
"(if P then P else \<not> P) = True" |
832 |
"(if \<not> P then \<not> P else P) = True" |
|
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
833 |
"(if P then True else False) = P" |
57169 | 834 |
"(if P then False else True) = (\<not> P)" |
835 |
"(if P then Q else True) = ((\<not> P) \<or> Q)" |
|
836 |
"(if P then Q else True) = (Q \<or> (\<not> P))" |
|
837 |
"(if P then Q else \<not> Q) = (P = Q)" |
|
838 |
"(if P then Q else \<not> Q) = (Q = P)" |
|
839 |
"(if P then \<not> Q else Q) = (P = (\<not> Q))" |
|
840 |
"(if P then \<not> Q else Q) = ((\<not> Q) = P)" |
|
841 |
"(if \<not> P then x else y) = (if P then y else x)" |
|
842 |
"(if P then (if Q then x else y) else x) = (if P \<and> (\<not> Q) then y else x)" |
|
843 |
"(if P then (if Q then x else y) else x) = (if (\<not> Q) \<and> P then y else x)" |
|
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
844 |
"(if P then (if Q then x else y) else y) = (if P \<and> Q then x else y)" |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
845 |
"(if P then (if Q then x else y) else y) = (if Q \<and> P then x else y)" |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
846 |
"(if P then x else if P then y else z) = (if P then x else z)" |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
847 |
"(if P then x else if Q then x else y) = (if P \<or> Q then x else y)" |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
848 |
"(if P then x else if Q then x else y) = (if Q \<or> P then x else y)" |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
849 |
"(if P then x = y else x = z) = (x = (if P then y else z))" |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
850 |
"(if P then x = y else y = z) = (y = (if P then x else z))" |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
851 |
"(if P then x = y else z = y) = (y = (if P then x else z))" |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
852 |
by auto |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
853 |
|
58061 | 854 |
lemma [z3_rule]: |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
855 |
"0 + (x::int) = x" |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
856 |
"x + 0 = x" |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
857 |
"x + x = 2 * x" |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
858 |
"0 * x = 0" |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
859 |
"1 * x = x" |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
860 |
"x + y = y + x" |
72458
b44e894796d5
add reconstruction for the SMT solver veriT
Mathias Fleury <Mathias.Fleury@mpi-inf.mpg.de>
parents:
72343
diff
changeset
|
861 |
by auto |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
862 |
|
58061 | 863 |
lemma [z3_rule]: (* for def-axiom *) |
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
864 |
"P = Q \<or> P \<or> Q" |
57169 | 865 |
"P = Q \<or> \<not> P \<or> \<not> Q" |
866 |
"(\<not> P) = Q \<or> \<not> P \<or> Q" |
|
867 |
"(\<not> P) = Q \<or> P \<or> \<not> Q" |
|
868 |
"P = (\<not> Q) \<or> \<not> P \<or> Q" |
|
869 |
"P = (\<not> Q) \<or> P \<or> \<not> Q" |
|
870 |
"P \<noteq> Q \<or> P \<or> \<not> Q" |
|
871 |
"P \<noteq> Q \<or> \<not> P \<or> Q" |
|
872 |
"P \<noteq> (\<not> Q) \<or> P \<or> Q" |
|
873 |
"(\<not> P) \<noteq> Q \<or> P \<or> Q" |
|
874 |
"P \<or> Q \<or> P \<noteq> (\<not> Q)" |
|
875 |
"P \<or> Q \<or> (\<not> P) \<noteq> Q" |
|
876 |
"P \<or> \<not> Q \<or> P \<noteq> Q" |
|
877 |
"\<not> P \<or> Q \<or> P \<noteq> Q" |
|
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
878 |
"P \<or> y = (if P then x else y)" |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
879 |
"P \<or> (if P then x else y) = y" |
57169 | 880 |
"\<not> P \<or> x = (if P then x else y)" |
881 |
"\<not> P \<or> (if P then x else y) = x" |
|
882 |
"P \<or> R \<or> \<not> (if P then Q else R)" |
|
883 |
"\<not> P \<or> Q \<or> \<not> (if P then Q else R)" |
|
884 |
"\<not> (if P then Q else R) \<or> \<not> P \<or> Q" |
|
885 |
"\<not> (if P then Q else R) \<or> P \<or> R" |
|
886 |
"(if P then Q else R) \<or> \<not> P \<or> \<not> Q" |
|
887 |
"(if P then Q else R) \<or> P \<or> \<not> R" |
|
888 |
"(if P then \<not> Q else R) \<or> \<not> P \<or> Q" |
|
889 |
"(if P then Q else \<not> R) \<or> P \<or> R" |
|
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
890 |
by auto |
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
891 |
|
57230 | 892 |
hide_type (open) symb_list pattern |
893 |
hide_const (open) Symb_Nil Symb_Cons trigger pat nopat fun_app z3div z3mod |
|
56078
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
894 |
|
624faeda77b5
moved 'SMT2' (SMT-LIB-2-based SMT module) into Isabelle
blanchet
parents:
diff
changeset
|
895 |
end |