diff -r 3d54fcc5f41a -r 6f3b75135638 Quot/Nominal/Terms.thy --- a/Quot/Nominal/Terms.thy Thu Feb 18 23:07:28 2010 +0100 +++ b/Quot/Nominal/Terms.thy Thu Feb 18 23:07:52 2010 +0100 @@ -25,52 +25,71 @@ where "bv1 (BUnit) = {}" | "bv1 (BVr x) = {atom x}" -| "bv1 (BPr bp1 bp2) = (bv1 bp1) \ (bv1 bp1)" - -local_setup {* define_raw_fv "Terms.rtrm1" - [[[[]], [[], []], [[(NONE, 0)], [(NONE, 0)]], [[(NONE, 0)], [], [(SOME @{term bv1}, 0)]]], - [[], [[]], [[], []]]] *} -print_theorems +| "bv1 (BPr bp1 bp2) = (bv1 bp1) \ (bv1 bp2)" setup {* snd o define_raw_perms ["rtrm1", "bp"] ["Terms.rtrm1", "Terms.bp"] *} -inductive - alpha1 :: "rtrm1 \ rtrm1 \ bool" ("_ \1 _" [100, 100] 100) -where - a1: "a = b \ (rVr1 a) \1 (rVr1 b)" -| a2: "\t1 \1 t2; s1 \1 s2\ \ rAp1 t1 s1 \1 rAp1 t2 s2" -| a3: "(\pi. (({atom aa}, t) \gen alpha1 fv_rtrm1 pi ({atom ab}, s))) \ rLm1 aa t \1 rLm1 ab s" -| a4: "t1 \1 t2 \ (\pi. (((bv1 b1), s1) \gen alpha1 fv_rtrm1 pi ((bv1 b2), s2))) \ rLt1 b1 t1 s1 \1 rLt1 b2 t2 s2" +local_setup {* snd o define_fv_alpha "Terms.rtrm1" + [[[[]], [[], []], [[(NONE, 0)], [(NONE, 0)]], [[(SOME @{term bv1}, 0)], [], [(SOME @{term bv1}, 0)]]], + [[], [[]], [[], []]]] *} +print_theorems +notation + alpha_rtrm1 ("_ \1 _" [100, 100] 100) and + alpha_bp ("_ \1b _" [100, 100] 100) +thm alpha_rtrm1_alpha_bp.intros lemma alpha1_inj: "(rVr1 a \1 rVr1 b) = (a = b)" "(rAp1 t1 s1 \1 rAp1 t2 s2) = (t1 \1 t2 \ s1 \1 s2)" -"(rLm1 aa t \1 rLm1 ab s) = (\pi. (({atom aa}, t) \gen alpha1 fv_rtrm1 pi ({atom ab}, s)))" -"(rLt1 b1 t1 s1 \1 rLt1 b2 t2 s2) = (t1 \1 t2 \ (\pi. (((bv1 b1), s1) \gen alpha1 fv_rtrm1 pi ((bv1 b2), s2))))" +"(rLm1 aa t \1 rLm1 ab s) = (\pi. (({atom aa}, t) \gen alpha_rtrm1 fv_rtrm1 pi ({atom ab}, s)))" +"(rLt1 bp rtrm11 rtrm12 \1 rLt1 bpa rtrm11a rtrm12a) = + ((\pi. (bv1 bp, bp) \gen alpha_bp fv_bp pi (bv1 bpa, bpa)) \ rtrm11 \1 rtrm11a \ + (\pi. (bv1 bp, rtrm12) \gen alpha_rtrm1 fv_rtrm1 pi (bv1 bpa, rtrm12a)))" +"alpha_bp BUnit BUnit" +"(alpha_bp (BVr name) (BVr namea)) = (name = namea)" +"(alpha_bp (BPr bp1 bp2) (BPr bp1a bp2a)) = (alpha_bp bp1 bp1a \ alpha_bp bp2 bp2a)" apply - -apply rule apply (erule alpha1.cases) apply (simp_all add: alpha1.intros) -apply rule apply (erule alpha1.cases) apply (simp_all add: alpha1.intros) -apply rule apply (erule alpha1.cases) apply (simp_all add: alpha1.intros) -apply rule apply (erule alpha1.cases) apply (simp_all add: alpha1.intros) +apply rule apply (erule alpha_rtrm1.cases) apply (simp_all add: alpha_rtrm1_alpha_bp.intros) +apply rule apply (erule alpha_rtrm1.cases) apply (simp_all add: alpha_rtrm1_alpha_bp.intros) +apply rule apply (erule alpha_rtrm1.cases) apply (simp_all add: alpha_rtrm1_alpha_bp.intros) +apply rule apply (erule alpha_rtrm1.cases) apply (simp_all add: alpha_rtrm1_alpha_bp.intros) +apply rule apply (erule alpha_bp.cases) apply (simp_all add: alpha_rtrm1_alpha_bp.intros) +apply rule apply (erule alpha_bp.cases) apply (simp_all add: alpha_rtrm1_alpha_bp.intros) done -(* Shouyld we derive it? But bv is given by the user? *) +lemma alpha_bp_refl: "alpha_bp a a" +apply induct +apply (simp_all add: alpha1_inj) +done + +lemma alpha_bp_eq_eq: "alpha_bp a b = (a = b)" +apply rule +apply (induct a b rule: alpha_rtrm1_alpha_bp.inducts(2)) +apply (simp_all add: alpha_bp_refl) +done + +lemma alpha_bp_eq: "alpha_bp = (op =)" +apply (rule ext)+ +apply (rule alpha_bp_eq_eq) +done + lemma bv1_eqvt[eqvt]: shows "(pi \ bv1 x) = bv1 (pi \ x)" apply (induct x) -apply (simp_all add: empty_eqvt insert_eqvt atom_eqvt) +apply (simp_all add: empty_eqvt insert_eqvt atom_eqvt eqvts) done lemma fv_rtrm1_eqvt[eqvt]: - shows "(pi\fv_rtrm1 t) = fv_rtrm1 (pi\t)" - apply (induct t) + "(pi\fv_rtrm1 t) = fv_rtrm1 (pi\t)" + "(pi\fv_bp b) = fv_bp (pi\b)" + apply (induct t and b) apply (simp_all add: insert_eqvt atom_eqvt empty_eqvt union_eqvt Diff_eqvt bv1_eqvt) done - lemma alpha1_eqvt: - shows "t \1 s \ (pi \ t) \1 (pi \ s)" - apply (induct t s rule: alpha1.inducts) + "t \1 s \ (pi \ t) \1 (pi \ s)" + "alpha_bp a b \ alpha_bp (pi \ a) (pi \ b)" + apply (induct t s and a b rule: alpha_rtrm1_alpha_bp.inducts) apply (simp_all add:eqvts alpha1_inj) apply (erule exE) apply (rule_tac x="pi \ pia" in exI) @@ -84,6 +103,8 @@ apply(simp add: atom_eqvt Diff_eqvt fv_rtrm1_eqvt insert_eqvt empty_eqvt) apply(simp add: permute_eqvt[symmetric]) apply (erule exE) + apply (erule exE) + apply (rule conjI) apply (rule_tac x="pi \ pia" in exI) apply (simp add: alpha_gen) apply(erule conjE)+ @@ -94,63 +115,60 @@ apply(rule_tac ?p1="- pi" in fresh_star_permute_iff[THEN iffD1]) apply(simp add: atom_eqvt fv_rtrm1_eqvt Diff_eqvt bv1_eqvt) apply(simp add: permute_eqvt[symmetric]) + apply (rule_tac x="pi \ piaa" in exI) + apply (simp add: alpha_gen) + apply(erule conjE)+ + apply(rule conjI) + apply(rule_tac ?p1="- pi" in permute_eq_iff[THEN iffD1]) + apply(simp add: fv_rtrm1_eqvt Diff_eqvt bv1_eqvt) + apply(rule conjI) + apply(rule_tac ?p1="- pi" in fresh_star_permute_iff[THEN iffD1]) + apply(simp add: atom_eqvt fv_rtrm1_eqvt Diff_eqvt bv1_eqvt) + apply(simp add: permute_eqvt[symmetric]) done -lemma alpha1_equivp: "equivp alpha1" +lemma alpha1_equivp: "equivp alpha_rtrm1" sorry -quotient_type trm1 = rtrm1 / alpha1 +quotient_type trm1 = rtrm1 / alpha_rtrm1 by (rule alpha1_equivp) -quotient_definition - "Vr1 :: name \ trm1" -is - "rVr1" - -quotient_definition - "Ap1 :: trm1 \ trm1 \ trm1" -is - "rAp1" - -quotient_definition - "Lm1 :: name \ trm1 \ trm1" -is - "rLm1" - -quotient_definition - "Lt1 :: bp \ trm1 \ trm1 \ trm1" -is - "rLt1" - -quotient_definition - "fv_trm1 :: trm1 \ atom set" -is - "fv_rtrm1" +local_setup {* +(fn ctxt => ctxt + |> snd o (Quotient_Def.quotient_lift_const ("Vr1", @{term rVr1})) + |> snd o (Quotient_Def.quotient_lift_const ("Ap1", @{term rAp1})) + |> snd o (Quotient_Def.quotient_lift_const ("Lm1", @{term rLm1})) + |> snd o (Quotient_Def.quotient_lift_const ("Lt1", @{term rLt1})) + |> snd o (Quotient_Def.quotient_lift_const ("fv_trm1", @{term fv_rtrm1}))) +*} +print_theorems lemma alpha_rfv1: shows "t \1 s \ fv_rtrm1 t = fv_rtrm1 s" - apply(induct rule: alpha1.induct) + apply(induct rule: alpha_rtrm1_alpha_bp.inducts(1)) apply(simp_all add: alpha_gen.simps) done lemma [quot_respect]: - "(op = ===> alpha1) rVr1 rVr1" - "(alpha1 ===> alpha1 ===> alpha1) rAp1 rAp1" - "(op = ===> alpha1 ===> alpha1) rLm1 rLm1" - "(op = ===> alpha1 ===> alpha1 ===> alpha1) rLt1 rLt1" + "(op = ===> alpha_rtrm1) rVr1 rVr1" + "(alpha_rtrm1 ===> alpha_rtrm1 ===> alpha_rtrm1) rAp1 rAp1" + "(op = ===> alpha_rtrm1 ===> alpha_rtrm1) rLm1 rLm1" + "(op = ===> alpha_rtrm1 ===> alpha_rtrm1 ===> alpha_rtrm1) rLt1 rLt1" apply (auto simp add: alpha1_inj) apply (rule_tac x="0" in exI) apply (simp add: fresh_star_def fresh_zero_perm alpha_rfv1 alpha_gen) apply (rule_tac x="0" in exI) +apply (simp add: alpha_gen fresh_star_def fresh_zero_perm alpha_rfv1 alpha_bp_eq) +apply (rule_tac x="0" in exI) apply (simp add: alpha_gen fresh_star_def fresh_zero_perm alpha_rfv1) done lemma [quot_respect]: - "(op = ===> alpha1 ===> alpha1) permute permute" + "(op = ===> alpha_rtrm1 ===> alpha_rtrm1) permute permute" by (simp add: alpha1_eqvt) lemma [quot_respect]: - "(alpha1 ===> op =) fv_rtrm1 fv_rtrm1" + "(alpha_rtrm1 ===> op =) fv_rtrm1 fv_rtrm1" by (simp add: alpha_rfv1) lemmas trm1_bp_induct = rtrm1_bp.induct[quot_lifted] @@ -224,6 +242,17 @@ apply(simp add: supp_Pair supp_atom bp_supp) done +lemma fv_eq_bv: "fv_bp bp = bv1 bp" +apply(induct bp rule: trm1_bp_inducts(2)) +apply(simp_all) +done + +lemma helper: "{b. \pi. pi \ (a \ b) \ bp \ bp} = {}" +apply auto +apply (rule_tac x="(x \ a)" in exI) +apply auto +done + lemma supp_fv: shows "supp t = fv_trm1 t" apply(induct t rule: trm1_bp_inducts(1)) @@ -240,13 +269,13 @@ apply(simp add: alpha_gen.simps) apply(simp add: supp_eqvt[symmetric] fv_trm1_eqvt[symmetric]) apply(subgoal_tac "supp (Lt1 bp rtrm11 rtrm12) = supp(rtrm11) \ supp (Abs (bv1 bp) rtrm12)") -apply(simp add: supp_Abs fv_trm1) +apply(simp add: supp_Abs fv_trm1 fv_eq_bv) apply(simp (no_asm) add: supp_def) -apply(simp add: alpha1_INJ) +apply(simp add: alpha1_INJ alpha_bp_eq) apply(simp add: Abs_eq_iff) apply(simp add: alpha_gen) -apply(simp add: supp_eqvt[symmetric] fv_trm1_eqvt[symmetric] bv1_eqvt) -apply(simp add: Collect_imp_eq Collect_neg_eq) +apply(simp add: supp_eqvt[symmetric] fv_trm1_eqvt[symmetric] bv1_eqvt fv_eq_bv) +apply(simp add: Collect_imp_eq Collect_neg_eq fresh_star_def helper) done lemma trm1_supp: @@ -254,7 +283,7 @@ "supp (Ap1 t1 t2) = supp t1 \ supp t2" "supp (Lm1 x t) = (supp t) - {atom x}" "supp (Lt1 b t s) = supp t \ (supp s - bv1 b)" - by (simp_all only: supp_fv fv_trm1) +by (simp_all add: supp_fv fv_trm1 fv_eq_bv) lemma trm1_induct_strong: assumes "\name b. P b (Vr1 name)" @@ -280,37 +309,40 @@ where "rbv2 (rAs x t) = {atom x}" -local_setup {* define_raw_fv "Terms.rtrm2" - [[[[]], [[], []], [[(NONE, 0)], [(NONE, 0)]], [[], [(SOME @{term rbv2}, 0)]]], - [[[(NONE, 0)], []]]] *} -print_theorems - setup {* snd o define_raw_perms ["rtrm2", "rassign"] ["Terms.rtrm2", "Terms.rassign"] *} -inductive - alpha2 :: "rtrm2 \ rtrm2 \ bool" ("_ \2 _" [100, 100] 100) -and - alpha2a :: "rassign \ rassign \ bool" ("_ \2a _" [100, 100] 100) -where - a1: "a = b \ (rVr2 a) \2 (rVr2 b)" -| a2: "\t1 \2 t2; s1 \2 s2\ \ rAp2 t1 s1 \2 rAp2 t2 s2" -| a3: "(\pi. (({atom a}, t) \gen alpha2 fv_rtrm2 pi ({atom b}, s))) \ rLm2 a t \2 rLm2 b s" -| a4: "\\pi. ((rbv2 bt, t) \gen alpha2 fv_rtrm2 pi ((rbv2 bs), s)); - \pi. ((rbv2 bt, bt) \gen alpha2a fv_rassign pi (rbv2 bs, bs))\ - \ rLt2 bt t \2 rLt2 bs s" -| a5: "\a = b; t \2 s\ \ rAs a t \2a rAs b s" (* This way rbv2 can be lifted *) +local_setup {* snd o define_fv_alpha "Terms.rtrm2" + [[[[]], [[], []], [[(NONE, 0)], [(NONE, 0)]], [[(SOME @{term rbv2}, 0)], [(SOME @{term rbv2}, 0)]]], + [[[], []]]] *} +print_theorems + +notation + alpha_rtrm2 ("_ \2 _" [100, 100] 100) and + alpha_rassign ("_ \2b _" [100, 100] 100) +thm alpha_rtrm2_alpha_rassign.intros lemma alpha2_equivp: - "equivp alpha2" - "equivp alpha2a" + "equivp alpha_rtrm2" + "equivp alpha_rassign" sorry quotient_type - trm2 = rtrm2 / alpha2 + trm2 = rtrm2 / alpha_rtrm2 and - assign = rassign / alpha2a + assign = rassign / alpha_rassign by (auto intro: alpha2_equivp) +local_setup {* +(fn ctxt => ctxt + |> snd o (Quotient_Def.quotient_lift_const ("Vr2", @{term rVr2})) + |> snd o (Quotient_Def.quotient_lift_const ("Ap2", @{term rAp2})) + |> snd o (Quotient_Def.quotient_lift_const ("Lm2", @{term rLm2})) + |> snd o (Quotient_Def.quotient_lift_const ("Lt2", @{term rLt2})) + |> snd o (Quotient_Def.quotient_lift_const ("As", @{term rAs})) + |> snd o (Quotient_Def.quotient_lift_const ("fv_trm2", @{term fv_rtrm2})) + |> snd o (Quotient_Def.quotient_lift_const ("bv2", @{term rbv2}))) +*} +print_theorems section {*** lets with many assignments ***} @@ -331,36 +363,27 @@ "bv3 ANil = {}" | "bv3 (ACons x t as) = {atom x} \ (bv3 as)" -local_setup {* define_raw_fv "Terms.trm3" - [[[[]], [[], []], [[(NONE, 0)], [(NONE, 0)]], [[], [(SOME @{term bv3}, 0)]]], - [[], [[(NONE, 0)], [], []]]] *} -print_theorems - setup {* snd o define_raw_perms ["rtrm3", "assigns"] ["Terms.trm3", "Terms.assigns"] *} -inductive - alpha3 :: "trm3 \ trm3 \ bool" ("_ \3 _" [100, 100] 100) -and - alpha3a :: "assigns \ assigns \ bool" ("_ \3a _" [100, 100] 100) -where - a1: "a = b \ (Vr3 a) \3 (Vr3 b)" -| a2: "\t1 \3 t2; s1 \3 s2\ \ Ap3 t1 s1 \3 Ap3 t2 s2" -| a3: "(\pi. (({atom a}, t) \gen alpha3 fv_rtrm3 pi ({atom b}, s))) \ Lm3 a t \3 Lm3 b s" -| a4: "\\pi. ((bv3 bt, t) \gen alpha3 fv_trm3 pi ((bv3 bs), s)); - \pi. ((bv3 bt, bt) \gen alpha3a fv_assign pi (bv3 bs, bs))\ - \ Lt3 bt t \3 Lt3 bs s" -| a5: "ANil \3a ANil" -| a6: "\a = b; t \3 s; tt \3a st\ \ ACons a t tt \3a ACons b s st" +local_setup {* snd o define_fv_alpha "Terms.trm3" + [[[[]], [[], []], [[(NONE, 0)], [(NONE, 0)]], [[(SOME @{term bv3}, 0)], [(SOME @{term bv3}, 0)]]], + [[], [[], [], []]]] *} +print_theorems + +notation + alpha_trm3 ("_ \3 _" [100, 100] 100) and + alpha_assigns ("_ \3a _" [100, 100] 100) +thm alpha_trm3_alpha_assigns.intros lemma alpha3_equivp: - "equivp alpha3" - "equivp alpha3a" + "equivp alpha_trm3" + "equivp alpha_assigns" sorry quotient_type - qtrm3 = trm3 / alpha3 + qtrm3 = trm3 / alpha_trm3 and - qassigns = assigns / alpha3a + qassigns = assigns / alpha_assigns by (auto intro: alpha3_equivp) @@ -374,10 +397,6 @@ thm trm4.recs -local_setup {* define_raw_fv "Terms.trm4" [ - [[[]], [[], []], [[(NONE, 0)], [(NONE, 0)]]], [[], [[], []]] ] *} -print_theorems - (* there cannot be a clause for lists, as *) (* permutations are already defined in Nominal (also functions, options, and so on) *) setup {* snd o define_raw_perms ["trm4"] ["Terms.trm4"] *} @@ -393,22 +412,21 @@ thm permute_trm4_permute_trm4_list.simps thm permute_trm4_permute_trm4_list.simps[simplified repaired] -inductive - alpha4 :: "trm4 \ trm4 \ bool" ("_ \4 _" [100, 100] 100) -and alpha4list :: "trm4 list \ trm4 list \ bool" ("_ \4list _" [100, 100] 100) -where - a1: "a = b \ (Vr4 a) \4 (Vr4 b)" -| a2: "\t1 \4 t2; s1 \4list s2\ \ Ap4 t1 s1 \4 Ap4 t2 s2" -| a3: "(\pi. (({atom a}, t) \gen alpha4 fv_rtrm4 pi ({atom b}, s))) \ Lm4 a t \4 Lm4 b s" -| a5: "[] \4list []" -| a6: "\t \4 s; ts \4list ss\ \ (t#ts) \4list (s#ss)" +local_setup {* snd o define_fv_alpha "Terms.trm4" [ + [[[]], [[], []], [[(NONE, 0)], [(NONE, 0)]]], [[], [[], []]] ] *} +print_theorems -lemma alpha4_equivp: "equivp alpha4" sorry -lemma alpha4list_equivp: "equivp alpha4list" sorry +notation + alpha_trm4 ("_ \4 _" [100, 100] 100) and + alpha_trm4_list ("_ \4l _" [100, 100] 100) +thm alpha_trm4_alpha_trm4_list.intros + +lemma alpha4_equivp: "equivp alpha_trm4" sorry +lemma alpha4list_equivp: "equivp alpha_trm4_list" sorry quotient_type - qtrm4 = trm4 / alpha4 and - qtrm4list = "trm4 list" / alpha4list + qtrm4 = trm4 / alpha_trm4 and + qtrm4list = "trm4 list" / alpha_trm4_list by (simp_all add: alpha4_equivp alpha4list_equivp) @@ -426,101 +444,70 @@ "rbv5 rLnil = {}" | "rbv5 (rLcons n t ltl) = {atom n} \ (rbv5 ltl)" -local_setup {* define_raw_fv "Terms.rtrm5" [ - [[[]], [[], []], [[(SOME @{term rbv5}, 0)], [(SOME @{term rbv5}, 0)]]], [[], [[(NONE, 0)], [], []]] ] *} -print_theorems setup {* snd o define_raw_perms ["rtrm5", "rlts"] ["Terms.rtrm5", "Terms.rlts"] *} print_theorems -inductive - alpha5 :: "rtrm5 \ rtrm5 \ bool" ("_ \5 _" [100, 100] 100) -and - alphalts :: "rlts \ rlts \ bool" ("_ \l _" [100, 100] 100) -where - a1: "a = b \ (rVr5 a) \5 (rVr5 b)" -| a2: "\t1 \5 t2; s1 \5 s2\ \ rAp5 t1 s1 \5 rAp5 t2 s2" -| a3: "\\pi. ((rbv5 l1, t1) \gen alpha5 fv_rtrm5 pi (rbv5 l2, t2)); - \pi. ((rbv5 l1, l1) \gen alphalts fv_rlts pi (rbv5 l2, l2))\ - \ rLt5 l1 t1 \5 rLt5 l2 t2" -| a4: "rLnil \l rLnil" -| a5: "ls1 \l ls2 \ t1 \5 t2 \ n1 = n2 \ rLcons n1 t1 ls1 \l rLcons n2 t2 ls2" +local_setup {* snd o define_fv_alpha "Terms.rtrm5" [ + [[[]], [[], []], [[(SOME @{term rbv5}, 0)], [(SOME @{term rbv5}, 0)]]], [[], [[], [], []]] ] *} +print_theorems -print_theorems +(* Alternate version with additional binding of name in rlts in rLcons *) +(*local_setup {* snd o define_fv_alpha "Terms.rtrm5" [ + [[[]], [[], []], [[(SOME @{term rbv5}, 0)], [(SOME @{term rbv5}, 0)]]], [[], [[(NONE,0)], [], [(NONE,0)]]] ] *} +print_theorems*) + +notation + alpha_rtrm5 ("_ \5 _" [100, 100] 100) and + alpha_rlts ("_ \l _" [100, 100] 100) +thm alpha_rtrm5_alpha_rlts.intros lemma alpha5_inj: "((rVr5 a) \5 (rVr5 b)) = (a = b)" "(rAp5 t1 s1 \5 rAp5 t2 s2) = (t1 \5 t2 \ s1 \5 s2)" - "(rLt5 l1 t1 \5 rLt5 l2 t2) = ((\pi. ((rbv5 l1, t1) \gen alpha5 fv_rtrm5 pi (rbv5 l2, t2))) \ - (\pi. ((rbv5 l1, l1) \gen alphalts fv_rlts pi (rbv5 l2, l2))))" + "(rLt5 l1 t1 \5 rLt5 l2 t2) = ((\pi. ((rbv5 l1, t1) \gen alpha_rtrm5 fv_rtrm5 pi (rbv5 l2, t2))) \ + (\pi. ((rbv5 l1, l1) \gen alpha_rlts fv_rlts pi (rbv5 l2, l2))))" "rLnil \l rLnil" "(rLcons n1 t1 ls1 \l rLcons n2 t2 ls2) = (n1 = n2 \ ls1 \l ls2 \ t1 \5 t2)" apply - -apply (simp_all add: alpha5_alphalts.intros) +apply (simp_all add: alpha_rtrm5_alpha_rlts.intros) apply rule -apply (erule alpha5.cases) -apply (simp_all add: alpha5_alphalts.intros) +apply (erule alpha_rtrm5.cases) +apply (simp_all add: alpha_rtrm5_alpha_rlts.intros) apply rule -apply (erule alpha5.cases) -apply (simp_all add: alpha5_alphalts.intros) +apply (erule alpha_rtrm5.cases) +apply (simp_all add: alpha_rtrm5_alpha_rlts.intros) apply rule -apply (erule alpha5.cases) -apply (simp_all add: alpha5_alphalts.intros) +apply (erule alpha_rtrm5.cases) +apply (simp_all add: alpha_rtrm5_alpha_rlts.intros) apply rule -apply (erule alphalts.cases) -apply (simp_all add: alpha5_alphalts.intros) +apply (erule alpha_rlts.cases) +apply (simp_all add: alpha_rtrm5_alpha_rlts.intros) done lemma alpha5_equivps: - shows "equivp alpha5" - and "equivp alphalts" + shows "equivp alpha_rtrm5" + and "equivp alpha_rlts" sorry quotient_type - trm5 = rtrm5 / alpha5 + trm5 = rtrm5 / alpha_rtrm5 and - lts = rlts / alphalts + lts = rlts / alpha_rlts by (auto intro: alpha5_equivps) -quotient_definition - "Vr5 :: name \ trm5" -is - "rVr5" - -quotient_definition - "Ap5 :: trm5 \ trm5 \ trm5" -is - "rAp5" - -quotient_definition - "Lt5 :: lts \ trm5 \ trm5" -is - "rLt5" - -quotient_definition - "Lnil :: lts" -is - "rLnil" - -quotient_definition - "Lcons :: name \ trm5 \ lts \ lts" -is - "rLcons" - -quotient_definition - "fv_trm5 :: trm5 \ atom set" -is - "fv_rtrm5" - -quotient_definition - "fv_lts :: lts \ atom set" -is - "fv_rlts" - -quotient_definition - "bv5 :: lts \ atom set" -is - "rbv5" +local_setup {* +(fn ctxt => ctxt + |> snd o (Quotient_Def.quotient_lift_const ("Vr5", @{term rVr5})) + |> snd o (Quotient_Def.quotient_lift_const ("Ap5", @{term rAp5})) + |> snd o (Quotient_Def.quotient_lift_const ("Lt5", @{term rLt5})) + |> snd o (Quotient_Def.quotient_lift_const ("Lnil", @{term rLnil})) + |> snd o (Quotient_Def.quotient_lift_const ("Lcons", @{term rLcons})) + |> snd o (Quotient_Def.quotient_lift_const ("fv_trm5", @{term fv_rtrm5})) + |> snd o (Quotient_Def.quotient_lift_const ("fv_lts", @{term fv_rlts})) + |> snd o (Quotient_Def.quotient_lift_const ("bv5", @{term rbv5}))) +*} +print_theorems lemma rbv5_eqvt: "pi \ (rbv5 x) = rbv5 (pi \ x)" @@ -537,13 +524,13 @@ lemma alpha5_eqvt: "xa \5 y \ (x \ xa) \5 (x \ y)" "xb \l ya \ (x \ xb) \l (x \ ya)" - apply(induct rule: alpha5_alphalts.inducts) + apply(induct rule: alpha_rtrm5_alpha_rlts.inducts) apply (simp_all add: alpha5_inj) apply (erule exE)+ apply(unfold alpha_gen) apply (erule conjE)+ apply (rule conjI) - apply (rule_tac x="x \ pi" in exI) + apply (rule_tac x="x \ pia" in exI) apply (rule conjI) apply(rule_tac ?p1="- x" in permute_eq_iff[THEN iffD1]) apply(simp add: atom_eqvt Diff_eqvt insert_eqvt set_eqvt empty_eqvt rbv5_eqvt fv_rtrm5_eqvt) @@ -552,7 +539,7 @@ apply(simp add: atom_eqvt Diff_eqvt insert_eqvt set_eqvt empty_eqvt rbv5_eqvt fv_rtrm5_eqvt) apply (subst permute_eqvt[symmetric]) apply (simp) - apply (rule_tac x="x \ pia" in exI) + apply (rule_tac x="x \ pi" in exI) apply (rule conjI) apply(rule_tac ?p1="- x" in permute_eq_iff[THEN iffD1]) apply(simp add: atom_eqvt Diff_eqvt insert_eqvt set_eqvt empty_eqvt rbv5_eqvt fv_rlts_eqvt) @@ -566,27 +553,27 @@ lemma alpha5_rfv: "(t \5 s \ fv_rtrm5 t = fv_rtrm5 s)" "(l \l m \ fv_rlts l = fv_rlts m)" - apply(induct rule: alpha5_alphalts.inducts) + apply(induct rule: alpha_rtrm5_alpha_rlts.inducts) apply(simp_all add: alpha_gen) done lemma bv_list_rsp: shows "x \l y \ rbv5 x = rbv5 y" - apply(induct rule: alpha5_alphalts.inducts(2)) + apply(induct rule: alpha_rtrm5_alpha_rlts.inducts(2)) apply(simp_all) done lemma [quot_respect]: - "(alphalts ===> op =) fv_rlts fv_rlts" - "(alpha5 ===> op =) fv_rtrm5 fv_rtrm5" - "(alphalts ===> op =) rbv5 rbv5" - "(op = ===> alpha5) rVr5 rVr5" - "(alpha5 ===> alpha5 ===> alpha5) rAp5 rAp5" - "(alphalts ===> alpha5 ===> alpha5) rLt5 rLt5" - "(alphalts ===> alpha5 ===> alpha5) rLt5 rLt5" - "(op = ===> alpha5 ===> alphalts ===> alphalts) rLcons rLcons" - "(op = ===> alpha5 ===> alpha5) permute permute" - "(op = ===> alphalts ===> alphalts) permute permute" + "(alpha_rlts ===> op =) fv_rlts fv_rlts" + "(alpha_rtrm5 ===> op =) fv_rtrm5 fv_rtrm5" + "(alpha_rlts ===> op =) rbv5 rbv5" + "(op = ===> alpha_rtrm5) rVr5 rVr5" + "(alpha_rtrm5 ===> alpha_rtrm5 ===> alpha_rtrm5) rAp5 rAp5" + "(alpha_rlts ===> alpha_rtrm5 ===> alpha_rtrm5) rLt5 rLt5" + "(alpha_rlts ===> alpha_rtrm5 ===> alpha_rtrm5) rLt5 rLt5" + "(op = ===> alpha_rtrm5 ===> alpha_rlts ===> alpha_rlts) rLcons rLcons" + "(op = ===> alpha_rtrm5 ===> alpha_rtrm5) permute permute" + "(op = ===> alpha_rlts ===> alpha_rlts) permute permute" apply (simp_all add: alpha5_inj alpha5_rfv alpha5_eqvt bv_list_rsp) apply (clarify) apply (rule conjI) apply (rule_tac x="0" in exI) apply (simp add: fresh_star_def fresh_zero_perm alpha_gen alpha5_rfv) @@ -597,7 +584,7 @@ done lemma - shows "(alphalts ===> op =) rbv5 rbv5" + shows "(alpha_rlts ===> op =) rbv5 rbv5" by (simp add: bv_list_rsp) lemmas trm5_lts_inducts = rtrm5_rlts.inducts[quot_lifted] @@ -686,7 +673,7 @@ lemma distinct_helper: shows "\(rVr5 x \5 rAp5 y z)" apply auto - apply (erule alpha5.cases) + apply (erule alpha_rtrm5.cases) apply (simp_all only: rtrm5.distinct) done @@ -719,13 +706,15 @@ | "rbv6 (rLm6 n t) = {atom n} \ rbv6 t" | "rbv6 (rLt6 l r) = rbv6 l \ rbv6 r" -local_setup {* define_raw_fv "Terms.rtrm6" [ - [[[]], [[(NONE, 0)], [(NONE, 0)]], [[], [(SOME @{term rbv6}, 0)]]]] *} -print_theorems - setup {* snd o define_raw_perms ["rtrm6"] ["Terms.rtrm6"] *} print_theorems +local_setup {* snd o define_fv_alpha "Terms.rtrm6" [ + [[[]], [[(NONE, 0)], [(NONE, 0)]], [[(SOME @{term rbv6}, 0)], [(SOME @{term rbv6}, 0)]]]] *} +notation alpha_rtrm6 ("_ \6a _" [100, 100] 100) +(* HERE THE RULES DIFFER *) +thm alpha_rtrm6.intros + inductive alpha6 :: "rtrm6 \ rtrm6 \ bool" ("_ \6 _" [100, 100] 100) where @@ -741,30 +730,15 @@ trm6 = rtrm6 / alpha6 by (auto intro: alpha6_equivps) -quotient_definition - "Vr6 :: name \ trm6" -is - "rVr6" - -quotient_definition - "Lm6 :: name \ trm6 \ trm6" -is - "rLm6" - -quotient_definition - "Lt6 :: trm6 \ trm6 \ trm6" -is - "rLt6" - -quotient_definition - "fv_trm6 :: trm6 \ atom set" -is - "fv_rtrm6" - -quotient_definition - "bv6 :: trm6 \ atom set" -is - "rbv6" +local_setup {* +(fn ctxt => ctxt + |> snd o (Quotient_Def.quotient_lift_const ("Vr6", @{term rVr6})) + |> snd o (Quotient_Def.quotient_lift_const ("Lm6", @{term rLm6})) + |> snd o (Quotient_Def.quotient_lift_const ("Lt6", @{term rLt6})) + |> snd o (Quotient_Def.quotient_lift_const ("fv_trm6", @{term fv_rtrm6})) + |> snd o (Quotient_Def.quotient_lift_const ("bv6", @{term rbv6}))) +*} +print_theorems lemma [quot_respect]: "(op = ===> alpha6 ===> alpha6) permute permute" @@ -772,7 +746,6 @@ sorry (* Definitely not true , see lemma below *) - lemma [quot_respect]:"(alpha6 ===> op =) rbv6 rbv6" apply simp apply clarify apply (erule alpha6.induct) @@ -875,13 +848,16 @@ | "rbv7 (rLm7 n t) = rbv7 t - {atom n}" | "rbv7 (rLt7 l r) = rbv7 l \ rbv7 r" -local_setup {* define_raw_fv "Terms.rtrm7" [ - [[[]], [[(NONE, 0)], [(NONE, 0)]], [[], [(SOME @{term rbv7}, 0)]]]] *} -print_theorems - setup {* snd o define_raw_perms ["rtrm7"] ["Terms.rtrm7"] *} print_theorems +local_setup {* snd o define_fv_alpha "Terms.rtrm7" [ + [[[]], [[(NONE, 0)], [(NONE, 0)]], [[(SOME @{term rbv7}, 0)], [(SOME @{term rbv7}, 0)]]]] *} +notation + alpha_rtrm7 ("_ \7a _" [100, 100] 100) +(* HERE THE RULES DIFFER *) +thm alpha_rtrm7.intros + inductive alpha7 :: "rtrm7 \ rtrm7 \ bool" ("_ \7 _" [100, 100] 100) where @@ -889,11 +865,6 @@ | a2: "(\pi. (({atom a}, t) \gen alpha7 fv_rtrm7 pi ({atom b}, s))) \ rLm7 a t \7 rLm7 b s" | a3: "(\pi. (((rbv7 t1), s1) \gen alpha7 fv_rtrm7 pi ((rbv7 t2), s2))) \ rLt7 t1 s1 \7 rLt7 t2 s2" -lemma bvfv7: "rbv7 x = fv_rtrm7 x" - apply induct - apply simp_all -done - lemma "(x::name) \ y \ \ (alpha7 ===> op =) rbv7 rbv7" apply simp apply (rule_tac x="rLt7 (rVr7 x) (rVr7 x)" in exI) @@ -923,13 +894,18 @@ "rbv8 (Bar0 x) = {}" | "rbv8 (Bar1 v x b) = {atom v}" -local_setup {* define_raw_fv "Terms.rfoo8" [ - [[[]], [[], [(SOME @{term rbv8}, 0)]]], [[[]], [[], [(NONE, 1)], [(NONE, 1)]]]] *} -print_theorems - setup {* snd o define_raw_perms ["rfoo8", "rbar8"] ["Terms.rfoo8", "Terms.rbar8"] *} print_theorems +local_setup {* snd o define_fv_alpha "Terms.rfoo8" [ + [[[]], [[(SOME @{term rbv8}, 0)], [(SOME @{term rbv8}, 0)]]], [[[]], [[], [(NONE, 1)], [(NONE, 1)]]]] *} +notation + alpha_rfoo8 ("_ \f' _" [100, 100] 100) and + alpha_rbar8 ("_ \b' _" [100, 100] 100) +(* HERE THE RULE DIFFERS *) +thm alpha_rfoo8_alpha_rbar8.intros + + inductive alpha8f :: "rfoo8 \ rfoo8 \ bool" ("_ \f _" [100, 100] 100) and @@ -958,6 +934,9 @@ apply simp apply clarify apply (erule alpha8f_alpha8b.inducts(1)) apply (simp_all add: alpha_gen fv_rbar8_rsp_hlp) + apply clarify + apply (erule alpha8f_alpha8b.inducts(2)) + apply (simp_all) done @@ -977,12 +956,17 @@ "rbv9 (Var9 x) = {}" | "rbv9 (Lam9 x b) = {atom x}" -local_setup {* define_raw_fv "Terms.rlam9" [ - [[[]], [[(NONE, 0)], [(NONE, 0)]]], [[[], [(SOME @{term rbv9}, 0)]]]] *} +setup {* snd o define_raw_perms ["rlam9", "rbla9"] ["Terms.rlam9", "Terms.rbla9"] *} print_theorems -setup {* snd o define_raw_perms ["rlam9", "rbla9"] ["Terms.rlam9", "Terms.rbla9"] *} -print_theorems +local_setup {* snd o define_fv_alpha "Terms.rlam9" [ + [[[]], [[(NONE, 0)], [(NONE, 0)]]], [[[(SOME @{term rbv9}, 0)], [(SOME @{term rbv9}, 0)]]]] *} +notation + alpha_rlam9 ("_ \9l' _" [100, 100] 100) and + alpha_rbla9 ("_ \9b' _" [100, 100] 100) +(* HERE THE RULES DIFFER *) +thm alpha_rlam9_alpha_rbla9.intros + inductive alpha9l :: "rlam9 \ rlam9 \ bool" ("_ \9l _" [100, 100] 100) @@ -997,35 +981,16 @@ lam9 = rlam9 / alpha9l and bla9 = rbla9 / alpha9b sorry -quotient_definition - "qVar9 :: name \ lam9" -is - "Var9" - -quotient_definition - "qLam :: name \ lam9 \ lam9" -is - "Lam9" - -quotient_definition - "qBla9 :: lam9 \ lam9 \ bla9" -is - "Bla9" - -quotient_definition - "fv_lam9 :: lam9 \ atom set" -is - "fv_rlam9" - -quotient_definition - "fv_bla9 :: bla9 \ atom set" -is - "fv_rbla9" - -quotient_definition - "bv9 :: lam9 \ atom set" -is - "rbv9" +local_setup {* +(fn ctxt => ctxt + |> snd o (Quotient_Def.quotient_lift_const ("qVar9", @{term Var9})) + |> snd o (Quotient_Def.quotient_lift_const ("qLam9", @{term Lam9})) + |> snd o (Quotient_Def.quotient_lift_const ("qBla9", @{term Bla9})) + |> snd o (Quotient_Def.quotient_lift_const ("fv_lam9", @{term fv_rlam9})) + |> snd o (Quotient_Def.quotient_lift_const ("fv_bla9", @{term fv_rbla9})) + |> snd o (Quotient_Def.quotient_lift_const ("bv9", @{term rbv9}))) +*} +print_theorems instantiation lam9 and bla9 :: pt begin @@ -1072,14 +1037,11 @@ setup {* snd o define_raw_perms ["tyS"] ["Terms.tyS"] *} print_theorems -abbreviation - "atoms xs \ {atom x| x. x \ xs}" - local_setup {* define_raw_fv "Terms.ty" [[[[]], [[], []]]] *} print_theorems (* -doesn't work yet +Doesnot work yet since we do not refer to fv_ty local_setup {* define_raw_fv "Terms.tyS" [[[[], []]]] *} print_theorems *) @@ -1087,12 +1049,12 @@ primrec fv_tyS where - "fv_tyS (All xs T) = (fv_ty T - atoms xs)" + "fv_tyS (All xs T) = (fv_ty T - atom ` xs)" inductive alpha_tyS :: "tyS \ tyS \ bool" ("_ \tyS _" [100, 100] 100) where - a1: "\pi. ((atoms xs1, T1) \gen (op =) fv_ty pi (atoms xs2, T2)) + a1: "\pi. ((atom ` xs1, T1) \gen (op =) fv_ty pi (atom ` xs2, T2)) \ All xs1 T1 \tyS All xs2 T2" lemma