merge
authorCezary Kaliszyk <kaliszyk@in.tum.de>
Fri, 26 Mar 2010 17:22:17 +0100
changeset 1660 d1293d30c657
parent 1659 758904445fb2 (current diff)
parent 1658 aacab5f67333 (diff)
child 1663 d87a872e7f67
child 1664 aa999d263b10
merge
--- a/Nominal/Abs.thy	Fri Mar 26 17:22:02 2010 +0100
+++ b/Nominal/Abs.thy	Fri Mar 26 17:22:17 2010 +0100
@@ -51,145 +51,187 @@
   by (case_tac [!] bs, case_tac [!] cs) 
      (auto simp add: le_fun_def le_bool_def alphas)
 
-lemma alpha_gen_refl:
-  assumes a: "R x x"
-  shows "(bs, x) \<approx>gen R f 0 (bs, x)"
-  and   "(bs, x) \<approx>res R f 0 (bs, x)"
-  and   "(cs, x) \<approx>lst R f 0 (cs, x)"
-  using a 
-  unfolding alphas
-  unfolding fresh_star_def
-  by (simp_all add: fresh_zero_perm)
-
-lemma alpha_gen_sym:
-  assumes a: "R (p \<bullet> x) y \<Longrightarrow> R (- p \<bullet> y) x"
-  shows "(bs, x) \<approx>gen R f p (cs, y) \<Longrightarrow> (cs, y) \<approx>gen R f (- p) (bs, x)"
-  and   "(bs, x) \<approx>res R f p (cs, y) \<Longrightarrow> (cs, y) \<approx>res R f (- p) (bs, x)"
-  and   "(ds, x) \<approx>lst R f p (es, y) \<Longrightarrow> (es, y) \<approx>lst R f (- p) (ds, x)"
-  using a
-  unfolding alphas
-  unfolding fresh_star_def
-  by (auto simp add:  fresh_minus_perm)
-
-lemma alpha_gen_trans:
-  assumes a: "\<lbrakk>R (p \<bullet> x) y; R (q \<bullet> y) z\<rbrakk> \<Longrightarrow> R ((q + p) \<bullet> x) z"
-  shows "\<lbrakk>(bs, x) \<approx>gen R f p (cs, y); (cs, y) \<approx>gen R f q (ds, z)\<rbrakk> \<Longrightarrow> (bs, x) \<approx>gen R f (q + p) (ds, z)"
-  and   "\<lbrakk>(bs, x) \<approx>res R f p (cs, y); (cs, y) \<approx>res R f q (ds, z)\<rbrakk> \<Longrightarrow> (bs, x) \<approx>res R f (q + p) (ds, z)"
-  and   "\<lbrakk>(es, x) \<approx>lst R f p (gs, y); (gs, y) \<approx>lst R f q (hs, z)\<rbrakk> \<Longrightarrow> (es, x) \<approx>lst R f (q + p) (hs, z)"
-  using a 
-  unfolding alphas
-  unfolding fresh_star_def
-  by (simp_all add: fresh_plus_perm)
-
-lemma alpha_gen_eqvt:
-  assumes a: "R (q \<bullet> x) y \<Longrightarrow> R (p \<bullet> (q \<bullet> x)) (p \<bullet> y)"
-  and     b: "p \<bullet> (f x) = f (p \<bullet> x)"
-  and     c: "p \<bullet> (f y) = f (p \<bullet> y)"
-  shows "(bs, x) \<approx>gen R f q (cs, y) \<Longrightarrow> (p \<bullet> bs, p \<bullet> x) \<approx>gen R f (p \<bullet> q) (p \<bullet> cs, p \<bullet> y)"
-  and   "(bs, x) \<approx>res R f q (cs, y) \<Longrightarrow> (p \<bullet> bs, p \<bullet> x) \<approx>res R f (p \<bullet> q) (p \<bullet> cs, p \<bullet> y)"
-  and   "(ds, x) \<approx>lst R f q (es, y) \<Longrightarrow> (p \<bullet> ds, p \<bullet> x) \<approx>lst R f (p \<bullet> q) (p \<bullet> es, p \<bullet> y)" 
-  unfolding alphas
-  unfolding set_eqvt[symmetric]
-  unfolding b[symmetric] c[symmetric]
-  unfolding Diff_eqvt[symmetric]
-  unfolding permute_eqvt[symmetric]
-  using a
-  by (auto simp add: fresh_star_permute_iff)
-
 fun
   alpha_abs 
 where
   "alpha_abs (bs, x) (cs, y) \<longleftrightarrow> (\<exists>p. (bs, x) \<approx>gen (op=) supp p (cs, y))"
 
+fun
+  alpha_abs_lst
+where
+  "alpha_abs_lst (bs, x) (cs, y) \<longleftrightarrow> (\<exists>p. (bs, x) \<approx>lst (op=) supp p (cs, y))"
+
+fun
+  alpha_abs_res
+where
+  "alpha_abs_res (bs, x) (cs, y) \<longleftrightarrow> (\<exists>p. (bs, x) \<approx>res (op=) supp p (cs, y))"
+
 notation
-  alpha_abs ("_ \<approx>abs _")
+  alpha_abs ("_ \<approx>abs _") and
+  alpha_abs_lst ("_ \<approx>abs'_lst _") and
+  alpha_abs_res ("_ \<approx>abs'_res _")
+
+lemmas alphas_abs = alpha_abs.simps alpha_abs_res.simps alpha_abs_lst.simps
+
+lemma alphas_abs_refl:
+  shows "(bs, x) \<approx>abs (bs, x)"
+  and   "(bs, x) \<approx>abs_res (bs, x)"
+  and   "(cs, x) \<approx>abs_lst (cs, x)" 
+  unfolding alphas_abs
+  unfolding alphas
+  unfolding fresh_star_def
+  by (rule_tac [!] x="0" in exI)
+     (simp_all add: fresh_zero_perm)
+
+lemma alphas_abs_sym:
+  shows "(bs, x) \<approx>abs (cs, y) \<Longrightarrow> (cs, y) \<approx>abs (bs, x)"
+  and   "(bs, x) \<approx>abs_res (cs, y) \<Longrightarrow> (cs, y) \<approx>abs_res (bs, x)"
+  and   "(ds, x) \<approx>abs_lst (es, y) \<Longrightarrow> (es, y) \<approx>abs_lst (ds, x)"
+  unfolding alphas_abs
+  unfolding alphas
+  unfolding fresh_star_def
+  by (erule_tac [!] exE, rule_tac [!] x="-p" in exI)
+     (auto simp add: fresh_minus_perm)
 
-lemma alpha_abs_swap:
+lemma alphas_abs_trans:
+  shows "\<lbrakk>(bs, x) \<approx>abs (cs, y); (cs, y) \<approx>abs (ds, z)\<rbrakk> \<Longrightarrow> (bs, x) \<approx>abs (ds, z)"
+  and   "\<lbrakk>(bs, x) \<approx>abs_res (cs, y); (cs, y) \<approx>abs_res (ds, z)\<rbrakk> \<Longrightarrow> (bs, x) \<approx>abs_res (ds, z)"
+  and   "\<lbrakk>(es, x) \<approx>abs_lst (gs, y); (gs, y) \<approx>abs_lst (hs, z)\<rbrakk> \<Longrightarrow> (es, x) \<approx>abs_lst (hs, z)"
+  unfolding alphas_abs
+  unfolding alphas
+  unfolding fresh_star_def
+  apply(erule_tac [!] exE, erule_tac [!] exE)
+  apply(rule_tac [!] x="pa + p" in exI)
+  by (simp_all add: fresh_plus_perm)
+
+lemma alphas_abs_eqvt:
+  shows "(bs, x) \<approx>abs (cs, y) \<Longrightarrow> (p \<bullet> bs, p \<bullet> x) \<approx>abs (p \<bullet> cs, p \<bullet> y)"
+  and   "(bs, x) \<approx>abs_res (cs, y) \<Longrightarrow> (p \<bullet> bs, p \<bullet> x) \<approx>abs_res (p \<bullet> cs, p \<bullet> y)"
+  and   "(ds, x) \<approx>abs_lst (es, y) \<Longrightarrow> (p \<bullet> ds, p \<bullet> x) \<approx>abs_lst (p \<bullet> es, p \<bullet> y)"
+  unfolding alphas_abs
+  unfolding alphas
+  unfolding set_eqvt[symmetric]
+  unfolding supp_eqvt[symmetric]
+  unfolding Diff_eqvt[symmetric]
+  apply(erule_tac [!] exE)
+  apply(rule_tac [!] x="p \<bullet> pa" in exI)
+  by (auto simp add: fresh_star_permute_iff permute_eqvt[symmetric])
+
+lemma alphas_abs_swap1:
   assumes a1: "a \<notin> (supp x) - bs"
   and     a2: "b \<notin> (supp x) - bs"
   shows "(bs, x) \<approx>abs ((a \<rightleftharpoons> b) \<bullet> bs, (a \<rightleftharpoons> b) \<bullet> x)"
+  and   "(bs, x) \<approx>abs_res ((a \<rightleftharpoons> b) \<bullet> bs, (a \<rightleftharpoons> b) \<bullet> x)"
   using a1 a2
-  unfolding Diff_iff
-  unfolding alpha_abs.simps
+  unfolding alphas_abs
   unfolding alphas
-  unfolding supp_eqvt[symmetric] Diff_eqvt[symmetric]
+  unfolding supp_eqvt[symmetric] Diff_eqvt[symmetric] 
   unfolding fresh_star_def fresh_def
   unfolding swap_set_not_in[OF a1 a2] 
-  by (rule_tac x="(a \<rightleftharpoons> b)" in exI)
+  by (rule_tac [!] x="(a \<rightleftharpoons> b)" in exI)
+     (auto simp add: supp_perm swap_atom)
+
+lemma alphas_abs_swap2:
+  assumes a1: "a \<notin> (supp x) - (set bs)"
+  and     a2: "b \<notin> (supp x) - (set bs)"
+  shows "(bs, x) \<approx>abs_lst ((a \<rightleftharpoons> b) \<bullet> bs, (a \<rightleftharpoons> b) \<bullet> x)"
+  using a1 a2
+  unfolding alphas_abs
+  unfolding alphas
+  unfolding supp_eqvt[symmetric] Diff_eqvt[symmetric] set_eqvt[symmetric]
+  unfolding fresh_star_def fresh_def
+  unfolding swap_set_not_in[OF a1 a2] 
+  by (rule_tac [!] x="(a \<rightleftharpoons> b)" in exI)
      (auto simp add: supp_perm swap_atom)
 
 fun
-  supp_abs_fun
+  aux_set 
+where
+  "aux_set (bs, x) = (supp x) - bs"
+
+fun
+  aux_list
 where
-  "supp_abs_fun (bs, x) = (supp x) - bs"
+  "aux_list (cs, x) = (supp x) - (set cs)"
 
+lemma aux_abs_lemma:
+  assumes a: "(bs, x) \<approx>abs (cs, y)" 
+  shows "aux_set (bs, x) = aux_set (cs, y)"
+  using a
+  by (induct rule: alpha_abs.induct)
+     (simp add: alphas_abs alphas)
 
-lemma supp_abs_fun_lemma:
-  assumes a: "x \<approx>abs y" 
-  shows "supp_abs_fun x = supp_abs_fun y"
+lemma aux_abs_res_lemma:
+  assumes a: "(bs, x) \<approx>abs_res (cs, y)" 
+  shows "aux_set (bs, x) = aux_set (cs, y)"
   using a
-  apply(induct rule: alpha_abs.induct)
-  apply(simp add: alpha_gen)
-  done
-  
+  by (induct rule: alpha_abs_res.induct)
+     (simp add: alphas_abs alphas)
+ 
+lemma aux_abs_list_lemma:
+  assumes a: "(bs, x) \<approx>abs_lst (cs, y)" 
+  shows "aux_list (bs, x) = aux_list (cs, y)"
+  using a
+  by (induct rule: alpha_abs_lst.induct)
+     (simp add: alphas_abs alphas)
 
-quotient_type 'a abs_gen = "(atom set \<times> 'a::pt)" / "alpha_abs"
-  apply(rule equivpI)
+quotient_type 
+    'a abs_gen = "(atom set \<times> 'a::pt)" / "alpha_abs"
+and 'b abs_res = "(atom set \<times> 'b::pt)" / "alpha_abs_res"
+and 'c abs_lst = "(atom list \<times> 'c::pt)" / "alpha_abs_lst"
+  apply(rule_tac [!] equivpI)
   unfolding reflp_def symp_def transp_def
-  apply(simp_all)
-  (* refl *)
-  apply(clarify)
-  apply(rule_tac x="0" in exI)
-  apply(rule alpha_gen_refl)
-  apply(simp)
-  (* symm *)
-  apply(clarify)
-  apply(rule_tac x="- p" in exI)
-  apply(rule alpha_gen_sym)
-  apply(clarsimp)
-  apply(assumption)
-  (* trans *)
-  apply(clarify)
-  apply(rule_tac x="pa + p" in exI)
-  apply(rule alpha_gen_trans)
-  apply(auto)
-  done
+  by (auto intro: alphas_abs_sym alphas_abs_refl alphas_abs_trans simp only:)
 
 quotient_definition
   "Abs::atom set \<Rightarrow> ('a::pt) \<Rightarrow> 'a abs_gen"
 is
   "Pair::atom set \<Rightarrow> ('a::pt) \<Rightarrow> (atom set \<times> 'a)"
 
+quotient_definition
+  "Abs_res::atom set \<Rightarrow> ('a::pt) \<Rightarrow> 'a abs_res"
+is
+  "Pair::atom set \<Rightarrow> ('a::pt) \<Rightarrow> (atom set \<times> 'a)"
+
+quotient_definition
+  "Abs_lst::atom list \<Rightarrow> ('a::pt) \<Rightarrow> 'a abs_lst"
+is
+  "Pair::atom list \<Rightarrow> ('a::pt) \<Rightarrow> (atom list \<times> 'a)"
+
 lemma [quot_respect]:
-  shows "((op =) ===> (op =) ===> alpha_abs) Pair Pair"
-  apply(clarsimp)
-  apply(rule exI)
-  apply(rule alpha_gen_refl)
-  apply(simp)
-  done
+  shows "(op= ===> op= ===> alpha_abs) Pair Pair"
+  and   "(op= ===> op= ===> alpha_abs_res) Pair Pair"
+  and   "(op= ===> op= ===> alpha_abs_lst) Pair Pair"
+  unfolding fun_rel_def
+  by (auto intro: alphas_abs_refl simp only:)
 
 lemma [quot_respect]:
-  shows "((op =) ===> alpha_abs ===> alpha_abs) permute permute"
-  apply(clarsimp)
-  apply(rule exI)
-  apply(rule alpha_gen_eqvt)
-  apply(simp_all add: supp_eqvt)
-  done
+  shows "(op= ===> alpha_abs ===> alpha_abs) permute permute"
+  and   "(op= ===> alpha_abs_res ===> alpha_abs_res) permute permute"
+  and   "(op= ===> alpha_abs_lst ===> alpha_abs_lst) permute permute"
+  unfolding fun_rel_def
+  by (auto intro: alphas_abs_eqvt simp only: Pair_eqvt)
 
 lemma [quot_respect]:
-  shows "(alpha_abs ===> (op =)) supp_abs_fun supp_abs_fun"
-  apply(simp add: supp_abs_fun_lemma)
-  done
+  shows "(alpha_abs ===> op=) aux_set aux_set"
+  and   "(alpha_abs_res ===> op=) aux_set aux_set"
+  and   "(alpha_abs_lst ===> op=) aux_list aux_list"
+  unfolding fun_rel_def
+  apply(rule_tac [!] allI)
+  apply(rule_tac [!] allI)
+  apply(case_tac [!] x, case_tac [!] y)
+  apply(rule_tac [!] impI)
+  by (simp_all only: aux_abs_lemma aux_abs_res_lemma aux_abs_list_lemma)
 
-lemma abs_induct:
-  "\<lbrakk>\<And>as (x::'a::pt). P (Abs as x)\<rbrakk> \<Longrightarrow> P t"
+lemma abs_inducts:
+  shows "(\<And>as (x::'a::pt). P1 (Abs as x)) \<Longrightarrow> P1 x1"
+  and   "(\<And>as (x::'a::pt). P2 (Abs_res as x)) \<Longrightarrow> P2 x2"
+  and   "(\<And>as (x::'a::pt). P3 (Abs_lst as x)) \<Longrightarrow> P3 x3"
   apply(lifting prod.induct[where 'a="atom set" and 'b="'a"])
+  apply(lifting prod.induct[where 'a="atom set" and 'b="'a"])
+  apply(lifting prod.induct[where 'a="atom list" and 'b="'a"])
   done
 
-(* TEST case *)
-lemmas abs_induct2 = prod.induct[where 'a="atom set" and 'b="'a::pt", quot_lifted]
-thm abs_induct abs_induct2
-
 instantiation abs_gen :: (pt) pt
 begin
 
@@ -198,351 +240,206 @@
 is
   "permute:: perm \<Rightarrow> (atom set \<times> 'a::pt) \<Rightarrow> (atom set \<times> 'a::pt)"
 
-(* ??? has to be 'a \<dots> 'b does not work *)
-lemma permute_ABS [simp]:
+lemma permute_Abs[simp]:
   fixes x::"'a::pt"  
   shows "(p \<bullet> (Abs as x)) = Abs (p \<bullet> as) (p \<bullet> x)"
-  thm permute_prod.simps
-  by (lifting permute_prod.simps(1)[where 'a="atom set" and 'b="'a"])
+  by (lifting permute_prod.simps[where 'a="atom set" and 'b="'a"])
 
 instance
   apply(default)
-  apply(induct_tac [!] x rule: abs_induct)
+  apply(induct_tac [!] x rule: abs_inducts(1))
+  apply(simp_all)
+  done
+
+end
+
+instantiation abs_res :: (pt) pt
+begin
+
+quotient_definition
+  "permute_abs_res::perm \<Rightarrow> ('a::pt abs_res) \<Rightarrow> 'a abs_res"
+is
+  "permute:: perm \<Rightarrow> (atom set \<times> 'a::pt) \<Rightarrow> (atom set \<times> 'a::pt)"
+
+lemma permute_Abs_res[simp]:
+  fixes x::"'a::pt"  
+  shows "(p \<bullet> (Abs_res as x)) = Abs_res (p \<bullet> as) (p \<bullet> x)"
+  by (lifting permute_prod.simps[where 'a="atom set" and 'b="'a"])
+
+instance
+  apply(default)
+  apply(induct_tac [!] x rule: abs_inducts(2))
+  apply(simp_all)
+  done
+
+end
+
+instantiation abs_lst :: (pt) pt
+begin
+
+quotient_definition
+  "permute_abs_lst::perm \<Rightarrow> ('a::pt abs_lst) \<Rightarrow> 'a abs_lst"
+is
+  "permute:: perm \<Rightarrow> (atom list \<times> 'a::pt) \<Rightarrow> (atom list \<times> 'a::pt)"
+
+lemma permute_Abs_lst[simp]:
+  fixes x::"'a::pt"  
+  shows "(p \<bullet> (Abs_lst as x)) = Abs_lst (p \<bullet> as) (p \<bullet> x)"
+  by (lifting permute_prod.simps[where 'a="atom list" and 'b="'a"])
+
+instance
+  apply(default)
+  apply(induct_tac [!] x rule: abs_inducts(3))
   apply(simp_all)
   done
 
 end
 
+lemmas permute_abs = permute_Abs permute_Abs_res permute_Abs_lst
+
+
 quotient_definition
-  "supp_Abs_fun :: ('a::pt) abs_gen \<Rightarrow> atom \<Rightarrow> bool"
+  "supp_gen :: ('a::pt) abs_gen \<Rightarrow> atom set"
 is
-  "supp_abs_fun"
+  "aux_set"
+
+quotient_definition
+  "supp_res :: ('a::pt) abs_res \<Rightarrow> atom set"
+is
+  "aux_set"
 
-lemma supp_Abs_fun_simp:
-  shows "supp_Abs_fun (Abs bs x) = (supp x) - bs"
-  by (lifting supp_abs_fun.simps(1))
+quotient_definition
+  "supp_lst :: ('a::pt) abs_lst \<Rightarrow> atom set"
+is
+  "aux_list"
 
-lemma supp_Abs_fun_eqvt [eqvt]:
-  shows "(p \<bullet> supp_Abs_fun x) = supp_Abs_fun (p \<bullet> x)"
-  apply(induct_tac x rule: abs_induct)
-  apply(simp add: supp_Abs_fun_simp supp_eqvt Diff_eqvt)
+lemma aux_supps:
+  shows "supp_gen (Abs bs x) = (supp x) - bs"
+  and   "supp_res (Abs_res bs x) = (supp x) - bs"
+  and   "supp_lst (Abs_lst cs x) = (supp x) - (set cs)"
+  apply(lifting aux_set.simps)
+  apply(lifting aux_set.simps)
+  apply(lifting aux_list.simps)
   done
 
-lemma supp_Abs_fun_fresh:
-  shows "a \<sharp> Abs bs x \<Longrightarrow> a \<sharp> supp_Abs_fun (Abs bs x)"
-  apply(rule fresh_fun_eqvt_app)
-  apply(simp add: eqvts_raw)
-  apply(simp)
+lemma aux_supp_eqvt[eqvt]:
+  shows "(p \<bullet> supp_gen x) = supp_gen (p \<bullet> x)"
+  and   "(p \<bullet> supp_res y) = supp_res (p \<bullet> y)"
+  and   "(p \<bullet> supp_lst z) = supp_lst (p \<bullet> z)"
+  apply(induct_tac x rule: abs_inducts(1))
+  apply(simp add: aux_supps supp_eqvt Diff_eqvt)
+  apply(induct_tac y rule: abs_inducts(2))
+  apply(simp add: aux_supps supp_eqvt Diff_eqvt)
+  apply(induct_tac z rule: abs_inducts(3))
+  apply(simp add: aux_supps supp_eqvt Diff_eqvt set_eqvt)
   done
 
-lemma Abs_swap:
+lemma aux_fresh:
+  shows "a \<sharp> Abs bs x \<Longrightarrow> a \<sharp> supp_gen (Abs bs x)"
+  and   "a \<sharp> Abs_res bs x \<Longrightarrow> a \<sharp> supp_res (Abs_res bs x)"
+  and   "a \<sharp> Abs_lst cs x \<Longrightarrow> a \<sharp> supp_lst (Abs_lst cs x)"
+  apply(rule_tac [!] fresh_fun_eqvt_app)
+  apply(simp_all add: eqvts_raw)
+  done
+
+lemma abs_swap1:
   assumes a1: "a \<notin> (supp x) - bs"
   and     a2: "b \<notin> (supp x) - bs"
-  shows "(Abs bs x) = (Abs ((a \<rightleftharpoons> b) \<bullet> bs) ((a \<rightleftharpoons> b) \<bullet> x))"
-  using a1 a2 by (lifting alpha_abs_swap)
-
-lemma Abs_supports:
-  shows "((supp x) - as) supports (Abs as x)"
-  unfolding supports_def
-  apply(clarify)
-  apply(simp (no_asm))
-  apply(subst Abs_swap[symmetric])
-  apply(simp_all)
+  shows "Abs bs x = Abs ((a \<rightleftharpoons> b) \<bullet> bs) ((a \<rightleftharpoons> b) \<bullet> x)"
+  and   "Abs_res bs x = Abs_res ((a \<rightleftharpoons> b) \<bullet> bs) ((a \<rightleftharpoons> b) \<bullet> x)"
+  using a1 a2 
+  apply(lifting alphas_abs_swap1(1))
+  apply(lifting alphas_abs_swap1(2))
   done
 
-lemma finite_supp_Abs_subset1:
-  assumes "finite (supp x)"
+lemma abs_swap2:
+  assumes a1: "a \<notin> (supp x) - (set bs)"
+  and     a2: "b \<notin> (supp x) - (set bs)"
+  shows "Abs_lst bs x = Abs_lst ((a \<rightleftharpoons> b) \<bullet> bs) ((a \<rightleftharpoons> b) \<bullet> x)"
+  using a1 a2 by (lifting alphas_abs_swap2)
+
+lemma abs_supports:
+  shows "((supp x) - as) supports (Abs as x)"
+  and   "((supp x) - as) supports (Abs_res as x)"
+  and   "((supp x) - (set bs)) supports (Abs_lst bs x)"
+  unfolding supports_def
+  unfolding permute_abs
+  by (simp_all add: abs_swap1[symmetric] abs_swap2[symmetric])
+
+lemma supp_abs_subset1:
+  assumes a: "finite (supp x)"
   shows "(supp x) - as \<subseteq> supp (Abs as x)"
-  apply(simp add: supp_conv_fresh)
-  apply(auto)
-  apply(drule_tac supp_Abs_fun_fresh)
-  apply(simp only: supp_Abs_fun_simp)
-  apply(simp add: fresh_def)
-  apply(simp add: supp_finite_atom_set assms)
+  and   "(supp x) - as \<subseteq> supp (Abs_res as x)"
+  and   "(supp x) - (set bs) \<subseteq> supp (Abs_lst bs x)"
+  unfolding supp_conv_fresh
+  apply(auto dest!: aux_fresh simp add: aux_supps)
+  apply(simp_all add: fresh_def supp_finite_atom_set a)
   done
 
-lemma finite_supp_Abs_subset2:
-  assumes "finite (supp x)"
+lemma supp_abs_subset2:
+  assumes a: "finite (supp x)"
   shows "supp (Abs as x) \<subseteq> (supp x) - as"
-  apply(rule supp_is_subset)
-  apply(rule Abs_supports)
-  apply(simp add: assms)
+  and   "supp (Abs_res as x) \<subseteq> (supp x) - as"
+  and   "supp (Abs_lst bs x) \<subseteq> (supp x) - (set bs)"
+  apply(rule_tac [!] supp_is_subset)
+  apply(simp_all add: abs_supports a)
   done
 
-lemma finite_supp_Abs:
-  assumes "finite (supp x)"
+lemma abs_finite_supp:
+  assumes a: "finite (supp x)"
   shows "supp (Abs as x) = (supp x) - as"
-  apply(rule_tac subset_antisym)
-  apply(rule finite_supp_Abs_subset2[OF assms])
-  apply(rule finite_supp_Abs_subset1[OF assms])
+  and   "supp (Abs_res as x) = (supp x) - as"
+  and   "supp (Abs_lst bs x) = (supp x) - (set bs)"
+  apply(rule_tac [!] subset_antisym)
+  apply(simp_all add: supp_abs_subset1[OF a] supp_abs_subset2[OF a])
   done
 
-lemma supp_Abs:
+lemma supp_abs:
   fixes x::"'a::fs"
   shows "supp (Abs as x) = (supp x) - as"
-  apply(rule finite_supp_Abs)
-  apply(simp add: finite_supp)
+  and   "supp (Abs_res as x) = (supp x) - as"
+  and   "supp (Abs_lst bs x) = (supp x) - (set bs)"
+  apply(rule_tac [!] abs_finite_supp)
+  apply(simp_all add: finite_supp)
   done
 
 instance abs_gen :: (fs) fs
   apply(default)
-  apply(induct_tac x rule: abs_induct)
-  apply(simp add: supp_Abs)
-  apply(simp add: finite_supp)
+  apply(induct_tac x rule: abs_inducts(1))
+  apply(simp add: supp_abs finite_supp)
   done
 
-lemma Abs_fresh_iff:
-  fixes x::"'a::fs"
-  shows "a \<sharp> Abs bs x \<longleftrightarrow> a \<in> bs \<or> (a \<notin> bs \<and> a \<sharp> x)"
-  apply(simp add: fresh_def)
-  apply(simp add: supp_Abs)
-  apply(auto)
+instance abs_res :: (fs) fs
+  apply(default)
+  apply(induct_tac x rule: abs_inducts(2))
+  apply(simp add: supp_abs finite_supp)
+  done
+
+instance abs_lst :: (fs) fs
+  apply(default)
+  apply(induct_tac x rule: abs_inducts(3))
+  apply(simp add: supp_abs finite_supp)
   done
 
-lemma Abs_eq_iff:
-  shows "Abs bs x = Abs cs y \<longleftrightarrow> (\<exists>p. (bs, x) \<approx>gen (op =) supp p (cs, y))"
-  by (lifting alpha_abs.simps(1))
-
-
-
-(* 
-  below is a construction site for showing that in the
-  single-binder case, the old and new alpha equivalence 
-  coincide
-*)
-
-fun
-  alpha1
-where
-  "alpha1 (a, x) (b, y) \<longleftrightarrow> (a = b \<and> x = y) \<or> (a \<noteq> b \<and> x = (a \<rightleftharpoons> b) \<bullet> y \<and> a \<sharp> y)"
-
-notation 
-  alpha1 ("_ \<approx>abs1 _")
-
-fun
-  alpha2
-where
-  "alpha2 (a, x) (b, y) \<longleftrightarrow> (\<exists>c. c \<sharp> (a,b,x,y) \<and> ((c \<rightleftharpoons> a) \<bullet> x) = ((c \<rightleftharpoons> b) \<bullet> y))"
-
-notation 
-  alpha2 ("_ \<approx>abs2 _")
+lemma abs_fresh_iff:
+  fixes x::"'a::fs"
+  shows "a \<sharp> Abs bs x \<longleftrightarrow> a \<in> bs \<or> (a \<notin> bs \<and> a \<sharp> x)"
+  and   "a \<sharp> Abs_res bs x \<longleftrightarrow> a \<in> bs \<or> (a \<notin> bs \<and> a \<sharp> x)"
+  and   "a \<sharp> Abs_lst cs x \<longleftrightarrow> a \<in> (set cs) \<or> (a \<notin> (set cs) \<and> a \<sharp> x)"
+  unfolding fresh_def
+  unfolding supp_abs
+  by auto
 
-lemma alpha_old_new:
-  assumes a: "(a, x) \<approx>abs1 (b, y)" "sort_of a = sort_of b"
-  shows "({a}, x) \<approx>abs ({b}, y)"
-using a
-apply(simp)
-apply(erule disjE)
-apply(simp)
-apply(rule exI)
-apply(rule alpha_gen_refl)
-apply(simp)
-apply(rule_tac x="(a \<rightleftharpoons> b)" in  exI)
-apply(simp add: alpha_gen)
-apply(simp add: fresh_def)
-apply(rule conjI)
-apply(rule_tac ?p1="(a \<rightleftharpoons> b)" in  permute_eq_iff[THEN iffD1])
-apply(rule trans)
-apply(simp add: Diff_eqvt supp_eqvt)
-apply(subst swap_set_not_in)
-back
-apply(simp)
-apply(simp)
-apply(simp add: permute_set_eq)
-apply(rule conjI)
-apply(rule_tac ?p1="(a \<rightleftharpoons> b)" in fresh_star_permute_iff[THEN iffD1])
-apply(simp add: permute_self)
-apply(simp add: Diff_eqvt supp_eqvt)
-apply(simp add: permute_set_eq)
-apply(subgoal_tac "supp (a \<rightleftharpoons> b) \<subseteq> {a, b}")
-apply(simp add: fresh_star_def fresh_def)
-apply(blast)
-apply(simp add: supp_swap)
-apply(simp add: eqvts)
-done
-
-
-lemma perm_induct_test:
-  fixes P :: "perm => bool"
-  assumes fin: "finite (supp p)" 
-  assumes zero: "P 0"
-  assumes swap: "\<And>a b. \<lbrakk>sort_of a = sort_of b; a \<noteq> b\<rbrakk> \<Longrightarrow> P (a \<rightleftharpoons> b)"
-  assumes plus: "\<And>p1 p2. \<lbrakk>supp p1 \<inter> supp p2 = {}; P p1; P p2\<rbrakk> \<Longrightarrow> P (p1 + p2)"
-  shows "P p"
-using fin
-apply(induct F\<equiv>"supp p" arbitrary: p rule: finite_induct)
-oops
-
-lemma ii:
-  assumes "\<forall>x \<in> A. p \<bullet> x = x"
-  shows "p \<bullet> A = A"
-using assms
-apply(auto)
-apply (metis Collect_def Collect_mem_eq Int_absorb assms eqvt_bound inf_Int_eq mem_def mem_permute_iff)
-apply (metis Collect_def Collect_mem_eq Int_absorb assms eqvt_apply eqvt_bound eqvt_lambda inf_Int_eq mem_def mem_permute_iff permute_minus_cancel(2) permute_pure)
-done
-
-
-
-lemma alpha_abs_Pair:
-  shows "(bs, (x1, x2)) \<approx>gen (\<lambda>(x1,x2) (y1,y2). x1=y1 \<and> x2=y2) (\<lambda>(x,y). supp x \<union> supp y) p (cs, (y1, y2))
-         \<longleftrightarrow> ((bs, x1) \<approx>gen (op=) supp p (cs, y1) \<and> (bs, x2) \<approx>gen (op=) supp p (cs, y2))"         
-  apply(simp add: alpha_gen)
-  apply(simp add: fresh_star_def)
-  apply(simp add: ball_Un Un_Diff)
-  apply(rule iffI)
-  apply(simp)
-  defer
-  apply(simp)
-  apply(rule conjI)
-  apply(clarify)
-  apply(simp add: supp_eqvt[symmetric] Diff_eqvt[symmetric])
-  apply(rule sym)
-  apply(rule ii)
-  apply(simp add: fresh_def supp_perm)
-  apply(clarify)
-  apply(simp add: supp_eqvt[symmetric] Diff_eqvt[symmetric])
-  apply(simp add: fresh_def supp_perm)
-  apply(rule sym)
-  apply(rule ii)
-  apply(simp)
+lemma abs_eq_iff:
+  shows "Abs bs x = Abs cs y \<longleftrightarrow> (bs, x) \<approx>abs (cs, y)"
+  and   "Abs_res bs x = Abs_res cs y \<longleftrightarrow> (bs, x) \<approx>abs_res (cs, y)"
+  and   "Abs_lst ds x = Abs_lst hs y \<longleftrightarrow> (ds, x) \<approx>abs_lst (hs, y)"
+  apply(simp_all)
+  apply(lifting alphas_abs)
   done
 
 
-lemma yy:
-  assumes "S1 - {x} = S2 - {x}" "x \<in> S1" "x \<in> S2"
-  shows "S1 = S2"
-using assms
-apply (metis insert_Diff_single insert_absorb)
-done
-
-lemma kk:
-  assumes a: "p \<bullet> x = y"
-  shows "\<forall>a \<in> supp x. (p \<bullet> a) \<in> supp y"
-using a
-apply(auto)
-apply(rule_tac p="- p" in permute_boolE)
-apply(simp add: mem_eqvt supp_eqvt)
-done
-
-lemma ww:
-  assumes "a \<notin> supp x" "b \<in> supp x" "a \<noteq> b" "sort_of a = sort_of b"
-  shows "((a \<rightleftharpoons> b) \<bullet> x) \<noteq> x"
-apply(subgoal_tac "(supp x) supports x")
-apply(simp add: supports_def)
-using assms
-apply -
-apply(drule_tac x="a" in spec)
-defer
-apply(rule supp_supports)
-apply(auto)
-apply(rotate_tac 1)
-apply(drule_tac p="(a \<rightleftharpoons> b)" in permute_boolI)
-apply(simp add: mem_eqvt supp_eqvt)
-done
-
-lemma alpha_abs_sym:
-  assumes a: "({a}, x) \<approx>abs ({b}, y)"
-  shows "({b}, y) \<approx>abs ({a}, x)"
-using a
-apply(simp)
-apply(erule exE)
-apply(rule_tac x="- p" in exI)
-apply(simp add: alpha_gen)
-apply(simp add: fresh_star_def fresh_minus_perm)
-apply (metis permute_minus_cancel(2))
-done
-
-lemma alpha_abs_trans:
-  assumes a: "({a1}, x1) \<approx>abs ({a2}, x2)"
-  assumes b: "({a2}, x2) \<approx>abs ({a3}, x3)"
-  shows "({a1}, x1) \<approx>abs ({a3}, x3)"
-using a b
-apply(simp)
-apply(erule exE)+
-apply(rule_tac x="pa + p" in exI)
-apply(simp add: alpha_gen)
-apply(simp add: fresh_star_def fresh_plus_perm)
-done
-
-lemma alpha_equal:
-  assumes a: "({a}, x) \<approx>abs ({a}, y)" 
-  shows "(a, x) \<approx>abs1 (a, y)"
-using a
-apply(simp)
-apply(erule exE)
-apply(simp add: alpha_gen)
-apply(erule conjE)+
-apply(case_tac "a \<notin> supp x")
-apply(simp)
-apply(subgoal_tac "supp x \<sharp>* p")
-apply(drule supp_perm_eq)
-apply(simp)
-apply(simp)
-apply(simp)
-apply(case_tac "a \<notin> supp y")
-apply(simp)
-apply(drule supp_perm_eq)
-apply(clarify)
-apply(simp (no_asm_use))
-apply(simp)
-apply(simp)
-apply(drule yy)
-apply(simp)
-apply(simp)
-apply(simp)
-apply(case_tac "a \<sharp> p")
-apply(subgoal_tac "supp y \<sharp>* p")
-apply(drule supp_perm_eq)
-apply(clarify)
-apply(simp (no_asm_use))
-apply(metis)
-apply(auto simp add: fresh_star_def)[1]
-apply(frule_tac kk)
-apply(drule_tac x="a" in bspec)
-apply(simp)
-apply(simp add: fresh_def)
-apply(simp add: supp_perm)
-apply(subgoal_tac "((p \<bullet> a) \<sharp> p)")
-apply(simp add: fresh_def supp_perm)
-apply(simp add: fresh_star_def)
-done
-
-lemma alpha_unequal:
-  assumes a: "({a}, x) \<approx>abs ({b}, y)" "sort_of a = sort_of b" "a \<noteq> b"
-  shows "(a, x) \<approx>abs1 (b, y)"
-using a
-apply -
-apply(subgoal_tac "a \<notin> supp x - {a}")
-apply(subgoal_tac "b \<notin> supp x - {a}")
-defer
-apply(simp add: alpha_gen)
-apply(simp)
-apply(drule_tac alpha_abs_swap)
-apply(assumption)
-apply(simp only: insert_eqvt empty_eqvt swap_atom_simps)
-apply(drule alpha_abs_sym)
-apply(rotate_tac 4)
-apply(drule_tac alpha_abs_trans)
-apply(assumption)
-apply(drule alpha_equal)
-apply(simp)
-apply(rule_tac p="(a \<rightleftharpoons> b)" in permute_boolE)
-apply(simp add: fresh_eqvt)
-apply(simp add: fresh_def)
-done
-
-lemma alpha_new_old:
-  assumes a: "({a}, x) \<approx>abs ({b}, y)" "sort_of a = sort_of b" 
-  shows "(a, x) \<approx>abs1 (b, y)"
-using a
-apply(case_tac "a=b")
-apply(simp only: alpha_equal)
-apply(drule alpha_unequal)
-apply(simp)
-apply(simp)
-apply(simp)
-done
+section {* BELOW is stuff that may or may not be needed *}
 
 (* support of concrete atom sets *)
 
@@ -563,6 +460,12 @@
   done
 
 (* TODO: The following lemmas can be moved somewhere... *)
+
+lemma Abs_eq_iff:
+  shows "Abs bs x = Abs cs y \<longleftrightarrow> (\<exists>p. (bs, x) \<approx>gen (op =) supp p (cs, y))"
+  by (lifting alpha_abs.simps(1))
+
+
 lemma split_rsp2[quot_respect]: "((R1 ===> R2 ===> prod_rel R1 R2 ===> op =) ===>
   prod_rel R1 R2 ===> prod_rel R1 R2 ===> op =) split split"
   by auto
@@ -673,5 +576,51 @@
   apply(simp)
   done
 
+lemma alpha_gen_refl:
+  assumes a: "R x x"
+  shows "(bs, x) \<approx>gen R f 0 (bs, x)"
+  and   "(bs, x) \<approx>res R f 0 (bs, x)"
+  and   "(cs, x) \<approx>lst R f 0 (cs, x)"
+  using a 
+  unfolding alphas
+  unfolding fresh_star_def
+  by (simp_all add: fresh_zero_perm)
+
+lemma alpha_gen_sym:
+  assumes a: "R (p \<bullet> x) y \<Longrightarrow> R (- p \<bullet> y) x"
+  shows "(bs, x) \<approx>gen R f p (cs, y) \<Longrightarrow> (cs, y) \<approx>gen R f (- p) (bs, x)"
+  and   "(bs, x) \<approx>res R f p (cs, y) \<Longrightarrow> (cs, y) \<approx>res R f (- p) (bs, x)"
+  and   "(ds, x) \<approx>lst R f p (es, y) \<Longrightarrow> (es, y) \<approx>lst R f (- p) (ds, x)"
+  using a
+  unfolding alphas
+  unfolding fresh_star_def
+  by (auto simp add:  fresh_minus_perm)
+
+lemma alpha_gen_trans:
+  assumes a: "\<lbrakk>R (p \<bullet> x) y; R (q \<bullet> y) z\<rbrakk> \<Longrightarrow> R ((q + p) \<bullet> x) z"
+  shows "\<lbrakk>(bs, x) \<approx>gen R f p (cs, y); (cs, y) \<approx>gen R f q (ds, z)\<rbrakk> \<Longrightarrow> (bs, x) \<approx>gen R f (q + p) (ds, z)"
+  and   "\<lbrakk>(bs, x) \<approx>res R f p (cs, y); (cs, y) \<approx>res R f q (ds, z)\<rbrakk> \<Longrightarrow> (bs, x) \<approx>res R f (q + p) (ds, z)"
+  and   "\<lbrakk>(es, x) \<approx>lst R f p (gs, y); (gs, y) \<approx>lst R f q (hs, z)\<rbrakk> \<Longrightarrow> (es, x) \<approx>lst R f (q + p) (hs, z)"
+  using a 
+  unfolding alphas
+  unfolding fresh_star_def
+  by (simp_all add: fresh_plus_perm)
+
+lemma alpha_gen_eqvt:
+  assumes a: "R (q \<bullet> x) y \<Longrightarrow> R (p \<bullet> (q \<bullet> x)) (p \<bullet> y)"
+  and     b: "p \<bullet> (f x) = f (p \<bullet> x)"
+  and     c: "p \<bullet> (f y) = f (p \<bullet> y)"
+  shows "(bs, x) \<approx>gen R f q (cs, y) \<Longrightarrow> (p \<bullet> bs, p \<bullet> x) \<approx>gen R f (p \<bullet> q) (p \<bullet> cs, p \<bullet> y)"
+  and   "(bs, x) \<approx>res R f q (cs, y) \<Longrightarrow> (p \<bullet> bs, p \<bullet> x) \<approx>res R f (p \<bullet> q) (p \<bullet> cs, p \<bullet> y)"
+  and   "(ds, x) \<approx>lst R f q (es, y) \<Longrightarrow> (p \<bullet> ds, p \<bullet> x) \<approx>lst R f (p \<bullet> q) (p \<bullet> es, p \<bullet> y)" 
+  unfolding alphas
+  unfolding set_eqvt[symmetric]
+  unfolding b[symmetric] c[symmetric]
+  unfolding Diff_eqvt[symmetric]
+  unfolding permute_eqvt[symmetric]
+  using a
+  by (auto simp add: fresh_star_permute_iff)
+
+
 end
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Nominal/Abs_equiv.thy	Fri Mar 26 17:22:17 2010 +0100
@@ -0,0 +1,244 @@
+theory Abs_equiv
+imports Abs
+begin
+
+(* 
+  below is a construction site for showing that in the
+  single-binder case, the old and new alpha equivalence 
+  coincide
+*)
+
+fun
+  alpha1
+where
+  "alpha1 (a, x) (b, y) \<longleftrightarrow> (a = b \<and> x = y) \<or> (a \<noteq> b \<and> x = (a \<rightleftharpoons> b) \<bullet> y \<and> a \<sharp> y)"
+
+notation 
+  alpha1 ("_ \<approx>abs1 _")
+
+fun
+  alpha2
+where
+  "alpha2 (a, x) (b, y) \<longleftrightarrow> (\<exists>c. c \<sharp> (a,b,x,y) \<and> ((c \<rightleftharpoons> a) \<bullet> x) = ((c \<rightleftharpoons> b) \<bullet> y))"
+
+notation 
+  alpha2 ("_ \<approx>abs2 _")
+
+lemma alpha_old_new:
+  assumes a: "(a, x) \<approx>abs1 (b, y)" "sort_of a = sort_of b"
+  shows "({a}, x) \<approx>abs ({b}, y)"
+using a
+apply(simp)
+apply(erule disjE)
+apply(simp)
+apply(rule exI)
+apply(rule alpha_gen_refl)
+apply(simp)
+apply(rule_tac x="(a \<rightleftharpoons> b)" in  exI)
+apply(simp add: alpha_gen)
+apply(simp add: fresh_def)
+apply(rule conjI)
+apply(rule_tac ?p1="(a \<rightleftharpoons> b)" in  permute_eq_iff[THEN iffD1])
+apply(rule trans)
+apply(simp add: Diff_eqvt supp_eqvt)
+apply(subst swap_set_not_in)
+back
+apply(simp)
+apply(simp)
+apply(simp add: permute_set_eq)
+apply(rule conjI)
+apply(rule_tac ?p1="(a \<rightleftharpoons> b)" in fresh_star_permute_iff[THEN iffD1])
+apply(simp add: permute_self)
+apply(simp add: Diff_eqvt supp_eqvt)
+apply(simp add: permute_set_eq)
+apply(subgoal_tac "supp (a \<rightleftharpoons> b) \<subseteq> {a, b}")
+apply(simp add: fresh_star_def fresh_def)
+apply(blast)
+apply(simp add: supp_swap)
+apply(simp add: eqvts)
+done
+
+
+lemma perm_induct_test:
+  fixes P :: "perm => bool"
+  assumes fin: "finite (supp p)" 
+  assumes zero: "P 0"
+  assumes swap: "\<And>a b. \<lbrakk>sort_of a = sort_of b; a \<noteq> b\<rbrakk> \<Longrightarrow> P (a \<rightleftharpoons> b)"
+  assumes plus: "\<And>p1 p2. \<lbrakk>supp p1 \<inter> supp p2 = {}; P p1; P p2\<rbrakk> \<Longrightarrow> P (p1 + p2)"
+  shows "P p"
+using fin
+apply(induct F\<equiv>"supp p" arbitrary: p rule: finite_induct)
+oops
+
+lemma ii:
+  assumes "\<forall>x \<in> A. p \<bullet> x = x"
+  shows "p \<bullet> A = A"
+using assms
+apply(auto)
+apply (metis Collect_def Collect_mem_eq Int_absorb assms eqvt_bound inf_Int_eq mem_def mem_permute_iff)
+apply (metis Collect_def Collect_mem_eq Int_absorb assms eqvt_apply eqvt_bound eqvt_lambda inf_Int_eq mem_def mem_permute_iff permute_minus_cancel(2) permute_pure)
+done
+
+
+
+lemma alpha_abs_Pair:
+  shows "(bs, (x1, x2)) \<approx>gen (\<lambda>(x1,x2) (y1,y2). x1=y1 \<and> x2=y2) (\<lambda>(x,y). supp x \<union> supp y) p (cs, (y1, y2))
+         \<longleftrightarrow> ((bs, x1) \<approx>gen (op=) supp p (cs, y1) \<and> (bs, x2) \<approx>gen (op=) supp p (cs, y2))"         
+  apply(simp add: alpha_gen)
+  apply(simp add: fresh_star_def)
+  apply(simp add: ball_Un Un_Diff)
+  apply(rule iffI)
+  apply(simp)
+  defer
+  apply(simp)
+  apply(rule conjI)
+  apply(clarify)
+  apply(simp add: supp_eqvt[symmetric] Diff_eqvt[symmetric])
+  apply(rule sym)
+  apply(rule ii)
+  apply(simp add: fresh_def supp_perm)
+  apply(clarify)
+  apply(simp add: supp_eqvt[symmetric] Diff_eqvt[symmetric])
+  apply(simp add: fresh_def supp_perm)
+  apply(rule sym)
+  apply(rule ii)
+  apply(simp)
+  done
+
+
+lemma yy:
+  assumes "S1 - {x} = S2 - {x}" "x \<in> S1" "x \<in> S2"
+  shows "S1 = S2"
+using assms
+apply (metis insert_Diff_single insert_absorb)
+done
+
+lemma kk:
+  assumes a: "p \<bullet> x = y"
+  shows "\<forall>a \<in> supp x. (p \<bullet> a) \<in> supp y"
+using a
+apply(auto)
+apply(rule_tac p="- p" in permute_boolE)
+apply(simp add: mem_eqvt supp_eqvt)
+done
+
+lemma ww:
+  assumes "a \<notin> supp x" "b \<in> supp x" "a \<noteq> b" "sort_of a = sort_of b"
+  shows "((a \<rightleftharpoons> b) \<bullet> x) \<noteq> x"
+apply(subgoal_tac "(supp x) supports x")
+apply(simp add: supports_def)
+using assms
+apply -
+apply(drule_tac x="a" in spec)
+defer
+apply(rule supp_supports)
+apply(auto)
+apply(rotate_tac 1)
+apply(drule_tac p="(a \<rightleftharpoons> b)" in permute_boolI)
+apply(simp add: mem_eqvt supp_eqvt)
+done
+
+lemma alpha_abs_sym:
+  assumes a: "({a}, x) \<approx>abs ({b}, y)"
+  shows "({b}, y) \<approx>abs ({a}, x)"
+using a
+apply(simp)
+apply(erule exE)
+apply(rule_tac x="- p" in exI)
+apply(simp add: alpha_gen)
+apply(simp add: fresh_star_def fresh_minus_perm)
+apply (metis permute_minus_cancel(2))
+done
+
+lemma alpha_abs_trans:
+  assumes a: "({a1}, x1) \<approx>abs ({a2}, x2)"
+  assumes b: "({a2}, x2) \<approx>abs ({a3}, x3)"
+  shows "({a1}, x1) \<approx>abs ({a3}, x3)"
+using a b
+apply(simp)
+apply(erule exE)+
+apply(rule_tac x="pa + p" in exI)
+apply(simp add: alpha_gen)
+apply(simp add: fresh_star_def fresh_plus_perm)
+done
+
+lemma alpha_equal:
+  assumes a: "({a}, x) \<approx>abs ({a}, y)" 
+  shows "(a, x) \<approx>abs1 (a, y)"
+using a
+apply(simp)
+apply(erule exE)
+apply(simp add: alpha_gen)
+apply(erule conjE)+
+apply(case_tac "a \<notin> supp x")
+apply(simp)
+apply(subgoal_tac "supp x \<sharp>* p")
+apply(drule supp_perm_eq)
+apply(simp)
+apply(simp)
+apply(simp)
+apply(case_tac "a \<notin> supp y")
+apply(simp)
+apply(drule supp_perm_eq)
+apply(clarify)
+apply(simp (no_asm_use))
+apply(simp)
+apply(simp)
+apply(drule yy)
+apply(simp)
+apply(simp)
+apply(simp)
+apply(case_tac "a \<sharp> p")
+apply(subgoal_tac "supp y \<sharp>* p")
+apply(drule supp_perm_eq)
+apply(clarify)
+apply(simp (no_asm_use))
+apply(metis)
+apply(auto simp add: fresh_star_def)[1]
+apply(frule_tac kk)
+apply(drule_tac x="a" in bspec)
+apply(simp)
+apply(simp add: fresh_def)
+apply(simp add: supp_perm)
+apply(subgoal_tac "((p \<bullet> a) \<sharp> p)")
+apply(simp add: fresh_def supp_perm)
+apply(simp add: fresh_star_def)
+done
+
+lemma alpha_unequal:
+  assumes a: "({a}, x) \<approx>abs ({b}, y)" "sort_of a = sort_of b" "a \<noteq> b"
+  shows "(a, x) \<approx>abs1 (b, y)"
+using a
+apply -
+apply(subgoal_tac "a \<notin> supp x - {a}")
+apply(subgoal_tac "b \<notin> supp x - {a}")
+defer
+apply(simp add: alpha_gen)
+apply(simp)
+apply(drule_tac abs_swap1)
+apply(assumption)
+apply(simp only: insert_eqvt empty_eqvt swap_atom_simps)
+apply(simp only: abs_eq_iff)
+apply(drule alphas_abs_sym)
+apply(rotate_tac 4)
+apply(drule_tac alpha_abs_trans)
+apply(assumption)
+apply(drule alpha_equal)
+apply(rule_tac p="(a \<rightleftharpoons> b)" in permute_boolE)
+apply(simp add: fresh_eqvt)
+apply(simp add: fresh_def)
+done
+
+lemma alpha_new_old:
+  assumes a: "({a}, x) \<approx>abs ({b}, y)" "sort_of a = sort_of b" 
+  shows "(a, x) \<approx>abs1 (b, y)"
+using a
+apply(case_tac "a=b")
+apply(simp only: alpha_equal)
+apply(drule alpha_unequal)
+apply(simp)
+apply(simp)
+apply(simp)
+done
+
+end
\ No newline at end of file
--- a/Nominal/ExCoreHaskell.thy	Fri Mar 26 17:22:02 2010 +0100
+++ b/Nominal/ExCoreHaskell.thy	Fri Mar 26 17:22:17 2010 +0100
@@ -194,7 +194,7 @@
   apply (simp add: alphas)
   apply (simp add: perm_bv2[symmetric])
   apply (simp add: eqvts[symmetric])
-  apply (simp add: supp_Abs)
+  apply (simp add: supp_abs)
   apply (simp add: fv_supp)
   apply (simp add: alpha_perm_bn)
   apply (rule supp_perm_eq[symmetric])
@@ -394,7 +394,7 @@
                and s="TAll (pa \<bullet> p \<bullet> tvar) (p \<bullet> tkind) (pa \<bullet> p \<bullet> ty)" in subst)
     apply (simp only: eq_iff)
     apply (rule_tac x="-pa" in exI)
-    apply (simp add: alphas eqvts eqvts_raw supp_Abs fv_supp)
+    apply (simp add: alphas eqvts eqvts_raw supp_abs fv_supp)
     apply (rule_tac t="supp (pa \<bullet> p \<bullet> ty) - {atom (pa \<bullet> p \<bullet> tvar)}"
                 and s="pa \<bullet> (p \<bullet> supp ty - {p \<bullet> atom tvar})" in subst)
     apply (simp add: eqvts)
@@ -422,7 +422,7 @@
     apply (simp add: finite_supp)
     apply (simp add: finite_supp)
     apply (simp add: fresh_def)
-    apply (simp only: supp_Abs eqvts)
+    apply (simp only: supp_abs eqvts)
     apply blast
 
 (* GOAL2 *)
@@ -434,7 +434,7 @@
                and s="CAll (pa \<bullet> p \<bullet> tvar) (p \<bullet> ckind) (pa \<bullet> p \<bullet> co)" in subst)
     apply (simp only: eq_iff)
     apply (rule_tac x="-pa" in exI)
-    apply (simp add: alphas eqvts eqvts_raw supp_Abs fv_supp)
+    apply (simp add: alphas eqvts eqvts_raw supp_abs fv_supp)
     apply (rule_tac t="supp (pa \<bullet> p \<bullet> co) - {atom (pa \<bullet> p \<bullet> tvar)}"
                 and s="pa \<bullet> (p \<bullet> supp co - {p \<bullet> atom tvar})" in subst)
     apply (simp add: eqvts)
@@ -462,7 +462,7 @@
     apply (simp add: finite_supp)
     apply (simp add: finite_supp)
     apply (simp add: fresh_def)
-    apply (simp only: supp_Abs eqvts)
+    apply (simp only: supp_abs eqvts)
     apply blast
 
 
@@ -475,7 +475,7 @@
                and s="LAMT (pa \<bullet> p \<bullet> tvar) (p \<bullet> tkind) (pa \<bullet> p \<bullet> trm)" in subst)
     apply (simp only: eq_iff)
     apply (rule_tac x="-pa" in exI)
-    apply (simp add: alphas eqvts eqvts_raw supp_Abs fv_supp)
+    apply (simp add: alphas eqvts eqvts_raw supp_abs fv_supp)
     apply (rule_tac t="supp (pa \<bullet> p \<bullet> trm) - {atom (pa \<bullet> p \<bullet> tvar)}"
                 and s="pa \<bullet> (p \<bullet> supp trm - {p \<bullet> atom tvar})" in subst)
     apply (simp add: eqvts)
@@ -503,7 +503,7 @@
     apply (simp add: finite_supp)
     apply (simp add: finite_supp)
     apply (simp add: fresh_def)
-    apply (simp only: supp_Abs eqvts)
+    apply (simp only: supp_abs eqvts)
     apply blast
 
 (* GOAL4 a copy-and-paste *)
@@ -515,7 +515,7 @@
                and s="LAMC (pa \<bullet> p \<bullet> tvar) (p \<bullet> ckind) (pa \<bullet> p \<bullet> trm)" in subst)
     apply (simp only: eq_iff)
     apply (rule_tac x="-pa" in exI)
-    apply (simp add: alphas eqvts eqvts_raw supp_Abs fv_supp)
+    apply (simp add: alphas eqvts eqvts_raw supp_abs fv_supp)
     apply (rule_tac t="supp (pa \<bullet> p \<bullet> trm) - {atom (pa \<bullet> p \<bullet> tvar)}"
                 and s="pa \<bullet> (p \<bullet> supp trm - {p \<bullet> atom tvar})" in subst)
     apply (simp add: eqvts)
@@ -543,7 +543,7 @@
     apply (simp add: finite_supp)
     apply (simp add: finite_supp)
     apply (simp add: fresh_def)
-    apply (simp only: supp_Abs eqvts)
+    apply (simp only: supp_abs eqvts)
     apply blast
 
 
@@ -556,7 +556,7 @@
                and s="Lam (pa \<bullet> p \<bullet> var) (p \<bullet> ty) (pa \<bullet> p \<bullet> trm)" in subst)
     apply (simp only: eq_iff)
     apply (rule_tac x="-pa" in exI)
-    apply (simp add: alphas eqvts eqvts_raw supp_Abs fv_supp)
+    apply (simp add: alphas eqvts eqvts_raw supp_abs fv_supp)
     apply (rule_tac t="supp (pa \<bullet> p \<bullet> trm) - {atom (pa \<bullet> p \<bullet> var)}"
                 and s="pa \<bullet> (p \<bullet> supp trm - {p \<bullet> atom var})" in subst)
     apply (simp add: eqvts)
@@ -584,7 +584,7 @@
     apply (simp add: finite_supp)
     apply (simp add: finite_supp)
     apply (simp add: fresh_def)
-    apply (simp only: supp_Abs eqvts)
+    apply (simp only: supp_abs eqvts)
     apply blast
 
 
@@ -597,7 +597,7 @@
                and s="Let (pa \<bullet> p \<bullet> var) (p \<bullet> ty) (p \<bullet> trm1) (pa \<bullet> p \<bullet> trm2)" in subst)
     apply (simp only: eq_iff)
     apply (rule_tac x="-pa" in exI)
-    apply (simp add: alphas eqvts eqvts_raw supp_Abs fv_supp)
+    apply (simp add: alphas eqvts eqvts_raw supp_abs fv_supp)
     apply (rule_tac t="supp (pa \<bullet> p \<bullet> trm2) - {atom (pa \<bullet> p \<bullet> var)}"
                 and s="pa \<bullet> (p \<bullet> supp trm2 - {p \<bullet> atom var})" in subst)
     apply (simp add: eqvts)
@@ -626,7 +626,7 @@
     apply (simp add: finite_supp)
     apply (simp add: finite_supp)
     apply (simp add: fresh_def)
-    apply (simp only: supp_Abs eqvts)
+    apply (simp only: supp_abs eqvts)
     apply blast
 
 (* MAIN ACons Goal *)
@@ -647,10 +647,10 @@
     apply (rule at_set_avoiding2)
     apply (simp add: fin_bv)
     apply (simp add: finite_supp)
-    apply (simp add: supp_Abs)
+    apply (simp add: supp_abs)
     apply (rule finite_Diff)
     apply (simp add: finite_supp)
-    apply (simp add: fresh_star_def fresh_def supp_Abs eqvts)
+    apply (simp add: fresh_star_def fresh_def supp_abs eqvts)
     done
   then have b: "P1 a (0 \<bullet> tkind)" and "P2 b (0 \<bullet> ckind)" "P3 c (0 \<bullet> ty)" and "P4 d (0 \<bullet> ty_lst)" and "P5 e (0 \<bullet> co)" and "P6 f (0 \<bullet> co_lst)" and "P7 g (0 \<bullet> trm)" and "P8 h (0 \<bullet> assoc_lst)" by (blast+)
   moreover have "P9  i (permute_bv 0 (0 \<bullet> pat))" and "P10 j (permute_bv_vt 0 (0 \<bullet> vt_lst))" and "P11 k (permute_bv_tvtk 0 (0 \<bullet> tvtk_lst))" and "P12 l (permute_bv_tvck 0 (0 \<bullet> tvck_lst))" using a1 a2 a3 a4 by (blast+)
--- a/Nominal/ExLet.thy	Fri Mar 26 17:22:02 2010 +0100
+++ b/Nominal/ExLet.thy	Fri Mar 26 17:22:17 2010 +0100
@@ -87,7 +87,7 @@
   apply (simp add: permute_bn_alpha_bn)
   apply (simp add: perm_bn[symmetric])
   apply (simp add: eqvts[symmetric])
-  apply (simp add: supp_Abs)
+  apply (simp add: supp_abs)
   apply (simp add: trm_lts.supp)
   apply (rule supp_perm_eq[symmetric])
   apply (subst supp_finite_atom_set)
@@ -157,10 +157,10 @@
     apply(rule at_set_avoiding2)
     apply(rule fin_bn)
     apply(simp add: finite_supp)
-    apply(simp add: supp_Abs)
+    apply(simp add: supp_abs)
     apply(rule finite_Diff)
     apply(simp add: finite_supp)
-    apply(simp add: fresh_star_def fresh_def supp_Abs)
+    apply(simp add: fresh_star_def fresh_def supp_abs)
     apply(simp add: eqvts permute_bn)
     apply(rule a5)
     apply(simp add: permute_bn)
--- a/Nominal/Fv.thy	Fri Mar 26 17:22:02 2010 +0100
+++ b/Nominal/Fv.thy	Fri Mar 26 17:22:17 2010 +0100
@@ -872,7 +872,7 @@
 *}
 
 lemma supp_abs_sum: "supp (Abs x (a :: 'a :: fs)) \<union> supp (Abs x (b :: 'b :: fs)) = supp (Abs x (a, b))"
-  apply (simp add: supp_Abs supp_Pair)
+  apply (simp add: supp_abs supp_Pair)
   apply blast
   done
 
@@ -880,10 +880,10 @@
 fun supp_eq_tac ind fv perm eqiff ctxt =
   rel_indtac ind THEN_ALL_NEW
   asm_full_simp_tac (HOL_basic_ss addsimps fv) THEN_ALL_NEW
-  asm_full_simp_tac (HOL_basic_ss addsimps @{thms supp_Abs[symmetric]}) THEN_ALL_NEW
+  asm_full_simp_tac (HOL_basic_ss addsimps @{thms supp_abs[symmetric]}) THEN_ALL_NEW
   simp_tac (HOL_basic_ss addsimps @{thms supp_abs_sum}) THEN_ALL_NEW
   simp_tac (HOL_basic_ss addsimps @{thms supp_def}) THEN_ALL_NEW
-  simp_tac (HOL_basic_ss addsimps (@{thm permute_ABS} :: perm)) THEN_ALL_NEW
+  simp_tac (HOL_basic_ss addsimps (@{thm permute_Abs} :: perm)) THEN_ALL_NEW
   simp_tac (HOL_basic_ss addsimps (@{thm Abs_eq_iff} :: eqiff)) THEN_ALL_NEW
   simp_tac (HOL_basic_ss addsimps @{thms alpha_gen2}) THEN_ALL_NEW
   simp_tac (HOL_basic_ss addsimps @{thms alpha_gen}) THEN_ALL_NEW
--- a/Paper/Paper.thy	Fri Mar 26 17:22:02 2010 +0100
+++ b/Paper/Paper.thy	Fri Mar 26 17:22:17 2010 +0100
@@ -3,15 +3,35 @@
 imports "../Nominal/Test" "LaTeXsugar"
 begin
 
+consts
+  fv :: "'a \<Rightarrow> 'b"
+  abs_set :: "'a \<Rightarrow> 'b \<Rightarrow> 'c" 
+  Abs_lst :: "'a \<Rightarrow> 'b \<Rightarrow> 'c"
+  Abs_res :: "'a \<Rightarrow> 'b \<Rightarrow> 'c"
+
+definition
+ "equal \<equiv> (op =)" 
+
 notation (latex output)
   swap ("'(_ _')" [1000, 1000] 1000) and
   fresh ("_ # _" [51, 51] 50) and
   fresh_star ("_ #* _" [51, 51] 50) and
   supp ("supp _" [78] 73) and
   uminus ("-_" [78] 73) and
-  If  ("if _ then _ else _" 10)
+  If  ("if _ then _ else _" 10) and
+  alpha_gen ("_ \<approx>\<^raw:\makebox[0mm][l]{$\,_{\textit{set}}$}>\<^bsup>_,_,_\<^esup> _") and
+  alpha_lst ("_ \<approx>\<^raw:\makebox[0mm][l]{$\,_{\textit{list}}$}>\<^bsup>_,_,_\<^esup> _") and
+  alpha_res ("_ \<approx>\<^raw:\makebox[0mm][l]{$\,_{\textit{res}}$}>\<^bsup>_,_,_\<^esup> _") and
+  abs_set ("_ \<approx>\<^raw:{$\,_{\textit{abs\_set}}$}> _") and
+  fv ("fv'(_')" [100] 100) and
+  equal ("=") and
+  alpha_abs ("_ \<approx>\<^raw:{$\,_{\textit{abs\_set}}$}> _") and 
+  Abs ("[_]\<^raw:$\!$>\<^bsub>set\<^esub>._") and
+  Abs_lst ("[_]\<^raw:$\!$>\<^bsub>list\<^esub>._") and
+  Abs_res ("[_]\<^raw:$\!$>\<^bsub>res\<^esub>._") 
 (*>*)
 
+
 section {* Introduction *}
 
 text {*
@@ -19,12 +39,12 @@
   alpha-equated terms, for example
 
   \begin{center}
-  $t ::= x \mid t\;t \mid \lambda x. t$
+  @{text "t ::= x | t t | \<lambda>x. t"}
   \end{center}
 
   \noindent
   where free and bound variables have names.  For such terms Nominal Isabelle
-  derives automatically a reasoning infrastructure that  has been used
+  derives automatically a reasoning infrastructure that has been used
   successfully in formalisations of an equivalence checking algorithm for LF
   \cite{UrbanCheneyBerghofer08}, Typed
   Scheme~\cite{TobinHochstadtFelleisen08}, several calculi for concurrency
@@ -39,7 +59,8 @@
   %
   \begin{equation}\label{tysch}
   \begin{array}{l}
-  T ::= x \mid T \rightarrow T \hspace{5mm} S ::= \forall \{x_1,\ldots, x_n\}. T
+  @{text "T ::= x | T \<rightarrow> T"}\hspace{5mm}
+  @{text "S ::= \<forall>{x\<^isub>1,\<dots>, x\<^isub>n}. T"}
   \end{array}
   \end{equation}
 
@@ -59,38 +80,38 @@
   we would like to regard the following two type-schemes as alpha-equivalent
   %
   \begin{equation}\label{ex1}
-  \forall \{x, y\}. x \rightarrow y  \;\approx_\alpha\; \forall \{y, x\}. y \rightarrow x 
+  @{text "\<forall>{x,y}. x \<rightarrow> y  \<approx>\<^isub>\<alpha>  \<forall>{y,x}. y \<rightarrow> x"} 
   \end{equation}
 
   \noindent
-  but assuming that $x$, $y$ and $z$ are distinct variables,
+  but assuming that @{text x}, @{text y} and @{text z} are distinct variables,
   the following two should \emph{not} be alpha-equivalent
   %
   \begin{equation}\label{ex2}
-  \forall \{x, y\}. x \rightarrow y  \;\not\approx_\alpha\; \forall \{z\}. z \rightarrow z 
+  @{text "\<forall>{x,y}. x \<rightarrow> y  \<notapprox>\<^isub>\<alpha>  \<forall>{z}. z \<rightarrow> z"} 
   \end{equation}
 
   \noindent
-  Moreover, we like to regard type-schemes as 
-  alpha-equivalent, if they differ only on \emph{vacuous} binders, such as
+  Moreover, we like to regard type-schemes as alpha-equivalent, if they differ
+  only on \emph{vacuous} binders, such as
   %
   \begin{equation}\label{ex3}
-  \forall \{x\}. x \rightarrow y  \;\approx_\alpha\; \forall \{x, z\}. x \rightarrow y
+  @{text "\<forall>{x}. x \<rightarrow> y  \<approx>\<^isub>\<alpha>  \<forall>{x,z}. x \<rightarrow> y"}
   \end{equation}
 
   \noindent
-  where $z$ does not occur freely in the type.
-  In this paper we will give a general binding mechanism and associated
-  notion of alpha-equivalence that can be used to faithfully represent
-  this kind of binding in Nominal Isabelle.  The difficulty of finding the right notion 
-  for alpha-equivalence can be appreciated in this case by considering that the 
-  definition given by Leroy in \cite{Leroy92} is incorrect (it omits a side-condition).
+  where @{text z} does not occur freely in the type.  In this paper we will
+  give a general binding mechanism and associated notion of alpha-equivalence
+  that can be used to faithfully represent this kind of binding in Nominal
+  Isabelle.  The difficulty of finding the right notion for alpha-equivalence
+  can be appreciated in this case by considering that the definition given by
+  Leroy in \cite{Leroy92} is incorrect (it omits a side-condition).
 
-  However, the notion of alpha-equivalence that is preserved by vacuous binders is not
-  always wanted. For example in terms like
+  However, the notion of alpha-equivalence that is preserved by vacuous
+  binders is not always wanted. For example in terms like
   %
   \begin{equation}\label{one}
-  \LET x = 3 \AND y = 2 \IN x\,-\,y \END
+  @{text "\<LET> x = 3 \<AND> y = 2 \<IN> x - y \<END>"}
   \end{equation}
 
   \noindent
@@ -99,7 +120,7 @@
   with
   %
   \begin{center}
-  $\LET x = 3 \AND y = 2 \AND z = loop \IN x\,-\,y \END$
+  @{text "\<LET> x = 3 \<AND> y = 2 \<AND> z = loop \<IN> x - y \<END>"}
   \end{center}
 
   \noindent
@@ -109,10 +130,10 @@
 
   However, we found that this is still not sufficient for dealing with
   language constructs frequently occurring in programming language
-  research. For example in $\mathtt{let}$s containing patterns
+  research. For example in @{text "\<LET>"}s containing patterns
   %
   \begin{equation}\label{two}
-  \LET (x, y) = (3, 2) \IN x\,-\,y \END
+  @{text "\<LET> (x, y) = (3, 2) \<IN> x - y \<END>"}
   \end{equation}
 
   \noindent
@@ -121,72 +142,79 @@
   we do not want to regard \eqref{two} as alpha-equivalent with
   %
   \begin{center}
-  $\LET (y, x) = (3, 2) \IN x\,- y\,\END$
+  @{text "\<LET> (y, x) = (3, 2) \<IN> x - y \<END>"}
   \end{center}
 
   \noindent
-  As a result, we provide three general binding mechanisms each of which binds multiple
-  variables at once, and let the user chose which one is intended when formalising a
-  programming language calculus.
+  As a result, we provide three general binding mechanisms each of which binds
+  multiple variables at once, and let the user chose which one is intended
+  when formalising a programming language calculus.
 
-  By providing these general binding mechanisms, however, we have to work around 
-  a problem that has been pointed out by Pottier \cite{Pottier06} and Cheney 
-  \cite{Cheney05}: in $\mathtt{let}$-constructs of the form
+  By providing these general binding mechanisms, however, we have to work
+  around a problem that has been pointed out by Pottier \cite{Pottier06} and
+  Cheney \cite{Cheney05}: in @{text "\<LET>"}-constructs of the form
   %
   \begin{center}
-  $\LET x_1 = t_1 \AND \ldots \AND x_n = t_n \IN s \END$
+  @{text "\<LET> x\<^isub>1 = t\<^isub>1 \<AND> \<dots> \<AND> x\<^isub>n = t\<^isub>n \<IN> s \<END>"}
   \end{center}
 
   \noindent
-  which bind all the $x_i$ in $s$, we might not care about the order in 
-  which the $x_i = t_i$ are given, but we do care about the information that there are 
-  as many $x_i$ as there are $t_i$. We lose this information if we represent the 
-  $\mathtt{let}$-constructor by something like 
+  which bind all the @{text "x\<^isub>i"} in @{text s}, we might not care
+  about the order in which the @{text "x\<^isub>i = t\<^isub>i"} are given,
+  but we do care about the information that there are as many @{text
+  "x\<^isub>i"} as there are @{text "t\<^isub>i"}. We lose this information if
+  we represent the @{text "\<LET>"}-constructor by something like
   %
   \begin{center}
-  $\LET [x_1,\ldots,x_n].s\;\; [t_1,\ldots,t_n]$
+  @{text "\<LET> [x\<^isub>1,\<dots>,x\<^isub>n].s [t\<^isub>1,\<dots>,t\<^isub>n]"}
   \end{center}
 
   \noindent
-  where the notation $[\_\!\_].\_\!\_$ indicates that the $x_i$ become bound
-  in $s$. In this representation the term \mbox{$\LET [x].s\;\;[t_1,t_2]$}
-  would be a perfectly legal instance. To exclude such terms, additional
-  predicates about well-formed terms are needed in order to ensure that the two
-  lists are of equal length. This can result into very messy reasoning (see
-  for example~\cite{BengtsonParow09}). To avoid this, we will allow type specifications
-  for $\mathtt{let}$s as follows
+  where the notation @{text "[_]._"} indicates that the @{text "x\<^isub>i"}
+  become bound in @{text s}. In this representation the term 
+  \mbox{@{text "\<LET> [x].s [t\<^isub>1,t\<^isub>2]"}} would be a perfectly legal
+  instance. To exclude such terms, additional predicates about well-formed
+  terms are needed in order to ensure that the two lists are of equal
+  length. This can result into very messy reasoning (see for
+  example~\cite{BengtsonParow09}). To avoid this, we will allow type
+  specifications for $\mathtt{let}$s as follows
   %
   \begin{center}
   \begin{tabular}{r@ {\hspace{2mm}}r@ {\hspace{2mm}}l}
-  $trm$ & $::=$  & \ldots\\ 
-        & $\mid$ & $\mathtt{let}\;a\!::\!assn\;\;s\!::\!trm\quad\mathtt{bind}\;bn\,(a) \IN s$\\[1mm]
-  $assn$ & $::=$  & $\mathtt{anil}$\\
-         & $\mid$ & $\mathtt{acons}\;\;name\;\;trm\;\;assn$
+  @{text trm} & @{text "::="}  & @{text "\<dots>"}\\ 
+              & @{text "|"}    & @{text "\<LET> a::assn s::trm"}\hspace{4mm} 
+                                 \isacommand{bind} @{text "bn(a)"} \isacommand{in} @{text "s"}\\[1mm]
+  @{text assn} & @{text "::="} & @{text "\<ANIL>"}\\
+               & @{text "|"}   & @{text "\<ACONS> name trm assn"}
   \end{tabular}
   \end{center}
 
   \noindent
-  where $assn$ is an auxiliary type representing a list of assignments 
-  and $bn$ an auxiliary function identifying the variables to be bound by 
-  the $\mathtt{let}$. This function is defined by recursion over $assn$ as follows
+  where @{text assn} is an auxiliary type representing a list of assignments
+  and @{text bn} an auxiliary function identifying the variables to be bound
+  by the @{text "\<LET>"}. This function is defined by recursion over @{text
+  assn} as follows
 
   \begin{center}
-  $bn\,(\mathtt{anil}) = \varnothing \qquad bn\,(\mathtt{acons}\;x\;t\;as) = \{x\} \cup bn\,(as)$ 
+  @{text "bn(\<ANIL>) ="} @{term "{}"} \hspace{5mm} 
+  @{text "bn(\<ACONS> x t as) = {x} \<union> bn(as)"} 
   \end{center}
   
   \noindent
   The scope of the binding is indicated by labels given to the types, for
-  example \mbox{$s\!::\!trm$}, and a binding clause, in this case
-  $\mathtt{bind}\;bn\,(a) \IN s$, that states to bind in $s$ all the names the
-  function call $bn\,(a)$ returns.  This style of specifying terms and bindings is
-  heavily inspired by the syntax of the Ott-tool \cite{ott-jfp}.
+  example @{text "s::trm"}, and a binding clause, in this case
+  \isacommand{bind} @{text "bn(a)"} \isacommand{in} @{text "s"}, that states
+  to bind in @{text s} all the names the function call @{text "bn(a)"} returns.
+  This style of specifying terms and bindings is heavily inspired by the
+  syntax of the Ott-tool \cite{ott-jfp}.
+
 
   However, we will not be able to deal with all specifications that are
   allowed by Ott. One reason is that Ott lets the user to specify ``empty'' 
   types like
 
   \begin{center}
-  $t ::= t\;t \mid \lambda x. t$
+  @{text "t ::= t t | \<lambda>x. t"}
   \end{center}
 
   \noindent
@@ -204,32 +232,31 @@
   two type-schemes (with $x$, $y$ and $z$ being distinct)
 
   \begin{center}
-  $\forall \{x\}. x \rightarrow y  \;=\; \forall \{x, z\}. x \rightarrow y$ 
+  @{text "\<forall>{x}. x \<rightarrow> y  = \<forall>{x,z}. x \<rightarrow> y"} 
   \end{center}
   
   \noindent
-  are not just alpha-equal, but actually \emph{equal}. As a
-  result, we can only support specifications that make sense on the level of
-  alpha-equated terms (offending specifications, which for example bind a variable
-  according to a variable bound somewhere else, are not excluded by Ott, but we 
-  have to).  Our
-  insistence on reasoning with alpha-equated terms comes from the wealth of
-  experience we gained with the older version of Nominal Isabelle: for
-  non-trivial properties, reasoning about alpha-equated terms is much easier
-  than reasoning with raw terms. The fundamental reason for this is that the
-  HOL-logic underlying Nominal Isabelle allows us to replace
-  ``equals-by-equals''. In contrast, replacing ``alpha-equals-by-alpha-equals''
-  in a representation based on raw terms requires a lot of extra reasoning work.
+  are not just alpha-equal, but actually \emph{equal}. As a result, we can
+  only support specifications that make sense on the level of alpha-equated
+  terms (offending specifications, which for example bind a variable according
+  to a variable bound somewhere else, are not excluded by Ott, but we have
+  to).  Our insistence on reasoning with alpha-equated terms comes from the
+  wealth of experience we gained with the older version of Nominal Isabelle:
+  for non-trivial properties, reasoning about alpha-equated terms is much
+  easier than reasoning with raw terms. The fundamental reason for this is
+  that the HOL-logic underlying Nominal Isabelle allows us to replace
+  ``equals-by-equals''. In contrast, replacing
+  ``alpha-equals-by-alpha-equals'' in a representation based on raw terms
+  requires a lot of extra reasoning work.
 
-  Although in informal settings a reasoning infrastructure for alpha-equated 
-  terms is nearly always taken for granted, establishing 
-  it automatically in the Isabelle/HOL theorem prover is a rather non-trivial task. 
-  For every specification we will need to construct a type containing as 
-  elements the alpha-equated terms. To do so, we use 
-  the standard HOL-technique of defining a new type by  
-  identifying a non-empty subset of an existing type.   The construction we 
-  perform in HOL can be illustrated by the following picture:
- 
+  Although in informal settings a reasoning infrastructure for alpha-equated
+  terms is nearly always taken for granted, establishing it automatically in
+  the Isabelle/HOL theorem prover is a rather non-trivial task. For every
+  specification we will need to construct a type containing as elements the
+  alpha-equated terms. To do so, we use the standard HOL-technique of defining
+  a new type by identifying a non-empty subset of an existing type.  The
+  construction we perform in HOL can be illustrated by the following picture:
+
   \begin{center}
   \begin{tikzpicture}
   %\draw[step=2mm] (-4,-1) grid (4,1);
@@ -255,45 +282,45 @@
   \end{center}
 
   \noindent
-  We take as the starting point a definition of raw terms (defined as a 
-  datatype in Isabelle/HOL); identify then the 
-  alpha-equivalence classes in the type of sets of raw terms according to our 
-  alpha-equivalence relation and finally define the new type as these 
-  alpha-equivalence classes (non-emptiness is satisfied whenever the raw terms are 
-  definable as datatype in Isabelle/HOL and the fact that our relation for 
-  alpha-equivalence is indeed an equivalence relation).
+  We take as the starting point a definition of raw terms (defined as a
+  datatype in Isabelle/HOL); identify then the alpha-equivalence classes in
+  the type of sets of raw terms according to our alpha-equivalence relation
+  and finally define the new type as these alpha-equivalence classes
+  (non-emptiness is satisfied whenever the raw terms are definable as datatype
+  in Isabelle/HOL and the fact that our relation for alpha-equivalence is
+  indeed an equivalence relation).
 
-  The fact that we obtain an isomorphism between the new type and the non-empty 
-  subset shows that the new type is a faithful representation of alpha-equated terms. 
-  That is not the case for example for terms using the locally 
-  nameless representation of binders \cite{McKinnaPollack99}: in this representation 
-  there are ``junk'' terms that need to
-  be excluded by reasoning about a well-formedness predicate.
+  The fact that we obtain an isomorphism between the new type and the
+  non-empty subset shows that the new type is a faithful representation of
+  alpha-equated terms. That is not the case for example for terms using the
+  locally nameless representation of binders \cite{McKinnaPollack99}: in this
+  representation there are ``junk'' terms that need to be excluded by
+  reasoning about a well-formedness predicate.
 
-  The problem with introducing a new type in Isabelle/HOL is that in order to be useful, 
-  a reasoning infrastructure needs to be ``lifted'' from the underlying subset to 
-  the new type. This is usually a tricky and arduous task. To ease it,
-  we re-implemented in Isabelle/HOL the quotient package described by Homeier 
-  \cite{Homeier05} for the HOL4 system. This package 
-  allows us to  lift definitions and theorems involving raw terms
-  to definitions and theorems involving alpha-equated terms. For example
-  if we define the free-variable function over raw lambda-terms
+  The problem with introducing a new type in Isabelle/HOL is that in order to
+  be useful, a reasoning infrastructure needs to be ``lifted'' from the
+  underlying subset to the new type. This is usually a tricky and arduous
+  task. To ease it, we re-implemented in Isabelle/HOL the quotient package
+  described by Homeier \cite{Homeier05} for the HOL4 system. This package
+  allows us to lift definitions and theorems involving raw terms to
+  definitions and theorems involving alpha-equated terms. For example if we
+  define the free-variable function over raw lambda-terms
 
   \begin{center}
-  $\fv(x) = \{x\}$\hspace{10mm}
-  $\fv(t_1\;t_2) = \fv(t_1) \cup \fv(t_2)$\\[1mm]
-  $\fv(\lambda x.t) = \fv(t) - \{x\}$
+  @{text "fv(x) = {x}"}\hspace{10mm}
+  @{text "fv(t\<^isub>1 t\<^isub>2) = fv(t\<^isub>1) \<union> fv(t\<^isub>2)"}\\[1mm]
+  @{text "fv(\<lambda>x.t) = fv(t) - {x}"}
   \end{center}
   
   \noindent
-  then with not too great effort we obtain a function $\fv^\alpha$
+  then with not too great effort we obtain a function @{text "fv\<^sup>\<alpha>"}
   operating on quotients, or alpha-equivalence classes of lambda-terms. This
   lifted function is characterised by the equations
 
   \begin{center}
-  $\fv^\alpha(x) = \{x\}$\hspace{10mm}
-  $\fv^\alpha(t_1\;t_2) = \fv^\alpha(t_1) \cup \fv^\alpha(t_2)$\\[1mm]
-  $\fv^\alpha(\lambda x.t) = \fv^\alpha(t) - \{x\}$
+  @{text "fv\<^sup>\<alpha>(x) = {x}"}\hspace{10mm}
+  @{text "fv\<^sup>\<alpha>(t\<^isub>1 t\<^isub>2) = fv\<^sup>\<alpha>(t\<^isub>1) \<union> fv\<^sup>\<alpha>(t\<^isub>2)"}\\[1mm]
+  @{text "fv\<^sup>\<alpha>(\<lambda>x.t) = fv\<^sup>\<alpha>(t) - {x}"}
   \end{center}
 
   \noindent
@@ -400,44 +427,47 @@
   from this specification (remember that Nominal Isabelle is a definitional
   extension of Isabelle/HOL, which does not introduce any new axioms).
 
-
-  In order to keep our work manageable, we will wherever possible state
-  definitions and perform proofs inside Isabelle, as opposed to write custom
-  ML-code that generates them anew for each specification. To that
-  end, we will consider pairs @{text "(as, x)"} of type @{text "(atom set) \<times> \<beta>"}.
-  These pairs are intended to represent the abstraction, or binding, of the set @{text "as"} 
-  in the body @{text "x"}.
+  In order to keep our work with deriving the reasoning infrastructure
+  manageable, we will wherever possible state definitions and perform proofs
+  on the user-level of Isabelle/HOL, as opposed to write custom ML-code that
+  generates them anew for each specification. To that end, we will consider
+  first pairs @{text "(as, x)"} of type @{text "(atom set) \<times> \<beta>"}.  These pairs
+  are intended to represent the abstraction, or binding, of the set @{text
+  "as"} in the body @{text "x"}.
 
-  The first question we have to answer is when the pairs $(as, x)$ and $(bs, y)$ are
-  alpha-equivalent? (At the moment we are interested in
-  the notion of alpha-equivalence that is \emph{not} preserved by adding 
-  vacuous binders.) To answer this, we identify four conditions: {\it i)} given 
-  a free-variable function $\fv$ of type \mbox{@{text "\<beta> \<Rightarrow> atom set"}}, then @{text x} and @{text y} 
-  need to have the same set of free variables; moreover there must be a permutation
-  @{text p}  such that {\it ii)} it leaves the free variables of @{text x} and @{text y} unchanged, 
-  but {\it iii)} ``moves'' their bound names so that we obtain modulo a relation, 
-  say \mbox{@{text "_ R _"}}, two equal terms. We also require {\it iv)} that @{text p} makes 
-  the abstracted sets @{text as} and @{text bs} equal. The requirements {\it i)} to {\it iv)} can 
-  be stated formally as follows:
+  The first question we have to answer is when the pairs @{text "(as, x)"} and
+  @{text "(bs, y)"} are alpha-equivalent? (At the moment we are interested in
+  the notion of alpha-equivalence that is \emph{not} preserved by adding
+  vacuous binders.) To answer this, we identify four conditions: {\it i)}
+  given a free-variable function @{text "fv"} of type \mbox{@{text "\<beta> \<Rightarrow> atom
+  set"}}, then @{text x} and @{text y} need to have the same set of free
+  variables; moreover there must be a permutation @{text p} such that {\it
+  ii)} it leaves the free variables of @{text x} and @{text y} unchanged, but
+  {\it iii)} ``moves'' their bound names so that we obtain modulo a relation,
+  say \mbox{@{text "_ R _"}}, two equal terms. We also require {\it iv)} that
+  @{text p} makes the abstracted sets @{text as} and @{text bs} equal. The
+  requirements {\it i)} to {\it iv)} can be stated formally as follows:
   %
   \begin{equation}\label{alphaset}
   \begin{array}{@ {\hspace{10mm}}r@ {\hspace{2mm}}l}
-  \multicolumn{2}{l}{(as, x) \approx\hspace{0.05mm}_{set}^{\fv, R, p} (bs, y) \;\dn\hspace{30mm}\;}\\[1mm]
-             & @{text "fv(x) - as = fv(y) - bs"}\\
-  \wedge     & @{text "(fv(x) - as) #* p"}\\
-  \wedge     & @{text "(p \<bullet> x) R y"}\\
-  \wedge     & @{text "(p \<bullet> as) = bs"}\\ 
+  \multicolumn{2}{l}{@{term "(as, x) \<approx>gen R fv p (bs, y)"} @{text "\<equiv>"}\hspace{30mm}}\\
+               & @{term "fv(x) - as = fv(y) - bs"}\\
+  @{text "\<and>"} & @{term "(fv(x) - as) \<sharp>* p"}\\
+  @{text "\<and>"} & @{text "(p \<bullet> x) R y"}\\
+  @{text "\<and>"} & @{term "(p \<bullet> as) = bs"}\\ 
   \end{array}
   \end{equation}
 
   \noindent
-  Note that this relation is dependent on $p$. Alpha-equivalence is then the relation where 
-  we existentially quantify over this $p$. 
-  Also note that the relation is dependent on a free-variable function $\fv$ and a relation 
-  $R$. The reason for this extra generality is that we will use $\approx_{set}$ for both 
-  ``raw'' terms and alpha-equated terms. In the latter case, $R$ will be replaced by 
-  equality $(op =)$ and we are going to prove that $\fv$ will be equal to the support 
-  of $x$ and $y$. 
+  Note that this relation is dependent on the permutation @{text
+  "p"}. Alpha-equivalence between two pairs is then the relation where we
+  existentially quantify over this @{text "p"}. Also note that the relation is
+  dependent on a free-variable function @{text "fv"} and a relation @{text
+  "R"}. The reason for this extra generality is that we will use
+  $\approx_{\textit{set}}$ for both ``raw'' terms and alpha-equated terms. In
+  the latter case, $R$ will be replaced by equality @{text "="} and for raw terms we
+  will prove that @{text "fv"} is equal to the support of @{text
+  x} and @{text y}.
 
   The definition in \eqref{alphaset} does not make any distinction between the
   order of abstracted variables. If we want this, then we can define alpha-equivalence 
@@ -446,26 +476,27 @@
   %
   \begin{equation}\label{alphalist}
   \begin{array}{@ {\hspace{10mm}}r@ {\hspace{2mm}}l}
-  \multicolumn{2}{l}{(as, x) \approx\hspace{0.05mm}_{list}^{\fv, R, p} (bs, y) \;\dn\hspace{30mm}\;}\\[1mm]
-             & @{text "fv(x) - (set as) = fv(y) - (set bs)"}\\
-  \wedge     & @{text "(fv(x) - set as) #* p"}\\
+  \multicolumn{2}{l}{@{term "(as, x) \<approx>lst R fv p (bs, y)"} @{text "\<equiv>"}\hspace{30mm}}\\[1mm]
+             & @{term "fv(x) - (set as) = fv(y) - (set bs)"}\\
+  \wedge     & @{term "(fv(x) - set as) \<sharp>* p"}\\
   \wedge     & @{text "(p \<bullet> x) R y"}\\
-  \wedge     & @{text "(p \<bullet> as) = bs"}\\ 
+  \wedge     & @{term "(p \<bullet> as) = bs"}\\ 
   \end{array}
   \end{equation}
   
   \noindent
-  where $set$ is the function that coerces a list of atoms into a set of atoms.
+  where @{term set} is a function that coerces a list of atoms into a set of atoms.
+  Now the last clause ensures that the order of the binders matters.
 
-  If we do not want to make any difference between the order of binders and
+  If we do not want to make any difference between the order of binders \emph{and}
   also allow vacuous binders, then we keep sets of binders, but drop the fourth 
   condition in \eqref{alphaset}:
   %
   \begin{equation}\label{alphares}
   \begin{array}{@ {\hspace{10mm}}r@ {\hspace{2mm}}l}
-  \multicolumn{2}{l}{(as, x) \approx\hspace{0.05mm}_{res}^{\fv, R, p} (bs, y) \;\dn\hspace{30mm}\;}\\[1mm]
-             & @{text "fv(x) - as = fv(y) - bs"}\\
-  \wedge     & @{text "(fv(x) - as) #* p"}\\
+  \multicolumn{2}{l}{@{term "(as, x) \<approx>res R fv p (bs, y)"} @{text "\<equiv>"}\hspace{30mm}}\\[1mm]
+             & @{term "fv(x) - as = fv(y) - bs"}\\
+  \wedge     & @{term "(fv(x) - as) \<sharp>* p"}\\
   \wedge     & @{text "(p \<bullet> x) R y"}\\
   \end{array}
   \end{equation}
@@ -473,52 +504,116 @@
   \begin{exmple}\rm
   It might be useful to consider some examples for how these definitions pan out in practise.
   For this consider the case of abstracting a set of variables over types (as in type-schemes). 
-  We set $R$ to be the equality and for $\fv(T)$ we define
+  We set @{text R} to be the equality and for @{text "fv(T)"} we define
 
   \begin{center}
-  $\fv(x) = \{x\}  \qquad \fv(T_1 \rightarrow T_2) = \fv(T_1) \cup \fv(T_2)$
+  @{text "fv(x) = {x}"}  \hspace{5mm} @{text "fv(T\<^isub>1 \<rightarrow> T\<^isub>2) = fv(T\<^isub>1) \<union> fv(T\<^isub>2)"}
   \end{center}
 
   \noindent
-  Now recall the examples shown in \eqref{ex1}, \eqref{ex2} and \eqref{ex3}. It can be easily 
-  checked that @{text "({x, y}, x \<rightarrow> y)"} and
-  @{text "({y, x}, y \<rightarrow> x)"} are equal according to $\approx_{set}$ and $\approx_{res}$ by taking $p$ to
-  be the swapping @{term "(x \<rightleftharpoons> y)"}. In case of @{text "x \<noteq> y"}, then 
-  $([x, y], x \rightarrow y) \not\approx_{list} ([y,x], x \rightarrow y)$ since there is no permutation that 
-  makes the lists @{text "[x, y]"} and @{text "[y, x]"} equal, and also leaves the 
-  type \mbox{@{text "x \<rightarrow> y"}} unchanged. Another examples is 
-   $(\{x\}, x) \approx_{res} (\{x,y\}, x)$ which holds by taking $p$ to be the identity permutation.
-  However, if @{text "x \<noteq> y"}, then  
-  $(\{x\}, x) \not\approx_{set} (\{x,y\}, x)$ since there is no permutation that makes
-  the sets $\{x\}$ and $\{x,y\}$ equal (similarly for $\approx_{list}$).
+  Now recall the examples shown in \eqref{ex1}, \eqref{ex2} and
+  \eqref{ex3}. It can be easily checked that @{text "({x,y}, x \<rightarrow> y)"} and
+  @{text "({y,x}, y \<rightarrow> x)"} are equal according to $\approx_{\textit{set}}$ and
+  $\approx_{\textit{res}}$ by taking @{text p} to be the swapping @{term "(x \<rightleftharpoons>
+  y)"}. In case of @{text "x \<noteq> y"}, then @{text "([x, y], x \<rightarrow> y)"}
+  $\not\approx_{\textit{list}}$ @{text "([y,x], x \<rightarrow> y)"} since there is no permutation
+  that makes the lists @{text "[x, y]"} and @{text "[y, x]"} equal, and also
+  leaves the type \mbox{@{text "x \<rightarrow> y"}} unchanged. Another example is
+  @{text "({x}, x)"} $\approx_{\textit{res}}$ @{text "({x,y}, x)"} which holds by 
+  taking @{text p} to be the
+  identity permutation.  However, if @{text "x \<noteq> y"}, then @{text "({x}, x)"}
+  $\not\approx_{\textit{set}}$ @{text "({x,y}, x)"} since there is no permutation 
+  that makes the
+  sets @{text "{x}"} and @{text "{x,y}"} equal (similarly for $\approx_{\textit{list}}$).
   \end{exmple}
 
+  % looks too ugly
+  %\noindent
+  %Let $\star$ range over $\{set, res, list\}$. We prove next under which 
+  %conditions the $\approx\hspace{0.05mm}_\star^{\fv, R, p}$ are equivalence 
+  %relations and equivariant:
+  %
+  %\begin{lemma}
+  %{\it i)} Given the fact that $x\;R\;x$ holds, then 
+  %$(as, x) \approx\hspace{0.05mm}^{\fv, R, 0}_\star (as, x)$. {\it ii)} Given
+  %that @{text "(p \<bullet> x) R y"} implies @{text "(-p \<bullet> y) R x"}, then
+  %$(as, x) \approx\hspace{0.05mm}^{\fv, R, p}_\star (bs, y)$ implies
+  %$(bs, y) \approx\hspace{0.05mm}^{\fv, R, - p}_\star (as, x)$. {\it iii)} Given
+  %that @{text "(p \<bullet> x) R y"} and @{text "(q \<bullet> y) R z"} implies 
+  %@{text "((q + p) \<bullet> x) R z"}, then $(as, x) \approx\hspace{0.05mm}^{\fv, R, p}_\star (bs, y)$
+  %and $(bs, y) \approx\hspace{0.05mm}^{\fv, R, q}_\star (cs, z)$ implies
+  %$(as, x) \approx\hspace{0.05mm}^{\fv, R, q + p}_\star (cs, z)$. Given
+  %@{text "(q \<bullet> x) R y"} implies @{text "(p \<bullet> (q \<bullet> x)) R (p \<bullet> y)"} and
+  %@{text "p \<bullet> (fv x) = fv (p \<bullet> x)"} then @{text "p \<bullet> (fv y) = fv (p \<bullet> y)"}, then
+  %$(as, x) \approx\hspace{0.05mm}^{\fv, R, q}_\star (bs, y)$ implies
+  %$(p \;\isasymbullet\; as, p \;\isasymbullet\; x) \approx\hspace{0.05mm}^{\fv, R, q}_\star 
+  %(p \;\isasymbullet\; bs, p \;\isasymbullet\; y)$.
+  %\end{lemma}
+  
+  %\begin{proof}
+  %All properties are by unfolding the definitions and simple calculations. 
+  %\end{proof}
+
+
+  In the rest of this section we are going to introduce a type- and term-constructor 
+  for abstractions. For this we define 
+  %
+  \begin{equation}
+  @{term "abs_set (as, x) (bs, x) \<equiv> \<exists>p. alpha_gen (as, x) equal supp p (bs, x)"}
+  \end{equation}
+  
   \noindent
-  Let $\star$ range over $\{set, res, list\}$. We prove next under which 
-  conditions the $\approx\hspace{0.05mm}_\star^{\fv, R, p}$ are equivalence 
-  relations and equivariant:
+  Similarly for @{text "abs_list"} and @{text "abs_res"}. We can show that these 
+  relations are equivalence relations and equivariant 
+  (we only show the $\approx_{\textit{abs\_set}}$-case).
 
   \begin{lemma}
-  {\it i)} Given the fact that $x\;R\;x$ holds, then 
-  $(as, x) \approx\hspace{0.05mm}^{\fv, R, 0}_\star (as, x)$. {\it ii)} Given
-  that @{text "(p \<bullet> x) R y"} implies @{text "(-p \<bullet> y) R x"}, then
-  $(as, x) \approx\hspace{0.05mm}^{\fv, R, p}_\star (bs, y)$ implies
-  $(bs, y) \approx\hspace{0.05mm}^{\fv, R, - p}_\star (as, x)$. {\it iii)} Given
-  that @{text "(p \<bullet> x) R y"} and @{text "(q \<bullet> y) R z"} implies 
-  @{text "((q + p) \<bullet> x) R z"}, then $(as, x) \approx\hspace{0.05mm}^{\fv, R, p}_\star (bs, y)$
-  and $(bs, y) \approx\hspace{0.05mm}^{\fv, R, q}_\star (cs, z)$ implies
-  $(as, x) \approx\hspace{0.05mm}^{\fv, R, q + p}_\star (cs, z)$. Given
-  @{text "(q \<bullet> x) R y"} implies @{text "(p \<bullet> (q \<bullet> x)) R (p \<bullet> y)"} and
-  @{text "p \<bullet> (fv x) = fv (p \<bullet> x)"} then @{text "p \<bullet> (fv y) = fv (p \<bullet> y)"}, then
-  $(as, x) \approx\hspace{0.05mm}^{\fv, R, q}_\star (bs, y)$ implies
-  $(p \;\isasymbullet\; as, p \;\isasymbullet\; x) \approx\hspace{0.05mm}^{\fv, R, q}_\star 
-  (p \;\isasymbullet\; bs, p \;\isasymbullet\; y)$.
+  $\approx_{\textit{abs\_set}}$ is an equivalence
+  relations, and if @{term "abs_set (as, x) (bs, x)"} then also
+  @{term "abs_set (p \<bullet> as, p \<bullet> x) (p \<bullet> bs, p \<bullet> x)"}.
+  \end{lemma}
+
+  \begin{proof}
+  Reflexivity is by taking @{text "p"} to be @{text "0"}. For symmetry we have
+  a permutation @{text p} and for the proof obligation take @{term "-p"}. In case 
+  of transitivity we have two permutations @{text p} and @{text q}, and for the
+  proof obligation use @{text "q + p"}. All the conditions are then by simple
+  calculations. 
+  \end{proof}
+
+  \noindent
+  The following lemma (and similar ones for $\approx_{\textit{abs\_list}}$ and 
+  $\approx_{\textit{abs\_res}}$) will be crucial below: 
+
+  \begin{lemma}
+  @{thm[mode=IfThen] alpha_abs_swap[no_vars]}
   \end{lemma}
-  
+
   \begin{proof}
-  All properties are by unfolding the definitions and simple calculations. 
+  This lemma is straightforward by observing that the assumptions give us
+  @{term "(a \<rightleftharpoons> b) \<bullet> (supp x - bs) = (supp x - bs)"} and that @{text supp}
+  is equivariant.
   \end{proof}
 
+  \noindent 
+  We are also define the following  
+
+  @{text "aux (as, x) \<equiv> supp x - as"}
+
+  
+
+  \noindent
+  This allows us to use our quotient package and introduce new types
+  @{text "\<beta> abs_set"}, @{text "\<beta> abs_res"} and @{text "\<beta> abs_list"}
+  representing the alpha-equivalence classes. Elements in these types 
+  we will, respectively, write as:
+
+  \begin{center}
+  @{term "Abs as x"} \hspace{5mm} 
+  @{term "Abs_lst as x"} \hspace{5mm}
+  @{term "Abs_res as x"}
+  \end{center}
+
 
   \begin{lemma}
   $supp ([as]set. x) = supp x - as$ 
@@ -834,7 +929,7 @@
   \begin{tabular}{cp{7cm}}
   $\bullet$ & @{text "{atom x\<^isub>i} - bnds"} provided @{term "x\<^isub>i"} is an atom\\
   $\bullet$ & @{text "(atoms x\<^isub>i) - bnds"} provided @{term "x\<^isub>i"} is a set of atoms\\
-  $\bullet$ & @{text "(atoml x\<^isub>i) - bnds"} provided @{term "x\<^isub>i"} is a list of atoms\\
+  $\bullet$ & @{text "(atoms (set x\<^isub>i)) - bnds"} provided @{term "x\<^isub>i"} is a list of atoms\\
   $\bullet$ & @{text "(fv_ty\<^isub>i x\<^isub>i) - bnds"} provided @{term "ty\<^isub>i"} is a nominal datatype\\
   $\bullet$ & @{term "{}"} otherwise 
   \end{tabular}
--- a/Paper/document/root.tex	Fri Mar 26 17:22:02 2010 +0100
+++ b/Paper/document/root.tex	Fri Mar 26 17:22:17 2010 +0100
@@ -23,6 +23,14 @@
 \renewcommand{\isasymequiv}{$\dn$}
 \renewcommand{\isasymiota}{}
 \renewcommand{\isasymemptyset}{$\varnothing$}
+\newcommand{\isasymnotapprox}{$\not\approx$}
+\newcommand{\isasymLET}{$\mathtt{let}$}
+\newcommand{\isasymAND}{$\mathtt{and}$}
+\newcommand{\isasymIN}{$\mathtt{in}$}
+\newcommand{\isasymEND}{$\mathtt{end}$}
+\newcommand{\isasymBIND}{$\mathtt{bind}$}
+\newcommand{\isasymANIL}{$\mathtt{anil}$}
+\newcommand{\isasymACONS}{$\mathtt{acons}$}
 \newcommand{\LET}{\;\mathtt{let}\;}
 \newcommand{\IN}{\;\mathtt{in}\;}
 \newcommand{\END}{\;\mathtt{end}\;}
@@ -56,8 +64,8 @@
 programming language calculi involving named bound variables (as
 opposed to de-Bruijn indices). In this paper we present an extension of
 Nominal Isabelle for dealing with general bindings, that means
-term-constructors where multiple variables are bound at once. Such binding
-structures are ubiquitous in programming language research and only very
+term-constructors where multiple variables are bound at once. Such general
+bindings are ubiquitous in programming language research and only very
 poorly supported with single binders, such as lambda-abstractions. Our
 extension includes novel definitions of alpha-equivalence and establishes
 automatically the reasoning infrastructure for alpha-equated terms. We