diff -r b52e57ed7e29 -r d35d355f7330 src/HOL/Analysis/Product_Vector.thy --- a/src/HOL/Analysis/Product_Vector.thy Fri Apr 11 22:17:06 2025 +0100 +++ b/src/HOL/Analysis/Product_Vector.thy Sat Apr 12 22:42:32 2025 +0100 @@ -90,10 +90,7 @@ end lemma module_prod_scale_eq_scaleR: "module_prod.scale (*\<^sub>R) (*\<^sub>R) = scaleR" - apply (rule ext) apply (rule ext) - apply (subst module_prod.scale_def) - subgoal by unfold_locales - by (simp add: scaleR_prod_def) + using module_pair_axioms module_prod.scale_def module_prod_def by fastforce interpretation real_vector?: vector_space_prod "scaleR::_\_\'a::real_vector" "scaleR::_\_\'b::real_vector" rewrites "scale = ((*\<^sub>R)::_\_\('a \ 'b))" @@ -166,8 +163,8 @@ then have \\\<^sub>F ((x'1, y1), (x'2, y2)) in uniformity \\<^sub>F uniformity. (x'1,x'2) = x \ (y1,y2) \ U\ by (simp add: uniformity_prod_def eventually_filtermap case_prod_unfold) then obtain UA UB where \eventually UA uniformity\ and \eventually UB uniformity\ - and UA_UB_U: \UA (a1, a2) \ UB (b1, b2) \ (a1, b1) = x \ (a2, b2) \ U\ for a1 a2 b1 b2 - apply atomize_elim by (simp add: case_prod_beta eventually_prod_filter) + and UA_UB_U: \UA (a1, a2) \ UB (b1, b2) \ (a1, b1) = x \ (a2, b2) \ U\ for a1 a2 b1 b2 + by (force simp: case_prod_beta eventually_prod_filter) have \eventually (\a. UA (fst x, a)) (nhds (fst x))\ using \eventually UA uniformity\ eventually_mono eventually_nhds_uniformity by fastforce then obtain A where \open A\ and A_UA: \A \ {a. UA (fst x, a)}\ and \fst x \ A\ @@ -190,11 +187,13 @@ by (metis surj_pair uniformity_refl) next show \eventually E uniformity \ \\<^sub>F (x::'a\'b, y) in uniformity. E (y, x)\ for E - apply (simp only: uniformity_prod_def eventually_filtermap case_prod_unfold eventually_prod_filter) - apply (erule exE, erule exE, rename_tac Pf Pg) - apply (rule_tac x=\\(x,y). Pf (y,x)\ in exI) - apply (rule_tac x=\\(x,y). Pg (y,x)\ in exI) - by (auto simp add: uniformity_sym) + unfolding uniformity_prod_def eventually_filtermap case_prod_unfold eventually_prod_filter + apply clarify + subgoal for Pf Pg + apply (rule_tac x=\\(x,y). Pf (y,x)\ in exI) + apply (rule_tac x=\\(x,y). Pg (y,x)\ in exI) + by (auto simp add: uniformity_sym) + done next show \\D. eventually D uniformity \ (\x y z. D (x::'a\'b, y) \ D (y, z) \ E (x, z))\ if \eventually E uniformity\ for E @@ -224,11 +223,11 @@ proof - have *: "eventually P (filtercomap (\y. (x, y)) F) \ eventually (\z. fst z = x \ P (snd z)) F" for P :: "'a \ bool" and F - unfolding eventually_filtercomap - by (smt (verit) eventually_elim2 fst_conv prod.collapse snd_conv) + unfolding eventually_filtercomap + by (smt (verit, best) eventually_mono split_pairs2) thus ?thesis - unfolding filter_eq_iff - by (subst *) (auto simp: eventually_nhds_uniformity case_prod_unfold) + unfolding filter_eq_iff * + by (auto simp: eventually_nhds_uniformity case_prod_unfold) qed lemma uniformity_of_uniform_continuous_invariant: @@ -356,8 +355,7 @@ have 1: \\e\{0<..}. {(x,y). dist x y < e} \ {(x,y). dist x y < a} \ {(x,y). dist x y < e} \ {(x,y). dist x y < b}\ if \a>0\ \b>0\ for a b - apply (rule bexI[of _ \min a b\]) - using that by auto + using that by (auto intro: bexI[of _ \min a b\]) have 2: \mono (\P. eventually (\x. P (Q x)) F)\ for F :: \'z filter\ and Q :: \'z \ 'y\ unfolding mono_def using eventually_mono le_funD by fastforce have \\\<^sub>F ((x1::'a,y1),(x2::'b,y2)) in uniformity \\<^sub>F uniformity. dist x1 y1 < e/2 \ dist x2 y2 < e/2\ if \e>0\ for e @@ -383,17 +381,18 @@ have \e > 0\ using \0 < e1\ \0 < e2\ e_def by auto have \dist (x1,x2) (y1,y2) < e \ dist x1 y1 < e1\ for x1 y1 :: 'a and x2 y2 :: 'b - unfolding dist_prod_def e_def apply auto - by (smt (verit, best) real_sqrt_sum_squares_ge1) + unfolding dist_prod_def e_def + by (metis real_sqrt_sum_squares_ge1 fst_conv min_less_iff_conj order_le_less_trans snd_conv) moreover have \dist (x1,x2) (y1,y2) < e \ dist x2 y2 < e2\ for x1 y1 :: 'a and x2 y2 :: 'b - unfolding dist_prod_def e_def apply auto - by (smt (verit, best) real_sqrt_sum_squares_ge1) + unfolding dist_prod_def e_def + using real_sqrt_sum_squares_ge1 [of "dist x1 y1" "dist x2 y2"] + by (metis min_less_iff_conj order_le_less_trans real_sqrt_sum_squares_ge2 snd_conv) ultimately have *: \dist (x1,x2) (y1,y2) < e \ P ((x1, x2), (y1, y2))\ for x1 y1 x2 y2 using e1P1 e2P2 P1P2P by auto show \eventually P (INF e\{0<..}. principal {(x, y). dist x y < e})\ - apply (rule eventually_INF1[where i=e]) - using \e > 0\ * by (auto simp: eventually_principal) + using \e > 0\ * + by (auto simp: eventually_principal intro: eventually_INF1) qed qed end @@ -421,8 +420,8 @@ fix x y z :: "'a \ 'b" show "dist x y \ dist x z + dist y z" unfolding dist_prod_def - by (intro order_trans [OF _ real_sqrt_sum_squares_triangle_ineq] - real_sqrt_le_mono add_mono power_mono dist_triangle2 zero_le_dist) + by (meson add_mono dist_triangle2 order_trans power_mono real_sqrt_le_iff + real_sqrt_sum_squares_triangle_ineq zero_le_dist) next fix S :: "('a \ 'b) set" have *: "open S \ (\x\S. \e>0. \y. dist y x < e \ y \ S)" @@ -525,8 +524,8 @@ by auto show \\d>0. \x\S\T. \y\S\T. dist y x < d \ dist (f y) (f x) < e\ apply (rule exI[of _ d]) - using \d>0\ d[rule_format] apply auto - by (smt (verit, del_insts) dist_fst_le dist_snd_le fst_conv snd_conv) + by (metis SigmaE \0 < d\ d dist_fst_le dist_snd_le fst_eqD order_le_less_trans + snd_conv) next fix e :: real assume \e > 0\ and \\e>0. \d>0. \x\S\T. \x'\S\T. dist x' x < d \ dist (f x') (f x) < e\ @@ -559,8 +558,9 @@ fix e :: real assume \0 < e\ show \\d>0. \x y :: 'a. dist x y < d \ (\x' y'. dist x' y' < d \ dist (x + x') (y + y') < e)\ apply (rule exI[of _ \e/2\]) - using \0 < e\ apply auto - by (smt (verit, ccfv_SIG) dist_add_cancel dist_add_cancel2 dist_commute dist_triangle_lt) + using \0 < e\ + by (smt (verit) dist_add_cancel dist_add_cancel2 dist_commute + dist_triangle_lt field_sum_of_halves) qed subsection \Product is a Complete Metric Space\ @@ -607,10 +607,7 @@ done show "norm (scaleR r x) = \r\ * norm x" unfolding norm_prod_def - apply (simp add: power_mult_distrib) - apply (simp add: distrib_left [symmetric]) - apply (simp add: real_sqrt_mult) - done + by (simp add: power_mult_distrib real_sqrt_mult flip: distrib_left) show "sgn x = scaleR (inverse (norm x)) x" by (rule sgn_prod_def) show "dist x y = norm (x - y)" @@ -654,13 +651,10 @@ using f.pos_bounded by fast obtain Kg where "0 < Kg" and norm_g: "\x. norm (g x) \ norm x * Kg" using g.pos_bounded by fast - have "\x. norm (f x, g x) \ norm x * (Kf + Kg)" - apply (rule allI) - apply (simp add: norm_Pair) - apply (rule order_trans [OF sqrt_add_le_add_sqrt], simp, simp) - apply (simp add: distrib_left) - apply (rule add_mono [OF norm_f norm_g]) - done + have "\x. sqrt ((norm (f x))\<^sup>2) + sqrt ((norm (g x))\<^sup>2) \ norm x * (Kf + Kg)" + by (simp add: add_mono distrib_left norm_f norm_g) + then have "\x. norm (f x, g x) \ norm x * (Kf + Kg)" + by (smt (verit) norm_ge_zero norm_prod_def prod.sel sqrt_add_le_add_sqrt zero_le_power) then show "\K. \x. norm (f x, g x) \ norm x * K" .. qed @@ -730,44 +724,50 @@ by (metis norm_ge_zero sqrt_sum_squares_le_sum) lemma (in vector_space_prod) span_Times_sing1: "p.span ({0} \ B) = {0} \ vs2.span B" - apply (rule p.span_unique) - subgoal by (auto intro!: vs1.span_base vs2.span_base) - subgoal using vs1.subspace_single_0 vs2.subspace_span by (rule subspace_Times) - subgoal for T - proof safe +proof (rule p.span_unique) + show "{0} \ B \ {0} \ vs2.span B" + by (auto intro!: vs1.span_base vs2.span_base) + show "p.subspace ({0} \ vs2.span B)" + using vs1.subspace_single_0 vs2.subspace_span by (rule subspace_Times) + fix T :: "('b \ 'c) set" + assume subset_T: "{0} \ B \ T" and subspace: "p.subspace T" + show "{0} \ vs2.span B \ T" + proof clarify fix b - assume subset_T: "{0} \ B \ T" and subspace: "p.subspace T" and b_span: "b \ vs2.span B" + assume b_span: "b \ vs2.span B" then obtain t r where b: "b = (\a\t. r a *b a)" and t: "finite t" "t \ B" by (auto simp: vs2.span_explicit) have "(0, b) = (\b\t. scale (r b) (0, b))" - unfolding b scale_prod sum_prod - by simp + unfolding b scale_prod sum_prod by simp also have "\ \ T" using \t \ B\ subset_T by (auto intro!: p.subspace_sum p.subspace_scale subspace) finally show "(0, b) \ T" . qed - done +qed lemma (in vector_space_prod) span_Times_sing2: "p.span (A \ {0}) = vs1.span A \ {0}" - apply (rule p.span_unique) - subgoal by (auto intro!: vs1.span_base vs2.span_base) - subgoal using vs1.subspace_span vs2.subspace_single_0 by (rule subspace_Times) - subgoal for T - proof safe +proof (rule p.span_unique) + show "A \ {0} \ vs1.span A \ {0}" + by (auto intro!: vs1.span_base vs2.span_base) + show "p.subspace (vs1.span A \ {0})" + using vs1.subspace_span vs2.subspace_single_0 by (rule subspace_Times) + fix T :: "('b \ 'c) set" + assume subset_T: "A \ {0} \ T" and subspace: "p.subspace T" + show "vs1.span A \ {0} \ T" + proof clarify fix a - assume subset_T: "A \ {0} \ T" and subspace: "p.subspace T" and a_span: "a \ vs1.span A" + assume a_span: "a \ vs1.span A" then obtain t r where a: "a = (\a\t. r a *a a)" and t: "finite t" "t \ A" by (auto simp: vs1.span_explicit) have "(a, 0) = (\a\t. scale (r a) (a, 0))" - unfolding a scale_prod sum_prod - by simp + unfolding a scale_prod sum_prod by simp also have "\ \ T" using \t \ A\ subset_T by (auto intro!: p.subspace_sum p.subspace_scale subspace) finally show "(a, 0) \ T" . qed - done +qed subsection \Product is Finite Dimensional\