Prod.thy
author lcp
Thu, 06 Apr 1995 11:49:42 +0200
changeset 246 0f9230a24164
parent 185 8325414a370a
permissions -rw-r--r--
Deleted extra space in clos_mk.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
185
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
     1
(*  Title:      HOL/Prod.thy
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
     2
    ID:         Prod.thy,v 1.5 1994/08/19 09:04:27 lcp Exp
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
     4
    Copyright   1992  University of Cambridge
7949f97df77a Initial revision
clasohm
parents:
diff changeset
     5
185
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
     6
Ordered Pairs and the Cartesian product type.
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
     7
The unit type.
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
     8
*)
7949f97df77a Initial revision
clasohm
parents:
diff changeset
     9
185
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    10
Prod = Fun +
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    11
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    12
(** Products **)
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    13
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    14
(* type definition *)
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    15
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    16
consts
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    17
  Pair_Rep      :: "['a, 'b] => ['a, 'b] => bool"
51
934a58983311 new type declaration syntax instead of numbers
lcp
parents: 49
diff changeset
    18
185
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    19
defs
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    20
  Pair_Rep_def  "Pair_Rep == (%a b. %x y. x=a & y=b)"
51
934a58983311 new type declaration syntax instead of numbers
lcp
parents: 49
diff changeset
    21
185
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    22
subtype (Prod)
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    23
  ('a, 'b) "*"          (infixr 20)
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    24
    = "{f. ? a b. f = Pair_Rep(a::'a, b::'b)}"
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    25
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    26
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    27
(* abstract constants and syntax *)
51
934a58983311 new type declaration syntax instead of numbers
lcp
parents: 49
diff changeset
    28
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    29
consts
185
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    30
  fst           :: "'a * 'b => 'a"
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    31
  snd           :: "'a * 'b => 'b"
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    32
  split         :: "[['a, 'b] => 'c, 'a * 'b] => 'c"
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    33
  prod_fun      :: "['a => 'b, 'c => 'd, 'a * 'c] => 'b * 'd"
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    34
  Pair          :: "['a, 'b] => 'a * 'b"
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    35
  Sigma         :: "['a set, 'a => 'b set] => ('a * 'b) set"
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    36
185
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    37
syntax
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    38
  "@Tuple"      :: "args => 'a * 'b"            ("(1<_>)")
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    39
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    40
translations
185
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    41
  "<x, y, z>"   == "<x, <y, z>>"
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    42
  "<x, y>"      == "Pair(x, y)"
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    43
  "<x>"         => "x"
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    44
185
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    45
defs
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    46
  Pair_def      "Pair(a, b) == Abs_Prod(Pair_Rep(a, b))"
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    47
  fst_def       "fst(p) == @a. ? b. p = <a, b>"
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    48
  snd_def       "snd(p) == @b. ? a. p = <a, b>"
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    49
  split_def     "split(c, p) == c(fst(p), snd(p))"
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    50
  prod_fun_def  "prod_fun(f, g) == split(%x y.<f(x), g(y)>)"
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    51
  Sigma_def     "Sigma(A, B) == UN x:A. UN y:B(x). {<x, y>}"
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    52
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    53
185
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    54
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    55
(** Unit **)
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    56
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    57
subtype (Unit)
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    58
  unit = "{p. p = True}"
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    59
185
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    60
consts
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    61
  Unity         :: "unit"                       ("<>")
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    62
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    63
defs
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    64
  Unity_def     "Unity == Abs_Unit(True)"
8325414a370a adapted to 'subtype' section;
wenzelm
parents: 115
diff changeset
    65
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    66
end