author | bauerg |
Wed, 06 Dec 2000 12:34:12 +0100 | |
changeset 10606 | e3229a37d53f |
parent 9391 | a6ab3a442da6 |
child 10648 | a8c647cfa31f |
permissions | -rw-r--r-- |
5588 | 1 |
(* Title : Real/RealDef.thy |
7219 | 2 |
ID : $Id$ |
5588 | 3 |
Author : Jacques D. Fleuriot |
4 |
Copyright : 1998 University of Cambridge |
|
5 |
Description : The reals |
|
6 |
*) |
|
7 |
||
8 |
RealDef = PReal + |
|
9 |
||
10 |
constdefs |
|
11 |
realrel :: "((preal * preal) * (preal * preal)) set" |
|
12 |
"realrel == {p. ? x1 y1 x2 y2. p = ((x1,y1),(x2,y2)) & x1+y2 = x2+y1}" |
|
13 |
||
9391 | 14 |
typedef real = "UNIV//realrel" (Equiv.quotient_def) |
5588 | 15 |
|
16 |
||
17 |
instance |
|
10606 | 18 |
real :: {ord, zero, plus, times, minus, inverse} |
5588 | 19 |
|
20 |
consts |
|
21 |
||
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 |
10606 | 27 |
"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
|
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 |
10606 | 30 |
"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
|
31 |
preal_of_prat(prat_of_pnat 1p),preal_of_prat(prat_of_pnat 1p))})" |
5588 | 32 |
|
33 |
real_minus_def |
|
10606 | 34 |
"- R == Abs_real(UN (x,y):Rep_real(R). realrel^^{(y,x)})" |
35 |
||
36 |
real_diff_def |
|
37 |
"R - (S::real) == R + - S" |
|
5588 | 38 |
|
10606 | 39 |
real_inverse_def |
40 |
"inverse (R::real) == (@S. R ~= 0 & S*R = 1r)" |
|
5588 | 41 |
|
10606 | 42 |
real_divide_def |
43 |
"R / (S::real) == R * inverse S" |
|
44 |
||
5588 | 45 |
constdefs |
46 |
||
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5787
diff
changeset
|
47 |
real_of_preal :: preal => real |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5787
diff
changeset
|
48 |
"real_of_preal m == |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5787
diff
changeset
|
49 |
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
|
50 |
preal_of_prat(prat_of_pnat 1p))})" |
5588 | 51 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5787
diff
changeset
|
52 |
real_of_posnat :: nat => real |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5787
diff
changeset
|
53 |
"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
|
54 |
|
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5787
diff
changeset
|
55 |
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
|
56 |
"real_of_nat n == real_of_posnat n + (-1r)" |
5588 | 57 |
|
58 |
defs |
|
59 |
||
60 |
real_add_def |
|
61 |
"P + Q == Abs_real(UN p1:Rep_real(P). UN p2:Rep_real(Q). |
|
9365 | 62 |
(%(x1,y1). (%(x2,y2). realrel^^{(x1+x2, y1+y2)}) p2) p1)" |
5588 | 63 |
|
64 |
real_mult_def |
|
65 |
"P * Q == Abs_real(UN p1:Rep_real(P). UN p2:Rep_real(Q). |
|
9365 | 66 |
(%(x1,y1). (%(x2,y2). realrel^^{(x1*x2+y1*y2,x1*y2+x2*y1)}) p2) p1)" |
5588 | 67 |
|
68 |
real_less_def |
|
69 |
"P < Q == EX x1 y1 x2 y2. x1 + y2 < x2 + y1 & |
|
70 |
(x1,y1):Rep_real(P) & |
|
71 |
(x2,y2):Rep_real(Q)" |
|
72 |
real_le_def |
|
73 |
"P <= (Q::real) == ~(Q < P)" |
|
74 |
||
75 |
end |