121 |
121 |
122 (*The others are |
122 (*The others are |
123 i - j - k = i - (j + k), |
123 i - j - k = i - (j + k), |
124 k \<le> j ==> j - k + i = j + i - k, |
124 k \<le> j ==> j - k + i = j + i - k, |
125 k \<le> j ==> i + (j - k) = i + j - k *) |
125 k \<le> j ==> i + (j - k) = i + j - k *) |
126 declare diff_diff_left [simp] |
126 lemmas add_diff_assoc = diff_add_assoc [symmetric] |
127 diff_add_assoc [symmetric, simp] |
127 lemmas add_diff_assoc2 = diff_add_assoc2[symmetric] |
128 diff_add_assoc2[symmetric, simp] |
128 declare diff_diff_left [simp] add_diff_assoc [simp] add_diff_assoc2[simp] |
129 |
129 |
130 text{*At present we prove no analogue of @{text not_less_Least} or @{text |
130 text{*At present we prove no analogue of @{text not_less_Least} or @{text |
131 Least_Suc}, since there appears to be no need.*} |
131 Least_Suc}, since there appears to be no need.*} |
132 |
132 |
133 ML |
133 ML |
204 lemma of_nat_less_iff [simp]: |
204 lemma of_nat_less_iff [simp]: |
205 "(of_nat m < (of_nat n::'a::ordered_semidom)) = (m<n)" |
205 "(of_nat m < (of_nat n::'a::ordered_semidom)) = (m<n)" |
206 by (blast intro: of_nat_less_imp_less less_imp_of_nat_less) |
206 by (blast intro: of_nat_less_imp_less less_imp_of_nat_less) |
207 |
207 |
208 text{*Special cases where either operand is zero*} |
208 text{*Special cases where either operand is zero*} |
209 declare of_nat_less_iff [of 0, simplified, simp] |
209 lemmas of_nat_0_less_iff = of_nat_less_iff [of 0, simplified] |
210 declare of_nat_less_iff [of _ 0, simplified, simp] |
210 lemmas of_nat_less_0_iff = of_nat_less_iff [of _ 0, simplified] |
|
211 declare of_nat_0_less_iff [simp] |
|
212 declare of_nat_less_0_iff [simp] |
211 |
213 |
212 lemma of_nat_le_iff [simp]: |
214 lemma of_nat_le_iff [simp]: |
213 "(of_nat m \<le> (of_nat n::'a::ordered_semidom)) = (m \<le> n)" |
215 "(of_nat m \<le> (of_nat n::'a::ordered_semidom)) = (m \<le> n)" |
214 by (simp add: linorder_not_less [symmetric]) |
216 by (simp add: linorder_not_less [symmetric]) |
215 |
217 |
216 text{*Special cases where either operand is zero*} |
218 text{*Special cases where either operand is zero*} |
217 declare of_nat_le_iff [of 0, simplified, simp] |
219 lemmas of_nat_0_le_iff = of_nat_le_iff [of 0, simplified] |
218 declare of_nat_le_iff [of _ 0, simplified, simp] |
220 lemmas of_nat_le_0_iff = of_nat_le_iff [of _ 0, simplified] |
|
221 declare of_nat_0_le_iff [simp] |
|
222 declare of_nat_le_0_iff [simp] |
219 |
223 |
220 text{*The ordering on the @{text comm_semiring_1_cancel} is necessary |
224 text{*The ordering on the @{text comm_semiring_1_cancel} is necessary |
221 to exclude the possibility of a finite field, which indeed wraps back to |
225 to exclude the possibility of a finite field, which indeed wraps back to |
222 zero.*} |
226 zero.*} |
223 lemma of_nat_eq_iff [simp]: |
227 lemma of_nat_eq_iff [simp]: |
224 "(of_nat m = (of_nat n::'a::ordered_semidom)) = (m = n)" |
228 "(of_nat m = (of_nat n::'a::ordered_semidom)) = (m = n)" |
225 by (simp add: order_eq_iff) |
229 by (simp add: order_eq_iff) |
226 |
230 |
227 text{*Special cases where either operand is zero*} |
231 text{*Special cases where either operand is zero*} |
228 declare of_nat_eq_iff [of 0, simplified, simp] |
232 lemmas of_nat_0_eq_iff = of_nat_eq_iff [of 0, simplified] |
229 declare of_nat_eq_iff [of _ 0, simplified, simp] |
233 lemmas of_nat_eq_0_iff = of_nat_eq_iff [of _ 0, simplified] |
|
234 declare of_nat_0_eq_iff [simp] |
|
235 declare of_nat_eq_0_iff [simp] |
230 |
236 |
231 lemma of_nat_diff [simp]: |
237 lemma of_nat_diff [simp]: |
232 "n \<le> m ==> of_nat (m - n) = of_nat m - (of_nat n :: 'a::comm_ring_1)" |
238 "n \<le> m ==> of_nat (m - n) = of_nat m - (of_nat n :: 'a::comm_ring_1)" |
233 by (simp del: of_nat_add |
239 by (simp del: of_nat_add |
234 add: compare_rls of_nat_add [symmetric] split add: nat_diff_split) |
240 add: compare_rls of_nat_add [symmetric] split add: nat_diff_split) |