src/HOL/Real/RealDef.thy
author wenzelm
Fri, 09 Nov 2001 00:09:47 +0100
changeset 12114 a8e860c86252
parent 12018 ec054019c910
child 13487 1291c6375c29
permissions -rw-r--r--
eliminated old "symbols" syntax, use "xsymbols" instead;
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"
10919
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10834
diff changeset
    15
  "realrel == {p. EX x1 y1 x2 y2. p = ((x1,y1),(x2,y2)) & x1+y2 = x2+y1}" 
5588
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    16
10919
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10834
diff changeset
    17
typedef (REAL)
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10834
diff changeset
    18
  real = "UNIV//realrel"  (Equiv.quotient_def)
5588
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    19
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    20
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    21
instance
11713
883d559b0b8c sane numerals (stage 3): provide generic "1" on all number types;
wenzelm
parents: 11701
diff changeset
    22
   real  :: {ord, zero, one, plus, times, minus, inverse}
5588
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    23
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    24
consts 
10778
2c6605049646 more tidying, especially to remove real_of_posnat
paulson
parents: 10752
diff changeset
    25
   (*Overloaded constants denoting the Nat and Real subsets of enclosing
2c6605049646 more tidying, especially to remove real_of_posnat
paulson
parents: 10752
diff changeset
    26
     types such as hypreal and complex*)
10919
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10834
diff changeset
    27
   Nats, Reals :: "'a set"
10778
2c6605049646 more tidying, especially to remove real_of_posnat
paulson
parents: 10752
diff changeset
    28
  
10919
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10834
diff changeset
    29
   (*overloaded constant for injecting other types into "real"*)
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10834
diff changeset
    30
   real :: 'a => real
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10834
diff changeset
    31
5588
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    32
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    33
defs
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    34
7077
60b098bb8b8a heavily revised by Jacques: coercions have alphabetic names;
paulson
parents: 5787
diff changeset
    35
  real_zero_def  
12018
ec054019c910 Numerals and simprocs for types real and hypreal. The abstract
paulson
parents: 11713
diff changeset
    36
  "0 == Abs_REAL(realrel``{(preal_of_prat(prat_of_pnat 1),
ec054019c910 Numerals and simprocs for types real and hypreal. The abstract
paulson
parents: 11713
diff changeset
    37
			    preal_of_prat(prat_of_pnat 1))})"
ec054019c910 Numerals and simprocs for types real and hypreal. The abstract
paulson
parents: 11713
diff changeset
    38
7077
60b098bb8b8a heavily revised by Jacques: coercions have alphabetic names;
paulson
parents: 5787
diff changeset
    39
  real_one_def   
12018
ec054019c910 Numerals and simprocs for types real and hypreal. The abstract
paulson
parents: 11713
diff changeset
    40
  "1 == Abs_REAL(realrel``
ec054019c910 Numerals and simprocs for types real and hypreal. The abstract
paulson
parents: 11713
diff changeset
    41
               {(preal_of_prat(prat_of_pnat 1) + preal_of_prat(prat_of_pnat 1),
ec054019c910 Numerals and simprocs for types real and hypreal. The abstract
paulson
parents: 11713
diff changeset
    42
		 preal_of_prat(prat_of_pnat 1))})"
5588
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    43
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    44
  real_minus_def
10919
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10834
diff changeset
    45
  "- R ==  Abs_REAL(UN (x,y):Rep_REAL(R). realrel``{(y,x)})"
10606
e3229a37d53f converted rinv to inverse;
bauerg
parents: 9391
diff changeset
    46
e3229a37d53f converted rinv to inverse;
bauerg
parents: 9391
diff changeset
    47
  real_diff_def
e3229a37d53f converted rinv to inverse;
bauerg
parents: 9391
diff changeset
    48
  "R - (S::real) == R + - S"
5588
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    49
10606
e3229a37d53f converted rinv to inverse;
bauerg
parents: 9391
diff changeset
    50
  real_inverse_def
11713
883d559b0b8c sane numerals (stage 3): provide generic "1" on all number types;
wenzelm
parents: 11701
diff changeset
    51
  "inverse (R::real) == (SOME S. (R = 0 & S = 0) | S * R = 1)"
5588
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    52
10606
e3229a37d53f converted rinv to inverse;
bauerg
parents: 9391
diff changeset
    53
  real_divide_def
e3229a37d53f converted rinv to inverse;
bauerg
parents: 9391
diff changeset
    54
  "R / (S::real) == R * inverse S"
e3229a37d53f converted rinv to inverse;
bauerg
parents: 9391
diff changeset
    55
  
5588
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    56
constdefs
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    57
12018
ec054019c910 Numerals and simprocs for types real and hypreal. The abstract
paulson
parents: 11713
diff changeset
    58
  (** these don't use the overloaded "real" function: users don't see them **)
10919
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10834
diff changeset
    59
  
7077
60b098bb8b8a heavily revised by Jacques: coercions have alphabetic names;
paulson
parents: 5787
diff changeset
    60
  real_of_preal :: preal => real            
60b098bb8b8a heavily revised by Jacques: coercions have alphabetic names;
paulson
parents: 5787
diff changeset
    61
  "real_of_preal m     ==
12018
ec054019c910 Numerals and simprocs for types real and hypreal. The abstract
paulson
parents: 11713
diff changeset
    62
           Abs_REAL(realrel``{(m + preal_of_prat(prat_of_pnat 1),
ec054019c910 Numerals and simprocs for types real and hypreal. The abstract
paulson
parents: 11713
diff changeset
    63
                               preal_of_prat(prat_of_pnat 1))})"
5588
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    64
7077
60b098bb8b8a heavily revised by Jacques: coercions have alphabetic names;
paulson
parents: 5787
diff changeset
    65
  real_of_posnat :: nat => real             
60b098bb8b8a heavily revised by Jacques: coercions have alphabetic names;
paulson
parents: 5787
diff changeset
    66
  "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
    67
5588
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    68
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    69
defs
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    70
10919
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10834
diff changeset
    71
  (*overloaded*)
11713
883d559b0b8c sane numerals (stage 3): provide generic "1" on all number types;
wenzelm
parents: 11701
diff changeset
    72
  real_of_nat_def   "real n == real_of_posnat n + (- 1)"
10919
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10834
diff changeset
    73
5588
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    74
  real_add_def  
10919
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10834
diff changeset
    75
  "P+Q == Abs_REAL(UN p1:Rep_REAL(P). UN p2:Rep_REAL(Q).
10834
a7897aebbffc *** empty log message ***
nipkow
parents: 10797
diff changeset
    76
                   (%(x1,y1). (%(x2,y2). realrel``{(x1+x2, y1+y2)}) p2) p1)"
5588
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    77
  
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    78
  real_mult_def  
10919
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10834
diff changeset
    79
  "P*Q == Abs_REAL(UN p1:Rep_REAL(P). UN p2:Rep_REAL(Q).
10834
a7897aebbffc *** empty log message ***
nipkow
parents: 10797
diff changeset
    80
                   (%(x1,y1). (%(x2,y2). realrel``{(x1*x2+y1*y2,x1*y2+x2*y1)})
10752
c4f1bf2acf4c tidying, and separation of HOL-Hyperreal from HOL-Real
paulson
parents: 10648
diff changeset
    81
		   p2) p1)"
5588
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    82
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    83
  real_less_def
10752
c4f1bf2acf4c tidying, and separation of HOL-Hyperreal from HOL-Real
paulson
parents: 10648
diff changeset
    84
  "P<Q == EX x1 y1 x2 y2. x1 + y2 < x2 + y1 & 
10919
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10834
diff changeset
    85
                            (x1,y1):Rep_REAL(P) & (x2,y2):Rep_REAL(Q)" 
5588
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    86
  real_le_def
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    87
  "P <= (Q::real) == ~(Q < P)"
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    88
12114
a8e860c86252 eliminated old "symbols" syntax, use "xsymbols" instead;
wenzelm
parents: 12018
diff changeset
    89
syntax (xsymbols)
10919
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10834
diff changeset
    90
  Reals     :: "'a set"                   ("\\<real>")
144ede948e58 renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents: 10834
diff changeset
    91
  Nats      :: "'a set"                   ("\\<nat>")
10752
c4f1bf2acf4c tidying, and separation of HOL-Hyperreal from HOL-Real
paulson
parents: 10648
diff changeset
    92
5588
a3ab526bb891 Revised version with Abelian group simprocs
paulson
parents:
diff changeset
    93
end