| author | clasohm |
| Fri, 08 Mar 1996 13:11:09 +0100 | |
| changeset 1558 | 9c6ebfab4e05 |
| parent 1475 | 7f5a4cd08209 |
| child 1636 | e18416e3e1d4 |
| permissions | -rw-r--r-- |
| 923 | 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 |
|
4 |
Copyright 1992 University of Cambridge |
|
5 |
||
6 |
Ordered Pairs and the Cartesian product type. |
|
7 |
The unit type. |
|
8 |
*) |
|
9 |
||
10 |
Prod = Fun + |
|
11 |
||
12 |
(** Products **) |
|
13 |
||
14 |
(* type definition *) |
|
15 |
||
| 1558 | 16 |
constdefs |
|
1370
7361ac9b024d
removed quotes from types in consts and syntax sections
clasohm
parents:
1273
diff
changeset
|
17 |
Pair_Rep :: ['a, 'b] => ['a, 'b] => bool |
| 1558 | 18 |
"Pair_Rep == (%a b. %x y. x=a & y=b)" |
| 923 | 19 |
|
| 1475 | 20 |
typedef (Prod) |
| 923 | 21 |
('a, 'b) "*" (infixr 20)
|
22 |
= "{f. ? a b. f = Pair_Rep (a::'a) (b::'b)}"
|
|
23 |
||
24 |
||
25 |
(* abstract constants and syntax *) |
|
26 |
||
27 |
consts |
|
28 |
fst :: "'a * 'b => 'a" |
|
29 |
snd :: "'a * 'b => 'b" |
|
30 |
split :: "[['a, 'b] => 'c, 'a * 'b] => 'c" |
|
31 |
prod_fun :: "['a => 'b, 'c => 'd, 'a * 'c] => 'b * 'd" |
|
32 |
Pair :: "['a, 'b] => 'a * 'b" |
|
33 |
Sigma :: "['a set, 'a => 'b set] => ('a * 'b) set"
|
|
34 |
||
| 1068 | 35 |
(** Patterns -- extends pre-defined type "pttrn" used in abstractions **) |
36 |
types pttrns |
|
37 |
||
| 923 | 38 |
syntax |
|
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
967
diff
changeset
|
39 |
"@Tuple" :: "['a, args] => 'a * 'b" ("(1'(_,/ _'))")
|
| 923 | 40 |
|
|
1370
7361ac9b024d
removed quotes from types in consts and syntax sections
clasohm
parents:
1273
diff
changeset
|
41 |
"@pttrn" :: [pttrn,pttrns] => pttrn ("'(_,/_')")
|
|
7361ac9b024d
removed quotes from types in consts and syntax sections
clasohm
parents:
1273
diff
changeset
|
42 |
"" :: pttrn => pttrns ("_")
|
|
7361ac9b024d
removed quotes from types in consts and syntax sections
clasohm
parents:
1273
diff
changeset
|
43 |
"@pttrns" :: [pttrn,pttrns] => pttrns ("_,/_")
|
| 1068 | 44 |
|
| 923 | 45 |
translations |
|
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
967
diff
changeset
|
46 |
"(x, y, z)" == "(x, (y, z))" |
|
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
967
diff
changeset
|
47 |
"(x, y)" == "Pair x y" |
| 923 | 48 |
|
| 1114 | 49 |
"%(x,y,zs).b" == "split(%x (y,zs).b)" |
50 |
"%(x,y).b" == "split(%x y.b)" |
|
| 1068 | 51 |
|
| 923 | 52 |
defs |
53 |
Pair_def "Pair a b == Abs_Prod(Pair_Rep a b)" |
|
|
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
967
diff
changeset
|
54 |
fst_def "fst(p) == @a. ? b. p = (a, b)" |
|
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
967
diff
changeset
|
55 |
snd_def "snd(p) == @b. ? a. p = (a, b)" |
| 923 | 56 |
split_def "split c p == c (fst p) (snd p)" |
|
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
967
diff
changeset
|
57 |
prod_fun_def "prod_fun f g == split(%x y.(f(x), g(y)))" |
|
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
967
diff
changeset
|
58 |
Sigma_def "Sigma A B == UN x:A. UN y:B(x). {(x, y)}"
|
| 923 | 59 |
|
60 |
(** Unit **) |
|
61 |
||
| 1475 | 62 |
typedef (Unit) |
| 923 | 63 |
unit = "{p. p = True}"
|
64 |
||
65 |
consts |
|
|
1370
7361ac9b024d
removed quotes from types in consts and syntax sections
clasohm
parents:
1273
diff
changeset
|
66 |
"()" :: unit ("'(')")
|
| 923 | 67 |
|
68 |
defs |
|
|
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
967
diff
changeset
|
69 |
Unity_def "() == Abs_Unit(True)" |
| 923 | 70 |
|
| 1273 | 71 |
(* start 8bit 1 *) |
72 |
(* end 8bit 1 *) |
|
73 |
||
| 923 | 74 |
end |