294 unfolding dist_vec_def |
294 unfolding dist_vec_def |
295 apply (rule order_trans [OF _ setL2_triangle_ineq]) |
295 apply (rule order_trans [OF _ setL2_triangle_ineq]) |
296 apply (simp add: setL2_mono dist_triangle2) |
296 apply (simp add: setL2_mono dist_triangle2) |
297 done |
297 done |
298 next |
298 next |
299 (* FIXME: long proof! *) |
|
300 fix S :: "('a ^ 'b) set" |
299 fix S :: "('a ^ 'b) set" |
301 show "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> S)" |
300 show "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> S)" |
302 unfolding open_vec_def open_dist |
301 proof |
303 apply safe |
302 assume "open S" show "\<forall>x\<in>S. \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> S" |
304 apply (drule (1) bspec) |
303 proof |
305 apply clarify |
304 fix x assume "x \<in> S" |
306 apply (subgoal_tac "\<exists>e>0. \<forall>i y. dist y (x$i) < e \<longrightarrow> y \<in> A i") |
305 obtain A where A: "\<forall>i. open (A i)" "\<forall>i. x $ i \<in> A i" |
307 apply clarify |
306 and S: "\<forall>y. (\<forall>i. y $ i \<in> A i) \<longrightarrow> y \<in> S" |
308 apply (rule_tac x=e in exI, clarify) |
307 using `open S` and `x \<in> S` unfolding open_vec_def by metis |
309 apply (drule spec, erule mp, clarify) |
308 have "\<forall>i\<in>UNIV. \<exists>r>0. \<forall>y. dist y (x $ i) < r \<longrightarrow> y \<in> A i" |
310 apply (drule spec, drule spec, erule mp) |
309 using A unfolding open_dist by simp |
311 apply (erule le_less_trans [OF dist_vec_nth_le]) |
310 hence "\<exists>r. \<forall>i\<in>UNIV. 0 < r i \<and> (\<forall>y. dist y (x $ i) < r i \<longrightarrow> y \<in> A i)" |
312 apply (subgoal_tac "\<forall>i\<in>UNIV. \<exists>e>0. \<forall>y. dist y (x$i) < e \<longrightarrow> y \<in> A i") |
311 by (rule finite_choice [OF finite]) |
313 apply (drule finite_choice [OF finite], clarify) |
312 then obtain r where r1: "\<forall>i. 0 < r i" |
314 apply (rule_tac x="Min (range f)" in exI, simp) |
313 and r2: "\<forall>i y. dist y (x $ i) < r i \<longrightarrow> y \<in> A i" by fast |
315 apply clarify |
314 have "0 < Min (range r) \<and> (\<forall>y. dist y x < Min (range r) \<longrightarrow> y \<in> S)" |
316 apply (drule_tac x=i in spec, clarify) |
315 by (simp add: r1 r2 S le_less_trans [OF dist_vec_nth_le]) |
317 apply (erule (1) bspec) |
316 thus "\<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> S" .. |
318 apply (drule (1) bspec, clarify) |
317 qed |
319 apply (subgoal_tac "\<exists>r. (\<forall>i::'b. 0 < r i) \<and> e = setL2 r UNIV") |
318 next |
320 apply clarify |
319 assume *: "\<forall>x\<in>S. \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> S" show "open S" |
321 apply (rule_tac x="\<lambda>i. {y. dist y (x$i) < r i}" in exI) |
320 proof (unfold open_vec_def, rule) |
322 apply (rule conjI) |
321 fix x assume "x \<in> S" |
323 apply clarify |
322 then obtain e where "0 < e" and S: "\<forall>y. dist y x < e \<longrightarrow> y \<in> S" |
324 apply (rule conjI) |
323 using * by fast |
325 apply (clarify, rename_tac y) |
324 def r \<equiv> "\<lambda>i::'b. e / sqrt (of_nat CARD('b))" |
326 apply (rule_tac x="r i - dist y (x$i)" in exI, rule conjI, simp) |
325 from `0 < e` have r: "\<forall>i. 0 < r i" |
327 apply clarify |
326 unfolding r_def by (simp_all add: divide_pos_pos) |
328 apply (simp only: less_diff_eq) |
327 from `0 < e` have e: "e = setL2 r UNIV" |
329 apply (erule le_less_trans [OF dist_triangle]) |
328 unfolding r_def by (simp add: setL2_constant) |
330 apply simp |
329 def A \<equiv> "\<lambda>i. {y. dist (x $ i) y < r i}" |
331 apply clarify |
330 have "\<forall>i. open (A i) \<and> x $ i \<in> A i" |
332 apply (drule spec, erule mp) |
331 unfolding A_def by (simp add: open_ball r) |
333 apply (simp add: dist_vec_def setL2_strict_mono) |
332 moreover have "\<forall>y. (\<forall>i. y $ i \<in> A i) \<longrightarrow> y \<in> S" |
334 apply (rule_tac x="\<lambda>i. e / sqrt (of_nat CARD('b))" in exI) |
333 by (simp add: A_def S dist_vec_def e setL2_strict_mono dist_commute) |
335 apply (simp add: divide_pos_pos setL2_constant) |
334 ultimately show "\<exists>A. (\<forall>i. open (A i) \<and> x $ i \<in> A i) \<and> |
336 done |
335 (\<forall>y. (\<forall>i. y $ i \<in> A i) \<longrightarrow> y \<in> S)" by metis |
|
336 qed |
|
337 qed |
337 qed |
338 qed |
338 |
339 |
339 end |
340 end |
340 |
341 |
341 lemma Cauchy_vec_nth: |
342 lemma Cauchy_vec_nth: |