src/HOL/Prod.thy
 author wenzelm Thu Mar 11 13:20:35 1999 +0100 (1999-03-11) changeset 6349 f7750d816c21 parent 6340 7d5cbd5819a0 child 8703 816d8f6513be permissions -rw-r--r--
removed foo_build_completed -- now handled by session management (via usedir);
```     1 (*  Title:      HOL/Prod.thy
```
```     2     ID:         \$Id\$
```
```     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 + equalities +
```
```    11
```
```    12
```
```    13 (** products **)
```
```    14
```
```    15 (* type definition *)
```
```    16
```
```    17 constdefs
```
```    18   Pair_Rep      :: ['a, 'b] => ['a, 'b] => bool
```
```    19   "Pair_Rep == (%a b. %x y. x=a & y=b)"
```
```    20
```
```    21 global
```
```    22
```
```    23 typedef (Prod)
```
```    24   ('a, 'b) "*"          (infixr 20)
```
```    25     = "{f. ? a b. f = Pair_Rep (a::'a) (b::'b)}"
```
```    26
```
```    27 syntax (symbols)
```
```    28   "*"           :: [type, type] => type         ("(_ \\<times>/ _)" [21, 20] 20)
```
```    29
```
```    30 syntax (HTML output)
```
```    31   "*"           :: [type, type] => type         ("(_ \\<times>/ _)" [21, 20] 20)
```
```    32
```
```    33
```
```    34 (* abstract constants and syntax *)
```
```    35
```
```    36 consts
```
```    37   fst           :: "'a * 'b => 'a"
```
```    38   snd           :: "'a * 'b => 'b"
```
```    39   split         :: "[['a, 'b] => 'c, 'a * 'b] => 'c"
```
```    40   prod_fun      :: "['a => 'b, 'c => 'd, 'a * 'c] => 'b * 'd"
```
```    41   Pair          :: "['a, 'b] => 'a * 'b"
```
```    42   Sigma         :: "['a set, 'a => 'b set] => ('a * 'b) set"
```
```    43
```
```    44
```
```    45 (* patterns -- extends pre-defined type "pttrn" used in abstractions *)
```
```    46
```
```    47 nonterminals
```
```    48   patterns
```
```    49
```
```    50 syntax
```
```    51   "@Tuple"      :: "['a, args] => 'a * 'b"       ("(1'(_,/ _'))")
```
```    52
```
```    53   "_pattern"    :: [pttrn, patterns] => pttrn    ("'(_,/_')")
```
```    54   ""            :: pttrn => patterns             ("_")
```
```    55   "_patterns"   :: [pttrn, patterns] => patterns ("_,/_")
```
```    56
```
```    57   "@Sigma"      :: "[pttrn, 'a set, 'b set] => ('a * 'b) set"   ("(3SIGMA _:_./ _)" 10)
```
```    58   "@Times"      :: "['a set, 'a => 'b set] => ('a * 'b) set"    ("_ Times _" [81, 80] 80)
```
```    59
```
```    60 translations
```
```    61   "(x, y, z)"    == "(x, (y, z))"
```
```    62   "(x, y)"       == "Pair x y"
```
```    63
```
```    64   "%(x,y,zs).b"  == "split(%x (y,zs).b)"
```
```    65   "%(x,y).b"     == "split(%x y. b)"
```
```    66   "_abs (Pair x y) t" => "%(x,y).t"
```
```    67   (* The last rule accommodates tuples in `case C ... (x,y) ... => ...'
```
```    68      The (x,y) is parsed as `Pair x y' because it is logic, not pttrn *)
```
```    69
```
```    70   "SIGMA x:A. B" => "Sigma A (%x. B)"
```
```    71   "A Times B"    => "Sigma A (_K B)"
```
```    72
```
```    73 syntax (symbols)
```
```    74   "@Sigma"      :: "[pttrn, 'a set, 'b set] => ('a * 'b) set"   ("(3\\<Sigma> _\\<in>_./ _)" 10)
```
```    75   "@Times"      :: "['a set, 'a => 'b set] => ('a * 'b) set"    ("_ \\<times> _" [81, 80] 80)
```
```    76
```
```    77
```
```    78 (* definitions *)
```
```    79
```
```    80 local
```
```    81
```
```    82 defs
```
```    83   Pair_def      "Pair a b == Abs_Prod(Pair_Rep a b)"
```
```    84   fst_def       "fst p == @a. ? b. p = (a, b)"
```
```    85   snd_def       "snd p == @b. ? a. p = (a, b)"
```
```    86   split_def     "split == (%c p. c (fst p) (snd p))"
```
```    87   prod_fun_def  "prod_fun f g == split(%x y.(f(x), g(y)))"
```
```    88   Sigma_def     "Sigma A B == UN x:A. UN y:B(x). {(x, y)}"
```
```    89
```
```    90
```
```    91
```
```    92 (** unit **)
```
```    93
```
```    94 global
```
```    95
```
```    96 typedef  unit = "{True}"
```
```    97
```
```    98 consts
```
```    99   "()"          :: unit                           ("'(')")
```
```   100
```
```   101 local
```
```   102
```
```   103 defs
```
```   104   Unity_def     "() == Abs_unit True"
```
```   105
```
```   106 end
```
```   107
```
```   108 ML
```
```   109
```
```   110 val print_translation = [("Sigma", dependent_tr' ("@Sigma", "@Times"))];
```