646 apply (simp add: x y) |
646 apply (simp add: x y) |
647 done |
647 done |
648 |
648 |
649 subsection {* A generic notion of "hull" (convex, affine, conic hull and closure). *} |
649 subsection {* A generic notion of "hull" (convex, affine, conic hull and closure). *} |
650 |
650 |
651 definition hull :: "'a set set \<Rightarrow> 'a set \<Rightarrow> 'a set" (infixl "hull" 75) where |
651 definition hull :: "('a set \<Rightarrow> bool) \<Rightarrow> 'a set \<Rightarrow> 'a set" (infixl "hull" 75) where |
652 "S hull s = Inter {t. t \<in> S \<and> s \<subseteq> t}" |
652 "S hull s = Inter {t. S t \<and> s \<subseteq> t}" |
653 |
653 |
654 lemma hull_same: "s \<in> S \<Longrightarrow> S hull s = s" |
654 lemma hull_same: "S s \<Longrightarrow> S hull s = s" |
655 unfolding hull_def by auto |
655 unfolding hull_def by auto |
656 |
656 |
657 lemma hull_in: "(\<And>T. T \<subseteq> S ==> Inter T \<in> S) ==> (S hull s) \<in> S" |
657 lemma hull_in: "(\<And>T. Ball T S ==> S (Inter T)) ==> S (S hull s)" |
658 unfolding hull_def subset_iff by auto |
658 unfolding hull_def Ball_def by auto |
659 |
659 |
660 lemma hull_eq: "(\<And>T. T \<subseteq> S ==> Inter T \<in> S) ==> (S hull s) = s \<longleftrightarrow> s \<in> S" |
660 lemma hull_eq: "(\<And>T. Ball T S ==> S (Inter T)) ==> (S hull s) = s \<longleftrightarrow> S s" |
661 using hull_same[of s S] hull_in[of S s] by metis |
661 using hull_same[of S s] hull_in[of S s] by metis |
662 |
662 |
663 |
663 |
664 lemma hull_hull: "S hull (S hull s) = S hull s" |
664 lemma hull_hull: "S hull (S hull s) = S hull s" |
665 unfolding hull_def by blast |
665 unfolding hull_def by blast |
666 |
666 |
668 unfolding hull_def by blast |
668 unfolding hull_def by blast |
669 |
669 |
670 lemma hull_mono: " s \<subseteq> t ==> (S hull s) \<subseteq> (S hull t)" |
670 lemma hull_mono: " s \<subseteq> t ==> (S hull s) \<subseteq> (S hull t)" |
671 unfolding hull_def by blast |
671 unfolding hull_def by blast |
672 |
672 |
673 lemma hull_antimono: "S \<subseteq> T ==> (T hull s) \<subseteq> (S hull s)" |
673 lemma hull_antimono: "\<forall>x. S x \<longrightarrow> T x ==> (T hull s) \<subseteq> (S hull s)" |
674 unfolding hull_def by blast |
674 unfolding hull_def by blast |
675 |
675 |
676 lemma hull_minimal: "s \<subseteq> t \<Longrightarrow> t \<in> S ==> (S hull s) \<subseteq> t" |
676 lemma hull_minimal: "s \<subseteq> t \<Longrightarrow> S t ==> (S hull s) \<subseteq> t" |
677 unfolding hull_def by blast |
677 unfolding hull_def by blast |
678 |
678 |
679 lemma subset_hull: "t \<in> S ==> S hull s \<subseteq> t \<longleftrightarrow> s \<subseteq> t" |
679 lemma subset_hull: "S t ==> S hull s \<subseteq> t \<longleftrightarrow> s \<subseteq> t" |
680 unfolding hull_def by blast |
680 unfolding hull_def by blast |
681 |
681 |
682 lemma hull_unique: "s \<subseteq> t \<Longrightarrow> t \<in> S \<Longrightarrow> (\<And>t'. s \<subseteq> t' \<Longrightarrow> t' \<in> S ==> t \<subseteq> t') |
682 lemma hull_unique: "s \<subseteq> t \<Longrightarrow> S t \<Longrightarrow> (\<And>t'. s \<subseteq> t' \<Longrightarrow> S t' ==> t \<subseteq> t') |
683 ==> (S hull s = t)" |
683 ==> (S hull s = t)" |
684 unfolding hull_def by auto |
684 unfolding hull_def by auto |
685 |
685 |
686 lemma hull_induct: "(\<And>x. x\<in> S \<Longrightarrow> P x) \<Longrightarrow> Q {x. P x} \<Longrightarrow> \<forall>x\<in> Q hull S. P x" |
686 lemma hull_induct: "(\<And>x. x\<in> S \<Longrightarrow> P x) \<Longrightarrow> Q {x. P x} \<Longrightarrow> \<forall>x\<in> Q hull S. P x" |
687 using hull_minimal[of S "{x. P x}" Q] |
687 using hull_minimal[of S "{x. P x}" Q] |
688 by (auto simp add: subset_eq Collect_def mem_def) |
688 by (auto simp add: subset_eq) |
689 |
689 |
690 lemma hull_inc: "x \<in> S \<Longrightarrow> x \<in> P hull S" by (metis hull_subset subset_eq) |
690 lemma hull_inc: "x \<in> S \<Longrightarrow> x \<in> P hull S" by (metis hull_subset subset_eq) |
691 |
691 |
692 lemma hull_union_subset: "(S hull s) \<union> (S hull t) \<subseteq> (S hull (s \<union> t))" |
692 lemma hull_union_subset: "(S hull s) \<union> (S hull t) \<subseteq> (S hull (s \<union> t))" |
693 unfolding Un_subset_iff by (metis hull_mono Un_upper1 Un_upper2) |
693 unfolding Un_subset_iff by (metis hull_mono Un_upper1 Un_upper2) |
694 |
694 |
695 lemma hull_union: assumes T: "\<And>T. T \<subseteq> S ==> Inter T \<in> S" |
695 lemma hull_union: assumes T: "\<And>T. Ball T S ==> S (Inter T)" |
696 shows "S hull (s \<union> t) = S hull (S hull s \<union> S hull t)" |
696 shows "S hull (s \<union> t) = S hull (S hull s \<union> S hull t)" |
697 apply rule |
697 apply rule |
698 apply (rule hull_mono) |
698 apply (rule hull_mono) |
699 unfolding Un_subset_iff |
699 unfolding Un_subset_iff |
700 apply (metis hull_subset Un_upper1 Un_upper2 subset_trans) |
700 apply (metis hull_subset Un_upper1 Un_upper2 subset_trans) |
905 lemma (in real_vector) span_mono: "A \<subseteq> B ==> span A \<subseteq> span B" |
905 lemma (in real_vector) span_mono: "A \<subseteq> B ==> span A \<subseteq> span B" |
906 by (metis span_def hull_mono) |
906 by (metis span_def hull_mono) |
907 |
907 |
908 lemma (in real_vector) subspace_span: "subspace(span S)" |
908 lemma (in real_vector) subspace_span: "subspace(span S)" |
909 unfolding span_def |
909 unfolding span_def |
910 apply (rule hull_in[unfolded mem_def]) |
910 apply (rule hull_in) |
911 apply (simp only: subspace_def Inter_iff Int_iff subset_eq) |
911 apply (simp only: subspace_def Inter_iff Int_iff subset_eq) |
912 apply auto |
912 apply auto |
913 apply (erule_tac x="X" in ballE) |
|
914 apply (simp add: mem_def) |
|
915 apply blast |
|
916 apply (erule_tac x="X" in ballE) |
|
917 apply (erule_tac x="X" in ballE) |
|
918 apply (erule_tac x="X" in ballE) |
|
919 apply (clarsimp simp add: mem_def) |
|
920 apply simp |
|
921 apply simp |
|
922 apply simp |
|
923 apply (erule_tac x="X" in ballE) |
|
924 apply (erule_tac x="X" in ballE) |
|
925 apply (simp add: mem_def) |
|
926 apply simp |
|
927 apply simp |
|
928 done |
913 done |
929 |
914 |
930 lemma (in real_vector) span_clauses: |
915 lemma (in real_vector) span_clauses: |
931 "a \<in> S ==> a \<in> span S" |
916 "a \<in> S ==> a \<in> span S" |
932 "0 \<in> span S" |
917 "0 \<in> span S" |
933 "x\<in> span S \<Longrightarrow> y \<in> span S ==> x + y \<in> span S" |
918 "x\<in> span S \<Longrightarrow> y \<in> span S ==> x + y \<in> span S" |
934 "x \<in> span S \<Longrightarrow> c *\<^sub>R x \<in> span S" |
919 "x \<in> span S \<Longrightarrow> c *\<^sub>R x \<in> span S" |
935 by (metis span_def hull_subset subset_eq) |
920 by (metis span_def hull_subset subset_eq) |
936 (metis subspace_span subspace_def)+ |
921 (metis subspace_span subspace_def)+ |
937 |
922 |
938 lemma (in real_vector) span_induct: assumes SP: "\<And>x. x \<in> S ==> P x" |
923 lemma (in real_vector) span_induct: assumes SP: "\<And>x. x \<in> S ==> x \<in> P" |
939 and P: "subspace P" and x: "x \<in> span S" shows "P x" |
924 and P: "subspace P" and x: "x \<in> span S" shows "x \<in> P" |
940 proof- |
925 proof- |
941 from SP have SP': "S \<subseteq> P" by (simp add: mem_def subset_eq) |
926 from SP have SP': "S \<subseteq> P" by (simp add: subset_eq) |
942 from P have P': "P \<in> subspace" by (simp add: mem_def) |
927 from x hull_minimal[where S=subspace, OF SP' P, unfolded span_def[symmetric]] |
943 from x hull_minimal[OF SP' P', unfolded span_def[symmetric]] |
928 show "x \<in> P" by (metis subset_eq) |
944 show "P x" by (metis mem_def subset_eq) |
|
945 qed |
929 qed |
946 |
930 |
947 lemma span_empty[simp]: "span {} = {0}" |
931 lemma span_empty[simp]: "span {} = {0}" |
948 apply (simp add: span_def) |
932 apply (simp add: span_def) |
949 apply (rule hull_unique) |
933 apply (rule hull_unique) |
950 apply (auto simp add: mem_def subspace_def) |
934 apply (auto simp add: subspace_def) |
951 unfolding mem_def[of "0::'a", symmetric] |
|
952 apply simp |
|
953 done |
935 done |
954 |
936 |
955 lemma (in real_vector) independent_empty[intro]: "independent {}" |
937 lemma (in real_vector) independent_empty[intro]: "independent {}" |
956 by (simp add: dependent_def) |
938 by (simp add: dependent_def) |
957 |
939 |
966 apply (rule span_mono) |
948 apply (rule span_mono) |
967 apply auto |
949 apply auto |
968 done |
950 done |
969 |
951 |
970 lemma (in real_vector) span_subspace: "A \<subseteq> B \<Longrightarrow> B \<le> span A \<Longrightarrow> subspace B \<Longrightarrow> span A = B" |
952 lemma (in real_vector) span_subspace: "A \<subseteq> B \<Longrightarrow> B \<le> span A \<Longrightarrow> subspace B \<Longrightarrow> span A = B" |
971 by (metis order_antisym span_def hull_minimal mem_def) |
953 by (metis order_antisym span_def hull_minimal) |
972 |
954 |
973 lemma (in real_vector) span_induct': assumes SP: "\<forall>x \<in> S. P x" |
955 lemma (in real_vector) span_induct': assumes SP: "\<forall>x \<in> S. P x" |
974 and P: "subspace P" shows "\<forall>x \<in> span S. P x" |
956 and P: "subspace {x. P x}" shows "\<forall>x \<in> span S. P x" |
975 using span_induct SP P by blast |
957 using span_induct SP P by blast |
976 |
958 |
977 inductive (in real_vector) span_induct_alt_help for S:: "'a \<Rightarrow> bool" |
959 inductive_set (in real_vector) span_induct_alt_help for S:: "'a set" |
978 where |
960 where |
979 span_induct_alt_help_0: "span_induct_alt_help S 0" |
961 span_induct_alt_help_0: "0 \<in> span_induct_alt_help S" |
980 | span_induct_alt_help_S: "x \<in> S \<Longrightarrow> span_induct_alt_help S z \<Longrightarrow> span_induct_alt_help S (c *\<^sub>R x + z)" |
962 | span_induct_alt_help_S: "x \<in> S \<Longrightarrow> z \<in> span_induct_alt_help S \<Longrightarrow> (c *\<^sub>R x + z) \<in> span_induct_alt_help S" |
981 |
963 |
982 lemma span_induct_alt': |
964 lemma span_induct_alt': |
983 assumes h0: "h 0" and hS: "\<And>c x y. x \<in> S \<Longrightarrow> h y \<Longrightarrow> h (c *\<^sub>R x + y)" shows "\<forall>x \<in> span S. h x" |
965 assumes h0: "h 0" and hS: "\<And>c x y. x \<in> S \<Longrightarrow> h y \<Longrightarrow> h (c *\<^sub>R x + y)" shows "\<forall>x \<in> span S. h x" |
984 proof- |
966 proof- |
985 {fix x:: "'a" assume x: "span_induct_alt_help S x" |
967 {fix x:: "'a" assume x: "x \<in> span_induct_alt_help S" |
986 have "h x" |
968 have "h x" |
987 apply (rule span_induct_alt_help.induct[OF x]) |
969 apply (rule span_induct_alt_help.induct[OF x]) |
988 apply (rule h0) |
970 apply (rule h0) |
989 apply (rule hS, assumption, assumption) |
971 apply (rule hS, assumption, assumption) |
990 done} |
972 done} |
991 note th0 = this |
973 note th0 = this |
992 {fix x assume x: "x \<in> span S" |
974 {fix x assume x: "x \<in> span S" |
993 |
975 |
994 have "span_induct_alt_help S x" |
976 have "x \<in> span_induct_alt_help S" |
995 proof(rule span_induct[where x=x and S=S]) |
977 proof(rule span_induct[where x=x and S=S]) |
996 show "x \<in> span S" using x . |
978 show "x \<in> span S" using x . |
997 next |
979 next |
998 fix x assume xS : "x \<in> S" |
980 fix x assume xS : "x \<in> S" |
999 from span_induct_alt_help_S[OF xS span_induct_alt_help_0, of 1] |
981 from span_induct_alt_help_S[OF xS span_induct_alt_help_0, of 1] |
1000 show "span_induct_alt_help S x" by simp |
982 show "x \<in> span_induct_alt_help S" by simp |
1001 next |
983 next |
1002 have "span_induct_alt_help S 0" by (rule span_induct_alt_help_0) |
984 have "0 \<in> span_induct_alt_help S" by (rule span_induct_alt_help_0) |
1003 moreover |
985 moreover |
1004 {fix x y assume h: "span_induct_alt_help S x" "span_induct_alt_help S y" |
986 {fix x y assume h: "x \<in> span_induct_alt_help S" "y \<in> span_induct_alt_help S" |
1005 from h |
987 from h |
1006 have "span_induct_alt_help S (x + y)" |
988 have "(x + y) \<in> span_induct_alt_help S" |
1007 apply (induct rule: span_induct_alt_help.induct) |
989 apply (induct rule: span_induct_alt_help.induct) |
1008 apply simp |
990 apply simp |
1009 unfolding add_assoc |
991 unfolding add_assoc |
1010 apply (rule span_induct_alt_help_S) |
992 apply (rule span_induct_alt_help_S) |
1011 apply assumption |
993 apply assumption |
1012 apply simp |
994 apply simp |
1013 done} |
995 done} |
1014 moreover |
996 moreover |
1015 {fix c x assume xt: "span_induct_alt_help S x" |
997 {fix c x assume xt: "x \<in> span_induct_alt_help S" |
1016 then have "span_induct_alt_help S (c *\<^sub>R x)" |
998 then have "(c *\<^sub>R x) \<in> span_induct_alt_help S" |
1017 apply (induct rule: span_induct_alt_help.induct) |
999 apply (induct rule: span_induct_alt_help.induct) |
1018 apply (simp add: span_induct_alt_help_0) |
1000 apply (simp add: span_induct_alt_help_0) |
1019 apply (simp add: scaleR_right_distrib) |
1001 apply (simp add: scaleR_right_distrib) |
1020 apply (rule span_induct_alt_help_S) |
1002 apply (rule span_induct_alt_help_S) |
1021 apply assumption |
1003 apply assumption |
1022 apply simp |
1004 apply simp |
1023 done |
1005 done |
1024 } |
1006 } |
1025 ultimately show "subspace (span_induct_alt_help S)" |
1007 ultimately show "subspace (span_induct_alt_help S)" |
1026 unfolding subspace_def mem_def Ball_def by blast |
1008 unfolding subspace_def Ball_def by blast |
1027 qed} |
1009 qed} |
1028 with th0 show ?thesis by blast |
1010 with th0 show ?thesis by blast |
1029 qed |
1011 qed |
1030 |
1012 |
1031 lemma span_induct_alt: |
1013 lemma span_induct_alt: |
1079 have "x \<in> f ` span S" |
1061 have "x \<in> f ` span S" |
1080 apply (rule span_induct[where x=x and S = "f ` S"]) |
1062 apply (rule span_induct[where x=x and S = "f ` S"]) |
1081 apply (clarsimp simp add: image_iff) |
1063 apply (clarsimp simp add: image_iff) |
1082 apply (frule span_superset) |
1064 apply (frule span_superset) |
1083 apply blast |
1065 apply blast |
1084 apply (simp only: mem_def) |
|
1085 apply (rule subspace_linear_image[OF lf]) |
1066 apply (rule subspace_linear_image[OF lf]) |
1086 apply (rule subspace_span) |
1067 apply (rule subspace_span) |
1087 apply (rule x) |
1068 apply (rule x) |
1088 done} |
1069 done} |
1089 moreover |
1070 moreover |
1090 {fix x assume x: "x \<in> span S" |
1071 {fix x assume x: "x \<in> span S" |
1091 have th0:"(\<lambda>a. f a \<in> span (f ` S)) = {x. f x \<in> span (f ` S)}" apply (rule set_eqI) |
1072 have "x \<in> {x. f x \<in> span (f ` S)}" |
1092 unfolding mem_def Collect_def .. |
|
1093 have "f x \<in> span (f ` S)" |
|
1094 apply (rule span_induct[where S=S]) |
1073 apply (rule span_induct[where S=S]) |
|
1074 apply simp |
1095 apply (rule span_superset) |
1075 apply (rule span_superset) |
1096 apply simp |
1076 apply simp |
1097 apply (subst th0) |
|
1098 apply (rule subspace_linear_preimage[OF lf subspace_span, of "f ` S"]) |
1077 apply (rule subspace_linear_preimage[OF lf subspace_span, of "f ` S"]) |
1099 apply (rule x) |
1078 apply (rule x) |
1100 done} |
1079 done |
|
1080 hence "f x \<in> span (f ` S)" by simp |
|
1081 } |
1101 ultimately show ?thesis by blast |
1082 ultimately show ?thesis by blast |
1102 qed |
1083 qed |
1103 |
1084 |
1104 text {* The key breakdown property. *} |
1085 text {* The key breakdown property. *} |
1105 |
1086 |
1118 then have "?P x" using xS |
1099 then have "?P x" using xS |
1119 apply - |
1100 apply - |
1120 apply (rule exI[where x=0]) |
1101 apply (rule exI[where x=0]) |
1121 apply (rule span_superset) |
1102 apply (rule span_superset) |
1122 by simp} |
1103 by simp} |
1123 ultimately have "?P x" by blast} |
1104 ultimately have "x \<in> Collect ?P" by blast} |
1124 moreover have "subspace ?P" |
1105 moreover have "subspace (Collect ?P)" |
1125 unfolding subspace_def |
1106 unfolding subspace_def |
1126 apply auto |
1107 apply auto |
1127 apply (simp add: mem_def) |
|
1128 apply (rule exI[where x=0]) |
1108 apply (rule exI[where x=0]) |
1129 using span_0[of "S - {b}"] |
1109 using span_0[of "S - {b}"] |
1130 apply (simp add: mem_def) |
1110 apply simp |
1131 apply (clarsimp simp add: mem_def) |
|
1132 apply (rule_tac x="k + ka" in exI) |
1111 apply (rule_tac x="k + ka" in exI) |
1133 apply (subgoal_tac "x + y - (k + ka) *\<^sub>R b = (x - k*\<^sub>R b) + (y - ka *\<^sub>R b)") |
1112 apply (subgoal_tac "x + y - (k + ka) *\<^sub>R b = (x - k*\<^sub>R b) + (y - ka *\<^sub>R b)") |
1134 apply (simp only: ) |
1113 apply (simp only: ) |
1135 apply (rule span_add[unfolded mem_def]) |
1114 apply (rule span_add) |
1136 apply assumption+ |
1115 apply assumption+ |
1137 apply (simp add: algebra_simps) |
1116 apply (simp add: algebra_simps) |
1138 apply (clarsimp simp add: mem_def) |
|
1139 apply (rule_tac x= "c*k" in exI) |
1117 apply (rule_tac x= "c*k" in exI) |
1140 apply (subgoal_tac "c *\<^sub>R x - (c * k) *\<^sub>R b = c*\<^sub>R (x - k*\<^sub>R b)") |
1118 apply (subgoal_tac "c *\<^sub>R x - (c * k) *\<^sub>R b = c*\<^sub>R (x - k*\<^sub>R b)") |
1141 apply (simp only: ) |
1119 apply (simp only: ) |
1142 apply (rule span_mul[unfolded mem_def]) |
1120 apply (rule span_mul) |
1143 apply assumption |
1121 apply assumption |
1144 by (simp add: algebra_simps) |
1122 by (simp add: algebra_simps) |
1145 ultimately show "?P a" using aS span_induct[where S=S and P= "?P"] by metis |
1123 ultimately have "a \<in> Collect ?P" using aS by (rule span_induct) |
|
1124 thus "?P a" by simp |
1146 qed |
1125 qed |
1147 |
1126 |
1148 lemma span_breakdown_eq: |
1127 lemma span_breakdown_eq: |
1149 "x \<in> span (insert a S) \<longleftrightarrow> (\<exists>k. (x - k *\<^sub>R a) \<in> span S)" (is "?lhs \<longleftrightarrow> ?rhs") |
1128 "x \<in> span (insert a S) \<longleftrightarrow> (\<exists>k. (x - k *\<^sub>R a) \<in> span S)" (is "?lhs \<longleftrightarrow> ?rhs") |
1150 proof- |
1129 proof- |
1264 apply (rule span_setsum[OF fS]) |
1243 apply (rule span_setsum[OF fS]) |
1265 using span_mono[OF SP] |
1244 using span_mono[OF SP] |
1266 by (auto intro: span_superset span_mul)} |
1245 by (auto intro: span_superset span_mul)} |
1267 moreover |
1246 moreover |
1268 have "\<forall>x \<in> span P. x \<in> ?E" |
1247 have "\<forall>x \<in> span P. x \<in> ?E" |
1269 unfolding mem_def Collect_def |
|
1270 proof(rule span_induct_alt') |
1248 proof(rule span_induct_alt') |
1271 show "?h 0" |
1249 show "0 \<in> Collect ?h" |
|
1250 unfolding mem_Collect_eq |
1272 apply (rule exI[where x="{}"]) by simp |
1251 apply (rule exI[where x="{}"]) by simp |
1273 next |
1252 next |
1274 fix c x y |
1253 fix c x y |
1275 assume x: "x \<in> P" and hy: "?h y" |
1254 assume x: "x \<in> P" and hy: "y \<in> Collect ?h" |
1276 from hy obtain S u where fS: "finite S" and SP: "S\<subseteq>P" |
1255 from hy obtain S u where fS: "finite S" and SP: "S\<subseteq>P" |
1277 and u: "setsum (\<lambda>v. u v *\<^sub>R v) S = y" by blast |
1256 and u: "setsum (\<lambda>v. u v *\<^sub>R v) S = y" by blast |
1278 let ?S = "insert x S" |
1257 let ?S = "insert x S" |
1279 let ?u = "\<lambda>y. if y = x then (if x \<in> S then u y + c else c) |
1258 let ?u = "\<lambda>y. if y = x then (if x \<in> S then u y + c else c) |
1280 else u y" |
1259 else u y" |
1301 using xS by auto |
1280 using xS by auto |
1302 have "?Q ?S ?u (c*\<^sub>R x + y)" using fS xS th0 |
1281 have "?Q ?S ?u (c*\<^sub>R x + y)" using fS xS th0 |
1303 by (simp add: th00 setsum_clauses add_commute cong del: if_weak_cong)} |
1282 by (simp add: th00 setsum_clauses add_commute cong del: if_weak_cong)} |
1304 ultimately have "?Q ?S ?u (c*\<^sub>R x + y)" |
1283 ultimately have "?Q ?S ?u (c*\<^sub>R x + y)" |
1305 by (cases "x \<in> S", simp, simp) |
1284 by (cases "x \<in> S", simp, simp) |
1306 then show "?h (c*\<^sub>R x + y)" |
1285 then show "(c*\<^sub>R x + y) \<in> Collect ?h" |
|
1286 unfolding mem_Collect_eq |
1307 apply - |
1287 apply - |
1308 apply (rule exI[where x="?S"]) |
1288 apply (rule exI[where x="?S"]) |
1309 apply (rule exI[where x="?u"]) by metis |
1289 apply (rule exI[where x="?u"]) by metis |
1310 qed |
1290 qed |
1311 ultimately show ?thesis by blast |
1291 ultimately show ?thesis by blast |
2266 apply (rule span_mul) |
2246 apply (rule span_mul) |
2267 by (rule span_superset) |
2247 by (rule span_superset) |
2268 with a have a0:"?a \<noteq> 0" by auto |
2248 with a have a0:"?a \<noteq> 0" by auto |
2269 have "\<forall>x\<in>span B. ?a \<bullet> x = 0" |
2249 have "\<forall>x\<in>span B. ?a \<bullet> x = 0" |
2270 proof(rule span_induct') |
2250 proof(rule span_induct') |
2271 show "subspace (\<lambda>x. ?a \<bullet> x = 0)" by (auto simp add: subspace_def mem_def inner_simps) |
2251 show "subspace {x. ?a \<bullet> x = 0}" by (auto simp add: subspace_def inner_simps) |
2272 next |
2252 next |
2273 {fix x assume x: "x \<in> B" |
2253 {fix x assume x: "x \<in> B" |
2274 from x have B': "B = insert x (B - {x})" by blast |
2254 from x have B': "B = insert x (B - {x})" by blast |
2275 have fth: "finite (B - {x})" using fB by simp |
2255 have fth: "finite (B - {x})" using fB by simp |
2276 have "?a \<bullet> x = 0" |
2256 have "?a \<bullet> x = 0" |
2546 by (simp add: linear_add[OF lf] linear_cmul[OF lf] linear_0[OF lf]) |
2526 by (simp add: linear_add[OF lf] linear_cmul[OF lf] linear_0[OF lf]) |
2547 |
2527 |
2548 lemma linear_eq_0_span: |
2528 lemma linear_eq_0_span: |
2549 assumes lf: "linear f" and f0: "\<forall>x\<in>B. f x = 0" |
2529 assumes lf: "linear f" and f0: "\<forall>x\<in>B. f x = 0" |
2550 shows "\<forall>x \<in> span B. f x = 0" |
2530 shows "\<forall>x \<in> span B. f x = 0" |
2551 proof |
2531 using f0 subspace_kernel[OF lf] |
2552 fix x assume x: "x \<in> span B" |
2532 by (rule span_induct') |
2553 let ?P = "\<lambda>x. f x = 0" |
|
2554 from subspace_kernel[OF lf] have "subspace ?P" unfolding Collect_def . |
|
2555 with x f0 span_induct[of B "?P" x] show "f x = 0" by blast |
|
2556 qed |
|
2557 |
2533 |
2558 lemma linear_eq_0: |
2534 lemma linear_eq_0: |
2559 assumes lf: "linear f" and SB: "S \<subseteq> span B" and f0: "\<forall>x\<in>B. f x = 0" |
2535 assumes lf: "linear f" and SB: "S \<subseteq> span B" and f0: "\<forall>x\<in>B. f x = 0" |
2560 shows "\<forall>x \<in> S. f x = 0" |
2536 shows "\<forall>x \<in> S. f x = 0" |
2561 by (metis linear_eq_0_span[OF lf] subset_eq SB f0) |
2537 by (metis linear_eq_0_span[OF lf] subset_eq SB f0) |
2592 and bg: "bilinear g" |
2568 and bg: "bilinear g" |
2593 and SB: "S \<subseteq> span B" and TC: "T \<subseteq> span C" |
2569 and SB: "S \<subseteq> span B" and TC: "T \<subseteq> span C" |
2594 and fg: "\<forall>x\<in> B. \<forall>y\<in> C. f x y = g x y" |
2570 and fg: "\<forall>x\<in> B. \<forall>y\<in> C. f x y = g x y" |
2595 shows "\<forall>x\<in>S. \<forall>y\<in>T. f x y = g x y " |
2571 shows "\<forall>x\<in>S. \<forall>y\<in>T. f x y = g x y " |
2596 proof- |
2572 proof- |
2597 let ?P = "\<lambda>x. \<forall>y\<in> span C. f x y = g x y" |
2573 let ?P = "{x. \<forall>y\<in> span C. f x y = g x y}" |
2598 from bf bg have sp: "subspace ?P" |
2574 from bf bg have sp: "subspace ?P" |
2599 unfolding bilinear_def linear_def subspace_def bf bg |
2575 unfolding bilinear_def linear_def subspace_def bf bg |
2600 by(auto simp add: span_0 mem_def bilinear_lzero[OF bf] bilinear_lzero[OF bg] span_add Ball_def intro: bilinear_ladd[OF bf]) |
2576 by(auto simp add: span_0 bilinear_lzero[OF bf] bilinear_lzero[OF bg] span_add Ball_def intro: bilinear_ladd[OF bf]) |
2601 |
2577 |
2602 have "\<forall>x \<in> span B. \<forall>y\<in> span C. f x y = g x y" |
2578 have "\<forall>x \<in> span B. \<forall>y\<in> span C. f x y = g x y" |
2603 apply - |
2579 apply (rule span_induct' [OF _ sp]) |
2604 apply (rule ballI) |
2580 apply (rule ballI) |
2605 apply (rule span_induct[of B ?P]) |
2581 apply (rule span_induct') |
2606 defer |
2582 apply (simp add: fg) |
2607 apply (rule sp) |
|
2608 apply assumption |
|
2609 apply (clarsimp simp add: Ball_def) |
|
2610 apply (rule_tac P="\<lambda>y. f xa y = g xa y" and S=C in span_induct) |
|
2611 using fg |
|
2612 apply (auto simp add: subspace_def) |
2583 apply (auto simp add: subspace_def) |
2613 using bf bg unfolding bilinear_def linear_def |
2584 using bf bg unfolding bilinear_def linear_def |
2614 by(auto simp add: span_0 mem_def bilinear_rzero[OF bf] bilinear_rzero[OF bg] span_add Ball_def intro: bilinear_ladd[OF bf]) |
2585 by(auto simp add: span_0 bilinear_rzero[OF bf] bilinear_rzero[OF bg] span_add Ball_def intro: bilinear_ladd[OF bf]) |
2615 then show ?thesis using SB TC by (auto intro: ext) |
2586 then show ?thesis using SB TC by (auto intro: ext) |
2616 qed |
2587 qed |
2617 |
2588 |
2618 lemma bilinear_eq_stdbasis: fixes f::"'a::euclidean_space \<Rightarrow> 'b::euclidean_space \<Rightarrow> _" |
2589 lemma bilinear_eq_stdbasis: fixes f::"'a::euclidean_space \<Rightarrow> 'b::euclidean_space \<Rightarrow> _" |
2619 assumes bf: "bilinear f" |
2590 assumes bf: "bilinear f" |