author | blanchet |
Sun, 27 Jul 2014 21:11:35 +0200 | |
changeset 57696 | fb71c6f100f8 |
parent 57232 | 8cecd655eef4 |
child 57994 | 68b283f9f826 |
permissions | -rw-r--r-- |
36899
bcd6fce5bf06
layered SMT setup, adapted SMT clients, added further tests, made Z3 proof abstraction configurable
boehmes
parents:
36898
diff
changeset
|
1 |
(* Title: HOL/SMT_Examples/SMT_Examples.thy |
36898 | 2 |
Author: Sascha Boehme, TU Muenchen |
3 |
*) |
|
4 |
||
36899
bcd6fce5bf06
layered SMT setup, adapted SMT clients, added further tests, made Z3 proof abstraction configurable
boehmes
parents:
36898
diff
changeset
|
5 |
header {* Examples for the SMT binding *} |
36898 | 6 |
|
7 |
theory SMT_Examples |
|
36899
bcd6fce5bf06
layered SMT setup, adapted SMT clients, added further tests, made Z3 proof abstraction configurable
boehmes
parents:
36898
diff
changeset
|
8 |
imports Complex_Main |
36898 | 9 |
begin |
10 |
||
47152
446cfc760ccf
renamed "smt_fixed" to "smt_read_only_certificates"
blanchet
parents:
47111
diff
changeset
|
11 |
declare [[smt_certificates = "SMT_Examples.certs"]] |
446cfc760ccf
renamed "smt_fixed" to "smt_read_only_certificates"
blanchet
parents:
47111
diff
changeset
|
12 |
declare [[smt_read_only_certificates = true]] |
36898 | 13 |
|
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
14 |
declare [[smt2_certificates = "SMT_Examples.certs2"]] |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
15 |
declare [[smt2_read_only_certificates = true]] |
36898 | 16 |
|
17 |
||
18 |
section {* Propositional and first-order logic *} |
|
19 |
||
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
20 |
lemma "True" by smt2 |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
21 |
lemma "p \<or> \<not>p" by smt2 |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
22 |
lemma "(p \<and> True) = p" by smt2 |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
23 |
lemma "(p \<or> q) \<and> \<not>p \<Longrightarrow> q" by smt2 |
56109 | 24 |
lemma "(a \<and> b) \<or> (c \<and> d) \<Longrightarrow> (a \<and> b) \<or> (c \<and> d)" by smt2 |
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
25 |
lemma "(p1 \<and> p2) \<or> p3 \<longrightarrow> (p1 \<longrightarrow> (p3 \<and> p2) \<or> (p1 \<and> p3)) \<or> p1" by smt2 |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
26 |
lemma "P = P = P = P = P = P = P = P = P = P" by smt2 |
36898 | 27 |
|
46084
dd7fb9e651ad
regenerate SMT example certificates, to reflect "set" type constructor
blanchet
parents:
45972
diff
changeset
|
28 |
lemma |
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
29 |
assumes "a \<or> b \<or> c \<or> d" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
30 |
and "e \<or> f \<or> (a \<and> d)" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
31 |
and "\<not> (a \<or> (c \<and> ~c)) \<or> b" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
32 |
and "\<not> (b \<and> (x \<or> \<not> x)) \<or> c" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
33 |
and "\<not> (d \<or> False) \<or> c" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
34 |
and "\<not> (c \<or> (\<not> p \<and> (p \<or> (q \<and> \<not> q))))" |
36898 | 35 |
shows False |
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
36 |
using assms by smt2 |
36898 | 37 |
|
38 |
axiomatization symm_f :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" where |
|
39 |
symm_f: "symm_f x y = symm_f y x" |
|
56109 | 40 |
|
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
41 |
lemma "a = a \<and> symm_f a b = symm_f b a" by (smt2 symm_f) |
36898 | 42 |
|
46084
dd7fb9e651ad
regenerate SMT example certificates, to reflect "set" type constructor
blanchet
parents:
45972
diff
changeset
|
43 |
(* |
36898 | 44 |
Taken from ~~/src/HOL/ex/SAT_Examples.thy. |
45 |
Translated from TPTP problem library: PUZ015-2.006.dimacs |
|
46 |
*) |
|
46084
dd7fb9e651ad
regenerate SMT example certificates, to reflect "set" type constructor
blanchet
parents:
45972
diff
changeset
|
47 |
lemma |
36898 | 48 |
assumes "~x0" |
49 |
and "~x30" |
|
50 |
and "~x29" |
|
51 |
and "~x59" |
|
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
52 |
and "x1 \<or> x31 \<or> x0" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
53 |
and "x2 \<or> x32 \<or> x1" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
54 |
and "x3 \<or> x33 \<or> x2" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
55 |
and "x4 \<or> x34 \<or> x3" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
56 |
and "x35 \<or> x4" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
57 |
and "x5 \<or> x36 \<or> x30" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
58 |
and "x6 \<or> x37 \<or> x5 \<or> x31" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
59 |
and "x7 \<or> x38 \<or> x6 \<or> x32" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
60 |
and "x8 \<or> x39 \<or> x7 \<or> x33" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
61 |
and "x9 \<or> x40 \<or> x8 \<or> x34" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
62 |
and "x41 \<or> x9 \<or> x35" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
63 |
and "x10 \<or> x42 \<or> x36" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
64 |
and "x11 \<or> x43 \<or> x10 \<or> x37" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
65 |
and "x12 \<or> x44 \<or> x11 \<or> x38" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
66 |
and "x13 \<or> x45 \<or> x12 \<or> x39" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
67 |
and "x14 \<or> x46 \<or> x13 \<or> x40" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
68 |
and "x47 \<or> x14 \<or> x41" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
69 |
and "x15 \<or> x48 \<or> x42" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
70 |
and "x16 \<or> x49 \<or> x15 \<or> x43" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
71 |
and "x17 \<or> x50 \<or> x16 \<or> x44" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
72 |
and "x18 \<or> x51 \<or> x17 \<or> x45" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
73 |
and "x19 \<or> x52 \<or> x18 \<or> x46" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
74 |
and "x53 \<or> x19 \<or> x47" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
75 |
and "x20 \<or> x54 \<or> x48" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
76 |
and "x21 \<or> x55 \<or> x20 \<or> x49" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
77 |
and "x22 \<or> x56 \<or> x21 \<or> x50" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
78 |
and "x23 \<or> x57 \<or> x22 \<or> x51" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
79 |
and "x24 \<or> x58 \<or> x23 \<or> x52" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
80 |
and "x59 \<or> x24 \<or> x53" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
81 |
and "x25 \<or> x54" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
82 |
and "x26 \<or> x25 \<or> x55" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
83 |
and "x27 \<or> x26 \<or> x56" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
84 |
and "x28 \<or> x27 \<or> x57" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
85 |
and "x29 \<or> x28 \<or> x58" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
86 |
and "~x1 \<or> ~x31" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
87 |
and "~x1 \<or> ~x0" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
88 |
and "~x31 \<or> ~x0" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
89 |
and "~x2 \<or> ~x32" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
90 |
and "~x2 \<or> ~x1" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
91 |
and "~x32 \<or> ~x1" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
92 |
and "~x3 \<or> ~x33" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
93 |
and "~x3 \<or> ~x2" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
94 |
and "~x33 \<or> ~x2" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
95 |
and "~x4 \<or> ~x34" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
96 |
and "~x4 \<or> ~x3" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
97 |
and "~x34 \<or> ~x3" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
98 |
and "~x35 \<or> ~x4" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
99 |
and "~x5 \<or> ~x36" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
100 |
and "~x5 \<or> ~x30" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
101 |
and "~x36 \<or> ~x30" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
102 |
and "~x6 \<or> ~x37" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
103 |
and "~x6 \<or> ~x5" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
104 |
and "~x6 \<or> ~x31" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
105 |
and "~x37 \<or> ~x5" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
106 |
and "~x37 \<or> ~x31" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
107 |
and "~x5 \<or> ~x31" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
108 |
and "~x7 \<or> ~x38" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
109 |
and "~x7 \<or> ~x6" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
110 |
and "~x7 \<or> ~x32" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
111 |
and "~x38 \<or> ~x6" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
112 |
and "~x38 \<or> ~x32" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
113 |
and "~x6 \<or> ~x32" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
114 |
and "~x8 \<or> ~x39" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
115 |
and "~x8 \<or> ~x7" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
116 |
and "~x8 \<or> ~x33" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
117 |
and "~x39 \<or> ~x7" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
118 |
and "~x39 \<or> ~x33" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
119 |
and "~x7 \<or> ~x33" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
120 |
and "~x9 \<or> ~x40" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
121 |
and "~x9 \<or> ~x8" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
122 |
and "~x9 \<or> ~x34" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
123 |
and "~x40 \<or> ~x8" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
124 |
and "~x40 \<or> ~x34" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
125 |
and "~x8 \<or> ~x34" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
126 |
and "~x41 \<or> ~x9" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
127 |
and "~x41 \<or> ~x35" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
128 |
and "~x9 \<or> ~x35" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
129 |
and "~x10 \<or> ~x42" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
130 |
and "~x10 \<or> ~x36" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
131 |
and "~x42 \<or> ~x36" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
132 |
and "~x11 \<or> ~x43" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
133 |
and "~x11 \<or> ~x10" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
134 |
and "~x11 \<or> ~x37" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
135 |
and "~x43 \<or> ~x10" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
136 |
and "~x43 \<or> ~x37" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
137 |
and "~x10 \<or> ~x37" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
138 |
and "~x12 \<or> ~x44" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
139 |
and "~x12 \<or> ~x11" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
140 |
and "~x12 \<or> ~x38" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
141 |
and "~x44 \<or> ~x11" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
142 |
and "~x44 \<or> ~x38" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
143 |
and "~x11 \<or> ~x38" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
144 |
and "~x13 \<or> ~x45" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
145 |
and "~x13 \<or> ~x12" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
146 |
and "~x13 \<or> ~x39" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
147 |
and "~x45 \<or> ~x12" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
148 |
and "~x45 \<or> ~x39" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
149 |
and "~x12 \<or> ~x39" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
150 |
and "~x14 \<or> ~x46" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
151 |
and "~x14 \<or> ~x13" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
152 |
and "~x14 \<or> ~x40" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
153 |
and "~x46 \<or> ~x13" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
154 |
and "~x46 \<or> ~x40" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
155 |
and "~x13 \<or> ~x40" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
156 |
and "~x47 \<or> ~x14" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
157 |
and "~x47 \<or> ~x41" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
158 |
and "~x14 \<or> ~x41" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
159 |
and "~x15 \<or> ~x48" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
160 |
and "~x15 \<or> ~x42" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
161 |
and "~x48 \<or> ~x42" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
162 |
and "~x16 \<or> ~x49" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
163 |
and "~x16 \<or> ~x15" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
164 |
and "~x16 \<or> ~x43" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
165 |
and "~x49 \<or> ~x15" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
166 |
and "~x49 \<or> ~x43" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
167 |
and "~x15 \<or> ~x43" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
168 |
and "~x17 \<or> ~x50" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
169 |
and "~x17 \<or> ~x16" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
170 |
and "~x17 \<or> ~x44" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
171 |
and "~x50 \<or> ~x16" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
172 |
and "~x50 \<or> ~x44" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
173 |
and "~x16 \<or> ~x44" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
174 |
and "~x18 \<or> ~x51" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
175 |
and "~x18 \<or> ~x17" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
176 |
and "~x18 \<or> ~x45" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
177 |
and "~x51 \<or> ~x17" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
178 |
and "~x51 \<or> ~x45" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
179 |
and "~x17 \<or> ~x45" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
180 |
and "~x19 \<or> ~x52" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
181 |
and "~x19 \<or> ~x18" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
182 |
and "~x19 \<or> ~x46" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
183 |
and "~x52 \<or> ~x18" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
184 |
and "~x52 \<or> ~x46" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
185 |
and "~x18 \<or> ~x46" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
186 |
and "~x53 \<or> ~x19" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
187 |
and "~x53 \<or> ~x47" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
188 |
and "~x19 \<or> ~x47" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
189 |
and "~x20 \<or> ~x54" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
190 |
and "~x20 \<or> ~x48" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
191 |
and "~x54 \<or> ~x48" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
192 |
and "~x21 \<or> ~x55" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
193 |
and "~x21 \<or> ~x20" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
194 |
and "~x21 \<or> ~x49" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
195 |
and "~x55 \<or> ~x20" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
196 |
and "~x55 \<or> ~x49" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
197 |
and "~x20 \<or> ~x49" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
198 |
and "~x22 \<or> ~x56" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
199 |
and "~x22 \<or> ~x21" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
200 |
and "~x22 \<or> ~x50" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
201 |
and "~x56 \<or> ~x21" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
202 |
and "~x56 \<or> ~x50" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
203 |
and "~x21 \<or> ~x50" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
204 |
and "~x23 \<or> ~x57" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
205 |
and "~x23 \<or> ~x22" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
206 |
and "~x23 \<or> ~x51" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
207 |
and "~x57 \<or> ~x22" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
208 |
and "~x57 \<or> ~x51" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
209 |
and "~x22 \<or> ~x51" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
210 |
and "~x24 \<or> ~x58" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
211 |
and "~x24 \<or> ~x23" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
212 |
and "~x24 \<or> ~x52" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
213 |
and "~x58 \<or> ~x23" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
214 |
and "~x58 \<or> ~x52" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
215 |
and "~x23 \<or> ~x52" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
216 |
and "~x59 \<or> ~x24" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
217 |
and "~x59 \<or> ~x53" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
218 |
and "~x24 \<or> ~x53" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
219 |
and "~x25 \<or> ~x54" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
220 |
and "~x26 \<or> ~x25" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
221 |
and "~x26 \<or> ~x55" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
222 |
and "~x25 \<or> ~x55" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
223 |
and "~x27 \<or> ~x26" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
224 |
and "~x27 \<or> ~x56" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
225 |
and "~x26 \<or> ~x56" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
226 |
and "~x28 \<or> ~x27" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
227 |
and "~x28 \<or> ~x57" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
228 |
and "~x27 \<or> ~x57" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
229 |
and "~x29 \<or> ~x28" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
230 |
and "~x29 \<or> ~x58" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
231 |
and "~x28 \<or> ~x58" |
36898 | 232 |
shows False |
56727 | 233 |
using assms by smt2 |
36898 | 234 |
|
235 |
lemma "\<forall>x::int. P x \<longrightarrow> (\<forall>y::int. P x \<or> P y)" |
|
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
236 |
by smt2 |
36898 | 237 |
|
46084
dd7fb9e651ad
regenerate SMT example certificates, to reflect "set" type constructor
blanchet
parents:
45972
diff
changeset
|
238 |
lemma |
36898 | 239 |
assumes "(\<forall>x y. P x y = x)" |
240 |
shows "(\<exists>y. P x y) = P x c" |
|
56727 | 241 |
using assms by smt2 |
36898 | 242 |
|
46084
dd7fb9e651ad
regenerate SMT example certificates, to reflect "set" type constructor
blanchet
parents:
45972
diff
changeset
|
243 |
lemma |
36898 | 244 |
assumes "(\<forall>x y. P x y = x)" |
245 |
and "(\<forall>x. \<exists>y. P x y) = (\<forall>x. P x c)" |
|
246 |
shows "(EX y. P x y) = P x c" |
|
56727 | 247 |
using assms by smt2 |
36898 | 248 |
|
249 |
lemma |
|
250 |
assumes "if P x then \<not>(\<exists>y. P y) else (\<forall>y. \<not>P y)" |
|
251 |
shows "P x \<longrightarrow> P y" |
|
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
252 |
using assms by smt2 |
36898 | 253 |
|
254 |
||
255 |
section {* Arithmetic *} |
|
256 |
||
257 |
subsection {* Linear arithmetic over integers and reals *} |
|
258 |
||
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
259 |
lemma "(3::int) = 3" by smt2 |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
260 |
lemma "(3::real) = 3" by smt2 |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
261 |
lemma "(3 :: int) + 1 = 4" by smt2 |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
262 |
lemma "x + (y + z) = y + (z + (x::int))" by smt2 |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
263 |
lemma "max (3::int) 8 > 5" by smt2 |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
264 |
lemma "abs (x :: real) + abs y \<ge> abs (x + y)" by smt2 |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
265 |
lemma "P ((2::int) < 3) = P True" by smt2 |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
266 |
lemma "x + 3 \<ge> 4 \<or> x < (1::int)" by smt2 |
36898 | 267 |
|
268 |
lemma |
|
269 |
assumes "x \<ge> (3::int)" and "y = x + 4" |
|
46084
dd7fb9e651ad
regenerate SMT example certificates, to reflect "set" type constructor
blanchet
parents:
45972
diff
changeset
|
270 |
shows "y - x > 0" |
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
271 |
using assms by smt2 |
36898 | 272 |
|
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
273 |
lemma "let x = (2 :: int) in x + x \<noteq> 5" by smt2 |
36898 | 274 |
|
275 |
lemma |
|
276 |
fixes x :: real |
|
277 |
assumes "3 * x + 7 * a < 4" and "3 < 2 * x" |
|
278 |
shows "a < 0" |
|
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
279 |
using assms by smt2 |
36898 | 280 |
|
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
281 |
lemma "(0 \<le> y + -1 * x \<or> \<not> 0 \<le> x \<or> 0 \<le> (x::int)) = (\<not> False)" by smt2 |
36898 | 282 |
|
283 |
lemma " |
|
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
284 |
(n < m \<and> m < n') \<or> (n < m \<and> m = n') \<or> (n < n' \<and> n' < m) \<or> |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
285 |
(n = n' \<and> n' < m) \<or> (n = m \<and> m < n') \<or> |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
286 |
(n' < m \<and> m < n) \<or> (n' < m \<and> m = n) \<or> |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
287 |
(n' < n \<and> n < m) \<or> (n' = n \<and> n < m) \<or> (n' = m \<and> m < n) \<or> |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
288 |
(m < n \<and> n < n') \<or> (m < n \<and> n' = n) \<or> (m < n' \<and> n' < n) \<or> |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
289 |
(m = n \<and> n < n') \<or> (m = n' \<and> n' < n) \<or> |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
290 |
(n' = m \<and> m = (n::int))" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
291 |
by smt2 |
36898 | 292 |
|
46084
dd7fb9e651ad
regenerate SMT example certificates, to reflect "set" type constructor
blanchet
parents:
45972
diff
changeset
|
293 |
text{* |
36898 | 294 |
The following example was taken from HOL/ex/PresburgerEx.thy, where it says: |
295 |
||
296 |
This following theorem proves that all solutions to the |
|
297 |
recurrence relation $x_{i+2} = |x_{i+1}| - x_i$ are periodic with |
|
298 |
period 9. The example was brought to our attention by John |
|
299 |
Harrison. It does does not require Presburger arithmetic but merely |
|
300 |
quantifier-free linear arithmetic and holds for the rationals as well. |
|
301 |
||
46084
dd7fb9e651ad
regenerate SMT example certificates, to reflect "set" type constructor
blanchet
parents:
45972
diff
changeset
|
302 |
Warning: it takes (in 2006) over 4.2 minutes! |
36898 | 303 |
|
304 |
There, it is proved by "arith". SMT is able to prove this within a fraction |
|
305 |
of one second. With proof reconstruction, it takes about 13 seconds on a Core2 |
|
306 |
processor. |
|
307 |
*} |
|
308 |
||
309 |
lemma "\<lbrakk> x3 = abs x2 - x1; x4 = abs x3 - x2; x5 = abs x4 - x3; |
|
310 |
x6 = abs x5 - x4; x7 = abs x6 - x5; x8 = abs x7 - x6; |
|
311 |
x9 = abs x8 - x7; x10 = abs x9 - x8; x11 = abs x10 - x9 \<rbrakk> |
|
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
312 |
\<Longrightarrow> x1 = x10 \<and> x2 = (x11::int)" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
313 |
by smt2 |
36898 | 314 |
|
315 |
||
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
316 |
lemma "let P = 2 * x + 1 > x + (x::real) in P \<or> False \<or> P" by smt2 |
36898 | 317 |
|
48069
e9b2782c4f99
restricted Z3 by default to a fragment where proof reconstruction should not fail (for better integration with Sledgehammer) -- the full set of supported Z3 features can still be used by enabling the configuration option "z3_with_extensions"
boehmes
parents:
47155
diff
changeset
|
318 |
lemma "x + (let y = x mod 2 in 2 * y + 1) \<ge> x + (1::int)" |
56109 | 319 |
using [[z3_new_extensions]] by smt2 |
36898 | 320 |
|
48069
e9b2782c4f99
restricted Z3 by default to a fragment where proof reconstruction should not fail (for better integration with Sledgehammer) -- the full set of supported Z3 features can still be used by enabling the configuration option "z3_with_extensions"
boehmes
parents:
47155
diff
changeset
|
321 |
lemma "x + (let y = x mod 2 in y + y) < x + (3::int)" |
56109 | 322 |
using [[z3_new_extensions]] by smt2 |
36898 | 323 |
|
324 |
lemma |
|
325 |
assumes "x \<noteq> (0::real)" |
|
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
326 |
shows "x + x \<noteq> (let P = (abs x > 1) in if P \<or> \<not> P then 4 else 2) * x" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
327 |
using assms [[z3_new_extensions]] by smt2 |
36898 | 328 |
|
46084
dd7fb9e651ad
regenerate SMT example certificates, to reflect "set" type constructor
blanchet
parents:
45972
diff
changeset
|
329 |
lemma |
dd7fb9e651ad
regenerate SMT example certificates, to reflect "set" type constructor
blanchet
parents:
45972
diff
changeset
|
330 |
assumes "(n + m) mod 2 = 0" and "n mod 4 = 3" |
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
331 |
shows "n mod 2 = 1 \<and> m mod 2 = (1::int)" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
332 |
using assms [[z3_new_extensions]] by smt2 |
36898 | 333 |
|
334 |
||
335 |
subsection {* Linear arithmetic with quantifiers *} |
|
336 |
||
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
337 |
lemma "~ (\<exists>x::int. False)" by smt2 |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
338 |
lemma "~ (\<exists>x::real. False)" by smt2 |
36898 | 339 |
|
56727 | 340 |
lemma "\<exists>x::int. 0 < x" by smt2 |
36898 | 341 |
|
342 |
lemma "\<exists>x::real. 0 < x" |
|
56727 | 343 |
using [[smt2_oracle=true]] (* no Z3 proof *) |
344 |
by smt2 |
|
36898 | 345 |
|
56727 | 346 |
lemma "\<forall>x::int. \<exists>y. y > x" by smt2 |
36898 | 347 |
|
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
348 |
lemma "\<forall>x y::int. (x = 0 \<and> y = 1) \<longrightarrow> x \<noteq> y" by smt2 |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
349 |
lemma "\<exists>x::int. \<forall>y. x < y \<longrightarrow> y < 0 \<or> y >= 0" by smt2 |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
350 |
lemma "\<forall>x y::int. x < y \<longrightarrow> (2 * x + 1) < (2 * y)" by smt2 |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
351 |
lemma "\<forall>x y::int. (2 * x + 1) \<noteq> (2 * y)" by smt2 |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
352 |
lemma "\<forall>x y::int. x + y > 2 \<or> x + y = 2 \<or> x + y < 2" by smt2 |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
353 |
lemma "\<forall>x::int. if x > 0 then x + 1 > 0 else 1 > x" by smt2 |
56727 | 354 |
lemma "if (ALL x::int. x < 0 \<or> x > 0) then False else True" by smt2 |
355 |
lemma "(if (ALL x::int. x < 0 \<or> x > 0) then -1 else 3) > (0::int)" by smt2 |
|
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
356 |
lemma "~ (\<exists>x y z::int. 4 * x + -6 * y = (1::int))" by smt2 |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
357 |
lemma "\<exists>x::int. \<forall>x y. 0 < x \<and> 0 < y \<longrightarrow> (0::int) < x + y" by smt2 |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
358 |
lemma "\<exists>u::int. \<forall>(x::int) y::real. 0 < x \<and> 0 < y \<longrightarrow> -1 < x" by smt2 |
56727 | 359 |
lemma "\<exists>x::int. (\<forall>y. y \<ge> x \<longrightarrow> y > 0) \<longrightarrow> x > 0" by smt2 |
57232 | 360 |
lemma "\<forall>x::int. |
361 |
SMT2.trigger (SMT2.Symb_Cons (SMT2.Symb_Cons (SMT2.pat x) SMT2.Symb_Nil) SMT2.Symb_Nil) |
|
362 |
(x < a \<longrightarrow> 2 * x < 2 * a)" by smt2 |
|
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
363 |
lemma "\<forall>(a::int) b::int. 0 < b \<or> b < 1" by smt2 |
42318
0fd33b6b22cf
corrected order of steps in Z3 proof reconstruction for elimination of unused quantified variables: first try to eliminate unused variables, then skip over used variables
boehmes
parents:
41786
diff
changeset
|
364 |
|
36898 | 365 |
|
366 |
subsection {* Non-linear arithmetic over integers and reals *} |
|
367 |
||
368 |
lemma "a > (0::int) \<Longrightarrow> a*b > 0 \<Longrightarrow> b > 0" |
|
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
369 |
using [[smt2_oracle, z3_new_extensions]] |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
370 |
by smt2 |
36899
bcd6fce5bf06
layered SMT setup, adapted SMT clients, added further tests, made Z3 proof abstraction configurable
boehmes
parents:
36898
diff
changeset
|
371 |
|
41282 | 372 |
lemma "(a::int) * (x + 1 + y) = a * x + a * (y + 1)" |
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
373 |
using [[z3_new_extensions]] |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
374 |
by smt2 |
36898 | 375 |
|
41282 | 376 |
lemma "((x::real) * (1 + y) - x * (1 - y)) = (2 * x * y)" |
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
377 |
using [[z3_new_extensions]] |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
378 |
by smt2 |
36898 | 379 |
|
380 |
lemma |
|
381 |
"(U::int) + (1 + p) * (b + e) + p * d = |
|
382 |
U + (2 * (1 + p) * (b + e) + (1 + p) * d + d * p) - (1 + p) * (b + d + e)" |
|
56109 | 383 |
using [[z3_new_extensions]] by smt2 |
36898 | 384 |
|
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
385 |
lemma [z3_rule, z3_new_rule]: |
43893
f3e75541cb78
allow rules with premises to be declared as z3_rule (to circumvent incompleteness of Z3 proof reconstruction)
boehmes
parents:
42321
diff
changeset
|
386 |
fixes x :: "int" |
f3e75541cb78
allow rules with premises to be declared as z3_rule (to circumvent incompleteness of Z3 proof reconstruction)
boehmes
parents:
42321
diff
changeset
|
387 |
assumes "x * y \<le> 0" and "\<not> y \<le> 0" and "\<not> x \<le> 0" |
f3e75541cb78
allow rules with premises to be declared as z3_rule (to circumvent incompleteness of Z3 proof reconstruction)
boehmes
parents:
42321
diff
changeset
|
388 |
shows False |
f3e75541cb78
allow rules with premises to be declared as z3_rule (to circumvent incompleteness of Z3 proof reconstruction)
boehmes
parents:
42321
diff
changeset
|
389 |
using assms by (metis mult_le_0_iff) |
f3e75541cb78
allow rules with premises to be declared as z3_rule (to circumvent incompleteness of Z3 proof reconstruction)
boehmes
parents:
42321
diff
changeset
|
390 |
|
48069
e9b2782c4f99
restricted Z3 by default to a fragment where proof reconstruction should not fail (for better integration with Sledgehammer) -- the full set of supported Z3 features can still be used by enabling the configuration option "z3_with_extensions"
boehmes
parents:
47155
diff
changeset
|
391 |
lemma "x * y \<le> (0 :: int) \<Longrightarrow> x \<le> 0 \<or> y \<le> 0" |
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
392 |
using [[z3_with_extensions]] [[z3_new_extensions]] |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
393 |
by smt (* smt2 FIXME: "th-lemma" tactic fails *) |
43893
f3e75541cb78
allow rules with premises to be declared as z3_rule (to circumvent incompleteness of Z3 proof reconstruction)
boehmes
parents:
42321
diff
changeset
|
394 |
|
36898 | 395 |
|
396 |
section {* Pairs *} |
|
397 |
||
41132 | 398 |
lemma "fst (x, y) = a \<Longrightarrow> x = a" |
56109 | 399 |
using fst_conv by smt2 |
36898 | 400 |
|
41132 | 401 |
lemma "p1 = (x, y) \<and> p2 = (y, x) \<Longrightarrow> fst p1 = snd p2" |
56109 | 402 |
using fst_conv snd_conv by smt2 |
36898 | 403 |
|
404 |
||
405 |
section {* Higher-order problems and recursion *} |
|
406 |
||
41132 | 407 |
lemma "i \<noteq> i1 \<and> i \<noteq> i2 \<Longrightarrow> (f (i1 := v1, i2 := v2)) i = f i" |
56109 | 408 |
using fun_upd_same fun_upd_apply by smt2 |
36898 | 409 |
|
410 |
lemma "(f g (x::'a::type) = (g x \<and> True)) \<or> (f g x = True) \<or> (g x = True)" |
|
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
411 |
by smt2 |
36898 | 412 |
|
56109 | 413 |
lemma "id x = x \<and> id True = True" |
56727 | 414 |
by (smt2 id_def) |
36898 | 415 |
|
41132 | 416 |
lemma "i \<noteq> i1 \<and> i \<noteq> i2 \<Longrightarrow> ((f (i1 := v1)) (i2 := v2)) i = f i" |
56109 | 417 |
using fun_upd_same fun_upd_apply by smt2 |
36898 | 418 |
|
41786
a5899d0ce1a1
added test cases with quantifier occurring in first-order term positions
boehmes
parents:
41601
diff
changeset
|
419 |
lemma |
a5899d0ce1a1
added test cases with quantifier occurring in first-order term positions
boehmes
parents:
41601
diff
changeset
|
420 |
"f (\<exists>x. g x) \<Longrightarrow> True" |
a5899d0ce1a1
added test cases with quantifier occurring in first-order term positions
boehmes
parents:
41601
diff
changeset
|
421 |
"f (\<forall>x. g x) \<Longrightarrow> True" |
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
422 |
by smt2+ |
36899
bcd6fce5bf06
layered SMT setup, adapted SMT clients, added further tests, made Z3 proof abstraction configurable
boehmes
parents:
36898
diff
changeset
|
423 |
|
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
424 |
lemma True using let_rsp by smt2 |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
425 |
lemma "le = op \<le> \<Longrightarrow> le (3::int) 42" by smt2 |
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:
57232
diff
changeset
|
426 |
lemma "map (\<lambda>i::int. i + 1) [0, 1] = [1, 2]" by (smt2 list.map) |
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
427 |
lemma "(ALL x. P x) \<or> ~ All P" by smt2 |
36898 | 428 |
|
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:
57232
diff
changeset
|
429 |
fun dec_10 :: "int \<Rightarrow> int" where |
36898 | 430 |
"dec_10 n = (if n < 10 then n else dec_10 (n - 10))" |
56109 | 431 |
|
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
432 |
lemma "dec_10 (4 * dec_10 4) = 6" by (smt2 dec_10.simps) |
36898 | 433 |
|
434 |
axiomatization |
|
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:
57232
diff
changeset
|
435 |
eval_dioph :: "int list \<Rightarrow> int list \<Rightarrow> int" |
56109 | 436 |
where |
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:
57232
diff
changeset
|
437 |
eval_dioph_mod: "eval_dioph ks xs mod n = eval_dioph ks (map (\<lambda>x. x mod n) xs) mod n" |
56109 | 438 |
and |
36898 | 439 |
eval_dioph_div_mult: |
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:
57232
diff
changeset
|
440 |
"eval_dioph ks (map (\<lambda>x. x div n) xs) * n + |
36898 | 441 |
eval_dioph ks (map (\<lambda>x. x mod n) xs) = eval_dioph ks xs" |
56109 | 442 |
|
36898 | 443 |
lemma |
444 |
"(eval_dioph ks xs = l) = |
|
445 |
(eval_dioph ks (map (\<lambda>x. x mod 2) xs) mod 2 = l mod 2 \<and> |
|
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:
57232
diff
changeset
|
446 |
eval_dioph ks (map (\<lambda>x. x div 2) xs) = (l - eval_dioph ks (map (\<lambda>x. x mod 2) xs)) div 2)" |
fb71c6f100f8
do not embed 'nat' into 'int's in 'smt2' method -- this is highly inefficient and decreases the Sledgehammer success rate significantly
blanchet
parents:
57232
diff
changeset
|
447 |
using [[smt2_oracle = true]] (*FIXME*) |
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
448 |
using [[z3_new_extensions]] |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
449 |
by (smt2 eval_dioph_mod[where n=2] eval_dioph_div_mult[where n=2]) |
36898 | 450 |
|
451 |
||
45393
13ab80eafd71
try different alternatives in discharging extra assumptions when schematic theorems obtained from lambda-lifting can be instantiated in different ways
boehmes
parents:
43893
diff
changeset
|
452 |
context complete_lattice |
13ab80eafd71
try different alternatives in discharging extra assumptions when schematic theorems obtained from lambda-lifting can be instantiated in different ways
boehmes
parents:
43893
diff
changeset
|
453 |
begin |
13ab80eafd71
try different alternatives in discharging extra assumptions when schematic theorems obtained from lambda-lifting can be instantiated in different ways
boehmes
parents:
43893
diff
changeset
|
454 |
|
46084
dd7fb9e651ad
regenerate SMT example certificates, to reflect "set" type constructor
blanchet
parents:
45972
diff
changeset
|
455 |
lemma |
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
456 |
assumes "Sup {a | i::bool. True} \<le> Sup {b | i::bool. True}" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
457 |
and "Sup {b | i::bool. True} \<le> Sup {a | i::bool. True}" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
458 |
shows "Sup {a | i::bool. True} \<le> Sup {a | i::bool. True}" |
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
459 |
using assms by (smt2 order_trans) |
45393
13ab80eafd71
try different alternatives in discharging extra assumptions when schematic theorems obtained from lambda-lifting can be instantiated in different ways
boehmes
parents:
43893
diff
changeset
|
460 |
|
13ab80eafd71
try different alternatives in discharging extra assumptions when schematic theorems obtained from lambda-lifting can be instantiated in different ways
boehmes
parents:
43893
diff
changeset
|
461 |
end |
13ab80eafd71
try different alternatives in discharging extra assumptions when schematic theorems obtained from lambda-lifting can be instantiated in different ways
boehmes
parents:
43893
diff
changeset
|
462 |
|
13ab80eafd71
try different alternatives in discharging extra assumptions when schematic theorems obtained from lambda-lifting can be instantiated in different ways
boehmes
parents:
43893
diff
changeset
|
463 |
|
36898 | 464 |
section {* Monomorphization examples *} |
465 |
||
36899
bcd6fce5bf06
layered SMT setup, adapted SMT clients, added further tests, made Z3 proof abstraction configurable
boehmes
parents:
36898
diff
changeset
|
466 |
definition Pred :: "'a \<Rightarrow> bool" where "Pred x = True" |
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
467 |
|
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
468 |
lemma poly_Pred: "Pred x \<and> (Pred [x] \<or> \<not> Pred [x])" by (simp add: Pred_def) |
56109 | 469 |
|
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
470 |
lemma "Pred (1::int)" by (smt2 poly_Pred) |
36898 | 471 |
|
36899
bcd6fce5bf06
layered SMT setup, adapted SMT clients, added further tests, made Z3 proof abstraction configurable
boehmes
parents:
36898
diff
changeset
|
472 |
axiomatization g :: "'a \<Rightarrow> nat" |
bcd6fce5bf06
layered SMT setup, adapted SMT clients, added further tests, made Z3 proof abstraction configurable
boehmes
parents:
36898
diff
changeset
|
473 |
axiomatization where |
bcd6fce5bf06
layered SMT setup, adapted SMT clients, added further tests, made Z3 proof abstraction configurable
boehmes
parents:
36898
diff
changeset
|
474 |
g1: "g (Some x) = g [x]" and |
bcd6fce5bf06
layered SMT setup, adapted SMT clients, added further tests, made Z3 proof abstraction configurable
boehmes
parents:
36898
diff
changeset
|
475 |
g2: "g None = g []" and |
36898 | 476 |
g3: "g xs = length xs" |
56079
175ac95720d4
use 'smt2' in SMT examples as much as currently possible
blanchet
parents:
55465
diff
changeset
|
477 |
|
56727 | 478 |
lemma "g (Some (3::int)) = g (Some True)" by (smt2 g1 g2 g3 list.size) |
36898 | 479 |
|
480 |
end |