# HG changeset patch # User immler # Date 1360769707 -3600 # Node ID 5746e671ea70b30a52428edfeda5b974fe132e24 # Parent a27fcd14c3846d7dbd725484176de447b02a657a eliminated union_closed_basis; cleanup Fin_Map diff -r a27fcd14c384 -r 5746e671ea70 src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy --- a/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy Wed Feb 13 16:35:07 2013 +0100 +++ b/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy Wed Feb 13 16:35:07 2013 +0100 @@ -170,99 +170,6 @@ where "countable D" "\X. open X \ X \ {} \ \d \ D. d \ X" using countable_dense_exists by blast -text {* Construction of an increasing sequence approximating open sets, - therefore basis which is closed under union. *} - -definition union_closed_basis::"'a set set" where - "union_closed_basis = (\l. \set l) ` lists B" - -lemma basis_union_closed_basis: "topological_basis union_closed_basis" -proof (rule topological_basisI) - fix O' and x::'a assume "open O'" "x \ O'" - from topological_basisE[OF is_basis this] guess B' . note B' = this - thus "\B'\union_closed_basis. x \ B' \ B' \ O'" unfolding union_closed_basis_def - by (auto intro!: bexI[where x="[B']"]) -next - fix B' assume "B' \ union_closed_basis" - thus "open B'" - using topological_basis_open[OF is_basis] - by (auto simp: union_closed_basis_def) -qed - -lemma countable_union_closed_basis: "countable union_closed_basis" - unfolding union_closed_basis_def using countable_basis by simp - -lemmas open_union_closed_basis = topological_basis_open[OF basis_union_closed_basis] - -lemma union_closed_basis_ex: - assumes X: "X \ union_closed_basis" - shows "\B'. finite B' \ X = \B' \ B' \ B" -proof - - from X obtain l where "\x. x\set l \ x\B" "X = \set l" by (auto simp: union_closed_basis_def) - thus ?thesis by auto -qed - -lemma union_closed_basisE: - assumes "X \ union_closed_basis" - obtains B' where "finite B'" "X = \B'" "B' \ B" using union_closed_basis_ex[OF assms] by blast - -lemma union_closed_basisI: - assumes "finite B'" "X = \B'" "B' \ B" - shows "X \ union_closed_basis" -proof - - from finite_list[OF `finite B'`] guess l .. - thus ?thesis using assms unfolding union_closed_basis_def by (auto intro!: image_eqI[where x=l]) -qed - -lemma empty_basisI[intro]: "{} \ union_closed_basis" - by (rule union_closed_basisI[of "{}"]) auto - -lemma union_basisI[intro]: - assumes "X \ union_closed_basis" "Y \ union_closed_basis" - shows "X \ Y \ union_closed_basis" - using assms by (auto intro: union_closed_basisI elim!:union_closed_basisE) - -lemma open_imp_Union_of_incseq: - assumes "open X" - shows "\S. incseq S \ (\j. S j) = X \ range S \ union_closed_basis" -proof - - from open_countable_basis_ex[OF `open X`] - obtain B' where B': "B'\B" "X = \B'" by auto - from this(1) countable_basis have "countable B'" by (rule countable_subset) - show ?thesis - proof cases - assume "B' \ {}" - def S \ "\n. \i\{0..n}. from_nat_into B' i" - have S:"\n. S n = \{from_nat_into B' i|i. i\{0..n}}" unfolding S_def by force - have "incseq S" by (force simp: S_def incseq_Suc_iff) - moreover - have "(\j. S j) = X" unfolding B' - proof safe - fix x X assume "X \ B'" "x \ X" - then obtain n where "X = from_nat_into B' n" - by (metis `countable B'` from_nat_into_surj) - also have "\ \ S n" by (auto simp: S_def) - finally show "x \ (\j. S j)" using `x \ X` by auto - next - fix x n - assume "x \ S n" - also have "\ = (\i\{0..n}. from_nat_into B' i)" - by (simp add: S_def) - also have "\ \ (\i. from_nat_into B' i)" by auto - also have "\ \ \B'" using `B' \ {}` by (auto intro: from_nat_into) - finally show "x \ \B'" . - qed - moreover have "range S \ union_closed_basis" using B' - by (auto intro!: union_closed_basisI[OF _ S] simp: from_nat_into `B' \ {}`) - ultimately show ?thesis by auto - qed (auto simp: B') -qed - -lemma open_incseqE: - assumes "open X" - obtains S where "incseq S" "(\j. S j) = X" "range S \ union_closed_basis" - using open_imp_Union_of_incseq assms by atomize_elim - end class first_countable_topology = topological_space + diff -r a27fcd14c384 -r 5746e671ea70 src/HOL/Probability/Borel_Space.thy --- a/src/HOL/Probability/Borel_Space.thy Wed Feb 13 16:35:07 2013 +0100 +++ b/src/HOL/Probability/Borel_Space.thy Wed Feb 13 16:35:07 2013 +0100 @@ -149,10 +149,6 @@ thus "b \ sigma_sets UNIV (Collect open)" by auto qed simp_all -lemma borel_eq_union_closed_basis: - "borel = sigma UNIV union_closed_basis" - by (rule borel_eq_countable_basis[OF countable_union_closed_basis basis_union_closed_basis]) - lemma borel_measurable_Pair[measurable (raw)]: fixes f :: "'a \ 'b::second_countable_topology" and g :: "'a \ 'c::second_countable_topology" assumes f[measurable]: "f \ borel_measurable M" diff -r a27fcd14c384 -r 5746e671ea70 src/HOL/Probability/Fin_Map.thy --- a/src/HOL/Probability/Fin_Map.thy Wed Feb 13 16:35:07 2013 +0100 +++ b/src/HOL/Probability/Fin_Map.thy Wed Feb 13 16:35:07 2013 +0100 @@ -93,17 +93,6 @@ show "x = y" using assms by (simp add: extensional_restrict) qed -lemma finmap_choice: - assumes *: "\i. i \ I \ \x. P i x" and I: "finite I" - shows "\fm. domain fm = I \ (\i\I. P i (fm i))" -proof - - have "\f. \i\I. P i (f i)" - unfolding bchoice_iff[symmetric] using * by auto - then guess f .. - with I show ?thesis - by (intro exI[of _ "finmap_of I f"]) auto -qed - subsection {* Product set of Finite Maps *} text {* This is @{term Pi} for Finite Maps, most of this is copied *} @@ -532,40 +521,50 @@ instantiation finmap :: (countable, second_countable_topology) second_countable_topology begin +definition basis_proj::"'b set set" + where "basis_proj = (SOME B. countable B \ topological_basis B)" + +lemma countable_basis_proj: "countable basis_proj" and basis_proj: "topological_basis basis_proj" + unfolding basis_proj_def by (intro is_basis countable_basis)+ + definition basis_finmap::"('a \\<^isub>F 'b) set set" - where "basis_finmap = {Pi' I S|I S. finite I \ (\i \ I. S i \ union_closed_basis)}" + where "basis_finmap = {Pi' I S|I S. finite I \ (\i \ I. S i \ basis_proj)}" lemma in_basis_finmapI: - assumes "finite I" assumes "\i. i \ I \ S i \ union_closed_basis" + assumes "finite I" assumes "\i. i \ I \ S i \ basis_proj" shows "Pi' I S \ basis_finmap" using assms unfolding basis_finmap_def by auto -lemma in_basis_finmapE: - assumes "x \ basis_finmap" - obtains I S where "x = Pi' I S" "finite I" "\i. i \ I \ S i \ union_closed_basis" - using assms unfolding basis_finmap_def by auto - lemma basis_finmap_eq: - "basis_finmap = (\f. Pi' (domain f) (\i. from_nat_into union_closed_basis ((f)\<^isub>F i))) ` + assumes "basis_proj \ {}" + shows "basis_finmap = (\f. Pi' (domain f) (\i. from_nat_into basis_proj ((f)\<^isub>F i))) ` (UNIV::('a \\<^isub>F nat) set)" (is "_ = ?f ` _") unfolding basis_finmap_def proof safe fix I::"'a set" and S::"'a \ 'b set" - assume "finite I" "\i\I. S i \ union_closed_basis" - hence "Pi' I S = ?f (finmap_of I (\x. to_nat_on union_closed_basis (S x)))" - by (force simp: Pi'_def countable_union_closed_basis) + assume "finite I" "\i\I. S i \ basis_proj" + hence "Pi' I S = ?f (finmap_of I (\x. to_nat_on basis_proj (S x)))" + by (force simp: Pi'_def countable_basis_proj) thus "Pi' I S \ range ?f" by simp -qed (metis (mono_tags) empty_basisI equals0D finite_domain from_nat_into) +next + fix x and f::"'a \\<^isub>F nat" + show "\I S. (\' i\domain f. from_nat_into local.basis_proj ((f)\<^isub>F i)) = Pi' I S \ + finite I \ (\i\I. S i \ local.basis_proj)" + using assms by (auto intro: from_nat_into) +qed + +lemma basis_finmap_eq_empty: "basis_proj = {} \ basis_finmap = {Pi' {} undefined}" + by (auto simp: Pi'_iff basis_finmap_def) lemma countable_basis_finmap: "countable basis_finmap" - unfolding basis_finmap_eq by simp + by (cases "basis_proj = {}") (auto simp: basis_finmap_eq basis_finmap_eq_empty) lemma finmap_topological_basis: "topological_basis basis_finmap" proof (subst topological_basis_iff, safe) fix B' assume "B' \ basis_finmap" thus "open B'" - by (auto intro!: open_Pi'I topological_basis_open[OF basis_union_closed_basis] + by (auto intro!: open_Pi'I topological_basis_open[OF basis_proj] simp: topological_basis_def basis_finmap_def Let_def) next fix O'::"('a \\<^isub>F 'b) set" and x @@ -586,12 +585,12 @@ thus ?case by blast qed (auto simp: Pi'_def) have "\B. - (\i\domain x. x i \ B i \ B i \ a i \ B i \ union_closed_basis)" + (\i\domain x. x i \ B i \ B i \ a i \ B i \ basis_proj)" proof (rule bchoice, safe) fix i assume "i \ domain x" hence "open (a i)" "x i \ a i" using a by auto - from topological_basisE[OF basis_union_closed_basis this] guess b' . - thus "\y. x i \ y \ y \ a i \ y \ union_closed_basis" by auto + from topological_basisE[OF basis_proj this] guess b' . + thus "\y. x i \ y \ y \ a i \ y \ basis_proj" by auto qed then guess B .. note B = this def B' \ "Pi' (domain x) (\i. (B i)::'b set)" @@ -1017,9 +1016,8 @@ text {* adapted from @{thm sigma_prod_algebra_sigma_eq} *} lemma sigma_fprod_algebra_sigma_eq: - fixes E :: "'i \ 'a set set" + fixes E :: "'i \ 'a set set" and S :: "'i \ nat \ 'a set" assumes [simp]: "finite I" "I \ {}" - assumes S_mono: "\i. i \ I \ incseq (S i)" and S_union: "\i. i \ I \ (\j. S i j) = space (M i)" and S_in_E: "\i. i \ I \ range (S i) \ E i" assumes E_closed: "\i. i \ I \ E i \ Pow (space (M i))" @@ -1028,6 +1026,9 @@ shows "sets (PiF {I} M) = sigma_sets (space (PiF {I} M)) P" proof let ?P = "sigma (space (Pi\<^isub>F {I} M)) P" + from `finite I`[THEN ex_bij_betw_finite_nat] guess T .. + then have T: "\i. i \ I \ T i < card I" "\i. i\I \ the_inv_into I T (T i) = i" + by (auto simp add: bij_betw_def set_eq_iff image_iff the_inv_into_f_f simp del: `finite I`) have P_closed: "P \ Pow (space (Pi\<^isub>F {I} M))" using E_closed by (auto simp: space_PiF P_def Pi'_iff subset_eq) then have space_P: "space ?P = (\' i\I. space (M i))" @@ -1050,15 +1051,20 @@ using E_closed `i \ I` by (auto simp: space_P Pi_iff subset_eq split: split_if_asm) also have "\ = (\' j\I. \n. if i = j then A else S j n)" by (intro Pi'_cong) (simp_all add: S_union) - also have "\ = (\n. \' j\I. if i = j then A else S j n)" - using S_mono - by (subst Pi'_UN[symmetric, OF `finite I`]) (auto simp: incseq_def) + also have "\ = (\xs\{xs. length xs = card I}. \' j\I. if i = j then A else S j (xs ! T j))" + using T + apply auto + apply (simp_all add: Pi'_iff bchoice_iff) + apply (erule conjE exE)+ + apply (rule_tac x="map (\n. f (the_inv_into I T n)) [0.. \ sets ?P" proof (safe intro!: sets.countable_UN) - fix n show "(\' j\I. if i = j then A else S j n) \ sets ?P" + fix xs show "(\' j\I. if i = j then A else S j (xs ! T j)) \ sets ?P" using A S_in_E by (simp add: P_closed) - (auto simp: P_def subset_eq intro!: exI[of _ "\j. if i = j then A else S j n"]) + (auto simp: P_def subset_eq intro!: exI[of _ "\j. if i = j then A else S j (xs ! T j)"]) qed finally show "(\x. (x)\<^isub>F i) -` A \ space ?P \ sets ?P" using P_closed by simp @@ -1078,76 +1084,28 @@ by (auto intro!: sets.sigma_sets_subset product_in_sets_PiFI simp: E_generates P_def) qed -lemma sets_PiF_eq_sigma_union_closed_basis_single: - assumes "I \ {}" - assumes [simp]: "finite I" - shows "sets (PiF {I} (\_. borel)) = sigma_sets (space (PiF {I} (\_. borel))) - {Pi' I F |F. (\i\I. F i \ union_closed_basis)}" -proof - - from open_incseqE[OF open_UNIV] guess S::"nat \ 'b set" . note S = this - show ?thesis - proof (rule sigma_fprod_algebra_sigma_eq) - show "finite I" by simp - show "I \ {}" by fact - show "incseq S" "(\j. S j) = space borel" "range S \ union_closed_basis" - using S by simp_all - show "union_closed_basis \ Pow (space borel)" by simp - show "sets borel = sigma_sets (space borel) union_closed_basis" - by (simp add: borel_eq_union_closed_basis) - qed -qed - -text {* adapted from @{thm sets_PiF_eq_sigma_union_closed_basis_single} *} - -lemma sets_PiM_eq_sigma_union_closed_basis: - assumes "I \ {}" - assumes [simp]: "finite I" - shows "sets (PiM I (\_. borel)) = sigma_sets (space (PiM I (\_. borel))) - {Pi\<^isub>E I F |F. \i\I. F i \ union_closed_basis}" -proof - - from open_incseqE[OF open_UNIV] guess S::"nat \ 'b set" . note S = this - show ?thesis - proof (rule sigma_prod_algebra_sigma_eq) - show "finite I" by simp note[[show_types]] - fix i show "(\j. S j) = space borel" "range S \ union_closed_basis" - using S by simp_all - show "union_closed_basis \ Pow (space borel)" by simp - show "sets borel = sigma_sets (space borel) union_closed_basis" - by (simp add: borel_eq_union_closed_basis) - qed -qed - lemma product_open_generates_sets_PiF_single: assumes "I \ {}" assumes [simp]: "finite I" shows "sets (PiF {I} (\_. borel::'b::second_countable_topology measure)) = sigma_sets (space (PiF {I} (\_. borel))) {Pi' I F |F. (\i\I. F i \ Collect open)}" proof - - from open_incseqE[OF open_UNIV] guess S::"nat \ 'b set" . note S = this + from open_countable_basisE[OF open_UNIV] guess S::"'b set set" . note S = this show ?thesis proof (rule sigma_fprod_algebra_sigma_eq) show "finite I" by simp show "I \ {}" by fact - show "incseq S" "(\j. S j) = space borel" "range S \ Collect open" - using S by (auto simp: open_union_closed_basis) - show "Collect open \ Pow (space borel)" by simp - show "sets borel = sigma_sets (space borel) (Collect open)" - by (simp add: borel_def) - qed -qed - -lemma product_open_generates_sets_PiM: - assumes "I \ {}" - assumes [simp]: "finite I" - shows "sets (PiM I (\_. borel::'b::second_countable_topology measure)) = - sigma_sets (space (PiM I (\_. borel))) {Pi\<^isub>E I F |F. \i\I. F i \ Collect open}" -proof - - from open_incseqE[OF open_UNIV] guess S::"nat \ 'b set" . note S = this - show ?thesis - proof (rule sigma_prod_algebra_sigma_eq) - show "finite I" by simp note[[show_types]] - fix i show "(\j. S j) = space borel" "range S \ Collect open" - using S by (auto simp: open_union_closed_basis) + def S'\"from_nat_into S" + show "(\j. S' j) = space borel" + using S + apply (auto simp add: from_nat_into countable_basis_proj S'_def basis_proj_def) + apply (metis (lifting, mono_tags) UNIV_I UnionE basis_proj_def countable_basis_proj countable_subset from_nat_into_surj) + done + show "range S' \ Collect open" + using S + apply (auto simp add: from_nat_into countable_basis_proj S'_def) + apply (metis UNIV_not_empty Union_empty from_nat_into set_mp topological_basis_open[OF basis_proj] basis_proj_def) + done show "Collect open \ Pow (space borel)" by simp show "sets borel = sigma_sets (space borel) (Collect open)" by (simp add: borel_def) @@ -1174,7 +1132,7 @@ proof fix x assume "x \ B'" with B' have "x \ basis_finmap" by auto then obtain J X where "x = Pi' J X" "finite J" "X \ J \ sigma_sets UNIV (Collect open)" - by (auto simp: basis_finmap_def open_union_closed_basis) + by (auto simp: basis_finmap_def topological_basis_open[OF basis_proj]) thus "x \ sets ?s" by auto qed qed