merge
authorCezary Kaliszyk <kaliszyk@in.tum.de>
Wed, 15 Jun 2011 11:06:48 +0900
changeset 2855 1af453d56083
parent 2853 7661c4d7ca31 (current diff)
parent 2854 b577f06e0804 (diff)
child 2856 e36beb11723c
merge
--- a/Nominal/Ex/Let.thy	Wed Jun 15 09:51:26 2011 +0900
+++ b/Nominal/Ex/Let.thy	Wed Jun 15 11:06:48 2011 +0900
@@ -90,6 +90,69 @@
 
 lemmas alpha_bn_inducts = alpha_bn_inducts_raw[quot_lifted]
 
+lemma Abs_lst_fcb:
+  fixes xs ys :: "'a :: fs"
+    and S T :: "'b :: fs"
+  assumes e: "(Abs_lst (ba xs) T) = (Abs_lst (ba ys) S)"
+    and f1: "\<And>x. x \<in> set (ba xs) \<Longrightarrow> x \<sharp> f xs T"
+    and f2: "\<And>x. supp T - set (ba xs) = supp S - set (ba ys) \<Longrightarrow> x \<in> set (ba ys) \<Longrightarrow> x \<sharp> f xs T"
+    and eqv: "\<And>p. p \<bullet> T = S \<Longrightarrow> p \<bullet> ba xs = ba ys \<Longrightarrow> supp p \<subseteq> set (ba xs) \<union> set (ba ys) \<Longrightarrow> p \<bullet> (f xs T) = f ys S"
+  shows "f xs T = f ys S"
+  using e apply -
+  apply(subst (asm) Abs_eq_iff2)
+  apply(simp add: alphas)
+  apply(elim exE conjE)
+  apply(rule trans)
+  apply(rule_tac p="p" in supp_perm_eq[symmetric])
+  apply(rule fresh_star_supp_conv)
+  apply(drule fresh_star_perm_set_conv)
+  apply(rule finite_Diff)
+  apply(rule finite_supp)
+  apply(subgoal_tac "(set (ba xs) \<union> set (ba ys)) \<sharp>* f xs T")
+  apply(metis Un_absorb2 fresh_star_Un)
+  apply(subst fresh_star_Un)
+  apply(rule conjI)
+  apply(simp add: fresh_star_def f1)
+  apply(simp add: fresh_star_def f2)
+  apply(simp add: eqv)
+  done
+
+lemma max_eqvt[eqvt]: "p \<bullet> (max (a :: _ :: pure) b) = max (p \<bullet> a) (p \<bullet> b)"
+  by (simp add: permute_pure)
+
+(* TODO: should be provided by nominal *)
+lemma [eqvt]: "p \<bullet> bn a = bn (p \<bullet> a)"
+  by descending (rule eqvts)
+
+(* PROBLEM: the proof needs induction on alpha_bn inside which is not possible... *)
+nominal_primrec
+    height_trm :: "trm \<Rightarrow> nat"
+and height_assn :: "assn \<Rightarrow> nat"
+where
+  "height_trm (Var x) = 1"
+| "height_trm (App l r) = max (height_trm l) (height_trm r)"
+| "height_trm (Lam v b) = 1 + (height_trm b)"
+| "height_trm (Let as b) = max (height_assn as) (height_trm b)"
+| "height_assn ANil = 0"
+| "height_assn (ACons v t as) = max (height_trm t) (height_assn as)"
+  apply (simp only: eqvt_def height_trm_height_assn_graph_def)
+  apply (rule, perm_simp, rule, rule TrueI)
+  apply (case_tac x)
+  apply (case_tac a rule: trm_assn.exhaust(1))
+  apply (auto)[4]
+  apply (drule_tac x="assn" in meta_spec)
+  apply (drule_tac x="trm" in meta_spec)
+  apply (simp add: alpha_bn_refl)
+  apply (case_tac b rule: trm_assn.exhaust(2))
+  apply (auto)
+  apply (erule Abs_lst1_fcb)
+  apply (simp_all add: pure_fresh)
+  apply (simp add: eqvt_at_def)
+  apply (erule Abs_lst_fcb)
+  apply (simp_all add: pure_fresh)
+  apply (simp_all add: eqvt_at_def eqvts)
+  oops
+
 nominal_primrec
     subst  :: "name \<Rightarrow> trm \<Rightarrow> trm \<Rightarrow> trm"
 and substa :: "name \<Rightarrow> trm \<Rightarrow> assn \<Rightarrow> assn"
@@ -118,6 +181,7 @@
   apply auto
   apply (simp_all add: meta_eq_to_obj_eq[OF subst_def, symmetric, unfolded fun_eq_iff])
   apply (simp_all add: meta_eq_to_obj_eq[OF substa_def, symmetric, unfolded fun_eq_iff])
+  (*apply (erule Abs_lst1_fcb)*)
   prefer 3
   apply (erule alpha_bn_inducts)
   apply (simp add: alpha_bn_refl)