diff -r 95a239a5e055 -r 68245155eb58 src/HOL/Nominal/Examples/Contexts.thy --- a/src/HOL/Nominal/Examples/Contexts.thy Fri Dec 12 12:14:02 2008 +0100 +++ b/src/HOL/Nominal/Examples/Contexts.thy Sat Dec 13 13:24:45 2008 +0100 @@ -1,5 +1,3 @@ -(* $Id$ *) - theory Contexts imports "../Nominal" begin @@ -42,12 +40,12 @@ text {* Capture-Avoiding Substitution *} -consts subst :: "lam \ name \ lam \ lam" ("_[_::=_]" [100,100,100] 100) - nominal_primrec + subst :: "lam \ name \ lam \ lam" ("_[_::=_]" [100,100,100] 100) +where "(Var x)[y::=s] = (if x=y then s else (Var x))" - "(App t\<^isub>1 t\<^isub>2)[y::=s] = App (t\<^isub>1[y::=s]) (t\<^isub>2[y::=s])" - "x\(y,s) \ (Lam [x].t)[y::=s] = Lam [x].(t[y::=s])" +| "(App t\<^isub>1 t\<^isub>2)[y::=s] = App (t\<^isub>1[y::=s]) (t\<^isub>2[y::=s])" +| "x\(y,s) \ (Lam [x].t)[y::=s] = Lam [x].(t[y::=s])" apply(finite_guess)+ apply(rule TrueI)+ apply(simp add: abs_fresh) @@ -59,14 +57,13 @@ This operation is possibly capturing. *} -consts +nominal_primrec filling :: "ctx \ lam \ lam" ("_\_\" [100,100] 100) - -nominal_primrec +where "\\t\ = t" - "(CAppL E t')\t\ = App (E\t\) t'" - "(CAppR t' E)\t\ = App t' (E\t\)" - "(CLam [x].E)\t\ = Lam [x].(E\t\)" +| "(CAppL E t')\t\ = App (E\t\) t'" +| "(CAppR t' E)\t\ = App t' (E\t\)" +| "(CLam [x].E)\t\ = Lam [x].(E\t\)" by (rule TrueI)+ text {* @@ -81,14 +78,13 @@ text {* The composition of two contexts. *} -consts +nominal_primrec ctx_compose :: "ctx \ ctx \ ctx" ("_ \ _" [100,100] 100) - -nominal_primrec +where "\ \ E' = E'" - "(CAppL E t') \ E' = CAppL (E \ E') t'" - "(CAppR t' E) \ E' = CAppR t' (E \ E')" - "(CLam [x].E) \ E' = CLam [x].(E \ E')" +| "(CAppL E t') \ E' = CAppL (E \ E') t'" +| "(CAppR t' E) \ E' = CAppR t' (E \ E')" +| "(CLam [x].E) \ E' = CLam [x].(E \ E')" by (rule TrueI)+ lemma ctx_compose: