| author | sandnerr |
| Mon, 09 Dec 1996 19:13:13 +0100 | |
| changeset 2355 | ee9bdbe2ac8a |
| parent 2260 | b59781f2b809 |
| child 2393 | 651fce76c86c |
| 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 |
||
|
1755
17001ecd546e
Added additional parent theory equalities because some proofs in
berghofe
parents:
1674
diff
changeset
|
10 |
Prod = Fun + equalities + |
| 923 | 11 |
|
| 2260 | 12 |
|
13 |
(** products **) |
|
| 923 | 14 |
|
15 |
(* type definition *) |
|
16 |
||
| 1558 | 17 |
constdefs |
|
1370
7361ac9b024d
removed quotes from types in consts and syntax sections
clasohm
parents:
1273
diff
changeset
|
18 |
Pair_Rep :: ['a, 'b] => ['a, 'b] => bool |
| 1558 | 19 |
"Pair_Rep == (%a b. %x y. x=a & y=b)" |
| 923 | 20 |
|
| 1475 | 21 |
typedef (Prod) |
| 923 | 22 |
('a, 'b) "*" (infixr 20)
|
23 |
= "{f. ? a b. f = Pair_Rep (a::'a) (b::'b)}"
|
|
24 |
||
| 2260 | 25 |
syntax (symbols) |
26 |
"*" :: [type, type] => type ("(_ \\<times>/ _)" [21, 20] 20)
|
|
27 |
||
| 923 | 28 |
|
29 |
(* abstract constants and syntax *) |
|
30 |
||
31 |
consts |
|
32 |
fst :: "'a * 'b => 'a" |
|
33 |
snd :: "'a * 'b => 'b" |
|
34 |
split :: "[['a, 'b] => 'c, 'a * 'b] => 'c" |
|
35 |
prod_fun :: "['a => 'b, 'c => 'd, 'a * 'c] => 'b * 'd" |
|
36 |
Pair :: "['a, 'b] => 'a * 'b" |
|
37 |
Sigma :: "['a set, 'a => 'b set] => ('a * 'b) set"
|
|
38 |
||
| 2260 | 39 |
|
40 |
(* patterns -- extends pre-defined type "pttrn" used in abstractions *) |
|
41 |
||
| 1068 | 42 |
types pttrns |
43 |
||
| 923 | 44 |
syntax |
| 2260 | 45 |
"@Tuple" :: "['a, args] => 'a * 'b" ("(1'(_,/ _'))")
|
| 923 | 46 |
|
| 2260 | 47 |
"@pttrn" :: [pttrn, pttrns] => pttrn ("'(_,/_')")
|
48 |
"" :: pttrn => pttrns ("_")
|
|
49 |
"@pttrns" :: [pttrn, pttrns] => pttrns ("_,/_")
|
|
| 1068 | 50 |
|
| 2260 | 51 |
"@Sigma" :: "[idt, 'a set, 'b set] => ('a * 'b) set" ("(3SIGMA _:_./ _)" 10)
|
52 |
"@Times" :: "['a set, 'a => 'b set] => ('a * 'b) set" ("_ Times _" [81, 80] 80)
|
|
| 1636 | 53 |
|
| 923 | 54 |
translations |
|
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
967
diff
changeset
|
55 |
"(x, y, z)" == "(x, (y, z))" |
|
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
967
diff
changeset
|
56 |
"(x, y)" == "Pair x y" |
| 923 | 57 |
|
| 2260 | 58 |
"%(x,y,zs).b" == "split(%x (y,zs).b)" |
59 |
"%(x,y).b" == "split(%x y.b)" |
|
60 |
||
61 |
"SIGMA x:A.B" => "Sigma A (%x.B)" |
|
62 |
"A Times B" => "Sigma A (_K B)" |
|
| 1068 | 63 |
|
| 2260 | 64 |
syntax (symbols) |
65 |
"@Sigma" :: "[idt, 'a set, 'b set] => ('a * 'b) set" ("(3\\<Sigma> _\\<in>_./ _)" 10)
|
|
66 |
"@Times" :: "['a set, 'a => 'b set] => ('a * 'b) set" ("_ \\<times> _" [81, 80] 80)
|
|
67 |
||
68 |
||
69 |
(* definitions *) |
|
| 1636 | 70 |
|
| 923 | 71 |
defs |
72 |
Pair_def "Pair a b == Abs_Prod(Pair_Rep a b)" |
|
|
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
967
diff
changeset
|
73 |
fst_def "fst(p) == @a. ? b. p = (a, b)" |
|
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
967
diff
changeset
|
74 |
snd_def "snd(p) == @b. ? a. p = (a, b)" |
| 1655 | 75 |
split_def "split == (%c p. c (fst p) (snd p))" |
|
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
967
diff
changeset
|
76 |
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
|
77 |
Sigma_def "Sigma A B == UN x:A. UN y:B(x). {(x, y)}"
|
| 923 | 78 |
|
| 2260 | 79 |
|
80 |
||
81 |
(** unit **) |
|
| 923 | 82 |
|
| 1475 | 83 |
typedef (Unit) |
| 923 | 84 |
unit = "{p. p = True}"
|
85 |
||
86 |
consts |
|
|
1370
7361ac9b024d
removed quotes from types in consts and syntax sections
clasohm
parents:
1273
diff
changeset
|
87 |
"()" :: unit ("'(')")
|
| 923 | 88 |
|
89 |
defs |
|
|
972
e61b058d58d2
changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents:
967
diff
changeset
|
90 |
Unity_def "() == Abs_Unit(True)" |
| 923 | 91 |
|
| 1273 | 92 |
(* start 8bit 1 *) |
93 |
(* end 8bit 1 *) |
|
94 |
||
| 923 | 95 |
end |
| 1636 | 96 |
|
97 |
ML |
|
98 |
||
99 |
val print_translation = [("Sigma", dependent_tr' ("@Sigma", "@Times"))];
|