lemma assumes"x ≥ (3::int)"and"y = x + 4" shows"y - x > 0" using assms by smt
lemma"let x = (2 :: int) in x + x ≠ 5"by smt
lemma fixes x :: real assumes"3 * x + 7 * a < 4"and"3 < 2 * x" shows"a < 0" using assms by smt
lemma"(0 ≤ y + -1 * x ∨¬ 0 ≤ x ∨ 0 ≤ (x::int)) = (¬ False)"by smt
lemma" (n < m ∧ m < n') ∨ (n < m ∧ m = n') ∨ (n < n' ∧ n' < m) ∨ (n = n' ∧ n' < m) ∨ (n = m ∧ m < n') ∨ (n' < m ∧ m < n) ∨ (n' < m ∧ m = n) ∨ (n' < n ∧ n < m) ∨ (n' = n ∧ n < m) ∨ (n' = m ∧ m < n) ∨ (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))" by smt
text‹ The following example was taken from HOL/ex/PresburgerEx.thy, where it says: This following theorem proves that all solutions to the recurrence relation $x_{i+2} = |x_{i+1}| - x_i$ are periodic with period 9. The example was brought to our attention by John Harrison. It does does not require Presburger arithmetic but merely quantifier-free linear arithmetic and holds for the rationals as well. Warning: it takes (in 2006) over 4.2 minutes! There, it is proved by "arith". SMT is able to prove this within a fraction of one second. With proof reconstruction, it takes about 13 seconds on a Core2 processor. ›
lemma"∃x::real. 0 < x" using [[smt_oracle=true]] (* no Z3 proof *) by smt
lemma"∀x::int. ∃y. y > x"by smt
lemma"∀x y::int. (x = 0 ∧ y = 1) ⟶ x ≠ y"by smt lemma"∃x::int. ∀y. x < y ⟶ y < 0 ∨ y >= 0"by smt lemma"∀x y::int. x < y ⟶ (2 * x + 1) < (2 * y)"by smt lemma"∀x y::int. (2 * x + 1) ≠ (2 * y)"by smt lemma"∀x y::int. x + y > 2 ∨ x + y = 2 ∨ x + y < 2"by smt lemma"∀x::int. if x > 0 then x + 1 > 0 else 1 > x"by smt lemma"if (∀x::int. x < 0 ∨ x > 0) then False else True"by smt lemma"(if (∀x::int. x < 0 ∨ x > 0) then -1 else 3) > (0::int)"by smt lemma"~ (∃x y z::int. 4 * x + -6 * y = (1::int))"by smt lemma"∃x::int. ∀x y. 0 < x ∧ 0 < y ⟶ (0::int) < x + y"by smt lemma"∃u::int. ∀(x::int) y::real. 0 < x ∧ 0 < y ⟶ -1 < x"by smt lemma"∃x::int. (∀y. y ≥ x ⟶ y > 0) ⟶ x > 0"by smt lemma"∀(a::int) b::int. 0 < b ∨ b < 1"by smt
subsection‹Non-linear arithmetic over integers and reals›
lemma"a > (0::int) ==> a*b > 0 ==> b > 0" using [[smt_oracle, z3_extensions]] by smt
lemma"(a::int) * (x + 1 + y) = a * x + a * (y + 1)" using [[z3_extensions]] by smt
lemma"((x::real) * (1 + y) - x * (1 - y)) = (2 * x * y)" using [[z3_extensions]] 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 [[z3_extensions]] by smt
lemma [z3_rule]: fixes x :: "int" assumes"x * y ≤ 0"and"¬ y ≤ 0"and"¬ x ≤ 0" shows False using assms by (metis mult_le_0_iff)
subsection‹Linear arithmetic for natural numbers›
declare [[smt_nat_as_int]]
lemma"2 * (x::nat) ≠ 1"by smt
lemma"a < 3 ==> (7::nat) > 2 * a"by smt
lemma"let x = (1::nat) + y in x - y > 0 * x"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)" by smt
axiomatization
eval_dioph :: "int list ==> int list ==> int" where
eval_dioph_mod: "eval_dioph ks xs mod n = eval_dioph ks (map (λx. x mod n) xs) mod n" and
eval_dioph_div_mult: "eval_dioph ks (map (λx. x div n) xs) * n + eval_dioph ks (map (λx. x mod n) xs) = eval_dioph ks xs"
lemma "(eval_dioph ks xs = l) = (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_oracle = true]] (*FIXME*) using [[z3_extensions]] by (smt eval_dioph_mod[where n=2] eval_dioph_div_mult[where n=2])
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.