# HG changeset patch # User hoelzl # Date 1397473697 -7200 # Node ID f4635657d66fac591c9df7c086f6d075b49f42e3 # Parent 282f3b06fa86b84bbddc5ef42915a5c47191e7b6 added divide_nonneg_nonneg and co; made it a simp rule diff -r 282f3b06fa86 -r f4635657d66f src/HOL/Decision_Procs/Approximation.thy --- a/src/HOL/Decision_Procs/Approximation.thy Mon Apr 14 10:55:56 2014 +0200 +++ b/src/HOL/Decision_Procs/Approximation.thy Mon Apr 14 13:08:17 2014 +0200 @@ -778,7 +778,7 @@ also have "\ \ cos x" proof - from even[OF `even n`] `0 < ?fact` `0 < ?pow` - have "0 \ (?rest / ?fact) * ?pow" by (simp add: divide_nonneg_pos) + have "0 \ (?rest / ?fact) * ?pow" by simp thus ?thesis unfolding cos_eq by auto qed finally have "(lb_sin_cos_aux prec n 1 1 (x * x)) \ cos x" . @@ -891,7 +891,7 @@ also have "\ \ sin x" proof - from even[OF `even n`] `0 < ?fact` `0 < ?pow` - have "0 \ (?rest / ?fact) * ?pow" by (simp add: divide_nonneg_pos less_imp_le) + have "0 \ (?rest / ?fact) * ?pow" by simp thus ?thesis unfolding sin_eq by auto qed finally have "(x * lb_sin_cos_aux prec n 2 1 (x * x)) \ sin x" . @@ -1344,7 +1344,7 @@ obtain t where "\t\ \ \real x\" and "exp x = (\m = 0.. exp t / real (fact (get_even n)) * (real x) ^ (get_even n)" - by (auto simp: divide_nonneg_pos zero_le_even_power) + by (auto simp: zero_le_even_power) ultimately show ?thesis using get_odd exp_gt_zero by auto qed finally have "lb_exp_horner prec (get_even n) 1 1 x \ exp x" . diff -r 282f3b06fa86 -r f4635657d66f src/HOL/Fields.thy --- a/src/HOL/Fields.thy Mon Apr 14 10:55:56 2014 +0200 +++ b/src/HOL/Fields.thy Mon Apr 14 13:08:17 2014 +0200 @@ -1083,6 +1083,21 @@ "(b / a < 1) = ((0 < a & b < a) | (a < 0 & a < b) | a=0)" by (auto simp add: divide_less_eq) +lemma divide_nonneg_nonneg [simp]: + "0 \ x \ 0 \ y \ 0 \ x / y" + by (auto simp add: divide_simps) + +lemma divide_nonpos_nonpos: + "x \ 0 \ y \ 0 \ 0 \ x / y" + by (auto simp add: divide_simps) + +lemma divide_nonneg_nonpos: + "0 \ x \ y \ 0 \ x / y \ 0" + by (auto simp add: divide_simps) + +lemma divide_nonpos_nonneg: + "x \ 0 \ 0 \ y \ x / y \ 0" + by (auto simp add: divide_simps) text {*Conditional Simplification Rules: No Case Splits*} diff -r 282f3b06fa86 -r f4635657d66f src/HOL/Library/Convex.thy --- a/src/HOL/Library/Convex.thy Mon Apr 14 10:55:56 2014 +0200 +++ b/src/HOL/Library/Convex.thy Mon Apr 14 13:08:17 2014 +0200 @@ -138,7 +138,7 @@ with `0 \ setsum a s` have "0 < setsum a s" by simp then have "(\j\s. (a j / setsum a s) *\<^sub>R y j) \ C" using `\j\s. 0 \ a j` and `\j\s. y j \ C` - by (simp add: IH divide_nonneg_pos setsum_divide_distrib [symmetric]) + by (simp add: IH setsum_divide_distrib [symmetric]) from `convex C` and `y i \ C` and this and `0 \ a i` and `0 \ setsum a s` and `a i + setsum a s = 1` have "a i *\<^sub>R y i + setsum a s *\<^sub>R (\j\s. (a j / setsum a s) *\<^sub>R y j) \ C" @@ -432,9 +432,7 @@ then have "a i < 1" using asm by auto then have i0: "1 - a i > 0" by auto let ?a = "\j. a j / (1 - a i)" - { fix j assume "j \ s" - then have "?a j \ 0" - using i0 asms divide_nonneg_pos + { fix j assume "j \ s" with i0 asms have "?a j \ 0" by fastforce } note a_nonneg = this have "(\ j \ insert i s. a j) = 1" using asms by auto diff -r 282f3b06fa86 -r f4635657d66f src/HOL/Library/Float.thy --- a/src/HOL/Library/Float.thy Mon Apr 14 10:55:56 2014 +0200 +++ b/src/HOL/Library/Float.thy Mon Apr 14 13:08:17 2014 +0200 @@ -1108,7 +1108,7 @@ shows "0 \ real (lapprox_rat n x y)" using assms unfolding lapprox_rat_def p_def[symmetric] round_down_def real_of_int_minus[symmetric] powr_int[of 2, simplified] - by (auto simp add: inverse_eq_divide intro!: mult_nonneg_nonneg divide_nonneg_pos) + by auto lemma rapprox_rat: "real x / real y \ real (rapprox_rat prec x y)" using round_up by (simp add: rapprox_rat_def) diff -r 282f3b06fa86 -r f4635657d66f src/HOL/Multivariate_Analysis/Brouwer_Fixpoint.thy --- a/src/HOL/Multivariate_Analysis/Brouwer_Fixpoint.thy Mon Apr 14 10:55:56 2014 +0200 +++ b/src/HOL/Multivariate_Analysis/Brouwer_Fixpoint.thy Mon Apr 14 13:08:17 2014 +0200 @@ -64,11 +64,6 @@ apply auto done -lemma divide_nonneg_nonneg: - fixes a b :: "'a :: {linordered_field, field_inverse_zero}" - shows "a \ 0 \ b \ 0 \ 0 \ a / b" - by (cases "b = 0") (auto intro!: divide_nonneg_pos) - lemma setsum_Un_disjoint': assumes "finite A" and "finite B" diff -r 282f3b06fa86 -r f4635657d66f src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy --- a/src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy Mon Apr 14 10:55:56 2014 +0200 +++ b/src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy Mon Apr 14 13:08:17 2014 +0200 @@ -2262,10 +2262,7 @@ using Min_ge_iff[of i 0 ] and obt(1) unfolding t_def i_def using obt(4)[unfolded le_less] - apply auto - unfolding divide_le_0_iff - apply auto - done + by (auto simp: divide_le_0_iff) have t: "\v\s. u v + t * w v \ 0" proof fix v @@ -5056,7 +5053,7 @@ apply(rule *[OF _ assms(2)]) unfolding mem_Collect_eq using `b > 0` assms(3) - apply (auto intro!: divide_nonneg_pos) + apply auto done ultimately obtain u y where obt: "u\0" "u \ b / norm x" "y = u *\<^sub>R x" "y \ ?A" "y \ s" "\z\?A \ s. dist 0 z \ dist 0 y" @@ -5218,8 +5215,6 @@ from nor have y: "y = norm y *\<^sub>R ((inverse (norm x)) *\<^sub>R x)" unfolding as(3)[unfolded pi_def] by auto have "0 \ norm y * inverse (norm x)" and "0 \ norm x * inverse (norm y)" - unfolding divide_inverse[symmetric] - apply (rule_tac[!] divide_nonneg_pos) using nor apply auto done @@ -5230,7 +5225,7 @@ using x y and front_smul[THEN bspec, OF as(1), THEN spec[where x="norm y * (inverse (norm x))"]] using front_smul[THEN bspec, OF as(2), THEN spec[where x="norm x * (inverse (norm y))"]] using xys nor - apply (auto simp add:field_simps divide_le_eq_1 divide_inverse[symmetric]) + apply (auto simp add: field_simps) done then show "x = y" apply (subst injpi[symmetric]) @@ -6412,9 +6407,7 @@ next assume as: "dist a b = dist a x + dist x b" have "norm (a - x) / norm (a - b) \ 1" - unfolding divide_le_eq_1_pos[OF Fal2] - unfolding as[unfolded dist_norm] norm_ge_zero - by auto + using Fal2 unfolding as[unfolded dist_norm] norm_ge_zero by auto then show "\u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \ 0 \ u \ u \ 1" apply (rule_tac x="dist a x / dist a b" in exI) unfolding dist_norm @@ -6422,8 +6415,7 @@ apply rule defer apply rule - apply (rule divide_nonneg_pos) - prefer 4 + prefer 3 apply rule proof - fix i :: 'a diff -r 282f3b06fa86 -r f4635657d66f src/HOL/Multivariate_Analysis/Fashoda.thy --- a/src/HOL/Multivariate_Analysis/Fashoda.thy Mon Apr 14 10:55:56 2014 +0200 +++ b/src/HOL/Multivariate_Analysis/Fashoda.thy Mon Apr 14 13:08:17 2014 +0200 @@ -16,11 +16,6 @@ lemma axis_in_Basis: "a \ Basis \ axis i a \ Basis" by (auto simp add: Basis_vec_def axis_eq_axis) -lemma divide_nonneg_nonneg: - fixes a b :: "'a :: {linordered_field, field_inverse_zero}" - shows "a \ 0 \ b \ 0 \ 0 \ a / b" - by (cases "b = 0") (auto intro!: divide_nonneg_pos) - subsection {*Bijections between intervals. *} definition interval_bij :: "'a \ 'a \ 'a \ 'a \ 'a \ 'a::euclidean_space" @@ -60,7 +55,7 @@ have x: "a\i\x\i" "x\i\b\i" using assms(1)[unfolded mem_box] using i by auto have "0 \ (x \ i - a \ i) / (b \ i - a \ i) * (v \ i - u \ i)" - using * x by (auto intro!: mult_nonneg_nonneg divide_nonneg_nonneg) + using * x by auto then show "u \ i \ u \ i + (x \ i - a \ i) / (b \ i - a \ i) * (v \ i - u \ i)" using * by auto have "((x \ i - a \ i) / (b \ i - a \ i)) * (v \ i - u \ i) \ 1 * (v \ i - u \ i)" diff -r 282f3b06fa86 -r f4635657d66f src/HOL/Probability/Distributions.thy --- a/src/HOL/Probability/Distributions.thy Mon Apr 14 10:55:56 2014 +0200 +++ b/src/HOL/Probability/Distributions.thy Mon Apr 14 13:08:17 2014 +0200 @@ -277,7 +277,7 @@ unfolding emeasure_eq_ereal_measure[OF fin] using A by (simp add: measure_def) finally show "(\\<^sup>+ x. ereal (indicator A x / measure lborel A * indicator {..a} x) \lborel) = ereal (measure lborel (A \ {..a}) / r)" . -qed (auto intro!: divide_nonneg_nonneg measure_nonneg) +qed (auto simp: measure_nonneg) lemma (in prob_space) uniform_distrI_borel_atLeastAtMost: fixes a b :: real diff -r 282f3b06fa86 -r f4635657d66f src/HOL/Probability/Information.thy --- a/src/HOL/Probability/Information.thy Mon Apr 14 10:55:56 2014 +0200 +++ b/src/HOL/Probability/Information.thy Mon Apr 14 13:08:17 2014 +0200 @@ -130,7 +130,7 @@ KL_divergence b (density M f) (density (density M f) (\x. g x / f x))" using f g ac by (subst density_density_divide) simp_all also have "\ = (\x. (g x / f x) * log b (g x / f x) \density M f)" - using f g `1 < b` by (intro Mf.KL_density) (auto simp: AE_density divide_nonneg_nonneg) + using f g `1 < b` by (intro Mf.KL_density) (auto simp: AE_density) also have "\ = (\x. g x * log b (g x / f x) \M)" using ac f g `1 < b` by (subst integral_density) (auto intro!: integral_cong_AE) finally show ?thesis . @@ -332,7 +332,7 @@ from f g show "(\x. g x / f x) \ borel_measurable (density M f)" by auto show "AE x in density M f. 0 \ g x / f x" - using f g by (auto simp: AE_density divide_nonneg_nonneg) + using f g by (auto simp: AE_density) show "integrable (density M f) (\x. g x / f x * log b (g x / f x))" using `1 < b` f g ac by (subst integral_density) @@ -804,8 +804,7 @@ using D apply (subst eq_commute) apply (intro RN_deriv_unique_sigma_finite) - apply (auto intro: divide_nonneg_nonneg measure_nonneg - simp: distributed_distr_eq_density[symmetric, OF X] sf) + apply (auto simp: distributed_distr_eq_density[symmetric, OF X] sf measure_nonneg) done qed @@ -1102,7 +1101,7 @@ apply (rule positive_integral_mono_AE) using ae5 ae6 ae7 ae8 apply eventually_elim - apply (auto intro!: divide_nonneg_nonneg) + apply auto done also have "\ = (\\<^sup>+(y, z). \\<^sup>+ x. ereal (Pxz (x, z)) * ereal (Pyz (y, z) / Pz z) \S \T \\<^sub>M P)" by (subst STP.positive_integral_snd_measurable[symmetric]) (auto simp add: split_beta') @@ -1115,7 +1114,7 @@ "(\\<^sup>+ x. ereal (Pxz (x, b)) \S) = ereal (Pz b)" "0 \ Pyz (a, b)" then show "(\\<^sup>+ x. ereal (Pxz (x, b)) * ereal (Pyz (a, b) / Pz b) \S) = ereal (Pyz (a, b))" by (subst positive_integral_multc) - (auto intro!: divide_nonneg_nonneg split: prod.split) + (auto split: prod.split) qed also have "\ = 1" using Q.emeasure_space_1 distributed_AE[OF Pyz] distributed_distr_eq_density[OF Pyz] @@ -1151,7 +1150,7 @@ apply simp using ae5 ae6 ae7 ae8 apply eventually_elim - apply (auto intro!: divide_nonneg_nonneg) + apply auto done have I3: "integrable (S \\<^sub>M T \\<^sub>M P) (\(x, y, z). Pxyz (x, y, z) * log b (Pxyz (x, y, z) / (Pxz (x, z) * (Pyz (y,z) / Pz z))))" @@ -1347,7 +1346,7 @@ apply (rule positive_integral_mono_AE) using ae5 ae6 ae7 ae8 apply eventually_elim - apply (auto intro!: divide_nonneg_nonneg) + apply auto done also have "\ = (\\<^sup>+(y, z). \\<^sup>+ x. ereal (Pxz (x, z)) * ereal (Pyz (y, z) / Pz z) \S \T \\<^sub>M P)" by (subst STP.positive_integral_snd_measurable[symmetric]) @@ -1360,7 +1359,7 @@ fix a b assume "Pz b = 0 \ Pyz (a, b) = 0" "0 \ Pz b" "a \ space T \ b \ space P" "(\\<^sup>+ x. ereal (Pxz (x, b)) \S) = ereal (Pz b)" "0 \ Pyz (a, b)" then show "(\\<^sup>+ x. ereal (Pxz (x, b)) * ereal (Pyz (a, b) / Pz b) \S) = ereal (Pyz (a, b))" - by (subst positive_integral_multc) (auto intro!: divide_nonneg_nonneg) + by (subst positive_integral_multc) auto qed also have "\ = 1" using Q.emeasure_space_1 distributed_AE[OF Pyz] distributed_distr_eq_density[OF Pyz] @@ -1396,7 +1395,7 @@ apply (auto simp: split_beta') [] using ae5 ae6 ae7 ae8 apply eventually_elim - apply (auto intro!: divide_nonneg_nonneg) + apply auto done have I3: "integrable (S \\<^sub>M T \\<^sub>M P) (\(x, y, z). Pxyz (x, y, z) * log b (Pxyz (x, y, z) / (Pxz (x, z) * (Pyz (y,z) / Pz z))))" diff -r 282f3b06fa86 -r f4635657d66f src/HOL/Probability/Lebesgue_Integration.thy --- a/src/HOL/Probability/Lebesgue_Integration.thy Mon Apr 14 10:55:56 2014 +0200 +++ b/src/HOL/Probability/Lebesgue_Integration.thy Mon Apr 14 13:08:17 2014 +0200 @@ -303,7 +303,7 @@ mult_nonpos_nonneg) next fix y assume *: "\i. i \ UNIV \ ?g i x \ y" - have "\i. 0 \ ?g i x" by (auto simp: divide_nonneg_pos) + have "\i. 0 \ ?g i x" by auto from order_trans[OF this *] have "0 \ y" by simp show "max 0 (u x) \ y" proof (cases y) @@ -330,7 +330,7 @@ then show "max 0 (u x) \ y" using real ux by simp qed (insert `0 \ y`, auto) qed - qed (auto simp: divide_nonneg_pos) + qed auto qed lemma borel_measurable_implies_simple_function_sequence': diff -r 282f3b06fa86 -r f4635657d66f src/HOL/Rat.thy --- a/src/HOL/Rat.thy Mon Apr 14 10:55:56 2014 +0200 +++ b/src/HOL/Rat.thy Mon Apr 14 13:08:17 2014 +0200 @@ -578,7 +578,7 @@ by (cases "b = 0", simp, simp add: of_int_rat) moreover have "0 \ Fract (a mod b) b \ Fract (a mod b) b < 1" unfolding Fract_of_int_quotient - by (rule linorder_cases [of b 0]) (simp add: divide_nonpos_neg, simp, simp add: divide_nonneg_pos) + by (rule linorder_cases [of b 0]) (simp_all add: divide_nonpos_neg) ultimately show ?thesis by simp qed diff -r 282f3b06fa86 -r f4635657d66f src/HOL/Real.thy --- a/src/HOL/Real.thy Mon Apr 14 10:55:56 2014 +0200 +++ b/src/HOL/Real.thy Mon Apr 14 13:08:17 2014 +0200 @@ -1136,8 +1136,6 @@ apply (simp add: algebra_simps) apply (subst real_of_int_div_aux) apply simp - apply (subst zero_le_divide_iff) - apply auto apply (simp add: algebra_simps) apply (subst real_of_int_div_aux) apply simp @@ -1269,8 +1267,6 @@ apply (simp add: algebra_simps) apply (subst real_of_nat_div_aux) apply simp -apply (subst zero_le_divide_iff) -apply simp done lemma real_of_nat_div3: diff -r 282f3b06fa86 -r f4635657d66f src/HOL/Transcendental.thy --- a/src/HOL/Transcendental.thy Mon Apr 14 10:55:56 2014 +0200 +++ b/src/HOL/Transcendental.thy Mon Apr 14 13:08:17 2014 +0200 @@ -1494,10 +1494,7 @@ also have "- (x / (1 - x)) <= ..." proof - have "ln (1 + x / (1 - x)) <= x / (1 - x)" - apply (rule ln_add_one_self_le_self) - apply (rule divide_nonneg_pos) - using a c apply auto - done + using a c by (intro ln_add_one_self_le_self) auto thus ?thesis by auto qed @@ -1586,11 +1583,8 @@ also have "... = 1 + (y - x) / x" using x a by (simp add: field_simps) also have "x * ln(1 + (y - x) / x) <= x * ((y - x) / x)" - apply (rule mult_left_mono) - apply (rule ln_add_one_self_le_self) - apply (rule divide_nonneg_pos) - using x a apply simp_all - done + using x a + by (intro mult_left_mono ln_add_one_self_le_self) simp_all also have "... = y - x" using a by simp also have "... = (y - x) * ln (exp 1)" by simp also have "... <= (y - x) * ln x" @@ -3906,9 +3900,6 @@ hence low2: "- (pi / 2) < y / 2" and high2: "y / 2 < pi / 2" by auto - have divide_nonzero_divide: "\A B C :: real. C \ 0 \ A / B = (A / C) / (B / C)" - by auto - have "0 < cos y" using cos_gt_zero_pi[OF low high] . hence "cos y \ 0" and cos_sqrt: "sqrt ((cos y)\<^sup>2) = cos y" by auto @@ -3922,7 +3913,7 @@ finally have "1 + (tan y)\<^sup>2 = 1 / (cos y)\<^sup>2" . have "sin y / (cos y + 1) = tan y / ((cos y + 1) / cos y)" - unfolding tan_def divide_nonzero_divide[OF `cos y \ 0`, symmetric] .. + unfolding tan_def using `cos y \ 0` by (simp add: field_simps) also have "\ = tan y / (1 + 1 / cos y)" using `cos y \ 0` unfolding add_divide_distrib by auto also have "\ = tan y / (1 + 1 / sqrt ((cos y)\<^sup>2))"