# HG changeset patch # User paulson # Date 1672352065 0 # Node ID 8a17349143df036db561f28b5333ea46ce6f5c17 # Parent 947510ce4e36fce5d5f74cc8e2dd473661f672cc# Parent 25c0d4c0e1105cfeb42bc47b7c819ecde5fc4fc3 merged diff -r 947510ce4e36 -r 8a17349143df src/HOL/Analysis/Complex_Transcendental.thy --- a/src/HOL/Analysis/Complex_Transcendental.thy Thu Dec 29 16:44:45 2022 +0100 +++ b/src/HOL/Analysis/Complex_Transcendental.thy Thu Dec 29 22:14:25 2022 +0000 @@ -660,15 +660,10 @@ lemma norm_sin_squared: "norm(sin z) ^ 2 = (exp(2 * Im z) + inverse(exp(2 * Im z)) - 2 * cos(2 * Re z)) / 4" -proof (cases z) - case (Complex x1 x2) - then show ?thesis - apply (simp only: sin_add cmod_power2 cos_of_real sin_of_real cos_double_cos exp_double Complex_eq) - apply (simp add: cos_exp_eq sin_exp_eq exp_minus exp_of_real Re_divide Im_divide power_divide) - apply (simp only: left_diff_distrib [symmetric] power_mult_distrib cos_squared_eq) - apply (simp add: power2_eq_square field_split_simps) - done -qed + using cos_double_sin [of "Re z"] + apply (simp add: sin_cos_eq norm_cos_squared exp_minus mult.commute [of _ 2] exp_double) + apply (simp add: algebra_simps power2_eq_square) + done lemma exp_uminus_Im: "exp (- Im z) \ exp (cmod z)" using abs_Im_le_cmod linear order_trans by fastforce @@ -1002,17 +997,14 @@ lemma Arg2pi_times_of_real [simp]: assumes "0 < r" shows "Arg2pi (of_real r * z) = Arg2pi z" -proof (cases "z=0") - case False - show ?thesis - by (rule Arg2pi_unique [of "r * norm z"]) (use Arg2pi False assms is_Arg_def in auto) -qed auto + by (metis (no_types, lifting) Arg2pi Arg2pi_eq Arg2pi_unique assms mult.assoc + mult_eq_0_iff mult_pos_pos of_real_mult zero_less_norm_iff) lemma Arg2pi_times_of_real2 [simp]: "0 < r \ Arg2pi (z * of_real r) = Arg2pi z" by (metis Arg2pi_times_of_real mult.commute) lemma Arg2pi_divide_of_real [simp]: "0 < r \ Arg2pi (z / of_real r) = Arg2pi z" - by (metis Arg2pi_times_of_real2 less_numeral_extra(3) nonzero_eq_divide_eq of_real_eq_0_iff) + by (metis Arg2pi_times_of_real2 less_irrefl nonzero_eq_divide_eq of_real_eq_0_iff) lemma Arg2pi_le_pi: "Arg2pi z \ pi \ 0 \ Im z" proof (cases "z=0") @@ -1095,12 +1087,14 @@ lemma Arg2pi_eq_iff: assumes "w \ 0" "z \ 0" - shows "Arg2pi w = Arg2pi z \ (\x. 0 < x & w = of_real x * z)" - using assms Arg2pi_eq [of z] Arg2pi_eq [of w] - apply auto - apply (rule_tac x="norm w / norm z" in exI) - apply (simp add: field_split_simps) - by (metis mult.commute mult.left_commute) + shows "Arg2pi w = Arg2pi z \ (\x. 0 < x & w = of_real x * z)" (is "?lhs = ?rhs") +proof + assume ?lhs + then have "(cmod w) * (z / cmod z) = w" + by (metis Arg2pi_eq assms(2) mult_eq_0_iff nonzero_mult_div_cancel_left) + then show ?rhs + by (metis assms divide_pos_pos of_real_divide times_divide_eq_left times_divide_eq_right zero_less_norm_iff) +qed auto lemma Arg2pi_inverse_eq_0: "Arg2pi(inverse z) = 0 \ Arg2pi z = 0" by (metis Arg2pi_eq_0 Arg2pi_inverse inverse_inverse_eq) @@ -1142,19 +1136,20 @@ using Arg2pi_add [OF assms] by auto -lemma Arg2pi_cnj_eq_inverse: "z\0 \ Arg2pi (cnj z) = Arg2pi (inverse z)" - apply (simp add: Arg2pi_eq_iff field_split_simps complex_norm_square [symmetric]) - by (metis of_real_power zero_less_norm_iff zero_less_power) +lemma Arg2pi_cnj_eq_inverse: + assumes "z \ 0" shows "Arg2pi (cnj z) = Arg2pi (inverse z)" +proof - + have "\r>0. of_real r / z = cnj z" + by (metis assms complex_norm_square nonzero_mult_div_cancel_left zero_less_norm_iff zero_less_power) + then show ?thesis + by (metis Arg2pi_times_of_real2 divide_inverse_commute) +qed lemma Arg2pi_cnj: "Arg2pi(cnj z) = (if z \ \ then Arg2pi z else 2*pi - Arg2pi z)" -proof (cases "z=0") - case False - then show ?thesis - by (simp add: Arg2pi_cnj_eq_inverse Arg2pi_inverse) -qed auto + by (metis Arg2pi_cnj_eq_inverse Arg2pi_inverse Reals_cnj_iff complex_cnj_zero) lemma Arg2pi_exp: "0 \ Im z \ Im z < 2*pi \ Arg2pi(exp z) = Im z" - by (rule Arg2pi_unique [of "exp(Re z)"]) (auto simp: exp_eq_polar) + by (simp add: Arg2pi_unique exp_eq_polar) lemma complex_split_polar: obtains r a::real where "z = complex_of_real r * (cos a + \ * sin a)" "0 \ r" "0 \ a" "a < 2*pi" @@ -2215,21 +2210,13 @@ lemma Arg_times_of_real [simp]: assumes "0 < r" shows "Arg (of_real r * z) = Arg z" -proof (cases "z=0") - case True - then show ?thesis - by (simp add: Arg_def) -next - case False - with Arg_eq assms show ?thesis - by (auto simp: mpi_less_Arg Arg_le_pi intro!: Arg_unique [of "r * norm z"]) -qed + using Arg_def Ln_times_of_real assms by auto lemma Arg_times_of_real2 [simp]: "0 < r \ Arg (z * of_real r) = Arg z" by (metis Arg_times_of_real mult.commute) lemma Arg_divide_of_real [simp]: "0 < r \ Arg (z / of_real r) = Arg z" - by (metis Arg_times_of_real2 less_numeral_extra(3) nonzero_eq_divide_eq of_real_eq_0_iff) + by (metis Arg_times_of_real2 less_irrefl nonzero_eq_divide_eq of_real_eq_0_iff) lemma Arg_less_0: "0 \ Arg z \ 0 \ Im z" using Im_Ln_le_pi Im_Ln_pos_le @@ -2243,18 +2230,13 @@ by (auto simp: order.order_iff_strict Arg_def) lemma Arg_eq_0: "Arg z = 0 \ z \ \ \ 0 \ Re z" - using complex_is_Real_iff - by (simp add: Arg_def Im_Ln_eq_0) (metis less_eq_real_def of_real_Re of_real_def scale_zero_left) + using Arg_def Im_Ln_eq_0 complex_eq_iff complex_is_Real_iff by auto corollary\<^marker>\tag unimportant\ Arg_ne_0: assumes "z \ \\<^sub>\\<^sub>0" shows "Arg z \ 0" using assms by (auto simp: nonneg_Reals_def Arg_eq_0) lemma Arg_eq_pi_iff: "Arg z = pi \ z \ \ \ Re z < 0" -proof (cases "z=0") - case False - then show ?thesis - using Arg_eq_0 [of "-z"] Arg_eq_pi complex_is_Real_iff by blast -qed (simp add: Arg_def) + using Arg_eq_pi complex_is_Real_iff by blast lemma Arg_eq_0_pi: "Arg z = 0 \ Arg z = pi \ z \ \" using Arg_eq_pi_iff Arg_eq_0 by force @@ -2266,15 +2248,11 @@ proof (cases "z \ \") case True then show ?thesis - by simp (metis Arg2pi_inverse Arg2pi_real Arg_real Reals_inverse) + by (metis Arg2pi_inverse Arg2pi_real Arg_real Reals_inverse) next case False - then have z: "Arg z < pi" "z \ 0" - using Arg_eq_0_pi Arg_le_pi by (auto simp: less_eq_real_def) - show ?thesis - apply (rule Arg_unique [of "inverse (norm z)"]) - using False z mpi_less_Arg [of z] Arg_eq [of z] - by (auto simp: exp_minus field_simps) + then show ?thesis + by (simp add: Arg_def Ln_inverse complex_is_Real_iff complex_nonpos_Reals_iff) qed lemma Arg_eq_iff: @@ -2282,7 +2260,7 @@ shows "Arg w = Arg z \ (\x. 0 < x \ w = of_real x * z)" (is "?lhs = ?rhs") proof assume ?lhs - then have "w = complex_of_real (cmod w / cmod z) * z" + then have "w = (cmod w / cmod z) * z" by (metis Arg_eq assms divide_divide_eq_right eq_divide_eq exp_not_eq_zero of_real_divide) then show ?rhs using assms divide_pos_pos zero_less_norm_iff by blast @@ -2307,14 +2285,11 @@ assumes "z \ \\<^sub>\\<^sub>0" shows "continuous (at z) Arg" proof - - have [simp]: "(\z. Im (Ln z)) \z\ Arg z" + have "(\z. Im (Ln z)) \z\ Arg z" using Arg_def assms continuous_at by fastforce - show ?thesis + then show ?thesis unfolding continuous_at - proof (rule Lim_transform_within_open) - show "\w. \w \ - \\<^sub>\\<^sub>0; w \ z\ \ Im (Ln w) = Arg w" - by (metis Arg_def Compl_iff nonpos_Reals_zero_I) - qed (use assms in auto) + by (smt (verit, del_insts) Arg_eq_Im_Ln Lim_transform_away_at assms nonpos_Reals_zero_I) qed lemma continuous_within_Arg: "z \ \\<^sub>\\<^sub>0 \ continuous (at z within S) Arg" @@ -2388,44 +2363,17 @@ qed next show "arctan (Im z / Re z) > -pi" - by (rule le_less_trans[OF _ arctan_lbound]) auto + by (smt (verit, ccfv_SIG) arctan field_sum_of_halves) next - have "arctan (Im z / Re z) < pi / 2" - by (rule arctan_ubound) - also have "\ \ pi" by simp - finally show "arctan (Im z / Re z) \ pi" - by simp + show "arctan (Im z / Re z) \ pi" + by (smt (verit, best) arctan field_sum_of_halves) qed subsection\<^marker>\tag unimportant\\Relation between Ln and Arg2pi, and hence continuity of Arg2pi\ -lemma Arg2pi_Ln: - assumes "0 < Arg2pi z" shows "Arg2pi z = Im(Ln(-z)) + pi" -proof (cases "z = 0") - case True - with assms show ?thesis - by simp -next - case False - then have "z / of_real(norm z) = exp(\ * of_real(Arg2pi z))" - using Arg2pi [of z] - by (metis is_Arg_def abs_norm_cancel nonzero_mult_div_cancel_left norm_of_real zero_less_norm_iff) - then have "- z / of_real(norm z) = exp (\ * (of_real (Arg2pi z) - pi))" - using cis_conv_exp cis_pi - by (auto simp: exp_diff algebra_simps) - then have "ln (- z / of_real(norm z)) = ln (exp (\ * (of_real (Arg2pi z) - pi)))" - by simp - also have "\ = \ * (of_real(Arg2pi z) - pi)" - using Arg2pi [of z] assms pi_not_less_zero - by auto - finally have "Arg2pi z = Im (Ln (- z / of_real (cmod z))) + pi" - by simp - also have "\ = Im (Ln (-z) - ln (cmod z)) + pi" - by (metis diff_0_right minus_diff_eq zero_less_norm_iff Ln_divide_of_real False) - also have "\ = Im (Ln (-z)) + pi" - by simp - finally show ?thesis . -qed +lemma Arg2pi_Ln: "0 < Arg2pi z \ Arg2pi z = Im(Ln(-z)) + pi" + by (smt (verit, best) Arg2pi_0 Arg2pi_exp Arg2pi_minus Arg_exp Arg_minus Im_Ln_le_pi + exp_Ln mpi_less_Im_Ln neg_equal_0_iff_equal) lemma continuous_at_Arg2pi: assumes "z \ \\<^sub>\\<^sub>0" @@ -2433,18 +2381,14 @@ proof - have *: "isCont (\z. Im (Ln (- z)) + pi) z" by (rule Complex.isCont_Im isCont_Ln' continuous_intros | simp add: assms complex_is_Real_iff)+ - have [simp]: "Im x \ 0 \ Im (Ln (- x)) + pi = Arg2pi x" for x - using Arg2pi_Ln by (simp add: Arg2pi_gt_0 complex_nonneg_Reals_iff) consider "Re z < 0" | "Im z \ 0" using assms using complex_nonneg_Reals_iff not_le by blast - then have [simp]: "(\z. Im (Ln (- z)) + pi) \z\ Arg2pi z" + then have "(\z. Im (Ln (- z)) + pi) \z\ Arg2pi z" using "*" by (simp add: Arg2pi_Ln Arg2pi_gt_0 assms continuous_within) - show ?thesis + then show ?thesis unfolding continuous_at - proof (rule Lim_transform_within_open) - show "\x. \x \ - \\<^sub>\\<^sub>0; x \ z\ \ Im (Ln (- x)) + pi = Arg2pi x" - by (auto simp add: Arg2pi_Ln [OF Arg2pi_gt_0] complex_nonneg_Reals_iff) - qed (use assms in auto) + by (metis (mono_tags, lifting) Arg2pi_Ln Arg2pi_gt_0 Compl_iff Lim_transform_within_open assms + closed_nonneg_Reals_complex open_Compl) qed @@ -2467,18 +2411,7 @@ lemma Arg2pi_eq_Im_Ln: assumes "0 \ Im z" "0 < Re z" shows "Arg2pi z = Im (Ln z)" -proof (cases "Im z = 0") - case True then show ?thesis - using Arg2pi_eq_0 Ln_in_Reals assms(2) complex_is_Real_iff by auto -next - case False - then have *: "Arg2pi z > 0" - using Arg2pi_gt_0 complex_is_Real_iff by blast - then have "z \ 0" - by auto - with * assms False show ?thesis - by (subst Arg2pi_Ln) (auto simp: Ln_minus) -qed + by (smt (verit, ccfv_SIG) Arg2pi_exp Im_Ln_pos_le assms exp_Ln pi_neq_zero zero_complex.simps(1)) lemma continuous_within_upperhalf_Arg2pi: assumes "z \ 0" @@ -2681,9 +2614,7 @@ also have "\ \ ((\z. g z ^ nat n) has_field_derivative dd') (at z within S)" proof (rule has_field_derivative_cong_eventually) show "\\<^sub>F x in at z within S. g x powr of_int n = g x ^ nat n" - unfolding eventually_at - apply (rule exI[where x=e]) - using powr_of_int that \e>0\ e_dist by (simp add: dist_commute) + unfolding eventually_at by (metis e_dist \e>0\ dist_commute powr_of_int that) qed (use powr_of_int \g z\0\ that in simp) also have "\" unfolding dd'_def using gderiv that by (auto intro!: derivative_eq_intros) @@ -2707,8 +2638,7 @@ proof (rule has_field_derivative_cong_eventually) show "\\<^sub>F x in at z within S. g x powr of_int n = inverse (g x ^ nat (- n))" unfolding eventually_at - apply (rule exI[where x=e]) - using powr_of_int that \e>0\ e_dist by (simp add: dist_commute) + by (metis \e>0\ e_dist dist_commute linorder_not_le powr_of_int that) qed (use powr_of_int \g z\0\ that in simp) also have "\" proof - @@ -2759,8 +2689,8 @@ using field_differentiable_def has_field_derivative_powr_right by blast lemma holomorphic_on_powr_right [holomorphic_intros]: - assumes "f holomorphic_on s" - shows "(\z. w powr (f z)) holomorphic_on s" + assumes "f holomorphic_on S" + shows "(\z. w powr (f z)) holomorphic_on S" proof (cases "w = 0") case False with assms show ?thesis @@ -2769,21 +2699,9 @@ qed simp lemma holomorphic_on_divide_gen [holomorphic_intros]: - assumes f: "f holomorphic_on s" and g: "g holomorphic_on s" and 0: "\z z'. \z \ s; z' \ s\ \ g z = 0 \ g z' = 0" -shows "(\z. f z / g z) holomorphic_on s" -proof (cases "\z\s. g z = 0") - case True - with 0 have "g z = 0" if "z \ s" for z - using that by blast - then show ?thesis - using g holomorphic_transform by auto -next - case False - with 0 have "g z \ 0" if "z \ s" for z - using that by blast - with holomorphic_on_divide show ?thesis - using f g by blast -qed + assumes "f holomorphic_on S" "g holomorphic_on S" and "\z z'. \z \ S; z' \ S\ \ g z = 0 \ g z' = 0" + shows "(\z. f z / g z) holomorphic_on S" + by (metis (no_types, lifting) assms division_ring_divide_zero holomorphic_on_divide holomorphic_transform) lemma norm_powr_real_powr: "w \ \ \ 0 \ Re w \ cmod (w powr z) = Re w powr Re z" @@ -2879,6 +2797,7 @@ lemma tendsto_neg_powr_complex_of_nat: assumes "filterlim f at_top F" and "Re s < 0" shows "((\x. of_nat (f x) powr s) \ 0) F" + using tendsto_neg_powr_complex_of_real [of "real o f" F s] proof - have "((\x. of_real (real (f x)) powr s) \ 0) F" using assms(2) by (intro filterlim_compose[OF _ tendsto_neg_powr_complex_of_real] @@ -3093,29 +3012,18 @@ also have "\ = exp (Ln z / 2)" apply (rule csqrt_square) using cos_gt_zero_pi [of "(Im (Ln z) / 2)"] Im_Ln_le_pi mpi_less_Im_Ln assms - by (fastforce simp: Re_exp Im_exp ) + by (fastforce simp: Re_exp Im_exp) finally show ?thesis using assms csqrt_square by simp qed lemma csqrt_inverse: - assumes "z \ \\<^sub>\\<^sub>0" - shows "csqrt (inverse z) = inverse (csqrt z)" -proof (cases "z=0") - case False - then show ?thesis - using assms csqrt_exp_Ln Ln_inverse exp_minus - by (simp add: csqrt_exp_Ln Ln_inverse exp_minus) -qed auto - -lemma cnj_csqrt: - assumes "z \ \\<^sub>\\<^sub>0" - shows "cnj(csqrt z) = csqrt(cnj z)" -proof (cases "z=0") - case False - then show ?thesis - by (simp add: assms cnj_Ln csqrt_exp_Ln exp_cnj) -qed auto + "z \ \\<^sub>\\<^sub>0 \ csqrt (inverse z) = inverse (csqrt z)" + by (metis Ln_inverse csqrt_eq_0 csqrt_exp_Ln divide_minus_left exp_minus + inverse_nonzero_iff_nonzero) + +lemma cnj_csqrt: "z \ \\<^sub>\\<^sub>0 \ cnj(csqrt z) = csqrt(cnj z)" + by (metis cnj_Ln complex_cnj_divide complex_cnj_numeral complex_cnj_zero_iff csqrt_eq_0 csqrt_exp_Ln exp_cnj) lemma has_field_derivative_csqrt: assumes "z \ \\<^sub>\\<^sub>0" @@ -3175,8 +3083,8 @@ "continuous (at z within (\ \ {w. 0 \ Re(w)})) csqrt" proof (cases "z \ \\<^sub>\\<^sub>0") case True - have [simp]: "Im z = 0" and 0: "Re z < 0 \ z = 0" - using True cnj.code complex_cnj_zero_iff by (auto simp: Complex_eq complex_nonpos_Reals_iff) fastforce + then have [simp]: "Im z = 0" and 0: "Re z < 0 \ z = 0" + using complex_nonpos_Reals_iff complex_eq_iff by force+ show ?thesis using 0 proof @@ -3296,11 +3204,7 @@ have nzi: "((1 - \*z) * inverse (1 + \*z)) \ 0" using nz1 nz2 by auto have "Im ((1 - \*z) / (1 + \*z)) = 0 \ 0 < Re ((1 - \*z) / (1 + \*z))" - apply (simp add: divide_complex_def) - apply (simp add: divide_simps split: if_split_asm) - using assms - apply (auto simp: algebra_simps abs_square_less_1 [unfolded power2_eq_square]) - done + by (simp add: Im_complex_div_lemma Re_complex_div_lemma assms cmod_eq_Im) then have *: "((1 - \*z) / (1 + \*z)) \ \\<^sub>\\<^sub>0" by (auto simp add: complex_nonpos_Reals_iff) show "\Re(Arctan z)\ < pi/2" @@ -3483,7 +3387,7 @@ also have "\ = x" proof - have "(complex_of_real x)\<^sup>2 \ - 1" - by (metis diff_0_right minus_diff_eq mult_zero_left not_le of_real_1 of_real_eq_iff of_real_minus of_real_power power2_eq_square real_minus_mult_self_le zero_less_one) + by (smt (verit, best) Im_complex_of_real imaginary_unit.sel(2) of_real_minus power2_eq_iff power2_i) then show ?thesis by simp qed @@ -3526,22 +3430,8 @@ qed lemma arctan_inverse: - assumes "0 < x" - shows "arctan(inverse x) = pi/2 - arctan x" -proof - - have "arctan(inverse x) = arctan(inverse(tan(arctan x)))" - by (simp add: arctan) - also have "\ = arctan (tan (pi / 2 - arctan x))" - by (simp add: tan_cot) - also have "\ = pi/2 - arctan x" - proof - - have "0 < pi - arctan x" - using arctan_ubound [of x] pi_gt_zero by linarith - with assms show ?thesis - by (simp add: Transcendental.arctan_tan) - qed - finally show ?thesis . -qed + "0 < x \arctan(inverse x) = pi/2 - arctan x" + by (smt (verit, del_insts) arctan arctan_unique tan_cot zero_less_arctan_iff) lemma arctan_add_small: assumes "\x * y\ < 1" @@ -3590,7 +3480,7 @@ show "(\k. 1 / real (k * 2 + 1) * x ^ (k * 2 + 1)) \ 0 * 0" using assms by (intro tendsto_mult real_tendsto_divide_at_top) - (auto simp: filterlim_real_sequentially filterlim_sequentially_iff_filterlim_real + (auto simp: filterlim_sequentially_iff_filterlim_real intro!: real_tendsto_divide_at_top tendsto_power_zero filterlim_real_sequentially tendsto_eq_intros filterlim_at_top_mult_tendsto_pos filterlim_tendsto_add_at_top) qed simp @@ -3705,7 +3595,7 @@ ultimately show ?thesis apply (simp add: sin_exp_eq Arcsin_def Arcsin_body_lemma exp_minus divide_simps) apply (simp add: algebra_simps) - apply (simp add: power2_eq_square [symmetric] algebra_simps) + apply (simp add: right_diff_distrib flip: power2_eq_square) done qed @@ -3748,13 +3638,13 @@ by (metis Arcsin_sin) lemma Arcsin_0 [simp]: "Arcsin 0 = 0" - by (metis Arcsin_sin norm_zero pi_half_gt_zero real_norm_def sin_zero zero_complex.simps(1)) + by (simp add: Arcsin_unique) lemma Arcsin_1 [simp]: "Arcsin 1 = pi/2" - by (metis Arcsin_sin Im_complex_of_real Re_complex_of_real numeral_One of_real_numeral pi_half_ge_zero real_sqrt_abs real_sqrt_pow2 real_sqrt_power sin_of_real sin_pi_half) + using Arcsin_unique sin_of_real_pi_half by fastforce lemma Arcsin_minus_1 [simp]: "Arcsin(-1) = - (pi/2)" - by (metis Arcsin_1 Arcsin_sin Im_complex_of_real Re_complex_of_real abs_of_nonneg of_real_minus pi_half_ge_zero power2_minus real_sqrt_abs sin_Arcsin sin_minus) + by (simp add: Arcsin_unique) lemma has_field_derivative_Arcsin: assumes "Im z = 0 \ \Re z\ < 1" @@ -3800,8 +3690,7 @@ using Arcsin_range_lemma [of "-z"] by simp lemma Arccos_body_lemma: "z + \ * csqrt(1 - z\<^sup>2) \ 0" - using Arcsin_body_lemma [of z] - by (metis Arcsin_body_lemma complex_i_mult_minus diff_minus_eq_add power2_minus right_minus_eq) + by (metis Arcsin_body_lemma complex_i_mult_minus diff_0 diff_eq_eq power2_minus) lemma Re_Arccos: "Re(Arccos z) = Im (Ln (z + \ * csqrt(1 - z\<^sup>2)))" by (simp add: Arccos_def) @@ -3811,7 +3700,7 @@ text\A very tricky argument to find!\ lemma isCont_Arccos_lemma: - assumes eq0: "Im (z + \ * csqrt (1 - z\<^sup>2)) = 0" and "(Im z = 0 \ \Re z\ < 1)" + assumes eq0: "Im (z + \ * csqrt (1 - z\<^sup>2)) = 0" and "Im z = 0 \ \Re z\ < 1" shows False proof (cases "Im z = 0") case True @@ -3987,8 +3876,7 @@ have "Arccos w \ Arccos w \ pi\<^sup>2 + (cmod w)\<^sup>2" using Re by (simp add: dot_square_norm cmod_power2 [of "Arccos w"]) then have "cmod (Arccos w) \ pi + cmod (cos (Arccos w))" - apply (simp add: norm_le_square) - by (metis dot_square_norm norm_ge_zero norm_le_square pi_ge_zero triangle_lemma) + by (smt (verit) Im_Arccos_bound Re_Arccos_bound cmod_le cos_Arccos) then show "cmod (Arccos w) \ pi + cmod w" by auto qed @@ -3996,68 +3884,11 @@ subsection\<^marker>\tag unimportant\\Interrelations between Arcsin and Arccos\ -lemma cos_Arcsin_nonzero: - assumes "z\<^sup>2 \ 1" shows "cos(Arcsin z) \ 0" -proof - - have eq: "(\ * z * (csqrt (1 - z\<^sup>2)))\<^sup>2 = z\<^sup>2 * (z\<^sup>2 - 1)" - by (simp add: algebra_simps) - have "\ * z * (csqrt (1 - z\<^sup>2)) \ z\<^sup>2 - 1" - proof - assume "\ * z * (csqrt (1 - z\<^sup>2)) = z\<^sup>2 - 1" - then have "(\ * z * (csqrt (1 - z\<^sup>2)))\<^sup>2 = (z\<^sup>2 - 1)\<^sup>2" - by simp - then have "z\<^sup>2 * (z\<^sup>2 - 1) = (z\<^sup>2 - 1)*(z\<^sup>2 - 1)" - using eq power2_eq_square by auto - then show False - using assms by simp - qed - then have "1 + \ * z * (csqrt (1 - z * z)) \ z\<^sup>2" - by (metis add_minus_cancel power2_eq_square uminus_add_conv_diff) - then have "2*(1 + \ * z * (csqrt (1 - z * z))) \ 2*z\<^sup>2" (*FIXME cancel_numeral_factor*) - by (metis mult_cancel_left zero_neq_numeral) - then have "(\ * z + csqrt (1 - z\<^sup>2))\<^sup>2 \ -1" - using assms - apply (simp add: power2_sum) - apply (simp add: power2_eq_square algebra_simps) - done - then show ?thesis - apply (simp add: cos_exp_eq Arcsin_def exp_minus) - apply (simp add: divide_simps Arcsin_body_lemma) - apply (metis add.commute minus_unique power2_eq_square) - done -qed - -lemma sin_Arccos_nonzero: - assumes "z\<^sup>2 \ 1" shows "sin(Arccos z) \ 0" -proof - - have eq: "(\ * z * (csqrt (1 - z\<^sup>2)))\<^sup>2 = -(z\<^sup>2) * (1 - z\<^sup>2)" - by (simp add: algebra_simps) - have "\ * z * (csqrt (1 - z\<^sup>2)) \ 1 - z\<^sup>2" - proof - assume "\ * z * (csqrt (1 - z\<^sup>2)) = 1 - z\<^sup>2" - then have "(\ * z * (csqrt (1 - z\<^sup>2)))\<^sup>2 = (1 - z\<^sup>2)\<^sup>2" - by simp - then have "-(z\<^sup>2) * (1 - z\<^sup>2) = (1 - z\<^sup>2)*(1 - z\<^sup>2)" - using eq power2_eq_square by auto - then have "-(z\<^sup>2) = (1 - z\<^sup>2)" - using assms - by (metis add.commute add.right_neutral diff_add_cancel mult_right_cancel) - then show False - using assms by simp - qed - then have "z\<^sup>2 + \ * z * (csqrt (1 - z\<^sup>2)) \ 1" - by (simp add: algebra_simps) - then have "2*(z\<^sup>2 + \ * z * (csqrt (1 - z\<^sup>2))) \ 2*1" - by (metis mult_cancel_left2 zero_neq_numeral) (*FIXME cancel_numeral_factor*) - then have "(z + \ * csqrt (1 - z\<^sup>2))\<^sup>2 \ 1" - using assms - by (metis Arccos_def add.commute add.left_neutral cancel_comm_monoid_add_class.diff_cancel cos_Arccos csqrt_0 mult_zero_right) - then show ?thesis - apply (simp add: sin_exp_eq Arccos_def exp_minus) - apply (simp add: divide_simps Arccos_body_lemma) - apply (simp add: power2_eq_square) - done -qed +lemma cos_Arcsin_nonzero: "z\<^sup>2 \ 1 \cos(Arcsin z) \ 0" + by (metis diff_0_right power_zero_numeral sin_Arcsin sin_squared_eq) + +lemma sin_Arccos_nonzero: "z\<^sup>2 \ 1 \sin(Arccos z) \ 0" + by (metis add.right_neutral cos_Arccos power2_eq_square power_zero_numeral sin_cos_squared_add3) lemma cos_sin_csqrt: assumes "0 < cos(Re z) \ cos(Re z) = 0 \ Im z * sin(Re z) \ 0" @@ -4076,185 +3907,51 @@ qed (use assms in \auto simp: Re_sin Im_sin add_pos_pos mult_le_0_iff zero_le_mult_iff\) lemma Arcsin_Arccos_csqrt_pos: - "(0 < Re z | Re z = 0 & 0 \ Im z) \ Arcsin z = Arccos(csqrt(1 - z\<^sup>2))" + "(0 < Re z \ Re z = 0 \ 0 \ Im z) \ Arcsin z = Arccos(csqrt(1 - z\<^sup>2))" by (simp add: Arcsin_def Arccos_def Complex.csqrt_square add.commute) lemma Arccos_Arcsin_csqrt_pos: - "(0 < Re z | Re z = 0 & 0 \ Im z) \ Arccos z = Arcsin(csqrt(1 - z\<^sup>2))" + "(0 < Re z \ Re z = 0 \ 0 \ Im z) \ Arccos z = Arcsin(csqrt(1 - z\<^sup>2))" by (simp add: Arcsin_def Arccos_def Complex.csqrt_square add.commute) lemma sin_Arccos: - "0 < Re z | Re z = 0 & 0 \ Im z \ sin(Arccos z) = csqrt(1 - z\<^sup>2)" + "0 < Re z \ Re z = 0 \ 0 \ Im z \ sin(Arccos z) = csqrt(1 - z\<^sup>2)" by (simp add: Arccos_Arcsin_csqrt_pos) lemma cos_Arcsin: - "0 < Re z | Re z = 0 & 0 \ Im z \ cos(Arcsin z) = csqrt(1 - z\<^sup>2)" + "0 < Re z \ Re z = 0 \ 0 \ Im z \ cos(Arcsin z) = csqrt(1 - z\<^sup>2)" by (simp add: Arcsin_Arccos_csqrt_pos) subsection\<^marker>\tag unimportant\\Relationship with Arcsin on the Real Numbers\ -lemma Im_Arcsin_of_real: - assumes "\x\ \ 1" - shows "Im (Arcsin (of_real x)) = 0" -proof - - have "csqrt (1 - (of_real x)\<^sup>2) = (if x^2 \ 1 then sqrt (1 - x^2) else \ * sqrt (x^2 - 1))" - by (simp add: of_real_sqrt del: csqrt_of_real_nonneg) - then have "cmod (\ * of_real x + csqrt (1 - (of_real x)\<^sup>2))^2 = 1" - using assms abs_square_le_1 - by (force simp add: Complex.cmod_power2) - then have "cmod (\ * of_real x + csqrt (1 - (of_real x)\<^sup>2)) = 1" - by (simp add: norm_complex_def) - then show ?thesis - by (simp add: Im_Arcsin exp_minus) -qed +lemma of_real_arcsin: "\x\ \ 1 \ of_real(arcsin x) = Arcsin(of_real x)" + by (smt (verit, best) Arcsin_sin Im_complex_of_real Re_complex_of_real arcsin sin_of_real) + +lemma Im_Arcsin_of_real: "\x\ \ 1 \ Im (Arcsin (of_real x)) = 0" + by (metis Im_complex_of_real of_real_arcsin) corollary\<^marker>\tag unimportant\ Arcsin_in_Reals [simp]: "z \ \ \ \Re z\ \ 1 \ Arcsin z \ \" by (metis Im_Arcsin_of_real Re_complex_of_real Reals_cases complex_is_Real_iff) -lemma arcsin_eq_Re_Arcsin: - assumes "\x\ \ 1" - shows "arcsin x = Re (Arcsin (of_real x))" -unfolding arcsin_def -proof (rule the_equality, safe) - show "- (pi / 2) \ Re (Arcsin (complex_of_real x))" - using Re_Ln_pos_le [OF Arcsin_body_lemma, of "of_real x"] - by (auto simp: Complex.in_Reals_norm Re_Arcsin) -next - show "Re (Arcsin (complex_of_real x)) \ pi / 2" - using Re_Ln_pos_le [OF Arcsin_body_lemma, of "of_real x"] - by (auto simp: Complex.in_Reals_norm Re_Arcsin) -next - show "sin (Re (Arcsin (complex_of_real x))) = x" - using Re_sin [of "Arcsin (of_real x)"] Arcsin_body_lemma [of "of_real x"] - by (simp add: Im_Arcsin_of_real assms) -next - fix x' - assume "- (pi / 2) \ x'" "x' \ pi / 2" "x = sin x'" - then show "x' = Re (Arcsin (complex_of_real (sin x')))" - unfolding sin_of_real [symmetric] - by (subst Arcsin_sin) auto -qed - -lemma of_real_arcsin: "\x\ \ 1 \ of_real(arcsin x) = Arcsin(of_real x)" - by (metis Im_Arcsin_of_real add.right_neutral arcsin_eq_Re_Arcsin complex_eq mult_zero_right of_real_0) +lemma arcsin_eq_Re_Arcsin: "\x\ \ 1 \ arcsin x = Re (Arcsin (of_real x))" + by (metis Re_complex_of_real of_real_arcsin) subsection\<^marker>\tag unimportant\\Relationship with Arccos on the Real Numbers\ -lemma Im_Arccos_of_real: - assumes "\x\ \ 1" - shows "Im (Arccos (of_real x)) = 0" -proof - - have "csqrt (1 - (of_real x)\<^sup>2) = (if x^2 \ 1 then sqrt (1 - x^2) else \ * sqrt (x^2 - 1))" - by (simp add: of_real_sqrt del: csqrt_of_real_nonneg) - then have "cmod (of_real x + \ * csqrt (1 - (of_real x)\<^sup>2))^2 = 1" - using assms abs_square_le_1 - by (force simp add: Complex.cmod_power2) - then have "cmod (of_real x + \ * csqrt (1 - (of_real x)\<^sup>2)) = 1" - by (simp add: norm_complex_def) - then show ?thesis - by (simp add: Im_Arccos exp_minus) -qed +lemma of_real_arccos: "\x\ \ 1 \ of_real(arccos x) = Arccos(of_real x)" + by (smt (verit, del_insts) Arccos_unique Im_complex_of_real Re_complex_of_real arccos_lbound + arccos_ubound cos_arccos_abs cos_of_real) + +lemma Im_Arccos_of_real: "\x\ \ 1 \ Im (Arccos (of_real x)) = 0" + by (metis Im_complex_of_real of_real_arccos) corollary\<^marker>\tag unimportant\ Arccos_in_Reals [simp]: "z \ \ \ \Re z\ \ 1 \ Arccos z \ \" - by (metis Im_Arccos_of_real Re_complex_of_real Reals_cases complex_is_Real_iff) - -lemma arccos_eq_Re_Arccos: - assumes "\x\ \ 1" - shows "arccos x = Re (Arccos (of_real x))" -unfolding arccos_def -proof (rule the_equality, safe) - show "0 \ Re (Arccos (complex_of_real x))" - using Im_Ln_pos_le [OF Arccos_body_lemma, of "of_real x"] - by (auto simp: Complex.in_Reals_norm Re_Arccos) -next - show "Re (Arccos (complex_of_real x)) \ pi" - using Im_Ln_pos_le [OF Arccos_body_lemma, of "of_real x"] - by (auto simp: Complex.in_Reals_norm Re_Arccos) -next - show "cos (Re (Arccos (complex_of_real x))) = x" - using Re_cos [of "Arccos (of_real x)"] Arccos_body_lemma [of "of_real x"] - by (simp add: Im_Arccos_of_real assms) -next - fix x' - assume "0 \ x'" "x' \ pi" "x = cos x'" - then show "x' = Re (Arccos (complex_of_real (cos x')))" - unfolding cos_of_real [symmetric] - by (subst Arccos_cos) auto -qed - -lemma of_real_arccos: "\x\ \ 1 \ of_real(arccos x) = Arccos(of_real x)" - by (metis Im_Arccos_of_real add.right_neutral arccos_eq_Re_Arccos complex_eq mult_zero_right of_real_0) - -subsection\<^marker>\tag unimportant\\Some interrelationships among the real inverse trig functions\ - -lemma arccos_arctan: - assumes "-1 < x" "x < 1" - shows "arccos x = pi/2 - arctan(x / sqrt(1 - x\<^sup>2))" -proof - - have "arctan(x / sqrt(1 - x\<^sup>2)) - (pi/2 - arccos x) = 0" - proof (rule sin_eq_0_pi) - show "- pi < arctan (x / sqrt (1 - x\<^sup>2)) - (pi / 2 - arccos x)" - using arctan_lbound [of "x / sqrt(1 - x\<^sup>2)"] arccos_bounded [of x] assms - by (simp add: algebra_simps) - next - show "arctan (x / sqrt (1 - x\<^sup>2)) - (pi / 2 - arccos x) < pi" - using arctan_ubound [of "x / sqrt(1 - x\<^sup>2)"] arccos_bounded [of x] assms - by (simp add: algebra_simps) - next - show "sin (arctan (x / sqrt (1 - x\<^sup>2)) - (pi / 2 - arccos x)) = 0" - using assms - by (simp add: algebra_simps sin_diff cos_add sin_arccos sin_arctan cos_arctan - power2_eq_square square_eq_1_iff) - qed - then show ?thesis - by simp -qed - -lemma arcsin_plus_arccos: - assumes "-1 \ x" "x \ 1" - shows "arcsin x + arccos x = pi/2" -proof - - have "arcsin x = pi/2 - arccos x" - apply (rule sin_inj_pi) - using assms arcsin [OF assms] arccos [OF assms] - by (auto simp: algebra_simps sin_diff) - then show ?thesis - by (simp add: algebra_simps) -qed - -lemma arcsin_arccos_eq: "-1 \ x \ x \ 1 \ arcsin x = pi/2 - arccos x" - using arcsin_plus_arccos by force - -lemma arccos_arcsin_eq: "-1 \ x \ x \ 1 \ arccos x = pi/2 - arcsin x" - using arcsin_plus_arccos by force - -lemma arcsin_arctan: "-1 < x \ x < 1 \ arcsin x = arctan(x / sqrt(1 - x\<^sup>2))" - by (simp add: arccos_arctan arcsin_arccos_eq) - -lemma csqrt_1_diff_eq: "csqrt (1 - (of_real x)\<^sup>2) = (if x^2 \ 1 then sqrt (1 - x^2) else \ * sqrt (x^2 - 1))" - by ( simp add: of_real_sqrt del: csqrt_of_real_nonneg) - -lemma arcsin_arccos_sqrt_pos: "0 \ x \ x \ 1 \ arcsin x = arccos(sqrt(1 - x\<^sup>2))" - apply (simp add: abs_square_le_1 arcsin_eq_Re_Arcsin arccos_eq_Re_Arccos) - apply (subst Arcsin_Arccos_csqrt_pos) - apply (auto simp: power_le_one csqrt_1_diff_eq) - done - -lemma arcsin_arccos_sqrt_neg: "-1 \ x \ x \ 0 \ arcsin x = -arccos(sqrt(1 - x\<^sup>2))" - using arcsin_arccos_sqrt_pos [of "-x"] - by (simp add: arcsin_minus) - -lemma arccos_arcsin_sqrt_pos: "0 \ x \ x \ 1 \ arccos x = arcsin(sqrt(1 - x\<^sup>2))" - apply (simp add: abs_square_le_1 arcsin_eq_Re_Arcsin arccos_eq_Re_Arccos) - apply (subst Arccos_Arcsin_csqrt_pos) - apply (auto simp: power_le_one csqrt_1_diff_eq) - done - -lemma arccos_arcsin_sqrt_neg: "-1 \ x \ x \ 0 \ arccos x = pi - arcsin(sqrt(1 - x\<^sup>2))" - using arccos_arcsin_sqrt_pos [of "-x"] - by (simp add: arccos_minus) + by (metis Im_Arccos_of_real complex_is_Real_iff of_real_Re) + +lemma arccos_eq_Re_Arccos: "\x\ \ 1 \ arccos x = Re (Arccos (of_real x))" + by (metis Re_complex_of_real of_real_arccos) subsection\<^marker>\tag unimportant\\Continuity results for arcsin and arccos\ diff -r 947510ce4e36 -r 8a17349143df src/HOL/Analysis/Function_Topology.thy --- a/src/HOL/Analysis/Function_Topology.thy Thu Dec 29 16:44:45 2022 +0100 +++ b/src/HOL/Analysis/Function_Topology.thy Thu Dec 29 22:14:25 2022 +0000 @@ -118,12 +118,7 @@ have *: "f \ U" if "U \ \" and "\V\\. \i. i \ I \ Y V i \ topspace (X i) \ f i \ Y V i" and "\i\I. f i \ topspace (X i)" and "f \ extensional I" for f U - proof - - have "Pi\<^sub>E I (Y U) = U" - using Y \U \ \\ by blast - then show "f \ U" - using that unfolding PiE_def Pi_def by blast - qed + by (smt (verit) PiE_iff Y that) show "?TOP \ \(\U\\. ?F U) \ \\" by (auto simp: PiE_iff *) show "\\ \ ?TOP \ \(\U\\. ?F U)" @@ -158,18 +153,16 @@ using Y by force show "?G ` \ \ {Pi\<^sub>E I Y |Y. (\i. openin (X i) (Y i)) \ finite {i. Y i \ topspace (X i)}}" apply clarsimp - apply (rule_tac x=" (\i. if i = J U then Y U else topspace (X i))" in exI) + apply (rule_tac x= "(\i. if i = J U then Y U else topspace (X i))" in exI) apply (auto simp: *) done next show "(\U\\. ?G U) = ?TOP \ \\" proof have "(\\<^sub>E i\I. if i = J U then Y U else topspace (X i)) \ (\\<^sub>E i\I. topspace (X i))" - apply (clarsimp simp: PiE_iff Ball_def all_conj_distrib split: if_split_asm) - using Y \U \ \\ openin_subset by blast+ + by (simp add: PiE_mono Y \U \ \\ openin_subset) then have "(\U\\. ?G U) \ ?TOP" - using \U \ \\ - by fastforce + using \U \ \\ by fastforce moreover have "(\U\\. ?G U) \ \\" using PiE_mem Y by fastforce ultimately show "(\U\\. ?G U) \ ?TOP \ \\" @@ -211,24 +204,25 @@ assumes "openin (product_topology T I) U" "x \ U" shows "\X. x \ (\\<^sub>E i\I. X i) \ (\i. openin (T i) (X i)) \ finite {i. X i \ topspace (T i)} \ (\\<^sub>E i\I. X i) \ U" proof - - have "generate_topology_on {(\\<^sub>E i\I. X i) |X. (\i. openin (T i) (X i)) \ finite {i. X i \ topspace (T i)}} U" - using assms unfolding product_topology_def by (intro openin_topology_generated_by) auto - then have "\x. x\U \ \X. x \ (\\<^sub>E i\I. X i) \ (\i. openin (T i) (X i)) \ finite {i. X i \ topspace (T i)} \ (\\<^sub>E i\I. X i) \ U" + define IT where "IT \ \X. {i. X i \ topspace (T i)}" + have "generate_topology_on {(\\<^sub>E i\I. X i) |X. (\i. openin (T i) (X i)) \ finite (IT X)} U" + using assms unfolding product_topology_def IT_def by (intro openin_topology_generated_by) auto + then have "\x. x\U \ \X. x \ (\\<^sub>E i\I. X i) \ (\i. openin (T i) (X i)) \ finite (IT X) \ (\\<^sub>E i\I. X i) \ U" proof induction case (Int U V x) then obtain XU XV where H: - "x \ Pi\<^sub>E I XU" "(\i. openin (T i) (XU i))" "finite {i. XU i \ topspace (T i)}" "Pi\<^sub>E I XU \ U" - "x \ Pi\<^sub>E I XV" "(\i. openin (T i) (XV i))" "finite {i. XV i \ topspace (T i)}" "Pi\<^sub>E I XV \ V" - by auto meson + "x \ Pi\<^sub>E I XU" "\i. openin (T i) (XU i)" "finite (IT XU)" "Pi\<^sub>E I XU \ U" + "x \ Pi\<^sub>E I XV" "\i. openin (T i) (XV i)" "finite (IT XV)" "Pi\<^sub>E I XV \ V" + by (meson Int_iff) define X where "X = (\i. XU i \ XV i)" have "Pi\<^sub>E I X \ Pi\<^sub>E I XU \ Pi\<^sub>E I XV" - unfolding X_def by (auto simp add: PiE_iff) + by (auto simp add: PiE_iff X_def) then have "Pi\<^sub>E I X \ U \ V" using H by auto moreover have "\i. openin (T i) (X i)" unfolding X_def using H by auto - moreover have "finite {i. X i \ topspace (T i)}" - apply (rule rev_finite_subset[of "{i. XU i \ topspace (T i)} \ {i. XV i \ topspace (T i)}"]) - unfolding X_def using H by auto + moreover have "finite (IT X)" + apply (rule rev_finite_subset[of "IT XU \ IT XV"]) + using H by (auto simp: X_def IT_def) moreover have "x \ Pi\<^sub>E I X" unfolding X_def using H by auto ultimately show ?case @@ -236,16 +230,10 @@ next case (UN K x) then obtain k where "k \ K" "x \ k" by auto - with UN have "\X. x \ Pi\<^sub>E I X \ (\i. openin (T i) (X i)) \ finite {i. X i \ topspace (T i)} \ Pi\<^sub>E I X \ k" - by simp - then obtain X where "x \ Pi\<^sub>E I X \ (\i. openin (T i) (X i)) \ finite {i. X i \ topspace (T i)} \ Pi\<^sub>E I X \ k" - by blast - then have "x \ Pi\<^sub>E I X \ (\i. openin (T i) (X i)) \ finite {i. X i \ topspace (T i)} \ Pi\<^sub>E I X \ (\K)" - using \k \ K\ by auto - then show ?case - by auto + with \k \ K\ UN show ?case + by (meson Sup_upper2) qed auto - then show ?thesis using \x \ U\ by auto + then show ?thesis using \x \ U\ IT_def by blast qed lemma product_topology_empty_discrete: @@ -257,9 +245,7 @@ arbitrary union_of ((finite intersection_of (\F. (\i U. F = {f. f i \ U} \ i \ I \ openin (X i) U))) relative_to topspace (product_topology X I))" - apply (subst product_topology) - apply (simp add: topology_inverse' [OF istopology_subbase]) - done + by (simp add: istopology_subbase product_topology) lemma subtopology_PiE: "subtopology (product_topology X I) (\\<^sub>E i\I. (S i)) = product_topology (\i. subtopology (X i) (S i)) I" @@ -349,6 +335,7 @@ "openin (product_topology X I) S \ (\x \ S. \U. finite {i \ I. U i \ topspace(X i)} \ (\i \ I. openin (X i) (U i)) \ x \ Pi\<^sub>E I U \ Pi\<^sub>E I U \ S)" +sledgehammer [isar_proofs, provers = "cvc4 z3 spass e vampire verit", timeout = 77] unfolding openin_product_topology arbitrary_union_of_alt product_topology_base_alt topspace_product_topology apply safe apply (drule bspec; blast)+ @@ -438,9 +425,7 @@ corollary closedin_product_topology: "closedin (product_topology X I) (PiE I S) \ PiE I S = {} \ (\i \ I. closedin (X i) (S i))" - apply (simp add: PiE_eq PiE_eq_empty_iff closure_of_product_topology flip: closure_of_eq) - apply (metis closure_of_empty) - done + by (smt (verit, best) PiE_eq closedin_empty closure_of_eq closure_of_product_topology) corollary closedin_product_topology_singleton: "f \ extensional I \ closedin (product_topology X I) {f} \ (\i \ I. closedin (X i) {f i})" @@ -501,17 +486,13 @@ also have "... = (\i\J. (\x. f x i)-`(X i) \ topspace T1) \ (topspace T1)" using * \J \ I\ by auto also have "openin T1 (...)" - apply (rule openin_INT) - apply (simp add: \finite J\) - using H(2) assms(1) \J \ I\ by auto + using H(2) \J \ I\ \finite J\ assms(1) by blast ultimately show "openin T1 (f-`U \ topspace T1)" by simp next - show "f `topspace T1 \ \{Pi\<^sub>E I X |X. (\i. openin (T i) (X i)) \ finite {i. X i \ topspace (T i)}}" - apply (subst topology_generated_by_topspace[symmetric]) - apply (subst product_topology_def[symmetric]) - apply (simp only: topspace_product_topology) - apply (auto simp add: PiE_iff) - using assms unfolding continuous_map_def by auto + have "f ` topspace T1 \ topspace (product_topology T I)" + using assms continuous_map_def by fastforce + then show "f `topspace T1 \ \{Pi\<^sub>E I X |X. (\i. openin (T i) (X i)) \ finite {i. X i \ topspace (T i)}}" + by (simp add: product_topology_def) qed lemma continuous_map_product_then_coordinatewise [intro]: @@ -522,8 +503,7 @@ fix i assume "i \ I" have "(\x. f x i) = (\y. y i) o f" by auto also have "continuous_map T1 (T i) (...)" - apply (rule continuous_map_compose[of _ "product_topology T I"]) - using assms \i \ I\ by auto + by (metis \i \ I\ assms continuous_map_compose continuous_map_product_coordinates) ultimately show "continuous_map T1 (T i) (\x. f x i)" by simp next @@ -583,28 +563,14 @@ assumes "finite I" "\i. i \ I \ open (U i)" shows "open {f. \i\I. f (x i) \ U i}" proof - - define J where "J = x`I" - define V where "V = (\y. if y \ J then \{U i|i. i\I \ x i = y} else UNIV)" - define X where "X = (\y. if y \ J then V y else UNIV)" + define V where "V \ (\y. if y \ x`I then \{U i|i. i\I \ x i = y} else UNIV)" + define X where "X \ (\y. if y \ x`I then V y else UNIV)" have *: "open (X i)" for i unfolding X_def V_def using assms by auto - have **: "finite {i. X i \ UNIV}" - unfolding X_def V_def J_def using assms(1) by auto - have "open (Pi\<^sub>E UNIV X)" - by (simp add: "*" "**" open_PiE) + then have "open (Pi\<^sub>E UNIV X)" + by (simp add: X_def assms(1) open_PiE) moreover have "Pi\<^sub>E UNIV X = {f. \i\I. f (x i) \ U i}" - apply (auto simp add: PiE_iff) unfolding X_def V_def J_def - proof (auto) - fix f :: "'a \ 'b" and i :: 'i - assume a1: "i \ I" - assume a2: "\i. f i \ (if i \ x`I then if i \ x`I then \{U ia |ia. ia \ I \ x ia = i} else UNIV else UNIV)" - have f3: "x i \ x`I" - using a1 by blast - have "U i \ {U ia |ia. ia \ I \ x ia = x i}" - using a1 by blast - then show "f (x i) \ U i" - using f3 a2 by (meson Inter_iff) - qed + by (fastforce simp add: PiE_iff X_def V_def split: if_split_asm) ultimately show ?thesis by simp qed @@ -620,25 +586,13 @@ fixes f :: "'a::topological_space \ 'b \ 'c::topological_space" assumes "\i. continuous_on S (\x. f x i)" shows "continuous_on S f" - using continuous_map_coordinatewise_then_product [of UNIV, where T = "\i. euclidean"] - by (metis UNIV_I assms continuous_map_iff_continuous euclidean_product_topology) - -lemma continuous_on_product_then_coordinatewise_UNIV: - assumes "continuous_on UNIV f" - shows "continuous_on UNIV (\x. f x i)" - unfolding continuous_map_iff_continuous2 [symmetric] - by (rule continuous_map_product_then_coordinatewise [where I=UNIV]) (use assms in \auto simp: euclidean_product_topology\) + by (metis UNIV_I assms continuous_map_iff_continuous euclidean_product_topology + continuous_map_coordinatewise_then_product) lemma continuous_on_product_then_coordinatewise: assumes "continuous_on S f" shows "continuous_on S (\x. f x i)" -proof - - have "continuous_on S ((\q. q i) \ f)" - by (metis assms continuous_on_compose continuous_on_id - continuous_on_product_then_coordinatewise_UNIV continuous_on_subset subset_UNIV) - then show ?thesis - by auto -qed + by (metis UNIV_I assms continuous_map_iff_continuous continuous_map_product_then_coordinatewise(1) euclidean_product_topology) lemma continuous_on_coordinatewise_iff: fixes f :: "('a \ real) \ 'b \ real" @@ -679,16 +633,15 @@ next case (Suc N) define f::"((nat \ 'a) \ 'a) \ (nat \ 'a)" - where "f = (\(x, b). (\i. if i = N then b else x i))" + where "f = (\(x, b). x(N:=b))" have "{x. (\i. x i \ F) \ (\i\Suc N. x i = a)} \ f`({x. (\i. x i \ F) \ (\i\N. x i = a)} \ F)" proof (auto) fix x assume H: "\i::nat. x i \ F" "\i\Suc N. x i = a" - define y where "y = (\i. if i = N then a else x i)" - have "f (y, x N) = x" - unfolding f_def y_def by auto - moreover have "(y, x N) \ {x. (\i. x i \ F) \ (\i\N. x i = a)} \ F" - unfolding y_def using H \a \ F\ by auto - ultimately show "x \ f`({x. (\i. x i \ F) \ (\i\N. x i = a)} \ F)" + have "f (x(N:=a), x N) = x" + unfolding f_def by auto + moreover have "(x(N:=a), x N) \ {x. (\i. x i \ F) \ (\i\N. x i = a)} \ F" + using H \a \ F\ by auto + ultimately show "x \ f ` ({x. (\i. x i \ F) \ (\i\N. x i = a)} \ F)" by (metis (no_types, lifting) image_eqI) qed moreover have "countable ({x. (\i. x i \ F) \ (\i\N. x i = a)} \ F)" @@ -742,7 +695,7 @@ by metis text \\B i\ is a countable basis of neighborhoods of \x\<^sub>i\.\ define B where "B = (\i. (A (x i))`UNIV \ {UNIV})" - have "countable (B i)" for i unfolding B_def by auto + have countB: "countable (B i)" for i unfolding B_def by auto have open_B: "\X i. X \ B i \ open X" by (auto simp: B_def A) define K where "K = {Pi\<^sub>E UNIV X | X. (\i. X i \ B i) \ finite {i. X i \ UNIV}}" @@ -750,14 +703,14 @@ unfolding K_def B_def by auto then have "K \ {}" by auto have "countable {X. (\i. X i \ B i) \ finite {i. X i \ UNIV}}" - apply (rule countable_product_event_const) using \\i. countable (B i)\ by auto + by (simp add: countB countable_product_event_const) moreover have "K = (\X. Pi\<^sub>E UNIV X)`{X. (\i. X i \ B i) \ finite {i. X i \ UNIV}}" unfolding K_def by auto ultimately have "countable K" by auto - have "x \ k" if "k \ K" for k + have I: "x \ k" if "k \ K" for k using that unfolding K_def B_def apply auto using A(1) by auto - have "open k" if "k \ K" for k - using that unfolding K_def by (blast intro: open_B open_PiE elim: ) + have II: "open k" if "k \ K" for k + using that unfolding K_def by (blast intro: open_B open_PiE) have Inc: "\k\K. k \ U" if "open U \ x \ U" for U proof - have "openin (product_topology (\i. euclidean) UNIV) U" "x \ U" @@ -775,31 +728,28 @@ have *: "\y. y \ B i \ y \ X i" for i unfolding B_def using A(3)[OF H(2)] H(1) by (metis PiE_E UNIV_I UnCI image_iff) have **: "Y i \ B i \ Y i \ X i" for i - apply (cases "i \ I") - unfolding Y_def using * that apply (auto) - apply (metis (no_types, lifting) someI, metis (no_types, lifting) someI_ex subset_iff) - unfolding B_def apply simp - unfolding I_def apply auto - done + proof (cases "i \ I") + case True + then show ?thesis + by (metis (mono_tags, lifting) "*" Nitpick.Eps_psimp Y_def) + next + case False + then show ?thesis by (simp add: B_def I_def Y_def) + qed have "{i. Y i \ UNIV} \ I" unfolding Y_def by auto - then have ***: "finite {i. Y i \ UNIV}" - unfolding I_def using H(3) rev_finite_subset by blast - have "(\i. Y i \ B i) \ finite {i. Y i \ UNIV}" - using ** *** by auto + with ** have "(\i. Y i \ B i) \ finite {i. Y i \ UNIV}" + using H(3) I_def finite_subset by blast then have "Pi\<^sub>E UNIV Y \ K" unfolding K_def by auto - have "Y i \ X i" for i - apply (cases "i \ I") using ** apply simp unfolding Y_def I_def by auto - then have "Pi\<^sub>E UNIV Y \ Pi\<^sub>E UNIV X" by auto - then have "Pi\<^sub>E UNIV Y \ U" using H(4) by auto + using "**" by auto + then have "Pi\<^sub>E UNIV Y \ U" + by (metis H(4) PiE_mono subset_trans) then show ?thesis using \Pi\<^sub>E UNIV Y \ K\ by auto qed - show "\L. (\(i::nat). x \ L i \ open (L i)) \ (\U. open U \ x \ U \ (\i. L i \ U))" - apply (rule first_countableI[of K]) - using \countable K\ \\k. k \ K \ x \ k\ \\k. k \ K \ open k\ Inc by auto + using \countable K\ I II Inc by (simp add: first_countableI) qed proposition product_topology_countable_basis: @@ -821,7 +771,7 @@ unfolding K_def using \\U. U \ B2 \ open U\ by auto have "countable {X. (\(i::'a). X i \ B2) \ finite {i. X i \ UNIV}}" - apply (rule countable_product_event_const) using \countable B2\ by auto + using \countable B2\ by (intro countable_product_event_const) auto moreover have "K = (\X. Pi\<^sub>E UNIV X)`{X. (\i. X i \ B2) \ finite {i. X i \ UNIV}}" unfolding K_def by auto ultimately have ii: "countable K" by auto @@ -832,9 +782,7 @@ then have "openin (product_topology (\i. euclidean) UNIV) U" unfolding open_fun_def by auto with product_topology_open_contains_basis[OF this \x \ U\] - have "\X. x \ (\\<^sub>E i\UNIV. X i) \ (\i. open (X i)) \ finite {i. X i \ UNIV} \ (\\<^sub>E i\UNIV. X i) \ U" - by simp - then obtain X where H: "x \ (\\<^sub>E i\UNIV. X i)" + obtain X where H: "x \ (\\<^sub>E i\UNIV. X i)" "\i. open (X i)" "finite {i. X i \ UNIV}" "(\\<^sub>E i\UNIV. X i) \ U" @@ -845,29 +793,15 @@ have *: "\y. y \ B2 \ y \ X i \ x i \ y" for i unfolding B2_def using B \open (X i)\ \x i \ X i\ by (meson UnCI topological_basisE) have **: "Y i \ B2 \ Y i \ X i \ x i \ Y i" for i - using someI_ex[OF *] - apply (cases "i \ I") - unfolding Y_def using * apply (auto) - unfolding B2_def I_def by auto + using someI_ex[OF *] by (simp add: B2_def I_def Y_def) have "{i. Y i \ UNIV} \ I" unfolding Y_def by auto - then have ***: "finite {i. Y i \ UNIV}" - unfolding I_def using H(3) rev_finite_subset by blast - have "(\i. Y i \ B2) \ finite {i. Y i \ UNIV}" - using ** *** by auto + then have "(\i. Y i \ B2) \ finite {i. Y i \ UNIV}" + using "**" H(3) I_def finite_subset by blast then have "Pi\<^sub>E UNIV Y \ K" unfolding K_def by auto - - have "Y i \ X i" for i - apply (cases "i \ I") using ** apply simp unfolding Y_def I_def by auto - then have "Pi\<^sub>E UNIV Y \ Pi\<^sub>E UNIV X" by auto - then have "Pi\<^sub>E UNIV Y \ U" using H(4) by auto - - have "x \ Pi\<^sub>E UNIV Y" - using ** by auto - - show "\V\K. x \ V \ V \ U" - using \Pi\<^sub>E UNIV Y \ K\ \Pi\<^sub>E UNIV Y \ U\ \x \ Pi\<^sub>E UNIV Y\ by auto + then show "\V\K. x \ V \ V \ U" + by (meson "**" H(4) PiE_I PiE_mono UNIV_I order.trans) next fix U assume "U \ K" show "open U" @@ -878,9 +812,11 @@ qed instance "fun" :: (countable, second_countable_topology) second_countable_topology - apply standard - using product_topology_countable_basis topological_basis_imp_subbasis by auto - +proof + show "\B::('a \ 'b) set set. countable B \ open = generate_topology B" + using product_topology_countable_basis topological_basis_imp_subbasis + by auto +qed subsection\The Alexander subbase theorem\ @@ -1106,11 +1042,7 @@ qed ultimately show ?thesis by metis -next - case False - then show ?thesis - by (auto simp: continuous_map_def PiE_def) -qed +qed (auto simp: continuous_map_def PiE_def) lemma continuous_map_componentwise_UNIV: @@ -1147,8 +1079,7 @@ fix x f assume "f \ V" let ?T = "{a \ topspace(Y i). - (\j. if j = i then a - else if j \ I then f j else undefined) \ (\\<^sub>E i\I. topspace (Y i)) \ \\}" + (\j\I. f j)(i:=a) \ (\\<^sub>E i\I. topspace (Y i)) \ \\}" show "\T. openin (Y i) T \ f i \ T \ T \ (\f. f i) ` V" proof (intro exI conjI) show "openin (Y i) ?T" @@ -1164,8 +1095,8 @@ by simp (metis IntD1 PiE_iff V \f \ V\ that) qed then show "continuous_map (Y i) (product_topology Y I) - (\x j. if j = i then x else if j \ I then f j else undefined)" - by (auto simp: continuous_map_componentwise assms extensional_def) + (\x. (\j\I. f j)(i:=x))" + by (auto simp: continuous_map_componentwise assms extensional_def restrict_def) next have "openin (product_topology Y I) (\\<^sub>E i\I. topspace (Y i))" by (metis openin_topspace topspace_product_topology) @@ -1177,18 +1108,15 @@ show "\X. X \ (\) (\\<^sub>E i\I. topspace (Y i)) ` \ \ openin (product_topology Y I) X" unfolding openin_product_topology relative_to_def apply (clarify intro!: arbitrary_union_of_inc) - apply (rename_tac F) - apply (rule_tac x=F in exI) using subsetD [OF \] - apply (force intro: finite_intersection_of_inc) - done + by (metis (mono_tags, lifting) finite_intersection_of_inc mem_Collect_eq topspace_product_topology) qed (use \finite \\ \\ \ {}\ in auto) qed ultimately show "openin (product_topology Y I) ((\\<^sub>E i\I. topspace (Y i)) \ \\)" by (auto simp only: Int_Inter_eq split: if_split) qed next - have eqf: "(\j. if j = i then f i else if j \ I then f j else undefined) = f" + have eqf: "(\j\I. f j)(i:=f i) = f" using PiE_arb V \f \ V\ by force show "f i \ ?T" using V assms \f \ V\ by (auto simp: PiE_iff eqf) @@ -1273,10 +1201,8 @@ next assume ?rhs then show ?lhs - apply (simp only: openin_product_topology) - apply (rule arbitrary_union_of_inc) - apply (auto simp: product_topology_base_alt) - done + unfolding openin_product_topology + by (intro arbitrary_union_of_inc) (auto simp: product_topology_base_alt) qed ultimately show ?thesis by simp @@ -1306,9 +1232,7 @@ by (simp add: continuous_map_product_projection) moreover have "\x. x \ topspace (X i) \ x \ (\f. f i) ` (\\<^sub>E i\I. topspace (X i))" - using \i \ I\ z - apply (rule_tac x="\j. if j = i then x else if j \ I then z j else undefined" in image_eqI, auto) - done + using \i \ I\ z by (rule_tac x="z(i:=x)" in image_eqI) auto then have "(\f. f i) ` (\\<^sub>E i\I. topspace (X i)) = topspace (X i)" using \i \ I\ z by auto ultimately show "compactin (X i) (topspace (X i))" @@ -1461,7 +1385,7 @@ then have "(\x. x k) ` {x. x j \ V} = UNIV" if "k \ j" for k using that apply (clarsimp simp add: set_eq_iff) - apply (rule_tac x="\m. if m = k then x else f m" in image_eqI, auto) + apply (rule_tac x="f(k:=x)" in image_eqI, auto) done then have "{i. (\x. x i) ` C \ topspace (X i)} \ {j}" using Ceq by auto @@ -1493,7 +1417,7 @@ using PiE_ext \g \ U\ gin by force next case (insert i M) - define f where "f \ \j. if j = i then g i else h j" + define f where "f \ h(i:=g i)" have fin: "f \ PiE I (topspace \ X)" unfolding f_def using gin insert.prems(1) by auto have subM: "{j \ I. f j \ g j} \ M" @@ -1506,13 +1430,13 @@ show ?thesis proof (cases "i \ I") case True - let ?U = "{x \ topspace(X i). (\j. if j = i then x else h j) \ U}" - let ?V = "{x \ topspace(X i). (\j. if j = i then x else h j) \ V}" + let ?U = "{x \ topspace(X i). h(i:=x) \ U}" + let ?V = "{x \ topspace(X i). h(i:=x) \ V}" have False proof (rule connected_spaceD [OF cs [OF \i \ I\]]) have "\k. k \ I \ continuous_map (X i) (X k) (\x. if k = i then x else h k)" using continuous_map_eq_topcontinuous_at insert.prems(1) topcontinuous_at_def by fastforce - then have cm: "continuous_map (X i) (product_topology X I) (\x j. if j = i then x else h j)" + then have cm: "continuous_map (X i) (product_topology X I) (\x. h(i:=x))" using \i \ I\ insert.prems(1) by (auto simp: continuous_map_componentwise extensional_def) show "openin (X i) ?U" @@ -1522,45 +1446,23 @@ show "topspace (X i) \ ?U \ ?V" proof clarsimp fix x - assume "x \ topspace (X i)" and "(\j. if j = i then x else h j) \ V" + assume "x \ topspace (X i)" and "h(i:=x) \ V" with True subUV \h \ Pi\<^sub>E I (topspace \ X)\ - show "(\j. if j = i then x else h j) \ U" - by (drule_tac c="(\j. if j = i then x else h j)" in subsetD) auto + show "h(i:=x) \ U" + by (force dest: subsetD [where c="h(i:=x)"]) qed show "?U \ ?V = {}" using disj by blast show "?U \ {}" - using \U \ {}\ f_def - proof - - have "(\j. if j = i then g i else h j) \ U" - using \f \ U\ f_def by blast - moreover have "f i \ topspace (X i)" - by (metis PiE_iff True comp_apply fin) - ultimately have "\b. b \ topspace (X i) \ (\a. if a = i then b else h a) \ U" - using f_def by auto - then show ?thesis - by blast - qed - have "(\j. if j = i then h i else h j) = h" - by force - moreover have "h i \ topspace (X i)" - using True insert.prems(1) by auto - ultimately show "?V \ {}" - using \h \ V\ by force + using True \f \ U\ f_def gin by auto + show "?V \ {}" + using True \h \ V\ V openin_subset by fastforce qed then show ?thesis .. next case False show ?thesis - proof (cases "h = f") - case True - show ?thesis - by (rule insert.IH [OF insert.prems(1)]) (simp add: True subM) - next - case False - then show ?thesis - using gin insert.prems(1) \i \ I\ unfolding f_def by fastforce - qed + using insert.prems(1) by (metis False gin PiE_E \f \ U\ f_def fun_upd_triv) qed next case False @@ -1640,14 +1542,8 @@ assumes "i \ I" shows "quotient_map(product_topology X I) (X i) (\x. x i) \ (topspace(product_topology X I) = {} \ topspace(X i) = {})" - (is "?lhs = ?rhs") -proof - assume ?lhs with assms show ?rhs - by (auto simp: continuous_open_quotient_map open_map_product_projection) -next - assume ?rhs with assms show ?lhs - by (auto simp: Abstract_Topology.retraction_imp_quotient_map retraction_map_product_projection) -qed + by (metis assms image_empty quotient_imp_surjective_map retraction_imp_quotient_map + retraction_map_product_projection) lemma product_topology_homeomorphic_component: assumes "i \ I" "\j. \j \ I; j \ i\ \ \a. topspace(X j) = {a}" @@ -1676,9 +1572,8 @@ from that obtain f where f: "f \ (\\<^sub>E i\I. topspace (X i))" by force have "?SX f i homeomorphic_space X i" - apply (simp add: subtopology_PiE ) - using product_topology_homeomorphic_component [OF \i \ I\, of "\j. subtopology (X j) (if j = i then topspace (X i) else {f j})"] - using f by fastforce + using f product_topology_homeomorphic_component [OF \i \ I\, of "\j. subtopology (X j) (if j = i then topspace (X i) else {f j})"] + by (force simp add: subtopology_PiE) then show ?thesis using minor [OF f major \i \ I\] PQ by auto qed diff -r 947510ce4e36 -r 8a17349143df src/HOL/Analysis/Measure_Space.thy --- a/src/HOL/Analysis/Measure_Space.thy Thu Dec 29 16:44:45 2022 +0100 +++ b/src/HOL/Analysis/Measure_Space.thy Thu Dec 29 22:14:25 2022 +0000 @@ -26,9 +26,9 @@ proof (rule SUP_eqI) fix y :: ennreal assume "\n. n \ UNIV \ (if i < n then f i else 0) \ y" from this[of "Suc i"] show "f i \ y" by auto - qed (insert assms, simp) + qed (use assms in simp) ultimately show ?thesis using assms - by (subst suminf_eq_SUP) (auto simp: indicator_def) + by (simp add: suminf_eq_SUP) qed lemma suminf_indicator: @@ -71,11 +71,8 @@ by (induct n) (auto simp add: binaryset_def f) qed moreover - have "... \ f A + f B" by (rule tendsto_const) - ultimately - have "(\n. \i< Suc (Suc n). f (binaryset A B i)) \ f A + f B" - by metis - hence "(\n. \i< n+2. f (binaryset A B i)) \ f A + f B" + have "\ \ f A + f B" by (rule tendsto_const) + ultimately have "(\n. \i< n+2. f (binaryset A B i)) \ f A + f B" by simp thus ?thesis by (rule LIMSEQ_offset [where k=2]) qed @@ -83,7 +80,7 @@ lemma binaryset_sums: assumes f: "f {} = 0" shows "(\n. f (binaryset A B n)) sums (f A + f B)" - by (simp add: sums_def LIMSEQ_binaryset [where f=f, OF f] atLeast0LessThan) + using LIMSEQ_binaryset f sums_def by blast lemma suminf_binaryset_eq: fixes f :: "'a set \ 'b::{comm_monoid_add, t2_space}" @@ -148,7 +145,7 @@ by (auto simp add: increasing_def) lemma countably_additiveI[case_names countably]: - "(\A. range A \ M \ disjoint_family A \ (\i. A i) \ M \ (\i. f (A i)) = f (\i. A i)) + "(\A. \range A \ M; disjoint_family A; (\i. A i) \ M\ \ (\i. f(A i)) = f(\i. A i)) \ countably_additive M f" by (simp add: countably_additive_def) @@ -198,9 +195,9 @@ assume xy: "x \ M" "y \ M" "x \ y" then have "y - x \ M" by auto then have "f x + 0 \ f x + f (y-x)" by (intro add_left_mono zero_le) - also have "... = f (x \ (y-x))" using addf - by (auto simp add: additive_def) (metis Diff_disjoint Un_Diff_cancel Diff xy(1,2)) - also have "... = f y" + also have "\ = f (x \ (y-x))" + by (metis addf Diff_disjoint \y - x \ M\ additiveD xy(1)) + also have "\ = f y" by (metis Un_Diff_cancel Un_absorb1 xy(3)) finally show "f x \ f y" by simp qed @@ -222,9 +219,12 @@ also have "\ = f (A x) + f ((\i\F. A i) - A x)" using f(2) by (rule additiveD) (insert in_M, auto) also have "\ \ f (A x) + f (\i\F. A i)" - using additive_increasing[OF f] in_M subs by (auto simp: increasing_def intro: add_left_mono) - also have "\ \ f (A x) + (\i\F. f (A i))" using insert by (auto intro: add_left_mono) - finally show "f (\i\(insert x F). A i) \ (\i\(insert x F). f (A i))" using insert by simp + using additive_increasing[OF f] in_M subs + by (simp add: increasingD) + also have "\ \ f (A x) + (\i\F. f (A i))" + using insert by (auto intro: add_left_mono) + finally show "f (\i\(insert x F). A i) \ (\i\(insert x F). f (A i))" + by (simp add: insert) qed lemma (in ring_of_sets) countably_additive_additive: @@ -239,10 +239,8 @@ hence "range (binaryset x y) \ M \ (\i. binaryset x y i) \ M \ f (\i. binaryset x y i) = (\ n. f (binaryset x y n))" - using ca - by (simp add: countably_additive_def) - hence "{x,y,{}} \ M \ x \ y \ M \ - f (x \ y) = (\n. f (binaryset x y n))" + using ca by (simp add: countably_additive_def) + hence "{x,y,{}} \ M \ x \ y \ M \ f (x \ y) = (\n. f (binaryset x y n))" by (simp add: range_binaryset_eq UN_binaryset_eq) thus "f (x \ y) = f x + f y" using posf x y by (auto simp add: Un suminf_binaryset_eq positive_def) @@ -259,8 +257,8 @@ fix N note disj_N = disjoint_family_on_mono[OF _ disj, of "{..ii\{.. f \" using space_closed A + using A by (intro additive_sum [OF f ad]) (auto simp: disj_N) + also have "\ \ f \" using space_closed A by (intro increasingD[OF inc] finite_UN) auto finally show "(\i f \" by simp qed (insert f A, auto simp: positive_def) @@ -272,16 +270,10 @@ proof (rule countably_additiveI) fix F :: "nat \ 'a set" assume F: "range F \ M" "(\i. F i) \ M" and disj: "disjoint_family F" - have "\i\{i. F i \ {}}. \x. x \ F i" by auto - from bchoice[OF this] obtain f where f: "\i. F i \ {} \ f i \ F i" by auto - - have inj_f: "inj_on f {i. F i \ {}}" - proof (rule inj_onI, simp) - fix i j a b assume *: "f i = f j" "F i \ {}" "F j \ {}" - then have "f i \ F i" "f j \ F j" using f by force+ - with disj * show "i = j" by (auto simp: disjoint_family_on_def) - qed - have "finite (\i. F i)" + have "\i. F i \ {} \ (\x. x \ F i)" by auto + then obtain f where f: "\i. F i \ {} \ f i \ F i" by metis + + have finU: "finite (\i. F i)" by (metis F(2) assms(1) infinite_super sets_into_space) have F_subset: "{i. \ (F i) \ 0} \ {i. F i \ {}}" @@ -290,8 +282,11 @@ proof (rule finite_imageD) from f have "f`{i. F i \ {}} \ (\i. F i)" by auto then show "finite (f`{i. F i \ {}})" - by (rule finite_subset) fact - qed fact + by (simp add: finU finite_subset) + show inj_f: "inj_on f {i. F i \ {}}" + using f disj + by (simp add: inj_on_def disjoint_family_on_def disjoint_iff) metis + qed ultimately have fin_not_0: "finite {i. \ (F i) \ 0}" by (rule finite_subset) @@ -323,8 +318,7 @@ have f_UN: "(\i. f (disjointed A i)) = f (\i. A i)" by (auto simp: UN_disjointed_eq disjoint_family_disjointed) moreover have "(\n. (\i (\i. f (disjointed A i))" - using f(1)[unfolded positive_def] dA - by (auto intro!: summable_LIMSEQ) + by (simp add: summable_LIMSEQ) from LIMSEQ_Suc[OF this] have "(\n. (\i\n. f (disjointed A i))) \ (\i. f (disjointed A i))" unfolding lessThan_Suc_atMost . @@ -332,23 +326,21 @@ using disjointed_additive[OF f A(1,2)] . ultimately show "(\i. f (A i)) \ f (\i. A i)" by simp next - assume cont: "\A. range A \ M \ incseq A \ (\i. A i) \ M \ (\i. f (A i)) \ f (\i. A i)" + assume cont[rule_format]: "\A. range A \ M \ incseq A \ (\i. A i) \ M \ (\i. f (A i)) \ f (\i. A i)" fix A :: "nat \ 'a set" assume A: "range A \ M" "disjoint_family A" "(\i. A i) \ M" have *: "(\n. (\ii. A i)" by auto - have "(\n. f (\i f (\i. A i)" - proof (unfold *[symmetric], intro cont[rule_format]) - show "range (\i. \i M" "(\i. \i M" - using A * by auto - qed (force intro!: incseq_SucI) + have "range (\i. \i M" "(\i. \i M" + using A * by auto + then have "(\n. f (\i f (\i. A i)" + unfolding *[symmetric] by (force intro!: cont incseq_SucI)+ moreover have "\n. f (\iii. f (A i)) sums f (\i. A i)" unfolding sums_def by simp - from sums_unique[OF this] - show "(\i. f (A i)) = f (\i. A i)" by simp + then show "(\i. f (A i)) = f (\i. A i)" + by (metis sums_unique) qed lemma (in ring_of_sets) continuous_from_above_iff_empty_continuous: @@ -357,13 +349,15 @@ shows "(\A. range A \ M \ decseq A \ (\i. A i) \ M \ (\i. f (A i) \ \) \ (\i. f (A i)) \ f (\i. A i)) \ (\A. range A \ M \ decseq A \ (\i. A i) = {} \ (\i. f (A i) \ \) \ (\i. f (A i)) \ 0)" proof safe - assume cont: "(\A. range A \ M \ decseq A \ (\i. A i) \ M \ (\i. f (A i) \ \) \ (\i. f (A i)) \ f (\i. A i))" - fix A :: "nat \ 'a set" assume A: "range A \ M" "decseq A" "(\i. A i) = {}" "\i. f (A i) \ \" - with cont[THEN spec, of A] show "(\i. f (A i)) \ 0" + assume cont[rule_format]: "(\A. range A \ M \ decseq A \ (\i. A i) \ M \ (\i. f (A i) \ \) \ (\i. f (A i)) \ f (\i. A i))" + fix A :: "nat \ 'a set" + assume A: "range A \ M" "decseq A" "(\i. A i) = {}" "\i. f (A i) \ \" + with cont[of A] show "(\i. f (A i)) \ 0" using \positive M f\[unfolded positive_def] by auto next - assume cont: "\A. range A \ M \ decseq A \ (\i. A i) = {} \ (\i. f (A i) \ \) \ (\i. f (A i)) \ 0" - fix A :: "nat \ 'a set" assume A: "range A \ M" "decseq A" "(\i. A i) \ M" "\i. f (A i) \ \" + assume cont[rule_format]: "\A. range A \ M \ decseq A \ (\i. A i) = {} \ (\i. f (A i) \ \) \ (\i. f (A i)) \ 0" + fix A :: "nat \ 'a set" + assume A: "range A \ M" "decseq A" "(\i. A i) \ M" "\i. f (A i) \ \" have f_mono: "\a b. a \ M \ b \ M \ a \ b \ f a \ f b" using additive_increasing[OF f] unfolding increasing_def by simp @@ -378,23 +372,19 @@ using A by (auto intro!: f_mono) then have f_Int_fin: "f (\x. A x) \ \" using A by (auto simp: top_unique) - { fix i - have "f (A i - (\i. A i)) \ f (A i)" using A by (auto intro!: f_mono) - then have "f (A i - (\i. A i)) \ \" - using A by (auto simp: top_unique) } - note f_fin = this + have f_fin: "f (A i - (\i. A i)) \ \" for i + using A by (metis Diff Diff_subset f_mono infinity_ennreal_def range_subsetD top_unique) have "(\i. f (A i - (\i. A i))) \ 0" - proof (intro cont[rule_format, OF _ decseq _ f_fin]) + proof (intro cont[ OF _ decseq _ f_fin]) show "range (\i. A i - (\i. A i)) \ M" "(\i. A i - (\i. A i)) = {}" using A by auto qed - from INF_Lim[OF decseq_f this] - have "(INF n. f (A n - (\i. A i))) = 0" . + with INF_Lim decseq_f have "(INF n. f (A n - (\i. A i))) = 0" by metis moreover have "(INF n. f (\i. A i)) = f (\i. A i)" by auto ultimately have "(INF n. f (A n - (\i. A i)) + f (\i. A i)) = 0 + f (\i. A i)" using A(4) f_fin f_Int_fin - by (subst INF_ennreal_add_const) (auto simp: decseq_f) + using INF_ennreal_add_const by presburger moreover { fix n have "f (A n - (\i. A i)) + f (\i. A i) = f ((A n - (\i. A i)) \ (\i. A i))" @@ -424,7 +414,8 @@ also have "((\i. A i) - A i) \ A i = (\i. A i)" by auto finally have "f ((\i. A i) - A i) = f (\i. A i) - f (A i)" - using f(3)[rule_format, of "A i"] A by (auto simp: ennreal_add_diff_cancel subset_eq) } + using assms f by fastforce + } moreover have "\\<^sub>F i in sequentially. f (A i) \ f (\i. A i)" using increasingD[OF additive_increasing[OF f(1, 2)], of "A _" "\i. A i"] A by (auto intro!: always_eventually simp: subset_eq) @@ -502,17 +493,11 @@ by (metis emeasure_mono emeasure_notin_sets sets.sets_into_space sets.top zero_le) lemma emeasure_Diff: - assumes finite: "emeasure M B \ \" - and [measurable]: "A \ sets M" "B \ sets M" and "B \ A" + assumes "emeasure M B \ \" + and "A \ sets M" "B \ sets M" and "B \ A" shows "emeasure M (A - B) = emeasure M A - emeasure M B" -proof - - have "(A - B) \ B = A" using \B \ A\ by auto - then have "emeasure M A = emeasure M ((A - B) \ B)" by simp - also have "\ = emeasure M (A - B) + emeasure M B" - by (subst plus_emeasure[symmetric]) auto - finally show "emeasure M (A - B) = emeasure M A - emeasure M B" - using finite by simp -qed + by (smt (verit, best) add_diff_self_ennreal assms emeasure_Un emeasure_mono + ennreal_add_left_cancel le_iff_sup) lemma emeasure_compl: "s \ sets M \ emeasure M s \ \ \ emeasure M (space M - s) = emeasure M (space M) - emeasure M s" @@ -563,8 +548,7 @@ also have "\ = emeasure M (A 0) - emeasure M (\i. A i)" using A finite * by (simp, subst emeasure_Diff) auto finally show ?thesis - by (rule ennreal_minus_cancel[rotated 3]) - (insert finite A, auto intro: INF_lower emeasure_mono) + by (smt (verit, best) Inf_lower diff_diff_ennreal le_MI finite range_eqI) qed lemma INF_emeasure_decseq': @@ -580,7 +564,7 @@ have "(INF n. emeasure M (A n)) = (INF n. emeasure M (A (n + i)))" proof (rule INF_eq) show "\j\UNIV. emeasure M (A (j + i)) \ emeasure M (A i')" for i' - by (intro bexI[of _ i'] emeasure_mono decseqD[OF \decseq A\] A) auto + by (meson A \decseq A\ decseq_def emeasure_mono iso_tuple_UNIV_I nat_le_iff_add) qed auto also have "\ = emeasure M (INF n. (A (n + i)))" using A \decseq A\ fin by (intro INF_emeasure_decseq) (auto simp: decseq_def less_top) @@ -1118,7 +1102,7 @@ text \The next lemma is convenient to combine with a lemma whose conclusion is of the form \AE x in M. P x = Q x\: for such a lemma, there is no \[symmetric]\ variant, -but using \AE_symmetric[OF...]\ will replace it.\ +but using \AE_symmetric[OF\]\ will replace it.\ (* depricated replace by laws about eventually *) lemma @@ -1645,11 +1629,9 @@ have "emeasure M (A \ B) \ \" using emeasure_subadditive[OF measurable] fin by (auto simp: top_unique) then show "(measure M (A \ B)) \ (measure M A) + (measure M B)" - using emeasure_subadditive[OF measurable] fin - apply simp - apply (subst (asm) (2 3 4) emeasure_eq_ennreal_measure) - apply (auto simp flip: ennreal_plus) - done + unfolding measure_def + by (metis emeasure_subadditive[OF measurable] fin enn2real_mono enn2real_plus + ennreal_add_less_top infinity_ennreal_def less_top) qed lemma measure_subadditive_finite: @@ -1672,13 +1654,13 @@ assumes A: "range A \ sets M" and fin: "(\i. emeasure M (A i)) \ \" shows "measure M (\i. A i) \ (\i. measure M (A i))" proof - - from fin have **: "\i. emeasure M (A i) \ top" - using ennreal_suminf_lessD[of "\i. emeasure M (A i)"] by (simp add: less_top) - { have "emeasure M (\i. A i) \ (\i. emeasure M (A i))" - using emeasure_subadditive_countably[OF A] . - also have "\ < \" - using fin by (simp add: less_top) - finally have "emeasure M (\i. A i) \ top" by simp } + have **: "\i. emeasure M (A i) \ top" + using fin ennreal_suminf_lessD[of "\i. emeasure M (A i)"] by (simp add: less_top) + have ge0: "(\i. Sigma_Algebra.measure M (A i)) \ 0" + using fin emeasure_eq_ennreal_measure[OF **] + by (metis infinity_ennreal_def measure_nonneg suminf_cong suminf_nonneg summable_suminf_not_top) + have "emeasure M (\i. A i) \ top" + by (metis A emeasure_subadditive_countably fin infinity_ennreal_def neq_top_trans) then have "ennreal (measure M (\i. A i)) = emeasure M (\i. A i)" by (rule emeasure_eq_ennreal_measure[symmetric]) also have "\ \ (\i. emeasure M (A i))" @@ -1687,11 +1669,7 @@ using fin unfolding emeasure_eq_ennreal_measure[OF **] by (subst suminf_ennreal) (auto simp: **) finally show ?thesis - apply (rule ennreal_le_iff[THEN iffD1, rotated]) - apply (intro suminf_nonneg allI measure_nonneg summable_suminf_not_top) - using fin - apply (simp add: emeasure_eq_ennreal_measure[OF **]) - done + using ge0 ennreal_le_iff by blast qed lemma measure_Un_null_set: "A \ sets M \ B \ null_sets M \ measure M (A \ B) = measure M A" @@ -2038,11 +2016,11 @@ have "emeasure M (B N) \ (\n\{..n\{.. = (\n\{..n\{.. = ennreal (\n\{.. ennreal (\n. measure M (A n))" + also have "\ \ ennreal (\n. measure M (A n))" using * by (auto simp: ennreal_leI) finally show ?thesis by simp qed @@ -2069,9 +2047,9 @@ have I: "(\k\{n..}. A k) = (\k. A (k+n))" by (auto, metis le_add_diff_inverse2, fastforce) have "emeasure M (limsup A) \ emeasure M (\k\{n..}. A k)" by (rule emeasure_mono, auto simp add: limsup_INF_SUP) - also have "... = emeasure M (\k. A (k+n))" + also have "\ = emeasure M (\k. A (k+n))" using I by auto - also have "... \ (\k. measure M (A (k+n)))" + also have "\ \ (\k. measure M (A (k+n)))" apply (rule emeasure_union_summable) using assms summable_ignore_initial_segment[OF assms(3), of n] by auto finally show ?thesis by simp diff -r 947510ce4e36 -r 8a17349143df src/HOL/Transcendental.thy --- a/src/HOL/Transcendental.thy Thu Dec 29 16:44:45 2022 +0100 +++ b/src/HOL/Transcendental.thy Thu Dec 29 22:14:25 2022 +0000 @@ -5477,6 +5477,64 @@ using that by metis qed +lemma arccos_arctan: + assumes "-1 < x" "x < 1" + shows "arccos x = pi/2 - arctan(x / sqrt(1 - x\<^sup>2))" +proof - + have "arctan(x / sqrt(1 - x\<^sup>2)) - (pi/2 - arccos x) = 0" + proof (rule sin_eq_0_pi) + show "- pi < arctan (x / sqrt (1 - x\<^sup>2)) - (pi / 2 - arccos x)" + using arctan_lbound [of "x / sqrt(1 - x\<^sup>2)"] arccos_bounded [of x] assms + by (simp add: algebra_simps) + next + show "arctan (x / sqrt (1 - x\<^sup>2)) - (pi / 2 - arccos x) < pi" + using arctan_ubound [of "x / sqrt(1 - x\<^sup>2)"] arccos_bounded [of x] assms + by (simp add: algebra_simps) + next + show "sin (arctan (x / sqrt (1 - x\<^sup>2)) - (pi / 2 - arccos x)) = 0" + using assms + by (simp add: algebra_simps sin_diff cos_add sin_arccos sin_arctan cos_arctan + power2_eq_square square_eq_1_iff) + qed + then show ?thesis + by simp +qed + +lemma arcsin_plus_arccos: + assumes "-1 \ x" "x \ 1" + shows "arcsin x + arccos x = pi/2" +proof - + have "arcsin x = pi/2 - arccos x" + apply (rule sin_inj_pi) + using assms arcsin [OF assms] arccos [OF assms] + by (auto simp: algebra_simps sin_diff) + then show ?thesis + by (simp add: algebra_simps) +qed + +lemma arcsin_arccos_eq: "-1 \ x \ x \ 1 \ arcsin x = pi/2 - arccos x" + using arcsin_plus_arccos by force + +lemma arccos_arcsin_eq: "-1 \ x \ x \ 1 \ arccos x = pi/2 - arcsin x" + using arcsin_plus_arccos by force + +lemma arcsin_arctan: "-1 < x \ x < 1 \ arcsin x = arctan(x / sqrt(1 - x\<^sup>2))" + by (simp add: arccos_arctan arcsin_arccos_eq) + +lemma arcsin_arccos_sqrt_pos: "0 \ x \ x \ 1 \ arcsin x = arccos(sqrt(1 - x\<^sup>2))" + by (smt (verit, del_insts) arccos_cos arcsin_0 arcsin_le_arcsin arcsin_pi cos_arcsin) + +lemma arcsin_arccos_sqrt_neg: "-1 \ x \ x \ 0 \ arcsin x = -arccos(sqrt(1 - x\<^sup>2))" + using arcsin_arccos_sqrt_pos [of "-x"] + by (simp add: arcsin_minus) + +lemma arccos_arcsin_sqrt_pos: "0 \ x \ x \ 1 \ arccos x = arcsin(sqrt(1 - x\<^sup>2))" + by (smt (verit, del_insts) arccos_lbound arccos_le_pi2 arcsin_sin sin_arccos) + +lemma arccos_arcsin_sqrt_neg: "-1 \ x \ x \ 0 \ arccos x = pi - arcsin(sqrt(1 - x\<^sup>2))" + using arccos_arcsin_sqrt_pos [of "-x"] + by (simp add: arccos_minus) + lemma cos_limit_1: assumes "(\j. cos (\ j)) \ 1" shows "\k. (\j. \ j - of_int (k j) * (2 * pi)) \ 0"