diff -r c7cdea70eacd -r 869d1183e082 Nominal-General/Nominal2_Base.thy --- a/Nominal-General/Nominal2_Base.thy Sun Apr 18 18:01:22 2010 +0200 +++ b/Nominal-General/Nominal2_Base.thy Mon Apr 19 09:25:31 2010 +0200 @@ -212,8 +212,8 @@ lemma swap_cancel: "(a \ b) + (a \ b) = 0" -by (rule Rep_perm_ext) - (simp add: Rep_perm_simps expand_fun_eq) + by (rule Rep_perm_ext) + (simp add: Rep_perm_simps expand_fun_eq) lemma swap_self [simp]: "(a \ a) = 0" @@ -302,7 +302,7 @@ begin definition - "p \ a = Rep_perm p a" + "p \ a = (Rep_perm p) a" instance apply(default) @@ -351,8 +351,10 @@ end -lemma permute_self: "p \ p = p" -unfolding permute_perm_def by (simp add: diff_minus add_assoc) +lemma permute_self: + shows "p \ p = p" + unfolding permute_perm_def + by (simp add: diff_minus add_assoc) lemma permute_eqvt: shows "p \ (q \ x) = (p \ q) \ (p \ x)" @@ -392,7 +394,7 @@ lemma permute_fun_app_eq: shows "p \ (f x) = (p \ f) (p \ x)" -unfolding permute_fun_def by simp + unfolding permute_fun_def by simp subsection {* Permutations for booleans *} @@ -429,29 +431,33 @@ fixes x::"'a::pt" and p::"perm" shows "(p \ X) = {p \ x | x. x \ X}" - apply(auto simp add: permute_fun_def permute_bool_def mem_def) + unfolding permute_fun_def + unfolding permute_bool_def + apply(auto simp add: mem_def) apply(rule_tac x="- p \ x" in exI) apply(simp) done lemma permute_set_eq_image: shows "p \ X = permute p ` X" -unfolding permute_set_eq by auto + unfolding permute_set_eq by auto lemma permute_set_eq_vimage: shows "p \ X = permute (- p) -` X" -unfolding permute_fun_def permute_bool_def -unfolding vimage_def Collect_def mem_def .. + unfolding permute_fun_def permute_bool_def + unfolding vimage_def Collect_def mem_def .. lemma swap_set_not_in: assumes a: "a \ S" "b \ S" shows "(a \ b) \ S = S" - using a by (auto simp add: permute_set_eq swap_atom) + unfolding permute_set_eq + using a by (auto simp add: swap_atom) lemma swap_set_in: assumes a: "a \ S" "b \ S" "sort_of a = sort_of b" shows "(a \ b) \ S \ S" - using a by (auto simp add: permute_set_eq swap_atom) + unfolding permute_set_eq + using a by (auto simp add: swap_atom) subsection {* Permutations for units *} @@ -461,8 +467,8 @@ definition "p \ (u::unit) = u" -instance proof -qed (simp_all add: permute_unit_def) +instance +by (default) (simp_all add: permute_unit_def) end @@ -493,8 +499,8 @@ "p \ (Inl x) = Inl (p \ x)" | "p \ (Inr y) = Inr (p \ y)" -instance proof -qed (case_tac [!] x, simp_all) +instance +by (default) (case_tac [!] x, simp_all) end @@ -509,8 +515,8 @@ "p \ [] = []" | "p \ (x # xs) = p \ x # p \ xs" -instance proof -qed (induct_tac [!] x, simp_all) +instance +by (default) (induct_tac [!] x, simp_all) end @@ -525,8 +531,8 @@ "p \ None = None" | "p \ (Some x) = Some (p \ x)" -instance proof -qed (induct_tac [!] x, simp_all) +instance +by (default) (induct_tac [!] x, simp_all) end @@ -537,8 +543,8 @@ definition "p \ (c::char) = c" -instance proof -qed (simp_all add: permute_char_def) +instance +by (default) (simp_all add: permute_char_def) end @@ -547,8 +553,8 @@ definition "p \ (n::nat) = n" -instance proof -qed (simp_all add: permute_nat_def) +instance +by (default) (simp_all add: permute_nat_def) end @@ -557,8 +563,8 @@ definition "p \ (i::int) = i" -instance proof -qed (simp_all add: permute_int_def) +instance +by (default) (simp_all add: permute_int_def) end @@ -679,26 +685,28 @@ have "(p \ a) \ (p \ x) \ finite {b. (p \ a \ b) \ p \ x \ p \ x}" unfolding fresh_def supp_def by simp also have "\ \ finite {b. (p \ a \ p \ b) \ p \ x \ p \ x}" - using bij_permute by (rule finite_Collect_bij [symmetric]) + using bij_permute by (rule finite_Collect_bij[symmetric]) also have "\ \ finite {b. p \ (a \ b) \ x \ p \ x}" by (simp only: permute_eqvt [of p] swap_eqvt) also have "\ \ finite {b. (a \ b) \ x \ x}" by (simp only: permute_eq_iff) also have "\ \ a \ x" unfolding fresh_def supp_def by simp - finally show ?thesis . + finally show "(p \ a) \ (p \ x) \ a \ x" . qed lemma fresh_eqvt: shows "p \ (a \ x) = (p \ a) \ (p \ x)" - by (simp add: permute_bool_def fresh_permute_iff) + unfolding permute_bool_def + by (simp add: fresh_permute_iff) lemma supp_eqvt: fixes p :: "perm" and x :: "'a::pt" shows "p \ (supp x) = supp (p \ x)" unfolding supp_conv_fresh - unfolding permute_fun_def Collect_def + unfolding Collect_def + unfolding permute_fun_def by (simp add: Not_eqvt fresh_eqvt) subsection {* supports *} @@ -715,10 +723,10 @@ and a2: "finite S" shows "(supp x) \ S" proof (rule ccontr) - assume "\(supp x \ S)" + assume "\ (supp x \ S)" then obtain a where b1: "a \ supp x" and b2: "a \ S" by auto - from a1 b2 have "\b. b \ S \ (a \ b) \ x = x" by (unfold supports_def) (auto) - hence "{b. (a \ b) \ x \ x} \ S" by auto + from a1 b2 have "\b. b \ S \ (a \ b) \ x = x" unfolding supports_def by auto + then have "{b. (a \ b) \ x \ x} \ S" by auto with a2 have "finite {b. (a \ b)\x \ x}" by (simp add: finite_subset) then have "a \ (supp x)" unfolding supp_def by simp with b1 show False by simp @@ -738,11 +746,12 @@ lemma supp_supports: fixes x :: "'a::pt" shows "(supp x) supports x" -proof (unfold supports_def, intro strip) +unfolding supports_def +proof (intro strip) fix a b assume "a \ (supp x) \ b \ (supp x)" then have "a \ x" and "b \ x" by (simp_all add: fresh_def) - then show "(a \ b) \ x = x" by (rule swap_fresh_fresh) + then show "(a \ b) \ x = x" by (simp add: swap_fresh_fresh) qed lemma supp_is_least_supports: @@ -837,7 +846,8 @@ lemma supports_perm: shows "{a. p \ a \ a} supports p" unfolding supports_def - by (simp add: perm_swap_eq swap_eqvt) + unfolding perm_swap_eq + by (simp add: swap_eqvt) lemma finite_perm_lemma: shows "finite {a::atom. p \ a \ a}" @@ -855,7 +865,8 @@ lemma fresh_perm: shows "a \ p \ p \ a = a" -unfolding fresh_def by (simp add: supp_perm) + unfolding fresh_def + by (simp add: supp_perm) lemma supp_swap: shows "supp (a \ b) = (if a = b \ sort_of a \ sort_of b then {} else {a, b})" @@ -886,8 +897,9 @@ fixes p::perm shows "a \ (- p) \ a \ p" unfolding fresh_def - apply(auto simp add: supp_perm) - apply(metis permute_minus_cancel)+ + unfolding supp_perm + apply(simp) + apply(metis permute_minus_cancel) done lemma supp_minus_perm: @@ -901,7 +913,7 @@ lemma plus_perm_eq: fixes p q::"perm" - assumes asm: "supp p \ supp q = {}" + assumes asm: "supp p \ supp q = {}" shows "p + q = q + p" unfolding expand_perm_eq proof @@ -1023,8 +1035,28 @@ section {* Support and freshness for applications *} +lemma fresh_conv_MOST: + shows "a \ x \ (MOST b. (a \ b) \ x = x)" + unfolding fresh_def supp_def + unfolding MOST_iff_cofinite by simp + +lemma fresh_fun_app: + assumes "a \ f" and "a \ x" + shows "a \ f x" + using assms + unfolding fresh_conv_MOST + unfolding permute_fun_app_eq + by (elim MOST_rev_mp, simp) + lemma supp_fun_app: shows "supp (f x) \ (supp f) \ (supp x)" + using fresh_fun_app + unfolding fresh_def + by auto + +(* alternative proof *) +lemma + shows "supp (f x) \ (supp f) \ (supp x)" proof (rule subsetCI) fix a::"atom" assume a: "a \ supp (f x)" @@ -1042,25 +1074,19 @@ with a show "False" by simp qed -lemma fresh_fun_app: - shows "a \ (f, x) \ a \ f x" -unfolding fresh_def -using supp_fun_app -by (auto simp add: supp_Pair) - lemma fresh_fun_eqvt_app: assumes a: "\p. p \ f = f" shows "a \ x \ a \ f x" proof - - from a have b: "supp f = {}" + from a have "supp f = {}" unfolding supp_def by simp - show "a \ x \ a \ f x" + then show "a \ x \ a \ f x" unfolding fresh_def - using supp_fun_app b + using supp_fun_app by auto qed -(* nominal infrastructure *) +section {* library functions for the nominal infrastructure *} use "nominal_library.ML" end