# HG changeset patch # User paulson # Date 1501165355 -3600 # Node ID d425bdf419f5d86687ea3815398d70431cc2676e # Parent 33a47f2d9edc8984d6feb80e3af1c1f825468e66 polytopes: simplical subdivisions, etc. diff -r 33a47f2d9edc -r d425bdf419f5 src/HOL/Analysis/Linear_Algebra.thy --- a/src/HOL/Analysis/Linear_Algebra.thy Wed Jul 26 16:07:45 2017 +0100 +++ b/src/HOL/Analysis/Linear_Algebra.thy Thu Jul 27 15:22:35 2017 +0100 @@ -79,20 +79,27 @@ lemma hull_inc: "x \ S \ x \ P hull S" by (metis hull_subset subset_eq) -lemma hull_union_subset: "(S hull s) \ (S hull t) \ (S hull (s \ t))" +lemma hull_Un_subset: "(S hull s) \ (S hull t) \ (S hull (s \ t))" unfolding Un_subset_iff by (metis hull_mono Un_upper1 Un_upper2) -lemma hull_union: +lemma hull_Un: assumes T: "\T. Ball T S \ S (\T)" shows "S hull (s \ t) = S hull (S hull s \ S hull t)" - apply rule - apply (rule hull_mono) - unfolding Un_subset_iff - apply (metis hull_subset Un_upper1 Un_upper2 subset_trans) - apply (rule hull_minimal) - apply (metis hull_union_subset) - apply (metis hull_in T) - done + apply (rule equalityI) + apply (meson hull_mono hull_subset sup.mono) + by (metis hull_Un_subset hull_hull hull_mono) + +lemma hull_Un_left: "P hull (S \ T) = P hull (P hull S \ T)" + apply (rule equalityI) + apply (simp add: Un_commute hull_mono hull_subset sup.coboundedI2) + by (metis Un_subset_iff hull_hull hull_mono hull_subset) + +lemma hull_Un_right: "P hull (S \ T) = P hull (S \ P hull T)" + by (metis hull_Un_left sup.commute) + +lemma hull_insert: + "P hull (insert a S) = P hull (insert a (P hull S))" + by (metis hull_Un_right insert_is_Un) lemma hull_redundant_eq: "a \ (S hull s) \ S hull (insert a s) = S hull s" unfolding hull_def by blast diff -r 33a47f2d9edc -r d425bdf419f5 src/HOL/Analysis/Polytope.thy --- a/src/HOL/Analysis/Polytope.thy Wed Jul 26 16:07:45 2017 +0100 +++ b/src/HOL/Analysis/Polytope.thy Thu Jul 27 15:22:35 2017 +0100 @@ -1230,6 +1230,179 @@ by (metis (no_types) Krein_Milman_Minkowski assms compact_convex_hull convex_convex_hull face_of_imp_compact face_of_imp_convex) +lemma face_of_convex_hull_aux: + assumes eq: "x *\<^sub>R p = u *\<^sub>R a + v *\<^sub>R b + w *\<^sub>R c" + and x: "u + v + w = x" "x \ 0" and S: "affine S" "a \ S" "b \ S" "c \ S" + shows "p \ S" +proof - + have "p = (u *\<^sub>R a + v *\<^sub>R b + w *\<^sub>R c) /\<^sub>R x" + by (metis \x \ 0\ eq mult.commute right_inverse scaleR_one scaleR_scaleR) + moreover have "affine hull {a,b,c} \ S" + by (simp add: S hull_minimal) + moreover have "(u *\<^sub>R a + v *\<^sub>R b + w *\<^sub>R c) /\<^sub>R x \ affine hull {a,b,c}" + apply (simp add: affine_hull_3) + apply (rule_tac x="u/x" in exI) + apply (rule_tac x="v/x" in exI) + apply (rule_tac x="w/x" in exI) + using x apply (auto simp: algebra_simps divide_simps) + done + ultimately show ?thesis by force +qed + +proposition face_of_convex_hull_insert_eq: + fixes a :: "'a :: euclidean_space" + assumes "finite S" and a: "a \ affine hull S" + shows "(F face_of (convex hull (insert a S)) \ + F face_of (convex hull S) \ + (\F'. F' face_of (convex hull S) \ F = convex hull (insert a F')))" + (is "F face_of ?CAS \ _") +proof safe + assume F: "F face_of ?CAS" + and *: "\F'. F' face_of convex hull S \ F = convex hull insert a F'" + obtain T where T: "T \ insert a S" and FeqT: "F = convex hull T" + by (metis F \finite S\ compact_insert finite_imp_compact face_of_convex_hull_subset) + show "F face_of convex hull S" + proof (cases "a \ T") + case True + have "F = convex hull insert a (convex hull T \ convex hull S)" + proof + have "T \ insert a (convex hull T \ convex hull S)" + using T hull_subset by fastforce + then show "F \ convex hull insert a (convex hull T \ convex hull S)" + by (simp add: FeqT hull_mono) + show "convex hull insert a (convex hull T \ convex hull S) \ F" + apply (rule hull_minimal) + using True by (auto simp: \F = convex hull T\ hull_inc) + qed + moreover have "convex hull T \ convex hull S face_of convex hull S" + by (metis F FeqT convex_convex_hull face_of_slice hull_mono inf.absorb_iff2 subset_insertI) + ultimately show ?thesis + using * by force + next + case False + then show ?thesis + by (metis FeqT F T face_of_subset hull_mono subset_insert subset_insertI) + qed +next + assume "F face_of convex hull S" + show "F face_of ?CAS" + by (simp add: \F face_of convex hull S\ a face_of_convex_hull_insert \finite S\) +next + fix F + assume F: "F face_of convex hull S" + show "convex hull insert a F face_of ?CAS" + proof (cases "S = {}") + case True + then show ?thesis + using F face_of_affine_eq by auto + next + case False + have anotc: "a \ convex hull S" + by (metis (no_types) a affine_hull_convex_hull hull_inc) + show ?thesis + proof (cases "F = {}") + case True show ?thesis + using anotc by (simp add: \F = {}\ \finite S\ extreme_point_of_convex_hull_insert face_of_singleton) + next + case False + have "convex hull insert a F \ ?CAS" + by (simp add: F a \finite S\ convex_hull_subset face_of_convex_hull_insert face_of_imp_subset hull_inc) + moreover + have "(\y v. (1 - ub) *\<^sub>R a + ub *\<^sub>R b = (1 - v) *\<^sub>R a + v *\<^sub>R y \ + 0 \ v \ v \ 1 \ y \ F) \ + (\x u. (1 - uc) *\<^sub>R a + uc *\<^sub>R c = (1 - u) *\<^sub>R a + u *\<^sub>R x \ + 0 \ u \ u \ 1 \ x \ F)" + if *: "(1 - ux) *\<^sub>R a + ux *\<^sub>R x + \ open_segment ((1 - ub) *\<^sub>R a + ub *\<^sub>R b) ((1 - uc) *\<^sub>R a + uc *\<^sub>R c)" + and "0 \ ub" "ub \ 1" "0 \ uc" "uc \ 1" "0 \ ux" "ux \ 1" + and b: "b \ convex hull S" and c: "c \ convex hull S" and "x \ F" + for b c ub uc ux x + proof - + obtain v where ne: "(1 - ub) *\<^sub>R a + ub *\<^sub>R b \ (1 - uc) *\<^sub>R a + uc *\<^sub>R c" + and eq: "(1 - ux) *\<^sub>R a + ux *\<^sub>R x = + (1 - v) *\<^sub>R ((1 - ub) *\<^sub>R a + ub *\<^sub>R b) + v *\<^sub>R ((1 - uc) *\<^sub>R a + uc *\<^sub>R c)" + and "0 < v" "v < 1" + using * by (auto simp: in_segment) + then have 0: "((1 - ux) - ((1 - v) * (1 - ub) + v * (1 - uc))) *\<^sub>R a + + (ux *\<^sub>R x - (((1 - v) * ub) *\<^sub>R b + (v * uc) *\<^sub>R c)) = 0" + by (auto simp: algebra_simps) + then have "((1 - ux) - ((1 - v) * (1 - ub) + v * (1 - uc))) *\<^sub>R a = + ((1 - v) * ub) *\<^sub>R b + (v * uc) *\<^sub>R c + (-ux) *\<^sub>R x" + by (auto simp: algebra_simps) + then have "a \ affine hull S" if "1 - ux - ((1 - v) * (1 - ub) + v * (1 - uc)) \ 0" + apply (rule face_of_convex_hull_aux) + using b c that apply (auto simp: algebra_simps) + using F convex_hull_subset_affine_hull face_of_imp_subset \x \ F\ apply blast+ + done + then have "1 - ux - ((1 - v) * (1 - ub) + v * (1 - uc)) = 0" + using a by blast + with 0 have equx: "(1 - v) * ub + v * uc = ux" + and uxx: "ux *\<^sub>R x = (((1 - v) * ub) *\<^sub>R b + (v * uc) *\<^sub>R c)" + by auto (auto simp: algebra_simps) + show ?thesis + proof (cases "uc = 0") + case True + then show ?thesis + using equx 0 \0 \ ub\ \ub \ 1\ \v < 1\ \x \ F\ + apply (auto simp: algebra_simps) + apply (rule_tac x=x in exI, simp) + apply (rule_tac x=ub in exI, auto) + apply (metis add.left_neutral diff_eq_eq less_irrefl mult.commute mult_cancel_right1 real_vector.scale_cancel_left real_vector.scale_left_diff_distrib) + using \x \ F\ \uc \ 1\ apply blast + done + next + case False + show ?thesis + proof (cases "ub = 0") + case True + then show ?thesis + using equx 0 \0 \ uc\ \uc \ 1\ \0 < v\ \x \ F\ \uc \ 0\ by (force simp: algebra_simps) + next + case False + then have "0 < ub" "0 < uc" + using \uc \ 0\ \0 \ ub\ \0 \ uc\ by auto + then have "ux \ 0" + by (metis \0 < v\ \v < 1\ diff_ge_0_iff_ge dual_order.strict_implies_order equx leD le_add_same_cancel2 zero_le_mult_iff zero_less_mult_iff) + have "b \ F \ c \ F" + proof (cases "b = c") + case True + then show ?thesis + by (metis \ux \ 0\ equx real_vector.scale_cancel_left scaleR_add_left uxx \x \ F\) + next + 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" + using \ux \ 0\ equx apply (auto simp: algebra_simps divide_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" . + then have "x \ open_segment b c" + apply (simp add: in_segment \b \ c\) + apply (rule_tac x="(v * uc) / ux" in exI) + using \0 \ ux\ \ux \ 0\ \0 < uc\ \0 < v\ \0 < ub\ \v < 1\ equx + apply (force simp: algebra_simps divide_simps) + done + then show ?thesis + by (rule face_ofD [OF F _ b c \x \ F\]) + qed + with \0 \ ub\ \ub \ 1\ \0 \ uc\ \uc \ 1\ show ?thesis by blast + qed + qed + qed + moreover have "convex hull F = F" + by (meson F convex_hull_eq face_of_imp_convex) + ultimately show ?thesis + unfolding face_of_def by (fastforce simp: convex_hull_insert_alt \S \ {}\ \F \ {}\) + qed + qed +qed + +lemma face_of_convex_hull_insert2: + fixes a :: "'a :: euclidean_space" + assumes S: "finite S" and a: "a \ affine hull S" and F: "F face_of convex hull S" + shows "convex hull (insert a F) face_of convex hull (insert a S)" + by (metis F face_of_convex_hull_insert_eq [OF S a]) + proposition face_of_convex_hull_affine_independent: fixes S :: "'a::euclidean_space set" assumes "~ affine_dependent S" @@ -1429,6 +1602,23 @@ lemma polytope_sing: "polytope {a}" using polytope_def by force +lemma face_of_polytope_insert: + "\polytope S; a \ affine hull S; F face_of S\ \ F face_of convex hull (insert a S)" + by (metis (no_types, lifting) affine_hull_convex_hull face_of_convex_hull_insert hull_insert polytope_def) + +lemma face_of_polytope_insert2: + fixes a :: "'a :: euclidean_space" + assumes "polytope S" "a \ affine hull S" "F face_of S" + shows "convex hull (insert a F) face_of convex hull (insert a S)" +proof - + obtain V where "finite V" "S = convex hull V" + using assms by (auto simp: polytope_def) + then have "convex hull (insert a F) face_of convex hull (insert a V)" + using affine_hull_convex_hull assms face_of_convex_hull_insert2 by blast + then show ?thesis + by (metis \S = convex hull V\ hull_insert) +qed + subsection\Polyhedra\ @@ -2638,38 +2828,41 @@ qed qed - lemma cell_subdivision_lemma: assumes "finite \" and "\X. X \ \ \ polytope X" and "\X. X \ \ \ aff_dim X \ d" and "\X Y. \X \ \; Y \ \\ \ (X \ Y) face_of X \ (X \ Y) face_of Y" and "finite I" - shows "\\'. \\' = \\ \ - finite \' \ - (\X \ \'. polytope X) \ - (\X \ \'. aff_dim X \ d) \ - (\X \ \'. \Y \ \'. X \ Y face_of X \ X \ Y face_of Y) \ - (\X \ \'. \x \ X. \y \ X. \a b. + shows "\\. \\ = \\ \ + finite \ \ + (\C \ \. \D. D \ \ \ C \ D) \ + (\C \ \. \x \ C. \D. D \ \ \ x \ D \ D \ C) \ + (\X \ \. polytope X) \ + (\X \ \. aff_dim X \ d) \ + (\X \ \. \Y \ \. X \ Y face_of X \ X \ Y face_of Y) \ + (\X \ \. \x \ X. \y \ X. \a b. (a,b) \ I \ a \ x \ b \ a \ y \ b \ a \ x \ b \ a \ y \ b)" using \finite I\ proof induction case empty then show ?case - by (rule_tac x="\" in exI) (simp add: assms) + by (rule_tac x="\" in exI) (auto simp: assms) next case (insert ab I) - then obtain \' where eq: "\\' = \\" and "finite \'" - and poly: "\X. X \ \' \ polytope X" - and aff: "\X. X \ \' \ aff_dim X \ d" - and face: "\X Y. \X \ \'; Y \ \'\ \ X \ Y face_of X \ X \ Y face_of Y" - and I: "\X x y a b. \X \ \'; x \ X; y \ X; (a,b) \ I\ \ + then obtain \ where eq: "\\ = \\" and "finite \" + and sub1: "\C. C \ \ \ \D. D \ \ \ C \ D" + and sub2: "\C x. C \ \ \ x \ C \ \D. D \ \ \ x \ D \ D \ C" + and poly: "\X. X \ \ \ polytope X" + and aff: "\X. X \ \ \ aff_dim X \ d" + and face: "\X Y. \X \ \; Y \ \\ \ X \ Y face_of X \ X \ Y face_of Y" + and I: "\X x y a b. \X \ \; x \ X; y \ X; (a,b) \ I\ \ a \ x \ b \ a \ y \ b \ a \ x \ b \ a \ y \ b" by (auto simp: that) obtain a b where "ab = (a,b)" by fastforce - let ?\ = "(\X. X \ {x. a \ x \ b}) ` \' \ (\X. X \ {x. a \ x \ b}) ` \'" + let ?\ = "(\X. X \ {x. a \ x \ b}) ` \ \ (\X. X \ {x. a \ x \ b}) ` \" have eqInt: "(S \ Collect P) \ (T \ Collect Q) = (S \ T) \ (Collect P \ Collect Q)" for S T::"'a set" and P Q by blast show ?case @@ -2677,7 +2870,7 @@ show "\?\ = \\" by (force simp: eq [symmetric]) show "finite ?\" - using \finite \'\ by force + using \finite \\ by force show "\X \ ?\. polytope X" by (force simp: poly polytope_Int_polyhedron polyhedron_halfspace_le polyhedron_halfspace_ge) show "\X \ ?\. aff_dim X \ d" @@ -2688,6 +2881,19 @@ using \ab = (a, b)\ I by fastforce show "\X \ ?\. \Y \ ?\. X \ Y face_of X \ X \ Y face_of Y" by (auto simp: eqInt halfspace_Int_eq face_of_Int_Int face face_of_halfspace_le face_of_halfspace_ge) + show "\C \ ?\. \D. D \ \ \ C \ D" + using sub1 by force + show "\C\\. \x\C. \D. D \ ?\ \ x \ D \ D \ C" + proof (intro ballI) + fix C z + assume "C \ \" "z \ C" + with sub2 obtain D where D: "D \ \" "z \ D" "D \ C" by blast + have "D \ \ \ z \ D \ {x. a \ x \ b} \ D \ {x. a \ x \ b} \ C \ + D \ \ \ z \ D \ {x. a \ x \ b} \ D \ {x. a \ x \ b} \ C" + using linorder_class.linear [of "a \ z" b] D by blast + then show "\D. D \ ?\ \ z \ D \ D \ C" + by blast + qed qed qed @@ -2701,6 +2907,8 @@ obtains "\'" where "finite \'" "\\' = \\" "\X. X \ \' \ diameter X < e" "\X. X \ \' \ polytope X" "\X. X \ \' \ aff_dim X \ d" "\X Y. \X \ \'; Y \ \'\ \ X \ Y face_of X \ X \ Y face_of Y" + "\C. C \ \' \ \D. D \ \ \ C \ D" + "\C x. C \ \ \ x \ C \ \D. D \ \' \ x \ D \ D \ C" proof - have "bounded(\\)" by (simp add: \finite \\ poly bounded_Union polytope_imp_bounded) @@ -2723,9 +2931,10 @@ and face: "\X Y. \X \ \'; Y \ \'\ \ X \ Y face_of X \ X \ Y face_of Y" and I: "\X x y a b. \X \ \'; x \ X; y \ X; (a,b) \ I\ \ a \ x \ b \ a \ y \ b \ a \ x \ b \ a \ y \ b" + and sub1: "\C. C \ \' \ \D. D \ \ \ C \ D" + and sub2: "\C x. C \ \ \ x \ C \ \D. D \ \' \ x \ D \ D \ C" apply (rule exE [OF cell_subdivision_lemma]) - apply (rule assms \finite I\ | assumption)+ - apply (auto intro: that) + using assms \finite I\ apply auto done show ?thesis proof (rule_tac \'="\'" in that) @@ -2788,14 +2997,13 @@ by (simp add: \0 < e\) finally show ?thesis . qed - qed (auto simp: eq poly aff face \finite \'\) + qed (auto simp: eq poly aff face sub1 sub2 \finite \'\) qed -subsection\Simplicial complexes and triangulations\ +subsection\Simplexes\ -subsubsection\The notion of n-simplex for integer @{term"n \ -1"}\ - +text\The notion of n-simplex for integer @{term"n \ -1"}\ definition simplex :: "int \ 'a::euclidean_space set \ bool" (infix "simplex" 50) where "n simplex S \ \C. ~(affine_dependent C) \ int(card C) = n + 1 \ S = convex hull C" @@ -2917,4 +3125,690 @@ qed (use C in auto) qed +subsection\Simplicial complexes and triangulations\ + +definition simplicial_complex where + "simplicial_complex \ \ + finite \ \ + (\S \ \. \n. n simplex S) \ + (\F S. S \ \ \ F face_of S \ F \ \) \ + (!S S'. S \ \ \ S' \ \ + \ (S \ S') face_of S \ (S \ S') face_of S')" + +definition triangulation where + "triangulation \ \ + finite \ \ + (\T \ \. \n. n simplex T) \ + (\T T'. T \ \ \ T' \ \ + \ (T \ T') face_of T \ (T \ T') face_of T')" + + +subsection\Refining a cell complex to a simplicial complex\ + +lemma convex_hull_insert_Int_eq: + fixes z :: "'a :: euclidean_space" + assumes z: "z \ rel_interior S" + and T: "T \ rel_frontier S" + and U: "U \ rel_frontier S" + and "convex S" "convex T" "convex U" + shows "convex hull (insert z T) \ convex hull (insert z U) = convex hull (insert z (T \ U))" + (is "?lhs = ?rhs") +proof + show "?lhs \ ?rhs" + proof (cases "T={} \ U={}") + case True then show ?thesis by auto + next + case False + then have "T \ {}" "U \ {}" by auto + have TU: "convex (T \ U)" + by (simp add: \convex T\ \convex U\ convex_Int) + have "(\x\T. closed_segment z x) \ (\x\U. closed_segment z x) + \ (if T \ U = {} then {z} else UNION (T \ U) (closed_segment z))" (is "_ \ ?IF") + proof clarify + fix x t u + assume xt: "x \ closed_segment z t" + and xu: "x \ closed_segment z u" + and "t \ T" "u \ U" + then have ne: "t \ z" "u \ z" + using T U z unfolding rel_frontier_def by blast+ + show "x \ ?IF" + proof (cases "x = z") + case True then show ?thesis by auto + next + case False + have t: "t \ closure S" + using T \t \ T\ rel_frontier_def by auto + have u: "u \ closure S" + using U \u \ U\ rel_frontier_def by auto + show ?thesis + proof (cases "t = u") + case True + then show ?thesis + using \t \ T\ \u \ U\ xt by auto + next + case False + have tnot: "t \ closed_segment u z" + proof - + have "t \ closure S - rel_interior S" + using T \t \ T\ rel_frontier_def by blast + then have "t \ open_segment z u" + by (meson DiffD2 rel_interior_closure_convex_segment [OF \convex S\ z u] subsetD) + then show ?thesis + by (simp add: \t \ u\ \t \ z\ open_segment_commute open_segment_def) + qed + moreover have "u \ closed_segment z t" + using rel_interior_closure_convex_segment [OF \convex S\ z t] \u \ U\ \u \ z\ + U [unfolded rel_frontier_def] tnot + by (auto simp: closed_segment_eq_open) + ultimately + have "~(between (t,u) z | between (u,z) t | between (z,t) u)" if "x \ z" + using that xt xu + apply (simp add: between_mem_segment [symmetric]) + by (metis between_commute between_trans_2 between_antisym) + then have "~ collinear {t, z, u}" if "x \ z" + by (auto simp: that collinear_between_cases between_commute) + moreover have "collinear {t, z, x}" + by (metis closed_segment_commute collinear_2 collinear_closed_segment collinear_triples ends_in_segment(1) insert_absorb insert_absorb2 xt) + moreover have "collinear {z, x, u}" + by (metis closed_segment_commute collinear_2 collinear_closed_segment collinear_triples ends_in_segment(1) insert_absorb insert_absorb2 xu) + ultimately have False + using collinear_3_trans [of t z x u] \x \ z\ by blast + then show ?thesis by metis + qed + qed + qed + then show ?thesis + using False \convex T\ \convex U\ TU + by (simp add: convex_hull_insert_segments hull_same split: if_split_asm) + qed + show "?rhs \ ?lhs" + by (metis inf_greatest hull_mono inf.cobounded1 inf.cobounded2 insert_mono) +qed + +lemma simplicial_subdivision_aux: + assumes "finite \" + and "\C. C \ \ \ polytope C" + and "\C. C \ \ \ aff_dim C \ of_nat n" + and "\C F. \C \ \; F face_of C\ \ F \ \" + and "\C1 C2. \C1 \ \; C2 \ \\ \ C1 \ C2 face_of C1 \ C1 \ C2 face_of C2" + shows "\\. simplicial_complex \ \ + (\K \ \. aff_dim K \ of_nat n) \ + \\ = \\ \ + (\C \ \. \F. finite F \ F \ \ \ C = \F) \ + (\K \ \. \C. C \ \ \ K \ C)" + using assms +proof (induction n arbitrary: \ rule: less_induct) + case (less n) + then have poly\: "\C. C \ \ \ polytope C" + and aff\: "\C. C \ \ \ aff_dim C \ of_nat n" + and face\: "\C F. \C \ \; F face_of C\ \ F \ \" + and intface\: "\C1 C2. \C1 \ \; C2 \ \\ \ C1 \ C2 face_of C1 \ C1 \ C2 face_of C2" + by metis+ + show ?case + proof (cases "n \ 1") + case True + have "\s. \n \ 1; s \ \\ \ \m. m simplex s" + using poly\ aff\ by (force intro: polytope_lowdim_imp_simplex) + then show ?thesis + unfolding simplicial_complex_def + apply (rule_tac x="\" in exI) + using True by (auto simp: less.prems) + next + case False + define \ where "\ \ {C \ \. aff_dim C < n}" + have "finite \" "\C. C \ \ \ polytope C" "\C. C \ \ \ aff_dim C \ int (n - 1)" + "\C F. \C \ \; F face_of C\ \ F \ \" + "\C1 C2. \C1 \ \; C2 \ \\ \ C1 \ C2 face_of C1 \ C1 \ C2 face_of C2" + using less.prems + apply (auto simp: \_def) + by (metis aff_dim_subset face_of_imp_subset less_le not_le) + with less.IH [of "n-1" \] False + obtain \ where "simplicial_complex \" + and aff_dim\: "\K. K \ \ \ aff_dim K \ int (n - 1)" + and "\\ = \\" + and fin\: "\C. C \ \ \ \F. finite F \ F \ \ \ C = \F" + and C\: "\K. K \ \ \ \C. C \ \ \ K \ C" + by auto + then have "finite \" + and simpl\: "\S. S \ \ \ \n. n simplex S" + and face\: "\F S. \S \ \; F face_of S\ \ F \ \" + and faceI\: "\S S'. \S \ \; S' \ \\ \ (S \ S') face_of S \ (S \ S') face_of S'" + by (auto simp: simplicial_complex_def) + define \ where "\ \ {C \ \. aff_dim C = n}" + have "finite \" + by (simp add: \_def less.prems(1)) + have poly\: "\C. C \ \ \ polytope C" + and convex\: "\C. C \ \ \ convex C" + and closed\: "\C. C \ \ \ closed C" + by (auto simp: \_def poly\ polytope_imp_convex polytope_imp_closed) + have in_rel_interior: "(@z. z \ rel_interior C) \ rel_interior C" if "C \ \" for C + using that poly\ polytope_imp_convex rel_interior_aff_dim some_in_eq by (fastforce simp: \_def) + have *: "\T. ~affine_dependent T \ card T \ n \ aff_dim K < n \ K = convex hull T" + if "K \ \" for K + proof - + obtain r where r: "r simplex K" + using \K \ \\ simpl\ by blast + have "r = aff_dim K" + using \r simplex K\ aff_dim_simplex by blast + with r + show ?thesis + unfolding simplex_def + using False \\K. K \ \ \ aff_dim K \ int (n - 1)\ that by fastforce + qed + have ahK_C_disjoint: "affine hull K \ rel_interior C = {}" + if "C \ \" "K \ \" "K \ rel_frontier C" for C K + proof - + have "convex C" "closed C" + by (auto simp: convex\ closed\ \C \ \\) + obtain F where F: "F face_of C" and "F \ C" "K \ F" + proof - + obtain L where "L \ \" "K \ L" + using \K \ \\ C\ by blast + have "K \ rel_frontier C" + by (simp add: \K \ rel_frontier C\) + also have "... \ C" + by (simp add: \closed C\ rel_frontier_def subset_iff) + finally have "K \ C" . + have "L \ C face_of C" + using \_def \_def \C \ \\ \L \ \\ intface\ by auto + moreover have "L \ C \ C" + using \C \ \\ \L \ \\ + apply (clarsimp simp: \_def \_def) + by (metis aff_dim_subset inf_le1 not_le) + moreover have "K \ L \ C" + using \C \ \\ \L \ \\ \K \ C\ \K \ L\ + by (auto simp: \_def \_def) + ultimately show ?thesis using that by metis + qed + have "affine hull F \ rel_interior C = {}" + by (rule affine_hull_face_of_disjoint_rel_interior [OF \convex C\ F \F \ C\]) + with hull_mono [OF \K \ F\] + show "affine hull K \ rel_interior C = {}" + by fastforce + qed + let ?\ = "(\C \ \. \K \ \ \ Pow (rel_frontier C). + {convex hull (insert (@z. z \ rel_interior C) K)})" + have "\\. simplicial_complex \ \ + (\K \ \. aff_dim K \ of_nat n) \ + (\C \ \. \F. F \ \ \ C = \F) \ + (\K \ \. \C. C \ \ \ K \ C)" + proof (rule exI, intro conjI ballI) + show "simplicial_complex (\ \ ?\)" + unfolding simplicial_complex_def + proof (intro conjI impI ballI allI) + show "finite (\ \ ?\)" + using \finite \\ \finite \\ by simp + show "\n. n simplex S" if "S \ \ \ ?\" for S + using that ahK_C_disjoint in_rel_interior simpl\ simplex_insert_dimplus1 by fastforce + show "F \ \ \ ?\" if S: "S \ \ \ ?\ \ F face_of S" for F S + proof - + have "F \ \" if "S \ \" + using S face\ that by blast + moreover have "F \ \ \ ?\" + if "F face_of S" "C \ \" "K \ \" and "K \ rel_frontier C" + and S: "S = convex hull insert (@z. z \ rel_interior C) K" for C K + proof - + let ?z = "@z. z \ rel_interior C" + have "?z \ rel_interior C" + by (simp add: in_rel_interior \C \ \\) + moreover + obtain I where "\ affine_dependent I" "card I \ n" "aff_dim K < int n" "K = convex hull I" + using * [OF \K \ \\] by auto + ultimately have "?z \ affine hull I" + using ahK_C_disjoint affine_hull_convex_hull that by blast + have "compact I" "finite I" + 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" + using face_of_convex_hull_subset [of "insert ?z I" F] by auto + show ?thesis + proof (cases "?z \ J") + case True + have "F \ (\K\\ \ Pow (rel_frontier C). {convex hull insert ?z K})" + proof + have "convex hull (J - {?z}) face_of K" + by (metis True \J \ insert ?z I\ \K = convex hull I\ \\ affine_dependent I\ face_of_convex_hull_affine_independent subset_insert_iff) + then have "convex hull (J - {?z}) \ \" + by (rule face\ [OF \K \ \\]) + moreover + have "\x. x \ convex hull (J - {?z}) \ x \ rel_frontier C" + by (metis True \J \ insert ?z I\ \K = convex hull I\ subsetD hull_mono subset_insert_iff that(4)) + ultimately show "convex hull (J - {?z}) \ \ \ Pow (rel_frontier C)" by auto + let ?F = "convex hull insert ?z (convex hull (J - {?z}))" + have "F \ ?F" + apply (clarsimp simp: \F = convex hull J\) + by (metis True subsetD hull_mono hull_subset subset_insert_iff) + moreover have "?F \ F" + apply (clarsimp simp: \F = convex hull J\) + by (metis (no_types, lifting) True convex_hull_eq_empty convex_hull_insert_segments hull_hull insert_Diff) + ultimately + show "F \ {?F}" by auto + qed + with \C\\\ show ?thesis by auto + next + 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 \ \\) + then show "F \ \ \ ?\" + by blast + qed + qed + ultimately show ?thesis + using that by auto + qed + have "(S \ S' face_of S) \ (S \ S' face_of S')" + if "S \ \ \ ?\" "S' \ \ \ ?\" for S S' + proof - + have symmy: "\\X Y. R X Y \ R Y X; + \X Y. \X \ \; Y \ \\ \ R X Y; + \X Y. \X \ \; Y \ ?\\ \ R X Y; + \X Y. \X \ ?\; Y \ ?\\ \ R X Y\ \ R S S'" for R + using that by (metis (no_types, lifting) Un_iff) + show ?thesis + proof (rule symmy) + show "Y \ X face_of Y \ Y \ X face_of X" + if "X \ Y face_of X \ X \ Y face_of Y" for X Y :: "'a set" + by (simp add: inf_commute that) + next + show "X \ Y face_of X \ X \ Y face_of Y" + if "X \ \" and "Y \ \" for X Y + by (simp add: faceI\ that) + next + show "X \ Y face_of X \ X \ Y face_of Y" + if XY: "X \ \" "Y \ ?\" for X Y + proof - + obtain C K + where "C \ \" "K \ \" "K \ rel_frontier C" + and Y: "Y = convex hull insert (@z. z \ rel_interior C) K" + using XY by blast + have "convex C" + by (simp add: \C \ \\ convex\) + have "K \ C" + by (metis DiffE \C \ \\ \K \ rel_frontier C\ closed\ closure_closed rel_frontier_def subset_iff) + let ?z = "(@z. z \ rel_interior C)" + have z: "?z \ rel_interior C" + using \C \ \\ in_rel_interior by blast + obtain D where "D \ \" "X \ D" + using C\ \X \ \\ by blast + have "D \ rel_interior C = (C \ D) \ rel_interior C" + using rel_interior_subset by blast + also have "(C \ D) \ rel_interior C = {}" + proof (rule face_of_disjoint_rel_interior) + show "C \ D face_of C" + using \_def \_def \C \ \\ \D \ \\ intface\ by blast + show "C \ D \ C" + by (metis (mono_tags, lifting) Int_lower2 \_def \_def \C \ \\ \D \ \\ aff_dim_subset mem_Collect_eq not_le) + qed + finally have DC: "D \ rel_interior C = {}" . + have eq: "X \ convex hull (insert ?z K) = X \ convex hull K" + apply (rule Int_convex_hull_insert_rel_exterior [OF \convex C\ \K \ C\ z]) + using DC by (meson \X \ D\ disjnt_def disjnt_subset1) + obtain I where I: "\ affine_dependent I" + and Keq: "K = convex hull I" and [simp]: "convex hull K = K" + using "*" \K \ \\ by force + then have "?z \ affine hull I" + 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: \K \ \\ faceI\ \X \ \\) + 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 + using "*" \K \ \\ faceI\ that(1) by (fastforce simp add: Y eq) + qed + next + show "X \ Y face_of X \ X \ Y face_of Y" + if XY: "X \ ?\" "Y \ ?\" for X Y + proof - + obtain C K D L + where "C \ \" "K \ \" "K \ rel_frontier C" + and X: "X = convex hull insert (@z. z \ rel_interior C) K" + and "D \ \" "L \ \" "L \ rel_frontier D" + and Y: "Y = convex hull insert (@z. z \ rel_interior D) L" + using XY by blast + let ?z = "(@z. z \ rel_interior C)" + have z: "?z \ rel_interior C" + using \C \ \\ in_rel_interior by blast + have "convex C" + by (simp add: \C \ \\ convex\) + have "convex K" + using "*" \K \ \\ by blast + have "convex L" + by (meson \L \ \\ convex_simplex simpl\) + show ?thesis + proof (cases "D=C") + case True + then have "L \ rel_frontier C" + using \L \ rel_frontier D\ by auto + show ?thesis + apply (simp add: X Y True) + apply (simp add: convex_hull_insert_Int_eq [OF z] \K \ rel_frontier C\ \L \ rel_frontier C\ \convex C\ \convex K\ \convex L\) + using face_of_polytope_insert2 + by (metis "*" IntI \C \ \\ \K \ \\ \L \ \\\K \ rel_frontier C\ \L \ rel_frontier C\ aff_independent_finite ahK_C_disjoint empty_iff faceI\ polytope_convex_hull z) + next + case False + have "convex D" + by (simp add: \D \ \\ convex\) + have "K \ C" + by (metis DiffE \C \ \\ \K \ rel_frontier C\ closed\ closure_closed rel_frontier_def subset_eq) + have "L \ D" + by (metis DiffE \D \ \\ \L \ rel_frontier D\ closed\ closure_closed rel_frontier_def subset_eq) + let ?w = "(@w. w \ rel_interior D)" + have w: "?w \ rel_interior D" + using \D \ \\ in_rel_interior by blast + have "C \ rel_interior D = (D \ C) \ rel_interior D" + using rel_interior_subset by blast + also have "(D \ C) \ rel_interior D = {}" + proof (rule face_of_disjoint_rel_interior) + show "D \ C face_of D" + using \_def \C \ \\ \D \ \\ intface\ by blast + have "D \ \ \ aff_dim D = int n" + using \_def \D \ \\ by blast + moreover have "C \ \ \ aff_dim C = int n" + using \_def \C \ \\ by blast + ultimately show "D \ C \ D" + by (metis False face_of_aff_dim_lt inf.idem inf_le1 intface\ not_le poly\ polytope_imp_convex) + 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) + have eq: "convex hull (insert ?z K) \ convex hull (insert ?w L) = + convex hull (insert ?z K) \ convex hull L" + apply (rule Int_convex_hull_insert_rel_exterior [OF \convex D\ \L \ D\ w]) + using zKC CD apply (force simp: disjnt_def) + done + have ch_id: "convex hull K = K" "convex hull L = L" + using "*" \K \ \\ \L \ \\ hull_same by auto + have "convex C" + 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" + 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) + show "C \ D face_of C" + using \_def \C \ \\ \D \ \\ intface\ by blast + have "D \ \" "aff_dim D = int n" + using \_def \D \ \\ by fastforce+ + moreover have "C \ \" "aff_dim C = int n" + using \_def \C \ \\ by fastforce+ + ultimately have "aff_dim D + - 1 * aff_dim C \ 0" + by fastforce + then have "\ C face_of D" + using False \convex D\ face_of_aff_dim_lt by fastforce + show "C \ D \ C" + using \C \ \\ \D \ \\ \\ C face_of D\ intface\ by fastforce + qed + then have "D \ rel_interior C = {}" + by (metis inf.absorb_iff2 inf_assoc inf_sup_aci(1) rel_interior_subset) + then show "disjnt L (rel_interior C)" + by (meson \L \ D\ disjnt_def disjnt_subset1) + next + show "L \ convex hull K = convex hull K \ L" + by force + qed + 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" + 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) + 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 (simp add: \K \ \\ \L \ \\ ch_id chKL faceI\) + 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) + qed + finally have 2: "convex hull insert ?z K \ convex hull L face_of convex hull insert ?w L" . + show ?thesis + by (simp add: X Y eq 1 2) + qed + qed + qed + qed + then + show "S \ S' face_of S" "S \ S' face_of S'" if "S \ \ \ ?\ \ S' \ \ \ ?\" for S S' + using that by auto + qed + show "\F \ \ \ ?\. C = \F" if "C \ \" for C + proof (cases "C \ \") + case True + then show ?thesis + by (meson UnCI fin\ subsetD subsetI) + next + case False + then have "C \ \" + by (simp add: \_def \_def aff\ less_le that) + let ?z = "@z. z \ rel_interior C" + have z: "?z \ rel_interior C" + using \C \ \\ in_rel_interior by blast + let ?F = "\K \ \ \ Pow (rel_frontier C). {convex hull (insert ?z K)}" + have "?F \ ?\" + using \C \ \\ by blast + moreover have "C \ \?F" + proof + fix x + assume "x \ C" + have "convex C" + using \C \ \\ convex\ by blast + have "bounded C" + using \C \ \\ by (simp add: poly\ polytope_imp_bounded that) + have "polytope C" + using \C \ \\ poly\ by auto + have "\ (?z = x \ C = {?z})" + using \C \ \\ aff_dim_sing [of ?z] \\ n \ 1\ by (force simp: \_def) + then obtain y where y: "y \ rel_frontier C" and xzy: "x \ closed_segment ?z y" + and sub: "open_segment ?z y \ rel_interior C" + by (blast intro: segment_to_rel_frontier [OF \convex C\ \bounded C\ z \x \ C\]) + then obtain F where "y \ F" "F face_of C" "F \ C" + by (auto simp: rel_frontier_of_polyhedron_alt [OF polytope_imp_polyhedron [OF \polytope C\]]) + then obtain \ where "finite \" "\ \ \" "F = \\" + by (metis (mono_tags, lifting) \_def \C \ \\ \convex C\ aff\ face\ face_of_aff_dim_lt fin\ le_less_trans mem_Collect_eq not_less) + then obtain K where "y \ K" "K \ \" + using \y \ F\ by blast + moreover have x: "x \ convex hull {?z,y}" + using segment_convex_hull xzy by auto + moreover have "convex hull {?z,y} \ convex hull insert ?z K" + by (metis (full_types) \y \ K\ hull_mono empty_subsetI insertCI insert_subset) + moreover have "K \ \" + using \K \ \\ \\ \ \\ by blast + moreover have "K \ rel_frontier C" + using \F = \\\ \F \ C\ \F face_of C\ \K \ \\ face_of_subset_rel_frontier by fastforce + ultimately show "x \ \?F" + by force + qed + moreover + have "convex hull insert (SOME z. z \ rel_interior C) K \ C" + if "K \ \" "K \ rel_frontier C" for K + proof (rule hull_minimal) + show "insert (SOME z. z \ rel_interior C) K \ C" + using that \C \ \\ in_rel_interior rel_interior_subset + by (force simp: closure_eq rel_frontier_def closed\) + show "convex C" + by (simp add: \C \ \\ convex\) + qed + then have "\?F \ C" + by auto + ultimately show ?thesis + by blast + qed + + have "(\C. C \ \ \ L \ C) \ aff_dim L \ int n" if "L \ \ \ ?\" for L + using that + proof + assume "L \ \" + then show ?thesis + using C\ \_def "*" by fastforce + next + assume "L \ ?\" + then obtain C K where "C \ \" + and L: "L = convex hull insert (@z. z \ rel_interior C) K" + and K: "K \ \" "K \ rel_frontier C" + by auto + then have "convex hull C = C" + by (meson convex\ convex_hull_eq) + then have "convex C" + by (metis (no_types) convex_convex_hull) + have "rel_frontier C \ C" + by (metis DiffE closed\ \C \ \\ closure_closed rel_frontier_def subsetI) + have "K \ C" + using K \rel_frontier C \ C\ by blast + have "C \ \" + using \_def \C \ \\ by auto + moreover have "L \ C" + using K L \C \ \\ + by (metis \K \ C\ \convex hull C = C\ contra_subsetD hull_mono in_rel_interior insert_subset rel_interior_subset) + ultimately show ?thesis + using \rel_frontier C \ C\ \L \ C\ aff\ aff_dim_subset \C \ \\ dual_order.trans by blast + qed + then show "\C. C \ \ \ L \ C" "aff_dim L \ int n" if "L \ \ \ ?\" for L + using that by auto + qed + then show ?thesis + apply (rule ex_forward, safe) + apply (meson Union_iff subsetCE, fastforce) + by (meson infinite_super simplicial_complex_def) + qed +qed + + +lemma simplicial_subdivision_of_cell_complex_lowdim: + assumes "finite \" + and poly: "\C. C \ \ \ polytope C" + and face: "\C1 C2. \C1 \ \; C2 \ \\ \ C1 \ C2 face_of C1 \ C1 \ C2 face_of C2" + and aff: "\C. C \ \ \ aff_dim C \ d" + obtains \ where "simplicial_complex \" "\K. K \ \ \ aff_dim K \ d" + "\\ = \\" + "\C. C \ \ \ \F. finite F \ F \ \ \ C = \F" + "\K. K \ \ \ \C. C \ \ \ K \ C" +proof (cases "d \ 0") + case True + then obtain n where n: "d = of_nat n" + using zero_le_imp_eq_int by blast + have "\\. simplicial_complex \ \ + (\K\\. aff_dim K \ int n) \ + \\ = \(\C\\. {F. F face_of C}) \ + (\C\\C\\. {F. F face_of C}. + \F. finite F \ F \ \ \ C = \F) \ + (\K\\. \C. C \ (\C\\. {F. F face_of C}) \ K \ C)" + proof (rule simplicial_subdivision_aux) + show "finite (\C\\. {F. F face_of C})" + using \finite \\ poly polyhedron_eq_finite_faces polytope_imp_polyhedron by fastforce + show "polytope F" if "F \ (\C\\. {F. F face_of C})" for F + using poly that face_of_polytope_polytope by blast + show "aff_dim F \ int n" if "F \ (\C\\. {F. F face_of C})" for F + using that + by clarify (metis n aff_dim_subset aff face_of_imp_subset order_trans) + show "F \ (\C\\. {F. F face_of C})" + if "G \ (\C\\. {F. F face_of C})" and "F face_of G" for F G + using that face_of_trans by blast + next + show "F1 \ F2 face_of F1 \ F1 \ F2 face_of F2" + if "F1 \ (\C\\. {F. F face_of C})" and "F2 \ (\C\\. {F. F face_of C})" for F1 F2 + using that + by safe (meson face face_of_Int_subface)+ + qed + moreover + have "\(\C\\. {F. F face_of C}) = \\" + using face_of_imp_subset face by blast + ultimately show ?thesis + apply clarify + apply (rule that, assumption+) + using n apply blast + apply (simp_all add: poly face_of_refl polytope_imp_convex) + using face_of_imp_subset by fastforce +next + case False + then have m1: "\C. C \ \ \ aff_dim C = -1" + by (metis aff aff_dim_empty_eq aff_dim_negative_iff dual_order.trans not_less) + then have face\: "\F S. \S \ \; F face_of S\ \ F \ \" + by (metis aff_dim_empty face_of_empty) + show ?thesis + proof + have "\S. S \ \ \ \n. n simplex S" + by (metis (no_types) m1 aff_dim_empty simplex_minus_1) + then show "simplicial_complex \" + by (auto simp: simplicial_complex_def \finite \\ face intro: face\) + show "aff_dim K \ d" if "K \ \" for K + by (simp add: that aff) + show "\F. finite F \ F \ \ \ C = \F" if "C \ \" for C + using \C \ \\ equals0I by auto + show "\C. C \ \ \ K \ C" if "K \ \" for K + using \K \ \\ by blast + qed auto +qed + +proposition simplicial_subdivision_of_cell_complex: + assumes "finite \" + and poly: "\C. C \ \ \ polytope C" + and face: "\C1 C2. \C1 \ \; C2 \ \\ \ C1 \ C2 face_of C1 \ C1 \ C2 face_of C2" + obtains \ where "simplicial_complex \" + "\\ = \\" + "\C. C \ \ \ \F. finite F \ F \ \ \ C = \F" + "\K. K \ \ \ \C. C \ \ \ K \ C" + by (blast intro: simplicial_subdivision_of_cell_complex_lowdim [OF assms aff_dim_le_DIM]) + +corollary fine_simplicial_subdivision_of_cell_complex: + assumes "0 < e" "finite \" + and poly: "\C. C \ \ \ polytope C" + and face: "\C1 C2. \C1 \ \; C2 \ \\ \ C1 \ C2 face_of C1 \ C1 \ C2 face_of C2" + obtains \ where "simplicial_complex \" + "\K. K \ \ \ diameter K < e" + "\\ = \\" + "\C. C \ \ \ \F. finite F \ F \ \ \ C = \F" + "\K. K \ \ \ \C. C \ \ \ K \ C" +proof - + obtain \ where \: "finite \" "\\ = \\" + and diapoly: "\X. X \ \ \ diameter X < e" "\X. X \ \ \ polytope X" + and "\X Y. \X \ \; Y \ \\ \ X \ Y face_of X \ X \ Y face_of Y" + and \covers: "\C x. C \ \ \ x \ C \ \D. D \ \ \ x \ D \ D \ C" + and \covered: "\C. C \ \ \ \D. D \ \ \ C \ D" + by (blast intro: cell_complex_subdivision_exists [OF \0 < e\ \finite \\ poly aff_dim_le_DIM face]) + then obtain \ where \: "simplicial_complex \" "\\ = \\" + and \covers: "\C. C \ \ \ \F. finite F \ F \ \ \ C = \F" + and \covered: "\K. K \ \ \ \C. C \ \ \ K \ C" + using simplicial_subdivision_of_cell_complex [OF \finite \\] by metis + show ?thesis + proof + show "simplicial_complex \" + by (rule \) + show "diameter K < e" if "K \ \" for K + by (metis le_less_trans diapoly \covered diameter_subset polytope_imp_bounded that) + show "\\ = \\" + by (simp add: \(2) \\\ = \\\) + show "\F. finite F \ F \ \ \ C = \F" if "C \ \" for C + proof - + { fix x + assume "x \ C" + then obtain D where "D \ \" "x \ D" "D \ C" + using \covers \C \ \\ \covers by force + then have "\X\\ \ Pow C. x \ X" + using \D \ \\ \D \ C\ \x \ D\ by blast + } + moreover + have "finite (\ \ Pow C)" + using \simplicial_complex \\ simplicial_complex_def by auto + ultimately show ?thesis + by (rule_tac x="(\ \ Pow C)" in exI) auto + qed + show "\C. C \ \ \ K \ C" if "K \ \" for K + by (meson \covered \covered order_trans that) + qed +qed + end diff -r 33a47f2d9edc -r d425bdf419f5 src/HOL/Analysis/Starlike.thy --- a/src/HOL/Analysis/Starlike.thy Wed Jul 26 16:07:45 2017 +0100 +++ b/src/HOL/Analysis/Starlike.thy Thu Jul 27 15:22:35 2017 +0100 @@ -5837,11 +5837,41 @@ show ?thesis using S apply (simp add: hull_redundant cong: aff_dim_affine_hull2) apply (simp add: affine_hull_insert_span_gen hull_inc) - apply (simp add: insert_commute [of a] hull_inc aff_dim_eq_dim [of x] dim_insert span_0) + apply (simp add: insert_commute [of a] hull_inc aff_dim_eq_dim [of x] dim_insert) apply (metis (no_types, lifting) add_minus_cancel image_iff uminus_add_conv_diff) done qed +lemma affine_dependent_choose: + fixes a :: "'a :: euclidean_space" + assumes "~(affine_dependent S)" + shows "affine_dependent(insert a S) \ a \ S \ a \ affine hull S" + (is "?lhs = ?rhs") +proof safe + assume "affine_dependent (insert a S)" and "a \ S" + then show "False" + using \a \ S\ assms insert_absorb by fastforce +next + assume lhs: "affine_dependent (insert a S)" + then have "a \ S" + by (metis (no_types) assms insert_absorb) + moreover have "finite S" + using affine_independent_iff_card assms by blast + moreover have "aff_dim (insert a S) \ int (card S)" + using \finite S\ affine_independent_iff_card \a \ S\ lhs by fastforce + ultimately show "a \ affine hull S" + by (metis aff_dim_affine_independent aff_dim_insert assms) +next + assume "a \ S" and "a \ affine hull S" + show "affine_dependent (insert a S)" + by (simp add: \a \ affine hull S\ \a \ S\ affine_dependent_def) +qed + +lemma affine_independent_insert: + fixes a :: "'a :: euclidean_space" + shows "\~(affine_dependent S); a \ affine hull S\ \ ~(affine_dependent(insert a S))" + by (simp add: affine_dependent_choose) + lemma subspace_bounded_eq_trivial: fixes S :: "'a::real_normed_vector set" assumes "subspace S"