lemma if_smult: "(if P then x else (y::real)) *πͺR v = (if P then x *πͺR v else y *πͺR v)" by simp
lemma sum_delta_notmem: assumes"x β s" shows"sum (λy. if (y = x) then P x else Q y) s = sum Q s" and"sum (λy. if (x = y) then P x else Q y) s = sum Q s" and"sum (λy. if (y = x) then P y else Q y) s = sum Q s" and"sum (λy. if (x = y) then P y else Q y) s = sum Q s" by (smt (verit, best) assms sum.cong)+
lemma span_substd_basis: assumes d: "d β Basis" shows"span d = {x. βiβBasis. i β d βΆ xβi = 0}"
(is"_ = ?B") proof - have"d β ?B" using d by (auto simp: inner_Basis) moreoverhave s: "subspace ?B" using subspace_substandard[of "λi. i β d"] . ultimatelyhave"span d β ?B" using span_mono[of d "?B"] span_eq_iff[of "?B"] by blast moreoverhave *: "card d β€ dim (span d)" by (simp add: d dim_eq_card_independent independent_substdbasis) moreoverfrom * have"dim ?B β€ dim (span d)" using dim_substandard[OF assms] by auto ultimatelyshow ?thesis by (simp add: s subspace_dim_equal) qed
lemma basis_to_substdbasis_subspace_isomorphism: fixes B :: "'a::euclidean_space set" assumes"independent B" shows"βf d::'a set. card d = card B β§ linear f β§ f ` B = d β§ f ` span B = {x. βiβBasis. i β d βΆ x β i = 0} β§ inj_on f (span B) β§ d β Basis" proof - have B: "card B = dim B" using dim_unique[of B B "card B"] assms span_superset[of B] by auto have"dim B β€ card (Basis :: 'a set)" using dim_subset_UNIV[of B] by simp from obtain_subset_with_card_n[OF this] obtain d :: "'a set"where d: "d β Basis"and t: "card d = dim B" by auto let ?t = "{x::'a::euclidean_space. βiβBasis. i β d βΆ xβi = 0}" have"βf. linear f β§ f ` B = d β§ f ` span B = ?t β§ inj_on f (span B)" proof (intro basis_to_basis_subspace_isomorphism subspace_span subspace_substandard span_superset) show"d β {x. βiβBasis. i β d βΆ x β i = 0}" using d inner_not_same_Basis by blast qed (auto simp: span_substd_basis independent_substdbasis dim_substandard d t B assms) with t βΉcard B = dim BβΊ d show ?thesis by auto qed
subsectionβΉAffine set and affine hullβΊ
definitionπβΉtag importantβΊ affine :: "'a::real_vector set ==> bool" where"affine S β· (βxβS. βyβS. βu v. u + v = 1 βΆ u *πͺR x + v *πͺR y β S)"
lemma affine_alt: "affine S β· (βxβS. βyβS. βu::real. (1 - u) *πͺR x + u *πͺR y β S)" unfolding affine_def by (metis eq_diff_eq')
lemma affine_empty [iff]: "affine {}" unfolding affine_def by auto
lemma affine: fixes V::"'a::real_vector set" shows"affine V β· (βS u. finite S β§ S β {} β§ S β V β§ sum u S = 1 βΆ (βxβS. u x *πͺR x) β V)" proof - have"u *πͺR x + v *πͺR y β V"if"x β V""y β V""u + v = (1::real)" and *: "β§S u. [finite S; S β {}; S β V; sum u S = 1]==> (βxβS. u x *πͺR x) β V"for x y u v proof (cases "x = y") case True thenshow ?thesis using that by (metis scaleR_add_left scaleR_one) next case False thenshow ?thesis using that *[of "{x,y}""λw. if w = x then u else v"] by auto qed moreoverhave"(βxβS. u x *πͺR x) β V" if *: "β§x y u v. [xβV; yβV; u + v = 1]==> u *πͺR x + v *πͺR y β V" and"finite S""S β {}""S β V""sum u S = 1"for S u proof -
define n where"n = card S"
consider "card S = 0" | "card S = 1" | "card S = 2" | "card S > 2"by linarith thenshow"(βxβS. u x *πͺR x) β V" proof cases assume"card S = 1" thenobtain a where"S={a}" by (auto simp: card_Suc_eq) thenshow ?thesis using that by simp next assume"card S = 2" thenobtain a b where"S = {a, b}" by (metis Suc_1 card_1_singletonE card_Suc_eq) thenshow ?thesis using *[of a b] that by (auto simp: sum_clauses(2)) next assume"card S > 2" thenshow ?thesis using that n_def proof (induct n arbitrary: u S) case 0 thenshow ?caseby auto next case (Suc n u S) have"sum u S = card S"if"Β¬ (βxβS. u x β 1)" using that unfolding card_eq_sum by auto with Suc.prems obtain x where"x β S"and x: "u x β 1"by force have c: "card (S - {x}) = card S - 1" by (simp add: Suc.prems(3) βΉx β SβΊ) have"sum u (S - {x}) = 1 - u x" by (simp add: Suc.prems sum_diff1 βΉx β SβΊ) with x have eq1: "inverse (1 - u x) * sum u (S - {x}) = 1" by auto have inV: "(βyβS - {x}. (inverse (1 - u x) * u y) *πͺR y) β V" proof (cases "card (S - {x}) > 2") case True thenhave S: "S - {x} β {}""card (S - {x}) = n" using Suc.prems c by force+ show ?thesis proof (rule Suc.hyps) show"(βaβS - {x}. inverse (1 - u x) * u a) = 1" by (auto simp: eq1 sum_distrib_left[symmetric]) qed (use S Suc.prems True in auto) next case False thenhave"card (S - {x}) = Suc (Suc 0)" using Suc.prems c by auto thenobtain a b where ab: "(S - {x}) = {a, b}""aβ b" unfolding card_Suc_eq by auto thenshow ?thesis using eq1 βΉS β VβΊ by (auto simp: sum_distrib_left distrib_left intro!: Suc.prems(2)[of a b]) qed have"u x + (1 - u x) = 1 ==> u x *πͺR x + (1 - u x) *πͺR ((βyβS - {x}. u y *πͺR y) /πͺR (1 - u x)) β V" by (rule Suc.prems) (useβΉx β SβΊ Suc.prems inV inβΉauto simp: scaleR_right.sumβΊ) moreoverhave"(βaβS. u a *πͺR a) = u x *πͺR x + (βaβS - {x}. u a *πͺR a)" by (meson Suc.prems(3) sum.remove βΉx β SβΊ) ultimatelyshow"(βxβS. u x *πͺR x) β V" by (simp add: x) qed qed (useβΉSβ {}βΊβΉfinite SβΊin auto) qed ultimatelyshow ?thesis unfolding affine_def by meson qed
subsubsectionπβΉtag unimportantβΊβΉStepping theorems and hence small special casesβΊ
lemma affine_hull_empty[simp]: "affine hull {} = {}" by simp
lemma affine_hull_finite_step: fixes y :: "'a::real_vector" shows"finite S ==> (βu. sum u (insert a S) = w β§ sum (λx. u x *πͺR x) (insert a S) = y) β· (βv u. sum u S = w - v β§ sum (λx. u x *πͺR x) S = y - v *πͺR a)" (is"_ ==> ?lhs = ?rhs") proof - assume fin: "finite S" show"?lhs = ?rhs" proof assume ?lhs thenobtain u where u: "sum u (insert a S) = w β§ (βxβinsert a S. u x *πͺR x) = y" by auto show ?rhs proof (cases "a β S") case True thenshow ?thesis using u by (simp add: insert_absorb) (metis diff_zero real_vector.scale_zero_left) next case False show ?thesis by (rule exI [where x="u a"]) (use u fin False in auto) qed next assume ?rhs thenobtain v u where vu: "sum u S = w - v""(βxβS. u x *πͺR x) = y - v *πͺR a" by auto have *: "β§x M. (if x = a then v else M) *πͺR x = (if x = a then v *πͺR x else M *??R x)" by auto show ?lhs proof (cases "a β S") case True show ?thesis by (rule exI [where x="λx. (if x=a then v else 0) + u x"])
(simp add: True scaleR_left_distrib sum.distrib sum_clauses fin vu * cong: if_cong) next case False thenshow ?thesis apply (rule_tac x="λx. if x=a then v else u x"in exI) apply (simp add: vu sum_clauses(2)[OF fin] *) by (simp add: sum_delta_notmem(3) vu) qed qed qed
lemma affine_hull_2: fixes a b :: "'a::real_vector" shows"affine hull {a,b} = {u *πͺR a + v *πͺR b| u v. (u + v = 1)}"
(is"?lhs = ?rhs") proof - have *: "β§x y z. z = x - y β· y + z = (x::real)" "β§x y z. z = x - y β· y + z = (x::'a)"by auto have"?lhs = {y. βu. sum u {a, b} = 1 β§ (βvβ{a, b}. u v *πͺR v) = y}" using affine_hull_finite[of "{a,b}"] by auto alsohave"β¦ = {y. βv u. u b = 1 - v β§ u b *πͺR b = y - v *πͺR a}" by (simp add: affine_hull_finite_step[of "{b}" a]) alsohave"β¦ = ?rhs"unfolding * by auto finallyshow ?thesis by auto qed
lemma affine_hull_3: fixes a b c :: "'a::real_vector" shows"affine hull {a,b,c} = { u *πͺR a + v *πͺR b + w *πͺR c| u v w. u + v + w = 1}" proof - have *: "β§x y z. z = x - y β· y + z = (x::real)" "β§x y z. z = x - y β· y + z = (x::'a)"by auto show ?thesis apply (simp add: affine_hull_finite affine_hull_finite_step) unfolding * apply safe apply (metis add.assoc) apply (rule_tac x=u in exI, force) done qed
lemma mem_affine: assumes"affine S""x β S""y β S""u + v = 1" shows"u *πͺR x + v *πͺR y β S" using assms affine_def[of S] by auto
lemma mem_affine_3: assumes"affine S""x β S""y β S""z β S""u + v + w = 1" shows"u *πͺR x + v *πͺR y + w *πͺR z β S" proof - have"u *πͺR x + v *πͺR y + w *πͺR z β affine hull {x, y, z}" using affine_hull_3[of x y z] assms by auto moreover have"affine hull {x, y, z} β affine hull S" using hull_mono[of "{x, y, z}""S"] assms by auto moreover have"affine hull S = S" using assms affine_hull_eq[of S] by auto ultimatelyshow ?thesis by auto qed
lemma mem_affine_3_minus: assumes"affine S""x β S""y β S""z β S" shows"x + v *πͺR (y-z) β S" using mem_affine_3[of S x y z 1 v "-v"] assms by (simp add: algebra_simps)
corollary%unimportant mem_affine_3_minus2: "[affine S; x β S; y β S; z β S]==> x - v *πͺR (y-z) β S" by (metis add_uminus_conv_diff mem_affine_3_minus real_vector.scale_minus_left)
subsubsectionπβΉtag unimportantβΊβΉSome relations between affine hull and subspacesβΊ
lemma affine_hull_insert_subset_span: "affine hull (insert a S) β {a + v| v . v β span {x - a | x . x β S}}" proof - have"βv T u. x = a + v β§ (finite T β§ T β {x - a |x. x β S} β§ (βvβT. u v *πͺR v) = v)" if"finite F""F β {}""F β insert a S""sum u F = 1""(βvβF. u v *πͺR v) = x" for x F u proof - have *: "(λx. x - a) ` (F - {a}) β {x - a |x. x β S}" using that by auto show ?thesis proof (intro exI conjI) show"finite ((λx. x - a) ` (F - {a}))" by (simp add: that(1)) show"(βvβ(λx. x - a) ` (F - {a}). u(v+a) *πͺR v) = x-a" by (simp add: sum.reindex[unfolded inj_on_def] algebra_simps
sum_subtractf scaleR_left.sum[symmetric] sum_diff1 that) qed (useβΉF β insert a SβΊin auto) qed thenshow ?thesis unfolding affine_hull_explicit span_explicit by fast qed
lemma affine_hull_span: assumes"a β S" shows"affine hull S = {a + v | v. v β span {x - a | x. x β S - {a}}}" using affine_hull_insert_span[of a "S - {a}", unfolded insert_Diff[OF assms]] by auto
definition affine_parallel :: "'a::real_vector set ==> 'a::real_vector set ==> bool" where"affine_parallel S T β· (βa. T = (λx. a + x) ` S)"
lemma affine_parallel_expl_aux: fixes S T :: "'a::real_vector set" assumes"β§x. x β S β· a + x β T" shows"T = (λx. a + x) ` S" proof - have"x β ((λx. a + x) ` S)"if"x β T"for x using that by (simp add: image_iff) (metis add.commute diff_add_cancel assms) moreoverhave"T β₯ (λx. a + x) ` S" using assms by auto ultimatelyshow ?thesis by auto qed
lemma affine_parallel_expl: "affine_parallel S T β· (βa. βx. x β S β· a + x β T)" by (auto simp add: affine_parallel_def)
(use affine_parallel_expl_aux [of S _ T] in blast)
lemma affine_parallel_reflex: "affine_parallel S S" unfolding affine_parallel_def using image_add_0 by blast
lemma affine_parallel_commute: assumes"affine_parallel A B" shows"affine_parallel B A" by (metis affine_parallel_def assms translation_galois)
lemma affine_parallel_assoc: assumes"affine_parallel A B" and"affine_parallel B C" shows"affine_parallel A C" by (metis affine_parallel_def assms translation_assoc)
lemma affine_translation_aux: fixes a :: "'a::real_vector" assumes"affine ((λx. a + x) ` S)" shows"affine S" proof -
{ fix x y u v assume xy: "x β S""y β S""(u :: real) + v = 1" thenhave"(a + x) β ((λx. a + x) ` S)""(a + y) β ((λx. a + x) ` S)" by auto thenhave h1: "u *πͺR (a + x) + v *πͺR (a + y) β (λx. a + x) ` S" using xy assms unfolding affine_def by auto have"u *πͺR (a + x) + v *πͺR (a + y) = (u + v) *πͺR a + (u *πͺR x + v *πͺR y)" by (simp add: algebra_simps) alsohave"β¦ = a + (u *πͺR x + v *πͺR y)" usingβΉu + v = 1βΊby auto ultimatelyhave"a + (u *πͺR x + v *πͺR y) β (λx. a + x) ` S" using h1 by auto thenhave"u *πͺR x + v *πͺR y β S"by auto
} thenshow ?thesis unfolding affine_def by auto qed
lemma affine_translation: "affine S β· affine ((+) a ` S)"for a :: "'a::real_vector" by (metis affine_translation_aux translation_galois)
lemma parallel_is_affine: fixes S T :: "'a::real_vector set" assumes"affine S""affine_parallel S T" shows"affine T" by (metis affine_parallel_def affine_translation assms)
lemma subspace_imp_affine: "subspace s ==> affine s" unfolding subspace_def affine_def by auto
lemma affine_diffs_subspace_subtract: "subspace ((λx. x - a) ` S)"if"affine S""a β S" using that affine_diffs_subspace [of _ a] by simp
lemma parallel_subspace_explicit: assumes"affine S" and"a β S" assumes"L β‘ {y. βx β S. (-a) + x = y}" shows"subspace L β§ affine_parallel S L" by (smt (verit) Collect_cong ab_left_minus affine_parallel_def assms image_def mem_Collect_eq parallel_is_affine subspace_affine)
lemma parallel_subspace_aux: assumes"subspace A" and"subspace B" and"affine_parallel A B" shows"A πͺ B" by (metis add.right_neutral affine_parallel_expl assms subsetI subspace_def)
lemma parallel_subspace: assumes"subspace A" and"subspace B" and"affine_parallel A B" shows"A = B" by (simp add: affine_parallel_commute assms parallel_subspace_aux subset_antisym)
lemma affine_parallel_subspace: assumes"affine S""S β {}" shows"β!L. subspace L β§ affine_parallel S L" by (meson affine_parallel_assoc affine_parallel_commute assms equals0I parallel_subspace parallel_subspace_explicit)
subsectionβΉAffine DependenceβΊ
text"Formalized by Lars Schewe."
definitionπβΉtag importantβΊ affine_dependent :: "'a::real_vector set ==> bool" where"affine_dependent S β· (βxβS. x β affine hull (S - {x}))"
lemma affine_dependent_imp_dependent: "affine_dependent S ==> dependent S" unfolding affine_dependent_def dependent_def using affine_hull_subset_span by auto
lemma affine_dependent_subset: "[affine_dependent S; S β T]==> affine_dependent T" using hull_mono [OF Diff_mono [OF _ subset_refl]] by (smt (verit) affine_dependent_def subsetD)
lemma affine_independent_subset: shows"[Β¬ affine_dependent T; S β T]==>Β¬ affine_dependent S" by (metis affine_dependent_subset)
lemma affine_independent_Diff: "Β¬ affine_dependent S ==>Β¬ affine_dependent(S - T)" by (meson Diff_subset affine_dependent_subset)
proposition affine_dependent_explicit: "affine_dependent p β· (βS U. finite S β§ S β p β§ sum U S = 0 β§ (βvβS. U v β 0) β§ sum (λv. U v *πͺR v) S = 0)" proof - have"βS U. finite S β§ S β p β§ sum U S = 0 β§ (βvβS. U v β 0) β§ (βwβS. U w *πͺR w) = 0" if"(βwβS. U w *πͺR w) = x""x β p""finite S""S β {}""S β p - {x}""sum U S = 1"forx S U proof (intro exI conjI) have"x β S" using that by auto thenshow"(βv β insert x S. if v = x then - 1 else U v) = 0" using that by (simp add: sum_delta_notmem) show"(βw β insert x S. (if w = x then - 1 else U w) *πͺR w) = 0" using that βΉx β SβΊby (simp add: if_smult sum_delta_notmem cong: if_cong) qed (use that in auto) moreoverhave"βxβp. βS U. finite S β§ S β {} β§ S β p - {x} β§ sum U S = 1 β§ (βvβS. U v *πͺR v) = x" if"(βvβS. U v *πͺR v) = 0""finite S""S β p""sum U S = 0""v β S""U v β 0"for S U v proof (intro bexI exI conjI) have"S β {v}" using that by auto thenshow"S - {v} β {}" using that by auto show"(βx β S - {v}. - (1 / U v) * U x) = 1" unfolding sum_distrib_left[symmetric] sum_diff1[OF βΉfinite SβΊ] by (simp add: that) show"(βxβS - {v}. (- (1 / U v) * U x) *πͺR x) = v" unfolding sum_distrib_left [symmetric] scaleR_scaleR[symmetric]
scaleR_right.sum [symmetric] sum_diff1[OF βΉfinite SβΊ] using that by auto show"S - {v} β p - {v}" using that by auto qed (use that in auto) ultimatelyshow ?thesis unfolding affine_dependent_def affine_hull_explicit by auto qed
lemma affine_dependent_explicit_finite: fixes S :: "'a::real_vector set" assumes"finite S" shows"affine_dependent S β· (βU. sum U S = 0 β§ (βvβS. U v β 0) β§ sum (λv. U v *πͺR v) S = 0)"
(is"?lhs = ?rhs") proof have *: "β§vt U v. (if vt then U v else 0) *πͺR v = (if vt then (U v) *πͺR v else 0::'a)" by auto assume ?lhs thenobtain T U v where "finite T""T β S""sum U T = 0""vβT""U v β 0""(βvβT. U v *πͺR v) = 0" unfolding affine_dependent_explicit by auto thenshow ?rhs apply (rule_tac x="λx. if xβT then U x else 0"in exI) apply (auto simp: * sum.inter_restrict[OF assms, symmetric] Int_absorb1[OF βΉTβSβΊ]) done next assume ?rhs thenobtain U v where"sum U S = 0""vβS""U v β 0""(βvβS. U v *πͺR v) = 0" by auto thenshow ?lhs unfolding affine_dependent_explicit using assms by auto qed
lemma dependent_imp_affine_dependent: assumes"dependent {x - a| x . x β S}" and"a β S" shows"affine_dependent (insert a S)" proof - from assms(1)[unfolded dependent_explicit] obtain S' U v where S: "finite S'""S' β {x - a |x. x β S}""vβS'""U v β 0""(βvβS'. U v *πͺR v) = 0" by auto
define T where"T = (λx. x + a) ` S'" have inj: "inj_on (λx. x + a) S'" unfolding inj_on_def by auto have"0 β S'" using S(2) assms(2) unfolding subset_eq by auto have fin: "finite T"and"T β S" unfolding T_def using S(1,2) by auto thenhave"finite (insert a T)"and"insert a T β insert a S" by auto moreoverhave *: "β§P Q. (βxβT. (if x = a then P x else Q x)) = (βxβT. Q x)" by (smt (verit, best) βΉT β SβΊ assms(2) subsetD sum.cong) have"(βxβinsert a T. if x = a then - (βxβT. U (x - a)) else U (x - a)) = 0" by (smt (verit) βΉT β SβΊ assms(2) fin insert_absorb insert_subset sum.insert sum_mono) moreoverhave"βvβinsert a T. (if v = a then - (βxβT. U (x - a)) else U (v - a)) β 0" using S(3,4) βΉ0βS'βΊ by (rule_tac x="v + a"in bexI) (auto simp: T_def) moreoverhave *: "β§P Q. (βxβT. (if x = a then P x else Q x) *πͺR x) = (βxβT. Q x *??R x)" usingβΉaβSβΊβΉTβSβΊby (auto intro!: sum.cong) have"(βxβT. U (x - a)) *πͺR a = (βvβT. U (v - a) *πͺR v)" unfolding scaleR_left.sum unfolding T_def and sum.reindex[OF inj] and o_def using S(5) by (auto simp: sum.distrib scaleR_right_distrib) thenhave"(βvβinsert a T. (if v = a then - (βxβT. U (x - a)) else U (v - a)) *πͺR v) = 0" unfolding sum_clauses(2)[OF fin] usingβΉaβSβΊβΉTβSβΊby (auto simp: *) ultimatelyshow ?thesis unfolding affine_dependent_explicit by (force intro!: exI[where x="insert a T"]) qed
lemma affine_dependent_biggerset: fixes S :: "'a::euclidean_space set" assumes"finite S""card S β₯ DIM('a) + 2" shows"affine_dependent S" proof - have"S β {}"using assms by auto thenobtain a where"aβS"by auto have *: "{x - a |x. x β S - {a}} = (λx. x - a) ` (S - {a})" by auto have"card {x - a |x. x β S - {a}} = card (S - {a})" unfolding * by (simp add: card_image inj_on_def) alsohave"β¦ > DIM('a)"using assms(2) unfolding card_Diff_singleton[OF βΉaβSβΊ] by auto finallyhave"affine_dependent (insert a (S - {a}))" using dependent_biggerset dependent_imp_affine_dependent by blast thenshow ?thesis by (simp add: βΉa β SβΊ insert_absorb) qed
lemma affine_dependent_biggerset_general: assumes"finite (S :: 'a::euclidean_space set)" and"card S β₯ dim S + 2" shows"affine_dependent S" proof - from assms(2) have"S β {}"by auto thenobtain a where"aβS"by auto have *: "{x - a |x. x β S - {a}} = (λx. x - a) ` (S - {a})" by auto have **: "card {x - a |x. x β S - {a}} = card (S - {a})" by (metis (no_types, lifting) "*" card_image diff_add_cancel inj_on_def) have"dim {x - a |x. x β S - {a}} β€ dim S" usingβΉaβSβΊby (auto simp: span_base span_diff intro: subset_le_dim) alsohave"β¦ < dim S + 1"by auto alsohave"β¦β€ card (S - {a})" using assms card_Diff_singleton[OF βΉaβSβΊ] by auto finallyhave"affine_dependent (insert a (S - {a}))" by (smt (verit) Collect_cong dependent_imp_affine_dependent dependent_biggerset_general ** Diff_iff insertCI) thenshow ?thesis by (simp add: βΉa β SβΊ insert_absorb) qed
subsectionπβΉtag unimportantβΊβΉSome Properties of Affine Dependent SetsβΊ
lemma affine_independent_0 [simp]: "Β¬ affine_dependent {}" by (simp add: affine_dependent_def)
lemma affine_independent_1 [simp]: "Β¬ affine_dependent {a}" by (simp add: affine_dependent_def)
lemma affine_hull_translation: "affine hull ((λx. a + x) ` S) = (λx. a + x) ` (affine hull S)" proof - have"affine ((λx. a + x) ` (affine hull S))" using affine_translation affine_affine_hull by blast moreoverhave"(λx. a + x) ` S β (λx. a + x) ` (affine hull S)" using hull_subset[of S] by auto ultimatelyhave h1: "affine hull ((λx. a + x) ` S) β (λx. a + x) ` (affine hull S)" by (metis hull_minimal) have"affine((λx. -a + x) ` (affine hull ((λx. a + x) ` S)))" using affine_translation affine_affine_hull by blast moreoverhave"(λx. -a + x) ` (λx. a + x) ` S β (λx. -a + x) ` (affine hull ((λx. a + x) ` S))" using hull_subset[of "(λx. a + x) ` S"] by auto moreoverhave"S = (λx. -a + x) ` (λx. a + x) ` S" using translation_assoc[of "-a" a] by auto ultimatelyhave"(λx. -a + x) ` (affine hull ((λx. a + x) ` S)) >= (affine hull S)" by (metis hull_minimal) thenhave"affine hull ((λx. a + x) ` S) >= (λx. a + x) ` (affine hull S)" by auto thenshow ?thesis using h1 by auto qed
lemma affine_dependent_translation: assumes"affine_dependent S" shows"affine_dependent ((λx. a + x) ` S)" proof - obtain x where x: "x β S β§ x β affine hull (S - {x})" using assms affine_dependent_def by auto have"(+) a ` (S - {x}) = (+) a ` S - {a + x}" by auto thenhave"a + x β affine hull ((λx. a + x) ` S - {a + x})" using affine_hull_translation[of a "S - {x}"] x by auto moreoverhave"a + x β (λx. a + x) ` S" using x by auto ultimatelyshow ?thesis unfolding affine_dependent_def by auto qed
lemma affine_dependent_translation_eq: "affine_dependent S β· affine_dependent ((λx. a + x) ` S)" by (metis affine_dependent_translation translation_galois)
lemma affine_hull_0_dependent: assumes"0 β affine hull S" shows"dependent S" proof - obtain s u where s_u: "finite s β§ s β {} β§ s β S β§ sum u s = 1 β§ (βvβs. u v *πͺR v) = 0" using assms affine_hull_explicit[of S] by auto thenhave"βvβs. u v β 0"by auto thenhave"finite s β§ s β S β§ (βvβs. u v β 0 β§ (βvβs. u v *πͺR v) = 0)" using s_u by auto thenshow ?thesis unfolding dependent_explicit[of S] by auto qed
lemma affine_dependent_imp_dependent2: assumes"affine_dependent (insert 0 S)" shows"dependent S" proof - obtain x where x: "x β insert 0 S β§ x β affine hull (insert 0 S - {x})" using affine_dependent_def[of "(insert 0 S)"] assms by blast thenhave"x β span (insert 0 S - {x})" using affine_hull_subset_span by auto moreoverhave"span (insert 0 S - {x}) = span (S - {x})" using insert_Diff_if[of "0" S "{x}"] span_insert_0[of "S-{x}"] by auto ultimatelyhave"x β span (S - {x})"by auto thenhave"x β 0 ==> dependent S" using x dependent_def by auto moreoverhave"dependent S"if"x = 0" by (metis that affine_hull_0_dependent Diff_insert_absorb dependent_zero x) ultimatelyshow ?thesis by auto qed
lemma affine_dependent_iff_dependent: assumes"a β S" shows"affine_dependent (insert a S) β· dependent ((λx. -a + x) ` S)" proof - have"((+) (- a) ` S) = {x - a| x . x β S}"by auto thenshow ?thesis using affine_dependent_translation_eq[of "(insert a S)""-a"]
affine_dependent_imp_dependent2 assms
dependent_imp_affine_dependent[of a S] by (auto simp del: uminus_add_conv_diff) qed
lemma affine_dependent_iff_dependent2: assumes"a β S" shows"affine_dependent S β· dependent ((λx. -a + x) ` (S-{a}))" by (metis Diff_iff affine_dependent_iff_dependent assms insert_Diff singletonI)
lemma affine_hull_insert_span_gen: "affine hull (insert a S) = (λx. a + x) ` span ((λx. - a + x) ` S)" proof - have h1: "{x - a |x. x β S} = ((λx. -a+x) ` S)" by auto
{ assume"a β S" thenhave ?thesis using affine_hull_insert_span[of a S] h1 by auto
} moreover
{ assume a1: "a β S" thenhave"insert 0 ((λx. -a+x) ` (S - {a})) = (λx. -a+x) ` S" by auto thenhave"span ((λx. -a+x) ` (S - {a})) = span ((λx. -a+x) ` S)" using span_insert_0[of "(+) (- a) ` (S - {a})"] by presburger moreoverhave"{x - a |x. x β (S - {a})} = ((λx. -a+x) ` (S - {a}))" by auto moreoverhave"insert a (S - {a}) = insert a S" by auto ultimatelyhave ?thesis using affine_hull_insert_span[of "a""S-{a}"] by auto
} ultimatelyshow ?thesis by auto qed
lemma affine_hull_span_0: assumes"0 β affine hull S" shows"affine hull S = span S" using affine_hull_span_gen[of "0" S] assms by auto
lemma extend_to_affine_basis_nonempty: fixes S V :: "'n::real_vector set" assumes"Β¬ affine_dependent S""S β V""S β {}" shows"βT. Β¬ affine_dependent T β§ S β T β§ T β V β§ affine hull T = affine hull V" proof - obtain a where a: "a β S" using assms by auto thenhave h0: "independent ((λx. -a + x) ` (S-{a}))" using affine_dependent_iff_dependent2 assms by auto obtain B where B: "(λx. -a+x) ` (S - {a}) β B β§ B β (λx. -a+x) ` V β§ independent B β§ (λx. -a+x) ` V β span B" using assms by (blast intro: maximal_independent_subset_extend[OF _ h0, of "(λx. -a + x) ` V"])
define T where"T = (λx. a+x) ` insert 0 B" thenhave"T = insert a ((λx. a+x) ` B)" by auto thenhave"affine hull T = (λx. a+x) ` span B" using affine_hull_insert_span_gen[of a "((λx. a+x) ` B)"] translation_assoc[of "-a" a B] by auto thenhave"V β affine hull T" using B assms translation_inverse_subset[of a V "span B"] by auto moreoverhave"T β V" using T_def B a assms by auto ultimatelyhave"affine hull T = affine hull V" by (metis Int_absorb1 Int_absorb2 hull_hull hull_mono) moreoverhave"S β T" using T_def B translation_inverse_subset[of a "S-{a}" B] by auto moreoverhave"Β¬ affine_dependent T" using T_def affine_dependent_translation_eq[of "insert 0 B"]
affine_dependent_imp_dependent2 B by auto ultimatelyshow ?thesis usingβΉT β VβΊby auto qed
lemma affine_basis_exists: fixes V :: "'n::real_vector set" shows"βB. B β V β§Β¬ affine_dependent B β§ affine hull V = affine hull B" by (metis affine_dependent_def affine_independent_1 empty_subsetI extend_to_affine_basis_nonempty insert_subset order_refl)
proposition extend_to_affine_basis: fixes S V :: "'n::real_vector set" assumes"Β¬ affine_dependent S""S β V" obtains T where"Β¬ affine_dependent T""S β T""T β V""affine hull T = affine hull V" by (metis affine_basis_exists assms(1) assms(2) bot.extremum extend_to_affine_basis_nonempty)
subsectionβΉAffine Dimension of a SetβΊ
definitionπβΉtag importantβΊ aff_dim :: "('a::euclidean_space) set ==> int" where"aff_dim V = (SOME d :: int. βB. affine hull B = affine hull V β§Β¬ affine_dependent B β§ of_nat (card B) = d + 1)"
lemma aff_dim_basis_exists: fixes V :: "('n::euclidean_space) set" shows"βB. affine hull B = affine hull V β§Β¬ affine_dependent B β§ of_nat (card B) = aff_dim V + 1" proof - obtain B where"Β¬ affine_dependent B β§ affine hull B = affine hull V" using affine_basis_exists[of V] by auto thenshow ?thesis unfolding aff_dim_def
some_eq_ex[of "λd. βB. affine hull B = affine hull V β§Β¬ affine_dependent B β§ of_nat (card B) = d + 1"] apply auto apply (rule exI[of _ "int (card B) - (1 :: int)"]) apply (rule exI[of _ "B"], auto) done qed
lemma affine_hull_eq_empty [simp]: "affine hull S = {} β· S = {}" by (metis affine_empty subset_empty subset_hull)
lemma empty_eq_affine_hull[simp]: "{} = affine hull S β· S = {}" by (metis affine_hull_eq_empty)
lemma aff_dim_parallel_subspace_aux: fixes B :: "'n::euclidean_space set" assumes"Β¬ affine_dependent B""a β B" shows"finite B β§ ((card B) - 1 = dim (span ((λx. -a+x) ` (B-{a}))))" proof - have"independent ((λx. -a + x) ` (B-{a}))" using affine_dependent_iff_dependent2 assms by auto thenhave fin: "dim (span ((λx. -a+x) ` (B-{a}))) = card ((λx. -a + x) ` (B-{a}))" "finite ((λx. -a + x) ` (B - {a}))" using indep_card_eq_dim_span[of "(λx. -a+x) ` (B-{a})"] by auto show ?thesis proof (cases "(λx. -a + x) ` (B - {a}) = {}") case True have"B = insert a ((λx. a + x) ` (λx. -a + x) ` (B - {a}))" using translation_assoc[of "a""-a""(B - {a})"] assms by auto thenhave"B = {a}"using True by auto thenshow ?thesis using assms fin by auto next case False thenhave"card ((λx. -a + x) ` (B - {a})) > 0" using fin by auto moreoverhave h1: "card ((λx. -a + x) ` (B-{a})) = card (B-{a})" by (rule card_image) (use translate_inj_on in blast) ultimatelyhave"card (B-{a}) > 0"by auto thenhave *: "finite (B - {a})" using card_gt_0_iff[of "(B - {a})"] by auto thenhave"card (B - {a}) = card B - 1" using card_Diff_singleton assms by auto with * show ?thesis using fin h1 by auto qed qed
lemma aff_dim_parallel_subspace: fixes V L :: "'n::euclidean_space set" assumes"V β {}" and"subspace L" and"affine_parallel (affine hull V) L" shows"aff_dim V = int (dim L)" proof - obtain B where
B: "affine hull B = affine hull V β§Β¬ affine_dependent B β§ int (card B) = aff_dim V + 1" using aff_dim_basis_exists by auto thenhave"B β {}" using assms B by auto thenobtain a where a: "a β B"by auto
define Lb where"Lb = span ((λx. -a+x) ` (B-{a}))" moreoverhave"affine_parallel (affine hull B) Lb" using Lb_def B assms affine_hull_span2[of a B] a
affine_parallel_commute[of "Lb""(affine hull B)"] unfolding affine_parallel_def by auto moreoverhave"subspace Lb" using Lb_def subspace_span by auto moreoverhave"affine hull B β {}" using assms B by auto ultimatelyhave"L = Lb" using assms affine_parallel_subspace[of "affine hull B"] affine_affine_hull[of B] B by auto thenhave"dim L = dim Lb" by auto moreoverhave"card B - 1 = dim Lb"and"finite B" using Lb_def aff_dim_parallel_subspace_aux a B by auto ultimatelyshow ?thesis using B βΉB β {}βΊ card_gt_0_iff[of B] by auto qed
lemma aff_independent_finite: fixes B :: "'n::euclidean_space set" assumes"Β¬ affine_dependent B" shows"finite B" using aff_dim_parallel_subspace_aux assms finite.simps by fastforce
lemma aff_dim_empty: fixes S :: "'n::euclidean_space set" shows"S = {} β· aff_dim S = -1" proof - obtain B where *: "affine hull B = affine hull S" and"Β¬ affine_dependent B" and"int (card B) = aff_dim S + 1" using aff_dim_basis_exists by auto moreover from * have"S = {} β· B = {}" by auto ultimatelyshow ?thesis using aff_independent_finite[of B] card_gt_0_iff[of B] by auto qed
lemma aff_dim_empty_eq [simp]: "aff_dim ({}::'a::euclidean_space set) = -1" using aff_dim_empty by blast
lemma aff_dim_affine_hull [simp]: "aff_dim (affine hull S) = aff_dim S" unfolding aff_dim_def using hull_hull[of _ S] by auto
lemma aff_dim_affine_hull2: assumes"affine hull S = affine hull T" shows"aff_dim S = aff_dim T" unfolding aff_dim_def using assms by auto
lemma aff_dim_unique: fixes B V :: "'n::euclidean_space set" assumes"affine hull B = affine hull V β§Β¬ affine_dependent B" shows"of_nat (card B) = aff_dim V + 1" proof (cases "B = {}") case True thenhave"V = {}" using assms by auto thenhave"aff_dim V = (-1::int)" using aff_dim_empty by auto thenshow ?thesis usingβΉB = {}βΊby auto next case False thenobtain a where a: "a β B"by auto
define Lb where"Lb = span ((λx. -a+x) ` (B-{a}))" have"affine_parallel (affine hull B) Lb" using Lb_def affine_hull_span2[of a B] a
affine_parallel_commute[of "Lb""(affine hull B)"] unfolding affine_parallel_def by auto moreoverhave"subspace Lb" using Lb_def subspace_span by auto ultimatelyhave"aff_dim B = int(dim Lb)" using aff_dim_parallel_subspace[of B Lb] βΉB β {}βΊby auto moreoverhave"(card B) - 1 = dim Lb""finite B" using Lb_def aff_dim_parallel_subspace_aux a assms by auto ultimatelyhave"of_nat (card B) = aff_dim B + 1" usingβΉB β {}βΊ card_gt_0_iff[of B] by auto thenshow ?thesis using aff_dim_affine_hull2 assms by auto qed
lemma aff_dim_affine_independent: fixes B :: "'n::euclidean_space set" assumes"Β¬ affine_dependent B" shows"of_nat (card B) = aff_dim B + 1" using aff_dim_unique[of B B] assms by auto
lemma affine_independent_iff_card: fixes S :: "'a::euclidean_space set" shows"Β¬ affine_dependent S β· finite S β§ aff_dim S = int(card S) - 1" (is"?lhs = ?rhs") proof show"?lhs ==> ?rhs" by (simp add: aff_dim_affine_independent aff_independent_finite) show"?rhs ==> ?lhs" by (metis of_nat_eq_iff affine_basis_exists aff_dim_unique card_subset_eq diff_add_cancel) qed
lemma aff_dim_sing [simp]: fixes a :: "'n::euclidean_space" shows"aff_dim {a} = 0" using aff_dim_affine_independent[of "{a}"] affine_independent_1 by auto
lemma aff_dim_2 [simp]: fixes a :: "'n::euclidean_space" shows"aff_dim {a,b} = (if a = b then 0 else 1)" proof (clarsimp) assume"a β b" thenhave"aff_dim{a,b} = card{a,b} - 1" using affine_independent_2 [of a b] aff_dim_affine_independent by fastforce alsohave"β¦ = 1" usingβΉa β bβΊby simp finallyshow"aff_dim {a, b} = 1" . qed
lemma aff_dim_inner_basis_exists: fixes V :: "('n::euclidean_space) set" shows"βB. B β V β§ affine hull B = affine hull V β§ Β¬ affine_dependent B β§ of_nat (card B) = aff_dim V + 1" by (metis aff_dim_unique affine_basis_exists)
lemma aff_dim_le_card: fixes V :: "'n::euclidean_space set" assumes"finite V" shows"aff_dim V β€ of_nat (card V) - 1" by (metis aff_dim_inner_basis_exists assms card_mono le_diff_eq of_nat_le_iff)
lemma aff_dim_parallel_le: fixes S T :: "'n::euclidean_space set" assumes"affine_parallel (affine hull S) (affine hull T)" shows"aff_dim S β€ aff_dim T" proof (cases "S={} β¨ T={}") case True thenshow ?thesis by (smt (verit, best) aff_dim_affine_hull2 affine_hull_empty affine_parallel_def assms empty_is_image) next case False thenobtain L where L: "subspace L""affine_parallel (affine hull T) L" by (metis affine_affine_hull affine_hull_eq_empty affine_parallel_subspace) with False show ?thesis by (metis aff_dim_parallel_subspace affine_parallel_assoc assms dual_order.refl) qed
lemma aff_dim_parallel_eq: fixes S T :: "'n::euclidean_space set" assumes"affine_parallel (affine hull S) (affine hull T)" shows"aff_dim S = aff_dim T" by (smt (verit, del_insts) aff_dim_parallel_le affine_parallel_commute assms)
lemma aff_dim_translation_eq: "aff_dim ((+) a ` S) = aff_dim S"for a :: "'n::euclidean_space" by (metis aff_dim_parallel_eq affine_hull_translation affine_parallel_def)
lemma aff_dim_translation_eq_subtract: "aff_dim ((λx. x - a) ` S) = aff_dim S"for a :: "'n::euclidean_space" using aff_dim_translation_eq [of "- a"] by (simp cong: image_cong_simp)
lemma aff_dim_affine: fixes S L :: "'n::euclidean_space set" assumes"affine S""subspace L""affine_parallel S L""S β {}" shows"aff_dim S = int (dim L)" by (simp add: aff_dim_parallel_subspace assms hull_same)
lemma dim_affine_hull [simp]: fixes S :: "'n::euclidean_space set" shows"dim (affine hull S) = dim S" by (metis affine_hull_subset_span dim_eq_span dim_mono hull_subset span_eq_dim)
lemma aff_dim_subspace: fixes S :: "'n::euclidean_space set" assumes"subspace S" shows"aff_dim S = int (dim S)" by (metis aff_dim_affine affine_parallel_subspace assms empty_iff parallel_subspace subspace_affine)
lemma aff_dim_zero: fixes S :: "'n::euclidean_space set" assumes"0 β affine hull S" shows"aff_dim S = int (dim S)" by (metis aff_dim_affine_hull aff_dim_subspace affine_hull_span_0 assms dim_span subspace_span)
lemma aff_dim_eq_dim: fixes S :: "'n::euclidean_space set" assumes"a β affine hull S" shows"aff_dim S = int (dim ((+) (- a) ` S))" by (metis ab_left_minus aff_dim_translation_eq aff_dim_zero affine_hull_translation image_eqI assms)
lemma aff_dim_eq_dim_subtract: fixes S :: "'n::euclidean_space set" assumes"a β affine hull S" shows"aff_dim S = int (dim ((λx. x - a) ` S))" using aff_dim_eq_dim assms by auto
lemma aff_dim_geq: fixes V :: "'n::euclidean_space set" shows"aff_dim V β₯ -1" by (metis add_le_cancel_right aff_dim_basis_exists diff_self of_nat_0_le_iff uminus_add_conv_diff)
lemma aff_dim_negative_iff [simp]: fixes S :: "'n::euclidean_space set" shows"aff_dim S < 0 β· S = {}" by (metis aff_dim_empty aff_dim_geq diff_0 eq_iff zle_diff1_eq)
lemma aff_lowdim_subset_hyperplane: fixes S :: "'a::euclidean_space set" assumes"aff_dim S < DIM('a)" obtains a b where"a β 0""S β {x. a β x = b}" proof (cases "S={}") case True moreover have"(SOME b. b β Basis) β 0" by (metis norm_some_Basis norm_zero zero_neq_one) ultimatelyshow ?thesis using that by blast next case False thenobtain c S' where"c β S'""S = insert c S'" by (meson equals0I mk_disjoint_insert) have"dim ((+) (-c) ` S) < DIM('a)" by (metis βΉS = insert c S'βΊ aff_dim_eq_dim assms hull_inc insertI1 of_nat_less_imp_less) thenobtain a where"a β 0""span ((+) (-c) ` S) β {x. a β x = 0}" using lowdim_subset_hyperplane by blast moreover have"a β w = a β c"if"span ((+) (- c) ` S) β {x. a β x = 0}""w β S"for w proof - have"w-c β span ((+) (- c) ` S)" by (simp add: span_base βΉw β SβΊ) with that have"w-c β {x. a β x = 0}" by blast thenshow ?thesis by (auto simp: algebra_simps) qed ultimatelyhave"S β {x. a β x = a β c}" by blast thenshow ?thesis by (rule that[OF βΉa β 0βΊ]) qed
lemma affine_independent_card_dim_diffs: fixes S :: "'a :: euclidean_space set" assumes"Β¬ affine_dependent S""a β S" shows"card S = dim ((λx. x - a) ` S) + 1" using aff_dim_affine_independent aff_dim_eq_dim_subtract assms hull_subset by fastforce
lemma independent_card_le_aff_dim: fixes B :: "'n::euclidean_space set" assumes"B β V" assumes"Β¬ affine_dependent B" shows"int (card B) β€ aff_dim V + 1" by (metis aff_dim_unique aff_independent_finite assms card_mono extend_to_affine_basis of_nat_mono)
lemma aff_dim_subset: fixes S T :: "'n::euclidean_space set" assumes"S β T" shows"aff_dim S β€ aff_dim T" by (metis add_le_cancel_right aff_dim_inner_basis_exists assms dual_order.trans independent_card_le_aff_dim)
lemma aff_dim_le_DIM: fixes S :: "'n::euclidean_space set" shows"aff_dim S β€ int (DIM('n))" by (metis aff_dim_UNIV aff_dim_subset top_greatest)
lemma affine_dim_equal: fixes S :: "'n::euclidean_space set" assumes"affine S""affine T""S β {}""S β T""aff_dim S = aff_dim T" shows"S = T" proof - obtain a where"a β S""a β T""T β {}"using assms by auto
define LS where"LS = {y. βx β S. (-a) + x = y}" thenhave ls: "subspace LS""affine_parallel S LS" using assms parallel_subspace_explicit[of S a LS] βΉa β SβΊby auto thenhave h1: "int(dim LS) = aff_dim S" using assms aff_dim_affine[of S LS] by auto
define LT where"LT = {y. βx β T. (-a) + x = y}" thenhave lt: "subspace LT β§ affine_parallel T LT" using assms parallel_subspace_explicit[of T a LT] βΉa β TβΊby auto thenhave"dim LS = dim LT" using assms aff_dim_affine[of T LT] βΉT β {}βΊ h1 by auto moreoverhave"LS β€ LT" using LS_def LT_def assms by auto ultimatelyhave"LS = LT" using subspace_dim_equal[of LS LT] ls lt by auto moreoverhave"S = {x. βy β LS. a+y=x}""T = {x. βy β LT. a+y=x}" using LS_def LT_def by auto ultimatelyshow ?thesis by auto qed
lemma aff_dim_eq_0: fixes S :: "'a::euclidean_space set" shows"aff_dim S = 0 β· (βa. S = {a})" proof (cases "S = {}") case False thenobtain a where"a β S"by auto show ?thesis proof safe assume 0: "aff_dim S = 0" have"Β¬ {a,b} β S"if"b β a"for b by (metis "0" aff_dim_2 aff_dim_subset not_one_le_zero that) thenshow"βa. S = {a}" usingβΉa β SβΊby blast qed auto qed auto
lemma affine_hull_UNIV: fixes S :: "'n::euclidean_space set" assumes"aff_dim S = int(DIM('n))" shows"affine hull S = (UNIV :: ('n::euclidean_space) set)" by (simp add: aff_dim_empty affine_dim_equal assms)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfΓ€ltig zusammengestellt. Es wird jedoch weder VollstΓ€ndigkeit, noch Richtigkeit,
noch QualitΓ€t der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.