src/HOL/SMT_Examples/SMT_Tests.thy
changeset 41132 42384824b732
parent 40681 872b08416fb4
child 41426 09615ed31f04
equal deleted inserted replaced
41131:fc9d503c3d67 41132:42384824b732
   150 
   150 
   151 lemma
   151 lemma
   152   "(\<not>(\<exists>x. P x)) \<longleftrightarrow> (\<forall>x. \<not> P x)"
   152   "(\<not>(\<exists>x. P x)) \<longleftrightarrow> (\<forall>x. \<not> P x)"
   153   "(\<exists>x. P x \<longrightarrow> Q) \<longleftrightarrow> (\<forall>x. P x) \<longrightarrow> Q"
   153   "(\<exists>x. P x \<longrightarrow> Q) \<longleftrightarrow> (\<forall>x. P x) \<longrightarrow> Q"
   154   "(\<forall>x y. R x y = x) \<longrightarrow> (\<exists>y. R x y) = R x c"
   154   "(\<forall>x y. R x y = x) \<longrightarrow> (\<exists>y. R x y) = R x c"
   155   "\<forall>x. \<exists>y. f x y = f x (g x)"
       
   156   "(if P x then \<not>(\<exists>y. P y) else (\<forall>y. \<not>P y)) \<longrightarrow> P x \<longrightarrow> P y"
   155   "(if P x then \<not>(\<exists>y. P y) else (\<forall>y. \<not>P y)) \<longrightarrow> P x \<longrightarrow> P y"
   157   "(\<forall>x y. R x y = x) \<and> (\<forall>x. \<exists>y. R x y) = (\<forall>x. R x c) \<longrightarrow> (\<exists>y. R x y) = R x c"
   156   "(\<forall>x y. R x y = x) \<and> (\<forall>x. \<exists>y. R x y) = (\<forall>x. R x c) \<longrightarrow> (\<exists>y. R x y) = R x c"
   158   by smt+
   157   by smt+
   159 
   158 
   160 lemma  (* only without proofs: *)
   159 lemma  (* only without proofs: *)
       
   160   "\<forall>x. \<exists>y. f x y = f x (g x)"
   161   "(\<not>\<not>(\<exists>x. P x)) \<longleftrightarrow> (\<not>(\<forall>x. \<not> P x))"
   161   "(\<not>\<not>(\<exists>x. P x)) \<longleftrightarrow> (\<not>(\<forall>x. \<not> P x))"
   162   "\<forall>u. \<exists>v. \<forall>w. \<exists>x. f u v w x = f u (g u) w (h u w)"
   162   "\<forall>u. \<exists>v. \<forall>w. \<exists>x. f u v w x = f u (g u) w (h u w)"
   163   "\<exists>x. if x = y then (\<forall>y. y = x \<or> y \<noteq> x) else (\<forall>y. y = (x, x) \<or> y \<noteq> (x, x))"
   163   "\<exists>x. if x = y then (\<forall>y. y = x \<or> y \<noteq> x) else (\<forall>y. y = (x, x) \<or> y \<noteq> (x, x))"
   164   "\<exists>x. if x = y then (\<exists>y. y = x \<or> y \<noteq> x) else (\<exists>y. y = (x, x) \<or> y \<noteq> (x, x))"
   164   "\<exists>x. if x = y then (\<exists>y. y = x \<or> y \<noteq> x) else (\<exists>y. y = (x, x) \<or> y \<noteq> (x, x))"
   165   "(\<exists>x. \<forall>y. P x \<longleftrightarrow> P y) \<longrightarrow> ((\<exists>x. P x) \<longleftrightarrow> (\<forall>y. P y))"
   165   "(\<exists>x. \<forall>y. P x \<longleftrightarrow> P y) \<longrightarrow> ((\<exists>x. P x) \<longleftrightarrow> (\<forall>y. P y))"
   520   "x + (y + z) = (x + y) + z"
   520   "x + (y + z) = (x + y) + z"
   521   "(x + y = 0) = (x = -y)"
   521   "(x + y = 0) = (x = -y)"
   522   by smt+
   522   by smt+
   523 
   523 
   524 lemma
   524 lemma
   525   "(-1::int) = - 1"
   525   "(-1::real) = - 1"
   526   "(-3::int) = - 3"
   526   "(-3::real) = - 3"
   527   "-(x::real) < 0 \<longleftrightarrow> x > 0"
   527   "-(x::real) < 0 \<longleftrightarrow> x > 0"
   528   "x > 0 \<longrightarrow> -x < 0"
   528   "x > 0 \<longrightarrow> -x < 0"
   529   "x < 0 \<longrightarrow> -x > 0"
   529   "x < 0 \<longrightarrow> -x > 0"
   530   by smt+
   530   by smt+
   531 
   531 
   537   "x - y = -y + x"
   537   "x - y = -y + x"
   538   "x - y - z = x - (y + z)" 
   538   "x - y - z = x - (y + z)" 
   539   by smt+
   539   by smt+
   540 
   540 
   541 lemma
   541 lemma
   542   "(x::int) * 0 = 0"
   542   "(x::real) * 0 = 0"
   543   "0 * x = 0"
   543   "0 * x = 0"
   544   "x * 1 = x"
   544   "x * 1 = x"
   545   "1 * x = x"
   545   "1 * x = x"
   546   "x * -1 = -x"
   546   "x * -1 = -x"
   547   "-1 * x = -x"
   547   "-1 * x = -x"
   620   "(snd (snd (x, y, z)) = snd (snd (u, v, w))) = (z = w)"
   620   "(snd (snd (x, y, z)) = snd (snd (u, v, w))) = (z = w)"
   621   "(fst (x, y) = snd (x, y)) = (x = y)"
   621   "(fst (x, y) = snd (x, y)) = (x = y)"
   622   "p1 = (x, y) \<and> p2 = (y, x) \<longrightarrow> fst p1 = snd p2"
   622   "p1 = (x, y) \<and> p2 = (y, x) \<longrightarrow> fst p1 = snd p2"
   623   "(fst (x, y) = snd (x, y)) = (x = y)"
   623   "(fst (x, y) = snd (x, y)) = (x = y)"
   624   "(fst p = snd p) = (p = (snd p, fst p))"
   624   "(fst p = snd p) = (p = (snd p, fst p))"
   625   using [[smt_trace=true]]
   625   using fst_conv snd_conv pair_collapse
   626   by smt+
   626   by smt+
   627 
   627 
   628 
   628 
   629 
   629 
   630 section {* Function updates *}
   630 section {* Function updates *}
   635   "i1 \<noteq> i2 \<longrightarrow> (f (i1 := v1, i2 := v2)) i1 = v1"
   635   "i1 \<noteq> i2 \<longrightarrow> (f (i1 := v1, i2 := v2)) i1 = v1"
   636   "i1 \<noteq> i2 \<longrightarrow> (f (i1 := v1, i2 := v2)) i2 = v2"
   636   "i1 \<noteq> i2 \<longrightarrow> (f (i1 := v1, i2 := v2)) i2 = v2"
   637   "i1 = i2 \<longrightarrow> (f (i1 := v1, i2 := v2)) i1 = v2"
   637   "i1 = i2 \<longrightarrow> (f (i1 := v1, i2 := v2)) i1 = v2"
   638   "i1 = i2 \<longrightarrow> (f (i1 := v1, i2 := v2)) i1 = v2"
   638   "i1 = i2 \<longrightarrow> (f (i1 := v1, i2 := v2)) i1 = v2"
   639   "distinct [i1, i2, i3] \<longrightarrow> (f (i1 := v1, i2 := v2)) i3 = f i3"
   639   "distinct [i1, i2, i3] \<longrightarrow> (f (i1 := v1, i2 := v2)) i3 = f i3"
       
   640   using fun_upd_same fun_upd_apply
   640   by smt+
   641   by smt+
   641 
   642 
   642 
   643 
   643 
   644 
   644 section {* Sets *}
   645 section {* Sets *}