src/HOL/Real/RealDef.thy
author paulson
Sat, 30 Dec 2000 22:13:18 +0100
changeset 10752 c4f1bf2acf4c
parent 10648 a8c647cfa31f
child 10778 2c6605049646
permissions -rw-r--r--
tidying, and separation of HOL-Hyperreal from HOL-Real
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5588
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
     1
(*  Title       : Real/RealDef.thy
7219
4e3f386c2e37 inserted Id: lines
paulson
parents: 7127
diff changeset
     2
    ID          : $Id$
5588
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
     3
    Author      : Jacques D. Fleuriot
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
     4
    Copyright   : 1998  University of Cambridge
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
     5
    Description : The reals
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
     6
*) 
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
     7
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
     8
RealDef = PReal +
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
     9
10752
c4f1bf2acf4c tidying, and separation of HOL-Hyperreal from HOL-Real
paulson
parents: 10648
diff changeset
    10
instance preal :: order (preal_le_refl,preal_le_trans,preal_le_anti_sym,
c4f1bf2acf4c tidying, and separation of HOL-Hyperreal from HOL-Real
paulson
parents: 10648
diff changeset
    11
                         preal_less_le)
c4f1bf2acf4c tidying, and separation of HOL-Hyperreal from HOL-Real
paulson
parents: 10648
diff changeset
    12
5588
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    13
constdefs
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    14
  realrel   ::  "((preal * preal) * (preal * preal)) set"
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    15
  "realrel == {p. ? x1 y1 x2 y2. p = ((x1,y1),(x2,y2)) & x1+y2 = x2+y1}" 
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    16
9391
a6ab3a442da6 changed / to // for quotienting; general tidying
paulson
parents: 9365
diff changeset
    17
typedef real = "UNIV//realrel"  (Equiv.quotient_def)
5588
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    18
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    19
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    20
instance
10606
e3229a37d53f converted rinv to inverse;
bauerg
parents: 9391
diff changeset
    21
   real  :: {ord, zero, plus, times, minus, inverse}
5588
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    22
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    23
consts 
10752
c4f1bf2acf4c tidying, and separation of HOL-Hyperreal from HOL-Real
paulson
parents: 10648
diff changeset
    24
  "1r"   :: real               ("1r")  
5588
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    25
10752
c4f1bf2acf4c tidying, and separation of HOL-Hyperreal from HOL-Real
paulson
parents: 10648
diff changeset
    26
   (*Overloaded constant: denotes the Real subset of enclosing types such as
c4f1bf2acf4c tidying, and separation of HOL-Hyperreal from HOL-Real
paulson
parents: 10648
diff changeset
    27
     hypreal and complex*)
c4f1bf2acf4c tidying, and separation of HOL-Hyperreal from HOL-Real
paulson
parents: 10648
diff changeset
    28
   SReal :: "'a set"
5588
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    29
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    30
defs
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    31
7077
60b098bb8b8a heavily revised by Jacques: coercions have alphabetic names;
paulson
parents: 5787
diff changeset
    32
  real_zero_def  
10606
e3229a37d53f converted rinv to inverse;
bauerg
parents: 9391
diff changeset
    33
  "0 == Abs_real(realrel^^{(preal_of_prat(prat_of_pnat 1p),
7077
60b098bb8b8a heavily revised by Jacques: coercions have alphabetic names;
paulson
parents: 5787
diff changeset
    34
                                preal_of_prat(prat_of_pnat 1p))})"
60b098bb8b8a heavily revised by Jacques: coercions have alphabetic names;
paulson
parents: 5787
diff changeset
    35
  real_one_def   
10606
e3229a37d53f converted rinv to inverse;
bauerg
parents: 9391
diff changeset
    36
  "1r == Abs_real(realrel^^{(preal_of_prat(prat_of_pnat 1p) + 
7077
60b098bb8b8a heavily revised by Jacques: coercions have alphabetic names;
paulson
parents: 5787
diff changeset
    37
            preal_of_prat(prat_of_pnat 1p),preal_of_prat(prat_of_pnat 1p))})"
5588
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    38
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    39
  real_minus_def
10606
e3229a37d53f converted rinv to inverse;
bauerg
parents: 9391
diff changeset
    40
  "- R ==  Abs_real(UN (x,y):Rep_real(R). realrel^^{(y,x)})"
e3229a37d53f converted rinv to inverse;
bauerg
parents: 9391
diff changeset
    41
e3229a37d53f converted rinv to inverse;
bauerg
parents: 9391
diff changeset
    42
  real_diff_def
e3229a37d53f converted rinv to inverse;
bauerg
parents: 9391
diff changeset
    43
  "R - (S::real) == R + - S"
5588
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    44
10606
e3229a37d53f converted rinv to inverse;
bauerg
parents: 9391
diff changeset
    45
  real_inverse_def
10648
a8c647cfa31f first stage in tidying up Real and Hyperreal.
paulson
parents: 10606
diff changeset
    46
  "inverse (R::real) == (SOME S. (R = 0 & S = 0) | S * R = 1r)"
5588
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    47
10606
e3229a37d53f converted rinv to inverse;
bauerg
parents: 9391
diff changeset
    48
  real_divide_def
e3229a37d53f converted rinv to inverse;
bauerg
parents: 9391
diff changeset
    49
  "R / (S::real) == R * inverse S"
e3229a37d53f converted rinv to inverse;
bauerg
parents: 9391
diff changeset
    50
  
5588
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    51
constdefs
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    52
7077
60b098bb8b8a heavily revised by Jacques: coercions have alphabetic names;
paulson
parents: 5787
diff changeset
    53
  real_of_preal :: preal => real            
60b098bb8b8a heavily revised by Jacques: coercions have alphabetic names;
paulson
parents: 5787
diff changeset
    54
  "real_of_preal m     ==
60b098bb8b8a heavily revised by Jacques: coercions have alphabetic names;
paulson
parents: 5787
diff changeset
    55
           Abs_real(realrel^^{(m+preal_of_prat(prat_of_pnat 1p),
60b098bb8b8a heavily revised by Jacques: coercions have alphabetic names;
paulson
parents: 5787
diff changeset
    56
                               preal_of_prat(prat_of_pnat 1p))})"
5588
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    57
7077
60b098bb8b8a heavily revised by Jacques: coercions have alphabetic names;
paulson
parents: 5787
diff changeset
    58
  real_of_posnat :: nat => real             
60b098bb8b8a heavily revised by Jacques: coercions have alphabetic names;
paulson
parents: 5787
diff changeset
    59
  "real_of_posnat n == real_of_preal(preal_of_prat(prat_of_pnat(pnat_of_nat n)))"
60b098bb8b8a heavily revised by Jacques: coercions have alphabetic names;
paulson
parents: 5787
diff changeset
    60
60b098bb8b8a heavily revised by Jacques: coercions have alphabetic names;
paulson
parents: 5787
diff changeset
    61
  real_of_nat :: nat => real          
7127
48e235179ffb added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents: 7077
diff changeset
    62
  "real_of_nat n    == real_of_posnat n + (-1r)"
5588
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    63
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    64
defs
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    65
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    66
  real_add_def  
10752
c4f1bf2acf4c tidying, and separation of HOL-Hyperreal from HOL-Real
paulson
parents: 10648
diff changeset
    67
  "P+Q == Abs_real(UN p1:Rep_real(P). UN p2:Rep_real(Q).
c4f1bf2acf4c tidying, and separation of HOL-Hyperreal from HOL-Real
paulson
parents: 10648
diff changeset
    68
                   (%(x1,y1). (%(x2,y2). realrel^^{(x1+x2, y1+y2)}) p2) p1)"
5588
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    69
  
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    70
  real_mult_def  
10752
c4f1bf2acf4c tidying, and separation of HOL-Hyperreal from HOL-Real
paulson
parents: 10648
diff changeset
    71
  "P*Q == Abs_real(UN p1:Rep_real(P). UN p2:Rep_real(Q).
c4f1bf2acf4c tidying, and separation of HOL-Hyperreal from HOL-Real
paulson
parents: 10648
diff changeset
    72
                   (%(x1,y1). (%(x2,y2). realrel^^{(x1*x2+y1*y2,x1*y2+x2*y1)})
c4f1bf2acf4c tidying, and separation of HOL-Hyperreal from HOL-Real
paulson
parents: 10648
diff changeset
    73
		   p2) p1)"
5588
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    74
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    75
  real_less_def
10752
c4f1bf2acf4c tidying, and separation of HOL-Hyperreal from HOL-Real
paulson
parents: 10648
diff changeset
    76
  "P<Q == EX x1 y1 x2 y2. x1 + y2 < x2 + y1 & 
c4f1bf2acf4c tidying, and separation of HOL-Hyperreal from HOL-Real
paulson
parents: 10648
diff changeset
    77
                            (x1,y1):Rep_real(P) & (x2,y2):Rep_real(Q)" 
5588
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    78
  real_le_def
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    79
  "P <= (Q::real) == ~(Q < P)"
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    80
10752
c4f1bf2acf4c tidying, and separation of HOL-Hyperreal from HOL-Real
paulson
parents: 10648
diff changeset
    81
syntax (symbols)
c4f1bf2acf4c tidying, and separation of HOL-Hyperreal from HOL-Real
paulson
parents: 10648
diff changeset
    82
  SReal     :: "'a set"                   ("\\<real>")
c4f1bf2acf4c tidying, and separation of HOL-Hyperreal from HOL-Real
paulson
parents: 10648
diff changeset
    83
5588
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    84
end