# HG changeset patch # User Christian Urban # Date 1268120815 -3600 # Node ID 424962b8b699cc5c326ef7f24c8dbc377158527d # Parent c0cb30581f581296a860a58b40306f5740e4807b added another compat example diff -r c0cb30581f58 -r 424962b8b699 Nominal/Test_compat.thy --- a/Nominal/Test_compat.thy Mon Mar 08 20:18:27 2010 +0100 +++ b/Nominal/Test_compat.thy Tue Mar 09 08:46:55 2010 +0100 @@ -142,8 +142,8 @@ thm alpha_trm'_raw_alpha_pat'_raw.intros[no_vars] -abbreviation "Var \ VAR_raw" -abbreviation "App \ APP_raw" +abbreviation "Var \ Var_raw" +abbreviation "App \ App_raw" abbreviation "Lam \ Lam_raw" abbreviation "Lett \ Let_raw" abbreviation "PN \ PN_raw" @@ -151,38 +151,61 @@ abbreviation "PD \ PD_raw" abbreviation "f \ f_raw" -(* not_yet_done -name = namea \ alpha_trm'_raw (Var_raw name) (Var_raw namea) -alpha_trm'_raw trm'_raw2 trm'_raw2a \ alpha_trm'_raw trm'_raw1 trm'_raw1a \ -alpha_trm'_raw (App_raw trm'_raw1 trm'_raw2) (App_raw trm'_raw1a trm'_raw2a) -\pi. ({atom name}, trm'_raw) \gen alpha_trm'_raw fv_trm'_raw pi ({atom namea}, trm'_rawa) \ -alpha_trm'_raw (Lam_raw name trm'_raw) (Lam_raw namea trm'_rawa) -\pi. (f_raw pat'_raw, - trm'_raw2) \gen alpha_trm'_raw fv_trm'_raw pi (f_raw pat'_rawa, trm'_raw2a) \ - alpha_trm'_raw trm'_raw1 trm'_raw1a \ - (f_raw pat'_raw, - pat'_raw) \gen alpha_pat'_raw fv_pat'_raw pi (f_raw pat'_rawa, pat'_rawa) \ -alpha_trm'_raw (Let_raw pat'_raw trm'_raw1 trm'_raw2) (Let_raw pat'_rawa trm'_raw1a trm'_raw2a) -True \ alpha_pat'_raw PN_raw PN_raw -name = namea \ alpha_pat'_raw (PS_raw name) (PS_raw namea) -name2 = name2a \ name1 = name1a \ alpha_pat'_raw (PD_raw name1 name2) (PD_raw name1a name2a) -*) +(* not_yet_done *) +inductive + alpha_trm' :: "trm'_raw \ trm'_raw \ bool" and + alpha_pat' :: "pat'_raw \ pat'_raw \ bool" and + compat_pat' :: "pat'_raw \ perm \ pat'_raw \ bool" +where + "name = name' \ alpha_trm' (Var name) (Var name')" +| "alpha_trm' t2 t2' \ alpha_trm' t1 t1' \ alpha_trm' (App t1 t2) (App t1' t2')" +| "\pi. ({atom x}, t) \gen alpha_trm' fv_trm'_raw pi ({atom x'}, t') \ alpha_trm' (Lam x t) (Lam x' t')" +| "\pi. (f p, t) \gen alpha_trm' fv_trm'_raw pi (f p', t') \ alpha_trm' s s' \ + compat_pat' p pi p' \ alpha_trm' (Lett p s t) (Lett p' s' t')" +| "alpha_pat' PN PN" +| "name = name' \ alpha_pat' (PS name) (PS name')" +| "name2 = name2' \ name1 = name1' \ alpha_pat' (PD name1 name2) (PD name1' name2')" +| "compat_pat' PN pi PN" +| "pi \ x = x' \ compat_pat' (PS x) pi (PS x')" +| "pi \ p1 = p1' \ pi \ p2 = p2' \ compat_pat' (PD p1 p2) pi (PD p1' p2')" -(* compat should be -compat (PN) pi (PN) == True -compat (PS x) pi (PS x') == pi o x = x' -compat (PD p1 p2) pi (PD p1' p2') == compat p1 pi p1' & compat p2 pi p2' -*) - +lemma + assumes a: "distinct [x, y, z, u]" + shows "alpha_trm' (Lett (PD x u) t (App (Var x) (Var y))) + (Lett (PD z u) t (App (Var z) (Var y)))" +using a +apply - +apply(rule alpha_trm'_alpha_pat'_compat_pat'.intros) +apply(auto simp add: alpha_gen) +apply(rule_tac x="(x \ z)" in exI) +apply(auto simp add: fresh_star_def) +defer +apply(rule alpha_trm'_alpha_pat'_compat_pat'.intros) +apply(simp add: alpha_trm'_alpha_pat'_compat_pat'.intros) +defer +apply(rule alpha_trm'_alpha_pat'_compat_pat'.intros) +apply(simp) +(* they can be proved *) +oops -thm alpha_trm'_raw_alpha_pat'_raw.intros[no_vars] -thm fv_trm'_raw_fv_pat'_raw.simps[no_vars] -thm f_raw.simps -(*thm trm'_pat'_induct -thm trm'_pat'_perm -thm trm'_pat'_fv -thm trm'_pat'_bn -thm trm'_pat'_inject*) +lemma + assumes a: "distinct [x, y, z, u]" + shows "\ alpha_trm' (Lett (PD x u) t (App (Var x) (Var y))) + (Lett (PD z z) t (App (Var z) (Var y)))" +using a +apply(clarify) +apply(erule alpha_trm'.cases) +apply(simp_all) +apply(auto simp add: alpha_gen) +apply(erule alpha_trm'.cases) +apply(simp_all) +apply(clarify) +apply(erule compat_pat'.cases) +apply(simp_all) +apply(clarify) +apply(erule alpha_trm'.cases) +apply(simp_all) +done nominal_datatype trm0 = Var0 "name"