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