src/HOL/Library/Euclidean_Space.thy
changeset 31417 c12b25b7f015
parent 31416 f4c079225845
child 31445 c8a474a919a7
equal deleted inserted replaced
31416:f4c079225845 31417:c12b25b7f015
   504 begin
   504 begin
   505 
   505 
   506 definition dist_vector_def:
   506 definition dist_vector_def:
   507   "dist (x::'a^'b) (y::'a^'b) = setL2 (\<lambda>i. dist (x$i) (y$i)) UNIV"
   507   "dist (x::'a^'b) (y::'a^'b) = setL2 (\<lambda>i. dist (x$i) (y$i)) UNIV"
   508 
   508 
   509 definition open_vector_def:
   509 definition topo_vector_def:
   510   "open S = (\<forall>x\<in>S. \<exists>e>0. \<forall>y::'a ^ 'b. dist y x < e \<longrightarrow> y \<in> S)"
   510   "topo = {S::('a ^ 'b) set. \<forall>x\<in>S. \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> S}"
   511 
   511 
   512 instance proof
   512 instance proof
   513   fix x y :: "'a ^ 'b"
   513   fix x y :: "'a ^ 'b"
   514   show "dist x y = 0 \<longleftrightarrow> x = y"
   514   show "dist x y = 0 \<longleftrightarrow> x = y"
   515     unfolding dist_vector_def
   515     unfolding dist_vector_def
   520     unfolding dist_vector_def
   520     unfolding dist_vector_def
   521     apply (rule order_trans [OF _ setL2_triangle_ineq])
   521     apply (rule order_trans [OF _ setL2_triangle_ineq])
   522     apply (simp add: setL2_mono dist_triangle2)
   522     apply (simp add: setL2_mono dist_triangle2)
   523     done
   523     done
   524 next
   524 next
   525   fix S :: "('a ^ 'b) set"
   525   show "topo = {S::('a ^ 'b) set. \<forall>x\<in>S. \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> S}"
   526   show "open S = (\<forall>x\<in>S. \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> S)"
   526     by (rule topo_vector_def)
   527     by (rule open_vector_def)
       
   528 qed
   527 qed
   529 
   528 
   530 end
   529 end
   531 
   530 
   532 lemma dist_nth_le: "dist (x $ i) (y $ i) \<le> dist x y"
   531 lemma dist_nth_le: "dist (x $ i) (y $ i) \<le> dist x y"