| author | paulson |
| Tue, 03 Aug 1999 13:15:54 +0200 | |
| changeset 7165 | 8c937127fd8c |
| parent 7127 | 48e235179ffb |
| child 7219 | 4e3f386c2e37 |
| permissions | -rw-r--r-- |
| 5588 | 1 |
(* Title : Real/RealDef.thy |
2 |
Author : Jacques D. Fleuriot |
|
3 |
Copyright : 1998 University of Cambridge |
|
4 |
Description : The reals |
|
5 |
*) |
|
6 |
||
7 |
RealDef = PReal + |
|
8 |
||
9 |
constdefs |
|
10 |
realrel :: "((preal * preal) * (preal * preal)) set" |
|
11 |
"realrel == {p. ? x1 y1 x2 y2. p = ((x1,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, minus}
|
|
18 |
||
19 |
consts |
|
20 |
||
21 |
"0r" :: real ("0r")
|
|
22 |
"1r" :: real ("1r")
|
|
23 |
||
24 |
defs |
|
25 |
||
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5787
diff
changeset
|
26 |
real_zero_def |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5787
diff
changeset
|
27 |
"0r == Abs_real(realrel^^{(preal_of_prat(prat_of_pnat 1p),
|
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5787
diff
changeset
|
28 |
preal_of_prat(prat_of_pnat 1p))})" |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5787
diff
changeset
|
29 |
real_one_def |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5787
diff
changeset
|
30 |
"1r == Abs_real(realrel^^{(preal_of_prat(prat_of_pnat 1p) +
|
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5787
diff
changeset
|
31 |
preal_of_prat(prat_of_pnat 1p),preal_of_prat(prat_of_pnat 1p))})" |
| 5588 | 32 |
|
33 |
real_minus_def |
|
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5787
diff
changeset
|
34 |
"- R == Abs_real(UN (x,y):Rep_real(R). realrel^^{(y,x)})"
|
| 5588 | 35 |
|
|
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
36 |
real_diff_def "x - y == x + (- y :: real)" |
| 5588 | 37 |
|
38 |
constdefs |
|
39 |
||
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5787
diff
changeset
|
40 |
real_of_preal :: preal => real |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5787
diff
changeset
|
41 |
"real_of_preal m == |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5787
diff
changeset
|
42 |
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
|
43 |
preal_of_prat(prat_of_pnat 1p))})" |
| 5588 | 44 |
|
45 |
rinv :: real => real |
|
46 |
"rinv(R) == (@S. R ~= 0r & S*R = 1r)" |
|
47 |
||
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5787
diff
changeset
|
48 |
real_of_posnat :: nat => real |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5787
diff
changeset
|
49 |
"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
|
50 |
|
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5787
diff
changeset
|
51 |
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
|
52 |
"real_of_nat n == real_of_posnat n + (-1r)" |
| 5588 | 53 |
|
54 |
defs |
|
55 |
||
56 |
real_add_def |
|
57 |
"P + Q == Abs_real(UN p1:Rep_real(P). UN p2:Rep_real(Q). |
|
58 |
split(%x1 y1. split(%x2 y2. realrel^^{(x1+x2, y1+y2)}) p2) p1)"
|
|
59 |
||
60 |
real_mult_def |
|
61 |
"P * Q == Abs_real(UN p1:Rep_real(P). UN p2:Rep_real(Q). |
|
62 |
split(%x1 y1. split(%x2 y2. realrel^^{(x1*x2+y1*y2,x1*y2+x2*y1)}) p2) p1)"
|
|
63 |
||
64 |
real_less_def |
|
65 |
"P < Q == EX x1 y1 x2 y2. x1 + y2 < x2 + y1 & |
|
66 |
(x1,y1):Rep_real(P) & |
|
67 |
(x2,y2):Rep_real(Q)" |
|
68 |
real_le_def |
|
69 |
"P <= (Q::real) == ~(Q < P)" |
|
70 |
||
71 |
end |