diff -r b6873d123f9b -r 89715c48f728 Nominal/Ex/SubstNoFcb.thy --- a/Nominal/Ex/SubstNoFcb.thy Sat May 12 21:39:09 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -theory Lambda imports "../Nominal2" begin - -atom_decl name - -nominal_datatype lam = - Var "name" -| App "lam" "lam" -| Lam x::"name" l::"lam" binds x in l ("Lam [_]. _" [100, 100] 100) - -nominal_primrec lam_rec :: - "(name \ 'a :: pt) \ (lam \ lam \ 'a) \ (name \ lam \ 'a) \ 'a \ 'b :: fs \ lam \ 'a" -where - "lam_rec fv fa fl fd P (Var n) = fv n" -| "lam_rec fv fa fl fd P (App l r) = fa l r" -| "(atom x \ P \ (\y s. atom y \ P \ Lam [x]. t = Lam [y]. s \ fl x t = fl y s)) \ - lam_rec fv fa fl fd P (Lam [x]. t) = fl x t" -| "(atom x \ P \ \(\y s. atom y \ P \ Lam [x]. t = Lam [y]. s \ fl x t = fl y s)) \ - lam_rec fv fa fl fd P (Lam [x]. t) = fd" - apply (simp add: eqvt_def lam_rec_graph_def) - apply (rule, perm_simp, rule, rule) - apply (case_tac x) - apply (rule_tac y="f" and c="e" in lam.strong_exhaust) - apply metis - apply metis - unfolding fresh_star_def - apply simp - apply metis - apply simp_all[2] - apply (metis (no_types) Pair_inject lam.distinct)+ - apply simp - apply (metis (no_types) Pair_inject lam.distinct)+ - done - -termination (eqvt) by lexicographic_order - -lemma lam_rec_cong[fundef_cong]: - " (\v. l = Var v \ fv v = fv' v) \ - (\t1 t2. l = App t1 t2 \ fa t1 t2 = fa' t1 t2) \ - (\n t. l = Lam [n]. t \ fl n t = fl' n t) \ - lam_rec fv fa fl fd P l = lam_rec fv' fa' fl' fd P l" - apply (rule_tac y="l" and c="P" in lam.strong_exhaust) - apply auto - apply (case_tac "(\y s. atom y \ P \ Lam [name]. lam = Lam [y]. s \ fl name lam = fl y s)") - apply (subst lam_rec.simps) apply (simp add: fresh_star_def) - apply (subst lam_rec.simps) apply (simp add: fresh_star_def) - using Abs1_eq_iff lam.eq_iff apply metis - apply (subst lam_rec.simps(4)) apply (simp add: fresh_star_def) - apply (subst lam_rec.simps(4)) apply (simp add: fresh_star_def) - using Abs1_eq_iff lam.eq_iff apply metis - done - -nominal_primrec substr where -[simp del]: "substr l y s = lam_rec - (%x. if x = y then s else (Var x)) - (%t1 t2. App (substr t1 y s) (substr t2 y s)) - (%x t. Lam [x]. (substr t y s)) (Lam [y]. Var y) (y, s) l" -unfolding eqvt_def substr_graph_def -apply (rule, perm_simp, rule, rule) -by pat_completeness auto - -termination (eqvt) by lexicographic_order - -lemma fresh_fun_eqvt_app3: - assumes e: "eqvt f" - shows "\a \ x; a \ y; a \ z\ \ a \ f x y z" - using fresh_fun_eqvt_app[OF e] fresh_fun_app by (metis (lifting, full_types)) - -lemma substr_simps: - "substr (Var x) y s = (if x = y then s else (Var x))" - "substr (App t1 t2) y s = App (substr t1 y s) (substr t2 y s)" - "atom x \ (y, s) \ substr (Lam [x]. t) y s = Lam [x]. (substr t y s)" - apply (subst substr.simps) apply (simp only: lam_rec.simps) - apply (subst substr.simps) apply (simp only: lam_rec.simps) - apply (subst substr.simps) apply (subst lam_rec.simps) - apply (auto simp add: Abs1_eq_iff substr.eqvt swap_fresh_fresh) - apply (rule fresh_fun_eqvt_app3[of substr]) - apply (simp add: eqvt_def eqvts_raw) - apply (simp_all add: fresh_Pair) - done - -end - - -