# HG changeset patch # User boehmes # Date 1256027387 -7200 # Node ID ab599f7f26397212e11995091bffe80c24f4611f # Parent 39f73a59e8554cd64f0275e9edfa3b012fb6613a corrected paths to certificates, added note how to re-generate the certificates diff -r 39f73a59e855 -r ab599f7f2639 src/HOL/SMT/Examples/SMT_Examples.thy --- a/src/HOL/SMT/Examples/SMT_Examples.thy Tue Oct 20 10:11:30 2009 +0200 +++ b/src/HOL/SMT/Examples/SMT_Examples.thy Tue Oct 20 10:29:47 2009 +0200 @@ -1,5 +1,5 @@ -(* Title: SMT_Examples.thy - Author: Sascha Boehme, TU Muenchen +(* Title: HOL/SMT/SMT_Examples.thy + Author: Sascha Boehme, TU Muenchen *) header {* Examples for the 'smt' tactic. *} @@ -10,36 +10,41 @@ declare [[smt_solver=z3, z3_proofs=true]] +text {* +To re-generate the certificates, replace the option 'smt_cert' with 'smt_keep' +(while keeping the paths as they are) and let Isabelle process this theory. +*} + section {* Propositional and first-order logic *} lemma "True" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_prop_01"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_prop_01"]] by smt lemma "p \ \p" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_prop_02"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_prop_02"]] by smt lemma "(p \ True) = p" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_prop_03"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_prop_03"]] by smt lemma "(p \ q) \ \p \ q" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_prop_04"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_prop_04"]] by smt lemma "(a \ b) \ (c \ d) \ (a \ b) \ (c \ d)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_prop_05"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_prop_05"]] using [[z3_proofs=false]] (* no Z3 proof *) by smt lemma "(p1 \ p2) \ p3 \ (p1 \ (p3 \ p2) \ (p1 \ p3)) \ p1" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_prop_06"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_prop_06"]] by smt lemma "P=P=P=P=P=P=P=P=P=P" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_prop_07"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_prop_07"]] by smt lemma @@ -50,13 +55,13 @@ and "~(d | False) | c" and "~(c | (~p & (p | (q & ~q))))" shows False - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_prop_08"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_prop_08"]] using assms by smt axiomatization symm_f :: "'a \ 'a \ 'a" where symm_f: "symm_f x y = symm_f y x" lemma "a = a \ symm_f a b = symm_f b a" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_prop_09"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_prop_09"]] by (smt add: symm_f) (* @@ -250,18 +255,18 @@ and "~x28 | ~x58" shows False using assms - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_prop_10"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_prop_10"]] by smt lemma "\x::int. P x \ (\y::int. P x \ P y)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_fol_01"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_fol_01"]] by smt lemma assumes "(\x y. P x y = x)" shows "(\y. P x y) = P x c" using assms - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_fol_02"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_fol_02"]] by smt lemma @@ -269,14 +274,14 @@ and "(\x. \y. P x y) = (\x. P x c)" shows "(EX y. P x y) = P x c" using assms - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_fol_03"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_fol_03"]] by smt lemma assumes "if P x then \(\y. P y) else (\y. \P y)" shows "P x \ P y" using assms - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_fol_04"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_fol_04"]] by smt @@ -285,46 +290,46 @@ subsection {* Linear arithmetic over integers and reals *} lemma "(3::int) = 3" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_linarith_01"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_linarith_01"]] by smt lemma "(3::real) = 3" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_linarith_02"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_linarith_02"]] by smt lemma "(3 :: int) + 1 = 4" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_linarith_03"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_linarith_03"]] by smt lemma "x + (y + z) = y + (z + (x::int))" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_linarith_04"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_linarith_04"]] by smt lemma "max (3::int) 8 > 5" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_linarith_05"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_linarith_05"]] by smt lemma "abs (x :: real) + abs y \ abs (x + y)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_linarith_06"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_linarith_06"]] by smt lemma "P ((2::int) < 3) = P True" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_linarith_07"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_linarith_07"]] by smt lemma "x + 3 \ 4 \ x < (1::int)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_linarith_08"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_linarith_08"]] by smt lemma assumes "x \ (3::int)" and "y = x + 4" shows "y - x > 0" using assms - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_linarith_09"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_linarith_09"]] by smt lemma "let x = (2 :: int) in x + x \ 5" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_linarith_10"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_linarith_10"]] by smt lemma @@ -332,22 +337,22 @@ assumes "3 * x + 7 * a < 4" and "3 < 2 * x" shows "a < 0" using assms - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_linarith_11"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_linarith_11"]] by smt lemma "(0 \ y + -1 * x \ \ 0 \ x \ 0 \ (x::int)) = (\ False)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_linarith_12"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_linarith_12"]] by smt lemma "distinct [x < (3::int), 3 \ x]" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_linarith_13"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_linarith_13"]] by smt lemma assumes "a > (0::int)" shows "distinct [a, a * 2, a - a]" using assms - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_linarith_14"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_linarith_14"]] by smt lemma " @@ -358,7 +363,7 @@ (m < n & n < n') | (m < n & n' = n) | (m < n' & n' < n) | (m = n & n < n') | (m = n' & n' < n) | (n' = m & m = (n::int))" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_linarith_15"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_linarith_15"]] by smt text{* @@ -381,144 +386,144 @@ x6 = abs x5 - x4; x7 = abs x6 - x5; x8 = abs x7 - x6; x9 = abs x8 - x7; x10 = abs x9 - x8; x11 = abs x10 - x9 \ \ x1 = x10 & x2 = (x11::int)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_linarith_16"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_linarith_16"]] by smt subsection {* Linear arithmetic with quantifiers *} lemma "~ (\x::int. False)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_arith_quant_01"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_arith_quant_01"]] by smt lemma "~ (\x::real. False)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_arith_quant_02"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_arith_quant_02"]] by smt lemma "\x::int. 0 < x" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_arith_quant_03"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_arith_quant_03"]] using [[z3_proofs=false]] (* no Z3 proof *) by smt lemma "\x::real. 0 < x" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_arith_quant_04"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_arith_quant_04"]] using [[z3_proofs=false]] (* no Z3 proof *) by smt lemma "\x::int. \y. y > x" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_arith_quant_05"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_arith_quant_05"]] using [[z3_proofs=false]] (* no Z3 proof *) by smt lemma "\x y::int. (x = 0 \ y = 1) \ x \ y" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_arith_quant_06"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_arith_quant_06"]] by smt lemma "\x::int. \y. x < y \ y < 0 \ y >= 0" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_arith_quant_07"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_arith_quant_07"]] by smt lemma "\x y::int. x < y \ (2 * x + 1) < (2 * y)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_arith_quant_08"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_arith_quant_08"]] by smt lemma "\x y::int. (2 * x + 1) \ (2 * y)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_arith_quant_09"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_arith_quant_09"]] by smt lemma "\x y::int. x + y > 2 \ x + y = 2 \ x + y < 2" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_arith_quant_10"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_arith_quant_10"]] by smt lemma "\x::int. if x > 0 then x + 1 > 0 else 1 > x" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_arith_quant_11"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_arith_quant_11"]] by smt lemma "if (ALL x::int. x < 0 \ x > 0) then False else True" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_arith_quant_12"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_arith_quant_12"]] by smt lemma "(if (ALL x::int. x < 0 \ x > 0) then -1 else 3) > (0::int)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_arith_quant_13"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_arith_quant_13"]] by smt lemma "~ (\x y z::int. 4 * x + -6 * y = (1::int))" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_arith_quant_14"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_arith_quant_14"]] by smt lemma "\x::int. \x y. 0 < x \ 0 < y \ (0::int) < x + y" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_arith_quant_15"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_arith_quant_15"]] by smt lemma "\u::int. \(x::int) y::real. 0 < x \ 0 < y \ -1 < x" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_arith_quant_16"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_arith_quant_16"]] by smt lemma "\x::int. (\y. y \ x \ y > 0) \ x > 0" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_arith_quant_17"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_arith_quant_17"]] by smt lemma "\x::int. trigger [pat x] (x < a \ 2 * x < 2 * a)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_arith_quant_18"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_arith_quant_18"]] by smt subsection {* Non-linear arithmetic over integers and reals *} lemma "a > (0::int) \ a*b > 0 \ b > 0" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_nlarith_01"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_nlarith_01"]] using [[z3_proofs=false]] -- {* Isabelle's arithmetic decision procedures are too weak to automatically prove @{thm zero_less_mult_pos}. *} by smt lemma "(a::int) * (x + 1 + y) = a * x + a * (y + 1)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_nlarith_02"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_nlarith_02"]] by smt lemma "((x::real) * (1 + y) - x * (1 - y)) = (2 * x * y)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_nlarith_03"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_nlarith_03"]] by smt lemma "(U::int) + (1 + p) * (b + e) + p * d = U + (2 * (1 + p) * (b + e) + (1 + p) * d + d * p) - (1 + p) * (b + d + e)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_nlarith_04"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_nlarith_04"]] by smt subsection {* Linear arithmetic for natural numbers *} lemma "2 * (x::nat) ~= 1" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_nat_arith_01"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_nat_arith_01"]] by smt lemma "a < 3 \ (7::nat) > 2 * a" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_nat_arith_02"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_nat_arith_02"]] by smt lemma "let x = (1::nat) + y in x - y > 0 * x" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_nat_arith_03"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_nat_arith_03"]] by smt lemma "let x = (1::nat) + y in let P = (if x > 0 then True else False) in False \ P = (x - 1 = y) \ (\P \ False)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_nat_arith_04"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_nat_arith_04"]] by smt lemma "distinct [a + (1::nat), a * 2 + 3, a - a]" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_nat_arith_05"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_nat_arith_05"]] by smt lemma "int (nat \x::int\) = \x\" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_nat_arith_06"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_nat_arith_06"]] by smt definition prime_nat :: "nat \ bool" where "prime_nat p = (1 < p \ (\m. m dvd p --> m = 1 \ m = p))" lemma "prime_nat (4*m + 1) \ m \ (1::nat)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_nat_arith_07"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_nat_arith_07"]] by (smt add: prime_nat_def) @@ -537,105 +542,105 @@ subsection {* Bitvector arithmetic *} lemma "(27 :: 4 word) = -5" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_bv_arith_01"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_bv_arith_01"]] by smt lemma "(27 :: 4 word) = 11" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_bv_arith_02"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_bv_arith_02"]] by smt lemma "23 < (27::8 word)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_bv_arith_03"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_bv_arith_03"]] by smt lemma "27 + 11 = (6::5 word)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_bv_arith_04"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_bv_arith_04"]] by smt lemma "7 * 3 = (21::8 word)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_bv_arith_05"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_bv_arith_05"]] by smt lemma "11 - 27 = (-16::8 word)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_bv_arith_06"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_bv_arith_06"]] by smt lemma "- -11 = (11::5 word)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_bv_arith_07"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_bv_arith_07"]] by smt lemma "-40 + 1 = (-39::7 word)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_bv_arith_08"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_bv_arith_08"]] by smt lemma "a + 2 * b + c - b = (b + c) + (a :: 32 word)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_bv_arith_09"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_bv_arith_09"]] by smt lemma "x = (5 :: 4 word) \ 4 * x = 4" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_bv_arith_10"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_bv_arith_10"]] by smt subsection {* Bit-level logic *} lemma "0b110 AND 0b101 = (0b100 :: 32 word)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_bv_bit_01"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_bv_bit_01"]] by smt lemma "0b110 OR 0b011 = (0b111 :: 8 word)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_bv_bit_02"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_bv_bit_02"]] by smt lemma "0xF0 XOR 0xFF = (0x0F :: 8 word)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_bv_bit_03"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_bv_bit_03"]] by smt lemma "NOT (0xF0 :: 16 word) = 0xFF0F" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_bv_bit_04"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_bv_bit_04"]] by smt lemma "word_cat (27::4 word) (27::8 word) = (2843::12 word)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_bv_bit_05"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_bv_bit_05"]] by smt lemma "word_cat (0b0011::4 word) (0b1111::6word) = (0b0011001111 :: 10 word)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_bv_bit_06"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_bv_bit_06"]] by smt lemma "slice 1 (0b10110 :: 4 word) = (0b11 :: 2 word)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_bv_bit_07"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_bv_bit_07"]] by smt lemma "ucast (0b1010 :: 4 word) = (0b1010 :: 10 word)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_bv_bit_08"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_bv_bit_08"]] by smt lemma "scast (0b1010 :: 4 word) = (0b111010 :: 6 word)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_bv_bit_09"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_bv_bit_09"]] by smt lemma "bv_lshr 0b10011 2 = (0b100::8 word)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_bv_bit_10"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_bv_bit_10"]] by smt lemma "bv_ashr 0b10011 2 = (0b100::8 word)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_bv_bit_11"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_bv_bit_11"]] by smt lemma "word_rotr 2 0b0110 = (0b1001::4 word)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_bv_bit_12"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_bv_bit_12"]] by smt lemma "word_rotl 1 0b1110 = (0b1101::4 word)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_bv_bit_13"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_bv_bit_13"]] by smt lemma "(x AND 0xff00) OR (x AND 0x00ff) = (x::16 word)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_bv_bit_14"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_bv_bit_14"]] by smt lemma "w < 256 \ (w :: 16 word) AND 0x00FF = w" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_bv_bit_15"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_bv_bit_15"]] by smt end @@ -649,56 +654,56 @@ shows "\i::int. i < 0 \ (\x::2 word. bv2int x > i)" using assms using [[smt_solver=z3]] - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_bv_01"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_bv_01"]] by smt lemma "P (0 \ (a :: 4 word)) = P True" using [[smt_solver=z3, z3_proofs=false]] - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_bv_02"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_bv_02"]] by smt section {* Pairs *} lemma "fst (x, y) = a \ x = a" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_pair_01"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_pair_01"]] by smt lemma "p1 = (x, y) \ p2 = (y, x) \ fst p1 = snd p2" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_pair_02"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_pair_02"]] by smt section {* Higher-order problems and recursion *} lemma "i \ i1 \ i \ i2 \ (f (i1 := v1, i2 := v2)) i = f i" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_hol_01"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_hol_01"]] by smt lemma "(f g x = (g x \ True)) \ (f g x = True) \ (g x = True)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_hol_02"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_hol_02"]] by smt lemma "id 3 = 3 \ id True = True" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_hol_03"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_hol_03"]] by (smt add: id_def) lemma "i \ i1 \ i \ i2 \ ((f (i1 := v1)) (i2 := v2)) i = f i" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_hol_04"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_hol_04"]] by smt lemma "map (\i::nat. i + 1) [0, 1] = [1, 2]" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_hol_05"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_hol_05"]] by (smt add: map.simps) lemma "(ALL x. P x) | ~ All P" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_hol_06"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_hol_06"]] by smt fun dec_10 :: "nat \ nat" where "dec_10 n = (if n < 10 then n else dec_10 (n - 10))" lemma "dec_10 (4 * dec_10 4) = 6" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_hol_07"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_hol_07"]] by (smt add: dec_10.simps) axiomatization @@ -715,7 +720,7 @@ (eval_dioph ks (map (\x. x mod 2) xs) mod 2 = l mod 2 \ eval_dioph ks (map (\x. x div 2) xs) = (l - eval_dioph ks (map (\x. x mod 2) xs)) div 2)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_hol_08"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_hol_08"]] by (smt add: eval_dioph_mod[where n=2] eval_dioph_div_mult[where n=2]) @@ -724,7 +729,7 @@ definition P :: "'a \ bool" where "P x = True" lemma poly_P: "P x \ (P [x] \ \P[x])" by (simp add: P_def) lemma "P (1::int)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_mono_01"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_mono_01"]] by (smt add: poly_P) consts g :: "'a \ nat" @@ -733,7 +738,7 @@ g2: "g None = g []" g3: "g xs = length xs" lemma "g (Some (3::int)) = g (Some True)" - using [[smt_cert="~/isabelle/SMT/Examples/cert/z3_mono_02"]] + using [[smt_cert="$ISABELLE_SMT/Examples/cert/z3_mono_02"]] by (smt add: g1 g2 g3 list.size) end