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 (..., ...)
     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 
    10 Prod = Fun +
    11 
    12 (** Products **)
    13 
    14 (* type definition *)
    15 
    16 consts
    17   Pair_Rep      :: "['a, 'b] => ['a, 'b] => bool"
    18 
    19 defs
    20   Pair_Rep_def  "Pair_Rep == (%a b. %x y. x=a & y=b)"
    21 
    22 subtype (Prod)
    23   ('a, 'b) "*"          (infixr 20)
    24     = "{f. ? a b. f = Pair_Rep (a::'a) (b::'b)}"
    25 
    26 
    27 (* abstract constants and syntax *)
    28 
    29 consts
    30   fst           :: "'a * 'b => 'a"
    31   snd           :: "'a * 'b => 'b"
    32   split         :: "[['a, 'b] => 'c, 'a * 'b] => 'c"
    33   prod_fun      :: "['a => 'b, 'c => 'd, 'a * 'c] => 'b * 'd"
    34   Pair          :: "['a, 'b] => 'a * 'b"
    35   Sigma         :: "['a set, 'a => 'b set] => ('a * 'b) set"
    36 
    37 syntax
    38   "@Tuple"      :: "['a, args] => 'a * 'b"            ("(1'(_,/ _'))")
    39 
    40 translations
    41   "(x, y, z)"   == "(x, (y, z))"
    42   "(x, y)"      == "Pair x y"
    43 
    44 defs
    45   Pair_def      "Pair a b == Abs_Prod(Pair_Rep a b)"
    46   fst_def       "fst(p) == @a. ? b. p = (a, b)"
    47   snd_def       "snd(p) == @b. ? a. p = (a, b)"
    48   split_def     "split c p == c (fst p) (snd p)"
    49   prod_fun_def  "prod_fun f g == split(%x y.(f(x), g(y)))"
    50   Sigma_def     "Sigma A B == UN x:A. UN y:B(x). {(x, y)}"
    51 
    52 
    53 
    54 (** Unit **)
    55 
    56 subtype (Unit)
    57   unit = "{p. p = True}"
    58 
    59 consts
    60   "()"          :: "unit"                           ("'(')")
    61 
    62 defs
    63   Unity_def     "() == Abs_Unit(True)"
    64 
    65 end