src/HOL/Prod.thy
author clasohm
Fri Mar 24 12:30:35 1995 +0100 (1995-03-24)
changeset 972 e61b058d58d2
parent 967 bfcb53497a99
child 1068 e0f2dffab506
permissions -rw-r--r--
changed syntax of tuples from <..., ...> to (..., ...)
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@972
    38
  "@Tuple"      :: "['a, args] => 'a * 'b"            ("(1'(_,/ _'))")
clasohm@923
    39
clasohm@923
    40
translations
clasohm@972
    41
  "(x, y, z)"   == "(x, (y, z))"
clasohm@972
    42
  "(x, y)"      == "Pair x y"
clasohm@923
    43
clasohm@923
    44
defs
clasohm@923
    45
  Pair_def      "Pair a b == Abs_Prod(Pair_Rep a b)"
clasohm@972
    46
  fst_def       "fst(p) == @a. ? b. p = (a, b)"
clasohm@972
    47
  snd_def       "snd(p) == @b. ? a. p = (a, b)"
clasohm@923
    48
  split_def     "split c p == c (fst p) (snd p)"
clasohm@972
    49
  prod_fun_def  "prod_fun f g == split(%x y.(f(x), g(y)))"
clasohm@972
    50
  Sigma_def     "Sigma A B == UN x:A. UN y:B(x). {(x, y)}"
clasohm@923
    51
clasohm@923
    52
clasohm@923
    53
clasohm@923
    54
(** Unit **)
clasohm@923
    55
clasohm@923
    56
subtype (Unit)
clasohm@923
    57
  unit = "{p. p = True}"
clasohm@923
    58
clasohm@923
    59
consts
clasohm@972
    60
  "()"          :: "unit"                           ("'(')")
clasohm@923
    61
clasohm@923
    62
defs
clasohm@972
    63
  Unity_def     "() == Abs_Unit(True)"
clasohm@923
    64
clasohm@923
    65
end