src/HOL/RealDef.thy
changeset 35028 108662d50512
parent 33657 a4179bf442d1
child 35032 7efe662e41b4
equal deleted inserted replaced
35027:ed7d12bcf8f8 35028:108662d50512
   414 end
   414 end
   415 
   415 
   416 
   416 
   417 subsection{*The Reals Form an Ordered Field*}
   417 subsection{*The Reals Form an Ordered Field*}
   418 
   418 
   419 instance real :: ordered_field
   419 instance real :: linordered_field
   420 proof
   420 proof
   421   fix x y z :: real
   421   fix x y z :: real
   422   show "x \<le> y ==> z + x \<le> z + y" by (rule real_add_left_mono)
   422   show "x \<le> y ==> z + x \<le> z + y" by (rule real_add_left_mono)
   423   show "x < y ==> 0 < z ==> z * x < z * y" by (rule real_mult_less_mono2)
   423   show "x < y ==> 0 < z ==> z * x < z * y" by (rule real_mult_less_mono2)
   424   show "\<bar>x\<bar> = (if x < 0 then -x else x)" by (simp only: real_abs_def)
   424   show "\<bar>x\<bar> = (if x < 0 then -x else x)" by (simp only: real_abs_def)
   425   show "sgn x = (if x=0 then 0 else if 0<x then 1 else - 1)"
   425   show "sgn x = (if x=0 then 0 else if 0<x then 1 else - 1)"
   426     by (simp only: real_sgn_def)
   426     by (simp only: real_sgn_def)
   427 qed
   427 qed
   428 
   428 
   429 instance real :: lordered_ab_group_add ..
   429 instance real :: lattice_ab_group_add ..
   430 
   430 
   431 text{*The function @{term real_of_preal} requires many proofs, but it seems
   431 text{*The function @{term real_of_preal} requires many proofs, but it seems
   432 to be essential for proving completeness of the reals from that of the
   432 to be essential for proving completeness of the reals from that of the
   433 positive reals.*}
   433 positive reals.*}
   434 
   434 
  1044 by simp
  1044 by simp
  1045  
  1045  
  1046 lemma abs_sum_triangle_ineq: "abs ((x::real) + y + (-l + -m)) \<le> abs(x + -l) + abs(y + -m)"
  1046 lemma abs_sum_triangle_ineq: "abs ((x::real) + y + (-l + -m)) \<le> abs(x + -l) + abs(y + -m)"
  1047 by simp
  1047 by simp
  1048 
  1048 
  1049 instance real :: lordered_ring
  1049 instance real :: lattice_ring
  1050 proof
  1050 proof
  1051   fix a::real
  1051   fix a::real
  1052   show "abs a = sup a (-a)"
  1052   show "abs a = sup a (-a)"
  1053     by (auto simp add: real_abs_def sup_real_def)
  1053     by (auto simp add: real_abs_def sup_real_def)
  1054 qed
  1054 qed