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