# HG changeset patch # User Christian Urban # Date 1271846239 -7200 # Node ID e2e963f4e90dbcfed491dfc6a2a8f97340b9bda3 # Parent 39951d71bfceb3640b8908f74d8887ffa3f73bd1 added an improved version of the induction principle for permutations diff -r 39951d71bfce -r e2e963f4e90d Nominal-General/Nominal2_Supp.thy --- a/Nominal-General/Nominal2_Supp.thy Wed Apr 21 10:09:07 2010 +0200 +++ b/Nominal-General/Nominal2_Supp.thy Wed Apr 21 12:37:19 2010 +0200 @@ -392,15 +392,16 @@ text {* Induction principle for permutations *} -lemma perm_subset_induct_aux [consumes 1, case_names zero swap plus]: + +lemma perm_struct_induct[consumes 1, case_names zero swap]: assumes S: "supp p \ S" assumes zero: "P 0" - assumes swap: "\a b. supp (a \ b) \ S \ P (a \ b)" - assumes plus: "\p1 p2. \P p1; P p2; supp p1 \ S; supp p2 \ S\ \ P (p1 + p2)" + assumes swap: "\p a b. \P p; supp p \ S; a \ S; b \ S; a \ b; sort_of a = sort_of b\ + \ P ((a \ b) + p)" shows "P p" proof - have "finite (supp p)" by (simp add: finite_supp) - then show ?thesis using S + then show "P p" using S proof(induct A\"supp p" arbitrary: p rule: finite_psubset_induct) case (psubset p) then have ih: "\q. supp q \ supp p \ P q" by auto @@ -412,23 +413,20 @@ moreover { assume "supp p \ {}" then obtain a where a0: "a \ supp p" by blast - then have a1: "supp (- p \ a \ a) \ S" using as + then have a1: "p \ a \ S" "a \ S" "sort_of (p \ a) = sort_of a" "p \ a \ a" using as by (auto simp add: supp_atom supp_perm swap_atom) - let ?q = "p + (- p \ a \ a)" + let ?q = "(p \ a \ a) + p" have a2: "supp ?q \ supp p" unfolding supp_perm by (auto simp add: swap_atom) moreover have "a \ supp ?q" by (simp add: supp_perm) then have "supp ?q \ supp p" using a0 by auto - ultimately have "supp ?q \ supp p" using as by auto + ultimately have "supp ?q \ supp p" using a2 by auto then have "P ?q" using ih by simp moreover have "supp ?q \ S" using as a2 by simp - moreover - have "P (- p \ a \ a)" using a1 swap by simp - ultimately - have "P (?q + (- p \ a \ a))" using a1 plus by simp + ultimately have "P ((p \ a \ a) + ?q)" using as a1 swap by simp moreover - have "p = ?q + (- p \ a \ a)" by (simp add: expand_perm_eq) + have "p = (p \ a \ a) + ?q" by (simp add: expand_perm_eq) ultimately have "P p" by simp } ultimately show "P p" by blast @@ -441,9 +439,9 @@ assumes swap: "\a b. \sort_of a = sort_of b; a \ b; a \ S; b \ S\ \ P (a \ b)" assumes plus: "\p1 p2. \P p1; P p2; supp p1 \ S; supp p2 \ S\ \ P (p1 + p2)" shows "P p" -apply(rule perm_subset_induct_aux[OF S]) -apply(auto simp add: zero swap plus supp_swap split: if_splits) -done +using S +by (induct p rule: perm_struct_induct) + (auto intro: zero plus swap simp add: supp_swap) lemma supp_perm_eq: assumes "(supp x) \* p" @@ -452,6 +450,23 @@ from assms have "supp p \ {a. a \ x}" unfolding supp_perm fresh_star_def fresh_def by auto then show "p \ x = x" + proof (induct p rule: perm_struct_induct) + case zero + show "0 \ x = x" by simp + next + case (swap p a b) + then have "a \ x" "b \ x" "p \ x = x" by simp_all + then show "((a \ b) + p) \ x = x" by (simp add: swap_fresh_fresh) + qed +qed + +lemma supp_perm_eq_test: + assumes "(supp x) \* p" + shows "p \ x = x" +proof - + from assms have "supp p \ {a. a \ x}" + unfolding supp_perm fresh_star_def fresh_def by auto + then show "p \ x = x" proof (induct p rule: perm_subset_induct) case zero show "0 \ x = x" by simp