185
|
1 |
(* Title: HOL/Prod.thy
|
|
2 |
ID: Prod.thy,v 1.5 1994/08/19 09:04:27 lcp Exp
|
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory
|
0
|
4 |
Copyright 1992 University of Cambridge
|
|
5 |
|
185
|
6 |
Ordered Pairs and the Cartesian product type.
|
|
7 |
The unit type.
|
0
|
8 |
*)
|
|
9 |
|
185
|
10 |
Prod = Fun +
|
|
11 |
|
|
12 |
(** Products **)
|
|
13 |
|
|
14 |
(* type definition *)
|
|
15 |
|
|
16 |
consts
|
|
17 |
Pair_Rep :: "['a, 'b] => ['a, 'b] => bool"
|
51
|
18 |
|
185
|
19 |
defs
|
|
20 |
Pair_Rep_def "Pair_Rep == (%a b. %x y. x=a & y=b)"
|
51
|
21 |
|
185
|
22 |
subtype (Prod)
|
|
23 |
('a, 'b) "*" (infixr 20)
|
|
24 |
= "{f. ? a b. f = Pair_Rep(a::'a, b::'b)}"
|
|
25 |
|
|
26 |
|
|
27 |
(* abstract constants and syntax *)
|
51
|
28 |
|
0
|
29 |
consts
|
185
|
30 |
fst :: "'a * 'b => 'a"
|
|
31 |
snd :: "'a * 'b => 'b"
|
|
32 |
split :: "[['a, 'b] => 'c, 'a * 'b] => 'c"
|
|
33 |
prod_fun :: "['a => 'b, 'c => 'd, 'a * 'c] => 'b * 'd"
|
|
34 |
Pair :: "['a, 'b] => 'a * 'b"
|
|
35 |
Sigma :: "['a set, 'a => 'b set] => ('a * 'b) set"
|
0
|
36 |
|
185
|
37 |
syntax
|
|
38 |
"@Tuple" :: "args => 'a * 'b" ("(1<_>)")
|
0
|
39 |
|
|
40 |
translations
|
185
|
41 |
"<x, y, z>" == "<x, <y, z>>"
|
|
42 |
"<x, y>" == "Pair(x, y)"
|
|
43 |
"<x>" => "x"
|
0
|
44 |
|
185
|
45 |
defs
|
|
46 |
Pair_def "Pair(a, b) == Abs_Prod(Pair_Rep(a, b))"
|
|
47 |
fst_def "fst(p) == @a. ? b. p = <a, b>"
|
|
48 |
snd_def "snd(p) == @b. ? a. p = <a, b>"
|
|
49 |
split_def "split(c, p) == c(fst(p), snd(p))"
|
|
50 |
prod_fun_def "prod_fun(f, g) == split(%x y.<f(x), g(y)>)"
|
|
51 |
Sigma_def "Sigma(A, B) == UN x:A. UN y:B(x). {<x, y>}"
|
0
|
52 |
|
|
53 |
|
185
|
54 |
|
|
55 |
(** Unit **)
|
|
56 |
|
|
57 |
subtype (Unit)
|
|
58 |
unit = "{p. p = True}"
|
0
|
59 |
|
185
|
60 |
consts
|
|
61 |
Unity :: "unit" ("<>")
|
|
62 |
|
|
63 |
defs
|
|
64 |
Unity_def "Unity == Abs_Unit(True)"
|
|
65 |
|
0
|
66 |
end
|