1006 lemma in_span_insert: |
1006 lemma in_span_insert: |
1007 assumes a: "a \<in> span (insert b S)" |
1007 assumes a: "a \<in> span (insert b S)" |
1008 and na: "a \<notin> span S" |
1008 and na: "a \<notin> span S" |
1009 shows "b \<in> span (insert a S)" |
1009 shows "b \<in> span (insert a S)" |
1010 proof - |
1010 proof - |
1011 from span_breakdown[of b "insert b S" a, OF insertI1 a] |
1011 from a obtain k where k: "a - k *\<^sub>R b \<in> span S" |
1012 obtain k where k: "a - k*\<^sub>R b \<in> span (S - {b})" by auto |
1012 unfolding span_insert by fast |
1013 show ?thesis |
1013 show ?thesis |
1014 proof (cases "k = 0") |
1014 proof (cases "k = 0") |
1015 case True |
1015 case True |
1016 with k have "a \<in> span S" |
1016 with k have "a \<in> span S" by simp |
1017 apply (simp) |
1017 with na show ?thesis by simp |
1018 apply (rule set_rev_mp) |
|
1019 apply assumption |
|
1020 apply (rule span_mono) |
|
1021 apply blast |
|
1022 done |
|
1023 with na show ?thesis by blast |
|
1024 next |
1018 next |
1025 case False |
1019 case False |
1026 have eq: "b = (1/k) *\<^sub>R a - ((1/k) *\<^sub>R a - b)" by simp |
1020 from k have "(- inverse k) *\<^sub>R (a - k *\<^sub>R b) \<in> span S" |
1027 from False have eq': "(1/k) *\<^sub>R (a - k*\<^sub>R b) = (1/k) *\<^sub>R a - b" |
|
1028 by (simp add: algebra_simps) |
|
1029 from k have "(1/k) *\<^sub>R (a - k*\<^sub>R b) \<in> span (S - {b})" |
|
1030 by (rule span_mul) |
1021 by (rule span_mul) |
1031 then have th: "(1/k) *\<^sub>R a - b \<in> span (S - {b})" |
1022 then have "b - inverse k *\<^sub>R a \<in> span S" |
1032 unfolding eq' . |
1023 using `k \<noteq> 0` by (simp add: scaleR_diff_right) |
1033 from k show ?thesis |
1024 then show ?thesis |
1034 apply (subst eq) |
1025 unfolding span_insert by fast |
1035 apply (rule span_sub) |
|
1036 apply (rule span_mul) |
|
1037 apply (rule span_superset) |
|
1038 apply blast |
|
1039 apply (rule set_rev_mp) |
|
1040 apply (rule th) |
|
1041 apply (rule span_mono) |
|
1042 using na |
|
1043 apply blast |
|
1044 done |
|
1045 qed |
1026 qed |
1046 qed |
1027 qed |
1047 |
1028 |
1048 lemma in_span_delete: |
1029 lemma in_span_delete: |
1049 assumes a: "a \<in> span S" |
1030 assumes a: "a \<in> span S" |
1077 "span P = {y. \<exists>S u. finite S \<and> S \<subseteq> P \<and> setsum (\<lambda>v. u v *\<^sub>R v) S = y}" |
1058 "span P = {y. \<exists>S u. finite S \<and> S \<subseteq> P \<and> setsum (\<lambda>v. u v *\<^sub>R v) S = y}" |
1078 (is "_ = ?E" is "_ = {y. ?h y}" is "_ = {y. \<exists>S u. ?Q S u y}") |
1059 (is "_ = ?E" is "_ = {y. ?h y}" is "_ = {y. \<exists>S u. ?Q S u y}") |
1079 proof - |
1060 proof - |
1080 { |
1061 { |
1081 fix x |
1062 fix x |
1082 assume x: "x \<in> ?E" |
1063 assume "?h x" |
1083 then obtain S u where fS: "finite S" and SP: "S\<subseteq>P" and u: "setsum (\<lambda>v. u v *\<^sub>R v) S = x" |
1064 then obtain S u where "finite S" and "S \<subseteq> P" and "setsum (\<lambda>v. u v *\<^sub>R v) S = x" |
1084 by blast |
1065 by blast |
1085 have "x \<in> span P" |
1066 then have "x \<in> span P" |
1086 unfolding u[symmetric] |
1067 by (auto intro: span_setsum span_mul span_superset) |
1087 apply (rule span_setsum[OF fS]) |
|
1088 using span_mono[OF SP] |
|
1089 apply (auto intro: span_superset span_mul) |
|
1090 done |
|
1091 } |
1068 } |
1092 moreover |
1069 moreover |
1093 have "\<forall>x \<in> span P. x \<in> ?E" |
1070 have "\<forall>x \<in> span P. ?h x" |
1094 proof (rule span_induct_alt') |
1071 proof (rule span_induct_alt') |
1095 show "0 \<in> Collect ?h" |
1072 show "?h 0" |
1096 unfolding mem_Collect_eq |
1073 by (rule exI[where x="{}"], simp) |
1097 apply (rule exI[where x="{}"]) |
|
1098 apply simp |
|
1099 done |
|
1100 next |
1074 next |
1101 fix c x y |
1075 fix c x y |
1102 assume x: "x \<in> P" |
1076 assume x: "x \<in> P" |
1103 assume hy: "y \<in> Collect ?h" |
1077 assume hy: "?h y" |
1104 from hy obtain S u where fS: "finite S" and SP: "S\<subseteq>P" |
1078 from hy obtain S u where fS: "finite S" and SP: "S\<subseteq>P" |
1105 and u: "setsum (\<lambda>v. u v *\<^sub>R v) S = y" by blast |
1079 and u: "setsum (\<lambda>v. u v *\<^sub>R v) S = y" by blast |
1106 let ?S = "insert x S" |
1080 let ?S = "insert x S" |
1107 let ?u = "\<lambda>y. if y = x then (if x \<in> S then u y + c else c) else u y" |
1081 let ?u = "\<lambda>y. if y = x then (if x \<in> S then u y + c else c) else u y" |
1108 from fS SP x have th0: "finite (insert x S)" "insert x S \<subseteq> P" |
1082 from fS SP x have th0: "finite (insert x S)" "insert x S \<subseteq> P" |
1109 by blast+ |
1083 by blast+ |
1110 have "?Q ?S ?u (c*\<^sub>R x + y)" |
1084 have "?Q ?S ?u (c*\<^sub>R x + y)" |
1111 proof cases |
1085 proof cases |
1112 assume xS: "x \<in> S" |
1086 assume xS: "x \<in> S" |
1113 have S1: "S = (S - {x}) \<union> {x}" |
1087 have "setsum (\<lambda>v. ?u v *\<^sub>R v) ?S = (\<Sum>v\<in>S - {x}. u v *\<^sub>R v) + (u x + c) *\<^sub>R x" |
1114 and Sss:"finite (S - {x})" "finite {x}" "(S - {x}) \<inter> {x} = {}" |
1088 using xS by (simp add: setsum.remove [OF fS xS] insert_absorb) |
1115 using xS fS by auto |
|
1116 have "setsum (\<lambda>v. ?u v *\<^sub>R v) ?S =(\<Sum>v\<in>S - {x}. u v *\<^sub>R v) + (u x + c) *\<^sub>R x" |
|
1117 using xS |
|
1118 by (simp add: setsum_Un_disjoint[OF Sss, unfolded S1[symmetric]] |
|
1119 setsum_clauses(2)[OF fS] cong del: if_weak_cong) |
|
1120 also have "\<dots> = (\<Sum>v\<in>S. u v *\<^sub>R v) + c *\<^sub>R x" |
1089 also have "\<dots> = (\<Sum>v\<in>S. u v *\<^sub>R v) + c *\<^sub>R x" |
1121 apply (simp add: setsum_Un_disjoint[OF Sss, unfolded S1[symmetric]]) |
1090 by (simp add: setsum.remove [OF fS xS] algebra_simps) |
1122 apply (simp add: algebra_simps) |
|
1123 done |
|
1124 also have "\<dots> = c*\<^sub>R x + y" |
1091 also have "\<dots> = c*\<^sub>R x + y" |
1125 by (simp add: add_commute u) |
1092 by (simp add: add_commute u) |
1126 finally have "setsum (\<lambda>v. ?u v *\<^sub>R v) ?S = c*\<^sub>R x + y" . |
1093 finally have "setsum (\<lambda>v. ?u v *\<^sub>R v) ?S = c*\<^sub>R x + y" . |
1127 then show ?thesis using th0 by blast |
1094 then show ?thesis using th0 by blast |
1128 next |
1095 next |
1132 apply (rule setsum_cong2) |
1099 apply (rule setsum_cong2) |
1133 using xS |
1100 using xS |
1134 apply auto |
1101 apply auto |
1135 done |
1102 done |
1136 show ?thesis using fS xS th0 |
1103 show ?thesis using fS xS th0 |
1137 by (simp add: th00 setsum_clauses add_commute cong del: if_weak_cong) |
1104 by (simp add: th00 add_commute cong del: if_weak_cong) |
1138 qed |
1105 qed |
1139 then show "(c*\<^sub>R x + y) \<in> Collect ?h" |
1106 then show "?h (c*\<^sub>R x + y)" |
1140 unfolding mem_Collect_eq |
1107 by fast |
1141 apply - |
|
1142 apply (rule exI[where x="?S"]) |
|
1143 apply (rule exI[where x="?u"]) |
|
1144 apply metis |
|
1145 done |
|
1146 qed |
1108 qed |
1147 ultimately show ?thesis by blast |
1109 ultimately show ?thesis by blast |
1148 qed |
1110 qed |
1149 |
1111 |
1150 lemma dependent_explicit: |
1112 lemma dependent_explicit: |
1163 by blast |
1125 by blast |
1164 from fS SP aP have th0: "finite ?S" "?S \<subseteq> P" "?v \<in> ?S" "?u ?v \<noteq> 0" |
1126 from fS SP aP have th0: "finite ?S" "?S \<subseteq> P" "?v \<in> ?S" "?u ?v \<noteq> 0" |
1165 by auto |
1127 by auto |
1166 have s0: "setsum (\<lambda>v. ?u v *\<^sub>R v) ?S = 0" |
1128 have s0: "setsum (\<lambda>v. ?u v *\<^sub>R v) ?S = 0" |
1167 using fS aS |
1129 using fS aS |
1168 apply (simp add: setsum_clauses field_simps) |
1130 apply simp |
1169 apply (subst (2) ua[symmetric]) |
1131 apply (subst (2) ua[symmetric]) |
1170 apply (rule setsum_cong2) |
1132 apply (rule setsum_cong2) |
1171 apply auto |
1133 apply auto |
1172 done |
1134 done |
1173 with th0 have ?rhs |
1135 with th0 have ?rhs by fast |
1174 apply - |
|
1175 apply (rule exI[where x= "?S"]) |
|
1176 apply (rule exI[where x= "?u"]) |
|
1177 apply auto |
|
1178 done |
|
1179 } |
1136 } |
1180 moreover |
1137 moreover |
1181 { |
1138 { |
1182 fix S u v |
1139 fix S u v |
1183 assume fS: "finite S" |
1140 assume fS: "finite S" |