# HG changeset patch # User Cezary Kaliszyk # Date 1265118907 -3600 # Node ID 41fc4d3fc76465077b5a35828e53faae26a5b510 # Parent 163d6917af629721c640fcac4a7295eb71e2549c First experiments in Terms. diff -r 163d6917af62 -r 41fc4d3fc764 Quot/Nominal/LamEx.thy --- a/Quot/Nominal/LamEx.thy Tue Feb 02 13:10:46 2010 +0100 +++ b/Quot/Nominal/LamEx.thy Tue Feb 02 14:55:07 2010 +0100 @@ -619,5 +619,5 @@ -end +end< diff -r 163d6917af62 -r 41fc4d3fc764 Quot/Nominal/LamEx2.thy --- a/Quot/Nominal/LamEx2.thy Tue Feb 02 13:10:46 2010 +0100 +++ b/Quot/Nominal/LamEx2.thy Tue Feb 02 14:55:07 2010 +0100 @@ -4,6 +4,7 @@ (* lemmas that should be in Nominal \\must be cleaned *) +(* Currently not used, still needed needed? *) lemma supp_finite_set: fixes S::"atom set" assumes "finite S" diff -r 163d6917af62 -r 41fc4d3fc764 Quot/Nominal/Terms.thy --- a/Quot/Nominal/Terms.thy Tue Feb 02 13:10:46 2010 +0100 +++ b/Quot/Nominal/Terms.thy Tue Feb 02 14:55:07 2010 +0100 @@ -1,5 +1,5 @@ theory Terms -imports "Nominal2_Atoms" "Nominal2_Eqvt" "Nominal2_Supp" "../QuotMain" +imports "Nominal2_Atoms" "Nominal2_Eqvt" "Nominal2_Supp" "../QuotMain" "Abs" begin atom_decl name @@ -8,11 +8,11 @@ section {*** lets with binding patterns ***} -datatype trm1 = - Vr1 "name" -| Ap1 "trm1" "trm1" -| Lm1 "name" "trm1" --"name is bound in trm1" -| Lt1 "bp" "trm1" "trm1" --"all variables in bp are bound in the 2nd trm1" +datatype rtrm1 = + rVr1 "name" +| rAp1 "rtrm1" "rtrm1" +| rLm1 "name" "rtrm1" --"name is bound in trm1" +| rLt1 "bp" "rtrm1" "rtrm1" --"all variables in bp are bound in the 2nd trm1" and bp = BUnit | BVr "name" @@ -28,78 +28,96 @@ (* needs to be calculated by the package *) primrec - fv_trm1 and fv_bp + rfv_trm1 and rfv_bp where - "fv_trm1 (Vr1 x) = {atom x}" -| "fv_trm1 (Ap1 t1 t2) = (fv_trm1 t1) \ (fv_trm1 t2)" -| "fv_trm1 (Lm1 x t) = (fv_trm1 t) - {atom x}" -| "fv_trm1 (Lt1 bp t1 t2) = (fv_trm1 t1) \ (fv_trm1 t2 - bv1 bp)" -| "fv_bp (BUnit) = {}" -| "fv_bp (BVr x) = {atom x}" -| "fv_bp (BPr b1 b2) = (fv_bp b1) \ (fv_bp b2)" + "rfv_trm1 (rVr1 x) = {atom x}" +| "rfv_trm1 (rAp1 t1 t2) = (rfv_trm1 t1) \ (rfv_trm1 t2)" +| "rfv_trm1 (rLm1 x t) = (rfv_trm1 t) - {atom x}" +| "rfv_trm1 (rLt1 bp t1 t2) = (rfv_trm1 t1) \ (rfv_trm1 t2 - bv1 bp)" +| "rfv_bp (BUnit) = {}" +| "rfv_bp (BVr x) = {atom x}" +| "rfv_bp (BPr b1 b2) = (rfv_bp b1) \ (rfv_bp b2)" (* needs to be stated by the package *) instantiation - trm1 and bp :: pt + rtrm1 and bp :: pt begin primrec - permute_trm1 and permute_bp + permute_rtrm1 and permute_bp where - "permute_trm1 pi (Vr1 a) = Vr1 (pi \ a)" -| "permute_trm1 pi (Ap1 t1 t2) = Ap1 (permute_trm1 pi t1) (permute_trm1 pi t2)" -| "permute_trm1 pi (Lm1 a t) = Lm1 (pi \ a) (permute_trm1 pi t)" -| "permute_trm1 pi (Lt1 bp t1 t2) = Lt1 (permute_bp pi bp) (permute_trm1 pi t1) (permute_trm1 pi t2)" + "permute_rtrm1 pi (rVr1 a) = rVr1 (pi \ a)" +| "permute_rtrm1 pi (rAp1 t1 t2) = rAp1 (permute_rtrm1 pi t1) (permute_rtrm1 pi t2)" +| "permute_rtrm1 pi (rLm1 a t) = rLm1 (pi \ a) (permute_rtrm1 pi t)" +| "permute_rtrm1 pi (rLt1 bp t1 t2) = rLt1 (permute_bp pi bp) (permute_rtrm1 pi t1) (permute_rtrm1 pi t2)" | "permute_bp pi (BUnit) = BUnit" | "permute_bp pi (BVr a) = BVr (pi \ a)" | "permute_bp pi (BPr bp1 bp2) = BPr (permute_bp pi bp1) (permute_bp pi bp2)" -lemma pt_trm1_bp_zero: - fixes t::trm1 +lemma pt_rtrm1_bp_zero: + fixes t::rtrm1 and b::bp shows "0 \ t = t" and "0 \ b = b" -apply(induct t and b rule: trm1_bp.inducts) +apply(induct t and b rule: rtrm1_bp.inducts) apply(simp_all) done -lemma pt_trm1_bp_plus: - fixes t::trm1 +lemma pt_rtrm1_bp_plus: + fixes t::rtrm1 and b::bp shows "((p + q) \ t) = p \ (q \ t)" and "((p + q) \ b) = p \ (q \ b)" -apply(induct t and b rule: trm1_bp.inducts) +apply(induct t and b rule: rtrm1_bp.inducts) apply(simp_all) done instance apply default -apply(simp_all add: pt_trm1_bp_zero pt_trm1_bp_plus) +apply(simp_all add: pt_rtrm1_bp_zero pt_rtrm1_bp_plus) done end inductive - alpha1 :: "trm1 \ trm1 \ bool" ("_ \1 _" [100, 100] 100) + alpha1 :: "rtrm1 \ rtrm1 \ bool" ("_ \1 _" [100, 100] 100) where - a1: "a = b \ (Vr1 a) \1 (Vr1 b)" -| a2: "\t1 \1 t2; s1 \1 s2\ \ Ap1 t1 s1 \1 Ap1 t2 s2" -| a3: "\pi. (fv_trm1 t - {atom a} = fv_trm1 s - {atom b} \ - (fv_trm1 t - {atom a})\* pi \ - (pi \ t) \1 s \ (pi \ a) = b) - \ Lm1 a t \1 Lm1 b s" -| a4: "\pi.(t1 \1 t2 \ - (fv_trm1 s1 - fv_bp b1 = fv_trm1 s2 - fv_bp b2) \ - (fv_trm1 s1 - fv_bp b1) \* pi \ - (pi \ s1 = s2) (* Optional: \ (pi \ b1 = b2) *)) - \ Lt1 b1 t1 s1 \1 Lt1 b2 t2 s2" + 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 rfv_trm1 pi ({atom ab}, s))) \ rLm1 aa t \1 rLm1 ab s" +| a4: "t1 \1 t2 \ (\pi. (((bv1 b1), s1) \gen alpha1 rfv_trm1 pi ((bv1 b2), s2))) \ rLt1 b1 t1 s1 \1 rLt1 b2 t2 s2" + +lemma alpha_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 rfv_trm1 pi ({atom ab}, s)))" +"(rLt1 b1 t1 s1 \1 rLt1 b2 t2 s2) = (t1 \1 t2 \ (\pi. (((bv1 b1), s1) \gen alpha1 rfv_trm1 pi ((bv1 b2), s2))))" +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) +done + +lemma rfv1_eqvt[eqvt]: + shows "(pi\rfv_trm1 t) = rfv_trm1 (pi\t)" + sorry + +lemma alpha1_eqvt: + shows "t \1 s \ (pi \ t) \1 (pi \ s)" + sorry lemma alpha1_equivp: "equivp alpha1" sorry -quotient_type qtrm1 = trm1 / alpha1 +quotient_type trm1 = rtrm1 / alpha1 by (rule alpha1_equivp) +quotient_definition + "Vr1 :: name \ trm1" +as + "rVr1" + section {*** lets with single assignments ***}