src/HOL/Induct/Comb.thy
changeset 3120 c58423c20740
child 3309 992a25b24d0d
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/HOL/Induct/Comb.thy	Wed May 07 12:50:26 1997 +0200
     1.3 @@ -0,0 +1,74 @@
     1.4 +(*  Title:      HOL/ex/Comb.thy
     1.5 +    ID:         $Id$
     1.6 +    Author:     Lawrence C Paulson
     1.7 +    Copyright   1996  University of Cambridge
     1.8 +
     1.9 +Combinatory Logic example: the Church-Rosser Theorem
    1.10 +Curiously, combinators do not include free variables.
    1.11 +
    1.12 +Example taken from
    1.13 +    J. Camilleri and T. F. Melham.
    1.14 +    Reasoning with Inductively Defined Relations in the HOL Theorem Prover.
    1.15 +    Report 265, University of Cambridge Computer Laboratory, 1992.
    1.16 +*)
    1.17 +
    1.18 +
    1.19 +Comb = Trancl +
    1.20 +
    1.21 +(** Datatype definition of combinators S and K, with infixed application **)
    1.22 +datatype comb = K
    1.23 +              | S
    1.24 +              | "#" comb comb (infixl 90)
    1.25 +
    1.26 +(** Inductive definition of contractions, -1->
    1.27 +             and (multi-step) reductions, --->
    1.28 +**)
    1.29 +consts
    1.30 +  contract  :: "(comb*comb) set"
    1.31 +  "-1->"    :: [comb,comb] => bool   (infixl 50)
    1.32 +  "--->"    :: [comb,comb] => bool   (infixl 50)
    1.33 +
    1.34 +translations
    1.35 +  "x -1-> y" == "(x,y) : contract"
    1.36 +  "x ---> y" == "(x,y) : contract^*"
    1.37 +
    1.38 +inductive contract
    1.39 +  intrs
    1.40 +    K     "K#x#y -1-> x"
    1.41 +    S     "S#x#y#z -1-> (x#z)#(y#z)"
    1.42 +    Ap1   "x-1->y ==> x#z -1-> y#z"
    1.43 +    Ap2   "x-1->y ==> z#x -1-> z#y"
    1.44 +
    1.45 +
    1.46 +(** Inductive definition of parallel contractions, =1=>
    1.47 +             and (multi-step) parallel reductions, ===>
    1.48 +**)
    1.49 +consts
    1.50 +  parcontract :: "(comb*comb) set"
    1.51 +  "=1=>"    :: [comb,comb] => bool   (infixl 50)
    1.52 +  "===>"    :: [comb,comb] => bool   (infixl 50)
    1.53 +
    1.54 +translations
    1.55 +  "x =1=> y" == "(x,y) : parcontract"
    1.56 +  "x ===> y" == "(x,y) : parcontract^*"
    1.57 +
    1.58 +inductive parcontract
    1.59 +  intrs
    1.60 +    refl  "x =1=> x"
    1.61 +    K     "K#x#y =1=> x"
    1.62 +    S     "S#x#y#z =1=> (x#z)#(y#z)"
    1.63 +    Ap    "[| x=1=>y;  z=1=>w |] ==> x#z =1=> y#w"
    1.64 +
    1.65 +
    1.66 +(*Misc definitions*)
    1.67 +constdefs
    1.68 +  I :: comb
    1.69 +  "I == S#K#K"
    1.70 +
    1.71 +  (*confluence; Lambda/Commutation treats this more abstractly*)
    1.72 +  diamond   :: "('a * 'a)set => bool"	
    1.73 +  "diamond(r) == ALL x y. (x,y):r --> 
    1.74 +                  (ALL y'. (x,y'):r --> 
    1.75 +                    (EX z. (y,z):r & (y',z) : r))"
    1.76 +
    1.77 +end