src/HOL/RealVector.thy
changeset 31446 2d91b2416de8
parent 31419 74fc28c5d68c
child 31490 c350f3ad6b0d
equal deleted inserted replaced
31445:c8a474a919a7 31446:2d91b2416de8
   731   fix x y z :: 'a show "dist x y \<le> dist x z + dist y z"
   731   fix x y z :: 'a show "dist x y \<le> dist x z + dist y z"
   732     unfolding dist_norm
   732     unfolding dist_norm
   733     using norm_triangle_ineq4 [of "x - z" "y - z"] by simp
   733     using norm_triangle_ineq4 [of "x - z" "y - z"] by simp
   734 qed
   734 qed
   735 
   735 
       
   736 subsection {* Extra type constraints *}
       
   737 
       
   738 text {* Only allow @{term dist} in class @{text metric_space}. *}
       
   739 
       
   740 setup {* Sign.add_const_constraint
       
   741   (@{const_name dist}, SOME @{typ "'a::metric_space \<Rightarrow> 'a \<Rightarrow> real"}) *}
       
   742 
       
   743 text {* Only allow @{term norm} in class @{text real_normed_vector}. *}
       
   744 
       
   745 setup {* Sign.add_const_constraint
       
   746   (@{const_name norm}, SOME @{typ "'a::real_normed_vector \<Rightarrow> real"}) *}
       
   747 
   736 
   748 
   737 subsection {* Sign function *}
   749 subsection {* Sign function *}
   738 
   750 
   739 lemma norm_sgn:
   751 lemma norm_sgn:
   740   "norm (sgn(x::'a::real_normed_vector)) = (if x = 0 then 0 else 1)"
   752   "norm (sgn(x::'a::real_normed_vector)) = (if x = 0 then 0 else 1)"