author | paulson |
Fri, 23 Jul 1999 17:29:12 +0200 | |
changeset 7077 | 60b098bb8b8a |
parent 5078 | 7b5ea59c0275 |
child 7219 | 4e3f386c2e37 |
permissions | -rw-r--r-- |
5078 | 1 |
(* Title : PRat.thy |
2 |
Author : Jacques D. Fleuriot |
|
3 |
Copyright : 1998 University of Cambridge |
|
4 |
Description : The positive rationals |
|
5 |
*) |
|
6 |
||
7 |
PRat = PNat + Equiv + |
|
8 |
||
9 |
constdefs |
|
10 |
ratrel :: "((pnat * pnat) * (pnat * pnat)) set" |
|
11 |
"ratrel == {p. ? x1 y1 x2 y2. p=((x1::pnat,y1),(x2,y2)) & x1*y2 = x2*y1}" |
|
12 |
||
13 |
typedef prat = "{x::(pnat*pnat).True}/ratrel" (Equiv.quotient_def) |
|
14 |
||
15 |
instance |
|
16 |
prat :: {ord,plus,times} |
|
17 |
||
18 |
||
19 |
constdefs |
|
20 |
||
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5078
diff
changeset
|
21 |
prat_of_pnat :: pnat => prat |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5078
diff
changeset
|
22 |
"prat_of_pnat m == Abs_prat(ratrel^^{(m,Abs_pnat 1)})" |
5078 | 23 |
|
24 |
qinv :: prat => prat |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5078
diff
changeset
|
25 |
"qinv(Q) == Abs_prat(UN (x,y):Rep_prat(Q). ratrel^^{(y,x)})" |
5078 | 26 |
|
27 |
defs |
|
28 |
||
29 |
prat_add_def |
|
30 |
"P + Q == Abs_prat(UN p1:Rep_prat(P). UN p2:Rep_prat(Q). |
|
31 |
split(%x1 y1. split(%x2 y2. ratrel^^{(x1*y2 + x2*y1, y1*y2)}) p2) p1)" |
|
32 |
||
33 |
prat_mult_def |
|
34 |
"P * Q == Abs_prat(UN p1:Rep_prat(P). UN p2:Rep_prat(Q). |
|
35 |
split(%x1 y1. split(%x2 y2. ratrel^^{(x1*x2, y1*y2)}) p2) p1)" |
|
36 |
||
37 |
(*** Gleason p. 119 ***) |
|
38 |
prat_less_def |
|
39 |
"P < (Q::prat) == ? T. P + T = Q" |
|
40 |
||
41 |
prat_le_def |
|
42 |
"P <= (Q::prat) == ~(Q < P)" |
|
43 |
||
44 |
end |
|
45 |
||
46 |
||
47 |
||
48 |
||
49 |