# HG changeset patch # User Cezary Kaliszyk # Date 1309131722 -32400 # Node ID 30af6a71cc56ebabc88931abdad33b714d9faa6a # Parent eb322a3924618b9e7052ad7e3db97c1333ee77c1# Parent 9448945a1e601ba9e5b088b302875b953a6e50a9 merge diff -r eb322a392461 -r 30af6a71cc56 Nominal/Ex/Classical_Test.thy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Nominal/Ex/Classical_Test.thy Mon Jun 27 08:42:02 2011 +0900 @@ -0,0 +1,115 @@ +theory Classical +imports "../Nominal2" +begin + +lemma supp_zero_perm_zero: + shows "supp (p :: perm) = {} \ p = 0" + by (metis supp_perm_singleton supp_zero_perm) + +lemma permute_atom_list_id: + shows "p \ l = l \ supp p \ set l = {}" + by (induct l) (auto simp add: supp_Nil supp_perm) + +lemma permute_length_eq: + shows "p \ xs = ys \ length xs = length ys" + by (auto simp add: length_eqvt[symmetric] permute_pure) + +lemma Abs_lst_binder_length: + shows "[xs]lst. T = [ys]lst. S \ length xs = length ys" + by (auto simp add: Abs_eq_iff alphas length_eqvt[symmetric] permute_pure) + +lemma Abs_lst_binder_eq: + shows "Abs_lst l T = Abs_lst l S \ T = S" + by (rule, simp_all add: Abs_eq_iff2 alphas) + (metis fresh_star_zero inf_absorb1 permute_atom_list_id supp_perm_eq + supp_zero_perm_zero) + +lemma in_permute_list: + shows "py \ p \ xs = px \ xs \ x \ set xs \ py \ p \ x = px \ x" + by (induct xs) auto + +lemma obtain_atom_list: + assumes eq: "p \ xs = ys" + and fin: "finite (supp c)" + and sorts: "map sort_of xs = map sort_of ys" + shows "\ds px py. (set ds \* c) \ (px \ xs = ds) \ (py \ ys = ds) + \ (supp px - set xs) \* c \ (supp py - set ys) \* c" + sorry + +lemma Abs_lst_fcb2: + fixes S T :: "'b :: fs" + and c::"'c::fs" + assumes e: "[xs]lst. T = [ys]lst. S" + and sorts: "map sort_of xs = map sort_of ys" + and fcb1: "\x. x \ set xs \ x \ f xs T c" + and fcb2: "\x. x \ set ys \ x \ f ys S c" + and fresh: "(set xs \ set ys) \* c" + and perm1: "\p. supp p \* c \ p \ (f xs T c) = f (p \ xs) (p \ T) c" + and perm2: "\p. supp p \* c \ p \ (f ys S c) = f (p \ ys) (p \ S) c" + shows "f xs T c = f ys S c" +proof - + have fin1: "finite (supp (f xs T c))" + apply(rule_tac S="supp (xs, T, c)" in supports_finite) + apply(simp add: supports_def) + apply(simp add: fresh_def[symmetric]) + apply(clarify) + apply(subst perm1) + apply(simp add: supp_swap fresh_star_def) + apply(simp add: swap_fresh_fresh fresh_Pair) + apply(simp add: finite_supp) + done + have fin2: "finite (supp (f ys S c))" + apply(rule_tac S="supp (ys, S, c)" in supports_finite) + apply(simp add: supports_def) + apply(simp add: fresh_def[symmetric]) + apply(clarify) + apply(subst perm2) + apply(simp add: supp_swap fresh_star_def) + apply(simp add: swap_fresh_fresh fresh_Pair) + apply(simp add: finite_supp) + done + obtain p :: perm where xs_ys: "p \ xs = ys" using e + by (auto simp add: Abs_eq_iff alphas) + obtain ds::"atom list" and px and py + where fr: "set ds \* (xs, ys, S, T, c, f xs T c, f ys S c)" + and pxd: "px \ xs = ds" and pyd: "py \ ys = ds" + and spx: "(supp px - set xs) \* (xs, ys, S, T, c, f xs T c, f ys S c)" + and spy: "(supp py - set ys) \* (xs, ys, S, T, c, f xs T c, f ys S c)" + using obtain_atom_list[OF xs_ys, of "(xs, ys, S, T, c, f xs T c, f ys S c)"] + sorts by (auto simp add: finite_supp supp_Pair fin1 fin2) + have "px \ (Abs_lst xs T) = py \ (Abs_lst ys S)" + apply (subst perm_supp_eq) + using spx apply (auto simp add: fresh_star_def Abs_fresh_iff)[1] + apply (subst perm_supp_eq) + using spy apply (auto simp add: fresh_star_def Abs_fresh_iff)[1] + by(rule e) + then have "Abs_lst ds (px \ T) = Abs_lst ds (py \ S)" by (simp add: pxd pyd) + then have eq: "px \ T = py \ S" by (simp add: Abs_lst_binder_eq) + have "f xs T c = px \ f xs T c" + apply(rule perm_supp_eq[symmetric]) + using spx unfolding fresh_star_def + apply (intro ballI) + by (case_tac "a \ set xs") (simp_all add: fcb1) + also have "... = f (px \ xs) (px \ T) c" + apply(rule perm1) + using spx fresh unfolding fresh_star_def + apply (intro ballI) + by (case_tac "a \ set xs") (simp_all add: fcb1) + also have "... = f (py \ ys) (py \ S) c" using eq pxd pyd by simp + also have "... = py \ f ys S c" + apply(rule perm2[symmetric]) + using spy fresh unfolding fresh_star_def + apply (intro ballI) + by (case_tac "a \ set ys") (simp_all add: fcb1) + also have "... = f ys S c" + apply(rule perm_supp_eq) + using spy unfolding fresh_star_def + apply (intro ballI) + by (case_tac "a \ set ys") (simp_all add: fcb2) + finally show ?thesis by simp +qed + +end + + +