equal
deleted
inserted
replaced
27 where |
27 where |
28 "inverse_divide \<equiv> divide" |
28 "inverse_divide \<equiv> divide" |
29 |
29 |
30 end |
30 end |
31 |
31 |
32 text\<open>Lemmas @{text divide_simps} move division to the outside and eliminates them on (in)equalities.\<close> |
32 text\<open>Lemmas \<open>divide_simps\<close> move division to the outside and eliminates them on (in)equalities.\<close> |
33 |
33 |
34 named_theorems divide_simps "rewrite rules to eliminate divisions" |
34 named_theorems divide_simps "rewrite rules to eliminate divisions" |
35 |
35 |
36 class division_ring = ring_1 + inverse + |
36 class division_ring = ring_1 + inverse + |
37 assumes left_inverse [simp]: "a \<noteq> 0 \<Longrightarrow> inverse a * a = 1" |
37 assumes left_inverse [simp]: "a \<noteq> 0 \<Longrightarrow> inverse a * a = 1" |
394 by (simp add: divide_inverse mult.commute) |
394 by (simp add: divide_inverse mult.commute) |
395 |
395 |
396 |
396 |
397 text \<open>Calculations with fractions\<close> |
397 text \<open>Calculations with fractions\<close> |
398 |
398 |
399 text\<open>There is a whole bunch of simp-rules just for class @{text |
399 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> |
400 field} but none for class @{text field} and @{text nonzero_divides} |
|
401 because the latter are covered by a simproc.\<close> |
400 because the latter are covered by a simproc.\<close> |
402 |
401 |
403 lemma mult_divide_mult_cancel_left: |
402 lemma mult_divide_mult_cancel_left: |
404 "c \<noteq> 0 \<Longrightarrow> (c * a) / (c * b) = a / b" |
403 "c \<noteq> 0 \<Longrightarrow> (c * a) / (c * b) = a / b" |
405 apply (cases "b = 0") |
404 apply (cases "b = 0") |
734 also have "... \<longleftrightarrow> a * c < b" |
733 also have "... \<longleftrightarrow> a * c < b" |
735 by (simp add: less_imp_not_eq [OF assms] divide_inverse mult.assoc) |
734 by (simp add: less_imp_not_eq [OF assms] divide_inverse mult.assoc) |
736 finally show ?thesis . |
735 finally show ?thesis . |
737 qed |
736 qed |
738 |
737 |
739 text\<open>The following @{text field_simps} rules are necessary, as minus is always moved atop of |
738 text\<open>The following \<open>field_simps\<close> rules are necessary, as minus is always moved atop of |
740 division but we want to get rid of division.\<close> |
739 division but we want to get rid of division.\<close> |
741 |
740 |
742 lemma pos_le_minus_divide_eq [field_simps]: "0 < c \<Longrightarrow> a \<le> - (b / c) \<longleftrightarrow> a * c \<le> - b" |
741 lemma pos_le_minus_divide_eq [field_simps]: "0 < c \<Longrightarrow> a \<le> - (b / c) \<longleftrightarrow> a * c \<le> - b" |
743 unfolding minus_divide_left by (rule pos_le_divide_eq) |
742 unfolding minus_divide_left by (rule pos_le_divide_eq) |
744 |
743 |
769 |
768 |
770 lemma frac_le_eq: |
769 lemma frac_le_eq: |
771 "y \<noteq> 0 \<Longrightarrow> z \<noteq> 0 \<Longrightarrow> x / y \<le> w / z \<longleftrightarrow> (x * z - w * y) / (y * z) \<le> 0" |
770 "y \<noteq> 0 \<Longrightarrow> z \<noteq> 0 \<Longrightarrow> x / y \<le> w / z \<longleftrightarrow> (x * z - w * y) / (y * z) \<le> 0" |
772 by (subst le_iff_diff_le_0) (simp add: diff_frac_eq ) |
771 by (subst le_iff_diff_le_0) (simp add: diff_frac_eq ) |
773 |
772 |
774 text\<open>Lemmas @{text sign_simps} is a first attempt to automate proofs |
773 text\<open>Lemmas \<open>sign_simps\<close> is a first attempt to automate proofs |
775 of positivity/negativity needed for @{text field_simps}. Have not added @{text |
774 of positivity/negativity needed for \<open>field_simps\<close>. Have not added \<open>sign_simps\<close> to \<open>field_simps\<close> because the former can lead to case |
776 sign_simps} to @{text field_simps} because the former can lead to case |
|
777 explosions.\<close> |
775 explosions.\<close> |
778 |
776 |
779 lemmas sign_simps = algebra_simps zero_less_mult_iff mult_less_0_iff |
777 lemmas sign_simps = algebra_simps zero_less_mult_iff mult_less_0_iff |
780 |
778 |
781 lemmas (in -) sign_simps = algebra_simps zero_less_mult_iff mult_less_0_iff |
779 lemmas (in -) sign_simps = algebra_simps zero_less_mult_iff mult_less_0_iff |
1004 by (cases "a = 0") (auto simp: field_simps) |
1002 by (cases "a = 0") (auto simp: field_simps) |
1005 |
1003 |
1006 lemma one_divide_eq_0_iff [simp]: "1 / a = 0 \<longleftrightarrow> a = 0" |
1004 lemma one_divide_eq_0_iff [simp]: "1 / a = 0 \<longleftrightarrow> a = 0" |
1007 using zero_eq_1_divide_iff[of a] by simp |
1005 using zero_eq_1_divide_iff[of a] by simp |
1008 |
1006 |
1009 text\<open>Simplify expressions such as @{text "0 < 1/x"} to @{text "0 < x"}\<close> |
1007 text\<open>Simplify expressions such as \<open>0 < 1/x\<close> to \<open>0 < x\<close>\<close> |
1010 |
1008 |
1011 lemma zero_le_divide_1_iff [simp]: |
1009 lemma zero_le_divide_1_iff [simp]: |
1012 "0 \<le> 1 / a \<longleftrightarrow> 0 \<le> a" |
1010 "0 \<le> 1 / a \<longleftrightarrow> 0 \<le> a" |
1013 by (simp add: zero_le_divide_iff) |
1011 by (simp add: zero_le_divide_iff) |
1014 |
1012 |