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