727 |
727 |
728 subclass semiring_0_cancel .. |
728 subclass semiring_0_cancel .. |
729 subclass pordered_semiring .. |
729 subclass pordered_semiring .. |
730 |
730 |
731 lemma mult_nonneg_nonneg: "0 \<le> a \<Longrightarrow> 0 \<le> b \<Longrightarrow> 0 \<le> a * b" |
731 lemma mult_nonneg_nonneg: "0 \<le> a \<Longrightarrow> 0 \<le> b \<Longrightarrow> 0 \<le> a * b" |
732 by (drule mult_left_mono [of zero b], auto) |
732 using mult_left_mono [of zero b a] by simp |
733 |
733 |
734 lemma mult_nonneg_nonpos: "0 \<le> a \<Longrightarrow> b \<le> 0 \<Longrightarrow> a * b \<le> 0" |
734 lemma mult_nonneg_nonpos: "0 \<le> a \<Longrightarrow> b \<le> 0 \<Longrightarrow> a * b \<le> 0" |
735 by (drule mult_left_mono [of b zero], auto) |
735 using mult_left_mono [of b zero a] by simp |
736 |
736 |
|
737 lemma mult_nonpos_nonneg: "a \<le> 0 \<Longrightarrow> 0 \<le> b \<Longrightarrow> a * b \<le> 0" |
|
738 using mult_right_mono [of a zero b] by simp |
|
739 |
|
740 text {* Legacy - use @{text mult_nonpos_nonneg} *} |
737 lemma mult_nonneg_nonpos2: "0 \<le> a \<Longrightarrow> b \<le> 0 \<Longrightarrow> b * a \<le> 0" |
741 lemma mult_nonneg_nonpos2: "0 \<le> a \<Longrightarrow> b \<le> 0 \<Longrightarrow> b * a \<le> 0" |
738 by (drule mult_right_mono [of b zero], auto) |
742 by (drule mult_right_mono [of b zero], auto) |
739 |
743 |
740 lemma split_mult_neg_le: "(0 \<le> a & b \<le> 0) | (a \<le> 0 & 0 \<le> b) \<Longrightarrow> a * b \<le> 0" |
744 lemma split_mult_neg_le: "(0 \<le> a & b \<le> 0) | (a \<le> 0 & 0 \<le> b) \<Longrightarrow> a * b \<le> 0" |
741 by (auto simp add: mult_nonneg_nonpos mult_nonneg_nonpos2) |
745 by (auto simp add: mult_nonneg_nonpos mult_nonneg_nonpos2) |
784 |
788 |
785 lemma mult_right_le_imp_le: |
789 lemma mult_right_le_imp_le: |
786 "a * c \<le> b * c \<Longrightarrow> 0 < c \<Longrightarrow> a \<le> b" |
790 "a * c \<le> b * c \<Longrightarrow> 0 < c \<Longrightarrow> a \<le> b" |
787 by (force simp add: mult_strict_right_mono not_less [symmetric]) |
791 by (force simp add: mult_strict_right_mono not_less [symmetric]) |
788 |
792 |
789 lemma mult_pos_pos: |
793 lemma mult_pos_pos: "0 < a \<Longrightarrow> 0 < b \<Longrightarrow> 0 < a * b" |
790 "0 < a \<Longrightarrow> 0 < b \<Longrightarrow> 0 < a * b" |
794 using mult_strict_left_mono [of zero b a] by simp |
791 by (drule mult_strict_left_mono [of zero b], auto) |
795 |
792 |
796 lemma mult_pos_neg: "0 < a \<Longrightarrow> b < 0 \<Longrightarrow> a * b < 0" |
793 lemma mult_pos_neg: |
797 using mult_strict_left_mono [of b zero a] by simp |
794 "0 < a \<Longrightarrow> b < 0 \<Longrightarrow> a * b < 0" |
798 |
795 by (drule mult_strict_left_mono [of b zero], auto) |
799 lemma mult_neg_pos: "a < 0 \<Longrightarrow> 0 < b \<Longrightarrow> a * b < 0" |
796 |
800 using mult_strict_right_mono [of a zero b] by simp |
797 lemma mult_pos_neg2: |
801 |
798 "0 < a \<Longrightarrow> b < 0 \<Longrightarrow> b * a < 0" |
802 text {* Legacy - use @{text mult_neg_pos} *} |
|
803 lemma mult_pos_neg2: "0 < a \<Longrightarrow> b < 0 \<Longrightarrow> b * a < 0" |
799 by (drule mult_strict_right_mono [of b zero], auto) |
804 by (drule mult_strict_right_mono [of b zero], auto) |
800 |
805 |
801 lemma zero_less_mult_pos: |
806 lemma zero_less_mult_pos: |
802 "0 < a * b \<Longrightarrow> 0 < a \<Longrightarrow> 0 < b" |
807 "0 < a * b \<Longrightarrow> 0 < a \<Longrightarrow> 0 < b" |
803 apply (cases "b\<le>0") |
808 apply (cases "b\<le>0") |
804 apply (auto simp add: le_less not_less) |
809 apply (auto simp add: le_less not_less) |
805 apply (drule_tac mult_pos_neg [of a b]) |
810 apply (drule_tac mult_pos_neg [of a b]) |
806 apply (auto dest: less_not_sym) |
811 apply (auto dest: less_not_sym) |
807 done |
812 done |
808 |
813 |
809 lemma zero_less_mult_pos2: |
814 lemma zero_less_mult_pos2: |
810 "0 < b * a \<Longrightarrow> 0 < a \<Longrightarrow> 0 < b" |
815 "0 < b * a \<Longrightarrow> 0 < a \<Longrightarrow> 0 < b" |
811 apply (cases "b\<le>0") |
816 apply (cases "b\<le>0") |
812 apply (auto simp add: le_less not_less) |
817 apply (auto simp add: le_less not_less) |
813 apply (drule_tac mult_pos_neg2 [of a b]) |
818 apply (drule_tac mult_pos_neg2 [of a b]) |
814 apply (auto dest: less_not_sym) |
819 apply (auto dest: less_not_sym) |
815 done |
820 done |
816 |
821 |
817 text{*Strict monotonicity in both arguments*} |
822 text{*Strict monotonicity in both arguments*} |
818 lemma mult_strict_mono: |
823 lemma mult_strict_mono: |
819 assumes "a < b" and "c < d" and "0 < b" and "0 \<le> c" |
824 assumes "a < b" and "c < d" and "0 < b" and "0 \<le> c" |
820 shows "a * c < b * d" |
825 shows "a * c < b * d" |
821 using assms apply (cases "c=0") |
826 using assms apply (cases "c=0") |
822 apply (simp add: mult_pos_pos) |
827 apply (simp add: mult_pos_pos) |
823 apply (erule mult_strict_right_mono [THEN less_trans]) |
828 apply (erule mult_strict_right_mono [THEN less_trans]) |
824 apply (force simp add: le_less) |
829 apply (force simp add: le_less) |
825 apply (erule mult_strict_left_mono, assumption) |
830 apply (erule mult_strict_left_mono, assumption) |
826 done |
831 done |
827 |
832 |
828 text{*This weaker variant has more natural premises*} |
833 text{*This weaker variant has more natural premises*} |
829 lemma mult_strict_mono': |
834 lemma mult_strict_mono': |
958 "b \<le> a \<Longrightarrow> c \<le> 0 \<Longrightarrow> a * c \<le> b * c" |
963 "b \<le> a \<Longrightarrow> c \<le> 0 \<Longrightarrow> a * c \<le> b * c" |
959 apply (drule mult_right_mono [of _ _ "uminus c"]) |
964 apply (drule mult_right_mono [of _ _ "uminus c"]) |
960 apply (simp_all add: minus_mult_right [symmetric]) |
965 apply (simp_all add: minus_mult_right [symmetric]) |
961 done |
966 done |
962 |
967 |
963 lemma mult_nonpos_nonpos: |
968 lemma mult_nonpos_nonpos: "a \<le> 0 \<Longrightarrow> b \<le> 0 \<Longrightarrow> 0 \<le> a * b" |
964 "a \<le> 0 \<Longrightarrow> b \<le> 0 \<Longrightarrow> 0 \<le> a * b" |
969 using mult_right_mono_neg [of a zero b] by simp |
965 by (drule mult_right_mono_neg [of a zero b]) auto |
|
966 |
970 |
967 lemma split_mult_pos_le: |
971 lemma split_mult_pos_le: |
968 "(0 \<le> a \<and> 0 \<le> b) \<or> (a \<le> 0 \<and> b \<le> 0) \<Longrightarrow> 0 \<le> a * b" |
972 "(0 \<le> a \<and> 0 \<le> b) \<or> (a \<le> 0 \<and> b \<le> 0) \<Longrightarrow> 0 \<le> a * b" |
969 by (auto simp add: mult_nonneg_nonneg mult_nonpos_nonpos) |
973 by (auto simp add: mult_nonneg_nonneg mult_nonpos_nonpos) |
970 |
974 |
1004 + ordered_ab_group_add + abs_if |
1008 + ordered_ab_group_add + abs_if |
1005 begin |
1009 begin |
1006 |
1010 |
1007 subclass ordered_ring .. |
1011 subclass ordered_ring .. |
1008 |
1012 |
1009 lemma mult_strict_left_mono_neg: |
1013 lemma mult_strict_left_mono_neg: "b < a \<Longrightarrow> c < 0 \<Longrightarrow> c * a < c * b" |
1010 "b < a \<Longrightarrow> c < 0 \<Longrightarrow> c * a < c * b" |
1014 using mult_strict_left_mono [of b a "- c"] by simp |
1011 apply (drule mult_strict_left_mono [of _ _ "uminus c"]) |
1015 |
1012 apply (simp_all add: minus_mult_left [symmetric]) |
1016 lemma mult_strict_right_mono_neg: "b < a \<Longrightarrow> c < 0 \<Longrightarrow> a * c < b * c" |
1013 done |
1017 using mult_strict_right_mono [of b a "- c"] by simp |
1014 |
1018 |
1015 lemma mult_strict_right_mono_neg: |
1019 lemma mult_neg_neg: "a < 0 \<Longrightarrow> b < 0 \<Longrightarrow> 0 < a * b" |
1016 "b < a \<Longrightarrow> c < 0 \<Longrightarrow> a * c < b * c" |
1020 using mult_strict_right_mono_neg [of a zero b] by simp |
1017 apply (drule mult_strict_right_mono [of _ _ "uminus c"]) |
|
1018 apply (simp_all add: minus_mult_right [symmetric]) |
|
1019 done |
|
1020 |
|
1021 lemma mult_neg_neg: |
|
1022 "a < 0 \<Longrightarrow> b < 0 \<Longrightarrow> 0 < a * b" |
|
1023 by (drule mult_strict_right_mono_neg, auto) |
|
1024 |
1021 |
1025 subclass ring_no_zero_divisors |
1022 subclass ring_no_zero_divisors |
1026 proof |
1023 proof |
1027 fix a b |
1024 fix a b |
1028 assume "a \<noteq> 0" then have A: "a < 0 \<or> 0 < a" by (simp add: neq_iff) |
1025 assume "a \<noteq> 0" then have A: "a < 0 \<or> 0 < a" by (simp add: neq_iff) |
1142 |
1139 |
1143 lemma mult_le_cancel_left_neg: |
1140 lemma mult_le_cancel_left_neg: |
1144 "c < 0 \<Longrightarrow> c * a \<le> c * b \<longleftrightarrow> b \<le> a" |
1141 "c < 0 \<Longrightarrow> c * a \<le> c * b \<longleftrightarrow> b \<le> a" |
1145 by (auto simp: mult_le_cancel_left) |
1142 by (auto simp: mult_le_cancel_left) |
1146 |
1143 |
1147 end |
|
1148 |
|
1149 context ordered_ring_strict |
|
1150 begin |
|
1151 |
|
1152 lemma mult_less_cancel_left_pos: |
1144 lemma mult_less_cancel_left_pos: |
1153 "0 < c \<Longrightarrow> c * a < c * b \<longleftrightarrow> a < b" |
1145 "0 < c \<Longrightarrow> c * a < c * b \<longleftrightarrow> a < b" |
1154 by (auto simp: mult_less_cancel_left) |
1146 by (auto simp: mult_less_cancel_left) |
1155 |
1147 |
1156 lemma mult_less_cancel_left_neg: |
1148 lemma mult_less_cancel_left_neg: |