# HG changeset patch # User paulson # Date 1690495525 -3600 # Node ID cc1058b831245aa699e2c2aaf871b939e166fe2e # Parent 67bf692cf1ab2e02bb03bc22c1b8f83d88852a0e Cosmetic polishing of proofs diff -r 67bf692cf1ab -r cc1058b83124 src/HOL/Analysis/Homotopy.thy --- a/src/HOL/Analysis/Homotopy.thy Wed Jul 26 20:28:35 2023 +0200 +++ b/src/HOL/Analysis/Homotopy.thy Thu Jul 27 23:05:25 2023 +0100 @@ -712,7 +712,7 @@ proposition homotopic_loops_subset: "\homotopic_loops S p q; S \ t\ \ homotopic_loops t p q" - by (fastforce simp add: homotopic_loops) + by (fastforce simp: homotopic_loops) proposition homotopic_loops_eq: "\path p; path_image p \ S; pathfinish p = pathstart p; \t. t \ {0..1} \ p(t) = q(t)\ @@ -1040,17 +1040,15 @@ have "homotopic_paths S (subpath u w g +++ subpath w v g) ((subpath u v g +++ subpath v w g) +++ subpath w v g)" by (simp add: hom homotopic_paths_join homotopic_paths_sym wvg) - also have "homotopic_paths S ((subpath u v g +++ subpath v w g) +++ subpath w v g) - (subpath u v g +++ subpath v w g +++ subpath w v g)" + also have "homotopic_paths S \ (subpath u v g +++ subpath v w g +++ subpath w v g)" using wvg vug \path g\ by (metis homotopic_paths_assoc homotopic_paths_sym path_image_subpath_commute path_subpath pathfinish_subpath pathstart_subpath u v w) - also have "homotopic_paths S (subpath u v g +++ subpath v w g +++ subpath w v g) - (subpath u v g +++ linepath (pathfinish (subpath u v g)) (pathfinish (subpath u v g)))" + also have "homotopic_paths S \ (subpath u v g +++ linepath (pathfinish (subpath u v g)) (pathfinish (subpath u v g)))" using wvg vug \path g\ by (metis homotopic_paths_join homotopic_paths_linv homotopic_paths_refl path_image_subpath_commute path_subpath pathfinish_subpath pathstart_join pathstart_subpath reversepath_subpath u v) - also have "homotopic_paths S (subpath u v g +++ linepath (pathfinish (subpath u v g)) (pathfinish (subpath u v g))) (subpath u v g)" + also have "homotopic_paths S \ (subpath u v g)" using vug \path g\ by (metis homotopic_paths_rid path_image_subpath_commute path_subpath u v) finally have "homotopic_paths S (subpath u w g +++ subpath w v g) (subpath u v g)" . then show ?thesis @@ -1077,11 +1075,11 @@ qed lemma homotopic_loops_imp_path_component_value: - "\homotopic_loops S p q; 0 \ t; t \ 1\ \ path_component S (p t) (q t)" -apply (clarsimp simp: homotopic_loops_def homotopic_with_def path_defs) -apply (rule_tac x="h \ (\u. (u, t))" in exI) -apply (fastforce elim!: continuous_on_subset intro!: continuous_intros) -done + "\homotopic_loops S p q; 0 \ t; t \ 1\ \ path_component S (p t) (q t)" + apply (clarsimp simp: homotopic_loops_def homotopic_with_def path_defs) + apply (rule_tac x="h \ (\u. (u, t))" in exI) + apply (fastforce elim!: continuous_on_subset intro!: continuous_intros) + done lemma homotopic_points_eq_path_component: "homotopic_loops S (linepath a a) (linepath b b) \ path_component S a b" @@ -1109,12 +1107,12 @@ lemma simply_connected_imp_path_connected: fixes S :: "_::real_normed_vector set" shows "simply_connected S \ path_connected S" -by (simp add: simply_connected_def path_connected_eq_homotopic_points) + by (simp add: simply_connected_def path_connected_eq_homotopic_points) lemma simply_connected_imp_connected: fixes S :: "_::real_normed_vector set" shows "simply_connected S \ connected S" -by (simp add: path_connected_imp_connected simply_connected_imp_path_connected) + by (simp add: path_connected_imp_connected simply_connected_imp_path_connected) lemma simply_connected_eq_contractible_loop_any: fixes S :: "_::real_normed_vector set" @@ -1123,13 +1121,10 @@ \ homotopic_loops S p (linepath a a))" (is "?lhs = ?rhs") proof - assume ?lhs then show ?rhs - unfolding simply_connected_def by force -next assume ?rhs then show ?lhs unfolding simply_connected_def by (metis pathfinish_in_path_image subsetD homotopic_loops_trans homotopic_loops_sym) -qed +qed (force simp: simply_connected_def) lemma simply_connected_eq_contractible_loop_some: fixes S :: "_::real_normed_vector set" @@ -1154,15 +1149,7 @@ S = {} \ (\a \ S. \p. path p \ path_image p \ S \ pathfinish p = pathstart p \ homotopic_loops S p (linepath a a))" - (is "?lhs = ?rhs") -proof (cases "S = {}") - case True then show ?thesis by force -next - case False - then obtain a where "a \ S" by blast - then show ?thesis - by (meson False homotopic_loops_sym homotopic_loops_trans simply_connected_def simply_connected_eq_contractible_loop_any) -qed + by (meson ex_in_conv homotopic_loops_sym homotopic_loops_trans simply_connected_def simply_connected_eq_contractible_loop_any) lemma simply_connected_eq_contractible_path: fixes S :: "_::real_normed_vector set" @@ -1207,14 +1194,12 @@ using that by (smt (verit, best) homotopic_paths_join homotopic_paths_linv homotopic_paths_rid homotopic_paths_sym homotopic_paths_trans pathstart_linepath) - also have "homotopic_paths S (p +++ reversepath q +++ q) - ((p +++ reversepath q) +++ q)" + also have "homotopic_paths S \ ((p +++ reversepath q) +++ q)" by (simp add: that homotopic_paths_assoc) - also have "homotopic_paths S ((p +++ reversepath q) +++ q) - (linepath (pathstart q) (pathstart q) +++ q)" + also have "homotopic_paths S \ (linepath (pathstart q) (pathstart q) +++ q)" using * [of "p +++ reversepath q"] that by (simp add: homotopic_paths_assoc homotopic_paths_join path_image_join) - also have "homotopic_paths S (linepath (pathstart q) (pathstart q) +++ q) q" + also have "homotopic_paths S \ q" using that homotopic_paths_lid by blast finally show ?thesis . qed @@ -1238,7 +1223,7 @@ have "path (fst \ p)" by (simp add: continuous_on_fst Path_Connected.path_continuous_image [OF \path p\]) moreover have "path_image (fst \ p) \ S" - using that by (force simp add: path_image_def) + using that by (force simp: path_image_def) ultimately have p1: "homotopic_loops S (fst \ p) (linepath a a)" using S that by (simp add: simply_connected_eq_contractible_loop_any pathfinish_def pathstart_def) @@ -1291,12 +1276,12 @@ corollary contractible_imp_connected: fixes S :: "_::real_normed_vector set" shows "contractible S \ connected S" -by (simp add: contractible_imp_simply_connected simply_connected_imp_connected) + by (simp add: contractible_imp_simply_connected simply_connected_imp_connected) lemma contractible_imp_path_connected: fixes S :: "_::real_normed_vector set" shows "contractible S \ path_connected S" -by (simp add: contractible_imp_simply_connected simply_connected_imp_path_connected) + by (simp add: contractible_imp_simply_connected simply_connected_imp_path_connected) lemma nullhomotopic_through_contractible: fixes S :: "_::topological_space set" @@ -1351,7 +1336,7 @@ with \path_connected U\ show ?thesis by blast qed then have "homotopic_with_canon (\h. True) S U (\x. c2) (\x. c1)" - by (auto simp add: path_component homotopic_constant_maps) + by (auto simp: path_component homotopic_constant_maps) then show ?thesis using c1 c2 homotopic_with_symD homotopic_with_trans by blast qed @@ -1419,7 +1404,7 @@ using \a \ S\ unfolding homotopic_with_def apply (rule_tac x="\y. (1 - (fst y)) *\<^sub>R snd y + (fst y) *\<^sub>R a" in exI) - apply (force simp add: P intro: continuous_intros) + apply (force simp: P intro: continuous_intros) done then show ?thesis using that by blast @@ -1516,18 +1501,17 @@ where "locally P S \ \w x. openin (top_of_set S) w \ x \ w - \ (\u v. openin (top_of_set S) u \ P v \ x \ u \ u \ v \ v \ w)" + \ (\U V. openin (top_of_set S) U \ P V \ x \ U \ U \ V \ V \ w)" lemma locallyI: assumes "\w x. \openin (top_of_set S) w; x \ w\ - \ \u v. openin (top_of_set S) u \ P v \ x \ u \ u \ v \ v \ w" + \ \U V. openin (top_of_set S) U \ P V \ x \ U \ U \ V \ V \ w" shows "locally P S" using assms by (force simp: locally_def) lemma locallyE: assumes "locally P S" "openin (top_of_set S) w" "x \ w" - obtains u v where "openin (top_of_set S) u" - "P v" "x \ u" "u \ v" "v \ w" + obtains U V where "openin (top_of_set S) U" "P V" "x \ U" "U \ V" "V \ w" using assms unfolding locally_def by meson lemma locally_mono: @@ -1636,28 +1620,26 @@ using \f ` S = T\ f \V \ S\ by auto have contvf: "continuous_on V f" using \V \ S\ continuous_on_subset f(3) by blast - have "f ` V \ W" - using uv using Int_lower2 gw image_subsetI mem_Collect_eq subset_iff by auto - then have contvg: "continuous_on (f ` V) g" - using \W \ T\ continuous_on_subset [OF g(3)] by blast - have "V \ g ` f ` V" - by (metis \V \ S\ hom homeomorphism_def homeomorphism_of_subsets order_refl) - then have homv: "homeomorphism V (f ` V) f g" - using \V \ S\ f by (auto simp: homeomorphism_def contvf contvg) have "openin (top_of_set (g ` T)) U" using \g ` T = S\ by (simp add: osu) then have "openin (top_of_set T) (T \ g -` U)" using \continuous_on T g\ continuous_on_open [THEN iffD1] by blast moreover have "\V. Q V \ y \ (T \ g -` U) \ (T \ g -` U) \ V \ V \ W" proof (intro exI conjI) + show "f ` V \ W" + using uv using Int_lower2 gw image_subsetI mem_Collect_eq subset_iff by auto + then have contvg: "continuous_on (f ` V) g" + using \W \ T\ continuous_on_subset [OF g(3)] by blast + have "V \ g ` f ` V" + by (metis \V \ S\ hom homeomorphism_def homeomorphism_of_subsets order_refl) + then have homv: "homeomorphism V (f ` V) f g" + using \V \ S\ f by (auto simp: homeomorphism_def contvf contvg) show "Q (f ` V)" using Q homv \P V\ by blast show "y \ T \ g -` U" using T(2) \y \ W\ \g y \ U\ by blast show "T \ g -` U \ f ` V" using g(1) image_iff uv(3) by fastforce - show "f ` V \ W" - using \f ` V \ W\ by blast qed ultimately show "\U. openin (top_of_set T) U \ (\v. Q v \ y \ U \ U \ v \ v \ W)" by meson @@ -1692,8 +1674,7 @@ fixes f :: "'a::euclidean_space \ 'b::euclidean_space" assumes f: "linear f" "inj f" and iff: "\S. P (f ` S) \ Q S" shows "locally P (f ` S) \ locally Q S" - using homeomorphism_locally [of "f`S" _ _ f] linear_homeomorphism_image [OF f] - by (metis (no_types, lifting) homeomorphism_image2 iff) + by (smt (verit) f homeomorphism_image2 homeomorphism_locally iff linear_homeomorphism_image) lemma locally_open_map_image: fixes f :: "'a::real_normed_vector \ 'b::real_normed_vector" @@ -1782,8 +1763,8 @@ shows "R a b" proof - have "\a b c. \a \ S; b \ S; c \ S; R a b\ \ R a c" - apply (rule connected_induction_simple [OF \connected S\], simp_all) - by (meson local.sym local.trans opI openin_imp_subset subsetCE) + by (smt (verit, ccfv_threshold) connected_induction_simple [OF \connected S\] + assms openin_imp_subset subset_eq) then show ?thesis by (metis etc opI) qed @@ -1833,13 +1814,13 @@ compact v \ x \ u \ u \ v \ v \ S \ T" if "open T" "x \ S" "x \ T" for x T proof - - obtain u v where uv: "x \ u" "u \ v" "v \ S" "compact v" "openin (top_of_set S) u" + obtain U V where uv: "x \ U" "U \ V" "V \ S" "compact V" "openin (top_of_set S) U" using r [OF \x \ S\] by auto obtain e where "e>0" and e: "cball x e \ T" using open_contains_cball \open T\ \x \ T\ by blast show ?thesis - apply (rule_tac x="(S \ ball x e) \ u" in exI) - apply (rule_tac x="cball x e \ v" in exI) + apply (rule_tac x="(S \ ball x e) \ U" in exI) + apply (rule_tac x="cball x e \ V" in exI) using that \e > 0\ e uv apply auto done @@ -1860,16 +1841,8 @@ shows "locally compact S \ (\x \ S. \U. x \ U \ openin (top_of_set S) U \ compact(closure U) \ closure U \ S)" - (is "?lhs = ?rhs") -proof - assume ?lhs - then show ?rhs - by (meson bounded_subset closure_minimal compact_closure compact_imp_bounded - compact_imp_closed dual_order.trans locally_compactE) -next - assume ?rhs then show ?lhs - by (meson closure_subset locally_compact) -qed + by (smt (verit, ccfv_threshold) bounded_subset closure_closed closure_mono closure_subset + compact_closure compact_imp_closed order.trans locally_compact) lemma locally_compact_Int_cball: fixes S :: "'a :: heine_borel set" @@ -2008,8 +1981,9 @@ then show ?rhs unfolding locally_def apply (elim all_forward imp_forward asm_rl exE) - apply (rule_tac x = "u \ ball x 1" in exI) - apply (rule_tac x = "v \ cball x 1" in exI) + apply (rename_tac U V) + apply (rule_tac x = "U \ ball x 1" in exI) + apply (rule_tac x = "V \ cball x 1" in exI) apply (force intro: openin_trans) done next @@ -2019,7 +1993,7 @@ lemma locally_compact_openin_Un: fixes S :: "'a::euclidean_space set" - assumes LCS: "locally compact S" and LCT:"locally compact T" + assumes LCS: "locally compact S" and LCT: "locally compact T" and opS: "openin (top_of_set (S \ T)) S" and opT: "openin (top_of_set (S \ T)) T" shows "locally compact (S \ T)" @@ -2453,7 +2427,7 @@ "\v x. \openin (top_of_set S) v; x \ v\ \ \u. openin (top_of_set S) u \ path_connected u \ x \ u \ u \ v" shows "locally path_connected S" - by (force simp add: locally_def dest: assms) + by (force simp: locally_def dest: assms) lemma locally_path_connected_2: assumes "locally path_connected S" @@ -2525,7 +2499,7 @@ proof assume ?lhs then show ?rhs - by (fastforce simp add: locally_connected) + by (fastforce simp: locally_connected) next assume ?rhs have *: "\T. openin (top_of_set S) T \ x \ T \ T \ c" @@ -3577,7 +3551,7 @@ show thesis using homotopic_with_compose_continuous_map_right [OF homotopic_with_compose_continuous_map_left [OF b g] f] - by (force simp add: that) + by (force simp: that) qed lemma nullhomotopic_into_contractible_space: @@ -3901,7 +3875,7 @@ by (rule homotopic_with_compose_continuous_left [where Y=T]) (use f in \auto simp: hom homotopic_with_symD\) ultimately show ?thesis - using that homotopic_with_trans by (fastforce simp add: o_def) + using that homotopic_with_trans by (fastforce simp: o_def) qed lemma homotopy_eqv_cohomotopic_triviality_null: @@ -3942,7 +3916,7 @@ by (rule homotopic_with_compose_continuous_right [where X=T]) (use f in \auto simp: hom homotopic_with_symD\) ultimately show ?thesis - using homotopic_with_trans by (fastforce simp add: o_def) + using homotopic_with_trans by (fastforce simp: o_def) qed lemma homotopy_eqv_homotopic_triviality_null: @@ -5002,7 +4976,7 @@ using \ by (auto simp: pairwise_def bij_betw_def inj_on_def) qed (use affine_hull_open assms that in auto) then show ?thesis - using \ \P \ U\ bij_betwE by (fastforce simp add: intro!: that) + using \ \P \ U\ bij_betwE by (fastforce simp: intro!: that) next case False with DIM_positive have "DIM('a) = 1" @@ -5089,7 +5063,7 @@ using \ by (auto simp: pairwise_def bij_betw_def inj_on_def) qed then show ?thesis - using \ \P \ U\ bij_betwE by (fastforce simp add: intro!: that) + using \ \P \ U\ bij_betwE by (fastforce simp: intro!: that) next case False with aff_dim_geq [of S] consider "aff_dim S = -1" | "aff_dim S = 0" | "aff_dim S = 1" by linarith @@ -5173,9 +5147,9 @@ using \T \ affine hull S\ h by auto qed show "\x. x \ T \ g' (f' x) = x" - using h j hom homeomorphism_apply1 by (fastforce simp add: f'_def g'_def) + using h j hom homeomorphism_apply1 by (fastforce simp: f'_def g'_def) show "\y. y \ T \ f' (g' y) = y" - using h j hom homeomorphism_apply2 by (fastforce simp add: f'_def g'_def) + using h j hom homeomorphism_apply2 by (fastforce simp: f'_def g'_def) qed next have \
: "\x y. \x \ affine hull S; h x = h y; y \ S\ \ x \ S" @@ -5241,7 +5215,7 @@ and d: "\x'. \dist x' a \ r; x' \ a; dist x' x < d\ \ dist (g x') (g x) < e" using contg False x \e>0\ - unfolding continuous_on_iff by (fastforce simp add: dist_commute intro: that) + unfolding continuous_on_iff by (fastforce simp: dist_commute intro: that) show ?thesis using \d > 0\ \x \ a\ by (rule_tac x="min d (norm(x - a))" in exI) @@ -5287,7 +5261,7 @@ next assume ?rhs then show ?lhs - using equal continuous_on_const by (force simp add: homotopic_with) + using equal continuous_on_const by (force simp: homotopic_with) qed next case greater diff -r 67bf692cf1ab -r cc1058b83124 src/HOL/Analysis/Polytope.thy --- a/src/HOL/Analysis/Polytope.thy Wed Jul 26 20:28:35 2023 +0200 +++ b/src/HOL/Analysis/Polytope.thy Thu Jul 27 23:05:25 2023 +0100 @@ -1355,7 +1355,7 @@ case False have "x = (((1 - v) * ub) *\<^sub>R b + (v * uc) *\<^sub>R c) /\<^sub>R ux" by (metis \ux \ 0\ uxx mult.commute right_inverse scaleR_one scaleR_scaleR) - also have "... = (1 - v * uc / ux) *\<^sub>R b + (v * uc / ux) *\<^sub>R c" + also have "\ = (1 - v * uc / ux) *\<^sub>R b + (v * uc / ux) *\<^sub>R c" using \ux \ 0\ equx apply (auto simp: field_split_simps) by (metis add.commute add_diff_eq add_divide_distrib diff_add_cancel scaleR_add_left) finally have "x = (1 - v * uc / ux) *\<^sub>R b + (v * uc / ux) *\<^sub>R c" . @@ -1501,7 +1501,7 @@ proof have "?lhs \ convex hull {x. x extreme_point_of S}" using Krein_Milman_Minkowski assms by blast - also have "... \ ?rhs" + also have "\ \ ?rhs" proof (rule hull_mono) show "{x. x extreme_point_of S} \ frontier S" using closure_subset @@ -1511,7 +1511,7 @@ next have "?rhs \ convex hull S" by (metis Diff_subset \compact S\ closure_closed compact_eq_bounded_closed frontier_def hull_mono) - also have "... \ ?lhs" + also have "\ \ ?lhs" by (simp add: \convex S\ hull_same) finally show "?rhs \ ?lhs" . qed @@ -1626,12 +1626,11 @@ done lemma polyhedron_UNIV [iff]: "polyhedron UNIV" - unfolding polyhedron_def - by (rule_tac x="{}" in exI) auto + using polyhedron_def by auto lemma polyhedron_Inter [intro,simp]: - "\finite F; \S. S \ F \ polyhedron S\ \ polyhedron(\F)" -by (induction F rule: finite_induct) auto + "\finite F; \S. S \ F \ polyhedron S\ \ polyhedron(\F)" + by (induction F rule: finite_induct) auto lemma polyhedron_empty [iff]: "polyhedron ({} :: 'a :: euclidean_space set)" @@ -1640,10 +1639,7 @@ have "\a. a \ 0 \ (\b. {x. i \ x \ -1} = {x. a \ x \ b})" by (rule_tac x="i" in exI) (force simp: i_def SOME_Basis nonzero_Basis) moreover have "\a b. a \ 0 \ {x. -i \ x \ - 1} = {x. a \ x \ b}" - apply (rule_tac x="-i" in exI) - apply (rule_tac x="-1" in exI) - apply (simp add: i_def SOME_Basis nonzero_Basis) - done + by (metis Basis_zero SOME_Basis i_def neg_0_equal_iff_equal) ultimately show ?thesis unfolding polyhedron_def by (rule_tac x="{{x. i \ x \ -1}, {x. -i \ x \ -1}}" in exI) force @@ -1664,7 +1660,7 @@ lemma polyhedron_halfspace_ge: fixes a :: "'a :: euclidean_space" shows "polyhedron {x. a \ x \ b}" -using polyhedron_halfspace_le [of "-a" "-b"] by simp + using polyhedron_halfspace_le [of "-a" "-b"] by simp lemma polyhedron_hyperplane: fixes a :: "'a :: euclidean_space" @@ -1679,7 +1675,7 @@ lemma affine_imp_polyhedron: fixes S :: "'a :: euclidean_space set" shows "affine S \ polyhedron S" -by (metis affine_hull_eq polyhedron_Inter polyhedron_hyperplane affine_hull_finite_intersection_hyperplanes [of S]) + by (metis affine_hull_finite_intersection_hyperplanes hull_same polyhedron_Inter polyhedron_hyperplane) lemma polyhedron_imp_closed: fixes S :: "'a :: euclidean_space set" @@ -1694,7 +1690,7 @@ lemma polyhedron_affine_hull: fixes S :: "'a :: euclidean_space set" shows "polyhedron(affine hull S)" -by (simp add: affine_imp_polyhedron) + by (simp add: affine_imp_polyhedron) subsection\Canonical polyhedron representation making facial structure explicit\ @@ -1704,14 +1700,7 @@ shows "polyhedron S \ (\F. finite F \ S = (affine hull S) \ \F \ (\h \ F. \a b. a \ 0 \ h = {x. a \ x \ b}))" - (is "?lhs = ?rhs") -proof - assume ?lhs then show ?rhs - using hull_subset polyhedron_def by fastforce -next - assume ?rhs then show ?lhs - by (metis polyhedron_Int polyhedron_Inter polyhedron_affine_hull polyhedron_halfspace_le) -qed + by (metis hull_subset inf.absorb_iff2 polyhedron_Int polyhedron_affine_hull polyhedron_def) proposition rel_interior_polyhedron_explicit: assumes "finite F" @@ -1744,13 +1733,13 @@ define \ where "\ = min (1/2) (e / 2 / norm(z - x))" have "norm (\ *\<^sub>R x - \ *\<^sub>R z) = norm (\ *\<^sub>R (x - z))" by (simp add: \_def algebra_simps norm_mult) - also have "... = \ * norm (x - z)" + also have "\ = \ * norm (x - z)" using \e > 0\ by (simp add: \_def) - also have "... < e" + also have "\ < e" using \z \ x\ \e > 0\ by (simp add: \_def min_def field_split_simps norm_minus_commute) finally have lte: "norm (\ *\<^sub>R x - \ *\<^sub>R z) < e" . have \_aff: "\ *\<^sub>R z + (1 - \) *\<^sub>R x \ affine hull S" - by (metis \x \ S\ add.commute affine_affine_hull diff_add_cancel hull_inc mem_affine zaff) + by (simp add: \x \ S\ hull_inc mem_affine zaff) have "\ *\<^sub>R z + (1 - \) *\<^sub>R x \ S" using ins [OF _ \_aff] by (simp add: algebra_simps lte) then obtain l where l: "0 < l" "l < 1" and ls: "(l *\<^sub>R z + (1 - l) *\<^sub>R x) \ S" @@ -1809,7 +1798,7 @@ have "a h \ 0" and "h = {x. a h \ x \ b h}" "h \ \F = \F" using \h \ F\ ab by auto then have "(affine hull S) \ {x. a h \ x \ b h} \ {}" - by (metis (no_types) affine_hull_eq_empty inf.absorb_iff2 inf_assoc inf_bot_right inf_commute seq that(2)) + by (metis affine_hull_eq_empty inf.absorb_iff1 inf_assoc inf_bot_left seq that(2)) moreover have "\ (affine hull S \ {x. a h \ x \ b h})" using \h = {x. a h \ x \ b h}\ that(2) by blast ultimately show ?thesis @@ -1822,14 +1811,14 @@ affine hull S \ {x. a h \ x \ b h} = affine hull S \ h \ (\w \ affine hull S. (w + a h) \ affine hull S)" by metis - have seq2: "S = affine hull S \ (\h\{h \ F. \ affine hull S \ h}. {x. a h \ x \ b h})" - by (subst seq) (auto simp: ab INT_extend_simps) + let ?F = "(\h. {x. a h \ x \ b h}) ` {h \ F. \ affine hull S \ h}" show ?thesis - apply (rule_tac x="(\h. {x. a h \ x \ b h}) ` {h. h \ F \ \(affine hull S \ h)}" in exI) - apply (intro conjI seq2) - using \finite F\ apply force - using ab apply blast - done + proof (intro exI conjI) + show "finite ?F" + using \finite F\ by force + show "S = affine hull S \ \ ?F" + by (subst seq) (auto simp: ab INT_extend_simps) + qed (use ab in blast) qed next assume ?rhs then show ?lhs @@ -1887,12 +1876,7 @@ (\F. finite F \ S = (affine hull S) \ \F \ (\h \ F. \a b. a \ 0 \ h = {x. a \ x \ b}) \ (\F'. F' \ F \ S \ (affine hull S) \ \F'))" - (is "?lhs = ?rhs") -proof - assume ?lhs - then show ?rhs - by (force simp: polyhedron_Int_affine_parallel_minimal elim!: ex_forward) -qed (auto simp: polyhedron_Int_affine elim!: ex_forward) + by (metis polyhedron_Int_affine polyhedron_Int_affine_parallel_minimal) proposition facet_of_polyhedron_explicit: assumes "finite F" @@ -1928,7 +1912,7 @@ have "x \ h" using that xint by auto then have able: "a h \ x \ b h" using faceq that by blast - also have "... < a h \ z" using \z \ h\ faceq [OF that] xint by auto + also have "\ < a h \ z" using \z \ h\ faceq [OF that] xint by auto finally have xltz: "a h \ x < a h \ z" . define l where "l = (b h - a h \ x) / (a h \ z - a h \ x)" define w where "w = (1 - l) *\<^sub>R x + l *\<^sub>R z" @@ -1942,14 +1926,15 @@ moreover have "l * (a i \ z) \ l * b i" proof (rule mult_left_mono) show "a i \ z \ b i" - by (metis Diff_insert_absorb Inter_iff Set.set_insert \h \ F\ faceq insertE mem_Collect_eq that zint) + by (metis DiffI Inter_iff empty_iff faceq insertE mem_Collect_eq that zint) qed (use \0 < l\ in auto) ultimately show ?thesis by (simp add: w_def algebra_simps) qed have weq: "a h \ w = b h" using xltz unfolding w_def l_def by (simp add: algebra_simps) (simp add: field_simps) - have faceS: "S \ {x. a h \ x = b h} face_of S" + let ?F = "{x. a h \ x = b h}" + have faceS: "S \ ?F face_of S" proof (rule face_of_Int_supporting_hyperplane_le) show "\x. x \ S \ a h \ x \ b h" using faceq seq that by fastforce @@ -1960,15 +1945,18 @@ using \a h \ w = b h\ awlt faceq less_eq_real_def by blast ultimately have "w \ S" using seq by blast - with weq have ne: "S \ {x. a h \ x = b h} \ {}" by blast - moreover have "affine hull (S \ {x. a h \ x = b h}) = (affine hull S) \ {x. a h \ x = b h}" + with weq have ne: "S \ ?F \ {}" by blast + moreover have "affine hull (S \ ?F) = (affine hull S) \ ?F" proof - show "affine hull (S \ {x. a h \ x = b h}) \ affine hull S \ {x. a h \ x = b h}" - apply (intro Int_greatest hull_mono Int_lower1) - apply (metis affine_hull_eq affine_hyperplane hull_mono inf_le2) - done + show "affine hull (S \ ?F) \ affine hull S \ ?F" + proof - + have "affine hull (S \ ?F) \ affine hull S" + by (simp add: hull_mono) + then show ?thesis + by (simp add: affine_hyperplane subset_hull) + qed next - show "affine hull S \ {x. a h \ x = b h} \ affine hull (S \ {x. a h \ x = b h})" + show "affine hull S \ ?F \ affine hull (S \ ?F)" proof fix y assume yaff: "y \ affine hull S \ {y. a h \ y = b h}" @@ -2014,7 +2002,7 @@ case False with \0 < inff\ have "inff * (a j \ y - a j \ w) \ 0" by (simp add: mult_le_0_iff) - also have "... < b j - a j \ w" + also have "\ < b j - a j \ w" by (simp add: awlt that) finally show ?thesis by simp qed @@ -2050,7 +2038,7 @@ by (metis yeq affine_affine_hull [simplified affine_alt, rule_format, OF waff caff]) qed qed - ultimately have "aff_dim (affine hull (S \ {x. a h \ x = b h})) = aff_dim S - 1" + ultimately have "aff_dim (affine hull (S \ ?F)) = aff_dim S - 1" using \b h < a h \ z\ zaff by (force simp: aff_dim_affine_Int_hyperplane) then show ?thesis by (simp add: ne faceS facet_of_def) @@ -2755,7 +2743,7 @@ by (meson \0 < a\ divide_less_eq floor_eq_iff) have "?n * a \ a + x" using \a>0\ by (simp add: distrib_right floor_divide_lower) - also have "... < y" + also have "\ < y" by (rule 1) finally have "?n * a < y" . with x show ?thesis @@ -2767,7 +2755,7 @@ by (meson \0 < a\ divide_less_eq floor_eq_iff) have "?n * a \ a + y" using \a>0\ by (simp add: distrib_right floor_divide_lower) - also have "... < x" + also have "\ < x" by (rule 2) finally have "?n * a < x" . then show ?thesis @@ -2891,7 +2879,7 @@ using B \X \ \'\ eq that by blast+ have "norm (x - y) \ (\b\Basis. \(x-y) \ b\)" by (rule norm_le_l1) - also have "... \ of_nat (DIM('a)) * (e / 2 / DIM('a))" + also have "\ \ of_nat (DIM('a)) * (e / 2 / DIM('a))" proof (rule sum_bounded_above) fix i::'a assume "i \ Basis" @@ -2930,12 +2918,12 @@ using I' [OF \n \ C\ refl] n by auto qed qed - also have "... = e / 2" + also have "\ = e / 2" by simp finally show ?thesis . qed qed (use \0 < e\ in force) - also have "... < e" + also have "\ < e" by (simp add: \0 < e\) finally show ?thesis . qed @@ -3240,7 +3228,7 @@ using \K \ \\ C\ by blast have "K \ rel_frontier C" by (simp add: \K \ rel_frontier C\) - also have "... \ C" + also have "\ \ C" by (simp add: \closed C\ rel_frontier_def subset_iff) finally have "K \ C" . have "L \ C face_of C" @@ -3292,7 +3280,7 @@ by (auto simp: \\ affine_dependent I\ aff_independent_finite finite_imp_compact) moreover have "F face_of convex hull insert ?z I" by (metis S \F face_of S\ \K = convex hull I\ convex_hull_eq_empty convex_hull_insert_segments hull_hull) - ultimately obtain J where "J \ insert ?z I" "F = convex hull J" + ultimately obtain J where J: "J \ insert ?z I" "F = convex hull J" using face_of_convex_hull_subset [of "insert ?z I" F] by auto show ?thesis proof (cases "?z \ J") @@ -3320,7 +3308,7 @@ case False then have "F \ \" using face_of_convex_hull_affine_independent [OF \\ affine_dependent I\] - by (metis Int_absorb2 Int_insert_right_if0 \F = convex hull J\ \J \ insert ?z I\ \K = convex hull I\ face\ inf_le2 \K \ \\) + by (metis J \K = convex hull I\ face\ subset_insert \K \ \\) then show "F \ \ \ ?\" by blast qed @@ -3366,7 +3354,7 @@ using ahK_C_disjoint \C \ \\ \K \ \\ \K \ rel_frontier C\ affine_hull_convex_hull z by blast have "X \ K face_of K" by (simp add: XY(1) \K \ \\ faceI\ inf_commute) - also have "... face_of convex hull insert ?z K" + also have "\ face_of convex hull insert ?z K" by (metis I Keq \?z \ affine hull I\ aff_independent_finite convex_convex_hull face_of_convex_hull_insert face_of_refl hull_insert) finally have "X \ K face_of convex hull insert ?z K" . then show ?thesis @@ -3413,7 +3401,7 @@ using \L \ rel_frontier D\ by auto have "convex hull insert (SOME z. z \ rel_interior C) (K \ L) face_of convex hull insert (SOME z. z \ rel_interior C) K" - by (metis face_of_polytope_insert2 "*" IntI \C \ \\ aff_independent_finite ahK_C_disjoint empty_iff faceI\ polytope_def z \K \ \\ \L \ \\\K \ rel_frontier C\) + by (metis IntI \C \ \\ \K \ \\ \K \ rel_frontier C\ \L \ \\ ahK_C_disjoint empty_iff faceI\ face_of_polytope_insert2 simpl\ simplex_imp_polytope z) then show ?thesis using True X Y \K \ rel_frontier C\ \L \ rel_frontier C\ \convex C\ \convex K\ \convex L\ convex_hull_insert_Int_eq z by force next @@ -3442,7 +3430,7 @@ qed finally have CD: "C \ (rel_interior D) = {}" . have zKC: "(convex hull insert ?z K) \ C" - by (metis DiffE \C \ \\ \K \ rel_frontier C\ closed\ closure_closed convex\ hull_minimal insert_subset rel_frontier_def rel_interior_subset subset_iff z) + by (metis \K \ C\ \convex C\ in_mono insert_subsetI rel_interior_subset subset_hull z) have "disjnt (convex hull insert (SOME z. z \ rel_interior C) K) (rel_interior D)" using zKC CD by (force simp: disjnt_def) then have eq: "convex hull (insert ?z K) \ convex hull (insert ?w L) = @@ -3454,7 +3442,7 @@ by (simp add: \C \ \\ convex\) have "convex hull (insert ?z K) \ L = L \ convex hull (insert ?z K)" by blast - also have "... = convex hull K \ L" + also have "\ = convex hull K \ L" proof (subst Int_convex_hull_insert_rel_exterior [OF \convex C\ \K \ C\ z]) have "(C \ D) \ rel_interior C = {}" proof (rule face_of_disjoint_rel_interior) @@ -3482,26 +3470,26 @@ finally have chKL: "convex hull (insert ?z K) \ L = convex hull K \ L" . have "convex hull insert ?z K \ convex hull L face_of K" by (simp add: \K \ \\ \L \ \\ ch_id chKL faceI\) - also have "... face_of convex hull insert ?z K" + also have "\ face_of convex hull insert ?z K" proof - obtain I where I: "\ affine_dependent I" "K = convex hull I" using * [OF \K \ \\] by auto then have "\a. a \ rel_interior C \ a \ affine hull I" using ahK_C_disjoint \C \ \\ \K \ \\ \K \ rel_frontier C\ affine_hull_convex_hull by blast then show ?thesis - by (metis I affine_independent_insert face_of_convex_hull_affine_independent hull_insert subset_insertI z) + by (metis I \convex K\ aff_independent_finite face_of_convex_hull_insert_eq face_of_refl hull_insert z) qed finally have 1: "convex hull insert ?z K \ convex hull L face_of convex hull insert ?z K" . have "convex hull insert ?z K \ convex hull L face_of L" by (metis \K \ \\ \L \ \\ chKL ch_id faceI\ inf_commute) - also have "... face_of convex hull insert ?w L" + also have "\ face_of convex hull insert ?w L" proof - obtain I where I: "\ affine_dependent I" "L = convex hull I" using * [OF \L \ \\] by auto then have "\a. a \ rel_interior D \ a \ affine hull I" using \D \ \\ \L \ \\ \L \ rel_frontier D\ affine_hull_convex_hull ahK_C_disjoint by blast then show ?thesis - by (metis I aff_independent_finite convex_convex_hull face_of_convex_hull_insert face_of_refl hull_insert w) + by (metis I \convex L\ aff_independent_finite face_of_convex_hull_insert face_of_refl hull_insert w) qed finally have 2: "convex hull insert ?z K \ convex hull L face_of convex hull insert ?w L" . show ?thesis @@ -3767,18 +3755,13 @@ if "T \ {U - C |C. C \ \ \ aff_dim C < aff_dim U}" for T using that dense_complement_convex_closed \closed U\ \convex U\ by auto qed - also have "... \ closure ?lhs" + also have "\ \ closure ?lhs" proof - obtain C where "C \ \" "aff_dim C < aff_dim U" by (metis False Sup_upper aff_dim_subset eq eq_iff not_le) - have "\X. X \ \ \ aff_dim X = aff_dim U \ x \ X" + then have "\X. X \ \ \ aff_dim X = aff_dim U \ x \ X" if "\V. (\C. V = U - C \ C \ \ \ aff_dim C < aff_dim U) \ x \ V" for x - proof - - have "x \ U \ x \ \\" - using \C \ \\ \aff_dim C < aff_dim U\ eq that by blast - then show ?thesis - by (metis Diff_iff Sup_upper Union_iff aff_dim_subset dual_order.order_iff_strict eq that) - qed + by (metis Diff_iff Sup_upper UnionE aff_dim_subset eq order_less_le that) then show ?thesis by (auto intro!: closure_mono) qed diff -r 67bf692cf1ab -r cc1058b83124 src/HOL/Analysis/Tagged_Division.thy --- a/src/HOL/Analysis/Tagged_Division.thy Wed Jul 26 20:28:35 2023 +0200 +++ b/src/HOL/Analysis/Tagged_Division.thy Thu Jul 27 23:05:25 2023 +0100 @@ -14,99 +14,56 @@ and "\i. i \ S \ finite (T i)" shows "(\i\S. sum (x i) (T i)) = (\(i, j)\Sigma S T. x i j)" using assms -proof induct - case empty - then show ?case - by simp -next - case (insert a S) - show ?case - by (simp add: insert.hyps(1) insert.prems sum.Sigma) -qed + by induction (auto simp: sum.Sigma) lemmas scaleR_simps = scaleR_zero_left scaleR_minus_left scaleR_left_diff_distrib scaleR_zero_right scaleR_minus_right scaleR_right_diff_distrib scaleR_eq_0_iff scaleR_cancel_left scaleR_cancel_right scaleR_add_right scaleR_add_left real_vector_class.scaleR_one -subsection\<^marker>\tag unimportant\ \Sundries\ - - -text\A transitive relation is well-founded if all initial segments are finite.\ -lemma wf_finite_segments: - assumes "irrefl r" and "trans r" and "\x. finite {y. (y, x) \ r}" - shows "wf (r)" - apply (simp add: trans_wf_iff wf_iff_acyclic_if_finite converse_def assms) - using acyclic_def assms irrefl_def trans_Restr by fastforce - -text\For creating values between \<^term>\u\ and \<^term>\v\.\ -lemma scaling_mono: - fixes u::"'a::linordered_field" - assumes "u \ v" "0 \ r" "r \ s" - shows "u + r * (v - u) / s \ v" -proof - - have "r/s \ 1" using assms - using divide_le_eq_1 by fastforce - then have "(r/s) * (v - u) \ 1 * (v - u)" - by (meson diff_ge_0_iff_ge mult_right_mono \u \ v\) - then show ?thesis - by (simp add: field_simps) -qed - subsection \Some useful lemmas about intervals\ lemma interior_subset_union_intervals: - assumes "i = cbox a b" - and "j = cbox c d" - and "interior j \ {}" + fixes a b c d + defines "i \ cbox a b" + defines "j \ cbox c d" + assumes "interior j \ {}" and "i \ j \ S" and "interior i \ interior j = {}" shows "interior i \ interior S" -proof - - have "box a b \ cbox c d = {}" - using Int_interval_mixed_eq_empty[of c d a b] assms - unfolding interior_cbox by auto - moreover - have "box a b \ cbox c d \ S" - apply (rule order_trans,rule box_subset_cbox) - using assms by auto - ultimately - show ?thesis - unfolding assms interior_cbox - by auto (metis IntI UnE empty_iff interior_maximal open_box subsetCE subsetI) -qed + by (smt (verit, del_insts) IntI Int_interval_mixed_eq_empty UnE assms empty_iff interior_cbox interior_maximal interior_subset open_interior subset_eq) lemma interior_Union_subset_cbox: - assumes "finite f" - assumes f: "\s. s \ f \ \a b. s = cbox a b" "\s. s \ f \ interior s \ t" - and t: "closed t" - shows "interior (\f) \ t" + assumes "finite \" + assumes \: "\S. S \ \ \ \a b. S = cbox a b" "\S. S \ \ \ interior S \ T" + and T: "closed T" + shows "interior (\\) \ T" proof - - have [simp]: "s \ f \ closed s" for s - using f by auto - define E where "E = {s\f. interior s = {}}" - then have "finite E" "E \ {s\f. interior s = {}}" - using \finite f\ by auto - then have "interior (\f) = interior (\(f - E))" + have clo[simp]: "S \ \ \ closed S" for S + using \ by auto + define E where "E = {s\\. interior s = {}}" + then have "finite E" "E \ {s\\. interior s = {}}" + using \finite \\ by auto + then have "interior (\\) = interior (\(\ - E))" proof (induction E rule: finite_subset_induct') case (insert s f') - have "interior (\(f - insert s f') \ s) = interior (\(f - insert s f'))" - using insert.hyps \finite f\ by (intro interior_closed_Un_empty_interior) auto - also have "\(f - insert s f') \ s = \(f - f')" + have "interior (\(\ - insert s f') \ s) = interior (\(\ - insert s f'))" + using insert.hyps \finite \\ by (intro interior_closed_Un_empty_interior) auto + also have "\(\ - insert s f') \ s = \(\ - f')" using insert.hyps by auto finally show ?case by (simp add: insert.IH) qed simp - also have "\ \ \(f - E)" + also have "\ \ \(\ - E)" by (rule interior_subset) - also have "\ \ t" + also have "\ \ T" proof (rule Union_least) - fix s assume "s \ f - E" - with f[of s] obtain a b where s: "s \ f" "s = cbox a b" "box a b \ {}" + fix s assume "s \ \ - E" + with \[of s] obtain a b where s: "s \ \" "s = cbox a b" "box a b \ {}" by (fastforce simp: E_def) - have "closure (interior s) \ closure t" - by (intro closure_mono f \s \ f\) - with s \closed t\ show "s \ t" + have "closure (interior s) \ closure T" + by (intro closure_mono \ \s \ \\) + with s \closed T\ show "s \ T" by simp qed finally show ?thesis . @@ -195,14 +152,12 @@ definition\<^marker>\tag important\ "gauge \ \ (\x. x \ \ x \ open (\ x))" lemma gaugeI: - assumes "\x. x \ \ x" - and "\x. open (\ x)" + assumes "\x. x \ \ x" and "\x. open (\ x)" shows "gauge \" using assms unfolding gauge_def by auto lemma gaugeD[dest]: - assumes "gauge \" - shows "x \ \ x" + assumes "gauge \" shows "x \ \ x" and "open (\ x)" using assms unfolding gauge_def by auto @@ -213,7 +168,7 @@ unfolding gauge_def by auto lemma gauge_trivial[intro!]: "gauge (\x. ball x 1)" - by (rule gauge_ball) auto + by auto lemma gauge_Int[intro]: "gauge \1 \ gauge \2 \ gauge (\x. \1 x \ \2 x)" unfolding gauge_def by auto @@ -221,8 +176,7 @@ lemma gauge_reflect: fixes \ :: "'a::euclidean_space \ 'a set" shows "gauge \ \ gauge (\x. uminus ` \ (- x))" - using equation_minus_iff - by (auto simp: gauge_def surj_def intro!: open_surjective_linear_image linear_uminus) + by (metis (mono_tags, lifting) gauge_def imageI open_negations minus_minus) lemma gauge_Inter: assumes "finite S" @@ -233,7 +187,7 @@ by auto show ?thesis unfolding gauge_def unfolding * - using assms unfolding Ball_def Inter_iff mem_Collect_eq gauge_def by auto + by (simp add: assms gaugeD open_INT) qed lemma gauge_existence_lemma: @@ -290,18 +244,6 @@ "s division_of cbox a (a::'a::euclidean_space) \ s = {cbox a a}" (is "?l = ?r") proof - assume ?r - moreover - { fix K - assume "s = {{a}}" "K\s" - then have "\x y. K = cbox x y" - apply (rule_tac x=a in exI)+ - apply force - done - } - ultimately show ?l - unfolding division_of_def cbox_idem by auto -next assume ?l have "x = {a}" if "x \ s" for x by (metis \s division_of cbox a a\ cbox_idem division_ofD(2) division_ofD(3) subset_singletonD that) @@ -309,10 +251,10 @@ using \s division_of cbox a a\ by auto ultimately show ?r unfolding cbox_idem by auto -qed +qed (use cbox_idem in blast) lemma elementary_empty: obtains p where "p division_of {}" - unfolding division_of_trivial by auto + by simp lemma elementary_interval: obtains p where "p division_of (cbox a b)" by (metis division_of_trivial division_of_self) @@ -334,31 +276,24 @@ and "q \ p" shows "q division_of (\q)" proof (rule division_ofI) - note * = division_ofD[OF assms(1)] show "finite q" - using "*"(1) assms(2) infinite_super by auto - { - fix k - assume "k \ q" - then have kp: "k \ p" - using assms(2) by auto - show "k \ \q" - using \k \ q\ by auto - show "\a b. k = cbox a b" - using *(4)[OF kp] by auto - show "k \ {}" - using *(3)[OF kp] by auto - } + using assms finite_subset by blast +next + fix k + assume "k \ q" + show "k \ \q" + using \k \ q\ by auto + show "\a b. k = cbox a b" "k \ {}" + using assms \k \ q\ by blast+ +next fix k1 k2 assume "k1 \ q" "k2 \ q" "k1 \ k2" - then have **: "k1 \ p" "k2 \ p" "k1 \ k2" - using assms(2) by auto - show "interior k1 \ interior k2 = {}" - using *(5)[OF **] by auto + then show "interior k1 \ interior k2 = {}" + using assms by blast qed auto lemma division_of_union_self[intro]: "p division_of s \ p division_of (\p)" - unfolding division_of_def by auto + by blast lemma division_inter: fixes s1 s2 :: "'a::euclidean_space set" @@ -379,25 +314,20 @@ ultimately show "finite ?A" by auto have *: "\s. \{x\s. x \ {}} = \s" by auto - show "\?A = s1 \ s2" + show UA: "\?A = s1 \ s2" unfolding * using division_ofD(6)[OF assms(1)] and division_ofD(6)[OF assms(2)] by auto { fix k - assume "k \ ?A" + assume kA: "k \ ?A" then obtain k1 k2 where k: "k = k1 \ k2" "k1 \ p1" "k2 \ p2" "k \ {}" by auto then show "k \ {}" by auto show "k \ s1 \ s2" - using division_ofD(2)[OF assms(1) k(2)] and division_ofD(2)[OF assms(2) k(3)] - unfolding k by auto - obtain a1 b1 where k1: "k1 = cbox a1 b1" - using division_ofD(4)[OF assms(1) k(2)] by blast - obtain a2 b2 where k2: "k2 = cbox a2 b2" - using division_ofD(4)[OF assms(2) k(3)] by blast + using UA kA by blast show "\a b. k = cbox a b" - unfolding k k1 k2 unfolding Int_interval by auto + using k by (metis (no_types, lifting) Int_interval assms division_ofD(4)) } fix k1 k2 assume "k1 \ ?A" @@ -407,17 +337,9 @@ then obtain x2 y2 where k2: "k2 = x2 \ y2" "x2 \ p1" "y2 \ p2" "k2 \ {}" by auto assume "k1 \ k2" - then have th: "x1 \ x2 \ y1 \ y2" - unfolding k1 k2 by auto - have *: "interior x1 \ interior x2 = {} \ interior y1 \ interior y2 = {} \ - interior (x1 \ y1) \ interior x1 \ interior (x1 \ y1) \ interior y1 \ - interior (x2 \ y2) \ interior x2 \ interior (x2 \ y2) \ interior y2 \ - interior (x1 \ y1) \ interior (x2 \ y2) = {}" by auto - show "interior k1 \ interior k2 = {}" + then show "interior k1 \ interior k2 = {}" unfolding k1 k2 - apply (rule *) - using assms division_ofD(5) k1 k2(2) k2(3) th apply auto - done + using assms division_ofD(5) k1 k2 by auto qed qed @@ -439,33 +361,20 @@ lemma elementary_Int: fixes s t :: "'a::euclidean_space set" - assumes "p1 division_of s" - and "p2 division_of t" + assumes "p1 division_of s" and "p2 division_of t" shows "\p. p division_of (s \ t)" using assms division_inter by blast lemma elementary_Inter: - assumes "finite f" - and "f \ {}" - and "\s\f. \p. p division_of (s::('a::euclidean_space) set)" - shows "\p. p division_of (\f)" + assumes "finite \" + and "\ \ {}" + and "\s\\. \p. p division_of (s::('a::euclidean_space) set)" + shows "\p. p division_of (\\)" using assms -proof (induct f rule: finite_induct) - case (insert x f) - show ?case - proof (cases "f = {}") - case True - then show ?thesis - unfolding True using insert by auto - next - case False - obtain p where "p division_of \f" - using insert(3)[OF False insert(5)[unfolded ball_simps,THEN conjunct2]] .. - moreover obtain px where "px division_of x" - using insert(5)[rule_format,OF insertI1] .. - ultimately show ?thesis - by (simp add: elementary_Int Inter_insert) - qed +proof (induct \ rule: finite_induct) + case (insert x \) + then show ?case + by (metis cInf_singleton complete_lattice_class.Inf_insert elementary_Int insert_iff) qed auto lemma division_disjoint_union: @@ -476,40 +385,11 @@ proof (rule division_ofI) note d1 = division_ofD[OF assms(1)] note d2 = division_ofD[OF assms(2)] - show "finite (p1 \ p2)" - using d1(1) d2(1) by auto - show "\(p1 \ p2) = s1 \ s2" - using d1(6) d2(6) by auto - { - fix k1 k2 - assume as: "k1 \ p1 \ p2" "k2 \ p1 \ p2" "k1 \ k2" - moreover - let ?g="interior k1 \ interior k2 = {}" - { - assume as: "k1\p1" "k2\p2" - have ?g - using interior_mono[OF d1(2)[OF as(1)]] interior_mono[OF d2(2)[OF as(2)]] - using assms(3) by blast - } - moreover - { - assume as: "k1\p2" "k2\p1" - have ?g - using interior_mono[OF d1(2)[OF as(2)]] interior_mono[OF d2(2)[OF as(1)]] - using assms(3) by blast - } - ultimately show ?g - using d1(5)[OF _ _ as(3)] and d2(5)[OF _ _ as(3)] by auto - } - fix k - assume k: "k \ p1 \ p2" - show "k \ s1 \ s2" - using k d1(2) d2(2) by auto - show "k \ {}" - using k d1(3) d2(3) by auto - show "\a b. k = cbox a b" - using k d1(4) d2(4) by auto -qed + fix k1 k2 + assume "k1 \ p1 \ p2" "k2 \ p1 \ p2" "k1 \ k2" + with assms show "interior k1 \ interior k2 = {}" + by (smt (verit, best) IntE Un_iff disjoint_iff_not_equal division_ofD(2) division_ofD(5) inf.orderE interior_Int) +qed (use division_ofD assms in auto) lemma partial_division_extend_1: fixes a b c d :: "'a::euclidean_space" @@ -533,71 +413,59 @@ show "finite p" unfolding p_def by (auto intro!: finite_PiE) { - fix k - assume "k \ p" - then obtain f where f: "f \ Basis \\<^sub>E {(a, c), (c, d), (d, b)}" and k: "k = ?B f" + fix K + assume "K \ p" + then obtain f where f: "f \ Basis \\<^sub>E {(a, c), (c, d), (d, b)}" and k: "K = ?B f" by (auto simp: p_def) - then show "\a b. k = cbox a b" - by auto - have "k \ cbox a b \ k \ {}" - proof (simp add: k box_eq_empty subset_box not_less, safe) - fix i :: 'a - assume i: "i \ Basis" - with f have "f i = (a, c) \ f i = (c, d) \ f i = (d, b)" - by (auto simp: PiE_iff) - with i ord[of i] - show "a \ i \ fst (f i) \ i" "snd (f i) \ i \ b \ i" "fst (f i) \ i \ snd (f i) \ i" - by auto - qed - then show "k \ {}" "k \ cbox a b" + then show "\a b. K = cbox a b" by auto { fix l assume "l \ p" then obtain g where g: "g \ Basis \\<^sub>E {(a, c), (c, d), (d, b)}" and l: "l = ?B g" by (auto simp: p_def) - assume "l \ k" + assume "l \ K" have "\i\Basis. f i \ g i" - proof (rule ccontr) - assume "\ ?thesis" - with f g have "f = g" - by (auto simp: PiE_iff extensional_def fun_eq_iff) - with \l \ k\ show False - by (simp add: l k) - qed + using \l \ K\ l k f g by auto then obtain i where *: "i \ Basis" "f i \ g i" .. then have "f i = (a, c) \ f i = (c, d) \ f i = (d, b)" - "g i = (a, c) \ g i = (c, d) \ g i = (d, b)" + "g i = (a, c) \ g i = (c, d) \ g i = (d, b)" using f g by (auto simp: PiE_iff) - with * ord[of i] show "interior l \ interior k = {}" + with * ord[of i] show "interior l \ interior K = {}" by (auto simp add: l k disjoint_interval intro!: bexI[of _ i]) } - note \k \ cbox a b\ + have "a \ i \ fst (f i) \ i" "snd (f i) \ i \ b \ i" "fst (f i) \ i \ snd (f i) \ i" + if "i \ Basis" for i + proof - + have "f i = (a, c) \ f i = (c, d) \ f i = (d, b)" + using that f by (auto simp: PiE_iff) + with that ord[of i] + show "a \ i \ fst (f i) \ i" "snd (f i) \ i \ b \ i" "fst (f i) \ i \ snd (f i) \ i" + by auto + qed + then show "K \ {}" "K \ cbox a b" + by (auto simp add: k box_eq_empty subset_box not_less) } moreover - { - fix x assume x: "x \ cbox a b" - have "\i\Basis. \l. x \ i \ {fst l \ i .. snd l \ i} \ l \ {(a, c), (c, d), (d, b)}" - proof - fix i :: 'a - assume "i \ Basis" - with x ord[of i] + have "\k\p. x \ k" if x: "x \ cbox a b" for x + proof - + have "\l. x \ i \ {fst l \ i .. snd l \ i} \ l \ {(a, c), (c, d), (d, b)}" if "i \ Basis" for i + proof - have "(a \ i \ x \ i \ x \ i \ c \ i) \ (c \ i \ x \ i \ x \ i \ d \ i) \ (d \ i \ x \ i \ x \ i \ b \ i)" + using that x ord[of i] by (auto simp: cbox_def) then show "\l. x \ i \ {fst l \ i .. snd l \ i} \ l \ {(a, c), (c, d), (d, b)}" by auto qed then obtain f where f: "\i\Basis. x \ i \ {fst (f i) \ i..snd (f i) \ i} \ f i \ {(a, c), (c, d), (d, b)}" - unfolding bchoice_iff .. - moreover from f have "restrict f Basis \ Basis \\<^sub>E {(a, c), (c, d), (d, b)}" - by auto - moreover from f have "x \ ?B (restrict f Basis)" + by metis + moreover from f have "x \ ?B (restrict f Basis)" "restrict f Basis \ Basis \\<^sub>E {(a,c), (c,d), (d,b)}" by (auto simp: mem_box) - ultimately have "\k\p. x \ k" + ultimately show ?thesis unfolding p_def by blast - } + qed ultimately show "\p = cbox a b" by auto qed @@ -608,14 +476,12 @@ obtains q where "p \ q" "q division_of cbox a (b::'a::euclidean_space)" proof (cases "p = {}") case True - obtain q where "q division_of (cbox a b)" - by (rule elementary_interval) then show ?thesis - using True that by blast + using elementary_interval that by auto next case False note p = division_ofD[OF assms(1)] - have div_cbox: "\k\p. \q. q division_of cbox a b \ k \ q" + have "\k\p. \q. q division_of cbox a b \ k \ q" proof fix k assume kp: "k \ p" @@ -629,64 +495,55 @@ then show "\q. q division_of cbox a b \ k \ q" unfolding k by auto qed - obtain q where q: "\x. x \ p \ q x division_of cbox a b" "\x. x \ p \ x \ q x" - using bchoice[OF div_cbox] by blast + then obtain q where q: "\x. x \ p \ q x division_of cbox a b" "\x. x \ p \ x \ q x" + by metis have "q x division_of \(q x)" if x: "x \ p" for x - apply (rule division_ofI) - using division_ofD[OF q(1)[OF x]] by auto + using q(1) x by blast then have di: "\x. x \ p \ \d. d division_of \(q x - {x})" by (meson Diff_subset division_of_subset) - have "\d. d division_of \((\i. \(q i - {i})) ` p)" - apply (rule elementary_Inter [OF finite_imageI[OF p(1)]]) - apply (auto dest: di simp: False elementary_Inter [OF finite_imageI[OF p(1)]]) - done - then obtain d where d: "d division_of \((\i. \(q i - {i})) ` p)" .. + have "\s\(\i. \ (q i - {i})) ` p. \d. d division_of s" + using di by blast + then obtain d where d: "d division_of \((\i. \(q i - {i})) ` p)" + by (meson False elementary_Inter finite_imageI image_is_empty p(1)) have "d \ p division_of cbox a b" proof - have te: "\S f T. S \ {} \ \i\S. f i \ i = T \ T = \(f ` S) \ \S" by auto have cbox_eq: "cbox a b = \((\i. \(q i - {i})) ` p) \ \p" proof (rule te[OF False], clarify) fix i - assume i: "i \ p" - show "\(q i - {i}) \ i = cbox a b" - using division_ofD(6)[OF q(1)[OF i]] using q(2)[OF i] by auto + assume "i \ p" + then show "\(q i - {i}) \ i = cbox a b" + by (metis Un_commute complete_lattice_class.Sup_insert division_ofD(6) insert_Diff q) qed - { fix K - assume K: "K \ p" - note qk=division_ofD[OF q(1)[OF K]] - have *: "\u T S. T \ S = {} \ u \ S \ u \ T = {}" + have [simp]: "interior (\i\p. \(q i - {i})) \ interior K = {}" if K: "K \ p" for K + proof - + note qk = division_ofD[OF q(1)[OF K]] + have *: "\U T S. T \ S = {} \ U \ S \ U \ T = {}" by auto - have "interior (\i\p. \(q i - {i})) \ interior K = {}" + show ?thesis proof (rule *[OF Int_interior_Union_intervals]) show "\T. T\q K - {K} \ interior K \ interior T = {}" - using qk(5) using q(2)[OF K] by auto + using K q(2) qk(5) by auto show "interior (\i\p. \(q i - {i})) \ interior (\(q K - {K}))" - apply (rule interior_mono)+ - using K by auto - qed (use qk in auto)} note [simp] = this + by (meson INF_lower K interior_mono) + qed (use qk in auto) + qed show "d \ p division_of (cbox a b)" - unfolding cbox_eq - apply (rule division_disjoint_union[OF d assms(1)]) - apply (rule Int_interior_Union_intervals) - apply (rule p open_interior ballI)+ - apply simp_all - done + by (simp add: Int_interior_Union_intervals assms(1) cbox_eq d division_disjoint_union p(1) p(4)) qed then show ?thesis by (meson Un_upper2 that) qed lemma elementary_bounded[dest]: - fixes S :: "'a::euclidean_space set" shows "p division_of S \ bounded S" unfolding division_of_def by (metis bounded_Union bounded_cbox) lemma elementary_subset_cbox: - "p division_of S \ \a b. S \ cbox a (b::'a::euclidean_space)" + "p division_of S \ \a b. S \ cbox a b" by (meson bounded_subset_cbox_symmetric elementary_bounded) proposition division_union_intervals_exists: - fixes a b :: "'a::euclidean_space" assumes "cbox a b \ {}" obtains p where "(insert (cbox a b) p) division_of (cbox a b \ cbox c d)" proof (cases "cbox c d = {}") @@ -707,26 +564,19 @@ obtain p where pd: "p division_of cbox c d" and "cbox u v \ p" by (rule partial_division_extend_1[OF uv_sub False[unfolded uv]]) note p = this division_ofD[OF pd] - have "interior (cbox a b \ \(p - {cbox u v})) = interior(cbox u v \ \(p - {cbox u v}))" - apply (rule arg_cong[of _ _ interior]) - using p(8) uv by auto + have "interior (cbox a b \ \(p - {cbox u v})) = interior(cbox u v) \ interior (\(p - {cbox u v}))" + by (metis Diff_subset Int_absorb1 Int_assoc Sup_subset_mono interior_Int p(8) uv) also have "\ = {}" - unfolding interior_Int - apply (rule Int_interior_Union_intervals) using p(6) p(7)[OF p(2)] \finite p\ - apply auto - done - finally have [simp]: "interior (cbox a b) \ interior (\(p - {cbox u v})) = {}" by simp + by (intro Int_interior_Union_intervals) auto + finally have disj: "interior (cbox a b) \ interior (\(p - {cbox u v})) = {}" + by simp have cbe: "cbox a b \ cbox c d = cbox a b \ \(p - {cbox u v})" using p(8) unfolding uv[symmetric] by auto have "insert (cbox a b) (p - {cbox u v}) division_of cbox a b \ \(p - {cbox u v})" - proof - - have "{cbox a b} division_of cbox a b" - by (simp add: assms division_of_self) - then show "insert (cbox a b) (p - {cbox u v}) division_of cbox a b \ \(p - {cbox u v})" - by (metis (no_types) Diff_subset \interior (cbox a b) \ interior (\(p - {cbox u v})) = {}\ division_disjoint_union division_of_subset insert_is_Un p(1) p(8)) - qed - with that[of "p - {cbox u v}"] show ?thesis by (simp add: cbe) + by (metis Diff_subset assms disj division_disjoint_union division_of_self division_of_subset insert_is_Un p(8) pd) + with that[of "p - {cbox u v}"] show ?thesis + by (simp add: cbe) qed qed @@ -735,7 +585,7 @@ and "\p. p \ f \ p division_of (\p)" and "\k1 k2. k1 \ \f \ k2 \ \f \ k1 \ k2 \ interior k1 \ interior k2 = {}" shows "\f division_of \(\f)" - using assms by (auto intro!: division_ofI) + using assms by (auto intro!: division_ofI) lemma elementary_union_interval: fixes a b :: "'a::euclidean_space" @@ -756,21 +606,13 @@ proof (cases "interior (cbox a b) = {}") case True show ?thesis - apply (rule that [of "insert (cbox a b) p", OF division_ofI]) - using pdiv(1-4) True False apply auto - apply (metis IntI equals0D pdiv(5)) - by (metis disjoint_iff_not_equal pdiv(5)) + by (metis True assms division_disjoint_union elementary_interval inf_bot_left that) next - case False + case nonempty: False have "\K\p. \q. (insert (cbox a b) q) division_of (cbox a b \ K)" - proof - fix K - assume kp: "K \ p" - from pdiv(4)[OF kp] obtain c d where "K = cbox c d" by blast - then show "\q. (insert (cbox a b) q) division_of (cbox a b \ K)" - by (meson \cbox a b \ {}\ division_union_intervals_exists) - qed - from bchoice[OF this] obtain q where "\x\p. insert (cbox a b) (q x) division_of (cbox a b) \ x" .. + by (metis \cbox a b \ {}\ division_union_intervals_exists pdiv(4)) + then obtain q where "\x\p. insert (cbox a b) (q x) division_of (cbox a b) \ x" + by metis note q = division_ofD[OF this[rule_format]] let ?D = "\{insert (cbox a b) (q K) | K. K \ p}" show thesis @@ -814,11 +656,11 @@ by (metis \interior (cbox a b) \ {}\ K q(2) x interior_subset_union_intervals) moreover obtain c d where c_d: "K' = cbox c d" - using q(4)[OF x'(2,1)] by blast + using q(4) x'(1) x'(2) by presburger have "interior K' \ interior (cbox a b) = {}" using as'(2) q(5) x' by blast then have "interior K' \ interior x'" - by (metis \interior (cbox a b) \ {}\ c_d interior_subset_union_intervals q(2) x'(1) x'(2)) + by (metis nonempty c_d interior_subset_union_intervals q(2) x') moreover have "interior x \ interior x' = {}" by (meson False assms division_ofD(5) x'(2) x(2)) ultimately show ?thesis @@ -831,39 +673,34 @@ lemma elementary_unions_intervals: - assumes fin: "finite f" - and "\s. s \ f \ \a b. s = cbox a (b::'a::euclidean_space)" - obtains p where "p division_of (\f)" + assumes fin: "finite \" + and "\s. s \ \ \ \a b. s = cbox a (b::'a::euclidean_space)" + obtains p where "p division_of (\\)" proof - - have "\p. p division_of (\f)" - proof (induct_tac f rule:finite_subset_induct) + have "\p. p division_of (\\)" + proof (induct_tac \ rule:finite_subset_induct) show "\p. p division_of \{}" using elementary_empty by auto next fix x F - assume as: "finite F" "x \ F" "\p. p division_of \F" "x\f" - from this(3) obtain p where p: "p division_of \F" .. - from assms(2)[OF as(4)] obtain a b where x: "x = cbox a b" by blast - have *: "\F = \p" - using division_ofD[OF p] by auto - show "\p. p division_of \(insert x F)" - using elementary_union_interval[OF p[unfolded *], of a b] - unfolding Union_insert x * by metis - qed (insert assms, auto) + assume as: "finite F" "x \ F" "\p. p division_of \F" "x\\" + then obtain a b where x: "x = cbox a b" + by (meson assms(2)) + then show "\p. p division_of \(insert x F)" + using elementary_union_interval by (metis Union_insert as(3) division_ofD(6)) + qed (use assms in auto) then show ?thesis using that by auto qed lemma elementary_union: - fixes S T :: "'a::euclidean_space set" assumes "ps division_of S" "pt division_of T" obtains p where "p division_of (S \ T)" proof - - have *: "S \ T = \ps \ \pt" + have "S \ T = \ps \ \pt" using assms unfolding division_of_def by auto + with elementary_unions_intervals[of "ps \ pt"] assms show ?thesis - apply (rule elementary_unions_intervals[of "ps \ pt"]) - using assms apply auto - by (simp add: * that) + by (metis Un_iff Union_Un_distrib division_of_def finite_Un that) qed lemma partial_division_extend: @@ -881,10 +718,7 @@ by (metis ab dual_order.trans partial_division_extend_interval divp(6)) note r1 = this division_ofD[OF this(2)] obtain p' where "p' division_of \(r1 - p)" - apply (rule elementary_unions_intervals[of "r1 - p"]) - using r1(3,6) - apply auto - done + by (metis Diff_subset division_of_subset r1(2) r1(8)) then obtain r2 where r2: "r2 division_of (\(r1 - p)) \ (\q)" by (metis assms(2) divq(6) elementary_Int) { @@ -894,11 +728,7 @@ unfolding r1 using ab by (meson division_contains r1(2) subsetCE) moreover have "R \ p" - proof - assume "R \ p" - then have "x \ S" using divp(2) r by auto - then show False using x by auto - qed + using divp(6) r(2) x(2) by blast ultimately have "x\\(r1 - p)" by auto } then have Teq: "T = \p \ (\(r1 - p) \ \q)" @@ -923,14 +753,11 @@ then have div: "p \ r2 division_of \p \ \(r1 - p) \ \q" by (simp add: assms(1) division_disjoint_union divp(6) r2) show ?thesis - apply (rule that[of "p \ r2"]) - apply (auto simp: div Teq) - done + by (metis Teq div sup_ge1 that) qed lemma division_split: - fixes a :: "'a::euclidean_space" assumes "p division_of (cbox a b)" and k: "k\Basis" shows "{l \ {x. x\k \ c} | l. l \ p \ l \ {x. x\k \ c} \ {}} division_of(cbox a b \ {x. x\k \ c})" @@ -954,11 +781,10 @@ using l p(2) uv by force show "K \ {}" by (simp add: l) - show "\a b. K = cbox a b" - apply (simp add: l uv p(2-3)[OF l(2)]) - apply (subst interval_split[OF k]) - apply (auto intro: order.trans) - done + have "\a b. cbox u v \ {x. x \ k \ c} = cbox a b" + unfolding interval_split[OF k] by (auto intro: order.trans) + then show "\a b. K = cbox a b" + by (simp add: l(1) uv) fix K' assume "K' \ ?p1" then obtain l' where l': "K' = l' \ {x. x \ k \ c}" "l' \ p" "l' \ {x. x \ k \ c} \ {}" @@ -978,11 +804,10 @@ using l p(2) uv by force show "K \ {}" by (simp add: l) - show "\a b. K = cbox a b" - apply (simp add: l uv p(2-3)[OF l(2)]) - apply (subst interval_split[OF k]) - apply (auto intro: order.trans) - done + have "\a b. cbox u v \ {x. c \ x \ k} = cbox a b" + unfolding interval_split[OF k] by (auto intro: order.trans) + then show "\a b. K = cbox a b" + by (simp add: l(1) uv) fix K' assume "K' \ ?p2" then obtain l' where l': "K' = l' \ {x. c \ x \ k}" "l' \ p" "l' \ {x. c \ x \ k} \ {}" @@ -1037,9 +862,9 @@ and "(\{K. \x. (x,K) \ s} = i)" shows "s tagged_division_of i" unfolding tagged_division_of - using assms by fastforce + using assms by fastforce -lemma tagged_division_ofD[dest]: (*FIXME USE A LOCALE*) +lemma tagged_division_ofD[dest]: assumes "s tagged_division_of i" shows "finite s" and "\x K. (x,K) \ s \ x \ K" @@ -1057,18 +882,14 @@ note assm = tagged_division_ofD[OF assms] show "\(snd ` s) = i" "finite (snd ` s)" using assm by auto - fix k - assume k: "k \ snd ` s" - then obtain xk where xk: "(xk, k) \ s" - by auto - then show "k \ i" "k \ {}" "\a b. k = cbox a b" + fix K + assume k: "K \ snd ` s" + then show "K \ i" "K \ {}" "\a b. K = cbox a b" using assm by fastforce+ - fix k' - assume k': "k' \ snd ` s" "k \ k'" - from this(1) obtain xk' where xk': "(xk', k') \ s" - by auto - then show "interior k \ interior k' = {}" - using assm(5) k'(2) xk by blast + fix K' + assume k': "K' \ snd ` s" "K \ K'" + then show "interior K \ interior K' = {}" + by (metis (no_types, lifting) assms imageE k prod.collapse tagged_division_ofD(5)) qed lemma partial_division_of_tagged_division: @@ -1078,23 +899,18 @@ note assm = tagged_partial_division_ofD[OF assms] show "finite (snd ` s)" "\(snd ` s) = \(snd ` s)" using assm by auto - fix k - assume k: "k \ snd ` s" - then obtain xk where xk: "(xk, k) \ s" - by auto - then show "k \ {}" "\a b. k = cbox a b" "k \ \(snd ` s)" - using assm by auto - fix k' - assume k': "k' \ snd ` s" "k \ k'" - from this(1) obtain xk' where xk': "(xk', k') \ s" - by auto - then show "interior k \ interior k' = {}" - using assm(5) k'(2) xk by auto + fix K + assume K: "K \ snd ` s" + then show "K \ {}" "\a b. K = cbox a b" "K \ \(snd ` s)" + using assm by fastforce+ + fix K' + assume "K' \ snd ` s" "K \ K'" + then show "interior K \ interior K' = {}" + using assm(5) K by force qed lemma tagged_partial_division_subset: - assumes "s tagged_partial_division_of i" - and "t \ s" + assumes "s tagged_partial_division_of i" and "t \ s" shows "t tagged_partial_division_of i" using assms finite_subset[OF assms(2)] unfolding tagged_partial_division_of_def @@ -1116,8 +932,7 @@ by (rule tagged_division_ofI) auto lemma tagged_division_of_self_real: "x \ {a .. b::real} \ {(x,{a .. b})} tagged_division_of {a .. b}" - unfolding box_real[symmetric] - by (rule tagged_division_of_self) + by (metis box_real(2) tagged_division_of_self) lemma tagged_division_Un: assumes "p1 tagged_division_of s1" @@ -1131,20 +946,16 @@ using p1(1) p2(1) by auto show "\{k. \x. (x, k) \ p1 \ p2} = s1 \ s2" using p1(6) p2(6) by blast - fix x k - assume xk: "(x, k) \ p1 \ p2" - show "x \ k" "\a b. k = cbox a b" - using xk p1(2,4) p2(2,4) by auto - show "k \ s1 \ s2" - using xk p1(3) p2(3) by blast - fix x' k' - assume xk': "(x', k') \ p1 \ p2" "(x, k) \ (x', k')" + fix x K + assume xK: "(x, K) \ p1 \ p2" + show "x \ K" "\a b. K = cbox a b" "K \ s1 \ s2" + using xK p1 p2 by auto + fix x' K' + assume xk': "(x', K') \ p1 \ p2" "(x, K) \ (x', K')" have *: "\a b. a \ s1 \ b \ s2 \ interior a \ interior b = {}" using assms(3) interior_mono by blast - show "interior k \ interior k' = {}" - apply (cases "(x, k) \ p1") - apply (meson "*" UnE assms(1) assms(2) p1(5) tagged_division_ofD(3) xk'(1) xk'(2)) - by (metis "*" UnE assms(1) assms(2) inf_sup_aci(1) p2(5) tagged_division_ofD(3) xk xk'(1) xk'(2)) + with assms show "interior K \ interior K' = {}" + by (metis Un_iff inf_commute p1(3) p2(3) tagged_division_ofD(5) xK xk') qed lemma tagged_division_Union: @@ -1186,21 +997,16 @@ lemma tagged_partial_division_of_Union_self: assumes "p tagged_partial_division_of s" shows "p tagged_division_of (\(snd ` p))" - apply (rule tagged_division_ofI) using tagged_partial_division_ofD[OF assms] - apply auto - done + by (intro tagged_division_ofI) auto lemma tagged_division_of_union_self: assumes "p tagged_division_of s" shows "p tagged_division_of (\(snd ` p))" - apply (rule tagged_division_ofI) using tagged_division_ofD[OF assms] - apply auto - done + by (intro tagged_division_ofI) auto lemma tagged_division_Un_interval: - fixes a :: "'a::euclidean_space" assumes "p1 tagged_division_of (cbox a b \ {x. x\k \ (c::real)})" and "p2 tagged_division_of (cbox a b \ {x. x\k \ c})" and k: "k \ Basis" @@ -1208,13 +1014,10 @@ proof - have *: "cbox a b = (cbox a b \ {x. x\k \ c}) \ (cbox a b \ {x. x\k \ c})" by auto - show ?thesis - apply (subst *) - apply (rule tagged_division_Un[OF assms(1-2)]) - unfolding interval_split[OF k] interior_cbox - using k - apply (auto simp add: box_def elim!: ballE[where x=k]) - done + have "interior (cbox a b \ {x. x \ k \ c}) \ interior (cbox a b \ {x. c \ x \ k}) = {}" + using k by (force simp: interval_split[OF k] box_def) + with assms show ?thesis + by (metis "*" tagged_division_Un) qed lemma tagged_division_Un_interval_real: @@ -1223,35 +1026,23 @@ and "p2 tagged_division_of ({a .. b} \ {x. x\k \ c})" and k: "k \ Basis" shows "(p1 \ p2) tagged_division_of {a .. b}" - using assms - unfolding box_real[symmetric] - by (rule tagged_division_Un_interval) + using assms by (metis box_real(2) tagged_division_Un_interval) lemma tagged_division_split_left_inj: assumes d: "d tagged_division_of i" - and tags: "(x1, K1) \ d" "(x2, K2) \ d" - and "K1 \ K2" - and eq: "K1 \ {x. x \ k \ c} = K2 \ {x. x \ k \ c}" - shows "interior (K1 \ {x. x\k \ c}) = {}" -proof - - have "interior (K1 \ K2) = {} \ (x2, K2) = (x1, K1)" - using tags d by (metis (no_types) interior_Int tagged_division_ofD(5)) - then show ?thesis - using eq \K1 \ K2\ by (metis (no_types) inf_assoc inf_bot_left inf_left_idem interior_Int old.prod.inject) -qed + and tags: "(x1, K1) \ d" "(x2, K2) \ d" + and "K1 \ K2" + and eq: "K1 \ {x. x \ k \ c} = K2 \ {x. x \ k \ c}" + shows "interior (K1 \ {x. x\k \ c}) = {}" + by (smt (verit) Int_Un_eq(1) Un_Int_distrib interior_Int prod.inject sup_bot.right_neutral tagged_division_ofD(5) assms) lemma tagged_division_split_right_inj: assumes d: "d tagged_division_of i" - and tags: "(x1, K1) \ d" "(x2, K2) \ d" - and "K1 \ K2" - and eq: "K1 \ {x. x\k \ c} = K2 \ {x. x\k \ c}" - shows "interior (K1 \ {x. x\k \ c}) = {}" -proof - - have "interior (K1 \ K2) = {} \ (x2, K2) = (x1, K1)" - using tags d by (metis (no_types) interior_Int tagged_division_ofD(5)) - then show ?thesis - using eq \K1 \ K2\ by (metis (no_types) inf_assoc inf_bot_left inf_left_idem interior_Int old.prod.inject) -qed + and tags: "(x1, K1) \ d" "(x2, K2) \ d" + and "K1 \ K2" + and eq: "K1 \ {x. x\k \ c} = K2 \ {x. x\k \ c}" + shows "interior (K1 \ {x. x\k \ c}) = {}" + by (smt (verit) Int_Un_eq(1) Un_Int_distrib interior_Int prod.inject sup_bot.right_neutral tagged_division_ofD(5) assms) lemma (in comm_monoid_set) over_tagged_division_lemma: assumes "p tagged_division_of i" @@ -1272,14 +1063,10 @@ using assm(4)[of "fst x" "snd x"] \x\p\ by auto have "(fst x, snd y) \ p" "(fst x, snd y) \ y" using \x \ p\ \x \ y\ \snd x = snd y\ [symmetric] by auto - with \x\p\ \y\p\ have "interior (snd x) \ interior (snd y) = {}" - by (intro assm(5)[of "fst x" _ "fst y"]) auto - then have "box a b = {}" - unfolding \snd x = snd y\[symmetric] ab by auto - then have "d (cbox a b) = \<^bold>1" - using assm(2)[of "fst x" "snd x"] \x\p\ ab[symmetric] by (intro assms(2)) auto + with \x\p\ \y\p\ have "box a b = {}" + by (metis \snd x = snd y\ ab assm(5) inf.idem interior_cbox prod.collapse) then show "d (snd x) = \<^bold>1" - unfolding ab by auto + by (simp add: ab assms(2)) qed qed @@ -1311,11 +1098,8 @@ by standard (auto simp: lift_option_def ac_simps split: bind_split) qed -lemma comm_monoid_and: "comm_monoid HOL.conj True" - by standard auto - lemma comm_monoid_set_and: "comm_monoid_set HOL.conj True" - by (rule comm_monoid_set.intro) (fact comm_monoid_and) + by (simp add: comm_monoid_set.intro conj.comm_monoid_axioms) paragraph \Misc\ @@ -1323,9 +1107,7 @@ lemma interval_real_split: "{a .. b::real} \ {x. x \ c} = {a .. min b c}" "{a .. b} \ {x. c \ x} = {max a c .. b}" - apply (metis Int_atLeastAtMostL1 atMost_def) - apply (metis Int_atLeastAtMostL2 atLeast_def) - done + by auto lemma bgauge_existence_lemma: "(\x\s. \d::real. 0 < d \ q d x) \ (\x. \d>0. x\s \ q d x)" by (meson zero_less_one) @@ -1375,16 +1157,11 @@ proof - obtain u v where l: "l = cbox u v" using \l \ d\ assms(1) by blast - have *: "\i\Basis. u \ i \ (\i\Basis. (if i = k then min (v \ k) c else v \ i) *\<^sub>R i) \ i" - using that(6) unfolding l interval_split[OF k] box_ne_empty that . - have **: "\i\Basis. u\i \ v\i" + have "\i\Basis. u\i \ v\i" using l using that(6) unfolding box_ne_empty[symmetric] by auto - show ?thesis - apply (rule bexI[OF _ \l \ d\]) - using that(1-3,5) \x \ Basis\ - unfolding l interval_bounds[OF **] interval_bounds[OF *] interval_split[OF k] that - apply (auto split: if_split_asm) - done + then show ?thesis + using that \x \ Basis\ unfolding l interval_split[OF k] + by (force split: if_split_asm) qed moreover have "\x y. \y < (if x = k then c else b \ x)\ \ y < b \ x" using \c < b\k\ by (auto split: if_split_asm) @@ -1403,16 +1180,11 @@ proof - obtain u v where l: "l = cbox u v" using \l \ d\ assm(4) by blast - have *: "\i\Basis. (\i\Basis. (if i = k then max (u \ k) c else u \ i) *\<^sub>R i) \ i \ v \ i" - using that(6) unfolding l interval_split[OF k] box_ne_empty that . - have **: "\i\Basis. u\i \ v\i" + have "\i\Basis. u\i \ v\i" using l using that(6) unfolding box_ne_empty[symmetric] by auto - show "\i\d. interval_lowerbound i \ x = y \ interval_upperbound i \ x = y" - apply (rule bexI[OF _ \l \ d\]) - using that(1-3,5) \x \ Basis\ - unfolding l interval_bounds[OF **] interval_bounds[OF *] interval_split[OF k] that - apply (auto split: if_split_asm) - done + then show "\i\d. interval_lowerbound i \ x = y \ interval_upperbound i \ x = y" + using that \x \ Basis\ unfolding l interval_split[OF k] + by (force split: if_split_asm) qed ultimately show ?t2 unfolding division_points_def interval_split[OF k, of a b] @@ -1520,8 +1292,6 @@ shows "(\l. l \ {x. \x\k - c\ \ e}) ` {l\p. l \ {x. \x\k - c\ \ e} \ {}} division_of (cbox a b \ {x. \x\k - c\ \ e})" proof - - have *: "\x c. \x - c\ \ e \ x \ c - e \ x \ c + e" - by auto have **: "\p q p' q'. p division_of q \ p = p' \ q = q' \ p' division_of q'" by auto note division_split(1)[OF assms, where c="c+e",unfolded interval_split[OF k]] @@ -1533,7 +1303,8 @@ apply (rule equalityI) apply blast apply clarsimp - apply (rule_tac x="xa \ {x. c + e \ x \ k}" in exI) + apply (rename_tac S) + apply (rule_tac x="S \ {x. c + e \ x \ k}" in exI) apply auto done by (simp add: interval_split k interval_doublesplit) @@ -1547,16 +1318,8 @@ and Basis_imp: "\a b c k. k \ Basis \ g (cbox a b) = g (cbox a b \ {x. x\k \ c}) \<^bold>* g (cbox a b \ {x. x\k \ c})" begin -lemma empty [simp]: - "g {} = \<^bold>1" -proof - - have *: "cbox One (-One) = ({}::'b set)" - by (auto simp: box_eq_empty inner_sum_left inner_Basis sum.If_cases ex_in_conv) - moreover have "box One (-One) = ({}::'b set)" - using box_subset_cbox[of One "-One"] by (auto simp: *) - ultimately show ?thesis - using box_empty_imp [of One "-One"] by simp -qed +lemma empty [simp]: "g {} = \<^bold>1" + by (metis box_empty_imp box_subset_cbox empty_as_interval subset_empty) lemma division: "F g d = g (cbox a b)" if "d division_of (cbox a b)" @@ -1566,21 +1329,22 @@ using that proof (induction C arbitrary: a b d rule: less_induct) case (less a b d) show ?case - proof cases - assume "box a b = {}" + proof (cases "box a b = {}") + case True { fix k assume "k\d" then obtain a' b' where k: "k = cbox a' b'" using division_ofD(4)[OF less.prems] by blast - with \k\d\ division_ofD(2)[OF less.prems] have "cbox a' b' \ cbox a b" - by auto + then have "cbox a' b' \ cbox a b" + using \k \ d\ less.prems by blast then have "box a' b' \ box a b" unfolding subset_box by auto then have "g k = \<^bold>1" - using box_empty_imp [of a' b'] k by (simp add: \box a b = {}\) } - then show "box a b = {} \ F g d = g (cbox a b)" + using box_empty_imp [of a' b'] k by (simp add: True) + } + with True show "F g d = g (cbox a b)" by (auto intro!: neutral simp: box_empty_imp) next - assume "box a b \ {}" + case False then have ab: "\i\Basis. a\i < b\i" and ab': "\i\Basis. a\i \ b\i" by (auto simp: box_ne_empty) show "F g d = g (cbox a b)" @@ -1600,11 +1364,10 @@ note *[OF this(1)] *[OF this(2)] note this[unfolded interval_bounds[OF uv(1)]] moreover have "a\j \ u\j" "v\j \ b\j" - using division_ofD(2,2,3)[OF \d division_of cbox a b\ as] - apply (metis j subset_box(1) uv(1)) - by (metis \cbox u v \ cbox a b\ j subset_box(1) uv(1)) + by (meson as division_ofD(2) j less.prems subset_box(1) uv(1))+ ultimately have "u\j = a\j \ v\j = a\j \ u\j = b\j \ v\j = b\j \ u\j = a\j \ v\j = b\j" - unfolding not_less de_Morgan_disj using ab[rule_format,of j] uv(2) j by force } + using uv(2) by force + } then have d': "\i\d. \u v. i = cbox u v \ (\j\Basis. u\j = a\j \ v\j = a\j \ u\j = b\j \ v\j = b\j \ u\j = a\j \ v\j = b\j)" unfolding forall_in_division[OF less.prems] by blast @@ -1624,9 +1387,9 @@ proof safe fix j :: 'b assume j: "j \ Basis" - note i(2)[unfolded uv mem_box,rule_format,of j] + note i(2)[unfolded uv mem_box] then show "u \ j = a \ j" and "v \ j = b \ j" - using uv(2)[rule_format,of j] j by (auto simp: inner_simps) + by (smt (verit) False box_midpoint j mem_box(1) uv(2))+ qed then have "i = cbox a b" using uv by auto then show ?thesis using i by auto @@ -1650,17 +1413,11 @@ unfolding euclidean_eq_iff[where 'a='b] by auto then have "u\j = v\j" using uv(2)[rule_format,OF j] by auto - then have "box u v = {}" - using j unfolding box_eq_empty by (auto intro!: bexI[of _ j]) then show "g x = \<^bold>1" - unfolding uv(1) by (rule box_empty_imp) + by (smt (verit) box_empty_imp box_eq_empty(1) j uv(1)) qed then show "F g d = g (cbox a b)" - using division_ofD[OF less.prems] - apply (subst deq) - apply (subst insert) - apply auto - done + by (metis deq division_of_finite insert_Diff_single insert_remove less.prems right_neutral) next case False then have "\x. x \ division_points (cbox a b) d" @@ -1748,12 +1505,7 @@ proposition tagged_division: assumes "d tagged_division_of (cbox a b)" shows "F (\(_, l). g l) d = g (cbox a b)" -proof - - have "F (\(_, k). g k) d = F g (snd ` d)" - using assms box_empty_imp by (rule over_tagged_division_lemma) - then show ?thesis - unfolding assms [THEN division_of_tagged_division, THEN division] . - qed + by (metis assms box_empty_imp division division_of_tagged_division over_tagged_division_lemma) end @@ -1778,14 +1530,14 @@ from that have [simp]: "k = 1" by simp from neutral [of 0 1] neutral [of a a for a] coalesce_less - have [simp]: "g {} = \<^bold>1" "\a. g {a} = \<^bold>1" - "\a b c. a < c \ c < b \ g {a..c} \<^bold>* g {c..b} = g {a..b}" - by auto + have [simp]: "g {} = \<^bold>1" "\a. g {a} = \<^bold>1" + "\a b c. a < c \ c < b \ g {a..c} \<^bold>* g {c..b} = g {a..b}" + by auto have "g {a..b} = g {a..min b c} \<^bold>* g {max a c..b}" - by (auto simp: min_def max_def le_less) + by (auto simp: min_def max_def le_less) then show "g (cbox a b) = g (cbox a b \ {x. x \ k \ c}) \<^bold>* g (cbox a b \ {x. c \ x \ k})" by (simp add: atMost_def [symmetric] atLeast_def [symmetric]) -qed + qed qed show "box = (greaterThanLessThan :: real \ _)" and "cbox = (atLeastAtMost :: real \ _)" @@ -1795,17 +1547,7 @@ lemma coalesce_less_eq: "g {a..c} \<^bold>* g {c..b} = g {a..b}" if "a \ c" "c \ b" - proof (cases "c = a \ c = b") - case False - with that have "a < c" "c < b" - by auto - then show ?thesis - by (rule coalesce_less) - next - case True - with that box_empty_imp [of a a] box_empty_imp [of b b] show ?thesis - by safe simp_all - qed + by (metis coalesce_less commute left_neutral less_eq_real_def neutral that) end @@ -1819,22 +1561,22 @@ show "g {a..b} = z" if "b \ a" for a b using that box_empty_imp by simp show "f (g {a..c}) (g {c..b}) = g {a..b}" if "a < c" "c < b" for a b c - using that - using Basis_imp [of 1 a b c] + using that Basis_imp [of 1 a b c] by (simp_all add: atMost_def [symmetric] atLeast_def [symmetric] max_def min_def) -qed + qed qed subsection \Special case of additivity we need for the FTC\ (*fix add explanation here *) + lemma additive_tagged_division_1: fixes f :: "real \ 'a::real_normed_vector" assumes "a \ b" and "p tagged_division_of {a..b}" - shows "sum (\(x,k). f(Sup k) - f(Inf k)) p = f b - f a" + shows "sum (\(x,K). f(Sup K) - f(Inf K)) p = f b - f a" proof - - let ?f = "(\k::(real) set. if k = {} then 0 else f(interval_upperbound k) - f(interval_lowerbound k))" + let ?f = "(\K::real set. if K = {} then 0 else f(interval_upperbound K) - f(interval_lowerbound K))" interpret operative_real plus 0 ?f rewrites "comm_monoid_set.F (+) 0 = sum" by standard[1] (auto simp add: sum_def) @@ -1843,12 +1585,7 @@ have **: "cbox a b \ {}" using assms(1) by auto then have "f b - f a = (\(x, l)\p. if l = {} then 0 else f (interval_upperbound l) - f (interval_lowerbound l))" - proof - - have "(if cbox a b = {} then 0 else f (interval_upperbound (cbox a b)) - f (interval_lowerbound (cbox a b))) = f b - f a" - using assms by auto - then show ?thesis - using p_td assms by (simp add: tagged_division) - qed + using assms(2) tagged_division by force then show ?thesis using assms by (auto intro!: sum.cong) qed @@ -1897,12 +1634,16 @@ obtain pfn where pfn: "\x. x \ I \ pfn x tagged_division_of x" "\x. x \ I \ d fine pfn x" - using bchoice[OF assms(2)] by auto + using assms by metis show thesis - apply (rule_tac p="\(pfn ` I)" in that) - using assms(1) assms(3) assms(4) pfn(1) tagged_division_Union apply force - by (metis (mono_tags, lifting) fine_Union imageE pfn(2)) + proof + show "\ (pfn ` I) tagged_division_of i" + using assms pfn(1) tagged_division_Union by force + show "d fine \ (pfn ` I)" + by (metis (mono_tags, lifting) fine_Union imageE pfn(2)) + qed qed + (* FIXME structure here, do not have one lemma in each subsection *) subsection\<^marker>\tag unimportant\ \The set we're concerned with must be closed\ @@ -1910,9 +1651,11 @@ lemma division_of_closed: fixes i :: "'n::euclidean_space set" shows "s division_of i \ closed i" - unfolding division_of_def by fastforce + by blast (* FIXME structure here, do not have one lemma in each subsection *) + subsection \General bisection principle for intervals; might be useful elsewhere\ + (* FIXME move? *) lemma interval_bisection_step: fixes type :: "'a::euclidean_space" @@ -1952,11 +1695,10 @@ assume "x \ ?A" then obtain c d where x: "x = cbox c d" - "\i. i \ Basis \ - c \ i = a \ i \ d \ i = ?ab i \ c \ i = ?ab i \ d \ i = b \ i" + "\i. i \ Basis \ c \ i = a \ i \ d \ i = ?ab i \ c \ i = ?ab i \ d \ i = b \ i" by blast have "c = (\i\Basis. (if c \ i = a \ i then a \ i else ?ab i) *\<^sub>R i)" - "d = (\i\Basis. (if c \ i = a \ i then ?ab i else b \ i) *\<^sub>R i)" + "d = (\i\Basis. (if c \ i = a \ i then ?ab i else b \ i) *\<^sub>R i)" using x(2) ab by (fastforce simp add: euclidean_eq_iff[where 'a='a])+ then show "x \ ?B" unfolding x by (rule_tac x="{i. i\Basis \ c\i = a\i}" in image_eqI) auto @@ -1968,7 +1710,7 @@ assume "S \ ?A" then obtain c d where s: "S = cbox c d" - "\i. i \ Basis \ c \ i = a \ i \ d \ i = ?ab i \ c \ i = ?ab i \ d \ i = b \ i" + "\i. i \ Basis \ c \ i = a \ i \ d \ i = ?ab i \ c \ i = ?ab i \ d \ i = b \ i" by blast show "P S" unfolding s using ab s(2) by (fastforce intro!: that) @@ -1986,8 +1728,7 @@ then obtain i where "c\i \ e\i \ d\i \ f\i" and i': "i \ Basis" unfolding euclidean_eq_iff[where 'a='a] by auto then have i: "c\i \ e\i" "d\i \ f\i" - using s(2) t(2) apply fastforce - using t(2)[OF i'] \c \ i \ e \ i \ d \ i \ f \ i\ i' s(2) t(2) by fastforce + using s(2) t(2) by fastforce+ have *: "\s t. (\a. a \ s \ a \ t \ False) \ s \ t = {}" by auto show "interior S \ interior T = {}" @@ -1995,10 +1736,10 @@ proof (rule *) fix x assume "x \ box c d" "x \ box e f" - then have x: "c\i < d\i" "e\i < f\i" "c\i < f\i" "e\i < d\i" - unfolding mem_box using i' by force+ - show False using s(2)[OF i'] t(2)[OF i'] and i x - by auto + then have "c\i < f\i" "e\i < d\i" + unfolding mem_box using i' by force+ + with i i' show False + using s(2) t(2) by fastforce qed qed also have "\?A = cbox a b" @@ -2024,7 +1765,7 @@ by (force simp add: mem_box) qed finally show thesis - by (metis (no_types, lifting) assms(3) that) + by (metis (no_types, lifting) assms(3) that) qed lemma interval_bisection: @@ -2066,9 +1807,10 @@ snd (f x) \ i \ snd x \ i \ 2 * (snd (f x) \ i - fst (f x) \ i) \ snd x \ i - fst x \ i)" by metis define AB A B where ab_def: "AB n = (f ^^ n) (a,b)" "A n = fst(AB n)" "B n = snd(AB n)" for n - have [simp]: "A 0 = a" "B 0 = b" and ABRAW: "\n. \ P (cbox (A(Suc n)) (B(Suc n))) \ - (\i\Basis. A(n)\i \ A(Suc n)\i \ A(Suc n)\i \ B(Suc n)\i \ B(Suc n)\i \ B(n)\i \ - 2 * (B(Suc n)\i - A(Suc n)\i) \ B(n)\i - A(n)\i)" (is "\n. ?P n") + have [simp]: "A 0 = a" "B 0 = b" + and ABRAW: "\n. \ P (cbox (A(Suc n)) (B(Suc n))) \ + (\i\Basis. A(n)\i \ A(Suc n)\i \ A(Suc n)\i \ B(Suc n)\i \ B(Suc n)\i \ B(n)\i \ + 2 * (B(Suc n)\i - A(Suc n)\i) \ B(n)\i - A(n)\i)" (is "\n. ?P n") proof - show "A 0 = a" "B 0 = b" unfolding ab_def by auto @@ -2080,13 +1822,9 @@ unfolding S using \\ P (cbox a b)\ f by auto next case (Suc n) - show ?case + then show ?case unfolding S - apply (rule f[rule_format]) - using Suc - unfolding S - apply auto - done + by (force intro!: f[rule_format]) qed qed then have AB: "A(n)\i \ A(Suc n)\i" "A(Suc n)\i \ B(Suc n)\i" @@ -2109,10 +1847,9 @@ also have "\ \ sum (\i. B n\i - A n\i) Basis" proof (rule sum_mono) fix i :: 'a - assume i: "i \ Basis" - show "\(x - y) \ i\ \ B n \ i - A n \ i" - using xy[unfolded mem_box,THEN bspec, OF i] - by (auto simp: inner_diff_left) + assume "i \ Basis" + with xy show "\(x - y) \ i\ \ B n \ i - A n \ i" + by (smt (verit, best) inner_diff_left mem_box(2)) qed also have "\ \ sum (\i. b\i - a\i) Basis / 2^n" unfolding sum_divide_distrib @@ -2136,23 +1873,21 @@ finally show "dist x y < e" . qed qed - { - fix n m :: nat - assume "m \ n" then have "cbox (A n) (B n) \ cbox (A m) (B m)" - proof (induction rule: inc_induct) - case (step i) - show ?case - using AB by (intro order_trans[OF step.IH] subset_box_imp) auto - qed simp - } note ABsubset = this + have ABsubset: "cbox (A n) (B n) \ cbox (A m) (B m)" if "m \ n" for m n + using that + proof (induction rule: inc_induct) + case (step i) show ?case + by (smt (verit, ccfv_SIG) ABRAW in_mono mem_box(2) step.IH subsetI) + qed simp have "\n. cbox (A n) (B n) \ {}" by (meson AB dual_order.trans interval_not_empty) then obtain x0 where x0: "\n. x0 \ cbox (A n) (B n)" using decreasing_closed_nest [OF closed_cbox] ABsubset interv by blast show thesis - proof (rule that[rule_format, of x0]) - show "x0\cbox a b" + proof (intro that strip) + show "x0 \ cbox a b" using \A 0 = a\ \B 0 = b\ x0 by blast + next fix e :: real assume "e > 0" from interv[OF this] obtain n @@ -2170,17 +1905,14 @@ moreover have "cbox (A n) (B n) \ cbox a b" using ABsubset \A 0 = a\ \B 0 = b\ by blast ultimately show "\c d. x0 \ cbox c d \ cbox c d \ ball x0 e \ cbox c d \ cbox a b \ \ P (cbox c d)" - apply (rule_tac x="A n" in exI) - apply (rule_tac x="B n" in exI) - apply (auto simp: x0) - done + by (meson x0) qed qed subsection \Cousin's lemma\ -lemma fine_division_exists: (*FIXME rename(?) *) +lemma fine_division_exists: fixes a b :: "'a::euclidean_space" assumes "gauge g" obtains p where "p tagged_division_of (cbox a b)" "g fine p" @@ -2199,23 +1931,21 @@ cbox c d \ ball x e \ cbox c d \ (cbox a b) \ \ (\p. p tagged_division_of cbox c d \ g fine p)" - apply (rule interval_bisection[of "\s. \p. p tagged_division_of s \ g fine p", OF _ _ False]) - apply (simp add: fine_def) - apply (metis tagged_division_Un fine_Un) - apply auto - done + proof (rule interval_bisection[of "\s. \p. p tagged_division_of s \ _ p", OF _ _ False]) + show "\p. p tagged_division_of {} \ g fine p" + by (simp add: fine_def) + qed (meson tagged_division_Un fine_Un)+ obtain e where e: "e > 0" "ball x e \ g x" - using gaugeD[OF assms, of x] unfolding open_contains_ball by auto - from x(2)[OF e(1)] - obtain c d where c_d: "x \ cbox c d" + by (meson assms gauge_def openE) + then obtain c d where c_d: "x \ cbox c d" "cbox c d \ ball x e" "cbox c d \ cbox a b" "\ (\p. p tagged_division_of cbox c d \ g fine p)" - by blast + by (meson x(2)) have "g fine {(x, cbox c d)}" unfolding fine_def using e using c_d(2) by auto then show ?thesis - using tagged_division_of_self[OF c_d(1)] using c_d by auto + using tagged_division_of_self[OF c_d(1)] using c_d by simp qed lemma fine_division_exists_real: @@ -2232,7 +1962,7 @@ and "gauge d" obtains q where "q tagged_division_of (cbox a b)" and "d fine q" - and "\(x,k) \ p. k \ d(x) \ (x,k) \ q" + and "\(x,K) \ p. K \ d(x) \ (x,K) \ q" proof - have p: "finite p" "p tagged_partial_division_of (cbox a b)" using ptag tagged_division_of_def by blast+ @@ -2250,48 +1980,48 @@ obtain q1 where q1: "q1 tagged_division_of \{k. \x. (x, k) \ p}" and "d fine q1" and q1I: "\x k. \(x, k)\p; k \ d x\ \ (x, k) \ q1" - using case_prodD tagged_partial_division_subset[OF insert(4) subset_insertI] - by (metis (mono_tags, lifting) insert.hyps(3) insert.prems(2)) + using insert + by (metis (mono_tags, lifting) case_prodD subset_insertI tagged_partial_division_subset) have *: "\{l. \y. (y,l) \ insert xk p} = k \ \{l. \y. (y,l) \ p}" unfolding xk by auto note p = tagged_partial_division_ofD[OF insert(4)] obtain u v where uv: "k = cbox u v" using p(4) xk by blast - have "finite {k. \x. (x, k) \ p}" - apply (rule finite_subset[of _ "snd ` p"]) - using image_iff apply fastforce - using insert.hyps(1) by blast + have "{K. \x. (x, K) \ p} \ snd ` p" + by force + then have "finite {K. \x. (x, K) \ p}" + using finite_surj insert.hyps(1) by blast then have int: "interior (cbox u v) \ interior (\{k. \x. (x, k) \ p}) = {}" proof (rule Int_interior_Union_intervals) show "open (interior (cbox u v))" by auto - show "\T. T \ {k. \x. (x, k) \ p} \ \a b. T = cbox a b" + show "\T. T \ {K. \x. (x, K) \ p} \ \a b. T = cbox a b" using p(4) by auto - show "\T. T \ {k. \x. (x, k) \ p} \ interior (cbox u v) \ interior T = {}" - by clarify (metis insert.hyps(2) insert_iff interior_cbox p(5) uv xk) + show "\T. T \ {K. \x. (x, K) \ p} \ interior (cbox u v) \ interior T = {}" + using insert.hyps(2) p(5) uv xk by blast qed show ?case proof (cases "cbox u v \ d x") case True have "{(x, cbox u v)} tagged_division_of cbox u v" by (simp add: p(2) uv xk tagged_division_of_self) - then have "{(x, cbox u v)} \ q1 tagged_division_of \{k. \x. (x, k) \ insert xk p}" - unfolding * uv by (metis (no_types, lifting) int q1 tagged_division_Un) - with True show ?thesis - apply (rule_tac x="{(x,cbox u v)} \ q1" in exI) - using \d fine q1\ fine_def q1I uv xk apply fastforce - done + then have "{(x, cbox u v)} \ q1 tagged_division_of \{K. \x. (x, K) \ insert xk p}" + by (smt (verit, best) "*" int q1 tagged_division_Un uv) + moreover have "d fine ({(x,cbox u v)} \ q1)" + using True \d fine q1\ fine_def by fastforce + ultimately show ?thesis + by (metis (no_types, lifting) case_prodI2 insert_iff insert_is_Un q1I uv xk) next case False obtain q2 where q2: "q2 tagged_division_of cbox u v" "d fine q2" using fine_division_exists[OF assms(2)] by blast show ?thesis - apply (rule_tac x="q2 \ q1" in exI) - apply (intro conjI) - unfolding * uv - apply (rule tagged_division_Un q2 q1 int fine_Un)+ - apply (auto intro: q1 q2 fine_Un \d fine q1\ simp add: False q1I uv xk) - done + proof (intro exI conjI) + show "q2 \ q1 tagged_division_of \ {k. \x. (x, k) \ insert xk p}" + by (smt (verit, best) "*" int q1 q2(1) tagged_division_Un uv) + show "d fine q2 \ q1" + by (simp add: \d fine q1\ fine_Un q2(2)) + qed (use False uv xk q1I in auto) qed qed with p obtain q where q: "q tagged_division_of \{k. \x. (x, k) \ p}" "d fine q" "\(x, k)\p. k \ d x \ (x, k) \ q" @@ -2335,8 +2065,7 @@ show "\?D0 \ cbox a b" apply (simp add: UN_subset_iff) apply (intro conjI allI ballI subset_box_imp) - apply (simp add: field_simps) - apply (auto intro: mult_right_mono aibi) + apply (simp add: field_simps aibi mult_right_mono) apply (force simp: aibi scaling_mono nat_less_real_le dest: PiE_mem intro: mult_right_mono) done next @@ -2352,22 +2081,19 @@ fix v w m and n::nat assume "m \ n" \ \WLOG we can assume \<^term>\m \ n\, when the first disjunct becomes impossible\ have "?K0(n,w) \ ?K0(m,v) \ interior(?K0(m,v)) \ interior(?K0(n,w)) = {}" + apply (rule ccontr) apply (simp add: subset_box disjoint_interval) - apply (rule ccontr) apply (clarsimp simp add: aibi mult_le_cancel_right divide_le_cancel not_less not_le) apply (drule_tac x=i in bspec, assumption) using \m\n\ realff [of _ _ "1+_"] realff [of "1+_"_ "1+_"] apply (auto simp: divide_simps add.commute not_le nat_le_iff_add realff) - apply (simp_all add: power_add) - apply (metis (no_types, opaque_lifting) mult_Suc mult_less_cancel2 not_less_eq mult.assoc) - apply (metis (no_types, opaque_lifting) mult_Suc mult_less_cancel2 not_less_eq mult.assoc) + apply (metis (no_types, opaque_lifting) power_add mult_Suc mult_less_cancel2 not_less_eq mult.assoc)+ done then show "?K0(m,v) \ ?K0(n,w) \ ?K0(n,w) \ ?K0(m,v) \ interior(?K0(m,v)) \ interior(?K0(n,w)) = {}" by meson qed auto show "\A B. \A \ ?D0; B \ ?D0\ \ A \ B \ B \ A \ interior A \ interior B = {}" - apply (erule imageE SigmaE)+ - using * by simp + using * by fastforce next show "\K \ ?D0. x \ K \ K \ g x" if "x \ S" for x proof (simp only: bex_simps split_paired_Bex_Sigma) @@ -2389,9 +2115,8 @@ by (meson sum_bounded_above that) also have "... = \ / 2" by (simp add: field_split_simps) - also have "... < \" - by (simp add: \0 < \\) - finally show ?thesis . + finally show ?thesis + using \0 < \\ by linarith qed then show ?thesis by (rule_tac e = "\ / 2 / DIM('a)" in that) (simp_all add: \0 < \\ dist_norm subsetD [OF \]) @@ -2404,13 +2129,7 @@ then have "norm (b - a) < e * 2^n" by (auto simp: field_split_simps) then have bai: "b \ i - a \ i < e * 2 ^ n" if "i \ Basis" for i - proof - - have "b \ i - a \ i \ norm (b - a)" - by (metis abs_of_nonneg dual_order.trans inner_diff_left linear norm_ge_zero Basis_le_norm that) - also have "... < e * 2 ^ n" - using \norm (b - a) < e * 2 ^ n\ by blast - finally show ?thesis . - qed + by (smt (verit, del_insts) Basis_le_norm diff_add_cancel inner_simps(1) that) have D: "(a + n \ x \ x \ a + m) \ (a + n \ y \ y \ a + m) \ abs(x - y) \ m - n" for a m n x and y::real by auto @@ -2438,9 +2157,9 @@ next have "a \ i + real ?k * (b \ i - a \ i) / 2 ^ n \ a \ i + (2 ^ n * (x \ i - a \ i) / (b \ i - a \ i)) * (b \ i - a \ i) / 2 ^ n" + using aibi [OF \i \ Basis\] xab 2 apply (intro add_left_mono mult_right_mono divide_right_mono of_nat_floor) - using aibi [OF \i \ Basis\] xab 2 - apply (simp_all add: \i \ Basis\ mem_box field_split_simps) + apply (auto simp: \i \ Basis\ mem_box field_split_simps) done also have "... = x \ i" using abi_less by (simp add: field_split_simps) @@ -2449,8 +2168,8 @@ have "x \ i \ a \ i + (2 ^ n * (x \ i - a \ i) / (b \ i - a \ i)) * (b \ i - a \ i) / 2 ^ n" using abi_less by (simp add: field_split_simps) also have "... \ a \ i + (real ?k + 1) * (b \ i - a \ i) / 2 ^ n" + using aibi [OF \i \ Basis\] xab apply (intro add_left_mono mult_right_mono divide_right_mono of_nat_floor) - using aibi [OF \i \ Basis\] xab apply (auto simp: \i \ Basis\ mem_box divide_simps) done finally show "x \ i \ a \ i + (real ?k + 1) * (b \ i - a \ i) / 2 ^ n" . @@ -2540,7 +2259,7 @@ qed let ?\ = "{K \ \. \K'. K' \ \ \ K \ K' \ \(K \ K')}" show ?thesis - proof (rule that) + proof show "countable ?\" by (blast intro: countable_subset [OF _ count]) show "\?\ \ cbox a b" @@ -2597,6 +2316,6 @@ lemma eventually_division_filter_tagged_division: "eventually (\p. p tagged_division_of s) (division_filter s)" - unfolding eventually_division_filter by (intro exI[of _ "\x. ball x 1"]) auto + using eventually_division_filter by auto end