src/HOL/Real/RealDef.thy
changeset 24506 020db6ec334a
parent 24198 4031da6d8ba3
child 24534 09b9a47904b7
equal deleted inserted replaced
24505:9e6d91f8bb73 24506:020db6ec334a
    63 lemmas [code func del] = real_le_def real_less_def
    63 lemmas [code func del] = real_le_def real_less_def
    64 
    64 
    65 instance real :: abs
    65 instance real :: abs
    66   real_abs_def:  "abs (r::real) == (if r < 0 then - r else r)" ..
    66   real_abs_def:  "abs (r::real) == (if r < 0 then - r else r)" ..
    67 
    67 
       
    68 instance real :: sgn
       
    69   real_sgn_def: "sgn x == (if x=0 then 0 else if 0<x then 1 else - 1)" ..
    68 
    70 
    69 subsection {* Equivalence relation over positive reals *}
    71 subsection {* Equivalence relation over positive reals *}
    70 
    72 
    71 lemma preal_trans_lemma:
    73 lemma preal_trans_lemma:
    72   assumes "x + y1 = x1 + y"
    74   assumes "x + y1 = x1 + y"
   410 proof
   412 proof
   411   fix x y z :: real
   413   fix x y z :: real
   412   show "x \<le> y ==> z + x \<le> z + y" by (rule real_add_left_mono)
   414   show "x \<le> y ==> z + x \<le> z + y" by (rule real_add_left_mono)
   413   show "x < y ==> 0 < z ==> z * x < z * y" by (rule real_mult_less_mono2)
   415   show "x < y ==> 0 < z ==> z * x < z * y" by (rule real_mult_less_mono2)
   414   show "\<bar>x\<bar> = (if x < 0 then -x else x)" by (simp only: real_abs_def)
   416   show "\<bar>x\<bar> = (if x < 0 then -x else x)" by (simp only: real_abs_def)
       
   417   show "sgn x = (if x=0 then 0 else if 0<x then 1 else - 1)"
       
   418     by (simp only: real_sgn_def)
   415 qed
   419 qed
   416 
   420 
   417 text{*The function @{term real_of_preal} requires many proofs, but it seems
   421 text{*The function @{term real_of_preal} requires many proofs, but it seems
   418 to be essential for proving completeness of the reals from that of the
   422 to be essential for proving completeness of the reals from that of the
   419 positive reals.*}
   423 positive reals.*}