src/HOL/Prod.thy
changeset 923 ff1574a81019
child 967 bfcb53497a99
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/HOL/Prod.thy	Fri Mar 03 12:02:25 1995 +0100
     1.3 @@ -0,0 +1,66 @@
     1.4 +(*  Title:      HOL/Prod.thy
     1.5 +    ID:         Prod.thy,v 1.5 1994/08/19 09:04:27 lcp Exp
     1.6 +    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
     1.7 +    Copyright   1992  University of Cambridge
     1.8 +
     1.9 +Ordered Pairs and the Cartesian product type.
    1.10 +The unit type.
    1.11 +*)
    1.12 +
    1.13 +Prod = Fun +
    1.14 +
    1.15 +(** Products **)
    1.16 +
    1.17 +(* type definition *)
    1.18 +
    1.19 +consts
    1.20 +  Pair_Rep      :: "['a, 'b] => ['a, 'b] => bool"
    1.21 +
    1.22 +defs
    1.23 +  Pair_Rep_def  "Pair_Rep == (%a b. %x y. x=a & y=b)"
    1.24 +
    1.25 +subtype (Prod)
    1.26 +  ('a, 'b) "*"          (infixr 20)
    1.27 +    = "{f. ? a b. f = Pair_Rep (a::'a) (b::'b)}"
    1.28 +
    1.29 +
    1.30 +(* abstract constants and syntax *)
    1.31 +
    1.32 +consts
    1.33 +  fst           :: "'a * 'b => 'a"
    1.34 +  snd           :: "'a * 'b => 'b"
    1.35 +  split         :: "[['a, 'b] => 'c, 'a * 'b] => 'c"
    1.36 +  prod_fun      :: "['a => 'b, 'c => 'd, 'a * 'c] => 'b * 'd"
    1.37 +  Pair          :: "['a, 'b] => 'a * 'b"
    1.38 +  Sigma         :: "['a set, 'a => 'b set] => ('a * 'b) set"
    1.39 +
    1.40 +syntax
    1.41 +  "@Tuple"      :: "args => 'a * 'b"            ("(1<_>)")
    1.42 +
    1.43 +translations
    1.44 +  "<x, y, z>"   == "<x, <y, z>>"
    1.45 +  "<x, y>"      == "Pair x y"
    1.46 +  "<x>"         => "x"
    1.47 +
    1.48 +defs
    1.49 +  Pair_def      "Pair a b == Abs_Prod(Pair_Rep a b)"
    1.50 +  fst_def       "fst(p) == @a. ? b. p = <a, b>"
    1.51 +  snd_def       "snd(p) == @b. ? a. p = <a, b>"
    1.52 +  split_def     "split c p == c (fst p) (snd p)"
    1.53 +  prod_fun_def  "prod_fun f g == split(%x y.<f(x), g(y)>)"
    1.54 +  Sigma_def     "Sigma A B == UN x:A. UN y:B(x). {<x, y>}"
    1.55 +
    1.56 +
    1.57 +
    1.58 +(** Unit **)
    1.59 +
    1.60 +subtype (Unit)
    1.61 +  unit = "{p. p = True}"
    1.62 +
    1.63 +consts
    1.64 +  Unity         :: "unit"                       ("<>")
    1.65 +
    1.66 +defs
    1.67 +  Unity_def     "Unity == Abs_Unit(True)"
    1.68 +
    1.69 +end