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