127 begin |
127 begin |
128 |
128 |
129 subclass division_ring_inverse_zero proof |
129 subclass division_ring_inverse_zero proof |
130 qed (fact field_inverse_zero) |
130 qed (fact field_inverse_zero) |
131 |
131 |
132 end |
|
133 |
|
134 text{*This version builds in division by zero while also re-orienting |
132 text{*This version builds in division by zero while also re-orienting |
135 the right-hand side.*} |
133 the right-hand side.*} |
136 lemma inverse_mult_distrib [simp]: |
134 lemma inverse_mult_distrib [simp]: |
137 "inverse(a*b) = inverse(a) * inverse(b::'a::{field,division_ring_inverse_zero})" |
135 "inverse (a * b) = inverse a * inverse b" |
138 proof cases |
136 proof cases |
139 assume "a \<noteq> 0 & b \<noteq> 0" |
137 assume "a \<noteq> 0 & b \<noteq> 0" |
140 thus ?thesis by (simp add: nonzero_inverse_mult_distrib mult_ac) |
138 thus ?thesis by (simp add: nonzero_inverse_mult_distrib mult_ac) |
141 next |
139 next |
142 assume "~ (a \<noteq> 0 & b \<noteq> 0)" |
140 assume "~ (a \<noteq> 0 & b \<noteq> 0)" |
143 thus ?thesis by force |
141 thus ?thesis by force |
144 qed |
142 qed |
145 |
143 |
146 lemma inverse_divide [simp]: |
144 lemma inverse_divide [simp]: |
147 "inverse (a/b) = b / (a::'a::{field,division_ring_inverse_zero})" |
145 "inverse (a / b) = b / a" |
148 by (simp add: divide_inverse mult_commute) |
146 by (simp add: divide_inverse mult_commute) |
149 |
147 |
150 |
148 |
151 text {* Calculations with fractions *} |
149 text {* Calculations with fractions *} |
152 |
150 |
153 text{* There is a whole bunch of simp-rules just for class @{text |
151 text{* There is a whole bunch of simp-rules just for class @{text |
154 field} but none for class @{text field} and @{text nonzero_divides} |
152 field} but none for class @{text field} and @{text nonzero_divides} |
155 because the latter are covered by a simproc. *} |
153 because the latter are covered by a simproc. *} |
156 |
154 |
157 lemma mult_divide_mult_cancel_left: |
155 lemma mult_divide_mult_cancel_left: |
158 "c\<noteq>0 ==> (c*a) / (c*b) = a / (b::'a::{field,division_ring_inverse_zero})" |
156 "c \<noteq> 0 \<Longrightarrow> (c * a) / (c * b) = a / b" |
159 apply (cases "b = 0") |
157 apply (cases "b = 0") |
160 apply simp_all |
158 apply simp_all |
161 done |
159 done |
162 |
160 |
163 lemma mult_divide_mult_cancel_right: |
161 lemma mult_divide_mult_cancel_right: |
164 "c\<noteq>0 ==> (a*c) / (b*c) = a / (b::'a::{field,division_ring_inverse_zero})" |
162 "c \<noteq> 0 \<Longrightarrow> (a * c) / (b * c) = a / b" |
165 apply (cases "b = 0") |
163 apply (cases "b = 0") |
166 apply simp_all |
164 apply simp_all |
167 done |
165 done |
168 |
166 |
169 lemma divide_divide_eq_right [simp,no_atp]: |
167 lemma divide_divide_eq_right [simp, no_atp]: |
170 "a / (b/c) = (a*c) / (b::'a::{field,division_ring_inverse_zero})" |
168 "a / (b / c) = (a * c) / b" |
171 by (simp add: divide_inverse mult_ac) |
169 by (simp add: divide_inverse mult_ac) |
172 |
170 |
173 lemma divide_divide_eq_left [simp,no_atp]: |
171 lemma divide_divide_eq_left [simp, no_atp]: |
174 "(a / b) / (c::'a::{field,division_ring_inverse_zero}) = a / (b*c)" |
172 "(a / b) / c = a / (b * c)" |
175 by (simp add: divide_inverse mult_assoc) |
173 by (simp add: divide_inverse mult_assoc) |
176 |
174 |
177 |
175 |
178 text {*Special Cancellation Simprules for Division*} |
176 text {*Special Cancellation Simprules for Division*} |
179 |
177 |
180 lemma mult_divide_mult_cancel_left_if[simp,no_atp]: |
178 lemma mult_divide_mult_cancel_left_if [simp,no_atp]: |
181 fixes c :: "'a :: {field,division_ring_inverse_zero}" |
179 shows "(c * a) / (c * b) = (if c = 0 then 0 else a / b)" |
182 shows "(c*a) / (c*b) = (if c=0 then 0 else a/b)" |
180 by (simp add: mult_divide_mult_cancel_left) |
183 by (simp add: mult_divide_mult_cancel_left) |
|
184 |
181 |
185 |
182 |
186 text {* Division and Unary Minus *} |
183 text {* Division and Unary Minus *} |
187 |
184 |
188 lemma minus_divide_right: "- (a/b) = a / -(b::'a::{field,division_ring_inverse_zero})" |
185 lemma minus_divide_right: |
189 by (simp add: divide_inverse) |
186 "- (a / b) = a / - b" |
|
187 by (simp add: divide_inverse) |
190 |
188 |
191 lemma divide_minus_right [simp, no_atp]: |
189 lemma divide_minus_right [simp, no_atp]: |
192 "a / -(b::'a::{field,division_ring_inverse_zero}) = -(a / b)" |
190 "a / - b = - (a / b)" |
193 by (simp add: divide_inverse) |
191 by (simp add: divide_inverse) |
194 |
192 |
195 lemma minus_divide_divide: |
193 lemma minus_divide_divide: |
196 "(-a)/(-b) = a / (b::'a::{field,division_ring_inverse_zero})" |
194 "(- a) / (- b) = a / b" |
197 apply (cases "b=0", simp) |
195 apply (cases "b=0", simp) |
198 apply (simp add: nonzero_minus_divide_divide) |
196 apply (simp add: nonzero_minus_divide_divide) |
199 done |
197 done |
200 |
198 |
201 lemma eq_divide_eq: |
199 lemma eq_divide_eq: |
202 "((a::'a::{field,division_ring_inverse_zero}) = b/c) = (if c\<noteq>0 then a*c = b else a=0)" |
200 "a = b / c \<longleftrightarrow> (if c \<noteq> 0 then a * c = b else a = 0)" |
203 by (simp add: nonzero_eq_divide_eq) |
201 by (simp add: nonzero_eq_divide_eq) |
204 |
202 |
205 lemma divide_eq_eq: |
203 lemma divide_eq_eq: |
206 "(b/c = (a::'a::{field,division_ring_inverse_zero})) = (if c\<noteq>0 then b = a*c else a=0)" |
204 "b / c = a \<longleftrightarrow> (if c \<noteq> 0 then b = a * c else a = 0)" |
207 by (force simp add: nonzero_divide_eq_eq) |
205 by (force simp add: nonzero_divide_eq_eq) |
208 |
206 |
209 lemma inverse_eq_1_iff [simp]: |
207 lemma inverse_eq_1_iff [simp]: |
210 "(inverse x = 1) = (x = (1::'a::{field,division_ring_inverse_zero}))" |
208 "inverse x = 1 \<longleftrightarrow> x = 1" |
211 by (insert inverse_eq_iff_eq [of x 1], simp) |
209 by (insert inverse_eq_iff_eq [of x 1], simp) |
212 |
210 |
213 lemma divide_eq_0_iff [simp,no_atp]: |
211 lemma divide_eq_0_iff [simp, no_atp]: |
214 "(a/b = 0) = (a=0 | b=(0::'a::{field,division_ring_inverse_zero}))" |
212 "a / b = 0 \<longleftrightarrow> a = 0 \<or> b = 0" |
215 by (simp add: divide_inverse) |
213 by (simp add: divide_inverse) |
216 |
214 |
217 lemma divide_cancel_right [simp,no_atp]: |
215 lemma divide_cancel_right [simp, no_atp]: |
218 "(a/c = b/c) = (c = 0 | a = (b::'a::{field,division_ring_inverse_zero}))" |
216 "a / c = b / c \<longleftrightarrow> c = 0 \<or> a = b" |
219 apply (cases "c=0", simp) |
217 apply (cases "c=0", simp) |
220 apply (simp add: divide_inverse) |
218 apply (simp add: divide_inverse) |
221 done |
219 done |
222 |
220 |
223 lemma divide_cancel_left [simp,no_atp]: |
221 lemma divide_cancel_left [simp, no_atp]: |
224 "(c/a = c/b) = (c = 0 | a = (b::'a::{field,division_ring_inverse_zero}))" |
222 "c / a = c / b \<longleftrightarrow> c = 0 \<or> a = b" |
225 apply (cases "c=0", simp) |
223 apply (cases "c=0", simp) |
226 apply (simp add: divide_inverse) |
224 apply (simp add: divide_inverse) |
227 done |
225 done |
228 |
226 |
229 lemma divide_eq_1_iff [simp,no_atp]: |
227 lemma divide_eq_1_iff [simp, no_atp]: |
230 "(a/b = 1) = (b \<noteq> 0 & a = (b::'a::{field,division_ring_inverse_zero}))" |
228 "a / b = 1 \<longleftrightarrow> b \<noteq> 0 \<and> a = b" |
231 apply (cases "b=0", simp) |
229 apply (cases "b=0", simp) |
232 apply (simp add: right_inverse_eq) |
230 apply (simp add: right_inverse_eq) |
233 done |
231 done |
234 |
232 |
235 lemma one_eq_divide_iff [simp,no_atp]: |
233 lemma one_eq_divide_iff [simp, no_atp]: |
236 "(1 = a/b) = (b \<noteq> 0 & a = (b::'a::{field,division_ring_inverse_zero}))" |
234 "1 = a / b \<longleftrightarrow> b \<noteq> 0 \<and> a = b" |
237 by (simp add: eq_commute [of 1]) |
235 by (simp add: eq_commute [of 1]) |
|
236 |
|
237 end |
238 |
238 |
239 |
239 |
240 text {* Ordered Fields *} |
240 text {* Ordered Fields *} |
241 |
241 |
242 class linordered_field = field + linordered_idom |
242 class linordered_field = field + linordered_idom |
648 begin |
648 begin |
649 |
649 |
650 subclass field_inverse_zero proof |
650 subclass field_inverse_zero proof |
651 qed (fact linordered_field_inverse_zero) |
651 qed (fact linordered_field_inverse_zero) |
652 |
652 |
653 end |
|
654 |
|
655 lemma le_divide_eq: |
653 lemma le_divide_eq: |
656 "(a \<le> b/c) = |
654 "(a \<le> b/c) = |
657 (if 0 < c then a*c \<le> b |
655 (if 0 < c then a*c \<le> b |
658 else if c < 0 then b \<le> a*c |
656 else if c < 0 then b \<le> a*c |
659 else a \<le> (0::'a::{linordered_field,division_ring_inverse_zero}))" |
657 else a \<le> 0)" |
660 apply (cases "c=0", simp) |
658 apply (cases "c=0", simp) |
661 apply (force simp add: pos_le_divide_eq neg_le_divide_eq linorder_neq_iff) |
659 apply (force simp add: pos_le_divide_eq neg_le_divide_eq linorder_neq_iff) |
662 done |
660 done |
663 |
661 |
664 lemma inverse_positive_iff_positive [simp]: |
662 lemma inverse_positive_iff_positive [simp]: |
665 "(0 < inverse a) = (0 < (a::'a::{linordered_field,division_ring_inverse_zero}))" |
663 "(0 < inverse a) = (0 < a)" |
666 apply (cases "a = 0", simp) |
664 apply (cases "a = 0", simp) |
667 apply (blast intro: inverse_positive_imp_positive positive_imp_inverse_positive) |
665 apply (blast intro: inverse_positive_imp_positive positive_imp_inverse_positive) |
668 done |
666 done |
669 |
667 |
670 lemma inverse_negative_iff_negative [simp]: |
668 lemma inverse_negative_iff_negative [simp]: |
671 "(inverse a < 0) = (a < (0::'a::{linordered_field,division_ring_inverse_zero}))" |
669 "(inverse a < 0) = (a < 0)" |
672 apply (cases "a = 0", simp) |
670 apply (cases "a = 0", simp) |
673 apply (blast intro: inverse_negative_imp_negative negative_imp_inverse_negative) |
671 apply (blast intro: inverse_negative_imp_negative negative_imp_inverse_negative) |
674 done |
672 done |
675 |
673 |
676 lemma inverse_nonnegative_iff_nonnegative [simp]: |
674 lemma inverse_nonnegative_iff_nonnegative [simp]: |
677 "(0 \<le> inverse a) = (0 \<le> (a::'a::{linordered_field,division_ring_inverse_zero}))" |
675 "0 \<le> inverse a \<longleftrightarrow> 0 \<le> a" |
678 by (simp add: linorder_not_less [symmetric]) |
676 by (simp add: not_less [symmetric]) |
679 |
677 |
680 lemma inverse_nonpositive_iff_nonpositive [simp]: |
678 lemma inverse_nonpositive_iff_nonpositive [simp]: |
681 "(inverse a \<le> 0) = (a \<le> (0::'a::{linordered_field,division_ring_inverse_zero}))" |
679 "inverse a \<le> 0 \<longleftrightarrow> a \<le> 0" |
682 by (simp add: linorder_not_less [symmetric]) |
680 by (simp add: not_less [symmetric]) |
683 |
681 |
684 lemma one_less_inverse_iff: |
682 lemma one_less_inverse_iff: |
685 "(1 < inverse x) = (0 < x & x < (1::'a::{linordered_field,division_ring_inverse_zero}))" |
683 "1 < inverse x \<longleftrightarrow> 0 < x \<and> x < 1" |
686 proof cases |
684 proof cases |
687 assume "0 < x" |
685 assume "0 < x" |
688 with inverse_less_iff_less [OF zero_less_one, of x] |
686 with inverse_less_iff_less [OF zero_less_one, of x] |
689 show ?thesis by simp |
687 show ?thesis by simp |
690 next |
688 next |
691 assume notless: "~ (0 < x)" |
689 assume notless: "~ (0 < x)" |
692 have "~ (1 < inverse x)" |
690 have "~ (1 < inverse x)" |
693 proof |
691 proof |
694 assume "1 < inverse x" |
692 assume "1 < inverse x" |
695 also with notless have "... \<le> 0" by (simp add: linorder_not_less) |
693 also with notless have "... \<le> 0" by simp |
696 also have "... < 1" by (rule zero_less_one) |
694 also have "... < 1" by (rule zero_less_one) |
697 finally show False by auto |
695 finally show False by auto |
698 qed |
696 qed |
699 with notless show ?thesis by simp |
697 with notless show ?thesis by simp |
700 qed |
698 qed |
701 |
699 |
702 lemma one_le_inverse_iff: |
700 lemma one_le_inverse_iff: |
703 "(1 \<le> inverse x) = (0 < x & x \<le> (1::'a::{linordered_field,division_ring_inverse_zero}))" |
701 "1 \<le> inverse x \<longleftrightarrow> 0 < x \<and> x \<le> 1" |
704 by (force simp add: order_le_less one_less_inverse_iff) |
702 proof (cases "x = 1") |
|
703 case True then show ?thesis by simp |
|
704 next |
|
705 case False then have "inverse x \<noteq> 1" by simp |
|
706 then have "1 \<noteq> inverse x" by blast |
|
707 then have "1 \<le> inverse x \<longleftrightarrow> 1 < inverse x" by (simp add: le_less) |
|
708 with False show ?thesis by (auto simp add: one_less_inverse_iff) |
|
709 qed |
705 |
710 |
706 lemma inverse_less_1_iff: |
711 lemma inverse_less_1_iff: |
707 "(inverse x < 1) = (x \<le> 0 | 1 < (x::'a::{linordered_field,division_ring_inverse_zero}))" |
712 "inverse x < 1 \<longleftrightarrow> x \<le> 0 \<or> 1 < x" |
708 by (simp add: linorder_not_le [symmetric] one_le_inverse_iff) |
713 by (simp add: not_le [symmetric] one_le_inverse_iff) |
709 |
714 |
710 lemma inverse_le_1_iff: |
715 lemma inverse_le_1_iff: |
711 "(inverse x \<le> 1) = (x \<le> 0 | 1 \<le> (x::'a::{linordered_field,division_ring_inverse_zero}))" |
716 "inverse x \<le> 1 \<longleftrightarrow> x \<le> 0 \<or> 1 \<le> x" |
712 by (simp add: linorder_not_less [symmetric] one_less_inverse_iff) |
717 by (simp add: not_less [symmetric] one_less_inverse_iff) |
713 |
718 |
714 lemma divide_le_eq: |
719 lemma divide_le_eq: |
715 "(b/c \<le> a) = |
720 "(b/c \<le> a) = |
716 (if 0 < c then b \<le> a*c |
721 (if 0 < c then b \<le> a*c |
717 else if c < 0 then a*c \<le> b |
722 else if c < 0 then a*c \<le> b |
718 else 0 \<le> (a::'a::{linordered_field,division_ring_inverse_zero}))" |
723 else 0 \<le> a)" |
719 apply (cases "c=0", simp) |
724 apply (cases "c=0", simp) |
720 apply (force simp add: pos_divide_le_eq neg_divide_le_eq linorder_neq_iff) |
725 apply (force simp add: pos_divide_le_eq neg_divide_le_eq) |
721 done |
726 done |
722 |
727 |
723 lemma less_divide_eq: |
728 lemma less_divide_eq: |
724 "(a < b/c) = |
729 "(a < b/c) = |
725 (if 0 < c then a*c < b |
730 (if 0 < c then a*c < b |
726 else if c < 0 then b < a*c |
731 else if c < 0 then b < a*c |
727 else a < (0::'a::{linordered_field,division_ring_inverse_zero}))" |
732 else a < 0)" |
728 apply (cases "c=0", simp) |
733 apply (cases "c=0", simp) |
729 apply (force simp add: pos_less_divide_eq neg_less_divide_eq linorder_neq_iff) |
734 apply (force simp add: pos_less_divide_eq neg_less_divide_eq) |
730 done |
735 done |
731 |
736 |
732 lemma divide_less_eq: |
737 lemma divide_less_eq: |
733 "(b/c < a) = |
738 "(b/c < a) = |
734 (if 0 < c then b < a*c |
739 (if 0 < c then b < a*c |
735 else if c < 0 then a*c < b |
740 else if c < 0 then a*c < b |
736 else 0 < (a::'a::{linordered_field,division_ring_inverse_zero}))" |
741 else 0 < a)" |
737 apply (cases "c=0", simp) |
742 apply (cases "c=0", simp) |
738 apply (force simp add: pos_divide_less_eq neg_divide_less_eq linorder_neq_iff) |
743 apply (force simp add: pos_divide_less_eq neg_divide_less_eq) |
739 done |
744 done |
740 |
745 |
741 text {*Division and Signs*} |
746 text {*Division and Signs*} |
742 |
747 |
743 lemma zero_less_divide_iff: |
748 lemma zero_less_divide_iff: |
744 "((0::'a::{linordered_field,division_ring_inverse_zero}) < a/b) = (0 < a & 0 < b | a < 0 & b < 0)" |
749 "(0 < a/b) = (0 < a & 0 < b | a < 0 & b < 0)" |
745 by (simp add: divide_inverse zero_less_mult_iff) |
750 by (simp add: divide_inverse zero_less_mult_iff) |
746 |
751 |
747 lemma divide_less_0_iff: |
752 lemma divide_less_0_iff: |
748 "(a/b < (0::'a::{linordered_field,division_ring_inverse_zero})) = |
753 "(a/b < 0) = |
749 (0 < a & b < 0 | a < 0 & 0 < b)" |
754 (0 < a & b < 0 | a < 0 & 0 < b)" |
750 by (simp add: divide_inverse mult_less_0_iff) |
755 by (simp add: divide_inverse mult_less_0_iff) |
751 |
756 |
752 lemma zero_le_divide_iff: |
757 lemma zero_le_divide_iff: |
753 "((0::'a::{linordered_field,division_ring_inverse_zero}) \<le> a/b) = |
758 "(0 \<le> a/b) = |
754 (0 \<le> a & 0 \<le> b | a \<le> 0 & b \<le> 0)" |
759 (0 \<le> a & 0 \<le> b | a \<le> 0 & b \<le> 0)" |
755 by (simp add: divide_inverse zero_le_mult_iff) |
760 by (simp add: divide_inverse zero_le_mult_iff) |
756 |
761 |
757 lemma divide_le_0_iff: |
762 lemma divide_le_0_iff: |
758 "(a/b \<le> (0::'a::{linordered_field,division_ring_inverse_zero})) = |
763 "(a/b \<le> 0) = |
759 (0 \<le> a & b \<le> 0 | a \<le> 0 & 0 \<le> b)" |
764 (0 \<le> a & b \<le> 0 | a \<le> 0 & 0 \<le> b)" |
760 by (simp add: divide_inverse mult_le_0_iff) |
765 by (simp add: divide_inverse mult_le_0_iff) |
761 |
766 |
762 text {* Division and the Number One *} |
767 text {* Division and the Number One *} |
763 |
768 |
764 text{*Simplify expressions equated with 1*} |
769 text{*Simplify expressions equated with 1*} |
765 |
770 |
766 lemma zero_eq_1_divide_iff [simp,no_atp]: |
771 lemma zero_eq_1_divide_iff [simp,no_atp]: |
767 "((0::'a::{linordered_field,division_ring_inverse_zero}) = 1/a) = (a = 0)" |
772 "(0 = 1/a) = (a = 0)" |
768 apply (cases "a=0", simp) |
773 apply (cases "a=0", simp) |
769 apply (auto simp add: nonzero_eq_divide_eq) |
774 apply (auto simp add: nonzero_eq_divide_eq) |
770 done |
775 done |
771 |
776 |
772 lemma one_divide_eq_0_iff [simp,no_atp]: |
777 lemma one_divide_eq_0_iff [simp,no_atp]: |
773 "(1/a = (0::'a::{linordered_field,division_ring_inverse_zero})) = (a = 0)" |
778 "(1/a = 0) = (a = 0)" |
774 apply (cases "a=0", simp) |
779 apply (cases "a=0", simp) |
775 apply (insert zero_neq_one [THEN not_sym]) |
780 apply (insert zero_neq_one [THEN not_sym]) |
776 apply (auto simp add: nonzero_divide_eq_eq) |
781 apply (auto simp add: nonzero_divide_eq_eq) |
777 done |
782 done |
778 |
783 |
786 declare divide_less_0_1_iff [simp,no_atp] |
791 declare divide_less_0_1_iff [simp,no_atp] |
787 declare zero_le_divide_1_iff [simp,no_atp] |
792 declare zero_le_divide_1_iff [simp,no_atp] |
788 declare divide_le_0_1_iff [simp,no_atp] |
793 declare divide_le_0_1_iff [simp,no_atp] |
789 |
794 |
790 lemma divide_right_mono: |
795 lemma divide_right_mono: |
791 "[|a \<le> b; 0 \<le> c|] ==> a/c \<le> b/(c::'a::{linordered_field,division_ring_inverse_zero})" |
796 "[|a \<le> b; 0 \<le> c|] ==> a/c \<le> b/c" |
792 by (force simp add: divide_strict_right_mono order_le_less) |
797 by (force simp add: divide_strict_right_mono le_less) |
793 |
798 |
794 lemma divide_right_mono_neg: "(a::'a::{linordered_field,division_ring_inverse_zero}) <= b |
799 lemma divide_right_mono_neg: "a <= b |
795 ==> c <= 0 ==> b / c <= a / c" |
800 ==> c <= 0 ==> b / c <= a / c" |
796 apply (drule divide_right_mono [of _ _ "- c"]) |
801 apply (drule divide_right_mono [of _ _ "- c"]) |
797 apply auto |
802 apply auto |
798 done |
803 done |
799 |
804 |
800 lemma divide_left_mono_neg: "(a::'a::{linordered_field,division_ring_inverse_zero}) <= b |
805 lemma divide_left_mono_neg: "a <= b |
801 ==> c <= 0 ==> 0 < a * b ==> c / a <= c / b" |
806 ==> c <= 0 ==> 0 < a * b ==> c / a <= c / b" |
802 apply (drule divide_left_mono [of _ _ "- c"]) |
807 apply (drule divide_left_mono [of _ _ "- c"]) |
803 apply (auto simp add: mult_commute) |
808 apply (auto simp add: mult_commute) |
804 done |
809 done |
805 |
810 |
806 |
811 |
807 |
812 |
808 text{*Simplify quotients that are compared with the value 1.*} |
813 text{*Simplify quotients that are compared with the value 1.*} |
809 |
814 |
810 lemma le_divide_eq_1 [no_atp]: |
815 lemma le_divide_eq_1 [no_atp]: |
811 fixes a :: "'a :: {linordered_field,division_ring_inverse_zero}" |
816 "(1 \<le> b / a) = ((0 < a & a \<le> b) | (a < 0 & b \<le> a))" |
812 shows "(1 \<le> b / a) = ((0 < a & a \<le> b) | (a < 0 & b \<le> a))" |
|
813 by (auto simp add: le_divide_eq) |
817 by (auto simp add: le_divide_eq) |
814 |
818 |
815 lemma divide_le_eq_1 [no_atp]: |
819 lemma divide_le_eq_1 [no_atp]: |
816 fixes a :: "'a :: {linordered_field,division_ring_inverse_zero}" |
820 "(b / a \<le> 1) = ((0 < a & b \<le> a) | (a < 0 & a \<le> b) | a=0)" |
817 shows "(b / a \<le> 1) = ((0 < a & b \<le> a) | (a < 0 & a \<le> b) | a=0)" |
|
818 by (auto simp add: divide_le_eq) |
821 by (auto simp add: divide_le_eq) |
819 |
822 |
820 lemma less_divide_eq_1 [no_atp]: |
823 lemma less_divide_eq_1 [no_atp]: |
821 fixes a :: "'a :: {linordered_field,division_ring_inverse_zero}" |
824 "(1 < b / a) = ((0 < a & a < b) | (a < 0 & b < a))" |
822 shows "(1 < b / a) = ((0 < a & a < b) | (a < 0 & b < a))" |
|
823 by (auto simp add: less_divide_eq) |
825 by (auto simp add: less_divide_eq) |
824 |
826 |
825 lemma divide_less_eq_1 [no_atp]: |
827 lemma divide_less_eq_1 [no_atp]: |
826 fixes a :: "'a :: {linordered_field,division_ring_inverse_zero}" |
828 "(b / a < 1) = ((0 < a & b < a) | (a < 0 & a < b) | a=0)" |
827 shows "(b / a < 1) = ((0 < a & b < a) | (a < 0 & a < b) | a=0)" |
|
828 by (auto simp add: divide_less_eq) |
829 by (auto simp add: divide_less_eq) |
829 |
830 |
830 |
831 |
831 text {*Conditional Simplification Rules: No Case Splits*} |
832 text {*Conditional Simplification Rules: No Case Splits*} |
832 |
833 |
833 lemma le_divide_eq_1_pos [simp,no_atp]: |
834 lemma le_divide_eq_1_pos [simp,no_atp]: |
834 fixes a :: "'a :: {linordered_field,division_ring_inverse_zero}" |
835 "0 < a \<Longrightarrow> (1 \<le> b/a) = (a \<le> b)" |
835 shows "0 < a \<Longrightarrow> (1 \<le> b/a) = (a \<le> b)" |
|
836 by (auto simp add: le_divide_eq) |
836 by (auto simp add: le_divide_eq) |
837 |
837 |
838 lemma le_divide_eq_1_neg [simp,no_atp]: |
838 lemma le_divide_eq_1_neg [simp,no_atp]: |
839 fixes a :: "'a :: {linordered_field,division_ring_inverse_zero}" |
839 "a < 0 \<Longrightarrow> (1 \<le> b/a) = (b \<le> a)" |
840 shows "a < 0 \<Longrightarrow> (1 \<le> b/a) = (b \<le> a)" |
|
841 by (auto simp add: le_divide_eq) |
840 by (auto simp add: le_divide_eq) |
842 |
841 |
843 lemma divide_le_eq_1_pos [simp,no_atp]: |
842 lemma divide_le_eq_1_pos [simp,no_atp]: |
844 fixes a :: "'a :: {linordered_field,division_ring_inverse_zero}" |
843 "0 < a \<Longrightarrow> (b/a \<le> 1) = (b \<le> a)" |
845 shows "0 < a \<Longrightarrow> (b/a \<le> 1) = (b \<le> a)" |
|
846 by (auto simp add: divide_le_eq) |
844 by (auto simp add: divide_le_eq) |
847 |
845 |
848 lemma divide_le_eq_1_neg [simp,no_atp]: |
846 lemma divide_le_eq_1_neg [simp,no_atp]: |
849 fixes a :: "'a :: {linordered_field,division_ring_inverse_zero}" |
847 "a < 0 \<Longrightarrow> (b/a \<le> 1) = (a \<le> b)" |
850 shows "a < 0 \<Longrightarrow> (b/a \<le> 1) = (a \<le> b)" |
|
851 by (auto simp add: divide_le_eq) |
848 by (auto simp add: divide_le_eq) |
852 |
849 |
853 lemma less_divide_eq_1_pos [simp,no_atp]: |
850 lemma less_divide_eq_1_pos [simp,no_atp]: |
854 fixes a :: "'a :: {linordered_field,division_ring_inverse_zero}" |
851 "0 < a \<Longrightarrow> (1 < b/a) = (a < b)" |
855 shows "0 < a \<Longrightarrow> (1 < b/a) = (a < b)" |
|
856 by (auto simp add: less_divide_eq) |
852 by (auto simp add: less_divide_eq) |
857 |
853 |
858 lemma less_divide_eq_1_neg [simp,no_atp]: |
854 lemma less_divide_eq_1_neg [simp,no_atp]: |
859 fixes a :: "'a :: {linordered_field,division_ring_inverse_zero}" |
855 "a < 0 \<Longrightarrow> (1 < b/a) = (b < a)" |
860 shows "a < 0 \<Longrightarrow> (1 < b/a) = (b < a)" |
|
861 by (auto simp add: less_divide_eq) |
856 by (auto simp add: less_divide_eq) |
862 |
857 |
863 lemma divide_less_eq_1_pos [simp,no_atp]: |
858 lemma divide_less_eq_1_pos [simp,no_atp]: |
864 fixes a :: "'a :: {linordered_field,division_ring_inverse_zero}" |
859 "0 < a \<Longrightarrow> (b/a < 1) = (b < a)" |
865 shows "0 < a \<Longrightarrow> (b/a < 1) = (b < a)" |
|
866 by (auto simp add: divide_less_eq) |
860 by (auto simp add: divide_less_eq) |
867 |
861 |
868 lemma divide_less_eq_1_neg [simp,no_atp]: |
862 lemma divide_less_eq_1_neg [simp,no_atp]: |
869 fixes a :: "'a :: {linordered_field,division_ring_inverse_zero}" |
863 "a < 0 \<Longrightarrow> b/a < 1 <-> a < b" |
870 shows "a < 0 \<Longrightarrow> b/a < 1 <-> a < b" |
|
871 by (auto simp add: divide_less_eq) |
864 by (auto simp add: divide_less_eq) |
872 |
865 |
873 lemma eq_divide_eq_1 [simp,no_atp]: |
866 lemma eq_divide_eq_1 [simp,no_atp]: |
874 fixes a :: "'a :: {linordered_field,division_ring_inverse_zero}" |
867 "(1 = b/a) = ((a \<noteq> 0 & a = b))" |
875 shows "(1 = b/a) = ((a \<noteq> 0 & a = b))" |
|
876 by (auto simp add: eq_divide_eq) |
868 by (auto simp add: eq_divide_eq) |
877 |
869 |
878 lemma divide_eq_eq_1 [simp,no_atp]: |
870 lemma divide_eq_eq_1 [simp,no_atp]: |
879 fixes a :: "'a :: {linordered_field,division_ring_inverse_zero}" |
871 "(b/a = 1) = ((a \<noteq> 0 & a = b))" |
880 shows "(b/a = 1) = ((a \<noteq> 0 & a = b))" |
|
881 by (auto simp add: divide_eq_eq) |
872 by (auto simp add: divide_eq_eq) |
882 |
873 |
883 lemma abs_inverse [simp]: |
874 lemma abs_inverse [simp]: |
884 "\<bar>inverse (a::'a::{linordered_field,division_ring_inverse_zero})\<bar> = |
875 "\<bar>inverse a\<bar> = |
885 inverse \<bar>a\<bar>" |
876 inverse \<bar>a\<bar>" |
886 apply (cases "a=0", simp) |
877 apply (cases "a=0", simp) |
887 apply (simp add: nonzero_abs_inverse) |
878 apply (simp add: nonzero_abs_inverse) |
888 done |
879 done |
889 |
880 |
890 lemma abs_divide [simp]: |
881 lemma abs_divide [simp]: |
891 "\<bar>a / (b::'a::{linordered_field,division_ring_inverse_zero})\<bar> = \<bar>a\<bar> / \<bar>b\<bar>" |
882 "\<bar>a / b\<bar> = \<bar>a\<bar> / \<bar>b\<bar>" |
892 apply (cases "b=0", simp) |
883 apply (cases "b=0", simp) |
893 apply (simp add: nonzero_abs_divide) |
884 apply (simp add: nonzero_abs_divide) |
894 done |
885 done |
895 |
886 |
896 lemma abs_div_pos: "(0::'a::{linordered_field,division_ring_inverse_zero}) < y ==> |
887 lemma abs_div_pos: "0 < y ==> |
897 \<bar>x\<bar> / y = \<bar>x / y\<bar>" |
888 \<bar>x\<bar> / y = \<bar>x / y\<bar>" |
898 apply (subst abs_divide) |
889 apply (subst abs_divide) |
899 apply (simp add: order_less_imp_le) |
890 apply (simp add: order_less_imp_le) |
900 done |
891 done |
901 |
892 |
902 lemma field_le_mult_one_interval: |
893 lemma field_le_mult_one_interval: |
903 fixes x :: "'a\<Colon>{linordered_field,division_ring_inverse_zero}" |
|
904 assumes *: "\<And>z. \<lbrakk> 0 < z ; z < 1 \<rbrakk> \<Longrightarrow> z * x \<le> y" |
894 assumes *: "\<And>z. \<lbrakk> 0 < z ; z < 1 \<rbrakk> \<Longrightarrow> z * x \<le> y" |
905 shows "x \<le> y" |
895 shows "x \<le> y" |
906 proof (cases "0 < x") |
896 proof (cases "0 < x") |
907 assume "0 < x" |
897 assume "0 < x" |
908 thus ?thesis |
898 thus ?thesis |