3 Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
3 Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
4 Copyright 1996 University of Cambridge |
4 Copyright 1996 University of Cambridge |
5 *) |
5 *) |
6 |
6 |
7 Relation = Prod + |
7 Relation = Prod + |
|
8 |
8 consts |
9 consts |
9 Id :: "('a * 'a)set" (*the identity relation*) |
10 O :: "[('b * 'c)set, ('a * 'b)set] => ('a * 'c)set" (infixr 60) |
10 O :: "[('b * 'c)set, ('a * 'b)set] => ('a * 'c)set" (infixr 60) |
11 converse :: "('a*'b) set => ('b*'a) set" ("(_^-1)" [1000] 999) |
11 converse :: "('a*'b) set => ('b*'a) set" ("(_^-1)" [1000] 999) |
12 "^^" :: "[('a*'b) set,'a set] => 'b set" (infixl 90) |
12 "^^" :: "[('a*'b) set,'a set] => 'b set" (infixl 90) |
13 |
13 Domain :: "('a*'b) set => 'a set" |
|
14 Range :: "('a*'b) set => 'b set" |
|
15 trans :: "('a * 'a)set => bool" (*transitivity predicate*) |
|
16 Univalent :: "('a * 'b)set => bool" |
|
17 defs |
14 defs |
18 Id_def "Id == {p. ? x. p = (x,x)}" |
15 comp_def "r O s == {(x,z). ? y. (x,y):s & (y,z):r}" |
19 comp_def "r O s == {(x,z). ? y. (x,y):s & (y,z):r}" |
16 converse_def "r^-1 == {(y,x). (x,y):r}" |
20 converse_def "r^-1 == {(y,x). (x,y):r}" |
17 Image_def "r ^^ s == {y. ? x:s. (x,y):r}" |
21 Domain_def "Domain(r) == {x. ? y. (x,y):r}" |
18 |
22 Range_def "Range(r) == Domain(r^-1)" |
19 constdefs |
23 Image_def "r ^^ s == {y. ? x:s. (x,y):r}" |
20 Id :: "('a * 'a)set" (*the identity relation*) |
24 trans_def "trans(r) == (!x y z. (x,y):r --> (y,z):r --> (x,z):r)" |
21 "Id == {p. ? x. p = (x,x)}" |
25 Univalent_def "Univalent r == !x y. (x,y):r --> (!z. (x,z):r --> y=z)" |
22 |
|
23 diag :: "'a set => ('a * 'a)set" |
|
24 "diag(A) == UN x:A. {(x,x)}" |
|
25 |
|
26 Domain :: "('a*'b) set => 'a set" |
|
27 "Domain(r) == {x. ? y. (x,y):r}" |
|
28 |
|
29 Range :: "('a*'b) set => 'b set" |
|
30 "Range(r) == Domain(r^-1)" |
|
31 |
|
32 trans :: "('a * 'a)set => bool" (*transitivity predicate*) |
|
33 "trans(r) == (!x y z. (x,y):r --> (y,z):r --> (x,z):r)" |
|
34 |
|
35 Univalent :: "('a * 'b)set => bool" |
|
36 "Univalent r == !x y. (x,y):r --> (!z. (x,z):r --> y=z)" |
|
37 |
26 end |
38 end |