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