src/HOL/Real/RealDef.thy
author paulson
Mon Aug 16 18:41:32 1999 +0200 (1999-08-16)
changeset 7219 4e3f386c2e37
parent 7127 48e235179ffb
child 9043 ca761fe227d8
permissions -rw-r--r--
inserted Id: lines
paulson@5588
     1
(*  Title       : Real/RealDef.thy
paulson@7219
     2
    ID          : $Id$
paulson@5588
     3
    Author      : Jacques D. Fleuriot
paulson@5588
     4
    Copyright   : 1998  University of Cambridge
paulson@5588
     5
    Description : The reals
paulson@5588
     6
*) 
paulson@5588
     7
paulson@5588
     8
RealDef = PReal +
paulson@5588
     9
paulson@5588
    10
constdefs
paulson@5588
    11
  realrel   ::  "((preal * preal) * (preal * preal)) set"
paulson@5588
    12
  "realrel == {p. ? x1 y1 x2 y2. p = ((x1,y1),(x2,y2)) & x1+y2 = x2+y1}" 
paulson@5588
    13
paulson@5588
    14
typedef real = "{x::(preal*preal).True}/realrel"          (Equiv.quotient_def)
paulson@5588
    15
paulson@5588
    16
paulson@5588
    17
instance
paulson@5588
    18
   real  :: {ord, plus, times, minus}
paulson@5588
    19
paulson@5588
    20
consts 
paulson@5588
    21
paulson@5588
    22
  "0r"       :: real               ("0r")   
paulson@5588
    23
  "1r"       :: real               ("1r")  
paulson@5588
    24
paulson@5588
    25
defs
paulson@5588
    26
paulson@7077
    27
  real_zero_def  
paulson@7077
    28
     "0r == Abs_real(realrel^^{(preal_of_prat(prat_of_pnat 1p),
paulson@7077
    29
                                preal_of_prat(prat_of_pnat 1p))})"
paulson@7077
    30
  real_one_def   
paulson@7077
    31
     "1r == Abs_real(realrel^^{(preal_of_prat(prat_of_pnat 1p) + 
paulson@7077
    32
            preal_of_prat(prat_of_pnat 1p),preal_of_prat(prat_of_pnat 1p))})"
paulson@5588
    33
paulson@5588
    34
  real_minus_def
paulson@7077
    35
    "- R ==  Abs_real(UN (x,y):Rep_real(R). realrel^^{(y,x)})"
paulson@5588
    36
paulson@7127
    37
  real_diff_def "x - y == x + (- y :: real)"
paulson@5588
    38
paulson@5588
    39
constdefs
paulson@5588
    40
paulson@7077
    41
  real_of_preal :: preal => real            
paulson@7077
    42
  "real_of_preal m     ==
paulson@7077
    43
           Abs_real(realrel^^{(m+preal_of_prat(prat_of_pnat 1p),
paulson@7077
    44
                               preal_of_prat(prat_of_pnat 1p))})"
paulson@5588
    45
paulson@5588
    46
  rinv       :: real => real
paulson@5588
    47
  "rinv(R)   == (@S. R ~= 0r & S*R = 1r)"
paulson@5588
    48
paulson@7077
    49
  real_of_posnat :: nat => real             
paulson@7077
    50
  "real_of_posnat n == real_of_preal(preal_of_prat(prat_of_pnat(pnat_of_nat n)))"
paulson@7077
    51
paulson@7077
    52
  real_of_nat :: nat => real          
paulson@7127
    53
  "real_of_nat n    == real_of_posnat n + (-1r)"
paulson@5588
    54
paulson@5588
    55
defs
paulson@5588
    56
paulson@5588
    57
  real_add_def  
paulson@5588
    58
  "P + Q == Abs_real(UN p1:Rep_real(P). UN p2:Rep_real(Q).
paulson@5588
    59
                split(%x1 y1. split(%x2 y2. realrel^^{(x1+x2, y1+y2)}) p2) p1)"
paulson@5588
    60
  
paulson@5588
    61
  real_mult_def  
paulson@5588
    62
  "P * Q == Abs_real(UN p1:Rep_real(P). UN p2:Rep_real(Q).
paulson@5588
    63
                split(%x1 y1. split(%x2 y2. realrel^^{(x1*x2+y1*y2,x1*y2+x2*y1)}) p2) p1)"
paulson@5588
    64
paulson@5588
    65
  real_less_def
paulson@5588
    66
  "P < Q == EX x1 y1 x2 y2. x1 + y2 < x2 + y1 & 
paulson@5588
    67
                                   (x1,y1):Rep_real(P) &
paulson@5588
    68
                                   (x2,y2):Rep_real(Q)" 
paulson@5588
    69
  real_le_def
paulson@5588
    70
  "P <= (Q::real) == ~(Q < P)"
paulson@5588
    71
paulson@5588
    72
end