src/HOL/SMT_Examples/SMT_Examples.thy
changeset 41282 a4d1b5eef12e
parent 41132 42384824b732
child 41303 939f647f0c9e
equal deleted inserted replaced
41281:679118e35378 41282:a4d1b5eef12e
    23 lemma "(p \<and> True) = p" by smt
    23 lemma "(p \<and> True) = p" by smt
    24 
    24 
    25 lemma "(p \<or> q) \<and> \<not>p \<Longrightarrow> q" by smt
    25 lemma "(p \<or> q) \<and> \<not>p \<Longrightarrow> q" by smt
    26 
    26 
    27 lemma "(a \<and> b) \<or> (c \<and> d) \<Longrightarrow> (a \<and> b) \<or> (c \<and> d)"
    27 lemma "(a \<and> b) \<or> (c \<and> d) \<Longrightarrow> (a \<and> b) \<or> (c \<and> d)"
    28   using [[smt_oracle=true]] (* no Z3 proof *)
       
    29   by smt
    28   by smt
    30 
    29 
    31 lemma "(p1 \<and> p2) \<or> p3 \<longrightarrow> (p1 \<longrightarrow> (p3 \<and> p2) \<or> (p1 \<and> p3)) \<or> p1" by smt
    30 lemma "(p1 \<and> p2) \<or> p3 \<longrightarrow> (p1 \<longrightarrow> (p3 \<and> p2) \<or> (p1 \<and> p3)) \<or> p1" by smt
    32 
    31 
    33 lemma "P=P=P=P=P=P=P=P=P=P" by smt
    32 lemma "P=P=P=P=P=P=P=P=P=P" by smt
   398 
   397 
   399 
   398 
   400 subsection {* Non-linear arithmetic over integers and reals *}
   399 subsection {* Non-linear arithmetic over integers and reals *}
   401 
   400 
   402 lemma "a > (0::int) \<Longrightarrow> a*b > 0 \<Longrightarrow> b > 0"
   401 lemma "a > (0::int) \<Longrightarrow> a*b > 0 \<Longrightarrow> b > 0"
   403   using [[smt_oracle=true]]  -- {* Isabelle's arithmetic decision procedures
   402   using zero_less_mult_pos
   404     are too weak to automatically prove @{thm zero_less_mult_pos}. *}
   403   by smt
   405   by smt (* FIXME: use z3_rule *)
   404 
   406 
   405 lemma  "(a::int) * (x + 1 + y) = a * x + a * (y + 1)"
   407 
   406   using right_distrib
   408 
   407   by smt
   409 lemma  "(a::int) * (x + 1 + y) = a * x + a * (y + 1)" by smt
   408 
   410 
   409 lemma "((x::real) * (1 + y) - x * (1 - y)) = (2 * x * y)"
   411 lemma "((x::real) * (1 + y) - x * (1 - y)) = (2 * x * y)" by smt
   410   sorry (* FIXME: Z3 could solve this directly *)
   412 
   411 
   413 lemma
   412 lemma
   414   "(U::int) + (1 + p) * (b + e) + p * d =
   413   "(U::int) + (1 + p) * (b + e) + p * d =
   415    U + (2 * (1 + p) * (b + e) + (1 + p) * d + d * p) - (1 + p) * (b + d + e)"
   414    U + (2 * (1 + p) * (b + e) + (1 + p) * d + d * p) - (1 + p) * (b + d + e)"
   416   by smt
   415   sorry (* FIXME: Z3 could solve this directly *)
   417 
   416 
   418 
   417 
   419 subsection {* Linear arithmetic for natural numbers *}
   418 subsection {* Linear arithmetic for natural numbers *}
   420 
   419 
   421 lemma "2 * (x::nat) ~= 1" by smt
   420 lemma "2 * (x::nat) ~= 1" by smt