9 Topology_Euclidean_Space |
9 Topology_Euclidean_Space |
10 "~~/src/HOL/Library/Convex" |
10 "~~/src/HOL/Library/Convex" |
11 "~~/src/HOL/Library/Set_Algebras" |
11 "~~/src/HOL/Library/Set_Algebras" |
12 begin |
12 begin |
13 |
13 |
14 lemma independent_injective_on_span_image: |
|
15 assumes iS: "independent S" |
|
16 and lf: "linear f" |
|
17 and fi: "inj_on f (span S)" |
|
18 shows "independent (f ` S)" |
|
19 proof - |
|
20 { |
|
21 fix a |
|
22 assume a: "a \<in> S" "f a \<in> span (f ` S - {f a})" |
|
23 have eq: "f ` S - {f a} = f ` (S - {a})" |
|
24 using fi a span_inc by (auto simp add: inj_on_def) |
|
25 from a have "f a \<in> f ` span (S -{a})" |
|
26 unfolding eq span_linear_image [OF lf, of "S - {a}"] by blast |
|
27 moreover have "span (S - {a}) \<subseteq> span S" |
|
28 using span_mono[of "S - {a}" S] by auto |
|
29 ultimately have "a \<in> span (S - {a})" |
|
30 using fi a span_inc by (auto simp add: inj_on_def) |
|
31 with a(1) iS have False |
|
32 by (simp add: dependent_def) |
|
33 } |
|
34 then show ?thesis |
|
35 unfolding dependent_def by blast |
|
36 qed |
|
37 |
|
38 lemma dim_image_eq: |
14 lemma dim_image_eq: |
39 fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space" |
15 fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space" |
40 assumes lf: "linear f" |
16 assumes lf: "linear f" |
41 and fi: "inj_on f (span S)" |
17 and fi: "inj_on f (span S)" |
42 shows "dim (f ` S) = dim (S::'n::euclidean_space set)" |
18 shows "dim (f ` S) = dim (S::'n::euclidean_space set)" |
44 obtain B where B: "B \<subseteq> S" "independent B" "S \<subseteq> span B" "card B = dim S" |
20 obtain B where B: "B \<subseteq> S" "independent B" "S \<subseteq> span B" "card B = dim S" |
45 using basis_exists[of S] by auto |
21 using basis_exists[of S] by auto |
46 then have "span S = span B" |
22 then have "span S = span B" |
47 using span_mono[of B S] span_mono[of S "span B"] span_span[of B] by auto |
23 using span_mono[of B S] span_mono[of S "span B"] span_span[of B] by auto |
48 then have "independent (f ` B)" |
24 then have "independent (f ` B)" |
49 using independent_injective_on_span_image[of B f] B assms by auto |
25 using independent_inj_on_image[of B f] B assms by auto |
50 moreover have "card (f ` B) = card B" |
26 moreover have "card (f ` B) = card B" |
51 using assms card_image[of f B] subset_inj_on[of f "span S" B] B span_inc by auto |
27 using assms card_image[of f B] subset_inj_on[of f "span S" B] B span_inc by auto |
52 moreover have "(f ` B) \<subseteq> (f ` S)" |
28 moreover have "(f ` B) \<subseteq> (f ` S)" |
53 using B by auto |
29 using B by auto |
54 ultimately have "dim (f ` S) \<ge> dim S" |
30 ultimately have "dim (f ` S) \<ge> dim S" |
7501 using assms(1,4-5) \<open>y\<in>s\<close> |
7477 using assms(1,4-5) \<open>y\<in>s\<close> |
7502 apply auto |
7478 apply auto |
7503 done |
7479 done |
7504 qed |
7480 qed |
7505 |
7481 |
|
7482 lemma in_interior_closure_convex_segment: |
|
7483 fixes S :: "'a::euclidean_space set" |
|
7484 assumes "convex S" and a: "a \<in> interior S" and b: "b \<in> closure S" |
|
7485 shows "open_segment a b \<subseteq> interior S" |
|
7486 proof (clarsimp simp: in_segment) |
|
7487 fix u::real |
|
7488 assume u: "0 < u" "u < 1" |
|
7489 have "(1 - u) *\<^sub>R a + u *\<^sub>R b = b - (1 - u) *\<^sub>R (b - a)" |
|
7490 by (simp add: algebra_simps) |
|
7491 also have "... \<in> interior S" using mem_interior_closure_convex_shrink [OF assms] u |
|
7492 by simp |
|
7493 finally show "(1 - u) *\<^sub>R a + u *\<^sub>R b \<in> interior S" . |
|
7494 qed |
|
7495 |
7506 |
7496 |
7507 subsection \<open>Some obvious but surprisingly hard simplex lemmas\<close> |
7497 subsection \<open>Some obvious but surprisingly hard simplex lemmas\<close> |
7508 |
7498 |
7509 lemma simplex: |
7499 lemma simplex: |
7510 assumes "finite s" |
7500 assumes "finite s" |
7514 unfolding convex_hull_finite[OF finite.insertI[OF assms(1)]] |
7504 unfolding convex_hull_finite[OF finite.insertI[OF assms(1)]] |
7515 apply (rule set_eqI, rule) |
7505 apply (rule set_eqI, rule) |
7516 unfolding mem_Collect_eq |
7506 unfolding mem_Collect_eq |
7517 apply (erule_tac[!] exE) |
7507 apply (erule_tac[!] exE) |
7518 apply (erule_tac[!] conjE)+ |
7508 apply (erule_tac[!] conjE)+ |
7519 unfolding setsum_clauses(2)[OF assms(1)] |
7509 unfolding setsum_clauses(2)[OF \<open>finite s\<close>] |
7520 apply (rule_tac x=u in exI) |
7510 apply (rule_tac x=u in exI) |
7521 defer |
7511 defer |
7522 apply (rule_tac x="\<lambda>x. if x = 0 then 1 - setsum u s else u x" in exI) |
7512 apply (rule_tac x="\<lambda>x. if x = 0 then 1 - setsum u s else u x" in exI) |
7523 using assms(2) |
7513 using assms(2) |
7524 unfolding if_smult and setsum_delta_notmem[OF assms(2)] |
7514 unfolding if_smult and setsum_delta_notmem[OF assms(2)] |
8703 then have "y \<in> \<Inter>I" by auto |
8693 then have "y \<in> \<Inter>I" by auto |
8704 } |
8694 } |
8705 then show ?thesis by auto |
8695 then show ?thesis by auto |
8706 qed |
8696 qed |
8707 |
8697 |
8708 lemma closure_inter: "closure (\<Inter>I) \<le> \<Inter>{closure S |S. S \<in> I}" |
8698 lemma closure_Int: "closure (\<Inter>I) \<le> \<Inter>{closure S |S. S \<in> I}" |
8709 proof - |
8699 proof - |
8710 { |
8700 { |
8711 fix y |
8701 fix y |
8712 assume "y \<in> \<Inter>I" |
8702 assume "y \<in> \<Inter>I" |
8713 then have y: "\<forall>S \<in> I. y \<in> S" by auto |
8703 then have y: "\<forall>S \<in> I. y \<in> S" by auto |
8791 moreover |
8781 moreover |
8792 have "closure (\<Inter>{rel_interior S |S. S \<in> I}) \<le> closure (\<Inter>I)" |
8782 have "closure (\<Inter>{rel_interior S |S. S \<in> I}) \<le> closure (\<Inter>I)" |
8793 using rel_interior_inter_aux closure_mono[of "\<Inter>{rel_interior S |S. S \<in> I}" "\<Inter>I"] |
8783 using rel_interior_inter_aux closure_mono[of "\<Inter>{rel_interior S |S. S \<in> I}" "\<Inter>I"] |
8794 by auto |
8784 by auto |
8795 ultimately show ?thesis |
8785 ultimately show ?thesis |
8796 using closure_inter[of I] by auto |
8786 using closure_Int[of I] by auto |
8797 qed |
8787 qed |
8798 |
8788 |
8799 lemma convex_inter_rel_interior_same_closure: |
8789 lemma convex_inter_rel_interior_same_closure: |
8800 assumes "\<forall>S\<in>I. convex (S :: 'n::euclidean_space set)" |
8790 assumes "\<forall>S\<in>I. convex (S :: 'n::euclidean_space set)" |
8801 and "\<Inter>{rel_interior S |S. S \<in> I} \<noteq> {}" |
8791 and "\<Inter>{rel_interior S |S. S \<in> I} \<noteq> {}" |
8806 moreover |
8796 moreover |
8807 have "closure (\<Inter>{rel_interior S |S. S \<in> I}) \<le> closure (\<Inter>I)" |
8797 have "closure (\<Inter>{rel_interior S |S. S \<in> I}) \<le> closure (\<Inter>I)" |
8808 using rel_interior_inter_aux closure_mono[of "\<Inter>{rel_interior S |S. S \<in> I}" "\<Inter>I"] |
8798 using rel_interior_inter_aux closure_mono[of "\<Inter>{rel_interior S |S. S \<in> I}" "\<Inter>I"] |
8809 by auto |
8799 by auto |
8810 ultimately show ?thesis |
8800 ultimately show ?thesis |
8811 using closure_inter[of I] by auto |
8801 using closure_Int[of I] by auto |
8812 qed |
8802 qed |
8813 |
8803 |
8814 lemma convex_rel_interior_inter: |
8804 lemma convex_rel_interior_inter: |
8815 assumes "\<forall>S\<in>I. convex (S :: 'n::euclidean_space set)" |
8805 assumes "\<forall>S\<in>I. convex (S :: 'n::euclidean_space set)" |
8816 and "\<Inter>{rel_interior S |S. S \<in> I} \<noteq> {}" |
8806 and "\<Inter>{rel_interior S |S. S \<in> I} \<noteq> {}" |
8896 and "convex T" |
8886 and "convex T" |
8897 and "rel_interior S \<inter> rel_interior T \<noteq> {}" |
8887 and "rel_interior S \<inter> rel_interior T \<noteq> {}" |
8898 shows "rel_interior (S \<inter> T) = rel_interior S \<inter> rel_interior T" |
8888 shows "rel_interior (S \<inter> T) = rel_interior S \<inter> rel_interior T" |
8899 using convex_rel_interior_finite_inter[of "{S,T}"] assms by auto |
8889 using convex_rel_interior_finite_inter[of "{S,T}"] assms by auto |
8900 |
8890 |
8901 lemma convex_affine_closure_inter: |
8891 lemma convex_affine_closure_Int: |
8902 fixes S T :: "'n::euclidean_space set" |
8892 fixes S T :: "'n::euclidean_space set" |
8903 assumes "convex S" |
8893 assumes "convex S" |
8904 and "affine T" |
8894 and "affine T" |
8905 and "rel_interior S \<inter> T \<noteq> {}" |
8895 and "rel_interior S \<inter> T \<noteq> {}" |
8906 shows "closure (S \<inter> T) = closure S \<inter> T" |
8896 shows "closure (S \<inter> T) = closure S \<inter> T" |
8926 lemma connected_component_1: |
8916 lemma connected_component_1: |
8927 fixes S :: "real set" |
8917 fixes S :: "real set" |
8928 shows "connected_component S a b \<longleftrightarrow> closed_segment a b \<subseteq> S" |
8918 shows "connected_component S a b \<longleftrightarrow> closed_segment a b \<subseteq> S" |
8929 by (simp add: connected_component_1_gen) |
8919 by (simp add: connected_component_1_gen) |
8930 |
8920 |
8931 lemma convex_affine_rel_interior_inter: |
8921 lemma convex_affine_rel_interior_Int: |
8932 fixes S T :: "'n::euclidean_space set" |
8922 fixes S T :: "'n::euclidean_space set" |
8933 assumes "convex S" |
8923 assumes "convex S" |
8934 and "affine T" |
8924 and "affine T" |
8935 and "rel_interior S \<inter> T \<noteq> {}" |
8925 and "rel_interior S \<inter> T \<noteq> {}" |
8936 shows "rel_interior (S \<inter> T) = rel_interior S \<inter> T" |
8926 shows "rel_interior (S \<inter> T) = rel_interior S \<inter> T" |
8942 moreover have "closure T = T" |
8932 moreover have "closure T = T" |
8943 using assms affine_closed[of T] by auto |
8933 using assms affine_closed[of T] by auto |
8944 ultimately show ?thesis |
8934 ultimately show ?thesis |
8945 using convex_rel_interior_inter_two[of S T] assms affine_imp_convex by auto |
8935 using convex_rel_interior_inter_two[of S T] assms affine_imp_convex by auto |
8946 qed |
8936 qed |
|
8937 |
|
8938 lemma convex_affine_rel_frontier_Int: |
|
8939 fixes S T :: "'n::euclidean_space set" |
|
8940 assumes "convex S" |
|
8941 and "affine T" |
|
8942 and "interior S \<inter> T \<noteq> {}" |
|
8943 shows "rel_frontier(S \<inter> T) = frontier S \<inter> T" |
|
8944 using assms |
|
8945 apply (simp add: rel_frontier_def convex_affine_closure_Int frontier_def) |
|
8946 by (metis Diff_Int_distrib2 Int_emptyI convex_affine_closure_Int convex_affine_rel_interior_Int empty_iff interior_rel_interior_gen) |
8947 |
8947 |
8948 lemma subset_rel_interior_convex: |
8948 lemma subset_rel_interior_convex: |
8949 fixes S T :: "'n::euclidean_space set" |
8949 fixes S T :: "'n::euclidean_space set" |
8950 assumes "convex S" |
8950 assumes "convex S" |
8951 and "convex T" |
8951 and "convex T" |
9085 convex_rel_interior_iff[of "S \<inter> (range f)" "f z"] |
9085 convex_rel_interior_iff[of "S \<inter> (range f)" "f z"] |
9086 by auto |
9086 by auto |
9087 moreover have "affine (range f)" |
9087 moreover have "affine (range f)" |
9088 by (metis assms(1) subspace_UNIV subspace_imp_affine subspace_linear_image) |
9088 by (metis assms(1) subspace_UNIV subspace_imp_affine subspace_linear_image) |
9089 ultimately have "f z \<in> rel_interior S" |
9089 ultimately have "f z \<in> rel_interior S" |
9090 using convex_affine_rel_interior_inter[of S "range f"] assms by auto |
9090 using convex_affine_rel_interior_Int[of S "range f"] assms by auto |
9091 then have "z \<in> f -` (rel_interior S)" |
9091 then have "z \<in> f -` (rel_interior S)" |
9092 by auto |
9092 by auto |
9093 } |
9093 } |
9094 ultimately show ?thesis by auto |
9094 ultimately show ?thesis by auto |
9095 qed |
9095 qed |
9248 then have *: "rel_interior S \<inter> fst -` {y} \<noteq> {}" |
9248 then have *: "rel_interior S \<inter> fst -` {y} \<noteq> {}" |
9249 by auto |
9249 by auto |
9250 moreover have aff: "affine (fst -` {y})" |
9250 moreover have aff: "affine (fst -` {y})" |
9251 unfolding affine_alt by (simp add: algebra_simps) |
9251 unfolding affine_alt by (simp add: algebra_simps) |
9252 ultimately have **: "rel_interior (S \<inter> fst -` {y}) = rel_interior S \<inter> fst -` {y}" |
9252 ultimately have **: "rel_interior (S \<inter> fst -` {y}) = rel_interior S \<inter> fst -` {y}" |
9253 using convex_affine_rel_interior_inter[of S "fst -` {y}"] assms by auto |
9253 using convex_affine_rel_interior_Int[of S "fst -` {y}"] assms by auto |
9254 have conv: "convex (S \<inter> fst -` {y})" |
9254 have conv: "convex (S \<inter> fst -` {y})" |
9255 using convex_Int assms aff affine_imp_convex by auto |
9255 using convex_Int assms aff affine_imp_convex by auto |
9256 { |
9256 { |
9257 fix x |
9257 fix x |
9258 assume "x \<in> f y" |
9258 assume "x \<in> f y" |