175 and "\<forall>j\<in>s. y j \<in> C" |
175 and "\<forall>j\<in>s. y j \<in> C" |
176 using insert.hyps(1,2) insert.prems by simp_all |
176 using insert.hyps(1,2) insert.prems by simp_all |
177 then have "0 \<le> setsum a s" |
177 then have "0 \<le> setsum a s" |
178 by (simp add: setsum_nonneg) |
178 by (simp add: setsum_nonneg) |
179 have "a i *\<^sub>R y i + (\<Sum>j\<in>s. a j *\<^sub>R y j) \<in> C" |
179 have "a i *\<^sub>R y i + (\<Sum>j\<in>s. a j *\<^sub>R y j) \<in> C" |
180 proof (cases) |
180 proof (cases "setsum a s = 0") |
181 assume z: "setsum a s = 0" |
181 case True |
182 with \<open>a i + setsum a s = 1\<close> have "a i = 1" |
182 with \<open>a i + setsum a s = 1\<close> have "a i = 1" |
183 by simp |
183 by simp |
184 from setsum_nonneg_0 [OF \<open>finite s\<close> _ z] \<open>\<forall>j\<in>s. 0 \<le> a j\<close> have "\<forall>j\<in>s. a j = 0" |
184 from setsum_nonneg_0 [OF \<open>finite s\<close> _ True] \<open>\<forall>j\<in>s. 0 \<le> a j\<close> have "\<forall>j\<in>s. a j = 0" |
185 by simp |
185 by simp |
186 show ?thesis using \<open>a i = 1\<close> and \<open>\<forall>j\<in>s. a j = 0\<close> and \<open>y i \<in> C\<close> |
186 show ?thesis using \<open>a i = 1\<close> and \<open>\<forall>j\<in>s. a j = 0\<close> and \<open>y i \<in> C\<close> |
187 by simp |
187 by simp |
188 next |
188 next |
189 assume nz: "setsum a s \<noteq> 0" |
189 case False |
190 with \<open>0 \<le> setsum a s\<close> have "0 < setsum a s" |
190 with \<open>0 \<le> setsum a s\<close> have "0 < setsum a s" |
191 by simp |
191 by simp |
192 then have "(\<Sum>j\<in>s. (a j / setsum a s) *\<^sub>R y j) \<in> C" |
192 then have "(\<Sum>j\<in>s. (a j / setsum a s) *\<^sub>R y j) \<in> C" |
193 using \<open>\<forall>j\<in>s. 0 \<le> a j\<close> and \<open>\<forall>j\<in>s. y j \<in> C\<close> |
193 using \<open>\<forall>j\<in>s. 0 \<le> a j\<close> and \<open>\<forall>j\<in>s. y j \<in> C\<close> |
194 by (simp add: IH setsum_divide_distrib [symmetric]) |
194 by (simp add: IH setsum_divide_distrib [symmetric]) |
195 from \<open>convex C\<close> and \<open>y i \<in> C\<close> and this and \<open>0 \<le> a i\<close> |
195 from \<open>convex C\<close> and \<open>y i \<in> C\<close> and this and \<open>0 \<le> a i\<close> |
196 and \<open>0 \<le> setsum a s\<close> and \<open>a i + setsum a s = 1\<close> |
196 and \<open>0 \<le> setsum a s\<close> and \<open>a i + setsum a s = 1\<close> |
197 have "a i *\<^sub>R y i + setsum a s *\<^sub>R (\<Sum>j\<in>s. (a j / setsum a s) *\<^sub>R y j) \<in> C" |
197 have "a i *\<^sub>R y i + setsum a s *\<^sub>R (\<Sum>j\<in>s. (a j / setsum a s) *\<^sub>R y j) \<in> C" |
198 by (rule convexD) |
198 by (rule convexD) |
199 then show ?thesis |
199 then show ?thesis |
200 by (simp add: scaleR_setsum_right nz) |
200 by (simp add: scaleR_setsum_right False) |
201 qed |
201 qed |
202 then show ?case using \<open>finite s\<close> and \<open>i \<notin> s\<close> |
202 then show ?case using \<open>finite s\<close> and \<open>i \<notin> s\<close> |
203 by simp |
203 by simp |
204 qed |
204 qed |
205 |
205 |