| author | wenzelm | 
| Tue, 27 Jun 2017 11:47:14 +0200 | |
| changeset 66200 | 02c66b71c013 | 
| parent 65057 | 799bbbb3a395 | 
| child 67091 | 1393c2340eec | 
| permissions | -rw-r--r-- | 
| 35050 
9f841f20dca6
renamed OrderedGroup to Groups; split theory Ring_and_Field into Rings Fields
 haftmann parents: 
35043diff
changeset | 1 | (* Title: HOL/Fields.thy | 
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
30961diff
changeset | 2 | Author: Gertrud Bauer | 
| 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
30961diff
changeset | 3 | Author: Steven Obua | 
| 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
30961diff
changeset | 4 | Author: Tobias Nipkow | 
| 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
30961diff
changeset | 5 | Author: Lawrence C Paulson | 
| 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
30961diff
changeset | 6 | Author: Markus Wenzel | 
| 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
30961diff
changeset | 7 | Author: Jeremy Avigad | 
| 14265 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
 paulson parents: diff
changeset | 8 | *) | 
| 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
 paulson parents: diff
changeset | 9 | |
| 60758 | 10 | section \<open>Fields\<close> | 
| 25152 | 11 | |
| 35050 
9f841f20dca6
renamed OrderedGroup to Groups; split theory Ring_and_Field into Rings Fields
 haftmann parents: 
35043diff
changeset | 12 | theory Fields | 
| 62481 
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
 haftmann parents: 
62347diff
changeset | 13 | imports Nat | 
| 25186 | 14 | begin | 
| 14421 
ee97b6463cb4
new Ring_and_Field hierarchy, eliminating redundant axioms
 paulson parents: 
14398diff
changeset | 15 | |
| 60758 | 16 | subsection \<open>Division rings\<close> | 
| 44064 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 17 | |
| 60758 | 18 | text \<open> | 
| 44064 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 19 | A division ring is like a field, but without the commutativity requirement. | 
| 60758 | 20 | \<close> | 
| 44064 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 21 | |
| 60352 
d46de31a50c4
separate class for division operator, with particular syntax added in more specific classes
 haftmann parents: 
59867diff
changeset | 22 | class inverse = divide + | 
| 44064 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 23 | fixes inverse :: "'a \<Rightarrow> 'a" | 
| 58776 
95e58e04e534
use NO_MATCH-simproc for distribution rules in field_simps, otherwise field_simps on '(a / (c + d)) * (e + f)' can be non-terminating
 hoelzl parents: 
58512diff
changeset | 24 | begin | 
| 60352 
d46de31a50c4
separate class for division operator, with particular syntax added in more specific classes
 haftmann parents: 
59867diff
changeset | 25 | |
| 
d46de31a50c4
separate class for division operator, with particular syntax added in more specific classes
 haftmann parents: 
59867diff
changeset | 26 | abbreviation inverse_divide :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "'/" 70) | 
| 
d46de31a50c4
separate class for division operator, with particular syntax added in more specific classes
 haftmann parents: 
59867diff
changeset | 27 | where | 
| 
d46de31a50c4
separate class for division operator, with particular syntax added in more specific classes
 haftmann parents: 
59867diff
changeset | 28 | "inverse_divide \<equiv> divide" | 
| 58776 
95e58e04e534
use NO_MATCH-simproc for distribution rules in field_simps, otherwise field_simps on '(a / (c + d)) * (e + f)' can be non-terminating
 hoelzl parents: 
58512diff
changeset | 29 | |
| 
95e58e04e534
use NO_MATCH-simproc for distribution rules in field_simps, otherwise field_simps on '(a / (c + d)) * (e + f)' can be non-terminating
 hoelzl parents: 
58512diff
changeset | 30 | end | 
| 
95e58e04e534
use NO_MATCH-simproc for distribution rules in field_simps, otherwise field_simps on '(a / (c + d)) * (e + f)' can be non-terminating
 hoelzl parents: 
58512diff
changeset | 31 | |
| 62481 
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
 haftmann parents: 
62347diff
changeset | 32 | text \<open>Setup for linear arithmetic prover\<close> | 
| 
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
 haftmann parents: 
62347diff
changeset | 33 | |
| 
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
 haftmann parents: 
62347diff
changeset | 34 | ML_file "~~/src/Provers/Arith/fast_lin_arith.ML" | 
| 
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
 haftmann parents: 
62347diff
changeset | 35 | ML_file "Tools/lin_arith.ML" | 
| 
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
 haftmann parents: 
62347diff
changeset | 36 | setup \<open>Lin_Arith.global_setup\<close> | 
| 
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
 haftmann parents: 
62347diff
changeset | 37 | declaration \<open>K Lin_Arith.setup\<close> | 
| 
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
 haftmann parents: 
62347diff
changeset | 38 | |
| 
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
 haftmann parents: 
62347diff
changeset | 39 | simproc_setup fast_arith_nat ("(m::nat) < n" | "(m::nat) \<le> n" | "(m::nat) = n") =
 | 
| 
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
 haftmann parents: 
62347diff
changeset | 40 | \<open>K Lin_Arith.simproc\<close> | 
| 
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
 haftmann parents: 
62347diff
changeset | 41 | (* Because of this simproc, the arithmetic solver is really only | 
| 
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
 haftmann parents: 
62347diff
changeset | 42 | useful to detect inconsistencies among the premises for subgoals which are | 
| 
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
 haftmann parents: 
62347diff
changeset | 43 | *not* themselves (in)equalities, because the latter activate | 
| 
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
 haftmann parents: 
62347diff
changeset | 44 | fast_nat_arith_simproc anyway. However, it seems cheaper to activate the | 
| 
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
 haftmann parents: 
62347diff
changeset | 45 | solver all the time rather than add the additional check. *) | 
| 
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
 haftmann parents: 
62347diff
changeset | 46 | |
| 
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
 haftmann parents: 
62347diff
changeset | 47 | lemmas [arith_split] = nat_diff_split split_min split_max | 
| 
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
 haftmann parents: 
62347diff
changeset | 48 | |
| 
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
 haftmann parents: 
62347diff
changeset | 49 | |
| 61799 | 50 | text\<open>Lemmas \<open>divide_simps\<close> move division to the outside and eliminates them on (in)equalities.\<close> | 
| 56481 | 51 | |
| 57950 | 52 | named_theorems divide_simps "rewrite rules to eliminate divisions" | 
| 56481 | 53 | |
| 44064 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 54 | class division_ring = ring_1 + inverse + | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 55 | assumes left_inverse [simp]: "a \<noteq> 0 \<Longrightarrow> inverse a * a = 1" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 56 | assumes right_inverse [simp]: "a \<noteq> 0 \<Longrightarrow> a * inverse a = 1" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 57 | assumes divide_inverse: "a / b = a * inverse b" | 
| 59867 
58043346ca64
given up separate type classes demanding `inverse 0 = 0`
 haftmann parents: 
59779diff
changeset | 58 | assumes inverse_zero [simp]: "inverse 0 = 0" | 
| 44064 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 59 | begin | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 60 | |
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 61 | subclass ring_1_no_zero_divisors | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 62 | proof | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 63 | fix a b :: 'a | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 64 | assume a: "a \<noteq> 0" and b: "b \<noteq> 0" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 65 | show "a * b \<noteq> 0" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 66 | proof | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 67 | assume ab: "a * b = 0" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 68 | hence "0 = inverse a * (a * b) * inverse b" by simp | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 69 | also have "\<dots> = (inverse a * a) * (b * inverse b)" | 
| 57512 
cc97b347b301
reduced name variants for assoc and commute on plus and mult
 haftmann parents: 
56571diff
changeset | 70 | by (simp only: mult.assoc) | 
| 44064 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 71 | also have "\<dots> = 1" using a b by simp | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 72 | finally show False by simp | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 73 | qed | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 74 | qed | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 75 | |
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 76 | lemma nonzero_imp_inverse_nonzero: | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 77 | "a \<noteq> 0 \<Longrightarrow> inverse a \<noteq> 0" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 78 | proof | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 79 | assume ianz: "inverse a = 0" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 80 | assume "a \<noteq> 0" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 81 | hence "1 = a * inverse a" by simp | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 82 | also have "... = 0" by (simp add: ianz) | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 83 | finally have "1 = 0" . | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 84 | thus False by (simp add: eq_commute) | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 85 | qed | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 86 | |
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 87 | lemma inverse_zero_imp_zero: | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 88 | "inverse a = 0 \<Longrightarrow> a = 0" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 89 | apply (rule classical) | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 90 | apply (drule nonzero_imp_inverse_nonzero) | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 91 | apply auto | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 92 | done | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 93 | |
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 94 | lemma inverse_unique: | 
| 44064 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 95 | assumes ab: "a * b = 1" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 96 | shows "inverse a = b" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 97 | proof - | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 98 | have "a \<noteq> 0" using ab by (cases "a = 0") simp_all | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 99 | moreover have "inverse a * (a * b) = inverse a" by (simp add: ab) | 
| 57512 
cc97b347b301
reduced name variants for assoc and commute on plus and mult
 haftmann parents: 
56571diff
changeset | 100 | ultimately show ?thesis by (simp add: mult.assoc [symmetric]) | 
| 44064 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 101 | qed | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 102 | |
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 103 | lemma nonzero_inverse_minus_eq: | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 104 | "a \<noteq> 0 \<Longrightarrow> inverse (- a) = - inverse a" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 105 | by (rule inverse_unique) simp | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 106 | |
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 107 | lemma nonzero_inverse_inverse_eq: | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 108 | "a \<noteq> 0 \<Longrightarrow> inverse (inverse a) = a" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 109 | by (rule inverse_unique) simp | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 110 | |
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 111 | lemma nonzero_inverse_eq_imp_eq: | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 112 | assumes "inverse a = inverse b" and "a \<noteq> 0" and "b \<noteq> 0" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 113 | shows "a = b" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 114 | proof - | 
| 60758 | 115 | from \<open>inverse a = inverse b\<close> | 
| 44064 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 116 | have "inverse (inverse a) = inverse (inverse b)" by (rule arg_cong) | 
| 60758 | 117 | with \<open>a \<noteq> 0\<close> and \<open>b \<noteq> 0\<close> show "a = b" | 
| 44064 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 118 | by (simp add: nonzero_inverse_inverse_eq) | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 119 | qed | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 120 | |
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 121 | lemma inverse_1 [simp]: "inverse 1 = 1" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 122 | by (rule inverse_unique) simp | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 123 | |
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 124 | lemma nonzero_inverse_mult_distrib: | 
| 44064 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 125 | assumes "a \<noteq> 0" and "b \<noteq> 0" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 126 | shows "inverse (a * b) = inverse b * inverse a" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 127 | proof - | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 128 | have "a * (b * inverse b) * inverse a = 1" using assms by simp | 
| 57512 
cc97b347b301
reduced name variants for assoc and commute on plus and mult
 haftmann parents: 
56571diff
changeset | 129 | hence "a * b * (inverse b * inverse a) = 1" by (simp only: mult.assoc) | 
| 44064 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 130 | thus ?thesis by (rule inverse_unique) | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 131 | qed | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 132 | |
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 133 | lemma division_ring_inverse_add: | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 134 | "a \<noteq> 0 \<Longrightarrow> b \<noteq> 0 \<Longrightarrow> inverse a + inverse b = inverse a * (a + b) * inverse b" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 135 | by (simp add: algebra_simps) | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 136 | |
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 137 | lemma division_ring_inverse_diff: | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 138 | "a \<noteq> 0 \<Longrightarrow> b \<noteq> 0 \<Longrightarrow> inverse a - inverse b = inverse a * (b - a) * inverse b" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 139 | by (simp add: algebra_simps) | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 140 | |
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 141 | lemma right_inverse_eq: "b \<noteq> 0 \<Longrightarrow> a / b = 1 \<longleftrightarrow> a = b" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 142 | proof | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 143 | assume neq: "b \<noteq> 0" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 144 |   {
 | 
| 57512 
cc97b347b301
reduced name variants for assoc and commute on plus and mult
 haftmann parents: 
56571diff
changeset | 145 | hence "a = (a / b) * b" by (simp add: divide_inverse mult.assoc) | 
| 44064 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 146 | also assume "a / b = 1" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 147 | finally show "a = b" by simp | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 148 | next | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 149 | assume "a = b" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 150 | with neq show "a / b = 1" by (simp add: divide_inverse) | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 151 | } | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 152 | qed | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 153 | |
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 154 | lemma nonzero_inverse_eq_divide: "a \<noteq> 0 \<Longrightarrow> inverse a = 1 / a" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 155 | by (simp add: divide_inverse) | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 156 | |
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 157 | lemma divide_self [simp]: "a \<noteq> 0 \<Longrightarrow> a / a = 1" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 158 | by (simp add: divide_inverse) | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 159 | |
| 56481 | 160 | lemma inverse_eq_divide [field_simps, divide_simps]: "inverse a = 1 / a" | 
| 44064 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 161 | by (simp add: divide_inverse) | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 162 | |
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 163 | lemma add_divide_distrib: "(a+b) / c = a/c + b/c" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 164 | by (simp add: divide_inverse algebra_simps) | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 165 | |
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 166 | lemma times_divide_eq_right [simp]: "a * (b / c) = (a * b) / c" | 
| 57512 
cc97b347b301
reduced name variants for assoc and commute on plus and mult
 haftmann parents: 
56571diff
changeset | 167 | by (simp add: divide_inverse mult.assoc) | 
| 44064 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 168 | |
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 169 | lemma minus_divide_left: "- (a / b) = (-a) / b" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 170 | by (simp add: divide_inverse) | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 171 | |
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 172 | lemma nonzero_minus_divide_right: "b \<noteq> 0 ==> - (a / b) = a / (- b)" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 173 | by (simp add: divide_inverse nonzero_inverse_minus_eq) | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 174 | |
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 175 | lemma nonzero_minus_divide_divide: "b \<noteq> 0 ==> (-a) / (-b) = a / b" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 176 | by (simp add: divide_inverse nonzero_inverse_minus_eq) | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 177 | |
| 56479 
91958d4b30f7
revert c1bbd3e22226, a14831ac3023, and 36489d77c484: divide_minus_left/right are again simp rules
 hoelzl parents: 
56445diff
changeset | 178 | lemma divide_minus_left [simp]: "(-a) / b = - (a / b)" | 
| 44064 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 179 | by (simp add: divide_inverse) | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 180 | |
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 181 | lemma diff_divide_distrib: "(a - b) / c = a / c - b / c" | 
| 56479 
91958d4b30f7
revert c1bbd3e22226, a14831ac3023, and 36489d77c484: divide_minus_left/right are again simp rules
 hoelzl parents: 
56445diff
changeset | 182 | using add_divide_distrib [of a "- b" c] by simp | 
| 44064 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 183 | |
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 184 | lemma nonzero_eq_divide_eq [field_simps]: "c \<noteq> 0 \<Longrightarrow> a = b / c \<longleftrightarrow> a * c = b" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 185 | proof - | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 186 | assume [simp]: "c \<noteq> 0" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 187 | have "a = b / c \<longleftrightarrow> a * c = (b / c) * c" by simp | 
| 57512 
cc97b347b301
reduced name variants for assoc and commute on plus and mult
 haftmann parents: 
56571diff
changeset | 188 | also have "... \<longleftrightarrow> a * c = b" by (simp add: divide_inverse mult.assoc) | 
| 44064 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 189 | finally show ?thesis . | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 190 | qed | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 191 | |
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 192 | lemma nonzero_divide_eq_eq [field_simps]: "c \<noteq> 0 \<Longrightarrow> b / c = a \<longleftrightarrow> b = a * c" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 193 | proof - | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 194 | assume [simp]: "c \<noteq> 0" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 195 | have "b / c = a \<longleftrightarrow> (b / c) * c = a * c" by simp | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 196 | also have "... \<longleftrightarrow> b = a * c" by (simp add: divide_inverse mult.assoc) | 
| 44064 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 197 | finally show ?thesis . | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 198 | qed | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 199 | |
| 56480 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 200 | lemma nonzero_neg_divide_eq_eq [field_simps]: "b \<noteq> 0 \<Longrightarrow> - (a / b) = c \<longleftrightarrow> - a = c * b" | 
| 59535 | 201 | using nonzero_divide_eq_eq[of b "-a" c] by simp | 
| 56441 | 202 | |
| 56480 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 203 | lemma nonzero_neg_divide_eq_eq2 [field_simps]: "b \<noteq> 0 \<Longrightarrow> c = - (a / b) \<longleftrightarrow> c * b = - a" | 
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 204 | using nonzero_neg_divide_eq_eq[of b a c] by auto | 
| 56441 | 205 | |
| 44064 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 206 | lemma divide_eq_imp: "c \<noteq> 0 \<Longrightarrow> b = a * c \<Longrightarrow> b / c = a" | 
| 57512 
cc97b347b301
reduced name variants for assoc and commute on plus and mult
 haftmann parents: 
56571diff
changeset | 207 | by (simp add: divide_inverse mult.assoc) | 
| 44064 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 208 | |
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 209 | lemma eq_divide_imp: "c \<noteq> 0 \<Longrightarrow> a * c = b \<Longrightarrow> a = b / c" | 
| 57512 
cc97b347b301
reduced name variants for assoc and commute on plus and mult
 haftmann parents: 
56571diff
changeset | 210 | by (drule sym) (simp add: divide_inverse mult.assoc) | 
| 44064 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 211 | |
| 56445 | 212 | lemma add_divide_eq_iff [field_simps]: | 
| 213 | "z \<noteq> 0 \<Longrightarrow> x + y / z = (x * z + y) / z" | |
| 214 | by (simp add: add_divide_distrib nonzero_eq_divide_eq) | |
| 215 | ||
| 216 | lemma divide_add_eq_iff [field_simps]: | |
| 217 | "z \<noteq> 0 \<Longrightarrow> x / z + y = (x + y * z) / z" | |
| 218 | by (simp add: add_divide_distrib nonzero_eq_divide_eq) | |
| 219 | ||
| 220 | lemma diff_divide_eq_iff [field_simps]: | |
| 221 | "z \<noteq> 0 \<Longrightarrow> x - y / z = (x * z - y) / z" | |
| 222 | by (simp add: diff_divide_distrib nonzero_eq_divide_eq eq_diff_eq) | |
| 223 | ||
| 56480 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 224 | lemma minus_divide_add_eq_iff [field_simps]: | 
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 225 | "z \<noteq> 0 \<Longrightarrow> - (x / z) + y = (- x + y * z) / z" | 
| 59535 | 226 | by (simp add: add_divide_distrib diff_divide_eq_iff) | 
| 56480 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 227 | |
| 56445 | 228 | lemma divide_diff_eq_iff [field_simps]: | 
| 229 | "z \<noteq> 0 \<Longrightarrow> x / z - y = (x - y * z) / z" | |
| 230 | by (simp add: field_simps) | |
| 231 | ||
| 56480 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 232 | lemma minus_divide_diff_eq_iff [field_simps]: | 
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 233 | "z \<noteq> 0 \<Longrightarrow> - (x / z) - y = (- x - y * z) / z" | 
| 59535 | 234 | by (simp add: divide_diff_eq_iff[symmetric]) | 
| 56480 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 235 | |
| 60353 
838025c6e278
implicit partial divison operation in integral domains
 haftmann parents: 
60352diff
changeset | 236 | lemma division_ring_divide_zero [simp]: | 
| 44064 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 237 | "a / 0 = 0" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 238 | by (simp add: divide_inverse) | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 239 | |
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 240 | lemma divide_self_if [simp]: | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 241 | "a / a = (if a = 0 then 0 else 1)" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 242 | by simp | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 243 | |
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 244 | lemma inverse_nonzero_iff_nonzero [simp]: | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 245 | "inverse a = 0 \<longleftrightarrow> a = 0" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 246 | by rule (fact inverse_zero_imp_zero, simp) | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 247 | |
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 248 | lemma inverse_minus_eq [simp]: | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 249 | "inverse (- a) = - inverse a" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 250 | proof cases | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 251 | assume "a=0" thus ?thesis by simp | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 252 | next | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 253 | assume "a\<noteq>0" | 
| 44064 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 254 | thus ?thesis by (simp add: nonzero_inverse_minus_eq) | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 255 | qed | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 256 | |
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 257 | lemma inverse_inverse_eq [simp]: | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 258 | "inverse (inverse a) = a" | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 259 | proof cases | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 260 | assume "a=0" thus ?thesis by simp | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 261 | next | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 262 | assume "a\<noteq>0" | 
| 44064 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 263 | thus ?thesis by (simp add: nonzero_inverse_inverse_eq) | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 264 | qed | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 265 | |
| 44680 | 266 | lemma inverse_eq_imp_eq: | 
| 267 | "inverse a = inverse b \<Longrightarrow> a = b" | |
| 268 | by (drule arg_cong [where f="inverse"], simp) | |
| 269 | ||
| 270 | lemma inverse_eq_iff_eq [simp]: | |
| 271 | "inverse a = inverse b \<longleftrightarrow> a = b" | |
| 272 | by (force dest!: inverse_eq_imp_eq) | |
| 273 | ||
| 56481 | 274 | lemma add_divide_eq_if_simps [divide_simps]: | 
| 275 | "a + b / z = (if z = 0 then a else (a * z + b) / z)" | |
| 276 | "a / z + b = (if z = 0 then b else (a + b * z) / z)" | |
| 277 | "- (a / z) + b = (if z = 0 then b else (-a + b * z) / z)" | |
| 278 | "a - b / z = (if z = 0 then a else (a * z - b) / z)" | |
| 279 | "a / z - b = (if z = 0 then -b else (a - b * z) / z)" | |
| 280 | "- (a / z) - b = (if z = 0 then -b else (- a - b * z) / z)" | |
| 281 | by (simp_all add: add_divide_eq_iff divide_add_eq_iff diff_divide_eq_iff divide_diff_eq_iff | |
| 282 | minus_divide_diff_eq_iff) | |
| 283 | ||
| 284 | lemma [divide_simps]: | |
| 285 | shows divide_eq_eq: "b / c = a \<longleftrightarrow> (if c \<noteq> 0 then b = a * c else a = 0)" | |
| 286 | and eq_divide_eq: "a = b / c \<longleftrightarrow> (if c \<noteq> 0 then a * c = b else a = 0)" | |
| 287 | and minus_divide_eq_eq: "- (b / c) = a \<longleftrightarrow> (if c \<noteq> 0 then - b = a * c else a = 0)" | |
| 288 | and eq_minus_divide_eq: "a = - (b / c) \<longleftrightarrow> (if c \<noteq> 0 then a * c = - b else a = 0)" | |
| 289 | by (auto simp add: field_simps) | |
| 290 | ||
| 44064 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 291 | end | 
| 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 292 | |
| 60758 | 293 | subsection \<open>Fields\<close> | 
| 44064 
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
 huffman parents: 
42904diff
changeset | 294 | |
| 22987 
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
 huffman parents: 
22842diff
changeset | 295 | class field = comm_ring_1 + inverse + | 
| 35084 | 296 | assumes field_inverse: "a \<noteq> 0 \<Longrightarrow> inverse a * a = 1" | 
| 297 | assumes field_divide_inverse: "a / b = a * inverse b" | |
| 59867 
58043346ca64
given up separate type classes demanding `inverse 0 = 0`
 haftmann parents: 
59779diff
changeset | 298 | assumes field_inverse_zero: "inverse 0 = 0" | 
| 25267 | 299 | begin | 
| 20496 
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
 huffman parents: 
19404diff
changeset | 300 | |
| 25267 | 301 | subclass division_ring | 
| 28823 | 302 | proof | 
| 22987 
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
 huffman parents: 
22842diff
changeset | 303 | fix a :: 'a | 
| 
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
 huffman parents: 
22842diff
changeset | 304 | assume "a \<noteq> 0" | 
| 
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
 huffman parents: 
22842diff
changeset | 305 | thus "inverse a * a = 1" by (rule field_inverse) | 
| 57512 
cc97b347b301
reduced name variants for assoc and commute on plus and mult
 haftmann parents: 
56571diff
changeset | 306 | thus "a * inverse a = 1" by (simp only: mult.commute) | 
| 35084 | 307 | next | 
| 308 | fix a b :: 'a | |
| 309 | show "a / b = a * inverse b" by (rule field_divide_inverse) | |
| 59867 
58043346ca64
given up separate type classes demanding `inverse 0 = 0`
 haftmann parents: 
59779diff
changeset | 310 | next | 
| 
58043346ca64
given up separate type classes demanding `inverse 0 = 0`
 haftmann parents: 
59779diff
changeset | 311 | show "inverse 0 = 0" | 
| 
58043346ca64
given up separate type classes demanding `inverse 0 = 0`
 haftmann parents: 
59779diff
changeset | 312 | by (fact field_inverse_zero) | 
| 14738 | 313 | qed | 
| 25230 | 314 | |
| 60353 
838025c6e278
implicit partial divison operation in integral domains
 haftmann parents: 
60352diff
changeset | 315 | subclass idom_divide | 
| 
838025c6e278
implicit partial divison operation in integral domains
 haftmann parents: 
60352diff
changeset | 316 | proof | 
| 
838025c6e278
implicit partial divison operation in integral domains
 haftmann parents: 
60352diff
changeset | 317 | fix b a | 
| 
838025c6e278
implicit partial divison operation in integral domains
 haftmann parents: 
60352diff
changeset | 318 | assume "b \<noteq> 0" | 
| 
838025c6e278
implicit partial divison operation in integral domains
 haftmann parents: 
60352diff
changeset | 319 | then show "a * b / b = a" | 
| 
838025c6e278
implicit partial divison operation in integral domains
 haftmann parents: 
60352diff
changeset | 320 | by (simp add: divide_inverse ac_simps) | 
| 
838025c6e278
implicit partial divison operation in integral domains
 haftmann parents: 
60352diff
changeset | 321 | next | 
| 
838025c6e278
implicit partial divison operation in integral domains
 haftmann parents: 
60352diff
changeset | 322 | fix a | 
| 
838025c6e278
implicit partial divison operation in integral domains
 haftmann parents: 
60352diff
changeset | 323 | show "a / 0 = 0" | 
| 
838025c6e278
implicit partial divison operation in integral domains
 haftmann parents: 
60352diff
changeset | 324 | by (simp add: divide_inverse) | 
| 
838025c6e278
implicit partial divison operation in integral domains
 haftmann parents: 
60352diff
changeset | 325 | qed | 
| 25230 | 326 | |
| 60758 | 327 | text\<open>There is no slick version using division by zero.\<close> | 
| 30630 | 328 | lemma inverse_add: | 
| 60353 
838025c6e278
implicit partial divison operation in integral domains
 haftmann parents: 
60352diff
changeset | 329 | "a \<noteq> 0 \<Longrightarrow> b \<noteq> 0 \<Longrightarrow> inverse a + inverse b = (a + b) * inverse a * inverse b" | 
| 
838025c6e278
implicit partial divison operation in integral domains
 haftmann parents: 
60352diff
changeset | 330 | by (simp add: division_ring_inverse_add ac_simps) | 
| 30630 | 331 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 332 | lemma nonzero_mult_divide_mult_cancel_left [simp]: | 
| 60353 
838025c6e278
implicit partial divison operation in integral domains
 haftmann parents: 
60352diff
changeset | 333 | assumes [simp]: "c \<noteq> 0" | 
| 
838025c6e278
implicit partial divison operation in integral domains
 haftmann parents: 
60352diff
changeset | 334 | shows "(c * a) / (c * b) = a / b" | 
| 
838025c6e278
implicit partial divison operation in integral domains
 haftmann parents: 
60352diff
changeset | 335 | proof (cases "b = 0") | 
| 
838025c6e278
implicit partial divison operation in integral domains
 haftmann parents: 
60352diff
changeset | 336 | case True then show ?thesis by simp | 
| 
838025c6e278
implicit partial divison operation in integral domains
 haftmann parents: 
60352diff
changeset | 337 | next | 
| 
838025c6e278
implicit partial divison operation in integral domains
 haftmann parents: 
60352diff
changeset | 338 | case False | 
| 
838025c6e278
implicit partial divison operation in integral domains
 haftmann parents: 
60352diff
changeset | 339 | then have "(c*a)/(c*b) = c * a * (inverse b * inverse c)" | 
| 30630 | 340 | by (simp add: divide_inverse nonzero_inverse_mult_distrib) | 
| 341 | also have "... = a * inverse b * (inverse c * c)" | |
| 57514 
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
 haftmann parents: 
57512diff
changeset | 342 | by (simp only: ac_simps) | 
| 30630 | 343 | also have "... = a * inverse b" by simp | 
| 344 | finally show ?thesis by (simp add: divide_inverse) | |
| 345 | qed | |
| 346 | ||
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 347 | lemma nonzero_mult_divide_mult_cancel_right [simp]: | 
| 60353 
838025c6e278
implicit partial divison operation in integral domains
 haftmann parents: 
60352diff
changeset | 348 | "c \<noteq> 0 \<Longrightarrow> (a * c) / (b * c) = a / b" | 
| 
838025c6e278
implicit partial divison operation in integral domains
 haftmann parents: 
60352diff
changeset | 349 | using nonzero_mult_divide_mult_cancel_left [of c a b] by (simp add: ac_simps) | 
| 30630 | 350 | |
| 36304 
6984744e6b34
less special treatment of times_divide_eq [simp]
 haftmann parents: 
36301diff
changeset | 351 | lemma times_divide_eq_left [simp]: "(b / c) * a = (b * a) / c" | 
| 57514 
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
 haftmann parents: 
57512diff
changeset | 352 | by (simp add: divide_inverse ac_simps) | 
| 30630 | 353 | |
| 61238 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 354 | lemma divide_inverse_commute: "a / b = inverse b * a" | 
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 355 | by (simp add: divide_inverse mult.commute) | 
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 356 | |
| 30630 | 357 | lemma add_frac_eq: | 
| 358 | assumes "y \<noteq> 0" and "z \<noteq> 0" | |
| 359 | shows "x / y + w / z = (x * z + w * y) / (y * z)" | |
| 360 | proof - | |
| 361 | have "x / y + w / z = (x * z) / (y * z) + (y * w) / (y * z)" | |
| 362 | using assms by simp | |
| 363 | also have "\<dots> = (x * z + y * w) / (y * z)" | |
| 364 | by (simp only: add_divide_distrib) | |
| 365 | finally show ?thesis | |
| 57512 
cc97b347b301
reduced name variants for assoc and commute on plus and mult
 haftmann parents: 
56571diff
changeset | 366 | by (simp only: mult.commute) | 
| 30630 | 367 | qed | 
| 368 | ||
| 60758 | 369 | text\<open>Special Cancellation Simprules for Division\<close> | 
| 30630 | 370 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 371 | lemma nonzero_divide_mult_cancel_right [simp]: | 
| 60353 
838025c6e278
implicit partial divison operation in integral domains
 haftmann parents: 
60352diff
changeset | 372 | "b \<noteq> 0 \<Longrightarrow> b / (a * b) = 1 / a" | 
| 
838025c6e278
implicit partial divison operation in integral domains
 haftmann parents: 
60352diff
changeset | 373 | using nonzero_mult_divide_mult_cancel_right [of b 1 a] by simp | 
| 30630 | 374 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 375 | lemma nonzero_divide_mult_cancel_left [simp]: | 
| 60353 
838025c6e278
implicit partial divison operation in integral domains
 haftmann parents: 
60352diff
changeset | 376 | "a \<noteq> 0 \<Longrightarrow> a / (a * b) = 1 / b" | 
| 
838025c6e278
implicit partial divison operation in integral domains
 haftmann parents: 
60352diff
changeset | 377 | using nonzero_mult_divide_mult_cancel_left [of a 1 b] by simp | 
| 30630 | 378 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 379 | lemma nonzero_mult_divide_mult_cancel_left2 [simp]: | 
| 60353 
838025c6e278
implicit partial divison operation in integral domains
 haftmann parents: 
60352diff
changeset | 380 | "c \<noteq> 0 \<Longrightarrow> (c * a) / (b * c) = a / b" | 
| 
838025c6e278
implicit partial divison operation in integral domains
 haftmann parents: 
60352diff
changeset | 381 | using nonzero_mult_divide_mult_cancel_left [of c a b] by (simp add: ac_simps) | 
| 30630 | 382 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 383 | lemma nonzero_mult_divide_mult_cancel_right2 [simp]: | 
| 60353 
838025c6e278
implicit partial divison operation in integral domains
 haftmann parents: 
60352diff
changeset | 384 | "c \<noteq> 0 \<Longrightarrow> (a * c) / (c * b) = a / b" | 
| 
838025c6e278
implicit partial divison operation in integral domains
 haftmann parents: 
60352diff
changeset | 385 | using nonzero_mult_divide_mult_cancel_right [of b c a] by (simp add: ac_simps) | 
| 30630 | 386 | |
| 387 | lemma diff_frac_eq: | |
| 388 | "y \<noteq> 0 \<Longrightarrow> z \<noteq> 0 \<Longrightarrow> x / y - w / z = (x * z - w * y) / (y * z)" | |
| 36348 
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
 haftmann parents: 
36343diff
changeset | 389 | by (simp add: field_simps) | 
| 30630 | 390 | |
| 391 | lemma frac_eq_eq: | |
| 392 | "y \<noteq> 0 \<Longrightarrow> z \<noteq> 0 \<Longrightarrow> (x / y = w / z) = (x * z = w * y)" | |
| 36348 
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
 haftmann parents: 
36343diff
changeset | 393 | by (simp add: field_simps) | 
| 
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
 haftmann parents: 
36343diff
changeset | 394 | |
| 58512 
dc4d76dfa8f0
moved lemmas out of Int.thy which have nothing to do with int
 haftmann parents: 
57950diff
changeset | 395 | lemma divide_minus1 [simp]: "x / - 1 = - x" | 
| 
dc4d76dfa8f0
moved lemmas out of Int.thy which have nothing to do with int
 haftmann parents: 
57950diff
changeset | 396 | using nonzero_minus_divide_right [of "1" x] by simp | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 397 | |
| 60758 | 398 | text\<open>This version builds in division by zero while also re-orienting | 
| 399 | the right-hand side.\<close> | |
| 14270 | 400 | lemma inverse_mult_distrib [simp]: | 
| 36409 | 401 | "inverse (a * b) = inverse a * inverse b" | 
| 402 | proof cases | |
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 403 | assume "a \<noteq> 0 & b \<noteq> 0" | 
| 57514 
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
 haftmann parents: 
57512diff
changeset | 404 | thus ?thesis by (simp add: nonzero_inverse_mult_distrib ac_simps) | 
| 36409 | 405 | next | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 406 | assume "~ (a \<noteq> 0 & b \<noteq> 0)" | 
| 36409 | 407 | thus ?thesis by force | 
| 408 | qed | |
| 14270 | 409 | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14353diff
changeset | 410 | lemma inverse_divide [simp]: | 
| 36409 | 411 | "inverse (a / b) = b / a" | 
| 57512 
cc97b347b301
reduced name variants for assoc and commute on plus and mult
 haftmann parents: 
56571diff
changeset | 412 | by (simp add: divide_inverse mult.commute) | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14353diff
changeset | 413 | |
| 23389 | 414 | |
| 60758 | 415 | text \<open>Calculations with fractions\<close> | 
| 16775 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 416 | |
| 61799 | 417 | text\<open>There is a whole bunch of simp-rules just for class \<open>field\<close> but none for class \<open>field\<close> and \<open>nonzero_divides\<close> | 
| 60758 | 418 | because the latter are covered by a simproc.\<close> | 
| 23413 
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
 nipkow parents: 
23406diff
changeset | 419 | |
| 
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
 nipkow parents: 
23406diff
changeset | 420 | lemma mult_divide_mult_cancel_left: | 
| 36409 | 421 | "c \<noteq> 0 \<Longrightarrow> (c * a) / (c * b) = a / b" | 
| 21328 | 422 | apply (cases "b = 0") | 
| 35216 | 423 | apply simp_all | 
| 14277 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
 paulson parents: 
14272diff
changeset | 424 | done | 
| 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
 paulson parents: 
14272diff
changeset | 425 | |
| 23413 
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
 nipkow parents: 
23406diff
changeset | 426 | lemma mult_divide_mult_cancel_right: | 
| 36409 | 427 | "c \<noteq> 0 \<Longrightarrow> (a * c) / (b * c) = a / b" | 
| 21328 | 428 | apply (cases "b = 0") | 
| 35216 | 429 | apply simp_all | 
| 14321 | 430 | done | 
| 23413 
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
 nipkow parents: 
23406diff
changeset | 431 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 432 | lemma divide_divide_eq_right [simp]: | 
| 36409 | 433 | "a / (b / c) = (a * c) / b" | 
| 57514 
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
 haftmann parents: 
57512diff
changeset | 434 | by (simp add: divide_inverse ac_simps) | 
| 14288 | 435 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 436 | lemma divide_divide_eq_left [simp]: | 
| 36409 | 437 | "(a / b) / c = a / (b * c)" | 
| 57512 
cc97b347b301
reduced name variants for assoc and commute on plus and mult
 haftmann parents: 
56571diff
changeset | 438 | by (simp add: divide_inverse mult.assoc) | 
| 14288 | 439 | |
| 56365 
713f9b9a7e51
New theorems for extracting quotients
 paulson <lp15@cam.ac.uk> parents: 
55718diff
changeset | 440 | lemma divide_divide_times_eq: | 
| 
713f9b9a7e51
New theorems for extracting quotients
 paulson <lp15@cam.ac.uk> parents: 
55718diff
changeset | 441 | "(x / y) / (z / w) = (x * w) / (y * z)" | 
| 
713f9b9a7e51
New theorems for extracting quotients
 paulson <lp15@cam.ac.uk> parents: 
55718diff
changeset | 442 | by simp | 
| 23389 | 443 | |
| 60758 | 444 | text \<open>Special Cancellation Simprules for Division\<close> | 
| 15234 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
 paulson parents: 
15229diff
changeset | 445 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 446 | lemma mult_divide_mult_cancel_left_if [simp]: | 
| 36409 | 447 | shows "(c * a) / (c * b) = (if c = 0 then 0 else a / b)" | 
| 60353 
838025c6e278
implicit partial divison operation in integral domains
 haftmann parents: 
60352diff
changeset | 448 | by simp | 
| 23413 
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
 nipkow parents: 
23406diff
changeset | 449 | |
| 15234 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
 paulson parents: 
15229diff
changeset | 450 | |
| 60758 | 451 | text \<open>Division and Unary Minus\<close> | 
| 14293 | 452 | |
| 36409 | 453 | lemma minus_divide_right: | 
| 454 | "- (a / b) = a / - b" | |
| 455 | by (simp add: divide_inverse) | |
| 14430 
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
 paulson parents: 
14421diff
changeset | 456 | |
| 56479 
91958d4b30f7
revert c1bbd3e22226, a14831ac3023, and 36489d77c484: divide_minus_left/right are again simp rules
 hoelzl parents: 
56445diff
changeset | 457 | lemma divide_minus_right [simp]: | 
| 36409 | 458 | "a / - b = - (a / b)" | 
| 459 | by (simp add: divide_inverse) | |
| 30630 | 460 | |
| 56479 
91958d4b30f7
revert c1bbd3e22226, a14831ac3023, and 36489d77c484: divide_minus_left/right are again simp rules
 hoelzl parents: 
56445diff
changeset | 461 | lemma minus_divide_divide: | 
| 36409 | 462 | "(- a) / (- b) = a / b" | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 463 | apply (cases "b=0", simp) | 
| 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 464 | apply (simp add: nonzero_minus_divide_divide) | 
| 14293 | 465 | done | 
| 466 | ||
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 467 | lemma inverse_eq_1_iff [simp]: | 
| 36409 | 468 | "inverse x = 1 \<longleftrightarrow> x = 1" | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 469 | by (insert inverse_eq_iff_eq [of x 1], simp) | 
| 23389 | 470 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 471 | lemma divide_eq_0_iff [simp]: | 
| 36409 | 472 | "a / b = 0 \<longleftrightarrow> a = 0 \<or> b = 0" | 
| 473 | by (simp add: divide_inverse) | |
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 474 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 475 | lemma divide_cancel_right [simp]: | 
| 36409 | 476 | "a / c = b / c \<longleftrightarrow> c = 0 \<or> a = b" | 
| 477 | apply (cases "c=0", simp) | |
| 478 | apply (simp add: divide_inverse) | |
| 479 | done | |
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 480 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 481 | lemma divide_cancel_left [simp]: | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 482 | "c / a = c / b \<longleftrightarrow> c = 0 \<or> a = b" | 
| 36409 | 483 | apply (cases "c=0", simp) | 
| 484 | apply (simp add: divide_inverse) | |
| 485 | done | |
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 486 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 487 | lemma divide_eq_1_iff [simp]: | 
| 36409 | 488 | "a / b = 1 \<longleftrightarrow> b \<noteq> 0 \<and> a = b" | 
| 489 | apply (cases "b=0", simp) | |
| 490 | apply (simp add: right_inverse_eq) | |
| 491 | done | |
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 492 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 493 | lemma one_eq_divide_iff [simp]: | 
| 36409 | 494 | "1 = a / b \<longleftrightarrow> b \<noteq> 0 \<and> a = b" | 
| 495 | by (simp add: eq_commute [of 1]) | |
| 496 | ||
| 65057 
799bbbb3a395
Some new lemmas thanks to Lukas Bulwahn. Also, NEWS.
 paulson <lp15@cam.ac.uk> parents: 
64591diff
changeset | 497 | lemma divide_eq_minus_1_iff: | 
| 
799bbbb3a395
Some new lemmas thanks to Lukas Bulwahn. Also, NEWS.
 paulson <lp15@cam.ac.uk> parents: 
64591diff
changeset | 498 | "(a / b = - 1) \<longleftrightarrow> b \<noteq> 0 \<and> a = - b" | 
| 
799bbbb3a395
Some new lemmas thanks to Lukas Bulwahn. Also, NEWS.
 paulson <lp15@cam.ac.uk> parents: 
64591diff
changeset | 499 | using divide_eq_1_iff by fastforce | 
| 
799bbbb3a395
Some new lemmas thanks to Lukas Bulwahn. Also, NEWS.
 paulson <lp15@cam.ac.uk> parents: 
64591diff
changeset | 500 | |
| 36719 | 501 | lemma times_divide_times_eq: | 
| 502 | "(x / y) * (z / w) = (x * z) / (y * w)" | |
| 503 | by simp | |
| 504 | ||
| 505 | lemma add_frac_num: | |
| 506 | "y \<noteq> 0 \<Longrightarrow> x / y + z = (x + z * y) / y" | |
| 507 | by (simp add: add_divide_distrib) | |
| 508 | ||
| 509 | lemma add_num_frac: | |
| 510 | "y \<noteq> 0 \<Longrightarrow> z + x / y = (x + z * y) / y" | |
| 511 | by (simp add: add_divide_distrib add.commute) | |
| 512 | ||
| 64591 
240a39af9ec4
restructured matter on polynomials and normalized fractions
 haftmann parents: 
64329diff
changeset | 513 | lemma dvd_field_iff: | 
| 
240a39af9ec4
restructured matter on polynomials and normalized fractions
 haftmann parents: 
64329diff
changeset | 514 | "a dvd b \<longleftrightarrow> (a = 0 \<longrightarrow> b = 0)" | 
| 
240a39af9ec4
restructured matter on polynomials and normalized fractions
 haftmann parents: 
64329diff
changeset | 515 | proof (cases "a = 0") | 
| 
240a39af9ec4
restructured matter on polynomials and normalized fractions
 haftmann parents: 
64329diff
changeset | 516 | case True | 
| 
240a39af9ec4
restructured matter on polynomials and normalized fractions
 haftmann parents: 
64329diff
changeset | 517 | then show ?thesis | 
| 
240a39af9ec4
restructured matter on polynomials and normalized fractions
 haftmann parents: 
64329diff
changeset | 518 | by simp | 
| 
240a39af9ec4
restructured matter on polynomials and normalized fractions
 haftmann parents: 
64329diff
changeset | 519 | next | 
| 
240a39af9ec4
restructured matter on polynomials and normalized fractions
 haftmann parents: 
64329diff
changeset | 520 | case False | 
| 
240a39af9ec4
restructured matter on polynomials and normalized fractions
 haftmann parents: 
64329diff
changeset | 521 | then have "b = a * (b / a)" | 
| 
240a39af9ec4
restructured matter on polynomials and normalized fractions
 haftmann parents: 
64329diff
changeset | 522 | by (simp add: field_simps) | 
| 
240a39af9ec4
restructured matter on polynomials and normalized fractions
 haftmann parents: 
64329diff
changeset | 523 | then have "a dvd b" .. | 
| 
240a39af9ec4
restructured matter on polynomials and normalized fractions
 haftmann parents: 
64329diff
changeset | 524 | with False show ?thesis | 
| 
240a39af9ec4
restructured matter on polynomials and normalized fractions
 haftmann parents: 
64329diff
changeset | 525 | by simp | 
| 
240a39af9ec4
restructured matter on polynomials and normalized fractions
 haftmann parents: 
64329diff
changeset | 526 | qed | 
| 
240a39af9ec4
restructured matter on polynomials and normalized fractions
 haftmann parents: 
64329diff
changeset | 527 | |
| 36409 | 528 | end | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 529 | |
| 62481 
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
 haftmann parents: 
62347diff
changeset | 530 | class field_char_0 = field + ring_char_0 | 
| 
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
 haftmann parents: 
62347diff
changeset | 531 | |
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 532 | |
| 60758 | 533 | subsection \<open>Ordered fields\<close> | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 534 | |
| 64290 | 535 | class field_abs_sgn = field + idom_abs_sgn | 
| 536 | begin | |
| 537 | ||
| 538 | lemma sgn_inverse [simp]: | |
| 539 | "sgn (inverse a) = inverse (sgn a)" | |
| 540 | proof (cases "a = 0") | |
| 541 | case True then show ?thesis by simp | |
| 542 | next | |
| 543 | case False | |
| 544 | then have "a * inverse a = 1" | |
| 545 | by simp | |
| 546 | then have "sgn (a * inverse a) = sgn 1" | |
| 547 | by simp | |
| 548 | then have "sgn a * sgn (inverse a) = 1" | |
| 549 | by (simp add: sgn_mult) | |
| 550 | then have "inverse (sgn a) * (sgn a * sgn (inverse a)) = inverse (sgn a) * 1" | |
| 551 | by simp | |
| 552 | then have "(inverse (sgn a) * sgn a) * sgn (inverse a) = inverse (sgn a)" | |
| 553 | by (simp add: ac_simps) | |
| 554 | with False show ?thesis | |
| 555 | by (simp add: sgn_eq_0_iff) | |
| 556 | qed | |
| 557 | ||
| 558 | lemma abs_inverse [simp]: | |
| 559 | "\<bar>inverse a\<bar> = inverse \<bar>a\<bar>" | |
| 560 | proof - | |
| 561 | from sgn_mult_abs [of "inverse a"] sgn_mult_abs [of a] | |
| 562 | have "inverse (sgn a) * \<bar>inverse a\<bar> = inverse (sgn a * \<bar>a\<bar>)" | |
| 563 | by simp | |
| 564 | then show ?thesis by (auto simp add: sgn_eq_0_iff) | |
| 565 | qed | |
| 566 | ||
| 567 | lemma sgn_divide [simp]: | |
| 568 | "sgn (a / b) = sgn a / sgn b" | |
| 569 | unfolding divide_inverse sgn_mult by simp | |
| 570 | ||
| 571 | lemma abs_divide [simp]: | |
| 572 | "\<bar>a / b\<bar> = \<bar>a\<bar> / \<bar>b\<bar>" | |
| 573 | unfolding divide_inverse abs_mult by simp | |
| 574 | ||
| 575 | end | |
| 576 | ||
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 577 | class linordered_field = field + linordered_idom | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 578 | begin | 
| 14268 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
 paulson parents: 
14267diff
changeset | 579 | |
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 580 | lemma positive_imp_inverse_positive: | 
| 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 581 | assumes a_gt_0: "0 < a" | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 582 | shows "0 < inverse a" | 
| 23482 | 583 | proof - | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 584 | have "0 < a * inverse a" | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 585 | by (simp add: a_gt_0 [THEN less_imp_not_eq2]) | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 586 | thus "0 < inverse a" | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 587 | by (simp add: a_gt_0 [THEN less_not_sym] zero_less_mult_iff) | 
| 23482 | 588 | qed | 
| 14268 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
 paulson parents: 
14267diff
changeset | 589 | |
| 14277 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
 paulson parents: 
14272diff
changeset | 590 | lemma negative_imp_inverse_negative: | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 591 | "a < 0 \<Longrightarrow> inverse a < 0" | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 592 | by (insert positive_imp_inverse_positive [of "-a"], | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 593 | simp add: nonzero_inverse_minus_eq less_imp_not_eq) | 
| 14268 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
 paulson parents: 
14267diff
changeset | 594 | |
| 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
 paulson parents: 
14267diff
changeset | 595 | lemma inverse_le_imp_le: | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 596 | assumes invle: "inverse a \<le> inverse b" and apos: "0 < a" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 597 | shows "b \<le> a" | 
| 23482 | 598 | proof (rule classical) | 
| 14268 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
 paulson parents: 
14267diff
changeset | 599 | assume "~ b \<le> a" | 
| 23482 | 600 | hence "a < b" by (simp add: linorder_not_le) | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 601 | hence bpos: "0 < b" by (blast intro: apos less_trans) | 
| 14268 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
 paulson parents: 
14267diff
changeset | 602 | hence "a * inverse a \<le> a * inverse b" | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 603 | by (simp add: apos invle less_imp_le mult_left_mono) | 
| 14268 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
 paulson parents: 
14267diff
changeset | 604 | hence "(a * inverse a) * b \<le> (a * inverse b) * b" | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 605 | by (simp add: bpos less_imp_le mult_right_mono) | 
| 57512 
cc97b347b301
reduced name variants for assoc and commute on plus and mult
 haftmann parents: 
56571diff
changeset | 606 | thus "b \<le> a" by (simp add: mult.assoc apos bpos less_imp_not_eq2) | 
| 23482 | 607 | qed | 
| 14268 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
 paulson parents: 
14267diff
changeset | 608 | |
| 14277 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
 paulson parents: 
14272diff
changeset | 609 | lemma inverse_positive_imp_positive: | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 610 | assumes inv_gt_0: "0 < inverse a" and nz: "a \<noteq> 0" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 611 | shows "0 < a" | 
| 23389 | 612 | proof - | 
| 14277 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
 paulson parents: 
14272diff
changeset | 613 | have "0 < inverse (inverse a)" | 
| 23389 | 614 | using inv_gt_0 by (rule positive_imp_inverse_positive) | 
| 14277 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
 paulson parents: 
14272diff
changeset | 615 | thus "0 < a" | 
| 23389 | 616 | using nz by (simp add: nonzero_inverse_inverse_eq) | 
| 617 | qed | |
| 14277 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
 paulson parents: 
14272diff
changeset | 618 | |
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 619 | lemma inverse_negative_imp_negative: | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 620 | assumes inv_less_0: "inverse a < 0" and nz: "a \<noteq> 0" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 621 | shows "a < 0" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 622 | proof - | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 623 | have "inverse (inverse a) < 0" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 624 | using inv_less_0 by (rule negative_imp_inverse_negative) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 625 | thus "a < 0" using nz by (simp add: nonzero_inverse_inverse_eq) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 626 | qed | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 627 | |
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 628 | lemma linordered_field_no_lb: | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 629 | "\<forall>x. \<exists>y. y < x" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 630 | proof | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 631 | fix x::'a | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 632 | have m1: "- (1::'a) < 0" by simp | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 633 | from add_strict_right_mono[OF m1, where c=x] | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 634 | have "(- 1) + x < x" by simp | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 635 | thus "\<exists>y. y < x" by blast | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 636 | qed | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 637 | |
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 638 | lemma linordered_field_no_ub: | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 639 | "\<forall> x. \<exists>y. y > x" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 640 | proof | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 641 | fix x::'a | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 642 | have m1: " (1::'a) > 0" by simp | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 643 | from add_strict_right_mono[OF m1, where c=x] | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 644 | have "1 + x > x" by simp | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 645 | thus "\<exists>y. y > x" by blast | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 646 | qed | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 647 | |
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 648 | lemma less_imp_inverse_less: | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 649 | assumes less: "a < b" and apos: "0 < a" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 650 | shows "inverse b < inverse a" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 651 | proof (rule ccontr) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 652 | assume "~ inverse b < inverse a" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 653 | hence "inverse a \<le> inverse b" by simp | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 654 | hence "~ (a < b)" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 655 | by (simp add: not_less inverse_le_imp_le [OF _ apos]) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 656 | thus False by (rule notE [OF _ less]) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 657 | qed | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 658 | |
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 659 | lemma inverse_less_imp_less: | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 660 | "inverse a < inverse b \<Longrightarrow> 0 < a \<Longrightarrow> b < a" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 661 | apply (simp add: less_le [of "inverse a"] less_le [of "b"]) | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 662 | apply (force dest!: inverse_le_imp_le nonzero_inverse_eq_imp_eq) | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 663 | done | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 664 | |
| 60758 | 665 | text\<open>Both premises are essential. Consider -1 and 1.\<close> | 
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 666 | lemma inverse_less_iff_less [simp]: | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 667 | "0 < a \<Longrightarrow> 0 < b \<Longrightarrow> inverse a < inverse b \<longleftrightarrow> b < a" | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 668 | by (blast intro: less_imp_inverse_less dest: inverse_less_imp_less) | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 669 | |
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 670 | lemma le_imp_inverse_le: | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 671 | "a \<le> b \<Longrightarrow> 0 < a \<Longrightarrow> inverse b \<le> inverse a" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 672 | by (force simp add: le_less less_imp_inverse_less) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 673 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 674 | lemma inverse_le_iff_le [simp]: | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 675 | "0 < a \<Longrightarrow> 0 < b \<Longrightarrow> inverse a \<le> inverse b \<longleftrightarrow> b \<le> a" | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 676 | by (blast intro: le_imp_inverse_le dest: inverse_le_imp_le) | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 677 | |
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 678 | |
| 60758 | 679 | text\<open>These results refer to both operands being negative. The opposite-sign | 
| 680 | case is trivial, since inverse preserves signs.\<close> | |
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 681 | lemma inverse_le_imp_le_neg: | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 682 | "inverse a \<le> inverse b \<Longrightarrow> b < 0 \<Longrightarrow> b \<le> a" | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 683 | apply (rule classical) | 
| 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 684 | apply (subgoal_tac "a < 0") | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 685 | prefer 2 apply force | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 686 | apply (insert inverse_le_imp_le [of "-b" "-a"]) | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 687 | apply (simp add: nonzero_inverse_minus_eq) | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 688 | done | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 689 | |
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 690 | lemma less_imp_inverse_less_neg: | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 691 | "a < b \<Longrightarrow> b < 0 \<Longrightarrow> inverse b < inverse a" | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 692 | apply (subgoal_tac "a < 0") | 
| 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 693 | prefer 2 apply (blast intro: less_trans) | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 694 | apply (insert less_imp_inverse_less [of "-b" "-a"]) | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 695 | apply (simp add: nonzero_inverse_minus_eq) | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 696 | done | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 697 | |
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 698 | lemma inverse_less_imp_less_neg: | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 699 | "inverse a < inverse b \<Longrightarrow> b < 0 \<Longrightarrow> b < a" | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 700 | apply (rule classical) | 
| 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 701 | apply (subgoal_tac "a < 0") | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 702 | prefer 2 | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 703 | apply force | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 704 | apply (insert inverse_less_imp_less [of "-b" "-a"]) | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 705 | apply (simp add: nonzero_inverse_minus_eq) | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 706 | done | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 707 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 708 | lemma inverse_less_iff_less_neg [simp]: | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 709 | "a < 0 \<Longrightarrow> b < 0 \<Longrightarrow> inverse a < inverse b \<longleftrightarrow> b < a" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 710 | apply (insert inverse_less_iff_less [of "-b" "-a"]) | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 711 | apply (simp del: inverse_less_iff_less | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 712 | add: nonzero_inverse_minus_eq) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 713 | done | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 714 | |
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 715 | lemma le_imp_inverse_le_neg: | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 716 | "a \<le> b \<Longrightarrow> b < 0 ==> inverse b \<le> inverse a" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 717 | by (force simp add: le_less less_imp_inverse_less_neg) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 718 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 719 | lemma inverse_le_iff_le_neg [simp]: | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 720 | "a < 0 \<Longrightarrow> b < 0 \<Longrightarrow> inverse a \<le> inverse b \<longleftrightarrow> b \<le> a" | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 721 | by (blast intro: le_imp_inverse_le_neg dest: inverse_le_imp_le_neg) | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 722 | |
| 36774 | 723 | lemma one_less_inverse: | 
| 724 | "0 < a \<Longrightarrow> a < 1 \<Longrightarrow> 1 < inverse a" | |
| 725 | using less_imp_inverse_less [of a 1, unfolded inverse_1] . | |
| 726 | ||
| 727 | lemma one_le_inverse: | |
| 728 | "0 < a \<Longrightarrow> a \<le> 1 \<Longrightarrow> 1 \<le> inverse a" | |
| 729 | using le_imp_inverse_le [of a 1, unfolded inverse_1] . | |
| 730 | ||
| 59546 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 731 | lemma pos_le_divide_eq [field_simps]: | 
| 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 732 | assumes "0 < c" | 
| 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 733 | shows "a \<le> b / c \<longleftrightarrow> a * c \<le> b" | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 734 | proof - | 
| 59546 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 735 | from assms have "a \<le> b / c \<longleftrightarrow> a * c \<le> (b / c) * c" | 
| 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 736 | using mult_le_cancel_right [of a c "b * inverse c"] by (auto simp add: field_simps) | 
| 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 737 | also have "... \<longleftrightarrow> a * c \<le> b" | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 738 | by (simp add: less_imp_not_eq2 [OF assms] divide_inverse mult.assoc) | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 739 | finally show ?thesis . | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 740 | qed | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 741 | |
| 59546 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 742 | lemma pos_less_divide_eq [field_simps]: | 
| 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 743 | assumes "0 < c" | 
| 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 744 | shows "a < b / c \<longleftrightarrow> a * c < b" | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 745 | proof - | 
| 59546 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 746 | from assms have "a < b / c \<longleftrightarrow> a * c < (b / c) * c" | 
| 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 747 | using mult_less_cancel_right [of a c "b / c"] by auto | 
| 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 748 | also have "... = (a*c < b)" | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 749 | by (simp add: less_imp_not_eq2 [OF assms] divide_inverse mult.assoc) | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 750 | finally show ?thesis . | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 751 | qed | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 752 | |
| 59546 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 753 | lemma neg_less_divide_eq [field_simps]: | 
| 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 754 | assumes "c < 0" | 
| 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 755 | shows "a < b / c \<longleftrightarrow> b < a * c" | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 756 | proof - | 
| 59546 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 757 | from assms have "a < b / c \<longleftrightarrow> (b / c) * c < a * c" | 
| 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 758 | using mult_less_cancel_right [of "b / c" c a] by auto | 
| 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 759 | also have "... \<longleftrightarrow> b < a * c" | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 760 | by (simp add: less_imp_not_eq [OF assms] divide_inverse mult.assoc) | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 761 | finally show ?thesis . | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 762 | qed | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 763 | |
| 59546 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 764 | lemma neg_le_divide_eq [field_simps]: | 
| 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 765 | assumes "c < 0" | 
| 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 766 | shows "a \<le> b / c \<longleftrightarrow> b \<le> a * c" | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 767 | proof - | 
| 59546 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 768 | from assms have "a \<le> b / c \<longleftrightarrow> (b / c) * c \<le> a * c" | 
| 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 769 | using mult_le_cancel_right [of "b * inverse c" c a] by (auto simp add: field_simps) | 
| 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 770 | also have "... \<longleftrightarrow> b \<le> a * c" | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 771 | by (simp add: less_imp_not_eq [OF assms] divide_inverse mult.assoc) | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 772 | finally show ?thesis . | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 773 | qed | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 774 | |
| 59546 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 775 | lemma pos_divide_le_eq [field_simps]: | 
| 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 776 | assumes "0 < c" | 
| 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 777 | shows "b / c \<le> a \<longleftrightarrow> b \<le> a * c" | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 778 | proof - | 
| 59546 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 779 | from assms have "b / c \<le> a \<longleftrightarrow> (b / c) * c \<le> a * c" | 
| 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 780 | using mult_le_cancel_right [of "b / c" c a] by auto | 
| 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 781 | also have "... \<longleftrightarrow> b \<le> a * c" | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 782 | by (simp add: less_imp_not_eq2 [OF assms] divide_inverse mult.assoc) | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 783 | finally show ?thesis . | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 784 | qed | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 785 | |
| 59546 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 786 | lemma pos_divide_less_eq [field_simps]: | 
| 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 787 | assumes "0 < c" | 
| 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 788 | shows "b / c < a \<longleftrightarrow> b < a * c" | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 789 | proof - | 
| 59546 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 790 | from assms have "b / c < a \<longleftrightarrow> (b / c) * c < a * c" | 
| 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 791 | using mult_less_cancel_right [of "b / c" c a] by auto | 
| 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 792 | also have "... \<longleftrightarrow> b < a * c" | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 793 | by (simp add: less_imp_not_eq2 [OF assms] divide_inverse mult.assoc) | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 794 | finally show ?thesis . | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 795 | qed | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 796 | |
| 59546 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 797 | lemma neg_divide_le_eq [field_simps]: | 
| 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 798 | assumes "c < 0" | 
| 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 799 | shows "b / c \<le> a \<longleftrightarrow> a * c \<le> b" | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 800 | proof - | 
| 59546 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 801 | from assms have "b / c \<le> a \<longleftrightarrow> a * c \<le> (b / c) * c" | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 802 | using mult_le_cancel_right [of a c "b / c"] by auto | 
| 59546 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 803 | also have "... \<longleftrightarrow> a * c \<le> b" | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 804 | by (simp add: less_imp_not_eq [OF assms] divide_inverse mult.assoc) | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 805 | finally show ?thesis . | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 806 | qed | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 807 | |
| 59546 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 808 | lemma neg_divide_less_eq [field_simps]: | 
| 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 809 | assumes "c < 0" | 
| 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 810 | shows "b / c < a \<longleftrightarrow> a * c < b" | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 811 | proof - | 
| 59546 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 812 | from assms have "b / c < a \<longleftrightarrow> a * c < b / c * c" | 
| 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 813 | using mult_less_cancel_right [of a c "b / c"] by auto | 
| 
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
 haftmann parents: 
59535diff
changeset | 814 | also have "... \<longleftrightarrow> a * c < b" | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 815 | by (simp add: less_imp_not_eq [OF assms] divide_inverse mult.assoc) | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 816 | finally show ?thesis . | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 817 | qed | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 818 | |
| 61799 | 819 | text\<open>The following \<open>field_simps\<close> rules are necessary, as minus is always moved atop of | 
| 60758 | 820 | division but we want to get rid of division.\<close> | 
| 56480 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 821 | |
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 822 | lemma pos_le_minus_divide_eq [field_simps]: "0 < c \<Longrightarrow> a \<le> - (b / c) \<longleftrightarrow> a * c \<le> - b" | 
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 823 | unfolding minus_divide_left by (rule pos_le_divide_eq) | 
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 824 | |
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 825 | lemma neg_le_minus_divide_eq [field_simps]: "c < 0 \<Longrightarrow> a \<le> - (b / c) \<longleftrightarrow> - b \<le> a * c" | 
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 826 | unfolding minus_divide_left by (rule neg_le_divide_eq) | 
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 827 | |
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 828 | lemma pos_less_minus_divide_eq [field_simps]: "0 < c \<Longrightarrow> a < - (b / c) \<longleftrightarrow> a * c < - b" | 
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 829 | unfolding minus_divide_left by (rule pos_less_divide_eq) | 
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 830 | |
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 831 | lemma neg_less_minus_divide_eq [field_simps]: "c < 0 \<Longrightarrow> a < - (b / c) \<longleftrightarrow> - b < a * c" | 
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 832 | unfolding minus_divide_left by (rule neg_less_divide_eq) | 
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 833 | |
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 834 | lemma pos_minus_divide_less_eq [field_simps]: "0 < c \<Longrightarrow> - (b / c) < a \<longleftrightarrow> - b < a * c" | 
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 835 | unfolding minus_divide_left by (rule pos_divide_less_eq) | 
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 836 | |
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 837 | lemma neg_minus_divide_less_eq [field_simps]: "c < 0 \<Longrightarrow> - (b / c) < a \<longleftrightarrow> a * c < - b" | 
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 838 | unfolding minus_divide_left by (rule neg_divide_less_eq) | 
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 839 | |
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 840 | lemma pos_minus_divide_le_eq [field_simps]: "0 < c \<Longrightarrow> - (b / c) \<le> a \<longleftrightarrow> - b \<le> a * c" | 
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 841 | unfolding minus_divide_left by (rule pos_divide_le_eq) | 
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 842 | |
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 843 | lemma neg_minus_divide_le_eq [field_simps]: "c < 0 \<Longrightarrow> - (b / c) \<le> a \<longleftrightarrow> a * c \<le> - b" | 
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 844 | unfolding minus_divide_left by (rule neg_divide_le_eq) | 
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 845 | |
| 56365 
713f9b9a7e51
New theorems for extracting quotients
 paulson <lp15@cam.ac.uk> parents: 
55718diff
changeset | 846 | lemma frac_less_eq: | 
| 
713f9b9a7e51
New theorems for extracting quotients
 paulson <lp15@cam.ac.uk> parents: 
55718diff
changeset | 847 | "y \<noteq> 0 \<Longrightarrow> z \<noteq> 0 \<Longrightarrow> x / y < w / z \<longleftrightarrow> (x * z - w * y) / (y * z) < 0" | 
| 
713f9b9a7e51
New theorems for extracting quotients
 paulson <lp15@cam.ac.uk> parents: 
55718diff
changeset | 848 | by (subst less_iff_diff_less_0) (simp add: diff_frac_eq ) | 
| 
713f9b9a7e51
New theorems for extracting quotients
 paulson <lp15@cam.ac.uk> parents: 
55718diff
changeset | 849 | |
| 
713f9b9a7e51
New theorems for extracting quotients
 paulson <lp15@cam.ac.uk> parents: 
55718diff
changeset | 850 | lemma frac_le_eq: | 
| 
713f9b9a7e51
New theorems for extracting quotients
 paulson <lp15@cam.ac.uk> parents: 
55718diff
changeset | 851 | "y \<noteq> 0 \<Longrightarrow> z \<noteq> 0 \<Longrightarrow> x / y \<le> w / z \<longleftrightarrow> (x * z - w * y) / (y * z) \<le> 0" | 
| 
713f9b9a7e51
New theorems for extracting quotients
 paulson <lp15@cam.ac.uk> parents: 
55718diff
changeset | 852 | by (subst le_iff_diff_le_0) (simp add: diff_frac_eq ) | 
| 
713f9b9a7e51
New theorems for extracting quotients
 paulson <lp15@cam.ac.uk> parents: 
55718diff
changeset | 853 | |
| 61799 | 854 | text\<open>Lemmas \<open>sign_simps\<close> is a first attempt to automate proofs | 
| 855 | of positivity/negativity needed for \<open>field_simps\<close>. Have not added \<open>sign_simps\<close> to \<open>field_simps\<close> because the former can lead to case | |
| 60758 | 856 | explosions.\<close> | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 857 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 858 | lemmas sign_simps = algebra_simps zero_less_mult_iff mult_less_0_iff | 
| 36348 
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
 haftmann parents: 
36343diff
changeset | 859 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 860 | lemmas (in -) sign_simps = algebra_simps zero_less_mult_iff mult_less_0_iff | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 861 | |
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 862 | (* Only works once linear arithmetic is installed: | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 863 | text{*An example:*}
 | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 864 | lemma fixes a b c d e f :: "'a::linordered_field" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 865 | shows "\<lbrakk>a>b; c<d; e<f; 0 < u \<rbrakk> \<Longrightarrow> | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 866 | ((a-b)*(c-d)*(e-f))/((c-d)*(e-f)*(a-b)) < | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 867 | ((e-f)*(a-b)*(c-d))/((e-f)*(a-b)*(c-d)) + u" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 868 | apply(subgoal_tac "(c-d)*(e-f)*(a-b) > 0") | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 869 | prefer 2 apply(simp add:sign_simps) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 870 | apply(subgoal_tac "(c-d)*(e-f)*(a-b)*u > 0") | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 871 | prefer 2 apply(simp add:sign_simps) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 872 | apply(simp add:field_simps) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 873 | done | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 874 | *) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 875 | |
| 56541 | 876 | lemma divide_pos_pos[simp]: | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 877 | "0 < x ==> 0 < y ==> 0 < x / y" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 878 | by(simp add:field_simps) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 879 | |
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 880 | lemma divide_nonneg_pos: | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 881 | "0 <= x ==> 0 < y ==> 0 <= x / y" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 882 | by(simp add:field_simps) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 883 | |
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 884 | lemma divide_neg_pos: | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 885 | "x < 0 ==> 0 < y ==> x / y < 0" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 886 | by(simp add:field_simps) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 887 | |
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 888 | lemma divide_nonpos_pos: | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 889 | "x <= 0 ==> 0 < y ==> x / y <= 0" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 890 | by(simp add:field_simps) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 891 | |
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 892 | lemma divide_pos_neg: | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 893 | "0 < x ==> y < 0 ==> x / y < 0" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 894 | by(simp add:field_simps) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 895 | |
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 896 | lemma divide_nonneg_neg: | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 897 | "0 <= x ==> y < 0 ==> x / y <= 0" | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 898 | by(simp add:field_simps) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 899 | |
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 900 | lemma divide_neg_neg: | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 901 | "x < 0 ==> y < 0 ==> 0 < x / y" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 902 | by(simp add:field_simps) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 903 | |
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 904 | lemma divide_nonpos_neg: | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 905 | "x <= 0 ==> y < 0 ==> 0 <= x / y" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 906 | by(simp add:field_simps) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 907 | |
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 908 | lemma divide_strict_right_mono: | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 909 | "[|a < b; 0 < c|] ==> a / c < b / c" | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 910 | by (simp add: less_imp_not_eq2 divide_inverse mult_strict_right_mono | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 911 | positive_imp_inverse_positive) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 912 | |
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 913 | |
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 914 | lemma divide_strict_right_mono_neg: | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 915 | "[|b < a; c < 0|] ==> a / c < b / c" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 916 | apply (drule divide_strict_right_mono [of _ _ "-c"], simp) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 917 | apply (simp add: less_imp_not_eq nonzero_minus_divide_right [symmetric]) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 918 | done | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 919 | |
| 60758 | 920 | text\<open>The last premise ensures that @{term a} and @{term b}
 | 
| 921 | have the same sign\<close> | |
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 922 | lemma divide_strict_left_mono: | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 923 | "[|b < a; 0 < c; 0 < a*b|] ==> c / a < c / b" | 
| 44921 | 924 | by (auto simp: field_simps zero_less_mult_iff mult_strict_right_mono) | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 925 | |
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 926 | lemma divide_left_mono: | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 927 | "[|b \<le> a; 0 \<le> c; 0 < a*b|] ==> c / a \<le> c / b" | 
| 44921 | 928 | by (auto simp: field_simps zero_less_mult_iff mult_right_mono) | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 929 | |
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 930 | lemma divide_strict_left_mono_neg: | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 931 | "[|a < b; c < 0; 0 < a*b|] ==> c / a < c / b" | 
| 44921 | 932 | by (auto simp: field_simps zero_less_mult_iff mult_strict_right_mono_neg) | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 933 | |
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 934 | lemma mult_imp_div_pos_le: "0 < y ==> x <= z * y ==> | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 935 | x / y <= z" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 936 | by (subst pos_divide_le_eq, assumption+) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 937 | |
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 938 | lemma mult_imp_le_div_pos: "0 < y ==> z * y <= x ==> | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 939 | z <= x / y" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 940 | by(simp add:field_simps) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 941 | |
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 942 | lemma mult_imp_div_pos_less: "0 < y ==> x < z * y ==> | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 943 | x / y < z" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 944 | by(simp add:field_simps) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 945 | |
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 946 | lemma mult_imp_less_div_pos: "0 < y ==> z * y < x ==> | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 947 | z < x / y" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 948 | by(simp add:field_simps) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 949 | |
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 950 | lemma frac_le: "0 <= x ==> | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 951 | x <= y ==> 0 < w ==> w <= z ==> x / z <= y / w" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 952 | apply (rule mult_imp_div_pos_le) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 953 | apply simp | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 954 | apply (subst times_divide_eq_left) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 955 | apply (rule mult_imp_le_div_pos, assumption) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 956 | apply (rule mult_mono) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 957 | apply simp_all | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 958 | done | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 959 | |
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 960 | lemma frac_less: "0 <= x ==> | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 961 | x < y ==> 0 < w ==> w <= z ==> x / z < y / w" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 962 | apply (rule mult_imp_div_pos_less) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 963 | apply simp | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 964 | apply (subst times_divide_eq_left) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 965 | apply (rule mult_imp_less_div_pos, assumption) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 966 | apply (erule mult_less_le_imp_less) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 967 | apply simp_all | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 968 | done | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 969 | |
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 970 | lemma frac_less2: "0 < x ==> | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 971 | x <= y ==> 0 < w ==> w < z ==> x / z < y / w" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 972 | apply (rule mult_imp_div_pos_less) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 973 | apply simp_all | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 974 | apply (rule mult_imp_less_div_pos, assumption) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 975 | apply (erule mult_le_less_imp_less) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 976 | apply simp_all | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 977 | done | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 978 | |
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 979 | lemma less_half_sum: "a < b ==> a < (a+b) / (1+1)" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 980 | by (simp add: field_simps zero_less_two) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 981 | |
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 982 | lemma gt_half_sum: "a < b ==> (a+b)/(1+1) < b" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 983 | by (simp add: field_simps zero_less_two) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 984 | |
| 53215 
5e47c31c6f7c
renamed typeclass dense_linorder to unbounded_dense_linorder
 hoelzl parents: 
52435diff
changeset | 985 | subclass unbounded_dense_linorder | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 986 | proof | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 987 | fix x y :: 'a | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 988 | from less_add_one show "\<exists>y. x < y" .. | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 989 | from less_add_one have "x + (- 1) < (x + 1) + (- 1)" by (rule add_strict_right_mono) | 
| 54230 
b1d955791529
more simplification rules on unary and binary minus
 haftmann parents: 
54147diff
changeset | 990 | then have "x - 1 < x + 1 - 1" by simp | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 991 | then have "x - 1 < x" by (simp add: algebra_simps) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 992 | then show "\<exists>y. y < x" .. | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 993 | show "x < y \<Longrightarrow> \<exists>z>x. z < y" by (blast intro!: less_half_sum gt_half_sum) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 994 | qed | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 995 | |
| 64290 | 996 | subclass field_abs_sgn .. | 
| 997 | ||
| 64329 | 998 | lemma inverse_sgn [simp]: | 
| 999 | "inverse (sgn a) = sgn a" | |
| 1000 | by (cases a 0 rule: linorder_cases) simp_all | |
| 1001 | ||
| 1002 | lemma divide_sgn [simp]: | |
| 1003 | "a / sgn b = a * sgn b" | |
| 1004 | by (cases b 0 rule: linorder_cases) simp_all | |
| 1005 | ||
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 1006 | lemma nonzero_abs_inverse: | 
| 64290 | 1007 | "a \<noteq> 0 ==> \<bar>inverse a\<bar> = inverse \<bar>a\<bar>" | 
| 1008 | by (rule abs_inverse) | |
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 1009 | |
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 1010 | lemma nonzero_abs_divide: | 
| 64290 | 1011 | "b \<noteq> 0 ==> \<bar>a / b\<bar> = \<bar>a\<bar> / \<bar>b\<bar>" | 
| 1012 | by (rule abs_divide) | |
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 1013 | |
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 1014 | lemma field_le_epsilon: | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 1015 | assumes e: "\<And>e. 0 < e \<Longrightarrow> x \<le> y + e" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 1016 | shows "x \<le> y" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 1017 | proof (rule dense_le) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 1018 | fix t assume "t < x" | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 1019 | hence "0 < x - t" by (simp add: less_diff_eq) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 1020 | from e [OF this] have "x + 0 \<le> x + (y - t)" by (simp add: algebra_simps) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 1021 | then have "0 \<le> y - t" by (simp only: add_le_cancel_left) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 1022 | then show "t \<le> y" by (simp add: algebra_simps) | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 1023 | qed | 
| 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 1024 | |
| 14277 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
 paulson parents: 
14272diff
changeset | 1025 | lemma inverse_positive_iff_positive [simp]: | 
| 36409 | 1026 | "(0 < inverse a) = (0 < a)" | 
| 21328 | 1027 | apply (cases "a = 0", simp) | 
| 14277 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
 paulson parents: 
14272diff
changeset | 1028 | apply (blast intro: inverse_positive_imp_positive positive_imp_inverse_positive) | 
| 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
 paulson parents: 
14272diff
changeset | 1029 | done | 
| 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
 paulson parents: 
14272diff
changeset | 1030 | |
| 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
 paulson parents: 
14272diff
changeset | 1031 | lemma inverse_negative_iff_negative [simp]: | 
| 36409 | 1032 | "(inverse a < 0) = (a < 0)" | 
| 21328 | 1033 | apply (cases "a = 0", simp) | 
| 14277 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
 paulson parents: 
14272diff
changeset | 1034 | apply (blast intro: inverse_negative_imp_negative negative_imp_inverse_negative) | 
| 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
 paulson parents: 
14272diff
changeset | 1035 | done | 
| 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
 paulson parents: 
14272diff
changeset | 1036 | |
| 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
 paulson parents: 
14272diff
changeset | 1037 | lemma inverse_nonnegative_iff_nonnegative [simp]: | 
| 36409 | 1038 | "0 \<le> inverse a \<longleftrightarrow> 0 \<le> a" | 
| 1039 | by (simp add: not_less [symmetric]) | |
| 14277 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
 paulson parents: 
14272diff
changeset | 1040 | |
| 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
 paulson parents: 
14272diff
changeset | 1041 | lemma inverse_nonpositive_iff_nonpositive [simp]: | 
| 36409 | 1042 | "inverse a \<le> 0 \<longleftrightarrow> a \<le> 0" | 
| 1043 | by (simp add: not_less [symmetric]) | |
| 14277 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
 paulson parents: 
14272diff
changeset | 1044 | |
| 56480 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 1045 | lemma one_less_inverse_iff: "1 < inverse x \<longleftrightarrow> 0 < x \<and> x < 1" | 
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 1046 | using less_trans[of 1 x 0 for x] | 
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 1047 | by (cases x 0 rule: linorder_cases) (auto simp add: field_simps) | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14353diff
changeset | 1048 | |
| 56480 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 1049 | lemma one_le_inverse_iff: "1 \<le> inverse x \<longleftrightarrow> 0 < x \<and> x \<le> 1" | 
| 36409 | 1050 | proof (cases "x = 1") | 
| 1051 | case True then show ?thesis by simp | |
| 1052 | next | |
| 1053 | case False then have "inverse x \<noteq> 1" by simp | |
| 1054 | then have "1 \<noteq> inverse x" by blast | |
| 1055 | then have "1 \<le> inverse x \<longleftrightarrow> 1 < inverse x" by (simp add: le_less) | |
| 1056 | with False show ?thesis by (auto simp add: one_less_inverse_iff) | |
| 1057 | qed | |
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14353diff
changeset | 1058 | |
| 56480 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 1059 | lemma inverse_less_1_iff: "inverse x < 1 \<longleftrightarrow> x \<le> 0 \<or> 1 < x" | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 1060 | by (simp add: not_le [symmetric] one_le_inverse_iff) | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14353diff
changeset | 1061 | |
| 56480 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 1062 | lemma inverse_le_1_iff: "inverse x \<le> 1 \<longleftrightarrow> x \<le> 0 \<or> 1 \<le> x" | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 1063 | by (simp add: not_less [symmetric] one_less_inverse_iff) | 
| 14365 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
 paulson parents: 
14353diff
changeset | 1064 | |
| 56481 | 1065 | lemma [divide_simps]: | 
| 56480 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 1066 | shows le_divide_eq: "a \<le> b / c \<longleftrightarrow> (if 0 < c then a * c \<le> b else if c < 0 then b \<le> a * c else a \<le> 0)" | 
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 1067 | and divide_le_eq: "b / c \<le> a \<longleftrightarrow> (if 0 < c then b \<le> a * c else if c < 0 then a * c \<le> b else 0 \<le> a)" | 
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 1068 | and less_divide_eq: "a < b / c \<longleftrightarrow> (if 0 < c then a * c < b else if c < 0 then b < a * c else a < 0)" | 
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 1069 | and divide_less_eq: "b / c < a \<longleftrightarrow> (if 0 < c then b < a * c else if c < 0 then a * c < b else 0 < a)" | 
| 56481 | 1070 | and le_minus_divide_eq: "a \<le> - (b / c) \<longleftrightarrow> (if 0 < c then a * c \<le> - b else if c < 0 then - b \<le> a * c else a \<le> 0)" | 
| 1071 | and minus_divide_le_eq: "- (b / c) \<le> a \<longleftrightarrow> (if 0 < c then - b \<le> a * c else if c < 0 then a * c \<le> - b else 0 \<le> a)" | |
| 1072 | and less_minus_divide_eq: "a < - (b / c) \<longleftrightarrow> (if 0 < c then a * c < - b else if c < 0 then - b < a * c else a < 0)" | |
| 1073 | and minus_divide_less_eq: "- (b / c) < a \<longleftrightarrow> (if 0 < c then - b < a * c else if c < 0 then a * c < - b else 0 < a)" | |
| 56480 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 1074 | by (auto simp: field_simps not_less dest: antisym) | 
| 14288 | 1075 | |
| 60758 | 1076 | text \<open>Division and Signs\<close> | 
| 16775 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1077 | |
| 56480 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 1078 | lemma | 
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 1079 | shows zero_less_divide_iff: "0 < a / b \<longleftrightarrow> 0 < a \<and> 0 < b \<or> a < 0 \<and> b < 0" | 
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 1080 | and divide_less_0_iff: "a / b < 0 \<longleftrightarrow> 0 < a \<and> b < 0 \<or> a < 0 \<and> 0 < b" | 
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 1081 | and zero_le_divide_iff: "0 \<le> a / b \<longleftrightarrow> 0 \<le> a \<and> 0 \<le> b \<or> a \<le> 0 \<and> b \<le> 0" | 
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 1082 | and divide_le_0_iff: "a / b \<le> 0 \<longleftrightarrow> 0 \<le> a \<and> b \<le> 0 \<or> a \<le> 0 \<and> 0 \<le> b" | 
| 56481 | 1083 | by (auto simp add: divide_simps) | 
| 16775 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1084 | |
| 60758 | 1085 | text \<open>Division and the Number One\<close> | 
| 14353 
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
 paulson parents: 
14348diff
changeset | 1086 | |
| 60758 | 1087 | text\<open>Simplify expressions equated with 1\<close> | 
| 14353 
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
 paulson parents: 
14348diff
changeset | 1088 | |
| 56480 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 1089 | lemma zero_eq_1_divide_iff [simp]: "0 = 1 / a \<longleftrightarrow> a = 0" | 
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 1090 | by (cases "a = 0") (auto simp: field_simps) | 
| 14353 
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
 paulson parents: 
14348diff
changeset | 1091 | |
| 56480 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 1092 | lemma one_divide_eq_0_iff [simp]: "1 / a = 0 \<longleftrightarrow> a = 0" | 
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 1093 | using zero_eq_1_divide_iff[of a] by simp | 
| 14353 
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
 paulson parents: 
14348diff
changeset | 1094 | |
| 61799 | 1095 | text\<open>Simplify expressions such as \<open>0 < 1/x\<close> to \<open>0 < x\<close>\<close> | 
| 36423 | 1096 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 1097 | lemma zero_le_divide_1_iff [simp]: | 
| 36423 | 1098 | "0 \<le> 1 / a \<longleftrightarrow> 0 \<le> a" | 
| 1099 | by (simp add: zero_le_divide_iff) | |
| 17085 | 1100 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 1101 | lemma zero_less_divide_1_iff [simp]: | 
| 36423 | 1102 | "0 < 1 / a \<longleftrightarrow> 0 < a" | 
| 1103 | by (simp add: zero_less_divide_iff) | |
| 1104 | ||
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 1105 | lemma divide_le_0_1_iff [simp]: | 
| 36423 | 1106 | "1 / a \<le> 0 \<longleftrightarrow> a \<le> 0" | 
| 1107 | by (simp add: divide_le_0_iff) | |
| 1108 | ||
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 1109 | lemma divide_less_0_1_iff [simp]: | 
| 36423 | 1110 | "1 / a < 0 \<longleftrightarrow> a < 0" | 
| 1111 | by (simp add: divide_less_0_iff) | |
| 14353 
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
 paulson parents: 
14348diff
changeset | 1112 | |
| 14293 | 1113 | lemma divide_right_mono: | 
| 36409 | 1114 | "[|a \<le> b; 0 \<le> c|] ==> a/c \<le> b/c" | 
| 1115 | by (force simp add: divide_strict_right_mono le_less) | |
| 14293 | 1116 | |
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 1117 | lemma divide_right_mono_neg: "a <= b | 
| 16775 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1118 | ==> c <= 0 ==> b / c <= a / c" | 
| 23482 | 1119 | apply (drule divide_right_mono [of _ _ "- c"]) | 
| 56479 
91958d4b30f7
revert c1bbd3e22226, a14831ac3023, and 36489d77c484: divide_minus_left/right are again simp rules
 hoelzl parents: 
56445diff
changeset | 1120 | apply auto | 
| 16775 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1121 | done | 
| 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1122 | |
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 1123 | lemma divide_left_mono_neg: "a <= b | 
| 16775 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1124 | ==> c <= 0 ==> 0 < a * b ==> c / a <= c / b" | 
| 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1125 | apply (drule divide_left_mono [of _ _ "- c"]) | 
| 57512 
cc97b347b301
reduced name variants for assoc and commute on plus and mult
 haftmann parents: 
56571diff
changeset | 1126 | apply (auto simp add: mult.commute) | 
| 16775 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1127 | done | 
| 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1128 | |
| 56480 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 1129 | lemma inverse_le_iff: "inverse a \<le> inverse b \<longleftrightarrow> (0 < a * b \<longrightarrow> b \<le> a) \<and> (a * b \<le> 0 \<longrightarrow> a \<le> b)" | 
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 1130 | by (cases a 0 b 0 rule: linorder_cases[case_product linorder_cases]) | 
| 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 1131 | (auto simp add: field_simps zero_less_mult_iff mult_le_0_iff) | 
| 42904 | 1132 | |
| 56480 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 1133 | lemma inverse_less_iff: "inverse a < inverse b \<longleftrightarrow> (0 < a * b \<longrightarrow> b < a) \<and> (a * b \<le> 0 \<longrightarrow> a < b)" | 
| 42904 | 1134 | by (subst less_le) (auto simp: inverse_le_iff) | 
| 1135 | ||
| 56480 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 1136 | lemma divide_le_cancel: "a / c \<le> b / c \<longleftrightarrow> (0 < c \<longrightarrow> a \<le> b) \<and> (c < 0 \<longrightarrow> b \<le> a)" | 
| 42904 | 1137 | by (simp add: divide_inverse mult_le_cancel_right) | 
| 1138 | ||
| 56480 
093ea91498e6
field_simps: better support for negation and division, and power
 hoelzl parents: 
56479diff
changeset | 1139 | lemma divide_less_cancel: "a / c < b / c \<longleftrightarrow> (0 < c \<longrightarrow> a < b) \<and> (c < 0 \<longrightarrow> b < a) \<and> c \<noteq> 0" | 
| 42904 | 1140 | by (auto simp add: divide_inverse mult_less_cancel_right) | 
| 1141 | ||
| 60758 | 1142 | text\<open>Simplify quotients that are compared with the value 1.\<close> | 
| 16775 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1143 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 1144 | lemma le_divide_eq_1: | 
| 36409 | 1145 | "(1 \<le> b / a) = ((0 < a & a \<le> b) | (a < 0 & b \<le> a))" | 
| 16775 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1146 | by (auto simp add: le_divide_eq) | 
| 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1147 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 1148 | lemma divide_le_eq_1: | 
| 36409 | 1149 | "(b / a \<le> 1) = ((0 < a & b \<le> a) | (a < 0 & a \<le> b) | a=0)" | 
| 16775 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1150 | by (auto simp add: divide_le_eq) | 
| 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1151 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 1152 | lemma less_divide_eq_1: | 
| 36409 | 1153 | "(1 < b / a) = ((0 < a & a < b) | (a < 0 & b < a))" | 
| 16775 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1154 | by (auto simp add: less_divide_eq) | 
| 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1155 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 1156 | lemma divide_less_eq_1: | 
| 36409 | 1157 | "(b / a < 1) = ((0 < a & b < a) | (a < 0 & a < b) | a=0)" | 
| 16775 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1158 | by (auto simp add: divide_less_eq) | 
| 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1159 | |
| 56571 
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
 hoelzl parents: 
56541diff
changeset | 1160 | lemma divide_nonneg_nonneg [simp]: | 
| 
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
 hoelzl parents: 
56541diff
changeset | 1161 | "0 \<le> x \<Longrightarrow> 0 \<le> y \<Longrightarrow> 0 \<le> x / y" | 
| 
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
 hoelzl parents: 
56541diff
changeset | 1162 | by (auto simp add: divide_simps) | 
| 
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
 hoelzl parents: 
56541diff
changeset | 1163 | |
| 
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
 hoelzl parents: 
56541diff
changeset | 1164 | lemma divide_nonpos_nonpos: | 
| 
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
 hoelzl parents: 
56541diff
changeset | 1165 | "x \<le> 0 \<Longrightarrow> y \<le> 0 \<Longrightarrow> 0 \<le> x / y" | 
| 
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
 hoelzl parents: 
56541diff
changeset | 1166 | by (auto simp add: divide_simps) | 
| 
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
 hoelzl parents: 
56541diff
changeset | 1167 | |
| 
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
 hoelzl parents: 
56541diff
changeset | 1168 | lemma divide_nonneg_nonpos: | 
| 
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
 hoelzl parents: 
56541diff
changeset | 1169 | "0 \<le> x \<Longrightarrow> y \<le> 0 \<Longrightarrow> x / y \<le> 0" | 
| 
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
 hoelzl parents: 
56541diff
changeset | 1170 | by (auto simp add: divide_simps) | 
| 
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
 hoelzl parents: 
56541diff
changeset | 1171 | |
| 
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
 hoelzl parents: 
56541diff
changeset | 1172 | lemma divide_nonpos_nonneg: | 
| 
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
 hoelzl parents: 
56541diff
changeset | 1173 | "x \<le> 0 \<Longrightarrow> 0 \<le> y \<Longrightarrow> x / y \<le> 0" | 
| 
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
 hoelzl parents: 
56541diff
changeset | 1174 | by (auto simp add: divide_simps) | 
| 23389 | 1175 | |
| 60758 | 1176 | text \<open>Conditional Simplification Rules: No Case Splits\<close> | 
| 16775 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1177 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 1178 | lemma le_divide_eq_1_pos [simp]: | 
| 36409 | 1179 | "0 < a \<Longrightarrow> (1 \<le> b/a) = (a \<le> b)" | 
| 16775 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1180 | by (auto simp add: le_divide_eq) | 
| 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1181 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 1182 | lemma le_divide_eq_1_neg [simp]: | 
| 36409 | 1183 | "a < 0 \<Longrightarrow> (1 \<le> b/a) = (b \<le> a)" | 
| 16775 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1184 | by (auto simp add: le_divide_eq) | 
| 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1185 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 1186 | lemma divide_le_eq_1_pos [simp]: | 
| 36409 | 1187 | "0 < a \<Longrightarrow> (b/a \<le> 1) = (b \<le> a)" | 
| 16775 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1188 | by (auto simp add: divide_le_eq) | 
| 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1189 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 1190 | lemma divide_le_eq_1_neg [simp]: | 
| 36409 | 1191 | "a < 0 \<Longrightarrow> (b/a \<le> 1) = (a \<le> b)" | 
| 16775 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1192 | by (auto simp add: divide_le_eq) | 
| 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1193 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 1194 | lemma less_divide_eq_1_pos [simp]: | 
| 36409 | 1195 | "0 < a \<Longrightarrow> (1 < b/a) = (a < b)" | 
| 16775 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1196 | by (auto simp add: less_divide_eq) | 
| 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1197 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 1198 | lemma less_divide_eq_1_neg [simp]: | 
| 36409 | 1199 | "a < 0 \<Longrightarrow> (1 < b/a) = (b < a)" | 
| 16775 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1200 | by (auto simp add: less_divide_eq) | 
| 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1201 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 1202 | lemma divide_less_eq_1_pos [simp]: | 
| 36409 | 1203 | "0 < a \<Longrightarrow> (b/a < 1) = (b < a)" | 
| 18649 
bb99c2e705ca
tidied, and added missing thm divide_less_eq_1_neg
 paulson parents: 
18623diff
changeset | 1204 | by (auto simp add: divide_less_eq) | 
| 
bb99c2e705ca
tidied, and added missing thm divide_less_eq_1_neg
 paulson parents: 
18623diff
changeset | 1205 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 1206 | lemma divide_less_eq_1_neg [simp]: | 
| 61941 | 1207 | "a < 0 \<Longrightarrow> b/a < 1 \<longleftrightarrow> a < b" | 
| 16775 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1208 | by (auto simp add: divide_less_eq) | 
| 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1209 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 1210 | lemma eq_divide_eq_1 [simp]: | 
| 36409 | 1211 | "(1 = b/a) = ((a \<noteq> 0 & a = b))" | 
| 16775 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1212 | by (auto simp add: eq_divide_eq) | 
| 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1213 | |
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53374diff
changeset | 1214 | lemma divide_eq_eq_1 [simp]: | 
| 36409 | 1215 | "(b/a = 1) = ((a \<noteq> 0 & a = b))" | 
| 16775 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1216 | by (auto simp add: divide_eq_eq) | 
| 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1217 | |
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 1218 | lemma abs_div_pos: "0 < y ==> | 
| 36301 
72f4d079ebf8
more localization; factored out lemmas for division_ring
 haftmann parents: 
35828diff
changeset | 1219 | \<bar>x\<bar> / y = \<bar>x / y\<bar>" | 
| 25304 
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
 haftmann parents: 
25267diff
changeset | 1220 | apply (subst abs_divide) | 
| 
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
 haftmann parents: 
25267diff
changeset | 1221 | apply (simp add: order_less_imp_le) | 
| 
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
 haftmann parents: 
25267diff
changeset | 1222 | done | 
| 16775 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
 avigad parents: 
16568diff
changeset | 1223 | |
| 61944 | 1224 | lemma zero_le_divide_abs_iff [simp]: "(0 \<le> a / \<bar>b\<bar>) = (0 \<le> a | b = 0)" | 
| 55718 
34618f031ba9
A few lemmas about summations, etc.
 paulson <lp15@cam.ac.uk> parents: 
54230diff
changeset | 1225 | by (auto simp: zero_le_divide_iff) | 
| 
34618f031ba9
A few lemmas about summations, etc.
 paulson <lp15@cam.ac.uk> parents: 
54230diff
changeset | 1226 | |
| 61944 | 1227 | lemma divide_le_0_abs_iff [simp]: "(a / \<bar>b\<bar> \<le> 0) = (a \<le> 0 | b = 0)" | 
| 55718 
34618f031ba9
A few lemmas about summations, etc.
 paulson <lp15@cam.ac.uk> parents: 
54230diff
changeset | 1228 | by (auto simp: divide_le_0_iff) | 
| 
34618f031ba9
A few lemmas about summations, etc.
 paulson <lp15@cam.ac.uk> parents: 
54230diff
changeset | 1229 | |
| 35579 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35216diff
changeset | 1230 | lemma field_le_mult_one_interval: | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35216diff
changeset | 1231 | assumes *: "\<And>z. \<lbrakk> 0 < z ; z < 1 \<rbrakk> \<Longrightarrow> z * x \<le> y" | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35216diff
changeset | 1232 | shows "x \<le> y" | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35216diff
changeset | 1233 | proof (cases "0 < x") | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35216diff
changeset | 1234 | assume "0 < x" | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35216diff
changeset | 1235 | thus ?thesis | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35216diff
changeset | 1236 | using dense_le_bounded[of 0 1 "y/x"] * | 
| 60758 | 1237 | unfolding le_divide_eq if_P[OF \<open>0 < x\<close>] by simp | 
| 35579 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35216diff
changeset | 1238 | next | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35216diff
changeset | 1239 | assume "\<not>0 < x" hence "x \<le> 0" by simp | 
| 61076 | 1240 | obtain s::'a where s: "0 < s" "s < 1" using dense[of 0 "1::'a"] by auto | 
| 60758 | 1241 | hence "x \<le> s * x" using mult_le_cancel_right[of 1 x s] \<open>x \<le> 0\<close> by auto | 
| 35579 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35216diff
changeset | 1242 | also note *[OF s] | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35216diff
changeset | 1243 | finally show ?thesis . | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35216diff
changeset | 1244 | qed | 
| 35090 
88cc65ae046e
moved lemma field_le_epsilon from Real.thy to Fields.thy
 haftmann parents: 
35084diff
changeset | 1245 | |
| 63952 
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
 paulson <lp15@cam.ac.uk> parents: 
62481diff
changeset | 1246 | text\<open>For creating values between @{term u} and @{term v}.\<close>
 | 
| 
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
 paulson <lp15@cam.ac.uk> parents: 
62481diff
changeset | 1247 | lemma scaling_mono: | 
| 
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
 paulson <lp15@cam.ac.uk> parents: 
62481diff
changeset | 1248 | assumes "u \<le> v" "0 \<le> r" "r \<le> s" | 
| 
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
 paulson <lp15@cam.ac.uk> parents: 
62481diff
changeset | 1249 | shows "u + r * (v - u) / s \<le> v" | 
| 
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
 paulson <lp15@cam.ac.uk> parents: 
62481diff
changeset | 1250 | proof - | 
| 
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
 paulson <lp15@cam.ac.uk> parents: 
62481diff
changeset | 1251 | have "r/s \<le> 1" using assms | 
| 
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
 paulson <lp15@cam.ac.uk> parents: 
62481diff
changeset | 1252 | using divide_le_eq_1 by fastforce | 
| 
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
 paulson <lp15@cam.ac.uk> parents: 
62481diff
changeset | 1253 | then have "(r/s) * (v - u) \<le> 1 * (v - u)" | 
| 
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
 paulson <lp15@cam.ac.uk> parents: 
62481diff
changeset | 1254 | apply (rule mult_right_mono) | 
| 
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
 paulson <lp15@cam.ac.uk> parents: 
62481diff
changeset | 1255 | using assms by simp | 
| 
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
 paulson <lp15@cam.ac.uk> parents: 
62481diff
changeset | 1256 | then show ?thesis | 
| 
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
 paulson <lp15@cam.ac.uk> parents: 
62481diff
changeset | 1257 | by (simp add: field_simps) | 
| 
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
 paulson <lp15@cam.ac.uk> parents: 
62481diff
changeset | 1258 | qed | 
| 
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
 paulson <lp15@cam.ac.uk> parents: 
62481diff
changeset | 1259 | |
| 36409 | 1260 | end | 
| 1261 | ||
| 61238 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 1262 | text \<open>Min/max Simplification Rules\<close> | 
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 1263 | |
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 1264 | lemma min_mult_distrib_left: | 
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 1265 | fixes x::"'a::linordered_idom" | 
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 1266 | shows "p * min x y = (if 0 \<le> p then min (p*x) (p*y) else max (p*x) (p*y))" | 
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 1267 | by (auto simp add: min_def max_def mult_le_cancel_left) | 
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 1268 | |
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 1269 | lemma min_mult_distrib_right: | 
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 1270 | fixes x::"'a::linordered_idom" | 
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 1271 | shows "min x y * p = (if 0 \<le> p then min (x*p) (y*p) else max (x*p) (y*p))" | 
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 1272 | by (auto simp add: min_def max_def mult_le_cancel_right) | 
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 1273 | |
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 1274 | lemma min_divide_distrib_right: | 
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 1275 | fixes x::"'a::linordered_field" | 
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 1276 | shows "min x y / p = (if 0 \<le> p then min (x/p) (y/p) else max (x/p) (y/p))" | 
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 1277 | by (simp add: min_mult_distrib_right divide_inverse) | 
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 1278 | |
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 1279 | lemma max_mult_distrib_left: | 
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 1280 | fixes x::"'a::linordered_idom" | 
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 1281 | shows "p * max x y = (if 0 \<le> p then max (p*x) (p*y) else min (p*x) (p*y))" | 
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 1282 | by (auto simp add: min_def max_def mult_le_cancel_left) | 
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 1283 | |
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 1284 | lemma max_mult_distrib_right: | 
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 1285 | fixes x::"'a::linordered_idom" | 
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 1286 | shows "max x y * p = (if 0 \<le> p then max (x*p) (y*p) else min (x*p) (y*p))" | 
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 1287 | by (auto simp add: min_def max_def mult_le_cancel_right) | 
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 1288 | |
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 1289 | lemma max_divide_distrib_right: | 
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 1290 | fixes x::"'a::linordered_field" | 
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 1291 | shows "max x y / p = (if 0 \<le> p then max (x/p) (y/p) else min (x/p) (y/p))" | 
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 1292 | by (simp add: max_mult_distrib_right divide_inverse) | 
| 
e3d8a313a649
Useful facts about min/max, etc.
 paulson <lp15@cam.ac.uk> parents: 
61076diff
changeset | 1293 | |
| 59557 | 1294 | hide_fact (open) field_inverse field_divide_inverse field_inverse_zero | 
| 1295 | ||
| 52435 
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
 haftmann parents: 
44921diff
changeset | 1296 | code_identifier | 
| 
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
 haftmann parents: 
44921diff
changeset | 1297 | code_module Fields \<rightharpoonup> (SML) Arith and (OCaml) Arith and (Haskell) Arith | 
| 59667 
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
 paulson <lp15@cam.ac.uk> parents: 
59557diff
changeset | 1298 | |
| 14265 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
 paulson parents: diff
changeset | 1299 | end |