src/HOL/Prod.thy
author oheimb
Tue, 23 Apr 1996 16:58:21 +0200
changeset 1672 2c109cd2fdd0
parent 1660 8cb42cd97579
child 1674 33aff4d854e4
permissions -rw-r--r--
repaired critical proofs depending on the order inside non-confluent SimpSets, (temporarily) removed problematic rule less_Suc_eq form simpset_of "Nat"
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     1
(*  Title:      HOL/Prod.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     2
    ID:         Prod.thy,v 1.5 1994/08/19 09:04:27 lcp Exp
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     4
    Copyright   1992  University of Cambridge
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     5
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     6
Ordered Pairs and the Cartesian product type.
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     7
The unit type.
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     8
*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     9
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    10
Prod = Fun +
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    11
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    12
(** Products **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    13
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    14
(* type definition *)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    15
1558
9c6ebfab4e05 added constdefs section
clasohm
parents: 1475
diff changeset
    16
constdefs
1370
7361ac9b024d removed quotes from types in consts and syntax sections
clasohm
parents: 1273
diff changeset
    17
  Pair_Rep      :: ['a, 'b] => ['a, 'b] => bool
1558
9c6ebfab4e05 added constdefs section
clasohm
parents: 1475
diff changeset
    18
  "Pair_Rep == (%a b. %x y. x=a & y=b)"
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    19
1475
7f5a4cd08209 expanded tabs; renamed subtype to typedef;
clasohm
parents: 1454
diff changeset
    20
typedef (Prod)
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    21
  ('a, 'b) "*"          (infixr 20)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    22
    = "{f. ? a b. f = Pair_Rep (a::'a) (b::'b)}"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    23
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    24
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    25
(* abstract constants and syntax *)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    26
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    27
consts
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    28
  fst           :: "'a * 'b => 'a"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    29
  snd           :: "'a * 'b => 'b"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    30
  split         :: "[['a, 'b] => 'c, 'a * 'b] => 'c"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    31
  prod_fun      :: "['a => 'b, 'c => 'd, 'a * 'c] => 'b * 'd"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    32
  Pair          :: "['a, 'b] => 'a * 'b"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    33
  Sigma         :: "['a set, 'a => 'b set] => ('a * 'b) set"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    34
1068
e0f2dffab506 HOL.thy:
nipkow
parents: 972
diff changeset
    35
(** Patterns -- extends pre-defined type "pttrn" used in abstractions **)
e0f2dffab506 HOL.thy:
nipkow
parents: 972
diff changeset
    36
types pttrns
e0f2dffab506 HOL.thy:
nipkow
parents: 972
diff changeset
    37
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    38
syntax
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 967
diff changeset
    39
  "@Tuple"      :: "['a, args] => 'a * 'b"            ("(1'(_,/ _'))")
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    40
1370
7361ac9b024d removed quotes from types in consts and syntax sections
clasohm
parents: 1273
diff changeset
    41
  "@pttrn"  :: [pttrn,pttrns] => pttrn              ("'(_,/_')")
7361ac9b024d removed quotes from types in consts and syntax sections
clasohm
parents: 1273
diff changeset
    42
  ""        ::  pttrn         => pttrns             ("_")
7361ac9b024d removed quotes from types in consts and syntax sections
clasohm
parents: 1273
diff changeset
    43
  "@pttrns" :: [pttrn,pttrns] => pttrns             ("_,/_")
1068
e0f2dffab506 HOL.thy:
nipkow
parents: 972
diff changeset
    44
1636
e18416e3e1d4 Introduced Times and SIGMA.
nipkow
parents: 1558
diff changeset
    45
  "@Sigma"  :: "[idt,'a set,'b set] => ('a * 'b)set"
e18416e3e1d4 Introduced Times and SIGMA.
nipkow
parents: 1558
diff changeset
    46
               ("(3SIGMA _:_./ _)" 10)
e18416e3e1d4 Introduced Times and SIGMA.
nipkow
parents: 1558
diff changeset
    47
  "@Times"  :: "['a set, 'a => 'b set] => ('a * 'b) set"
e18416e3e1d4 Introduced Times and SIGMA.
nipkow
parents: 1558
diff changeset
    48
               ("_ Times _" [81,80] 80)
e18416e3e1d4 Introduced Times and SIGMA.
nipkow
parents: 1558
diff changeset
    49
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    50
translations
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 967
diff changeset
    51
  "(x, y, z)"   == "(x, (y, z))"
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 967
diff changeset
    52
  "(x, y)"      == "Pair x y"
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    53
1114
c8dfb56a7e95 Prod is now a parent of Lfp.
nipkow
parents: 1081
diff changeset
    54
  "%(x,y,zs).b"   == "split(%x (y,zs).b)"
c8dfb56a7e95 Prod is now a parent of Lfp.
nipkow
parents: 1081
diff changeset
    55
  "%(x,y).b"      == "split(%x y.b)"
1660
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
    56
(*<<<<<<< Prod.thy*)
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
    57
(* The <= direction fails if split has more than one argument because
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
    58
   ast-matching fails. Otherwise it would work fine *)
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
    59
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
    60
(*=======*)
1068
e0f2dffab506 HOL.thy:
nipkow
parents: 972
diff changeset
    61
1636
e18416e3e1d4 Introduced Times and SIGMA.
nipkow
parents: 1558
diff changeset
    62
  "SIGMA x:A. B"  =>  "Sigma A (%x.B)"
e18416e3e1d4 Introduced Times and SIGMA.
nipkow
parents: 1558
diff changeset
    63
  "A Times B"     =>  "Sigma A (_K B)"
e18416e3e1d4 Introduced Times and SIGMA.
nipkow
parents: 1558
diff changeset
    64
1660
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
    65
(*>>>>>>> 1.13*)
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    66
defs
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    67
  Pair_def      "Pair a b == Abs_Prod(Pair_Rep a b)"
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 967
diff changeset
    68
  fst_def       "fst(p) == @a. ? b. p = (a, b)"
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 967
diff changeset
    69
  snd_def       "snd(p) == @b. ? a. p = (a, b)"
1655
5be64540f275 Added a number of lemmas
nipkow
parents: 1636
diff changeset
    70
  split_def     "split == (%c p. c (fst p) (snd p))"
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 967
diff changeset
    71
  prod_fun_def  "prod_fun f g == split(%x y.(f(x), g(y)))"
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 967
diff changeset
    72
  Sigma_def     "Sigma A B == UN x:A. UN y:B(x). {(x, y)}"
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    73
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    74
(** Unit **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    75
1475
7f5a4cd08209 expanded tabs; renamed subtype to typedef;
clasohm
parents: 1454
diff changeset
    76
typedef (Unit)
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    77
  unit = "{p. p = True}"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    78
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    79
consts
1370
7361ac9b024d removed quotes from types in consts and syntax sections
clasohm
parents: 1273
diff changeset
    80
  "()"          :: unit                           ("'(')")
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    81
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    82
defs
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 967
diff changeset
    83
  Unity_def     "() == Abs_Unit(True)"
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    84
1273
6960ec882bca added 8bit pragmas
regensbu
parents: 1114
diff changeset
    85
(* start 8bit 1 *)
1672
2c109cd2fdd0 repaired critical proofs depending on the order inside non-confluent SimpSets,
oheimb
parents: 1660
diff changeset
    86
types
2c109cd2fdd0 repaired critical proofs depending on the order inside non-confluent SimpSets,
oheimb
parents: 1660
diff changeset
    87
2c109cd2fdd0 repaired critical proofs depending on the order inside non-confluent SimpSets,
oheimb
parents: 1660
diff changeset
    88
('a, 'b) "ò"          (infixr 20)
2c109cd2fdd0 repaired critical proofs depending on the order inside non-confluent SimpSets,
oheimb
parents: 1660
diff changeset
    89
2c109cd2fdd0 repaired critical proofs depending on the order inside non-confluent SimpSets,
oheimb
parents: 1660
diff changeset
    90
translations
2c109cd2fdd0 repaired critical proofs depending on the order inside non-confluent SimpSets,
oheimb
parents: 1660
diff changeset
    91
2c109cd2fdd0 repaired critical proofs depending on the order inside non-confluent SimpSets,
oheimb
parents: 1660
diff changeset
    92
(type)  "x ò y"	== (type) "x * y" 
2c109cd2fdd0 repaired critical proofs depending on the order inside non-confluent SimpSets,
oheimb
parents: 1660
diff changeset
    93
2c109cd2fdd0 repaired critical proofs depending on the order inside non-confluent SimpSets,
oheimb
parents: 1660
diff changeset
    94
  "³(x,y,zs).b"   == "split(³x.³(y,zs).b)"
2c109cd2fdd0 repaired critical proofs depending on the order inside non-confluent SimpSets,
oheimb
parents: 1660
diff changeset
    95
  "³(x,y).b"      == "split(³x y.b)"
2c109cd2fdd0 repaired critical proofs depending on the order inside non-confluent SimpSets,
oheimb
parents: 1660
diff changeset
    96
1273
6960ec882bca added 8bit pragmas
regensbu
parents: 1114
diff changeset
    97
(* end 8bit 1 *)
6960ec882bca added 8bit pragmas
regensbu
parents: 1114
diff changeset
    98
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    99
end
1660
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
   100
(*<<<<<<< Prod.thy*)
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
   101
(*
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
   102
ML
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
   103
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
   104
local open Syntax
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
   105
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
   106
fun pttrn(_ $ s $ t) = const"@pttrn" $ s $ t;
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
   107
fun pttrns s t = const"@pttrns" $ s $ t;
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
   108
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
   109
fun split2(Abs(x,T,t)) =
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
   110
      let val (pats,u) = split1 t
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
   111
      in (pttrns (Free(x,T)) pats, subst_bounds([free x],u)) end
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
   112
  | split2(Const("split",_) $ r) =
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
   113
      let val (pats,s) = split2(r)
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
   114
          val (pats2,t) = split1(s)
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
   115
      in (pttrns (pttrn pats) pats2, t) end
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
   116
and split1(Abs(x,T,t)) =  (Free(x,T), subst_bounds([free x],t))
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
   117
  | split1(Const("split",_)$t) = split2(t);
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
   118
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
   119
fun split_tr'(t::args) =
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
   120
  let val (pats,ft) = split2(t)
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
   121
  in list_comb(const"_lambda" $ pttrn pats $ ft, args) end;
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
   122
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
   123
in
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
   124
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
   125
val print_translation = [("split", split_tr')];
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
   126
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
   127
end;
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
   128
*)
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
   129
(*=======*)
1636
e18416e3e1d4 Introduced Times and SIGMA.
nipkow
parents: 1558
diff changeset
   130
e18416e3e1d4 Introduced Times and SIGMA.
nipkow
parents: 1558
diff changeset
   131
ML
e18416e3e1d4 Introduced Times and SIGMA.
nipkow
parents: 1558
diff changeset
   132
e18416e3e1d4 Introduced Times and SIGMA.
nipkow
parents: 1558
diff changeset
   133
val print_translation = [("Sigma", dependent_tr' ("@Sigma", "@Times"))];
e18416e3e1d4 Introduced Times and SIGMA.
nipkow
parents: 1558
diff changeset
   134
1660
8cb42cd97579 *** empty log message ***
oheimb
parents: 1655
diff changeset
   135
(*>>>>>>> 1.13*)