diff -r 163c82d039cf -r 7cbb842aa99e src/HOL/Nominal/Examples/Support.thy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/HOL/Nominal/Examples/Support.thy Mon Oct 08 05:23:47 2007 +0200 @@ -0,0 +1,124 @@ +(* $Id$ *) + +theory Support +imports "../Nominal" +begin + +text {* + + An example showing that in general + + x\(A \ B) does not imply x\A and x\B + + The example shows that with A set to the set of + even atoms and B to the set of odd even atoms. + Then A \ B, that is the set of all atoms, has + empty support. The sets A, respectively B, have + the set of all atoms as support. + +*} + +atom_decl atom + +abbreviation + EVEN :: "atom set" +where + "EVEN \ {atom n | n. \i. n=2*i}" + +abbreviation + ODD :: "atom set" +where + "ODD \ {atom n | n. \i. n=2*i+1}" + +lemma even_or_odd: + fixes n::"nat" + shows "\i. (n = 2*i) \ (n=2*i+1)" + by (induct n) (presburger)+ + +lemma EVEN_union_ODD: + shows "EVEN \ ODD = UNIV" +proof - + have "EVEN \ ODD = (\n. atom n) ` {n. \i. n = 2*i} \ (\n. atom n) ` {n. \i. n = 2*i+1}" by auto + also have "\ = (\n. atom n) ` ({n. \i. n = 2*i} \ {n. \i. n = 2*i+1})" by auto + also have "\ = (\n. atom n) ` ({n. \i. n = 2*i \ n = 2*i+1})" by auto + also have "\ = (\n. atom n) ` (UNIV::nat set)" using even_or_odd by auto + also have "\ = (UNIV::atom set)" using atom.exhaust + by (rule_tac surj_range) (auto simp add: surj_def) + finally show "EVEN \ ODD = UNIV" by simp +qed + +lemma EVEN_intersect_ODD: + shows "EVEN \ ODD = {}" + using even_or_odd + by (auto) (presburger) + +lemma UNIV_subtract: + shows "UNIV - EVEN = ODD" + and "UNIV - ODD = EVEN" + using EVEN_union_ODD EVEN_intersect_ODD + by (blast)+ + +lemma EVEN_ODD_infinite: + shows "infinite EVEN" + and "infinite ODD" +apply(simp add: infinite_iff_countable_subset) +apply(rule_tac x="\n. atom (2*n)" in exI) +apply(auto simp add: inj_on_def)[1] +apply(simp add: infinite_iff_countable_subset) +apply(rule_tac x="\n. atom (2*n+1)" in exI) +apply(auto simp add: inj_on_def) +done + +(* A set S that is infinite and coinfinite has all atoms as its support *) +lemma supp_infinite_coinfinite: + fixes S::"atom set" + assumes a: "infinite S" + and b: "infinite (UNIV-S)" + shows "(supp S) = (UNIV::atom set)" +proof - + have "\(x::atom). x\(supp S)" + proof + fix x::"atom" + show "x\(supp S)" + proof (cases "x\S") + case True + have "x\S" by fact + hence "\b\(UNIV-S). [(x,b)]\S\S" by (auto simp add: perm_set_def calc_atm) + with b have "infinite {b\(UNIV-S). [(x,b)]\S\S}" by (rule infinite_Collection) + hence "infinite {b. [(x,b)]\S\S}" by (rule_tac infinite_super, auto) + then show "x\(supp S)" by (simp add: supp_def) + next + case False + have "x\S" by fact + hence "\b\S. [(x,b)]\S\S" by (auto simp add: perm_set_def calc_atm) + with a have "infinite {b\S. [(x,b)]\S\S}" by (rule infinite_Collection) + hence "infinite {b. [(x,b)]\S\S}" by (rule_tac infinite_super, auto) + then show "x\(supp S)" by (simp add: supp_def) + qed + qed + then show "(supp S) = (UNIV::atom set)" by auto +qed + +lemma EVEN_ODD_supp: + shows "supp EVEN = (UNIV::atom set)" + and "supp ODD = (UNIV::atom set)" + using supp_infinite_coinfinite UNIV_subtract EVEN_ODD_infinite + by simp_all + +lemma UNIV_supp: + shows "supp (UNIV::atom set) = ({}::atom set)" +proof - + have "\(x::atom) (y::atom). [(x,y)]\UNIV = (UNIV::atom set)" + by (auto simp add: perm_set_def calc_atm) + then show "supp (UNIV::atom set) = ({}::atom set)" + by (simp add: supp_def) +qed + +theorem EVEN_ODD_freshness: + fixes x::"atom" + shows "x\(EVEN \ ODD)" + and "\x\EVEN" + and "\x\ODD" + by (auto simp only: fresh_def EVEN_union_ODD EVEN_ODD_supp UNIV_supp) + +end \ No newline at end of file