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