author paulson Wed Mar 24 10:50:29 2004 +0100 (2004-03-24) changeset 14479 0eca4aabf371 parent 14478 bdf6b7adc3ec child 14480 14b7923b3307
streamlined treatment of quotients for the integers
 src/HOL/Integ/Bin.thy file | annotate | diff | revisions src/HOL/Integ/IntArith.thy file | annotate | diff | revisions src/HOL/Integ/IntDef.thy file | annotate | diff | revisions src/HOL/Integ/IntDiv.thy file | annotate | diff | revisions src/HOL/Integ/IntDiv_setup.ML file | annotate | diff | revisions src/HOL/Integ/cooper_proof.ML file | annotate | diff | revisions src/HOL/Set.thy file | annotate | diff | revisions src/HOL/Tools/Presburger/cooper_proof.ML file | annotate | diff | revisions
```     1.1 --- a/src/HOL/Integ/Bin.thy	Fri Mar 19 11:06:53 2004 +0100
1.2 +++ b/src/HOL/Integ/Bin.thy	Wed Mar 24 10:50:29 2004 +0100
1.3 @@ -137,7 +137,7 @@
1.4  lemma odd_nonzero: "1 + z + z \<noteq> (0::int)";
1.5  proof (cases z rule: int_cases)
1.6    case (nonneg n)
1.7 -  have le: "0 \<le> z+z" by (simp add: prems add_increasing)
1.8 +  have le: "0 \<le> z+z" by (simp add: nonneg add_increasing)
1.9    thus ?thesis using  le_imp_0_less [OF le]
1.11  next
1.12 @@ -147,7 +147,8 @@
1.13      assume eq: "1 + z + z = 0"
1.14      have "0 < 1 + (int n + int n)"
1.16 -    also have "... = - (1 + z + z)" by (simp add: prems int_Suc add_ac)
1.17 +    also have "... = - (1 + z + z)"
1.19      also have "... = 0" by (simp add: eq)
1.20      finally have "0<0" ..
1.21      thus False by blast
1.22 @@ -235,9 +236,9 @@
1.23    assume "a \<in> range of_int"
1.24    then obtain z where a: "a = of_int z" ..
1.25    hence "((1::'a) + a + a < 0) = (of_int (1 + z + z) < (of_int 0 :: 'a))"
1.26 -    by (simp add: prems)
1.27 +    by (simp add: a)
1.28    also have "... = (z < 0)" by (simp only: of_int_less_iff odd_less_0)
1.29 -  also have "... = (a < 0)" by (simp add: prems)
1.30 +  also have "... = (a < 0)" by (simp add: a)
1.31    finally show ?thesis .
1.32  qed
1.33
```
```     2.1 --- a/src/HOL/Integ/IntArith.thy	Fri Mar 19 11:06:53 2004 +0100
2.2 +++ b/src/HOL/Integ/IntArith.thy	Wed Mar 24 10:50:29 2004 +0100
2.3 @@ -40,17 +40,6 @@
2.4
2.5  subsection{*Inequality Reasoning for the Arithmetic Simproc*}
2.6
2.7 -lemma zero_less_nat_eq [simp]: "(0 < nat z) = (0 < z)"
2.8 -by (cut_tac w = 0 in zless_nat_conj, auto)
2.9 -
2.10 -lemma zless_imp_add1_zle: "w<z ==> w + (1::int) \<le> z"
2.11 -apply (rule eq_Abs_Integ [of z])
2.12 -apply (rule eq_Abs_Integ [of w])
2.14 -done
2.15 -
2.16 -
2.17 -
2.18  lemma add_numeral_0: "Numeral0 + a = (a::'a::number_ring)"
2.19  by simp
2.20
2.21 @@ -170,10 +159,10 @@
2.22  lemma add1_zle_eq: "(w + (1::int) \<le> z) = (w<z)"
2.23  by arith
2.24
2.25 -lemma zle_diff1_eq [simp]: "(w \<le> z - (1::int)) = (w<(z::int))"
2.26 +lemma zle_diff1_eq [simp]: "(w \<le> z - (1::int)) = (w<z)"
2.27  by arith
2.28
2.29 -lemma zle_add1_eq_le [simp]: "(w < z + 1) = (w\<le>(z::int))"
2.30 +lemma zle_add1_eq_le [simp]: "(w < z + (1::int)) = (w\<le>z)"
2.31  by arith
2.32
2.33  lemma int_one_le_iff_zero_less: "((1::int) \<le> z) = (0 < z)"
2.34 @@ -182,32 +171,13 @@
2.35
2.36  subsection{*The Functions @{term nat} and @{term int}*}
2.37
2.38 -lemma nonneg_eq_int: "[| 0 \<le> z;  !!m. z = int m ==> P |] ==> P"
2.39 -by (blast dest: nat_0_le sym)
2.40 -
2.41 -lemma nat_eq_iff: "(nat w = m) = (if 0 \<le> w then w = int m else m=0)"
2.42 -by auto
2.43 -
2.44 -lemma nat_eq_iff2: "(m = nat w) = (if 0 \<le> w then w = int m else m=0)"
2.45 -by auto
2.46 -
2.47 -lemma nat_less_iff: "0 \<le> w ==> (nat w < m) = (w < int m)"
2.48 -apply (rule iffI)
2.49 -apply (erule nat_0_le [THEN subst])
2.50 -apply (simp_all del: zless_int add: zless_int [symmetric])
2.51 -done
2.52 -
2.53 -lemma int_eq_iff: "(int m = z) = (m = nat z & 0 \<le> z)"
2.54 -by (auto simp add: nat_eq_iff2)
2.55 -
2.56 -
2.57  text{*Simplify the terms @{term "int 0"}, @{term "int(Suc 0)"} and
2.58    @{term "w + - z"}*}
2.59  declare Zero_int_def [symmetric, simp]
2.60  declare One_int_def [symmetric, simp]
2.61
2.62  text{*cooper.ML refers to this theorem*}
2.63 -lemmas zdiff_def_symmetric = zdiff_def [symmetric, simp]
2.64 +lemmas diff_int_def_symmetric = diff_int_def [symmetric, simp]
2.65
2.66  lemma nat_0: "nat 0 = 0"
2.68 @@ -218,22 +188,10 @@
2.69  lemma nat_2: "nat 2 = Suc (Suc 0)"
2.70  by (subst nat_eq_iff, simp)
2.71
2.72 -lemma nat_less_eq_zless: "0 \<le> w ==> (nat w < nat z) = (w<z)"
2.73 -apply (case_tac "z < 0")
2.74 -apply (auto simp add: nat_less_iff)
2.75 -done
2.76 -
2.77 -lemma nat_le_eq_zle: "0 < w | 0 \<le> z ==> (nat w \<le> nat z) = (w\<le>z)"
2.78 -by (auto simp add: linorder_not_less [symmetric] zless_nat_conj)
2.79 -
2.80 -
2.81  text{*This simplifies expressions of the form @{term "int n = z"} where
2.82        z is an integer literal.*}
2.83  declare int_eq_iff [of _ "number_of v", standard, simp]
2.84
2.85 -lemma int_nat_eq [simp]: "int (nat z) = (if 0 \<le> z then z else 0)"
2.86 -  by simp
2.87 -
2.88  lemma split_nat [arith_split]:
2.89    "P(nat(i::int)) = ((\<forall>n. i = int n \<longrightarrow> P n) & (i < 0 \<longrightarrow> P 0))"
2.90    (is "?P = (?L & ?R)")
2.91 @@ -251,6 +209,29 @@
2.92  qed
2.93
2.94
2.96 +lemma zdiff_int: "n \<le> m ==> int m - int n = int (m-n)"
2.97 +by (induct m n rule: diff_induct, simp_all)
2.98 +
2.99 +lemma nat_mult_distrib: "(0::int) \<le> z ==> nat (z*z') = nat z * nat z'"
2.100 +apply (case_tac "0 \<le> z'")
2.101 +apply (rule inj_int [THEN injD])
2.102 +apply (simp add: zmult_int [symmetric] zero_le_mult_iff)
2.104 +done
2.105 +
2.106 +lemma nat_mult_distrib_neg: "z \<le> (0::int) ==> nat(z*z') = nat(-z) * nat(-z')"
2.107 +apply (rule trans)
2.108 +apply (rule_tac [2] nat_mult_distrib, auto)
2.109 +done
2.110 +
2.111 +lemma nat_abs_mult_distrib: "nat (abs (w * z)) = nat (abs w) * nat (abs z)"
2.112 +apply (case_tac "z=0 | w=0")
2.113 +apply (auto simp add: zabs_def nat_mult_distrib [symmetric]
2.114 +                      nat_mult_distrib_neg [symmetric] mult_less_0_iff)
2.115 +done
2.116 +
2.117 +
2.118  subsubsection "Induction principles for int"
2.119
2.120                       (* `set:int': dummy construction *)
2.121 @@ -390,42 +371,6 @@
2.122  done
2.123
2.124
2.126 -
2.128 -lemma zdiff_int: "n \<le> m ==> int m - int n = int (m-n)"
2.129 -by (induct m n rule: diff_induct, simp_all)
2.130 -
2.132 -     "[| (0::int) \<le> z;  0 \<le> z' |] ==> nat (z+z') = nat z + nat z'"
2.133 -apply (rule inj_int [THEN injD])
2.135 -done
2.136 -
2.137 -lemma nat_diff_distrib:
2.138 -     "[| (0::int) \<le> z';  z' \<le> z |] ==> nat (z-z') = nat z - nat z'"
2.139 -apply (rule inj_int [THEN injD])
2.140 -apply (simp add: zdiff_int [symmetric] nat_le_eq_zle)
2.141 -done
2.142 -
2.143 -lemma nat_mult_distrib: "(0::int) \<le> z ==> nat (z*z') = nat z * nat z'"
2.144 -apply (case_tac "0 \<le> z'")
2.145 -apply (rule inj_int [THEN injD])
2.146 -apply (simp add: zmult_int [symmetric] zero_le_mult_iff)
2.148 -done
2.149 -
2.150 -lemma nat_mult_distrib_neg: "z \<le> (0::int) ==> nat(z*z') = nat(-z) * nat(-z')"
2.151 -apply (rule trans)
2.152 -apply (rule_tac [2] nat_mult_distrib, auto)
2.153 -done
2.154 -
2.155 -lemma nat_abs_mult_distrib: "nat (abs (w * z)) = nat (abs w) * nat (abs z)"
2.156 -apply (case_tac "z=0 | w=0")
2.157 -apply (auto simp add: zabs_def nat_mult_distrib [symmetric]
2.158 -                      nat_mult_distrib_neg [symmetric] mult_less_0_iff)
2.159 -done
2.160 -
2.161
2.162  ML
2.163  {*
```
```     3.1 --- a/src/HOL/Integ/IntDef.thy	Fri Mar 19 11:06:53 2004 +0100
3.2 +++ b/src/HOL/Integ/IntDef.thy	Wed Mar 24 10:50:29 2004 +0100
3.3 @@ -8,13 +8,15 @@
3.4  header{*The Integers as Equivalence Classes over Pairs of Natural Numbers*}
3.5
3.6  theory IntDef = Equiv + NatArith:
3.7 +
3.8  constdefs
3.9    intrel :: "((nat * nat) * (nat * nat)) set"
3.10 -    "intrel == {p. \<exists>x1 y1 x2 y2. p = ((x1,y1),(x2,y2)) & x1+y2 = x2+y1}"
3.11 +    --{*the equivalence relation underlying the integers*}
3.12 +    "intrel == {p. \<exists>x y u v. p = ((x,y),(u,v)) & x+v = u+y}"
3.13
3.14  typedef (Integ)
3.15    int = "UNIV//intrel"
3.16 -    by (auto simp add: quotient_def)
3.17 +    by (auto simp add: quotient_def)
3.18
3.19  instance int :: ord ..
3.20  instance int :: zero ..
3.21 @@ -27,49 +29,57 @@
3.22
3.23    int :: "nat => int"
3.24    "int m == Abs_Integ(intrel `` {(m,0)})"
3.25 -
3.26 +
3.27 +
3.29 -
3.30 -  zminus_def:    "- Z == Abs_Integ(\<Union>(x,y) \<in> Rep_Integ(Z). intrel``{(y,x)})"
3.31
3.32    Zero_int_def:  "0 == int 0"
3.33    One_int_def:   "1 == int 1"
3.34
3.36 -   "z + w ==
3.37 -       Abs_Integ(\<Union>(x1,y1) \<in> Rep_Integ(z). \<Union>(x2,y2) \<in> Rep_Integ(w).
3.38 -		 intrel``{(x1+x2, y1+y2)})"
3.39 +  minus_int_def:
3.40 +    "- z ==  contents (\<Union>(x,y) \<in> Rep_Integ(z). { Abs_Integ(intrel``{(y,x)}) })"
3.41 +
3.43 +   "z + w ==
3.44 +       contents (\<Union>(x,y) \<in> Rep_Integ(z). \<Union>(u,v) \<in> Rep_Integ(w).
3.45 +		 { Abs_Integ(intrel``{(x+u, y+v)}) })"
3.46 +
3.47 +  diff_int_def:  "z - (w::int) == z + (-w)"
3.48
3.49 -  zdiff_def:  "z - (w::int) == z + (-w)"
3.50 -  zmult_def:
3.51 -   "z * w ==
3.52 -       Abs_Integ(\<Union>(x1,y1) \<in> Rep_Integ(z). \<Union>(x2,y2) \<in> Rep_Integ(w).
3.53 -		 intrel``{(x1*x2 + y1*y2, x1*y2 + y1*x2)})"
3.54 +  mult_int_def:
3.55 +   "z * w ==
3.56 +       contents (\<Union>(x,y) \<in> Rep_Integ(z). \<Union>(u,v) \<in> Rep_Integ(w).
3.57 +		 { Abs_Integ(intrel``{(x*u + y*v, x*v + y*u)}) })"
3.58 +
3.59 +  le_int_def:
3.60 +   "z \<le> (w::int) ==
3.61 +    \<exists>x y u v. x+v \<le> u+y & (x,y) \<in> Rep_Integ z & (u,v) \<in> Rep_Integ w"
3.62
3.63 -  zless_def: "(z < (w::int)) == (z \<le> w & z \<noteq> w)"
3.64 +  less_int_def: "(z < (w::int)) == (z \<le> w & z \<noteq> w)"
3.65 +
3.66 +
3.67 +subsection{*Construction of the Integers*}
3.68
3.69 -  zle_def:
3.70 -  "z \<le> (w::int) == \<exists>x1 y1 x2 y2. x1 + y2 \<le> x2 + y1 &
3.71 -                            (x1,y1) \<in> Rep_Integ z & (x2,y2) \<in> Rep_Integ w"
3.72 +subsubsection{*Preliminary Lemmas about the Equivalence Relation*}
3.73
3.74 -lemma intrel_iff [simp]: "(((x1,y1),(x2,y2)) \<in>  intrel) = (x1+y2 = x2+y1)"
3.75 -by (unfold intrel_def, blast)
3.76 +lemma intrel_iff [simp]: "(((x,y),(u,v)) \<in>  intrel) = (x+v = u+y)"
3.78
3.79  lemma equiv_intrel: "equiv UNIV intrel"
3.80 -by (unfold intrel_def equiv_def refl_def sym_def trans_def, auto)
3.81 +by (simp add: intrel_def equiv_def refl_def sym_def trans_def)
3.82
3.83  lemmas equiv_intrel_iff =
3.84         eq_equiv_class_iff [OF equiv_intrel UNIV_I UNIV_I, simp]
3.85
3.86 -lemma intrel_in_integ [simp]: "intrel``{(x,y)}:Integ"
3.87 -by (unfold Integ_def intrel_def quotient_def, fast)
3.88 +lemma intrel_in_integ [simp]: "intrel``{(x,y)} \<in> Integ"
3.89 +by (simp add: Integ_def intrel_def quotient_def, fast)
3.90
3.91  lemma inj_on_Abs_Integ: "inj_on Abs_Integ Integ"
3.92  apply (rule inj_on_inverseI)
3.93  apply (erule Abs_Integ_inverse)
3.94  done
3.95
3.96 -declare inj_on_Abs_Integ [THEN inj_on_iff, simp]
3.97 +declare inj_on_Abs_Integ [THEN inj_on_iff, simp]
3.98          Abs_Integ_inverse [simp]
3.99
3.100  lemma inj_Rep_Integ: "inj(Rep_Integ)"
3.101 @@ -77,85 +87,64 @@
3.102  apply (rule Rep_Integ_inverse)
3.103  done
3.104
3.105 +text{*Case analysis on the representation of an integer as an equivalence
3.106 +      class.*}
3.107 +lemma eq_Abs_Integ [case_names Abs_Integ, cases type: int]:
3.108 +     "(!!x y. z = Abs_Integ(intrel``{(x,y)}) ==> P) ==> P"
3.109 +apply (rule Rep_Integ [of z, unfolded Integ_def, THEN quotientE])
3.110 +apply (drule arg_cong [where f=Abs_Integ])
3.111 +apply (auto simp add: Rep_Integ_inverse)
3.112 +done
3.113
3.114 -(** int: the injection from "nat" to "int" **)
3.115 +
3.116 +subsubsection{*@{term int}: Embedding the Naturals into the Integers*}
3.117
3.118  lemma inj_int: "inj int"
3.119 -apply (rule inj_onI)
3.120 -apply (unfold int_def)
3.121 -apply (drule inj_on_Abs_Integ [THEN inj_onD])
3.122 -apply (rule intrel_in_integ)+
3.123 -apply (drule eq_equiv_class)
3.124 -apply (rule equiv_intrel, fast)
3.126 -done
3.127 +by (simp add: inj_on_def int_def)
3.128
3.129  lemma int_int_eq [iff]: "(int m = int n) = (m = n)"
3.130  by (fast elim!: inj_int [THEN injD])
3.131
3.132
3.133 -
3.134 -subsection{*zminus: unary negation on Integ*}
3.135 -
3.136 -lemma zminus_congruent: "congruent intrel (%(x,y). intrel``{(y,x)})"
3.137 -apply (unfold congruent_def intrel_def)
3.139 -done
3.140 -
3.141 -lemma zminus: "- Abs_Integ(intrel``{(x,y)}) = Abs_Integ(intrel `` {(y,x)})"
3.142 -by (simp add: zminus_def equiv_intrel [THEN UN_equiv_class] zminus_congruent)
3.143 +subsubsection{*Integer Unary Negation*}
3.144
3.145 -(*Every integer can be written in the form Abs_Integ(...) *)
3.146 -lemma eq_Abs_Integ:
3.147 -     "(!!x y. z = Abs_Integ(intrel``{(x,y)}) ==> P) ==> P"
3.148 -apply (rule_tac x1=z in Rep_Integ [unfolded Integ_def, THEN quotientE])
3.149 -apply (drule_tac f = Abs_Integ in arg_cong)
3.150 -apply (rule_tac p = x in PairE)
3.152 -done
3.153 +lemma minus: "- Abs_Integ(intrel``{(x,y)}) = Abs_Integ(intrel `` {(y,x)})"
3.154 +proof -
3.155 +  have "congruent intrel (\<lambda>(x,y). {Abs_Integ (intrel``{(y,x)})})"
3.156 +    by (simp add: congruent_def)
3.157 +  thus ?thesis
3.158 +    by (simp add: minus_int_def UN_equiv_class [OF equiv_intrel])
3.159 +qed
3.160
3.161 -lemma zminus_zminus [simp]: "- (- z) = (z::int)"
3.162 -apply (rule eq_Abs_Integ [of z])
3.164 -done
3.165 +lemma zminus_zminus: "- (- z) = (z::int)"
3.166 +by (cases z, simp add: minus)
3.167
3.168 -lemma inj_zminus: "inj(%z::int. -z)"
3.169 -apply (rule inj_onI)
3.170 -apply (drule_tac f = uminus in arg_cong, simp)
3.171 -done
3.172 -
3.173 -lemma zminus_0 [simp]: "- 0 = (0::int)"
3.174 -by (simp add: int_def Zero_int_def zminus)
3.175 +lemma zminus_0: "- 0 = (0::int)"
3.176 +by (simp add: int_def Zero_int_def minus)
3.177
3.178
3.181
3.183 -  "Abs_Integ(intrel``{(x1,y1)}) + Abs_Integ(intrel``{(x2,y2)}) =
3.184 -   Abs_Integ(intrel``{(x1+x2, y1+y2)})"
3.186 -apply (subst equiv_intrel [THEN UN_equiv_class2])
3.187 -apply (auto simp add: congruent2_def)
3.188 -done
3.190 +     "Abs_Integ (intrel``{(x,y)}) + Abs_Integ (intrel``{(u,v)}) =
3.191 +      Abs_Integ (intrel``{(x+u, y+v)})"
3.192 +proof -
3.193 +  have "congruent2 intrel
3.194 +        (\<lambda>z w. (\<lambda>(x,y). (\<lambda>(u,v). {Abs_Integ (intrel `` {(x+u, y+v)})}) w) z)"
3.195 +    by (simp add: congruent2_def)
3.196 +  thus ?thesis
3.198 +                  UN_equiv_class2 [OF equiv_intrel])
3.199 +qed
3.200
3.201 -lemma zminus_zadd_distrib [simp]: "- (z + w) = (- z) + (- w::int)"
3.202 -apply (rule eq_Abs_Integ [of z])
3.203 -apply (rule eq_Abs_Integ [of w])
3.205 -done
3.206 +lemma zminus_zadd_distrib: "- (z + w) = (- z) + (- w::int)"
3.208
3.209  lemma zadd_commute: "(z::int) + w = w + z"
3.210 -apply (rule eq_Abs_Integ [of z])
3.211 -apply (rule eq_Abs_Integ [of w])
3.213 -done
3.215
3.216  lemma zadd_assoc: "((z1::int) + z2) + z3 = z1 + (z2 + z3)"
3.217 -apply (rule eq_Abs_Integ [of z1])
3.218 -apply (rule eq_Abs_Integ [of z2])
3.219 -apply (rule eq_Abs_Integ [of z3])
3.221 -done
3.223
3.224  (*For AC rewriting*)
3.225  lemma zadd_left_commute: "x + (y + z) = y + ((x + z)  ::int)"
3.226 @@ -164,13 +153,12 @@
3.228    done
3.229
3.230 -(*Integer addition is an AC operator*)
3.232
3.233  lemmas zmult_ac = Ring_and_Field.mult_ac
3.234
3.235  lemma zadd_int: "(int m) + (int n) = int (m + n)"
3.238
3.239  lemma zadd_int_left: "(int m) + (int n + z) = int (m + n) + z"
3.241 @@ -179,104 +167,56 @@
3.243
3.244  (*also for the instance declaration int :: plus_ac0*)
3.245 -lemma zadd_0 [simp]: "(0::int) + z = z"
3.246 -apply (unfold Zero_int_def int_def)
3.247 -apply (rule eq_Abs_Integ [of z])
3.249 -done
3.250 -
3.251 -lemma zadd_0_right [simp]: "z + (0::int) = z"
3.253 -
3.254 -lemma zadd_zminus_inverse [simp]: "z + (- z) = (0::int)"
3.255 -apply (unfold int_def Zero_int_def)
3.256 -apply (rule eq_Abs_Integ [of z])
3.258 -done
3.259 -
3.260 -lemma zadd_zminus_inverse2 [simp]: "(- z) + z = (0::int)"
3.261 -apply (rule zadd_commute [THEN trans])
3.263 +lemma zadd_0: "(0::int) + z = z"
3.264 +apply (simp add: Zero_int_def int_def)
3.266  done
3.267
3.268 -lemma zadd_zminus_cancel [simp]: "z + (- z + w) = (w::int)"
3.270 -
3.271 -lemma zminus_zadd_cancel [simp]: "(-z) + (z + w) = (w::int)"
3.273 +lemma zadd_0_right: "z + (0::int) = z"
3.275
3.276 -lemma zdiff0 [simp]: "(0::int) - x = -x"
3.278 -
3.279 -lemma zdiff0_right [simp]: "x - (0::int) = x"
3.281 -
3.282 -lemma zdiff_self [simp]: "x - x = (0::int)"
3.283 -by (simp add: zdiff_def Zero_int_def)
3.284 +lemma zadd_zminus_inverse2: "(- z) + z = (0::int)"
3.286
3.287
3.288 -(** Lemmas **)
3.289 -
3.290 -lemma zadd_assoc_cong: "(z::int) + v = z' + v' ==> z + (v + w) = z' + (v' + w)"
3.292 -
3.293 -
3.294 -subsection{*zmult: multiplication on Integ*}
3.295 +subsection{*Integer Multiplication*}
3.296
3.297  text{*Congruence property for multiplication*}
3.298 -lemma zmult_congruent2: "congruent2 intrel
3.299 -        (%p1 p2. (%(x1,y1). (%(x2,y2).
3.300 -                    intrel``{(x1*x2 + y1*y2, x1*y2 + y1*x2)}) p2) p1)"
3.301 +lemma mult_congruent2:
3.302 +     "congruent2 intrel
3.303 +        (%p1 p2. (%(x,y). (%(u,v).
3.304 +                    { Abs_Integ(intrel``{(x*u + y*v, x*v + y*u)}) }) p2) p1)"
3.305  apply (rule equiv_intrel [THEN congruent2_commuteI])
3.308 -apply (rename_tac x1 x2 y1 y2 z1 z2)
3.309 -apply (rule equiv_class_eq [OF equiv_intrel intrel_iff [THEN iffD2]])
3.310 -apply (subgoal_tac "x1*z1 + y2*z1 = y1*z1 + x2*z1 & x1*z2 + y2*z2 = y1*z2 + x2*z2")
3.311 -apply (simp add: mult_ac, arith)
3.312 +apply (auto simp add: congruent_def mult_ac)
3.313 +apply (rename_tac u v w x y z)
3.314 +apply (subgoal_tac "u*y + x*y = w*y + v*y  &  u*z + x*z = w*z + v*z")
3.315 +apply (simp add: mult_ac, arith)
3.317  done
3.318
3.319 -lemma zmult:
3.320 -   "Abs_Integ((intrel``{(x1,y1)})) * Abs_Integ((intrel``{(x2,y2)})) =
3.321 -    Abs_Integ(intrel `` {(x1*x2 + y1*y2, x1*y2 + y1*x2)})"
3.322 -by (simp add: zmult_def UN_UN_split_split_eq zmult_congruent2
3.323 +lemma mult:
3.324 +     "Abs_Integ((intrel``{(x,y)})) * Abs_Integ((intrel``{(u,v)})) =
3.325 +      Abs_Integ(intrel `` {(x*u + y*v, x*v + y*u)})"
3.326 +by (simp add: mult_int_def UN_UN_split_split_eq mult_congruent2
3.327                equiv_intrel [THEN UN_equiv_class2])
3.328
3.329  lemma zmult_zminus: "(- z) * w = - (z * (w::int))"
3.330 -apply (rule eq_Abs_Integ [of z])
3.331 -apply (rule eq_Abs_Integ [of w])
3.333 -done
3.335
3.336  lemma zmult_commute: "(z::int) * w = w * z"
3.337 -apply (rule eq_Abs_Integ [of z])
3.338 -apply (rule eq_Abs_Integ [of w])
3.340 -done
3.342
3.343  lemma zmult_assoc: "((z1::int) * z2) * z3 = z1 * (z2 * z3)"
3.344 -apply (rule eq_Abs_Integ [of z1])
3.345 -apply (rule eq_Abs_Integ [of z2])
3.346 -apply (rule eq_Abs_Integ [of z3])
3.348 -done
3.349 +by (cases z1, cases z2, cases z3, simp add: mult add_mult_distrib2 mult_ac)
3.350
3.351  lemma zadd_zmult_distrib: "((z1::int) + z2) * w = (z1 * w) + (z2 * w)"
3.352 -apply (rule eq_Abs_Integ [of z1])
3.353 -apply (rule eq_Abs_Integ [of z2])
3.354 -apply (rule eq_Abs_Integ [of w])
3.356 -done
3.357 -
3.358 -lemma zmult_zminus_right: "w * (- z) = - (w * (z::int))"
3.359 -by (simp add: zmult_commute [of w] zmult_zminus)
3.361
3.362  lemma zadd_zmult_distrib2: "(w::int) * (z1 + z2) = (w * z1) + (w * z2)"
3.364
3.365  lemma zdiff_zmult_distrib: "((z1::int) - z2) * w = (z1 * w) - (z2 * w)"
3.366 -apply (unfold zdiff_def)
3.370  done
3.371 @@ -285,28 +225,16 @@
3.372  by (simp add: zmult_commute [of w] zdiff_zmult_distrib)
3.373
3.374  lemmas int_distrib =
3.377    zdiff_zmult_distrib zdiff_zmult_distrib2
3.378
3.379  lemma zmult_int: "(int m) * (int n) = int (m * n)"
3.380 -by (simp add: int_def zmult)
3.381 -
3.382 -lemma zmult_0 [simp]: "0 * z = (0::int)"
3.383 -apply (unfold Zero_int_def int_def)
3.384 -apply (rule eq_Abs_Integ [of z])
3.386 -done
3.387 +by (simp add: int_def mult)
3.388
3.389 -lemma zmult_1 [simp]: "(1::int) * z = z"
3.390 -apply (unfold One_int_def int_def)
3.391 -apply (rule eq_Abs_Integ [of z])
3.393 -done
3.394 +lemma zmult_1: "(1::int) * z = z"
3.395 +by (cases z, simp add: One_int_def int_def mult)
3.396
3.397 -lemma zmult_0_right [simp]: "z * 0 = (0::int)"
3.398 -by (rule trans [OF zmult_commute zmult_0])
3.399 -
3.400 -lemma zmult_1_right [simp]: "z * (1::int) = z"
3.401 +lemma zmult_1_right: "z * (1::int) = z"
3.402  by (rule trans [OF zmult_commute zmult_1])
3.403
3.404
3.405 @@ -316,46 +244,36 @@
3.406    fix i j k :: int
3.407    show "(i + j) + k = i + (j + k)" by (simp add: zadd_assoc)
3.408    show "i + j = j + i" by (simp add: zadd_commute)
3.409 -  show "0 + i = i" by simp
3.410 -  show "- i + i = 0" by simp
3.411 -  show "i - j = i + (-j)" by (simp add: zdiff_def)
3.412 +  show "0 + i = i" by (rule zadd_0)
3.413 +  show "- i + i = 0" by (rule zadd_zminus_inverse2)
3.414 +  show "i - j = i + (-j)" by (simp add: diff_int_def)
3.415    show "(i * j) * k = i * (j * k)" by (rule zmult_assoc)
3.416    show "i * j = j * i" by (rule zmult_commute)
3.417 -  show "1 * i = i" by simp
3.418 +  show "1 * i = i" by (rule zmult_1)
3.419    show "(i + j) * k = i * k + j * k" by (simp add: int_distrib)
3.420 -  show "0 \<noteq> (1::int)"
3.421 +  show "0 \<noteq> (1::int)"
3.422      by (simp only: Zero_int_def One_int_def One_nat_def int_int_eq)
3.423  qed
3.424
3.425
3.426  subsection{*The @{text "\<le>"} Ordering*}
3.427
3.428 -lemma zle:
3.429 -  "(Abs_Integ(intrel``{(x1,y1)}) \<le> Abs_Integ(intrel``{(x2,y2)})) =
3.430 -   (x1 + y2 \<le> x2 + y1)"
3.431 -by (force simp add: zle_def)
3.432 +lemma le:
3.433 +  "(Abs_Integ(intrel``{(x,y)}) \<le> Abs_Integ(intrel``{(u,v)})) = (x+v \<le> u+y)"
3.434 +by (force simp add: le_int_def)
3.435
3.436  lemma zle_refl: "w \<le> (w::int)"
3.437 -apply (rule eq_Abs_Integ [of w])
3.438 -apply (force simp add: zle)
3.439 -done
3.440 +by (cases w, simp add: le)
3.441
3.442  lemma zle_trans: "[| i \<le> j; j \<le> k |] ==> i \<le> (k::int)"
3.443 -apply (rule eq_Abs_Integ [of i])
3.444 -apply (rule eq_Abs_Integ [of j])
3.445 -apply (rule eq_Abs_Integ [of k])
3.447 -done
3.448 +by (cases i, cases j, cases k, simp add: le)
3.449
3.450  lemma zle_anti_sym: "[| z \<le> w; w \<le> z |] ==> z = (w::int)"
3.451 -apply (rule eq_Abs_Integ [of w])
3.452 -apply (rule eq_Abs_Integ [of z])
3.454 -done
3.455 +by (cases w, cases z, simp add: le)
3.456
3.457  (* Axiom 'order_less_le' of class 'order': *)
3.458  lemma zless_le: "((w::int) < z) = (w \<le> z & w \<noteq> z)"
3.461
3.462  instance int :: order
3.463  proof qed
3.464 @@ -364,10 +282,7 @@
3.465
3.466  (* Axiom 'linorder_linear' of class 'linorder': *)
3.467  lemma zle_linear: "(z::int) \<le> w | w \<le> z"
3.468 -apply (rule eq_Abs_Integ [of z])
3.469 -apply (rule eq_Abs_Integ [of w])
3.470 -apply (simp add: zle linorder_linear)
3.471 -done
3.472 +by (cases z, cases w, simp add: le linorder_linear)
3.473
3.474  instance int :: linorder
3.475  proof qed (rule zle_linear)
3.476 @@ -379,21 +294,8 @@
3.477  lemma int_eq_0_conv [simp]: "(int n = 0) = (n = 0)"
3.479
3.480 -(*This lemma allows direct proofs of other <-properties*)
3.482 -    "(w < z) = (\<exists>n. z = w + int(Suc n))"
3.483 -apply (rule eq_Abs_Integ [of z])
3.484 -apply (rule eq_Abs_Integ [of w])
3.485 -apply (simp add: linorder_not_le [where 'a = int, symmetric]
3.486 -                 linorder_not_le [where 'a = nat]
3.487 -                 zle int_def zdiff_def zadd zminus)
3.489 -apply (rule_tac x = k in exI)
3.491 -done
3.492 -
3.493  lemma zless_int [simp]: "(int m < int n) = (m<n)"
3.496
3.497  lemma int_less_0_conv [simp]: "~ (int k < 0)"
3.499 @@ -425,25 +327,20 @@
3.500  lemma int_Suc0_eq_1: "int (Suc 0) = 1"
3.501  by (simp add: One_int_def One_nat_def)
3.502
3.503 +
3.504  subsection{*Monotonicity results*}
3.505
3.506 -lemma zadd_left_mono: "i \<le> j ==> k + i \<le> k + (j::int)"
3.507 -apply (rule eq_Abs_Integ [of i])
3.508 -apply (rule eq_Abs_Integ [of j])
3.509 -apply (rule eq_Abs_Integ [of k])
3.511 -done
3.512 +lemma zadd_left_mono: "i \<le> j ==> k + i \<le> k + (j::int)"
3.513 +by (cases i, cases j, cases k, simp add: le add)
3.514
3.515 -lemma zadd_strict_right_mono: "i < j ==> i + k < j + (k::int)"
3.516 -apply (rule eq_Abs_Integ [of i])
3.517 -apply (rule eq_Abs_Integ [of j])
3.518 -apply (rule eq_Abs_Integ [of k])
3.519 -apply (simp add: linorder_not_le [where 'a = int, symmetric]
3.520 -                 linorder_not_le [where 'a = nat]  zle zadd)
3.521 +lemma zadd_strict_right_mono: "i < j ==> i + k < j + (k::int)"
3.522 +apply (cases i, cases j, cases k)
3.523 +apply (simp add: linorder_not_le [where 'a = int, symmetric]
3.524 +                 linorder_not_le [where 'a = nat]  le add)
3.525  done
3.526
3.527  lemma zadd_zless_mono: "[| w'<w; z'\<le>z |] ==> w' + z' < w + (z::int)"
3.530
3.531
3.532  subsection{*Strict Monotonicity of Multiplication*}
3.533 @@ -451,7 +348,7 @@
3.534  text{*strict, in 1st argument; proof is by induction on k>0*}
3.535  lemma zmult_zless_mono2_lemma [rule_format]:
3.536       "i<j ==> 0<k --> int k * i < int k * j"
3.537 -apply (induct_tac "k", simp)
3.538 +apply (induct_tac "k", simp)
3.540  apply (case_tac "n=0")
3.542 @@ -459,14 +356,14 @@
3.543  done
3.544
3.545  lemma zero_le_imp_eq_int: "0 \<le> k ==> \<exists>n. k = int n"
3.546 -apply (rule eq_Abs_Integ [of k])
3.548 -apply (rule_tac x="x-y" in exI, simp)
3.549 +apply (cases k)
3.551 +apply (rule_tac x="x-y" in exI, simp)
3.552  done
3.553
3.554  lemma zmult_zless_mono2: "[| i<j;  (0::int) < k |] ==> k*i < k*j"
3.555 -apply (frule order_less_imp_le [THEN zero_le_imp_eq_int])
3.556 -apply (auto simp add: zmult_zless_mono2_lemma)
3.557 +apply (frule order_less_imp_le [THEN zero_le_imp_eq_int])
3.558 +apply (auto simp add: zmult_zless_mono2_lemma)
3.559  done
3.560
3.561
3.562 @@ -484,49 +381,100 @@
3.563  qed
3.564
3.565
3.566 +lemma zless_imp_add1_zle: "w<z ==> w + (1::int) \<le> z"
3.567 +apply (cases w, cases z)
3.569 +done
3.570 +
3.571  subsection{*Magnitide of an Integer, as a Natural Number: @{term nat}*}
3.572
3.573  constdefs
3.574     nat  :: "int => nat"
3.575 -    "nat(Z) == if Z<0 then 0 else (THE m. Z = int m)"
3.576 +    "nat z == contents (\<Union>(x,y) \<in> Rep_Integ(z). { x-y })"
3.577 +
3.578 +lemma nat: "nat (Abs_Integ (intrel``{(x,y)})) = x-y"
3.579 +proof -
3.580 +  have "congruent intrel (\<lambda>(x,y). {x-y})"
3.581 +    by (simp add: congruent_def, arith)
3.582 +  thus ?thesis
3.583 +    by (simp add: nat_def UN_equiv_class [OF equiv_intrel])
3.584 +qed
3.585
3.586  lemma nat_int [simp]: "nat(int n) = n"
3.587 -by (unfold nat_def, auto)
3.588 +by (simp add: nat int_def)
3.589
3.590  lemma nat_zero [simp]: "nat 0 = 0"
3.591 -apply (unfold Zero_int_def)
3.592 -apply (rule nat_int)
3.593 -done
3.594 +by (simp only: Zero_int_def nat_int)
3.595
3.596 -lemma nat_0_le [simp]: "0 \<le> z ==> int (nat z) = z"
3.597 -apply (rule eq_Abs_Integ [of z])
3.598 -apply (simp add: nat_def linorder_not_le [symmetric] zle int_def Zero_int_def)
3.599 -apply (subgoal_tac "(THE m. x = m + y) = x-y")
3.600 -apply (auto simp add: the_equality)
3.601 +lemma int_nat_eq [simp]: "int (nat z) = (if 0 \<le> z then z else 0)"
3.602 +by (cases z, simp add: nat le int_def Zero_int_def)
3.603 +
3.604 +corollary nat_0_le: "0 \<le> z ==> int (nat z) = z"
3.605 +apply simp
3.606  done
3.607
3.608  lemma nat_le_0 [simp]: "z \<le> 0 ==> nat z = 0"
3.609 -by (simp add: nat_def  order_less_le eq_commute [of 0])
3.610 +by (cases z, simp add: nat le int_def Zero_int_def)
3.611 +
3.612 +lemma nat_le_eq_zle: "0 < w | 0 \<le> z ==> (nat w \<le> nat z) = (w\<le>z)"
3.613 +apply (cases w, cases z)
3.614 +apply (simp add: nat le linorder_not_le [symmetric] int_def Zero_int_def, arith)
3.615 +done
3.616
3.617  text{*An alternative condition is @{term "0 \<le> w"} *}
3.618 -lemma nat_mono_iff: "0 < z ==> (nat w < nat z) = (w < z)"
3.619 -apply (subst zless_int [symmetric])
3.621 -apply (case_tac "w < 0")
3.622 - apply (simp add: order_less_imp_le)
3.624 +corollary nat_mono_iff: "0 < z ==> (nat w < nat z) = (w < z)"
3.625 +by (simp add: nat_le_eq_zle linorder_not_le [symmetric])
3.626 +
3.627 +corollary nat_less_eq_zless: "0 \<le> w ==> (nat w < nat z) = (w<z)"
3.628 +by (simp add: nat_le_eq_zle linorder_not_le [symmetric])
3.629 +
3.630 +lemma zless_nat_conj: "(nat w < nat z) = (0 < z & w < z)"
3.631 +apply (cases w, cases z)
3.632 +apply (simp add: nat le int_def Zero_int_def linorder_not_le [symmetric], arith)
3.633  done
3.634
3.635 -lemma zless_nat_conj: "(nat w < nat z) = (0 < z & w < z)"
3.636 -apply (case_tac "0 < z")
3.637 -apply (auto simp add: nat_mono_iff linorder_not_less)
3.638 +lemma nonneg_eq_int: "[| 0 \<le> z;  !!m. z = int m ==> P |] ==> P"
3.639 +by (blast dest: nat_0_le sym)
3.640 +
3.641 +lemma nat_eq_iff: "(nat w = m) = (if 0 \<le> w then w = int m else m=0)"
3.642 +by (cases w, simp add: nat le int_def Zero_int_def, arith)
3.643 +
3.644 +corollary nat_eq_iff2: "(m = nat w) = (if 0 \<le> w then w = int m else m=0)"
3.645 +by (simp only: eq_commute [of m] nat_eq_iff)
3.646 +
3.647 +lemma nat_less_iff: "0 \<le> w ==> (nat w < m) = (w < int m)"
3.648 +apply (cases w)
3.649 +apply (simp add: nat le int_def Zero_int_def linorder_not_le [symmetric], arith)
3.650  done
3.651
3.652 +lemma int_eq_iff: "(int m = z) = (m = nat z & 0 \<le> z)"
3.653 +by (auto simp add: nat_eq_iff2)
3.654 +
3.655 +lemma zero_less_nat_eq [simp]: "(0 < nat z) = (0 < z)"
3.656 +by (insert zless_nat_conj [of 0], auto)
3.657 +
3.658 +
3.660 +     "[| (0::int) \<le> z;  0 \<le> z' |] ==> nat (z+z') = nat z + nat z'"
3.661 +by (cases z, cases z', simp add: nat add le int_def Zero_int_def)
3.662 +
3.663 +lemma nat_diff_distrib:
3.664 +     "[| (0::int) \<le> z';  z' \<le> z |] ==> nat (z-z') = nat z - nat z'"
3.665 +by (cases z, cases z',
3.667 +
3.668 +
3.669 +lemma nat_zminus_int [simp]: "nat (- (int n)) = 0"
3.670 +by (simp add: int_def minus nat Zero_int_def)
3.671 +
3.672 +lemma zless_nat_eq_int_zless: "(m < nat z) = (int m < z)"
3.673 +by (cases z, simp add: nat le int_def  linorder_not_le [symmetric], arith)
3.674 +
3.675
3.676  subsection{*Lemmas about the Function @{term int} and Orderings*}
3.677
3.678  lemma negative_zless_0: "- (int (Suc n)) < 0"
3.681
3.682  lemma negative_zless [iff]: "- (int (Suc n)) < int m"
3.683  by (rule negative_zless_0 [THEN order_less_le_trans], simp)
3.684 @@ -541,10 +489,7 @@
3.685  by (subst le_minus_iff, simp)
3.686
3.687  lemma int_zle_neg: "(int n \<le> - int m) = (n = 0 & m = 0)"
3.688 -apply safe
3.689 -apply (drule_tac [2] le_minus_iff [THEN iffD1])
3.690 -apply (auto dest: zle_trans [OF _ negative_zle_0])
3.691 -done
3.692 +by (simp add: int_def le minus Zero_int_def)
3.693
3.694  lemma not_int_zless_negative [simp]: "~ (int n < - int m)"
3.696 @@ -553,10 +498,15 @@
3.697  by (force simp add: order_eq_iff [of "- int n"] int_zle_neg)
3.698
3.699  lemma zle_iff_zadd: "(w \<le> z) = (\<exists>n. z = w + int n)"
3.700 -by (force intro: exI [of _ "0::nat"]
3.701 -            intro!: not_sym [THEN not0_implies_Suc]
3.703 +apply (cases w, cases z)
3.705 +apply (rename_tac a b c d)
3.706 +apply (rule_tac x="c+b - (a+d)" in exI)
3.707 +apply arith
3.708 +done
3.709
3.710 +lemma abs_int_eq [simp]: "abs (int m) = int m"
3.712
3.713  text{*This version is proved for all ordered rings, not just integers!
3.714        It is proved here because attribute @{text arith_split} is not available
3.715 @@ -566,38 +516,6 @@
3.716       "P(abs(a::'a::ordered_ring)) = ((0 \<le> a --> P a) & (a < 0 --> P(-a)))"
3.717  by (force dest: order_less_le_trans simp add: abs_if linorder_not_less)
3.718
3.719 -lemma abs_int_eq [simp]: "abs (int m) = int m"
3.721 -
3.722 -
3.723 -subsection{*Misc Results*}
3.724 -
3.725 -lemma nat_zminus_int [simp]: "nat(- (int n)) = 0"
3.726 -by (auto simp add: nat_def zero_reorient minus_less_iff)
3.727 -
3.728 -lemma zless_nat_eq_int_zless: "(m < nat z) = (int m < z)"
3.729 -apply (case_tac "0 \<le> z")
3.730 -apply (erule nat_0_le [THEN subst], simp)
3.732 -apply (auto dest: order_less_trans simp add: order_less_imp_le)
3.733 -done
3.734 -
3.735 -text{*A case theorem distinguishing non-negative and negative int*}
3.736 -
3.737 -lemma negD: "x<0 ==> \<exists>n. x = - (int (Suc n))"
3.739 -                   diff_eq_eq [symmetric] zdiff_def)
3.740 -
3.741 -lemma int_cases [cases type: int, case_names nonneg neg]:
3.742 -     "[|!! n. z = int n ==> P;  !! n. z =  - (int (Suc n)) ==> P |] ==> P"
3.743 -apply (case_tac "z < 0", blast dest!: negD)
3.745 -apply (blast dest: nat_0_le [THEN sym])
3.746 -done
3.747 -
3.748 -lemma int_induct [induct type: int, case_names nonneg neg]:
3.749 -     "[|!! n. P (int n);  !!n. P (- (int (Suc n))) |] ==> P z"
3.750 -  by (cases z) auto
3.751
3.752
3.753  subsection{*The Constants @{term neg} and @{term iszero}*}
3.754 @@ -610,7 +528,7 @@
3.755    (*For simplifying equalities*)
3.756    iszero :: "'a::semiring => bool"
3.757    "iszero z == z = (0)"
3.758 -
3.759 +
3.760
3.761  lemma not_neg_int [simp]: "~ neg(int n)"
3.763 @@ -623,22 +541,23 @@
3.764  lemma not_neg_eq_ge_0: "(~neg x) = (0 \<le> x)"
3.765  by (simp add: neg_def linorder_not_less)
3.766
3.767 +
3.768  subsection{*To simplify inequalities when Numeral1 can get simplified to 1*}
3.769
3.770  lemma not_neg_0: "~ neg 0"
3.771  by (simp add: One_int_def neg_def)
3.772
3.773  lemma not_neg_1: "~ neg 1"
3.774 -by (simp add: neg_def linorder_not_less zero_le_one)
3.775 +by (simp add: neg_def linorder_not_less zero_le_one)
3.776
3.777  lemma iszero_0: "iszero 0"
3.779
3.780  lemma not_iszero_1: "~ iszero 1"
3.781 -by (simp add: iszero_def eq_commute)
3.782 +by (simp add: iszero_def eq_commute)
3.783
3.784  lemma neg_nat: "neg z ==> nat z = 0"
3.785 -by (simp add: nat_def neg_def)
3.786 +by (simp add: neg_def order_less_imp_le)
3.787
3.788  lemma not_neg_nat: "~ neg z ==> int (nat z) = z"
3.789  by (simp add: linorder_not_less neg_def)
3.790 @@ -657,36 +576,36 @@
3.791
3.792  lemma of_nat_add [simp]: "of_nat (m+n) = of_nat m + of_nat n"
3.793  apply (induct m)
3.796  done
3.797
3.798  lemma of_nat_mult [simp]: "of_nat (m*n) = of_nat m * of_nat n"
3.799 -apply (induct m)
3.801 +apply (induct m)
3.803  done
3.804
3.805  lemma zero_le_imp_of_nat: "0 \<le> (of_nat m::'a::ordered_semiring)"
3.806 -apply (induct m, simp_all)
3.807 -apply (erule order_trans)
3.808 -apply (rule less_add_one [THEN order_less_imp_le])
3.809 +apply (induct m, simp_all)
3.810 +apply (erule order_trans)
3.811 +apply (rule less_add_one [THEN order_less_imp_le])
3.812  done
3.813
3.814  lemma less_imp_of_nat_less:
3.815       "m < n ==> of_nat m < (of_nat n::'a::ordered_semiring)"
3.816 -apply (induct m n rule: diff_induct, simp_all)
3.817 -apply (insert add_le_less_mono [OF zero_le_imp_of_nat zero_less_one], force)
3.818 +apply (induct m n rule: diff_induct, simp_all)
3.819 +apply (insert add_le_less_mono [OF zero_le_imp_of_nat zero_less_one], force)
3.820  done
3.821
3.822  lemma of_nat_less_imp_less:
3.823       "of_nat m < (of_nat n::'a::ordered_semiring) ==> m < n"
3.824 -apply (induct m n rule: diff_induct, simp_all)
3.825 -apply (insert zero_le_imp_of_nat)
3.826 -apply (force simp add: linorder_not_less [symmetric])
3.827 +apply (induct m n rule: diff_induct, simp_all)
3.828 +apply (insert zero_le_imp_of_nat)
3.829 +apply (force simp add: linorder_not_less [symmetric])
3.830  done
3.831
3.832  lemma of_nat_less_iff [simp]:
3.833       "(of_nat m < (of_nat n::'a::ordered_semiring)) = (m<n)"
3.834 -by (blast intro: of_nat_less_imp_less less_imp_of_nat_less )
3.835 +by (blast intro: of_nat_less_imp_less less_imp_of_nat_less)
3.836
3.837  text{*Special cases where either operand is zero*}
3.838  declare of_nat_less_iff [of 0, simplified, simp]
3.839 @@ -694,7 +613,7 @@
3.840
3.841  lemma of_nat_le_iff [simp]:
3.842       "(of_nat m \<le> (of_nat n::'a::ordered_semiring)) = (m \<le> n)"
3.843 -by (simp add: linorder_not_less [symmetric])
3.844 +by (simp add: linorder_not_less [symmetric])
3.845
3.846  text{*Special cases where either operand is zero*}
3.847  declare of_nat_le_iff [of 0, simplified, simp]
3.848 @@ -704,7 +623,7 @@
3.849  a finite field, which indeed wraps back to zero.*}
3.850  lemma of_nat_eq_iff [simp]:
3.851       "(of_nat m = (of_nat n::'a::ordered_semiring)) = (m = n)"
3.854
3.855  text{*Special cases where either operand is zero*}
3.856  declare of_nat_eq_iff [of 0, simplified, simp]
3.857 @@ -713,7 +632,7 @@
3.858  lemma of_nat_diff [simp]:
3.859       "n \<le> m ==> of_nat (m - n) = of_nat m - (of_nat n :: 'a::ring)"
3.863
3.864
3.865  subsection{*The Set of Natural Numbers*}
3.866 @@ -725,29 +644,29 @@
3.867  syntax (xsymbols)    Nats :: "'a set"   ("\<nat>")
3.868
3.869  lemma of_nat_in_Nats [simp]: "of_nat n \<in> Nats"
3.872
3.873  lemma Nats_0 [simp]: "0 \<in> Nats"
3.875 -apply (rule range_eqI)
3.877 +apply (rule range_eqI)
3.878  apply (rule of_nat_0 [symmetric])
3.879  done
3.880
3.881  lemma Nats_1 [simp]: "1 \<in> Nats"
3.883 -apply (rule range_eqI)
3.885 +apply (rule range_eqI)
3.886  apply (rule of_nat_1 [symmetric])
3.887  done
3.888
3.889  lemma Nats_add [simp]: "[|a \<in> Nats; b \<in> Nats|] ==> a+b \<in> Nats"
3.890 -apply (auto simp add: Nats_def)
3.891 -apply (rule range_eqI)
3.892 +apply (auto simp add: Nats_def)
3.893 +apply (rule range_eqI)
3.895  done
3.896
3.897  lemma Nats_mult [simp]: "[|a \<in> Nats; b \<in> Nats|] ==> a*b \<in> Nats"
3.898 -apply (auto simp add: Nats_def)
3.899 -apply (rule range_eqI)
3.900 +apply (auto simp add: Nats_def)
3.901 +apply (rule range_eqI)
3.902  apply (rule of_nat_mult [symmetric])
3.903  done
3.904
3.905 @@ -755,7 +674,7 @@
3.906  lemma int_eq_of_nat: "int = (of_nat :: nat => int)"
3.907  proof
3.908    fix n
3.909 -  show "int n = of_nat n"  by (induct n, simp_all add: int_Suc add_ac)
3.910 +  show "int n = of_nat n"  by (induct n, simp_all add: int_Suc add_ac)
3.911  qed
3.912
3.913
3.914 @@ -769,9 +688,9 @@
3.915
3.916  lemma of_int: "of_int (Abs_Integ (intrel `` {(i,j)})) = of_nat i - of_nat j"
3.918 -apply (rule the_equality, auto)
3.919 +apply (rule the_equality, auto)
3.923  done
3.924
3.925  lemma of_int_0 [simp]: "of_int 0 = 0"
3.926 @@ -781,32 +700,26 @@
3.927  by (simp add: of_int One_int_def int_def)
3.928
3.929  lemma of_int_add [simp]: "of_int (w+z) = of_int w + of_int z"
3.930 -apply (rule eq_Abs_Integ [of w])
3.931 -apply (rule eq_Abs_Integ [of z])
3.933 -done
3.935
3.936  lemma of_int_minus [simp]: "of_int (-z) = - (of_int z)"
3.937 -apply (rule eq_Abs_Integ [of z])
3.938 -apply (simp add: compare_rls of_int zminus)
3.939 -done
3.940 +by (cases z, simp add: compare_rls of_int minus)
3.941
3.942  lemma of_int_diff [simp]: "of_int (w-z) = of_int w - of_int z"
3.944
3.945  lemma of_int_mult [simp]: "of_int (w*z) = of_int w * of_int z"
3.946 -apply (rule eq_Abs_Integ [of w])
3.947 -apply (rule eq_Abs_Integ [of z])
3.948 -apply (simp add: compare_rls of_int left_diff_distrib right_diff_distrib
3.950 +apply (cases w, cases z)
3.951 +apply (simp add: compare_rls of_int left_diff_distrib right_diff_distrib
3.953  done
3.954
3.955  lemma of_int_le_iff [simp]:
3.956       "(of_int w \<le> (of_int z::'a::ordered_ring)) = (w \<le> z)"
3.957 -apply (rule eq_Abs_Integ [of w])
3.958 -apply (rule eq_Abs_Integ [of z])
3.961 +apply (cases w)
3.962 +apply (cases z)
3.965  done
3.966
3.967  text{*Special cases where either operand is zero*}
3.968 @@ -824,7 +737,7 @@
3.969  text{*The ordering on the ring is necessary. See @{text of_nat_eq_iff} above.*}
3.970  lemma of_int_eq_iff [simp]:
3.971       "(of_int w = (of_int z::'a::ordered_ring)) = (w = z)"
3.974
3.975  text{*Special cases where either operand is zero*}
3.976  declare of_int_eq_iff [of 0, simplified, simp]
3.977 @@ -842,52 +755,52 @@
3.978    Ints      :: "'a set"                   ("\<int>")
3.979
3.980  lemma Ints_0 [simp]: "0 \<in> Ints"
3.982 -apply (rule range_eqI)
3.984 +apply (rule range_eqI)
3.985  apply (rule of_int_0 [symmetric])
3.986  done
3.987
3.988  lemma Ints_1 [simp]: "1 \<in> Ints"
3.990 -apply (rule range_eqI)
3.992 +apply (rule range_eqI)
3.993  apply (rule of_int_1 [symmetric])
3.994  done
3.995
3.996  lemma Ints_add [simp]: "[|a \<in> Ints; b \<in> Ints|] ==> a+b \<in> Ints"
3.997 -apply (auto simp add: Ints_def)
3.998 -apply (rule range_eqI)
3.999 +apply (auto simp add: Ints_def)
3.1000 +apply (rule range_eqI)
3.1002  done
3.1003
3.1004  lemma Ints_minus [simp]: "a \<in> Ints ==> -a \<in> Ints"
3.1005 -apply (auto simp add: Ints_def)
3.1006 -apply (rule range_eqI)
3.1007 +apply (auto simp add: Ints_def)
3.1008 +apply (rule range_eqI)
3.1009  apply (rule of_int_minus [symmetric])
3.1010  done
3.1011
3.1012  lemma Ints_diff [simp]: "[|a \<in> Ints; b \<in> Ints|] ==> a-b \<in> Ints"
3.1013 -apply (auto simp add: Ints_def)
3.1014 -apply (rule range_eqI)
3.1015 +apply (auto simp add: Ints_def)
3.1016 +apply (rule range_eqI)
3.1017  apply (rule of_int_diff [symmetric])
3.1018  done
3.1019
3.1020  lemma Ints_mult [simp]: "[|a \<in> Ints; b \<in> Ints|] ==> a*b \<in> Ints"
3.1021 -apply (auto simp add: Ints_def)
3.1022 -apply (rule range_eqI)
3.1023 +apply (auto simp add: Ints_def)
3.1024 +apply (rule range_eqI)
3.1025  apply (rule of_int_mult [symmetric])
3.1026  done
3.1027
3.1028  text{*Collapse nested embeddings*}
3.1029  lemma of_int_of_nat_eq [simp]: "of_int (of_nat n) = of_nat n"
3.1030 -by (induct n, auto)
3.1031 +by (induct n, auto)
3.1032
3.1033  lemma of_int_int_eq [simp]: "of_int (int n) = int n"
3.1036
3.1037
3.1038  lemma Ints_cases [case_names of_int, cases set: Ints]:
3.1039    "q \<in> \<int> ==> (!!z. q = of_int z ==> C) ==> C"
3.1040 -proof (unfold Ints_def)
3.1042    assume "!!z. q = of_int z ==> C"
3.1043    assume "q \<in> range of_int" thus C ..
3.1044  qed
3.1045 @@ -963,11 +876,41 @@
3.1046    by (rule setprod_zero_eq, auto)
3.1047
3.1048
3.1049 +text{*Now we replace the case analysis rule by a more conventional one:
3.1050 +whether an integer is negative or not.*}
3.1051 +
3.1053 +    "(w < z) = (\<exists>n. z = w + int(Suc n))"
3.1054 +apply (cases z, cases w)
3.1056 +apply (rename_tac a b c d)
3.1057 +apply (rule_tac x="a+d - Suc(c+b)" in exI)
3.1058 +apply arith
3.1059 +done
3.1060 +
3.1061 +lemma negD: "x<0 ==> \<exists>n. x = - (int (Suc n))"
3.1062 +apply (cases x)
3.1063 +apply (auto simp add: le minus Zero_int_def int_def order_less_le)
3.1064 +apply (rule_tac x="y - Suc x" in exI)
3.1065 +apply arith
3.1066 +done
3.1067 +
3.1068 +theorem int_cases [cases type: int, case_names nonneg neg]:
3.1069 +     "[|!! n. z = int n ==> P;  !! n. z =  - (int (Suc n)) ==> P |] ==> P"
3.1070 +apply (case_tac "z < 0", blast dest!: negD)
3.1072 +apply (blast dest: nat_0_le [THEN sym])
3.1073 +done
3.1074 +
3.1075 +theorem int_induct [induct type: int, case_names nonneg neg]:
3.1076 +     "[|!! n. P (int n);  !!n. P (- (int (Suc n))) |] ==> P z"
3.1077 +  by (cases z) auto
3.1078 +
3.1079 +
3.1080  (*Legacy ML bindings, but no longer the structure Int.*)
3.1081  ML
3.1082  {*
3.1083  val zabs_def = thm "zabs_def"
3.1084 -val nat_def  = thm "nat_def"
3.1085
3.1086  val int_0 = thm "int_0";
3.1087  val int_1 = thm "int_1";
3.1088 @@ -1002,11 +945,7 @@
3.1089  val int_def = thm "int_def";
3.1090  val Zero_int_def = thm "Zero_int_def";
3.1091  val One_int_def = thm "One_int_def";
3.1093 -val zdiff_def = thm "zdiff_def";
3.1094 -val zless_def = thm "zless_def";
3.1095 -val zle_def = thm "zle_def";
3.1096 -val zmult_def = thm "zmult_def";
3.1097 +val diff_int_def = thm "diff_int_def";
3.1098
3.1099  val intrel_iff = thm "intrel_iff";
3.1100  val equiv_intrel = thm "equiv_intrel";
3.1101 @@ -1015,13 +954,8 @@
3.1102  val inj_on_Abs_Integ = thm "inj_on_Abs_Integ";
3.1103  val inj_Rep_Integ = thm "inj_Rep_Integ";
3.1104  val inj_int = thm "inj_int";
3.1105 -val zminus_congruent = thm "zminus_congruent";
3.1106 -val zminus = thm "zminus";
3.1107 -val eq_Abs_Integ = thm "eq_Abs_Integ";
3.1108  val zminus_zminus = thm "zminus_zminus";
3.1109 -val inj_zminus = thm "inj_zminus";
3.1110  val zminus_0 = thm "zminus_0";
3.1115 @@ -1033,30 +967,17 @@
3.1116  val int_Suc = thm "int_Suc";
3.1123 -val zdiff0 = thm "zdiff0";
3.1124 -val zdiff0_right = thm "zdiff0_right";
3.1125 -val zdiff_self = thm "zdiff_self";
3.1126 -val zmult_congruent2 = thm "zmult_congruent2";
3.1127 -val zmult = thm "zmult";
3.1128  val zmult_zminus = thm "zmult_zminus";
3.1129  val zmult_commute = thm "zmult_commute";
3.1130  val zmult_assoc = thm "zmult_assoc";
3.1132 -val zmult_zminus_right = thm "zmult_zminus_right";
3.1134  val zdiff_zmult_distrib = thm "zdiff_zmult_distrib";
3.1135  val zdiff_zmult_distrib2 = thm "zdiff_zmult_distrib2";
3.1136  val int_distrib = thms "int_distrib";
3.1137  val zmult_int = thm "zmult_int";
3.1138 -val zmult_0 = thm "zmult_0";
3.1139  val zmult_1 = thm "zmult_1";
3.1140 -val zmult_0_right = thm "zmult_0_right";
3.1141  val zmult_1_right = thm "zmult_1_right";
3.1143  val int_int_eq = thm "int_int_eq";
3.1144  val int_eq_0_conv = thm "int_eq_0_conv";
3.1145  val zless_int = thm "zless_int";
```
```     4.1 --- a/src/HOL/Integ/IntDiv.thy	Fri Mar 19 11:06:53 2004 +0100
4.2 +++ b/src/HOL/Integ/IntDiv.thy	Wed Mar 24 10:50:29 2004 +0100
4.3 @@ -95,12 +95,12 @@
4.4       "[| b*q' + r'  \<le> b*q + r;  0 \<le> r';  0 < b;  r < b |]
4.5        ==> q' \<le> (q::int)"
4.6  apply (subgoal_tac "r' + b * (q'-q) \<le> r")
4.7 - prefer 2 apply (simp add: zdiff_zmult_distrib2)
4.8 + prefer 2 apply (simp add: right_diff_distrib)
4.9  apply (subgoal_tac "0 < b * (1 + q - q') ")
4.10  apply (erule_tac [2] order_le_less_trans)
4.12 + prefer 2 apply (simp add: right_diff_distrib right_distrib)
4.13  apply (subgoal_tac "b * q' < b * (1 + q) ")
4.15 + prefer 2 apply (simp add: right_diff_distrib right_distrib)
4.17  done
4.18
4.19 @@ -158,7 +158,7 @@
4.20  (*main argument*)
4.21  apply (subst posDivAlg_eqn, simp_all)
4.22  apply (erule splitE)
4.24 +apply (auto simp add: right_distrib Let_def)
4.25  done
4.26
4.27
4.28 @@ -186,7 +186,7 @@
4.29  (*main argument*)
4.30  apply (subst negDivAlg_eqn, assumption)
4.31  apply (erule splitE)
4.33 +apply (auto simp add: right_distrib Let_def)
4.34  done
4.35
4.36
4.37 @@ -321,7 +321,7 @@
4.38       "quorem((a,b),(q,r))
4.39        ==> quorem ((-a,b), (if r=0 then -q else -q - 1),
4.40                            (if r=0 then 0 else b-r))"
4.41 -by (force simp add: split_ifs quorem_def linorder_neq_iff zdiff_zmult_distrib2)
4.42 +by (force simp add: split_ifs quorem_def linorder_neq_iff right_diff_distrib)
4.43
4.44
4.45  lemma zdiv_zminus1_eq_if:
4.46 @@ -363,7 +363,7 @@
4.47  lemma self_quotient_aux2: "[| (0::int) < a; a = r + a*q; 0 \<le> r |] ==> q \<le> 1"
4.48  apply (subgoal_tac "0 \<le> a* (1-q) ")
4.52  done
4.53
4.54  lemma self_quotient: "[| quorem((a,a),(q,r));  a ~= (0::int) |] ==> q = 1"
4.55 @@ -517,7 +517,7 @@
4.56       "[| 0 \<le> b'*q' + r'; r' < b';  0 < b' |] ==> 0 \<le> (q'::int)"
4.57  apply (subgoal_tac "0 < b'* (q' + 1) ")
4.61  done
4.62
4.63  lemma zdiv_mono2_lemma:
4.64 @@ -529,7 +529,7 @@
4.66  apply (subgoal_tac "b*q = r' - r + b'*q'")
4.67   prefer 2 apply simp
4.69 +apply (simp (no_asm_simp) add: right_distrib)
4.71  apply (rule mult_right_mono, auto)
4.72  done
4.73 @@ -559,7 +559,7 @@
4.74  apply (frule q_neg_lemma, assumption+)
4.75  apply (subgoal_tac "b*q' < b* (q + 1) ")
4.79  apply (subgoal_tac "b*q' \<le> b'*q'")
4.80   prefer 2 apply (simp add: mult_right_mono_neg)
4.81  apply (subgoal_tac "b'*q' < b + b*q")
4.82 @@ -585,7 +585,7 @@
4.83  lemma zmult1_lemma:
4.84       "[| quorem((b,c),(q,r));  c ~= 0 |]
4.85        ==> quorem ((a*b, c), (a*q + a*r div c, a*r mod c))"
4.87 +by (force simp add: split_ifs quorem_def linorder_neq_iff right_distrib)
4.88
4.89  lemma zdiv_zmult1_eq: "(a*b) div c = a*(b div c) + a*(b mod c) div (c::int)"
4.90  apply (case_tac "c = 0", simp add: DIVISION_BY_ZERO)
4.91 @@ -637,7 +637,7 @@
4.93       "[| quorem((a,c),(aq,ar));  quorem((b,c),(bq,br));  c ~= 0 |]
4.94        ==> quorem ((a+b, c), (aq + bq + (ar+br) div c, (ar+br) mod c))"
4.96 +by (force simp add: split_ifs quorem_def linorder_neq_iff right_distrib)
4.97
4.98  (*NOT suitable for rewriting: the RHS has an instance of the LHS*)
4.100 @@ -700,7 +700,7 @@
4.101
4.102  lemma zmult2_lemma_aux1: "[| (0::int) < c;  b < r;  r \<le> 0 |] ==> b*c < b*(q mod c) + r"
4.103  apply (subgoal_tac "b * (c - q mod c) < r * 1")
4.106  apply (rule order_le_less_trans)
4.107  apply (erule_tac [2] mult_strict_right_mono)
4.108  apply (rule mult_left_mono_neg)
4.109 @@ -722,7 +722,7 @@
4.110
4.111  lemma zmult2_lemma_aux4: "[| (0::int) < c; 0 \<le> r; r < b |] ==> b * (q mod c) + r < b * c"
4.112  apply (subgoal_tac "r * 1 < b * (c - q mod c) ")
4.115  apply (rule order_less_le_trans)
4.116  apply (erule mult_strict_right_mono)
4.117  apply (rule_tac [2] mult_left_mono)
4.118 @@ -733,7 +733,7 @@
4.119  lemma zmult2_lemma: "[| quorem ((a,b), (q,r));  b ~= 0;  0 < c |]
4.120        ==> quorem ((a, b*c), (q div c, b*(q mod c) + r))"
4.121  by (auto simp add: mult_ac quorem_def linorder_neq_iff
4.123 +                   zero_less_mult_iff right_distrib [symmetric]
4.124                     zmult2_lemma_aux1 zmult2_lemma_aux2 zmult2_lemma_aux3 zmult2_lemma_aux4)
4.125
4.126  lemma zdiv_zmult2_eq: "(0::int) < c ==> a div (b*c) = (a div b) div c"
4.127 @@ -887,9 +887,9 @@
4.128  lemma neg_zdiv_mult_2: "a \<le> (0::int) ==> (1 + 2*b) div (2*a) = (b+1) div a"
4.129  apply (subgoal_tac " (1 + 2* (-b - 1)) div (2 * (-a)) = (-b - 1) div (-a) ")
4.130  apply (rule_tac [2] pos_zdiv_mult_2)
4.131 -apply (auto simp add: zmult_zminus_right right_diff_distrib)
4.132 +apply (auto simp add: minus_mult_right [symmetric] right_diff_distrib)
4.133  apply (subgoal_tac " (-1 - (2 * b)) = - (1 + (2 * b))")
4.134 -apply (simp only: zdiv_zminus_zminus zdiff_def zminus_zadd_distrib [symmetric],
4.135 +apply (simp only: zdiv_zminus_zminus diff_minus minus_add_distrib [symmetric],
4.136         simp)
4.137  done
4.138
4.139 @@ -934,16 +934,15 @@
4.140  apply (simp)
4.141  done
4.142
4.143 -
4.144  lemma neg_zmod_mult_2:
4.145       "a \<le> (0::int) ==> (1 + 2*b) mod (2*a) = 2 * ((b+1) mod a) - 1"
4.146  apply (subgoal_tac "(1 + 2* (-b - 1)) mod (2* (-a)) =
4.147                      1 + 2* ((-b - 1) mod (-a))")
4.148  apply (rule_tac [2] pos_zmod_mult_2)
4.149 -apply (auto simp add: zmult_zminus_right right_diff_distrib)
4.150 +apply (auto simp add: minus_mult_right [symmetric] right_diff_distrib)
4.151  apply (subgoal_tac " (-1 - (2 * b)) = - (1 + (2 * b))")
4.152   prefer 2 apply simp
4.153 -apply (simp only: zmod_zminus_zminus zdiff_def zminus_zadd_distrib [symmetric])
4.154 +apply (simp only: zmod_zminus_zminus diff_minus minus_add_distrib [symmetric])
4.155  done
4.156
4.157  lemma zmod_number_of_BIT [simp]:
4.158 @@ -1003,7 +1002,7 @@
4.159
4.160  lemma zdvd_0_right [iff]: "(m::int) dvd 0"
4.161    apply (unfold dvd_def)
4.162 -  apply (blast intro: zmult_0_right [symmetric])
4.163 +  apply (blast intro: mult_zero_right [symmetric])
4.164    done
4.165
4.166  lemma zdvd_0_left [iff]: "(0 dvd (m::int)) = (m = 0)"
4.167 @@ -1040,12 +1039,12 @@
4.168
4.169  lemma zdvd_zadd: "k dvd m ==> k dvd n ==> k dvd (m + n :: int)"
4.170    apply (unfold dvd_def)
4.171 -  apply (blast intro: zadd_zmult_distrib2 [symmetric])
4.172 +  apply (blast intro: right_distrib [symmetric])
4.173    done
4.174
4.175  lemma zdvd_zdiff: "k dvd m ==> k dvd n ==> k dvd (m - n :: int)"
4.176    apply (unfold dvd_def)
4.177 -  apply (blast intro: zdiff_zmult_distrib2 [symmetric])
4.178 +  apply (blast intro: right_diff_distrib [symmetric])
4.179    done
4.180
4.181  lemma zdvd_zdiffD: "k dvd m - n ==> k dvd n ==> k dvd (m::int)"
```
```     5.1 --- a/src/HOL/Integ/IntDiv_setup.ML	Fri Mar 19 11:06:53 2004 +0100
5.2 +++ b/src/HOL/Integ/IntDiv_setup.ML	Wed Mar 24 10:50:29 2004 +0100
5.3 @@ -24,7 +24,7 @@
5.4  val trans = trans
5.5
5.6  val prove_eq_sums =
5.9    in NatArithUtils.prove_conv all_tac (NatArithUtils.simp_all simps) end
5.10
5.11  end;
```
```     6.1 --- a/src/HOL/Integ/cooper_proof.ML	Fri Mar 19 11:06:53 2004 +0100
6.2 +++ b/src/HOL/Integ/cooper_proof.ML	Wed Mar 24 10:50:29 2004 +0100
6.3 @@ -44,7 +44,7 @@
6.4  (*-----------------------------------------------------------------*)
6.5
6.6  val presburger_ss = simpset_of (theory "Presburger")
6.7 -  addsimps [zdiff_def] delsimps [thm"zdiff_def_symmetric"];
6.8 +  addsimps [diff_int_def] delsimps [thm"diff_int_def_symmetric"];
6.9  val cboolT = ctyp_of (sign_of HOL.thy) HOLogic.boolT;
6.10
6.11  (*Theorems that will be used later for the proofgeneration*)
```
```     7.1 --- a/src/HOL/Set.thy	Fri Mar 19 11:06:53 2004 +0100
7.2 +++ b/src/HOL/Set.thy	Wed Mar 24 10:50:29 2004 +0100
7.3 @@ -1949,6 +1949,16 @@
7.4    by blast
7.5
7.6
7.7 +subsection {* Getting the Contents of a Singleton Set *}
7.8 +
7.9 +constdefs
7.10 +  contents :: "'a set => 'a"
7.11 +   "contents X == THE x. X = {x}"
7.12 +
7.13 +lemma contents_eq [simp]: "contents {x} = x"
7.15 +
7.16 +
7.17  subsection {* Transitivity rules for calculational reasoning *}
7.18
7.19  lemma forw_subst: "a = b ==> P b ==> P a"
```
```     8.1 --- a/src/HOL/Tools/Presburger/cooper_proof.ML	Fri Mar 19 11:06:53 2004 +0100
8.2 +++ b/src/HOL/Tools/Presburger/cooper_proof.ML	Wed Mar 24 10:50:29 2004 +0100
8.3 @@ -44,7 +44,7 @@
8.4  (*-----------------------------------------------------------------*)
8.5
8.6  val presburger_ss = simpset_of (theory "Presburger")
8.7 -  addsimps [zdiff_def] delsimps [thm"zdiff_def_symmetric"];
8.8 +  addsimps [diff_int_def] delsimps [thm"diff_int_def_symmetric"];
8.9  val cboolT = ctyp_of (sign_of HOL.thy) HOLogic.boolT;
8.10
8.11  (*Theorems that will be used later for the proofgeneration*)
```