src/ZF/ex/Comb.thy
author paulson
Tue, 30 Apr 1996 11:08:09 +0200
changeset 1702 4aa538e82f76
parent 1478 2b8c2a7547ab
child 11316 b4e71bd751e4
permissions -rw-r--r--
Cosmetic re-ordering of declarations
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1478
2b8c2a7547ab expanded tabs
clasohm
parents: 1401
diff changeset
     1
(*  Title:      ZF/ex/Comb.thy
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
     2
    ID:         $Id$
1478
2b8c2a7547ab expanded tabs
clasohm
parents: 1401
diff changeset
     3
    Author:     Lawrence C Paulson
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
     4
    Copyright   1994  University of Cambridge
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
     5
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
     6
Combinatory Logic example: the Church-Rosser Theorem
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
     7
Curiously, combinators do not include free variables.
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
     8
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
     9
Example taken from
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    10
    J. Camilleri and T. F. Melham.
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    11
    Reasoning with Inductively Defined Relations in the HOL Theorem Prover.
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    12
    Report 265, University of Cambridge Computer Laboratory, 1992.
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    13
*)
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    14
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    15
810
91c68f74f458 removed quotes around "Datatype",
lcp
parents: 753
diff changeset
    16
Comb = Datatype +
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    17
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    18
(** Datatype definition of combinators S and K, with infixed application **)
1401
0c439768f45c removed quotes from consts and syntax sections
clasohm
parents: 1155
diff changeset
    19
consts comb :: i
1702
4aa538e82f76 Cosmetic re-ordering of declarations
paulson
parents: 1478
diff changeset
    20
datatype
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    21
  "comb" = K
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    22
         | S
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    23
         | "#" ("p: comb", "q: comb")   (infixl 90)
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    24
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    25
(** Inductive definition of contractions, -1->
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    26
             and (multi-step) reductions, --->
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    27
**)
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    28
consts
1401
0c439768f45c removed quotes from consts and syntax sections
clasohm
parents: 1155
diff changeset
    29
  contract  :: i
1478
2b8c2a7547ab expanded tabs
clasohm
parents: 1401
diff changeset
    30
  "-1->"    :: [i,i] => o                       (infixl 50)
2b8c2a7547ab expanded tabs
clasohm
parents: 1401
diff changeset
    31
  "--->"    :: [i,i] => o                       (infixl 50)
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    32
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    33
translations
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    34
  "p -1-> q" == "<p,q> : contract"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    35
  "p ---> q" == "<p,q> : contract^*"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    36
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    37
inductive
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    38
  domains   "contract" <= "comb*comb"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    39
  intrs
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    40
    K     "[| p:comb;  q:comb |] ==> K#p#q -1-> p"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    41
    S     "[| p:comb;  q:comb;  r:comb |] ==> S#p#q#r -1-> (p#r)#(q#r)"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    42
    Ap1   "[| p-1->q;  r:comb |] ==> p#r -1-> q#r"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    43
    Ap2   "[| p-1->q;  r:comb |] ==> r#p -1-> r#q"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    44
  type_intrs "comb.intrs"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    45
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    46
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    47
(** Inductive definition of parallel contractions, =1=>
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    48
             and (multi-step) parallel reductions, ===>
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    49
**)
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    50
consts
1401
0c439768f45c removed quotes from consts and syntax sections
clasohm
parents: 1155
diff changeset
    51
  parcontract :: i
1478
2b8c2a7547ab expanded tabs
clasohm
parents: 1401
diff changeset
    52
  "=1=>"    :: [i,i] => o                       (infixl 50)
2b8c2a7547ab expanded tabs
clasohm
parents: 1401
diff changeset
    53
  "===>"    :: [i,i] => o                       (infixl 50)
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    54
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    55
translations
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    56
  "p =1=> q" == "<p,q> : parcontract"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    57
  "p ===> q" == "<p,q> : parcontract^+"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    58
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    59
inductive
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    60
  domains   "parcontract" <= "comb*comb"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    61
  intrs
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    62
    refl  "[| p:comb |] ==> p =1=> p"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    63
    K     "[| p:comb;  q:comb |] ==> K#p#q =1=> p"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    64
    S     "[| p:comb;  q:comb;  r:comb |] ==> S#p#q#r =1=> (p#r)#(q#r)"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    65
    Ap    "[| p=1=>q;  r=1=>s |] ==> p#r =1=> q#s"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    66
  type_intrs "comb.intrs"
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    67
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    68
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    69
(*Misc definitions*)
1702
4aa538e82f76 Cosmetic re-ordering of declarations
paulson
parents: 1478
diff changeset
    70
constdefs
4aa538e82f76 Cosmetic re-ordering of declarations
paulson
parents: 1478
diff changeset
    71
  I :: i
4aa538e82f76 Cosmetic re-ordering of declarations
paulson
parents: 1478
diff changeset
    72
  "I == S#K#K"
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    73
1702
4aa538e82f76 Cosmetic re-ordering of declarations
paulson
parents: 1478
diff changeset
    74
  diamond :: i => o
4aa538e82f76 Cosmetic re-ordering of declarations
paulson
parents: 1478
diff changeset
    75
  "diamond(r) == ALL x y. <x,y>:r --> 
4aa538e82f76 Cosmetic re-ordering of declarations
paulson
parents: 1478
diff changeset
    76
                          (ALL y'. <x,y'>:r --> 
4aa538e82f76 Cosmetic re-ordering of declarations
paulson
parents: 1478
diff changeset
    77
                                   (EX z. <y,z>:r & <y',z> : r))"
515
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    78
abcc438e7c27 installation of new inductive/datatype sections
lcp
parents:
diff changeset
    79
end