--- a/Quot/Nominal/LamEx.thy Mon Feb 01 15:46:25 2010 +0100
+++ b/Quot/Nominal/LamEx.thy Mon Feb 01 15:57:37 2010 +0100
@@ -1,5 +1,5 @@
theory LamEx
-imports "Nominal2_Atoms" "Nominal2_Eqvt" "Nominal2_Supp" "../QuotMain" "Abs" "../QuotProd"
+imports "Nominal2_Atoms" "Nominal2_Eqvt" "Nominal2_Supp" "../QuotMain" "Abs"
begin
@@ -26,6 +26,13 @@
apply(simp)
done
+lemma fresh_minus_perm:
+ fixes p::perm
+ shows "a \<sharp> (- p) \<longleftrightarrow> a \<sharp> p"
+ apply(simp add: fresh_def)
+ apply(simp only: supp_minus_perm)
+ done
+
lemma fresh_plus:
fixes p q::perm
shows "\<lbrakk>a \<sharp> p; a \<sharp> q\<rbrakk> \<Longrightarrow> a \<sharp> (p + q)"
@@ -146,13 +153,12 @@
where
a1: "a = b \<Longrightarrow> (rVar a) \<approx> (rVar b)"
| a2: "\<lbrakk>t1 \<approx> t2; s1 \<approx> s2\<rbrakk> \<Longrightarrow> rApp t1 s1 \<approx> rApp t2 s2"
-| a3: "\<exists>pi. (({atom a}, t) \<approx>gen alpha rfv pi ({atom b}, s)) \<Longrightarrow> rLam a t \<approx> rLam b s"
-
-thm alpha.induct
+| a3: "\<exists>pi. (rfv t - {atom a} = rfv s - {atom b} \<and> (rfv t - {atom a})\<sharp>* pi \<and> (pi \<bullet> t) \<approx> s)
+ \<Longrightarrow> rLam a t \<approx> rLam b s"
lemma a3_inverse:
assumes "rLam a t \<approx> rLam b s"
- shows "\<exists>pi. (({atom a}, t) \<approx>gen alpha rfv pi ({atom b}, s))"
+ shows "\<exists>pi. (rfv t - {atom a} = rfv s - {atom b} \<and> (rfv t - {atom a})\<sharp>* pi \<and> (pi \<bullet> t) \<approx> s)"
using assms
apply(erule_tac alpha.cases)
apply(auto)
@@ -166,11 +172,11 @@
apply(simp add: a2)
apply(simp)
apply(rule a3)
+apply(erule conjE)
apply(erule exE)
+apply(erule conjE)
apply(rule_tac x="pi \<bullet> pia" in exI)
-apply(simp add: alpha_gen.simps)
-apply(erule conjE)+
-apply(rule conjI)+
+apply(rule conjI)
apply(rule_tac ?p1="- pi" in permute_eq_iff[THEN iffD1])
apply(simp add: eqvts atom_eqvt)
apply(rule conjI)
@@ -187,43 +193,24 @@
apply(simp add: a2)
apply(rule a3)
apply(rule_tac x="0" in exI)
-apply(rule alpha_gen_refl)
-apply(assumption)
+apply(simp_all add: fresh_star_def fresh_zero_perm)
done
-lemma fresh_minus_perm:
- fixes p::perm
- shows "a \<sharp> (- p) \<longleftrightarrow> a \<sharp> p"
- apply(simp add: fresh_def)
- apply(simp only: supp_minus_perm)
- done
-
-lemma alpha_gen_atom_sym:
- assumes a: "\<And>pi t s. (R t s \<Longrightarrow> R (pi \<bullet> t) (pi \<bullet> s))"
- shows "\<exists>pi. ({atom a}, t) \<approx>gen \<lambda>x1 x2. R x1 x2 \<and> R x2 x1 f pi ({atom b}, s) \<Longrightarrow>
- \<exists>pi. ({atom b}, s) \<approx>gen R f pi ({atom a}, t)"
- apply(erule exE)
- apply(rule_tac x="- pi" in exI)
- apply(simp add: alpha_gen.simps)
- apply(erule conjE)+
- apply(rule conjI)
- apply(simp add: fresh_star_def fresh_minus_perm)
- apply(subgoal_tac "R (- pi \<bullet> s) ((- pi) \<bullet> (pi \<bullet> t))")
- apply simp
- apply(rule a)
- apply assumption
- done
-
lemma alpha_sym:
shows "t \<approx> s \<Longrightarrow> s \<approx> t"
- apply(induct rule: alpha.induct)
- apply(simp add: a1)
- apply(simp add: a2)
- apply(rule a3)
- apply(rule alpha_gen_atom_sym)
- apply(rule alpha_eqvt)
- apply(assumption)+
- done
+apply(induct rule: alpha.induct)
+apply(simp add: a1)
+apply(simp add: a2)
+apply(rule a3)
+apply(erule exE)
+apply(rule_tac x="- pi" in exI)
+apply(simp)
+apply(simp add: fresh_star_def fresh_minus_perm)
+apply(erule conjE)+
+apply(rotate_tac 3)
+apply(drule_tac pi="- pi" in alpha_eqvt)
+apply(simp)
+done
lemma alpha_trans:
shows "t1 \<approx> t2 \<Longrightarrow> t2 \<approx> t3 \<Longrightarrow> t1 \<approx> t3"
@@ -238,13 +225,11 @@
apply(rotate_tac 1)
apply(erule alpha.cases)
apply(simp_all)
-apply(simp add: alpha_gen.simps)
apply(erule conjE)+
apply(erule exE)+
apply(erule conjE)+
apply(rule a3)
apply(rule_tac x="pia + pi" in exI)
-apply(simp add: alpha_gen.simps)
apply(simp add: fresh_star_plus)
apply(drule_tac x="- pia \<bullet> sa" in spec)
apply(drule mp)
@@ -266,9 +251,89 @@
lemma alpha_rfv:
shows "t \<approx> s \<Longrightarrow> rfv t = rfv s"
apply(induct rule: alpha.induct)
- apply(simp_all add: alpha_gen.simps)
+ apply(simp_all)
done
+inductive
+ alpha2 :: "rlam \<Rightarrow> rlam \<Rightarrow> bool" ("_ \<approx>2 _" [100, 100] 100)
+where
+ a21: "a = b \<Longrightarrow> (rVar a) \<approx>2 (rVar b)"
+| a22: "\<lbrakk>t1 \<approx>2 t2; s1 \<approx>2 s2\<rbrakk> \<Longrightarrow> rApp t1 s1 \<approx>2 rApp t2 s2"
+| a23: "(a = b \<and> t \<approx>2 s) \<or> (a \<noteq> b \<and> ((a \<leftrightarrow> b) \<bullet> t) \<approx>2 s \<and> atom b \<notin> rfv t)\<Longrightarrow> rLam a t \<approx>2 rLam b s"
+
+lemma fv_vars:
+ fixes a::name
+ assumes a1: "\<forall>x \<in> rfv t - {atom a}. pi \<bullet> x = x"
+ shows "(pi \<bullet> t) \<approx>2 ((a \<leftrightarrow> (pi \<bullet> a)) \<bullet> t)"
+using a1
+apply(induct t)
+apply(auto)
+apply(rule a21)
+apply(case_tac "name = a")
+apply(simp)
+apply(simp)
+defer
+apply(rule a22)
+apply(simp)
+apply(simp)
+apply(rule a23)
+apply(case_tac "a = name")
+apply(simp)
+oops
+
+
+lemma
+ assumes a1: "t \<approx>2 s"
+ shows "t \<approx> s"
+using a1
+apply(induct)
+apply(rule alpha.intros)
+apply(simp)
+apply(rule alpha.intros)
+apply(simp)
+apply(simp)
+apply(rule alpha.intros)
+apply(erule disjE)
+apply(rule_tac x="0" in exI)
+apply(simp add: fresh_star_def fresh_zero_perm)
+apply(erule conjE)+
+apply(drule alpha_rfv)
+apply(simp)
+apply(rule_tac x="(a \<leftrightarrow> b)" in exI)
+apply(simp)
+apply(erule conjE)+
+apply(rule conjI)
+apply(drule alpha_rfv)
+apply(drule sym)
+apply(simp)
+apply(simp add: rfv_eqvt[symmetric])
+defer
+apply(subgoal_tac "atom a \<sharp> (rfv t - {atom a})")
+apply(subgoal_tac "atom b \<sharp> (rfv t - {atom a})")
+
+defer
+sorry
+
+lemma
+ assumes a1: "t \<approx> s"
+ shows "t \<approx>2 s"
+using a1
+apply(induct)
+apply(rule alpha2.intros)
+apply(simp)
+apply(rule alpha2.intros)
+apply(simp)
+apply(simp)
+apply(clarify)
+apply(rule alpha2.intros)
+apply(frule alpha_rfv)
+apply(rotate_tac 4)
+apply(drule sym)
+apply(simp)
+apply(drule sym)
+apply(simp)
+oops
+
quotient_type lam = rlam / alpha
by (rule alpha_equivp)
@@ -313,7 +378,7 @@
apply(rule a3)
apply(rule_tac x="0" in exI)
unfolding fresh_star_def
- apply(simp add: fresh_star_def fresh_zero_perm alpha_gen.simps)
+ apply(simp add: fresh_star_def fresh_zero_perm)
apply(simp add: alpha_rfv)
done
@@ -376,60 +441,10 @@
"\<lbrakk>x = xa; xb = xc\<rbrakk> \<Longrightarrow> App x xb = App xa xc"
by (lifting a2)
-lemma alpha_gen_rsp_pre:
- assumes a5: "\<And>t s. R t s \<Longrightarrow> R (pi \<bullet> t) (pi \<bullet> s)"
- and a1: "R s1 t1"
- and a2: "R s2 t2"
- and a3: "\<And>a b c d. R a b \<Longrightarrow> R c d \<Longrightarrow> R1 a c = R2 b d"
- and a4: "\<And>x y. R x y \<Longrightarrow> fv1 x = fv2 y"
- shows "(a, s1) \<approx>gen R1 fv1 pi (b, s2) = (a, t1) \<approx>gen R2 fv2 pi (b, t2)"
-apply (simp add: alpha_gen.simps)
-apply (simp only: a4[symmetric, OF a1] a4[symmetric, OF a2])
-apply auto
-apply (subst a3[symmetric])
-apply (rule a5)
-apply (rule a1)
-apply (rule a2)
-apply (assumption)
-apply (subst a3)
-apply (rule a5)
-apply (rule a1)
-apply (rule a2)
-apply (assumption)
-done
-
-lemma [quot_respect]: "(prod_rel op = alpha ===>
- (alpha ===> alpha ===> op =) ===> (alpha ===> op =) ===> op = ===> prod_rel op = alpha ===> op =)
- alpha_gen alpha_gen"
-apply simp
-apply clarify
-apply (rule alpha_gen_rsp_pre[of "alpha",OF alpha_eqvt])
-apply auto
-done
-
-lemma pi_rep: "pi \<bullet> (rep_lam x) = rep_lam (pi \<bullet> x)"
-apply (unfold rep_lam_def)
-sorry
-
-lemma [quot_preserve]: "(prod_fun id rep_lam --->
- (abs_lam ---> abs_lam ---> id) ---> (abs_lam ---> id) ---> id ---> (prod_fun id rep_lam) ---> id)
- alpha_gen = alpha_gen"
-apply (simp add: expand_fun_eq)
-apply (simp add: alpha_gen.simps)
-apply (simp add: pi_rep)
-apply (simp only: Quotient_abs_rep[OF Quotient_lam])
-apply auto
-done
-
-lemma alpha_prs [quot_preserve]: "(rep_lam ---> rep_lam ---> id) alpha = (op =)"
-apply (simp add: expand_fun_eq)
-sledgehammer
-sorry
-
-
-lemma a3:
- "\<exists>pi. ({atom a}, t) \<approx>gen (op =) fv pi ({atom b}, s) \<Longrightarrow> Lam a t = Lam b s"
- apply (lifting a3)
+lemma a3:
+ "\<lbrakk>\<exists>pi. (fv t - {atom a} = fv s - {atom b} \<and> (fv t - {atom a})\<sharp>* pi \<and> (pi \<bullet> t) = s)\<rbrakk>
+ \<Longrightarrow> Lam a t = Lam b s"
+ apply (lifting a3)
done
lemma a3_inv: