diff -r fb201e383f1b -r da575186d492 Nominal/Ex/SFT/LambdaTerms.thy --- a/Nominal/Ex/SFT/LambdaTerms.thy Tue Feb 19 05:38:46 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -header {* Definition of Lambda terms and convertibility *} - -theory LambdaTerms imports "../../Nominal2" begin - -lemma [simp]: "supp x = {} \ y \ x" - unfolding fresh_def by blast - -atom_decl name - -nominal_datatype lam = - Var "name" -| App "lam" "lam" -| Lam x::"name" l::"lam" binds x in l ("Lam [_]. _" [100, 100] 100) - -notation - App (infixl "\" 98) and - Lam ("\ _. _" [97, 97] 99) - -nominal_primrec - subst :: "lam \ name \ lam \ lam" ("_ [_ ::= _]" [90, 90, 90] 90) -where - "(Var x)[y ::= s] = (if x = y then s else (Var x))" -| "(t1 \ t2)[y ::= s] = (t1[y ::= s]) \ (t2[y ::= s])" -| "atom x \ (y, s) \ (\x. t)[y ::= s] = \x.(t[y ::= s])" -proof auto - fix a b :: lam and aa :: name and P - assume "\x y s. a = Var x \ aa = y \ b = s \ P" - "\t1 t2 y s. a = t1 \ t2 \ aa = y \ b = s \ P" - "\x y s t. \atom x \ (y, s); a = \ x. t \ aa = y \ b = s\ \ P" - then show "P" - by (rule_tac y="a" and c="(aa, b)" in lam.strong_exhaust) - (blast, blast, simp add: fresh_star_def) -next - fix x :: name and t and xa :: name and ya sa ta - assume *: "eqvt_at subst_sumC (t, ya, sa)" - "atom x \ (ya, sa)" "atom xa \ (ya, sa)" - "[[atom x]]lst. t = [[atom xa]]lst. ta" - then show "[[atom x]]lst. subst_sumC (t, ya, sa) = [[atom xa]]lst. subst_sumC (ta, ya, sa)" - apply - - apply (erule Abs_lst1_fcb) - apply(simp (no_asm) add: Abs_fresh_iff) - apply(drule_tac a="atom xa" in fresh_eqvt_at) - apply(simp add: finite_supp) - apply(simp_all add: fresh_Pair_elim Abs_fresh_iff Abs1_eq_iff) - apply(subgoal_tac "(atom x \ atom xa) \ ya = ya") - apply(subgoal_tac "(atom x \ atom xa) \ sa = sa") - apply(simp add: atom_eqvt eqvt_at_def) - apply(rule perm_supp_eq, simp add: supp_swap fresh_star_def fresh_Pair)+ - done -next - show "eqvt subst_graph" unfolding eqvt_def subst_graph_def - by (rule, perm_simp, rule) -qed - -termination (eqvt) by lexicographic_order - -lemma forget[simp]: - shows "atom x \ t \ t[x ::= s] = t" - by (nominal_induct t avoiding: x s rule: lam.strong_induct) - (auto simp add: lam.fresh fresh_at_base) - -lemma forget_closed[simp]: "supp t = {} \ t[x ::= s] = t" - by (simp add: fresh_def) - -lemma subst_id[simp]: "M [x ::= Var x] = M" - by (rule_tac lam="M" and c="x" in lam.strong_induct) - (simp_all add: fresh_star_def lam.fresh fresh_Pair) - -inductive - beta :: "lam \ lam \ bool" (infix "\" 80) -where - bI: "(\x. M) \ N \ M[x ::= N]" -| b1: "M \ M" -| b2: "M \ N \ N \ M" -| b3: "M \ N \ N \ L \ M \ L" -| b4: "M \ N \ Z \ M \ Z \ N" -| b5: "M \ N \ M \ Z \ N \ Z" -| b6: "M \ N \ \x. M \ \x. N" - -lemmas [trans] = b3 -equivariance beta - -end