src/HOL/Real/RealDef.thy
author paulson
Thu Oct 01 18:18:01 1998 +0200 (1998-10-01)
changeset 5588 a3ab526bb891
child 5787 4e5c74b7cd9e
permissions -rw-r--r--
Revised version with Abelian group simprocs
paulson@5588
     1
(*  Title       : Real/RealDef.thy
paulson@5588
     2
    Author      : Jacques D. Fleuriot
paulson@5588
     3
    Copyright   : 1998  University of Cambridge
paulson@5588
     4
    Description : The reals
paulson@5588
     5
*) 
paulson@5588
     6
paulson@5588
     7
RealDef = PReal +
paulson@5588
     8
paulson@5588
     9
constdefs
paulson@5588
    10
  realrel   ::  "((preal * preal) * (preal * preal)) set"
paulson@5588
    11
  "realrel == {p. ? x1 y1 x2 y2. p = ((x1,y1),(x2,y2)) & x1+y2 = x2+y1}" 
paulson@5588
    12
paulson@5588
    13
typedef real = "{x::(preal*preal).True}/realrel"          (Equiv.quotient_def)
paulson@5588
    14
paulson@5588
    15
paulson@5588
    16
instance
paulson@5588
    17
   real  :: {ord, plus, times, minus}
paulson@5588
    18
paulson@5588
    19
consts 
paulson@5588
    20
paulson@5588
    21
  "0r"       :: real               ("0r")   
paulson@5588
    22
  "1r"       :: real               ("1r")  
paulson@5588
    23
paulson@5588
    24
defs
paulson@5588
    25
paulson@5588
    26
  real_zero_def  "0r == Abs_real(realrel^^{(@#($#1p),@#($#1p))})"
paulson@5588
    27
  real_one_def   "1r == Abs_real(realrel^^{(@#($#1p) + @#($#1p),@#($#1p))})"
paulson@5588
    28
paulson@5588
    29
  real_minus_def
paulson@5588
    30
    "- R ==  Abs_real(UN p:Rep_real(R). split (%x y. realrel^^{(y,x)}) p)"
paulson@5588
    31
paulson@5588
    32
  real_diff_def "x - y == x + -(y::real)"
paulson@5588
    33
paulson@5588
    34
constdefs
paulson@5588
    35
paulson@5588
    36
  real_preal :: preal => real              ("%#_" [80] 80)
paulson@5588
    37
  "%# m     == Abs_real(realrel^^{(m+@#($#1p),@#($#1p))})"
paulson@5588
    38
paulson@5588
    39
  rinv       :: real => real
paulson@5588
    40
  "rinv(R)   == (@S. R ~= 0r & S*R = 1r)"
paulson@5588
    41
paulson@5588
    42
  real_nat :: nat => real                  ("%%# _" [80] 80) 
paulson@5588
    43
  "%%# n      == %#(@#($#(*# n)))"
paulson@5588
    44
paulson@5588
    45
defs
paulson@5588
    46
paulson@5588
    47
  real_add_def  
paulson@5588
    48
  "P + Q == Abs_real(UN p1:Rep_real(P). UN p2:Rep_real(Q).
paulson@5588
    49
                split(%x1 y1. split(%x2 y2. realrel^^{(x1+x2, y1+y2)}) p2) p1)"
paulson@5588
    50
  
paulson@5588
    51
  real_mult_def  
paulson@5588
    52
  "P * Q == Abs_real(UN p1:Rep_real(P). UN p2:Rep_real(Q).
paulson@5588
    53
                split(%x1 y1. split(%x2 y2. realrel^^{(x1*x2+y1*y2,x1*y2+x2*y1)}) p2) p1)"
paulson@5588
    54
paulson@5588
    55
  real_less_def
paulson@5588
    56
  "P < Q == EX x1 y1 x2 y2. x1 + y2 < x2 + y1 & 
paulson@5588
    57
                                   (x1,y1):Rep_real(P) &
paulson@5588
    58
                                   (x2,y2):Rep_real(Q)" 
paulson@5588
    59
  real_le_def
paulson@5588
    60
  "P <= (Q::real) == ~(Q < P)"
paulson@5588
    61
paulson@5588
    62
end