src/HOL/Nominal/Examples/CK_Machine.thy
changeset 29097 68245155eb58
parent 27247 e5787c5be196
child 37358 74fb4f03bb51
equal deleted inserted replaced
29088:95a239a5e055 29097:68245155eb58
     1 (* $Id$ *)
       
     2 
       
     3 theory CK_Machine 
     1 theory CK_Machine 
     4   imports "../Nominal" 
     2   imports "../Nominal" 
     5 begin
     3 begin
     6 
     4 
     7 text {* 
     5 text {* 
    39 | ZET "lam"                      (* zero test *)
    37 | ZET "lam"                      (* zero test *)
    40 | EQI "lam" "lam"                (* equality test on numbers *)
    38 | EQI "lam" "lam"                (* equality test on numbers *)
    41 
    39 
    42 section {* Capture-Avoiding Substitution *}
    40 section {* Capture-Avoiding Substitution *}
    43 
    41 
    44 consts subst :: "lam \<Rightarrow> name \<Rightarrow> lam \<Rightarrow> lam"  ("_[_::=_]" [100,100,100] 100)
       
    45 
       
    46 nominal_primrec
    42 nominal_primrec
       
    43   subst :: "lam \<Rightarrow> name \<Rightarrow> lam \<Rightarrow> lam"  ("_[_::=_]" [100,100,100] 100)
       
    44 where
    47   "(VAR x)[y::=s] = (if x=y then s else (VAR x))"
    45   "(VAR x)[y::=s] = (if x=y then s else (VAR x))"
    48   "(APP t\<^isub>1 t\<^isub>2)[y::=s] = APP (t\<^isub>1[y::=s]) (t\<^isub>2[y::=s])"
    46 | "(APP t\<^isub>1 t\<^isub>2)[y::=s] = APP (t\<^isub>1[y::=s]) (t\<^isub>2[y::=s])"
    49   "x\<sharp>(y,s) \<Longrightarrow> (LAM [x].t)[y::=s] = LAM [x].(t[y::=s])"
    47 | "x\<sharp>(y,s) \<Longrightarrow> (LAM [x].t)[y::=s] = LAM [x].(t[y::=s])"
    50   "(NUM n)[y::=s] = NUM n"
    48 | "(NUM n)[y::=s] = NUM n"
    51   "(t\<^isub>1 -- t\<^isub>2)[y::=s] = (t\<^isub>1[y::=s]) -- (t\<^isub>2[y::=s])"
    49 | "(t\<^isub>1 -- t\<^isub>2)[y::=s] = (t\<^isub>1[y::=s]) -- (t\<^isub>2[y::=s])"
    52   "(t\<^isub>1 ++ t\<^isub>2)[y::=s] = (t\<^isub>1[y::=s]) ++ (t\<^isub>2[y::=s])"
    50 | "(t\<^isub>1 ++ t\<^isub>2)[y::=s] = (t\<^isub>1[y::=s]) ++ (t\<^isub>2[y::=s])"
    53   "x\<sharp>(y,s) \<Longrightarrow> (FIX [x].t)[y::=s] = FIX [x].(t[y::=s])"
    51 | "x\<sharp>(y,s) \<Longrightarrow> (FIX [x].t)[y::=s] = FIX [x].(t[y::=s])"
    54   "TRUE[y::=s] = TRUE"
    52 | "TRUE[y::=s] = TRUE"
    55   "FALSE[y::=s] = FALSE"
    53 | "FALSE[y::=s] = FALSE"
    56   "(IF t1 t2 t3)[y::=s] = IF (t1[y::=s]) (t2[y::=s]) (t3[y::=s])"
    54 | "(IF t1 t2 t3)[y::=s] = IF (t1[y::=s]) (t2[y::=s]) (t3[y::=s])"
    57   "(ZET t)[y::=s] = ZET (t[y::=s])"
    55 | "(ZET t)[y::=s] = ZET (t[y::=s])"
    58   "(EQI t1 t2)[y::=s] = EQI (t1[y::=s]) (t2[y::=s])"
    56 | "(EQI t1 t2)[y::=s] = EQI (t1[y::=s]) (t2[y::=s])"
    59 apply(finite_guess)+
    57 apply(finite_guess)+
    60 apply(rule TrueI)+
    58 apply(rule TrueI)+
    61 apply(simp add: abs_fresh)+
    59 apply(simp add: abs_fresh)+
    62 apply(fresh_guess)+
    60 apply(fresh_guess)+
    63 done
    61 done