src/HOL/Analysis/Starlike.thy
changeset 69541 d466e0a639e4
parent 69529 4ab9657b3257
child 69618 2be1baf40351
equal deleted inserted replaced
69531:1ae0c822682c 69541:d466e0a639e4
  4977 using halfspace_eq_empty_le [of "-a" "-b"]
  4977 using halfspace_eq_empty_le [of "-a" "-b"]
  4978 by simp
  4978 by simp
  4979 
  4979 
  4980 subsection%unimportant\<open>Use set distance for an easy proof of separation properties\<close>
  4980 subsection%unimportant\<open>Use set distance for an easy proof of separation properties\<close>
  4981 
  4981 
  4982 proposition separation_closures:
  4982 proposition%unimportant separation_closures:
  4983   fixes S :: "'a::euclidean_space set"
  4983   fixes S :: "'a::euclidean_space set"
  4984   assumes "S \<inter> closure T = {}" "T \<inter> closure S = {}"
  4984   assumes "S \<inter> closure T = {}" "T \<inter> closure S = {}"
  4985   obtains U V where "U \<inter> V = {}" "open U" "open V" "S \<subseteq> U" "T \<subseteq> V"
  4985   obtains U V where "U \<inter> V = {}" "open U" "open V" "S \<subseteq> U" "T \<subseteq> V"
  4986 proof (cases "S = {} \<or> T = {}")
  4986 proof (cases "S = {} \<or> T = {}")
  4987   case True with that show ?thesis by auto
  4987   case True with that show ?thesis by auto
  5523     by (simp add: clo closedin_closed_Int)
  5523     by (simp add: clo closedin_closed_Int)
  5524 qed
  5524 qed
  5525 
  5525 
  5526 subsubsection%unimportant\<open>Representing affine hull as a finite intersection of hyperplanes\<close>
  5526 subsubsection%unimportant\<open>Representing affine hull as a finite intersection of hyperplanes\<close>
  5527 
  5527 
  5528 proposition affine_hull_convex_Int_nonempty_interior:
  5528 proposition%unimportant affine_hull_convex_Int_nonempty_interior:
  5529   fixes S :: "'a::real_normed_vector set"
  5529   fixes S :: "'a::real_normed_vector set"
  5530   assumes "convex S" "S \<inter> interior T \<noteq> {}"
  5530   assumes "convex S" "S \<inter> interior T \<noteq> {}"
  5531     shows "affine hull (S \<inter> T) = affine hull S"
  5531     shows "affine hull (S \<inter> T) = affine hull S"
  5532 proof
  5532 proof
  5533   show "affine hull (S \<inter> T) \<subseteq> affine hull S"
  5533   show "affine hull (S \<inter> T) \<subseteq> affine hull S"
  5694   fixes a :: "'a::euclidean_space"
  5694   fixes a :: "'a::euclidean_space"
  5695   shows "aff_dim {x. a \<bullet> x \<ge> r} =
  5695   shows "aff_dim {x. a \<bullet> x \<ge> r} =
  5696         (if a = 0 \<and> r > 0 then -1 else DIM('a))"
  5696         (if a = 0 \<and> r > 0 then -1 else DIM('a))"
  5697 using aff_dim_halfspace_le [of "-a" "-r"] by simp
  5697 using aff_dim_halfspace_le [of "-a" "-r"] by simp
  5698 
  5698 
  5699 subsection%unimportant\<open>Properties of special hyperplanes\<close>
  5699 subsection\<open>Properties of special hyperplanes\<close>
  5700 
  5700 
  5701 lemma subspace_hyperplane: "subspace {x. a \<bullet> x = 0}"
  5701 lemma subspace_hyperplane: "subspace {x. a \<bullet> x = 0}"
  5702   by (simp add: subspace_def inner_right_distrib)
  5702   by (simp add: subspace_def inner_right_distrib)
  5703 
  5703 
  5704 lemma subspace_hyperplane2: "subspace {x. x \<bullet> a = 0}"
  5704 lemma subspace_hyperplane2: "subspace {x. x \<bullet> a = 0}"
  5971     by (metis One_nat_def \<open>a \<noteq> 0\<close> affine_bounded_eq_lowdim affine_hyperplane bounded_hyperplane_eq_trivial_0)
  5971     by (metis One_nat_def \<open>a \<noteq> 0\<close> affine_bounded_eq_lowdim affine_hyperplane bounded_hyperplane_eq_trivial_0)
  5972 qed
  5972 qed
  5973 
  5973 
  5974 subsection%unimportant\<open>General case without assuming closure and getting non-strict separation\<close>
  5974 subsection%unimportant\<open>General case without assuming closure and getting non-strict separation\<close>
  5975 
  5975 
  5976 proposition separating_hyperplane_closed_point_inset:
  5976 proposition%unimportant separating_hyperplane_closed_point_inset:
  5977   fixes S :: "'a::euclidean_space set"
  5977   fixes S :: "'a::euclidean_space set"
  5978   assumes "convex S" "closed S" "S \<noteq> {}" "z \<notin> S"
  5978   assumes "convex S" "closed S" "S \<noteq> {}" "z \<notin> S"
  5979   obtains a b where "a \<in> S" "(a - z) \<bullet> z < b" "\<And>x. x \<in> S \<Longrightarrow> b < (a - z) \<bullet> x"
  5979   obtains a b where "a \<in> S" "(a - z) \<bullet> z < b" "\<And>x. x \<in> S \<Longrightarrow> b < (a - z) \<bullet> x"
  5980 proof -
  5980 proof -
  5981   obtain y where "y \<in> S" and y: "\<And>u. u \<in> S \<Longrightarrow> dist z y \<le> dist z u"
  5981   obtain y where "y \<in> S" and y: "\<And>u. u \<in> S \<Longrightarrow> dist z y \<le> dist z u"
  6008   obtains a b where "a \<in> S" "a \<noteq> 0" "0 < b" "\<And>x. x \<in> S \<Longrightarrow> a \<bullet> x > b"
  6008   obtains a b where "a \<in> S" "a \<noteq> 0" "0 < b" "\<And>x. x \<in> S \<Longrightarrow> a \<bullet> x > b"
  6009 using separating_hyperplane_closed_point_inset [OF assms]
  6009 using separating_hyperplane_closed_point_inset [OF assms]
  6010 by simp (metis \<open>0 \<notin> S\<close>)
  6010 by simp (metis \<open>0 \<notin> S\<close>)
  6011 
  6011 
  6012 
  6012 
  6013 proposition separating_hyperplane_set_0_inspan:
  6013 proposition%unimportant separating_hyperplane_set_0_inspan:
  6014   fixes S :: "'a::euclidean_space set"
  6014   fixes S :: "'a::euclidean_space set"
  6015   assumes "convex S" "S \<noteq> {}" "0 \<notin> S"
  6015   assumes "convex S" "S \<noteq> {}" "0 \<notin> S"
  6016   obtains a where "a \<in> span S" "a \<noteq> 0" "\<And>x. x \<in> S \<Longrightarrow> 0 \<le> a \<bullet> x"
  6016   obtains a where "a \<in> span S" "a \<noteq> 0" "\<And>x. x \<in> S \<Longrightarrow> 0 \<le> a \<bullet> x"
  6017 proof -
  6017 proof -
  6018   define k where [abs_def]: "k c = {x. 0 \<le> c \<bullet> x}" for c :: 'a
  6018   define k where [abs_def]: "k c = {x. 0 \<le> c \<bullet> x}" for c :: 'a
  6099     using \<open>a \<in> span ((+) (- z) ` S)\<close> affine_hull_insert_span_gen apply blast
  6099     using \<open>a \<in> span ((+) (- z) ` S)\<close> affine_hull_insert_span_gen apply blast
  6100     apply (simp_all add: \<open>a \<noteq> 0\<close> szx)
  6100     apply (simp_all add: \<open>a \<noteq> 0\<close> szx)
  6101     done
  6101     done
  6102 qed
  6102 qed
  6103 
  6103 
  6104 proposition supporting_hyperplane_rel_boundary:
  6104 proposition%unimportant supporting_hyperplane_rel_boundary:
  6105   fixes S :: "'a::euclidean_space set"
  6105   fixes S :: "'a::euclidean_space set"
  6106   assumes "convex S" "x \<in> S" and xno: "x \<notin> rel_interior S"
  6106   assumes "convex S" "x \<in> S" and xno: "x \<notin> rel_interior S"
  6107   obtains a where "a \<noteq> 0"
  6107   obtains a where "a \<noteq> 0"
  6108               and "\<And>y. y \<in> S \<Longrightarrow> a \<bullet> x \<le> a \<bullet> y"
  6108               and "\<And>y. y \<in> S \<Longrightarrow> a \<bullet> x \<le> a \<bullet> y"
  6109               and "\<And>y. y \<in> rel_interior S \<Longrightarrow> a \<bullet> x < a \<bullet> y"
  6109               and "\<And>y. y \<in> rel_interior S \<Longrightarrow> a \<bullet> x < a \<bullet> y"
  6202     then show ?A ?C
  6202     then show ?A ?C
  6203       by (auto simp: convex_hull_finite affine_hull_finite)
  6203       by (auto simp: convex_hull_finite affine_hull_finite)
  6204 qed
  6204 qed
  6205 
  6205 
  6206 
  6206 
  6207 proposition affine_hull_Int:
  6207 proposition%unimportant affine_hull_Int:
  6208   fixes s :: "'a::euclidean_space set"
  6208   fixes s :: "'a::euclidean_space set"
  6209   assumes "\<not> affine_dependent(s \<union> t)"
  6209   assumes "\<not> affine_dependent(s \<union> t)"
  6210     shows "affine hull (s \<inter> t) = affine hull s \<inter> affine hull t"
  6210     shows "affine hull (s \<inter> t) = affine hull s \<inter> affine hull t"
  6211 apply (rule subset_antisym)
  6211 apply (rule subset_antisym)
  6212 apply (simp add: hull_mono)
  6212 apply (simp add: hull_mono)
  6213 by (simp add: affine_hull_Int_subset assms)
  6213 by (simp add: affine_hull_Int_subset assms)
  6214 
  6214 
  6215 proposition convex_hull_Int:
  6215 proposition%unimportant convex_hull_Int:
  6216   fixes s :: "'a::euclidean_space set"
  6216   fixes s :: "'a::euclidean_space set"
  6217   assumes "\<not> affine_dependent(s \<union> t)"
  6217   assumes "\<not> affine_dependent(s \<union> t)"
  6218     shows "convex hull (s \<inter> t) = convex hull s \<inter> convex hull t"
  6218     shows "convex hull (s \<inter> t) = convex hull s \<inter> convex hull t"
  6219 apply (rule subset_antisym)
  6219 apply (rule subset_antisym)
  6220 apply (simp add: hull_mono)
  6220 apply (simp add: hull_mono)
  6221 by (simp add: convex_hull_Int_subset assms)
  6221 by (simp add: convex_hull_Int_subset assms)
  6222 
  6222 
  6223 proposition
  6223 proposition%unimportant
  6224   fixes s :: "'a::euclidean_space set set"
  6224   fixes s :: "'a::euclidean_space set set"
  6225   assumes "\<not> affine_dependent (\<Union>s)"
  6225   assumes "\<not> affine_dependent (\<Union>s)"
  6226     shows affine_hull_Inter: "affine hull (\<Inter>s) = (\<Inter>t\<in>s. affine hull t)" (is "?A")
  6226     shows affine_hull_Inter: "affine hull (\<Inter>s) = (\<Inter>t\<in>s. affine hull t)" (is "?A")
  6227       and convex_hull_Inter: "convex hull (\<Inter>s) = (\<Inter>t\<in>s. convex hull t)" (is "?C")
  6227       and convex_hull_Inter: "convex hull (\<Inter>s) = (\<Inter>t\<in>s. convex hull t)" (is "?C")
  6228 proof -
  6228 proof -
  6248   qed
  6248   qed
  6249   then show "?A" "?C"
  6249   then show "?A" "?C"
  6250     by auto
  6250     by auto
  6251 qed
  6251 qed
  6252 
  6252 
  6253 proposition in_convex_hull_exchange_unique:
  6253 proposition%unimportant in_convex_hull_exchange_unique:
  6254   fixes S :: "'a::euclidean_space set"
  6254   fixes S :: "'a::euclidean_space set"
  6255   assumes naff: "\<not> affine_dependent S" and a: "a \<in> convex hull S"
  6255   assumes naff: "\<not> affine_dependent S" and a: "a \<in> convex hull S"
  6256       and S: "T \<subseteq> S" "T' \<subseteq> S"
  6256       and S: "T \<subseteq> S" "T' \<subseteq> S"
  6257       and x:  "x \<in> convex hull (insert a T)"
  6257       and x:  "x \<in> convex hull (insert a T)"
  6258       and x': "x \<in> convex hull (insert a T')"
  6258       and x': "x \<in> convex hull (insert a T')"
  6396         by simp
  6396         by simp
  6397     qed
  6397     qed
  6398   qed
  6398   qed
  6399 qed
  6399 qed
  6400 
  6400 
  6401 corollary convex_hull_exchange_Int:
  6401 corollary%unimportant convex_hull_exchange_Int:
  6402   fixes a  :: "'a::euclidean_space"
  6402   fixes a  :: "'a::euclidean_space"
  6403   assumes "\<not> affine_dependent S" "a \<in> convex hull S" "T \<subseteq> S" "T' \<subseteq> S"
  6403   assumes "\<not> affine_dependent S" "a \<in> convex hull S" "T \<subseteq> S" "T' \<subseteq> S"
  6404   shows "(convex hull (insert a T)) \<inter> (convex hull (insert a T')) =
  6404   shows "(convex hull (insert a T)) \<inter> (convex hull (insert a T')) =
  6405          convex hull (insert a (T \<inter> T'))"
  6405          convex hull (insert a (T \<inter> T'))"
  6406 apply (rule subset_antisym)
  6406 apply (rule subset_antisym)
  6549     done
  6549     done
  6550   ultimately show ?thesis
  6550   ultimately show ?thesis
  6551     by (simp add: subs) (metis (lifting) span_eq_iff subs)
  6551     by (simp add: subs) (metis (lifting) span_eq_iff subs)
  6552 qed
  6552 qed
  6553 
  6553 
  6554 proposition affine_hyperplane_sums_eq_UNIV:
  6554 proposition%unimportant affine_hyperplane_sums_eq_UNIV:
  6555   fixes S :: "'a :: euclidean_space set"
  6555   fixes S :: "'a :: euclidean_space set"
  6556   assumes "affine S"
  6556   assumes "affine S"
  6557       and "S \<inter> {v. a \<bullet> v = b} \<noteq> {}"
  6557       and "S \<inter> {v. a \<bullet> v = b} \<noteq> {}"
  6558       and "S - {v. a \<bullet> v = b} \<noteq> {}"
  6558       and "S - {v. a \<bullet> v = b} \<noteq> {}"
  6559     shows "{x + y| x y. x \<in> S \<and> a \<bullet> y = b} = UNIV"
  6559     shows "{x + y| x y. x \<in> S \<and> a \<bullet> y = b} = UNIV"
  6784     using assms pairwise_orthogonal_imp_finite by auto
  6784     using assms pairwise_orthogonal_imp_finite by auto
  6785   with \<open>span B = span T\<close> show ?thesis
  6785   with \<open>span B = span T\<close> show ?thesis
  6786     by (rule_tac U=U in that) (auto simp: span_Un)
  6786     by (rule_tac U=U in that) (auto simp: span_Un)
  6787 qed
  6787 qed
  6788 
  6788 
  6789 corollary orthogonal_extension_strong:
  6789 corollary%unimportant orthogonal_extension_strong:
  6790   fixes S :: "'a::euclidean_space set"
  6790   fixes S :: "'a::euclidean_space set"
  6791   assumes S: "pairwise orthogonal S"
  6791   assumes S: "pairwise orthogonal S"
  6792   obtains U where "U \<inter> (insert 0 S) = {}" "pairwise orthogonal (S \<union> U)"
  6792   obtains U where "U \<inter> (insert 0 S) = {}" "pairwise orthogonal (S \<union> U)"
  6793                   "span (S \<union> U) = span (S \<union> T)"
  6793                   "span (S \<union> U) = span (S \<union> T)"
  6794 proof -
  6794 proof -
  6867   show ?thesis
  6867   show ?thesis
  6868     by (rule that [OF 1 2 3 4 5 6])
  6868     by (rule that [OF 1 2 3 4 5 6])
  6869 qed
  6869 qed
  6870 
  6870 
  6871 
  6871 
  6872 proposition orthogonal_to_subspace_exists_gen:
  6872 proposition%unimportant orthogonal_to_subspace_exists_gen:
  6873   fixes S :: "'a :: euclidean_space set"
  6873   fixes S :: "'a :: euclidean_space set"
  6874   assumes "span S \<subset> span T"
  6874   assumes "span S \<subset> span T"
  6875   obtains x where "x \<noteq> 0" "x \<in> span T" "\<And>y. y \<in> span S \<Longrightarrow> orthogonal x y"
  6875   obtains x where "x \<noteq> 0" "x \<in> span T" "\<And>y. y \<in> span S \<Longrightarrow> orthogonal x y"
  6876 proof -
  6876 proof -
  6877   obtain B where "B \<subseteq> span S" and orthB: "pairwise orthogonal B"
  6877   obtain B where "B \<subseteq> span S" and orthB: "pairwise orthogonal B"
  6913     ultimately show ?thesis
  6913     ultimately show ?thesis
  6914       using \<open>x \<noteq> 0\<close> that \<open>span B = span S\<close> by auto
  6914       using \<open>x \<noteq> 0\<close> that \<open>span B = span S\<close> by auto
  6915   qed
  6915   qed
  6916 qed
  6916 qed
  6917 
  6917 
  6918 corollary orthogonal_to_subspace_exists:
  6918 corollary%unimportant orthogonal_to_subspace_exists:
  6919   fixes S :: "'a :: euclidean_space set"
  6919   fixes S :: "'a :: euclidean_space set"
  6920   assumes "dim S < DIM('a)"
  6920   assumes "dim S < DIM('a)"
  6921   obtains x where "x \<noteq> 0" "\<And>y. y \<in> span S \<Longrightarrow> orthogonal x y"
  6921   obtains x where "x \<noteq> 0" "\<And>y. y \<in> span S \<Longrightarrow> orthogonal x y"
  6922 proof -
  6922 proof -
  6923 have "span S \<subset> UNIV"
  6923 have "span S \<subset> UNIV"
  6925       mem_Collect_eq top.extremum_strict top.not_eq_extremum)
  6925       mem_Collect_eq top.extremum_strict top.not_eq_extremum)
  6926   with orthogonal_to_subspace_exists_gen [of S UNIV] that show ?thesis
  6926   with orthogonal_to_subspace_exists_gen [of S UNIV] that show ?thesis
  6927     by (auto simp: span_UNIV)
  6927     by (auto simp: span_UNIV)
  6928 qed
  6928 qed
  6929 
  6929 
  6930 corollary orthogonal_to_vector_exists:
  6930 corollary%unimportant orthogonal_to_vector_exists:
  6931   fixes x :: "'a :: euclidean_space"
  6931   fixes x :: "'a :: euclidean_space"
  6932   assumes "2 \<le> DIM('a)"
  6932   assumes "2 \<le> DIM('a)"
  6933   obtains y where "y \<noteq> 0" "orthogonal x y"
  6933   obtains y where "y \<noteq> 0" "orthogonal x y"
  6934 proof -
  6934 proof -
  6935   have "dim {x} < DIM('a)"
  6935   have "dim {x} < DIM('a)"
  6936     using assms by auto
  6936     using assms by auto
  6937   then show thesis
  6937   then show thesis
  6938     by (rule orthogonal_to_subspace_exists) (simp add: orthogonal_commute span_base that)
  6938     by (rule orthogonal_to_subspace_exists) (simp add: orthogonal_commute span_base that)
  6939 qed
  6939 qed
  6940 
  6940 
  6941 proposition orthogonal_subspace_decomp_exists:
  6941 proposition%unimportant orthogonal_subspace_decomp_exists:
  6942   fixes S :: "'a :: euclidean_space set"
  6942   fixes S :: "'a :: euclidean_space set"
  6943   obtains y z where "y \<in> span S" "\<And>w. w \<in> span S \<Longrightarrow> orthogonal z w" "x = y + z"
  6943   obtains y z
       
  6944   where "y \<in> span S"
       
  6945     and "\<And>w. w \<in> span S \<Longrightarrow> orthogonal z w"
       
  6946     and "x = y + z"
  6944 proof -
  6947 proof -
  6945   obtain T where "0 \<notin> T" "T \<subseteq> span S" "pairwise orthogonal T" "independent T"
  6948   obtain T where "0 \<notin> T" "T \<subseteq> span S" "pairwise orthogonal T" "independent T"
  6946     "card T = dim (span S)" "span T = span S"
  6949     "card T = dim (span S)" "span T = span S"
  6947     using orthogonal_basis_subspace subspace_span by blast
  6950     using orthogonal_basis_subspace subspace_span by blast
  6948   let ?a = "\<Sum>b\<in>T. (b \<bullet> x / (b \<bullet> b)) *\<^sub>R b"
  6951   let ?a = "\<Sum>b\<in>T. (b \<bullet> x / (b \<bullet> b)) *\<^sub>R b"
  7221     by (metis dim_less dim_subset inf.cobounded2 inf.orderE inf.strict_boundedE not_le)
  7224     by (metis dim_less dim_subset inf.cobounded2 inf.orderE inf.strict_boundedE not_le)
  7222   ultimately show ?thesis
  7225   ultimately show ?thesis
  7223     by force
  7226     by force
  7224 qed
  7227 qed
  7225 
  7228 
  7226 corollary dense_complement_affine:
  7229 corollary%unimportant dense_complement_affine:
  7227   fixes S :: "'a :: euclidean_space set"
  7230   fixes S :: "'a :: euclidean_space set"
  7228   assumes less: "aff_dim T < aff_dim S" and "affine S" shows "closure(S - T) = S"
  7231   assumes less: "aff_dim T < aff_dim S" and "affine S" shows "closure(S - T) = S"
  7229 proof (cases "S \<inter> T = {}")
  7232 proof (cases "S \<inter> T = {}")
  7230   case True
  7233   case True
  7231   then show ?thesis
  7234   then show ?thesis
  7241     by (simp add: dense_complement_subspace)
  7244     by (simp add: dense_complement_subspace)
  7242   then show ?thesis
  7245   then show ?thesis
  7243     by (metis closure_translation translation_diff translation_invert)
  7246     by (metis closure_translation translation_diff translation_invert)
  7244 qed
  7247 qed
  7245 
  7248 
  7246 corollary dense_complement_openin_affine_hull:
  7249 corollary%unimportant dense_complement_openin_affine_hull:
  7247   fixes S :: "'a :: euclidean_space set"
  7250   fixes S :: "'a :: euclidean_space set"
  7248   assumes less: "aff_dim T < aff_dim S"
  7251   assumes less: "aff_dim T < aff_dim S"
  7249       and ope: "openin (subtopology euclidean (affine hull S)) S"
  7252       and ope: "openin (subtopology euclidean (affine hull S)) S"
  7250     shows "closure(S - T) = closure S"
  7253     shows "closure(S - T) = closure S"
  7251 proof -
  7254 proof -
  7255     by (rule closure_openin_Int_closure [OF ope])
  7258     by (rule closure_openin_Int_closure [OF ope])
  7256   then show ?thesis
  7259   then show ?thesis
  7257     by (metis Int_Diff aff_dim_affine_hull affine_affine_hull dense_complement_affine hull_subset inf.orderE less)
  7260     by (metis Int_Diff aff_dim_affine_hull affine_affine_hull dense_complement_affine hull_subset inf.orderE less)
  7258 qed
  7261 qed
  7259 
  7262 
  7260 corollary dense_complement_convex:
  7263 corollary%unimportant dense_complement_convex:
  7261   fixes S :: "'a :: euclidean_space set"
  7264   fixes S :: "'a :: euclidean_space set"
  7262   assumes "aff_dim T < aff_dim S" "convex S"
  7265   assumes "aff_dim T < aff_dim S" "convex S"
  7263     shows "closure(S - T) = closure S"
  7266     shows "closure(S - T) = closure S"
  7264 proof
  7267 proof
  7265   show "closure (S - T) \<subseteq> closure S"
  7268   show "closure (S - T) \<subseteq> closure S"
  7270     using \<open>convex S\<close> rel_interior_rel_open rel_open by blast
  7273     using \<open>convex S\<close> rel_interior_rel_open rel_open by blast
  7271   then show "closure S \<subseteq> closure (S - T)"
  7274   then show "closure S \<subseteq> closure (S - T)"
  7272     by (metis Diff_mono \<open>convex S\<close> closure_mono convex_closure_rel_interior order_refl rel_interior_subset)
  7275     by (metis Diff_mono \<open>convex S\<close> closure_mono convex_closure_rel_interior order_refl rel_interior_subset)
  7273 qed
  7276 qed
  7274 
  7277 
  7275 corollary dense_complement_convex_closed:
  7278 corollary%unimportant dense_complement_convex_closed:
  7276   fixes S :: "'a :: euclidean_space set"
  7279   fixes S :: "'a :: euclidean_space set"
  7277   assumes "aff_dim T < aff_dim S" "convex S" "closed S"
  7280   assumes "aff_dim T < aff_dim S" "convex S" "closed S"
  7278     shows "closure(S - T) = S"
  7281     shows "closure(S - T) = S"
  7279   by (simp add: assms dense_complement_convex)
  7282   by (simp add: assms dense_complement_convex)
  7280 
  7283 
  7282 subsection%unimportant\<open>Parallel slices, etc\<close>
  7285 subsection%unimportant\<open>Parallel slices, etc\<close>
  7283 
  7286 
  7284 text\<open> If we take a slice out of a set, we can do it perpendicularly,
  7287 text\<open> If we take a slice out of a set, we can do it perpendicularly,
  7285   with the normal vector to the slice parallel to the affine hull.\<close>
  7288   with the normal vector to the slice parallel to the affine hull.\<close>
  7286 
  7289 
  7287 proposition affine_parallel_slice:
  7290 proposition%unimportant affine_parallel_slice:
  7288   fixes S :: "'a :: euclidean_space set"
  7291   fixes S :: "'a :: euclidean_space set"
  7289   assumes "affine S"
  7292   assumes "affine S"
  7290       and "S \<inter> {x. a \<bullet> x \<le> b} \<noteq> {}"
  7293       and "S \<inter> {x. a \<bullet> x \<le> b} \<noteq> {}"
  7291       and "\<not> (S \<subseteq> {x. a \<bullet> x \<le> b})"
  7294       and "\<not> (S \<subseteq> {x. a \<bullet> x \<le> b})"
  7292   obtains a' b' where "a' \<noteq> 0"
  7295   obtains a' b' where "a' \<noteq> 0"
  7466     by (simp add: aff_dim_subspace Tdim \<open>0 \<le> d\<close> \<open>subspace T\<close> aff_dim_translation_eq)
  7469     by (simp add: aff_dim_subspace Tdim \<open>0 \<le> d\<close> \<open>subspace T\<close> aff_dim_translation_eq)
  7467   ultimately show ?thesis
  7470   ultimately show ?thesis
  7468     by (rule that)
  7471     by (rule that)
  7469 qed
  7472 qed
  7470 
  7473 
  7471 subsection\<open>Several Variants of Paracompactness\<close>
  7474 subsection\<open>Paracompactness\<close>
  7472 
  7475 
  7473 proposition paracompact:
  7476 proposition paracompact:
  7474   fixes S :: "'a :: euclidean_space set"
  7477   fixes S :: "'a :: euclidean_space set"
  7475   assumes "S \<subseteq> \<Union>\<C>" and opC: "\<And>T. T \<in> \<C> \<Longrightarrow> open T"
  7478   assumes "S \<subseteq> \<Union>\<C>" and opC: "\<And>T. T \<in> \<C> \<Longrightarrow> open T"
  7476   obtains \<C>' where "S \<subseteq> \<Union> \<C>'"
  7479   obtains \<C>' where "S \<subseteq> \<Union> \<C>'"
  7600       apply (auto intro: that finite_subset [OF *])
  7603       apply (auto intro: that finite_subset [OF *])
  7601       done
  7604       done
  7602     qed
  7605     qed
  7603 qed
  7606 qed
  7604 
  7607 
  7605 corollary paracompact_closed:
  7608 corollary%unimportant paracompact_closed:
  7606   fixes S :: "'a :: euclidean_space set"
  7609   fixes S :: "'a :: euclidean_space set"
  7607   assumes "closed S"
  7610   assumes "closed S"
  7608       and opC: "\<And>T. T \<in> \<C> \<Longrightarrow> open T"
  7611       and opC: "\<And>T. T \<in> \<C> \<Longrightarrow> open T"
  7609       and "S \<subseteq> \<Union>\<C>"
  7612       and "S \<subseteq> \<Union>\<C>"
  7610   obtains \<C>' where "S \<subseteq> \<Union>\<C>'"
  7613   obtains \<C>' where "S \<subseteq> \<Union>\<C>'"
  7685     by (rule continuous_on_Un_local_open [OF opS opT])
  7688     by (rule continuous_on_Un_local_open [OF opS opT])
  7686 qed
  7689 qed
  7687   
  7690   
  7688 subsection%unimportant\<open>The union of two collinear segments is another segment\<close>
  7691 subsection%unimportant\<open>The union of two collinear segments is another segment\<close>
  7689 
  7692 
  7690 proposition in_convex_hull_exchange:
  7693 proposition%unimportant in_convex_hull_exchange:
  7691   fixes a :: "'a::euclidean_space"
  7694   fixes a :: "'a::euclidean_space"
  7692   assumes a: "a \<in> convex hull S" and xS: "x \<in> convex hull S"
  7695   assumes a: "a \<in> convex hull S" and xS: "x \<in> convex hull S"
  7693   obtains b where "b \<in> S" "x \<in> convex hull (insert a (S - {b}))"
  7696   obtains b where "b \<in> S" "x \<in> convex hull (insert a (S - {b}))"
  7694 proof (cases "a \<in> S")
  7697 proof (cases "a \<in> S")
  7695   case True
  7698   case True
  7962 qed
  7965 qed
  7963 
  7966 
  7964 
  7967 
  7965 subsection\<open>Orthogonal complement\<close>
  7968 subsection\<open>Orthogonal complement\<close>
  7966 
  7969 
  7967 definition orthogonal_comp ("_\<^sup>\<bottom>" [80] 80)
  7970 definition%important orthogonal_comp ("_\<^sup>\<bottom>" [80] 80)
  7968   where "orthogonal_comp W \<equiv> {x. \<forall>y \<in> W. orthogonal y x}"
  7971   where "orthogonal_comp W \<equiv> {x. \<forall>y \<in> W. orthogonal y x}"
  7969 
  7972 
  7970 lemma subspace_orthogonal_comp: "subspace (W\<^sup>\<bottom>)"
  7973 proposition subspace_orthogonal_comp: "subspace (W\<^sup>\<bottom>)"
  7971   unfolding subspace_def orthogonal_comp_def orthogonal_def
  7974   unfolding subspace_def orthogonal_comp_def orthogonal_def
  7972   by (auto simp: inner_right_distrib)
  7975   by (auto simp: inner_right_distrib)
  7973 
  7976 
  7974 lemma orthogonal_comp_anti_mono:
  7977 lemma orthogonal_comp_anti_mono:
  7975   assumes "A \<subseteq> B"
  7978   assumes "A \<subseteq> B"
  8000     by (meson set_plus_elim)
  8003     by (meson set_plus_elim)
  8001   then show "x \<in> U"
  8004   then show "x \<in> U"
  8002     by (meson assms subsetCE subspace_add)
  8005     by (meson assms subsetCE subspace_add)
  8003 qed
  8006 qed
  8004 
  8007 
  8005 lemma subspace_sum_orthogonal_comp:
  8008 proposition subspace_sum_orthogonal_comp:
  8006   fixes U :: "'a :: euclidean_space set"
  8009   fixes U :: "'a :: euclidean_space set"
  8007   assumes "subspace U"
  8010   assumes "subspace U"
  8008   shows "U + U\<^sup>\<bottom> = UNIV"
  8011   shows "U + U\<^sup>\<bottom> = UNIV"
  8009 proof -
  8012 proof -
  8010   obtain B where "B \<subseteq> U"
  8013   obtain B where "B \<subseteq> U"
  8078   shows "f -` {0} =  (range (adjoint f))\<^sup>\<bottom>"
  8081   shows "f -` {0} =  (range (adjoint f))\<^sup>\<bottom>"
  8079   apply (auto simp: orthogonal_comp_def orthogonal_def)
  8082   apply (auto simp: orthogonal_comp_def orthogonal_def)
  8080   apply (simp add: adjoint_works assms(1) inner_commute)
  8083   apply (simp add: adjoint_works assms(1) inner_commute)
  8081   by (metis adjoint_works all_zero_iff assms(1) inner_commute)
  8084   by (metis adjoint_works all_zero_iff assms(1) inner_commute)
  8082 
  8085 
  8083 subsection\<open> A non-injective linear function maps into a hyperplane.\<close>
  8086 subsection%unimportant \<open>A non-injective linear function maps into a hyperplane.\<close>
  8084 
  8087 
  8085 lemma linear_surj_adj_imp_inj:
  8088 lemma linear_surj_adj_imp_inj:
  8086   fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space"
  8089   fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space"
  8087   assumes "linear f" "surj (adjoint f)"
  8090   assumes "linear f" "surj (adjoint f)"
  8088   shows "inj f"
  8091   shows "inj f"
  8137     using \<open>surj f\<close> adjoint_adjoint adjoint_linear assms ker_orthogonal_comp_adjoint by force
  8140     using \<open>surj f\<close> adjoint_adjoint adjoint_linear assms ker_orthogonal_comp_adjoint by force
  8138   then show "inj (adjoint f)"
  8141   then show "inj (adjoint f)"
  8139     by (simp add: \<open>surj f\<close> adjoint_adjoint adjoint_linear assms linear_surj_adj_imp_inj)
  8142     by (simp add: \<open>surj f\<close> adjoint_adjoint adjoint_linear assms linear_surj_adj_imp_inj)
  8140 qed
  8143 qed
  8141 
  8144 
  8142 proposition linear_singular_into_hyperplane:
  8145 lemma linear_singular_into_hyperplane:
  8143   fixes f :: "'n::euclidean_space \<Rightarrow> 'n"
  8146   fixes f :: "'n::euclidean_space \<Rightarrow> 'n"
  8144   assumes "linear f"
  8147   assumes "linear f"
  8145   shows "\<not> inj f \<longleftrightarrow> (\<exists>a. a \<noteq> 0 \<and> (\<forall>x. a \<bullet> f x = 0))" (is "_ = ?rhs")
  8148   shows "\<not> inj f \<longleftrightarrow> (\<exists>a. a \<noteq> 0 \<and> (\<forall>x. a \<bullet> f x = 0))" (is "_ = ?rhs")
  8146 proof
  8149 proof
  8147   assume "\<not>inj f"
  8150   assume "\<not>inj f"