| author | paulson <lp15@cam.ac.uk> | 
| Wed, 09 Dec 2015 17:35:22 +0000 | |
| changeset 61810 | 3c5040d5694a | 
| parent 61808 | fc1556774cfe | 
| child 61969 | e01015e49041 | 
| permissions | -rw-r--r-- | 
| 50091 | 1 | (* Title: HOL/Probability/Fin_Map.thy | 
| 50088 | 2 | Author: Fabian Immler, TU München | 
| 3 | *) | |
| 4 | ||
| 61808 | 5 | section \<open>Finite Maps\<close> | 
| 50091 | 6 | |
| 50088 | 7 | theory Fin_Map | 
| 8 | imports Finite_Product_Measure | |
| 9 | begin | |
| 10 | ||
| 61808 | 11 | text \<open>Auxiliary type that is instantiated to @{class polish_space}, needed for the proof of
 | 
| 50088 | 12 |   projective limit. @{const extensional} functions are used for the representation in order to
 | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 13 |   stay close to the developments of (finite) products @{const Pi\<^sub>E} and their sigma-algebra
 | 
| 61808 | 14 |   @{const Pi\<^sub>M}.\<close>
 | 
| 50088 | 15 | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 16 | typedef ('i, 'a) finmap ("(_ \<Rightarrow>\<^sub>F /_)" [22, 21] 21) =
 | 
| 50088 | 17 |   "{(I::'i set, f::'i \<Rightarrow> 'a). finite I \<and> f \<in> extensional I}" by auto
 | 
| 18 | ||
| 61808 | 19 | subsection \<open>Domain and Application\<close> | 
| 50088 | 20 | |
| 21 | definition domain where "domain P = fst (Rep_finmap P)" | |
| 22 | ||
| 23 | lemma finite_domain[simp, intro]: "finite (domain P)" | |
| 24 | by (cases P) (auto simp: domain_def Abs_finmap_inverse) | |
| 25 | ||
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 26 | definition proj ("'((_)')\<^sub>F" [0] 1000) where "proj P i = snd (Rep_finmap P) i"
 | 
| 50088 | 27 | |
| 28 | declare [[coercion proj]] | |
| 29 | ||
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 30 | lemma extensional_proj[simp, intro]: "(P)\<^sub>F \<in> extensional (domain P)" | 
| 50088 | 31 | by (cases P) (auto simp: domain_def Abs_finmap_inverse proj_def[abs_def]) | 
| 32 | ||
| 33 | lemma proj_undefined[simp, intro]: "i \<notin> domain P \<Longrightarrow> P i = undefined" | |
| 34 | using extensional_proj[of P] unfolding extensional_def by auto | |
| 35 | ||
| 36 | lemma finmap_eq_iff: "P = Q \<longleftrightarrow> (domain P = domain Q \<and> (\<forall>i\<in>domain P. P i = Q i))" | |
| 37 | by (cases P, cases Q) | |
| 38 | (auto simp add: Abs_finmap_inject extensional_def domain_def proj_def Abs_finmap_inverse | |
| 39 | intro: extensionalityI) | |
| 40 | ||
| 61808 | 41 | subsection \<open>Countable Finite Maps\<close> | 
| 50088 | 42 | |
| 43 | instance finmap :: (countable, countable) countable | |
| 44 | proof | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 45 | obtain mapper where mapper: "\<And>fm :: 'a \<Rightarrow>\<^sub>F 'b. set (mapper fm) = domain fm" | 
| 50088 | 46 | by (metis finite_list[OF finite_domain]) | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 47 | have "inj (\<lambda>fm. map (\<lambda>i. (i, (fm)\<^sub>F i)) (mapper fm))" (is "inj ?F") | 
| 50088 | 48 | proof (rule inj_onI) | 
| 49 | fix f1 f2 assume "?F f1 = ?F f2" | |
| 50 | then have "map fst (?F f1) = map fst (?F f2)" by simp | |
| 51 | then have "mapper f1 = mapper f2" by (simp add: comp_def) | |
| 52 | then have "domain f1 = domain f2" by (simp add: mapper[symmetric]) | |
| 61808 | 53 | with \<open>?F f1 = ?F f2\<close> show "f1 = f2" | 
| 54 | unfolding \<open>mapper f1 = mapper f2\<close> map_eq_conv mapper | |
| 50088 | 55 | by (simp add: finmap_eq_iff) | 
| 56 | qed | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 57 | then show "\<exists>to_nat :: 'a \<Rightarrow>\<^sub>F 'b \<Rightarrow> nat. inj to_nat" | 
| 50088 | 58 | by (intro exI[of _ "to_nat \<circ> ?F"] inj_comp) auto | 
| 59 | qed | |
| 60 | ||
| 61808 | 61 | subsection \<open>Constructor of Finite Maps\<close> | 
| 50088 | 62 | |
| 63 | definition "finmap_of inds f = Abs_finmap (inds, restrict f inds)" | |
| 64 | ||
| 65 | lemma proj_finmap_of[simp]: | |
| 66 | assumes "finite inds" | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 67 | shows "(finmap_of inds f)\<^sub>F = restrict f inds" | 
| 50088 | 68 | using assms | 
| 69 | by (auto simp: Abs_finmap_inverse finmap_of_def proj_def) | |
| 70 | ||
| 71 | lemma domain_finmap_of[simp]: | |
| 72 | assumes "finite inds" | |
| 73 | shows "domain (finmap_of inds f) = inds" | |
| 74 | using assms | |
| 75 | by (auto simp: Abs_finmap_inverse finmap_of_def domain_def) | |
| 76 | ||
| 77 | lemma finmap_of_eq_iff[simp]: | |
| 78 | assumes "finite i" "finite j" | |
| 51104 | 79 | shows "finmap_of i m = finmap_of j n \<longleftrightarrow> i = j \<and> (\<forall>k\<in>i. m k= n k)" | 
| 80 | using assms by (auto simp: finmap_eq_iff) | |
| 50088 | 81 | |
| 50124 | 82 | lemma finmap_of_inj_on_extensional_finite: | 
| 50088 | 83 | assumes "finite K" | 
| 84 | assumes "S \<subseteq> extensional K" | |
| 85 | shows "inj_on (finmap_of K) S" | |
| 86 | proof (rule inj_onI) | |
| 87 | fix x y::"'a \<Rightarrow> 'b" | |
| 88 | assume "finmap_of K x = finmap_of K y" | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 89 | hence "(finmap_of K x)\<^sub>F = (finmap_of K y)\<^sub>F" by simp | 
| 50088 | 90 | moreover | 
| 91 | assume "x \<in> S" "y \<in> S" hence "x \<in> extensional K" "y \<in> extensional K" using assms by auto | |
| 92 | ultimately | |
| 93 | show "x = y" using assms by (simp add: extensional_restrict) | |
| 94 | qed | |
| 95 | ||
| 61808 | 96 | subsection \<open>Product set of Finite Maps\<close> | 
| 50088 | 97 | |
| 61808 | 98 | text \<open>This is @{term Pi} for Finite Maps, most of this is copied\<close>
 | 
| 50088 | 99 | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 100 | definition Pi' :: "'i set \<Rightarrow> ('i \<Rightarrow> 'a set) \<Rightarrow> ('i \<Rightarrow>\<^sub>F 'a) set" where
 | 
| 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 101 |   "Pi' I A = { P. domain P = I \<and> (\<forall>i. i \<in> I \<longrightarrow> (P)\<^sub>F i \<in> A i) } "
 | 
| 50088 | 102 | |
| 103 | syntax | |
| 104 |   "_Pi'"  :: "[pttrn, 'a set, 'b set] => ('a => 'b) set"  ("(3PI' _:_./ _)" 10)
 | |
| 105 | syntax (xsymbols) | |
| 106 |   "_Pi'" :: "[pttrn, 'a set, 'b set] => ('a => 'b) set"  ("(3\<Pi>' _\<in>_./ _)"   10)
 | |
| 107 | translations | |
| 108 | "PI' x:A. B" == "CONST Pi' A (%x. B)" | |
| 109 | ||
| 61808 | 110 | subsubsection\<open>Basic Properties of @{term Pi'}\<close>
 | 
| 50088 | 111 | |
| 112 | lemma Pi'_I[intro!]: "domain f = A \<Longrightarrow> (\<And>x. x \<in> A \<Longrightarrow> f x \<in> B x) \<Longrightarrow> f \<in> Pi' A B" | |
| 113 | by (simp add: Pi'_def) | |
| 114 | ||
| 115 | lemma Pi'_I'[simp]: "domain f = A \<Longrightarrow> (\<And>x. x \<in> A \<longrightarrow> f x \<in> B x) \<Longrightarrow> f \<in> Pi' A B" | |
| 116 | by (simp add:Pi'_def) | |
| 117 | ||
| 118 | lemma Pi'_mem: "f\<in> Pi' A B \<Longrightarrow> x \<in> A \<Longrightarrow> f x \<in> B x" | |
| 119 | by (simp add: Pi'_def) | |
| 120 | ||
| 121 | lemma Pi'_iff: "f \<in> Pi' I X \<longleftrightarrow> domain f = I \<and> (\<forall>i\<in>I. f i \<in> X i)" | |
| 122 | unfolding Pi'_def by auto | |
| 123 | ||
| 124 | lemma Pi'E [elim]: | |
| 125 | "f \<in> Pi' A B \<Longrightarrow> (f x \<in> B x \<Longrightarrow> domain f = A \<Longrightarrow> Q) \<Longrightarrow> (x \<notin> A \<Longrightarrow> Q) \<Longrightarrow> Q" | |
| 126 | by(auto simp: Pi'_def) | |
| 127 | ||
| 128 | lemma in_Pi'_cong: | |
| 129 | "domain f = domain g \<Longrightarrow> (\<And> w. w \<in> A \<Longrightarrow> f w = g w) \<Longrightarrow> f \<in> Pi' A B \<longleftrightarrow> g \<in> Pi' A B" | |
| 130 | by (auto simp: Pi'_def) | |
| 131 | ||
| 132 | lemma Pi'_eq_empty[simp]: | |
| 133 |   assumes "finite A" shows "(Pi' A B) = {} \<longleftrightarrow> (\<exists>x\<in>A. B x = {})"
 | |
| 134 | using assms | |
| 135 | apply (simp add: Pi'_def, auto) | |
| 136 | apply (drule_tac x = "finmap_of A (\<lambda>u. SOME y. y \<in> B u)" in spec, auto) | |
| 137 | apply (cut_tac P= "%y. y \<in> B i" in some_eq_ex, auto) | |
| 138 | done | |
| 139 | ||
| 140 | lemma Pi'_mono: "(\<And>x. x \<in> A \<Longrightarrow> B x \<subseteq> C x) \<Longrightarrow> Pi' A B \<subseteq> Pi' A C" | |
| 141 | by (auto simp: Pi'_def) | |
| 142 | ||
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 143 | lemma Pi_Pi': "finite A \<Longrightarrow> (Pi\<^sub>E A B) = proj ` Pi' A B" | 
| 50088 | 144 | apply (auto simp: Pi'_def Pi_def extensional_def) | 
| 145 | apply (rule_tac x = "finmap_of A (restrict x A)" in image_eqI) | |
| 146 | apply auto | |
| 147 | done | |
| 148 | ||
| 61808 | 149 | subsection \<open>Topological Space of Finite Maps\<close> | 
| 51105 | 150 | |
| 151 | instantiation finmap :: (type, topological_space) topological_space | |
| 152 | begin | |
| 153 | ||
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 154 | definition open_finmap :: "('a \<Rightarrow>\<^sub>F 'b) set \<Rightarrow> bool" where
 | 
| 51105 | 155 |   "open_finmap = generate_topology {Pi' a b|a b. \<forall>i\<in>a. open (b i)}"
 | 
| 156 | ||
| 157 | lemma open_Pi'I: "(\<And>i. i \<in> I \<Longrightarrow> open (A i)) \<Longrightarrow> open (Pi' I A)" | |
| 158 | by (auto intro: generate_topology.Basis simp: open_finmap_def) | |
| 159 | ||
| 160 | instance using topological_space_generate_topology | |
| 161 | by intro_classes (auto simp: open_finmap_def class.topological_space_def) | |
| 162 | ||
| 163 | end | |
| 164 | ||
| 165 | lemma open_restricted_space: | |
| 166 |   shows "open {m. P (domain m)}"
 | |
| 167 | proof - | |
| 168 |   have "{m. P (domain m)} = (\<Union>i \<in> Collect P. {m. domain m = i})" by auto
 | |
| 169 | also have "open \<dots>" | |
| 170 | proof (rule, safe, cases) | |
| 171 | fix i::"'a set" | |
| 172 | assume "finite i" | |
| 173 |     hence "{m. domain m = i} = Pi' i (\<lambda>_. UNIV)" by (auto simp: Pi'_def)
 | |
| 61808 | 174 | also have "open \<dots>" by (auto intro: open_Pi'I simp: \<open>finite i\<close>) | 
| 51105 | 175 |     finally show "open {m. domain m = i}" .
 | 
| 176 | next | |
| 177 | fix i::"'a set" | |
| 178 |     assume "\<not> finite i" hence "{m. domain m = i} = {}" by auto
 | |
| 179 | also have "open \<dots>" by simp | |
| 180 |     finally show "open {m. domain m = i}" .
 | |
| 181 | qed | |
| 182 | finally show ?thesis . | |
| 183 | qed | |
| 184 | ||
| 185 | lemma closed_restricted_space: | |
| 186 |   shows "closed {m. P (domain m)}"
 | |
| 187 | using open_restricted_space[of "\<lambda>x. \<not> P x"] | |
| 188 | unfolding closed_def by (rule back_subst) auto | |
| 189 | ||
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 190 | lemma tendsto_proj: "((\<lambda>x. x) ---> a) F \<Longrightarrow> ((\<lambda>x. (x)\<^sub>F i) ---> (a)\<^sub>F i) F" | 
| 51105 | 191 | unfolding tendsto_def | 
| 192 | proof safe | |
| 193 | fix S::"'b set" | |
| 194 | let ?S = "Pi' (domain a) (\<lambda>x. if x = i then S else UNIV)" | |
| 195 | assume "open S" hence "open ?S" by (auto intro!: open_Pi'I) | |
| 196 | moreover assume "\<forall>S. open S \<longrightarrow> a \<in> S \<longrightarrow> eventually (\<lambda>x. x \<in> S) F" "a i \<in> S" | |
| 197 | ultimately have "eventually (\<lambda>x. x \<in> ?S) F" by auto | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 198 | thus "eventually (\<lambda>x. (x)\<^sub>F i \<in> S) F" | 
| 61808 | 199 | by eventually_elim (insert \<open>a i \<in> S\<close>, force simp: Pi'_iff split: split_if_asm) | 
| 51105 | 200 | qed | 
| 201 | ||
| 202 | lemma continuous_proj: | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 203 | shows "continuous_on s (\<lambda>x. (x)\<^sub>F i)" | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51489diff
changeset | 204 | unfolding continuous_on_def by (safe intro!: tendsto_proj tendsto_ident_at) | 
| 51105 | 205 | |
| 206 | instance finmap :: (type, first_countable_topology) first_countable_topology | |
| 207 | proof | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 208 | fix x::"'a\<Rightarrow>\<^sub>F'b" | 
| 51105 | 209 | have "\<forall>i. \<exists>A. countable A \<and> (\<forall>a\<in>A. x i \<in> a) \<and> (\<forall>a\<in>A. open a) \<and> | 
| 210 | (\<forall>S. open S \<and> x i \<in> S \<longrightarrow> (\<exists>a\<in>A. a \<subseteq> S)) \<and> (\<forall>a b. a \<in> A \<longrightarrow> b \<in> A \<longrightarrow> a \<inter> b \<in> A)" (is "\<forall>i. ?th i") | |
| 211 | proof | |
| 212 | fix i from first_countable_basis_Int_stableE[of "x i"] guess A . | |
| 213 | thus "?th i" by (intro exI[where x=A]) simp | |
| 214 | qed | |
| 215 | then guess A unfolding choice_iff .. note A = this | |
| 216 | hence open_sub: "\<And>i S. i\<in>domain x \<Longrightarrow> open (S i) \<Longrightarrow> x i\<in>(S i) \<Longrightarrow> (\<exists>a\<in>A i. a\<subseteq>(S i))" by auto | |
| 217 |   have A_notempty: "\<And>i. i \<in> domain x \<Longrightarrow> A i \<noteq> {}" using open_sub[of _ "\<lambda>_. UNIV"] by auto
 | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 218 | let ?A = "(\<lambda>f. Pi' (domain x) f) ` (Pi\<^sub>E (domain x) A)" | 
| 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 219 |   show "\<exists>A::nat \<Rightarrow> ('a\<Rightarrow>\<^sub>F'b) set. (\<forall>i. x \<in> (A i) \<and> open (A i)) \<and> (\<forall>S. open S \<and> x \<in> S \<longrightarrow> (\<exists>i. A i \<subseteq> S))"
 | 
| 51473 | 220 | proof (rule first_countableI[where A="?A"], safe) | 
| 51105 | 221 | show "countable ?A" using A by (simp add: countable_PiE) | 
| 222 | next | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 223 |     fix S::"('a \<Rightarrow>\<^sub>F 'b) set" assume "open S" "x \<in> S"
 | 
| 51105 | 224 | thus "\<exists>a\<in>?A. a \<subseteq> S" unfolding open_finmap_def | 
| 225 | proof (induct rule: generate_topology.induct) | |
| 226 | case UNIV thus ?case by (auto simp add: ex_in_conv PiE_eq_empty_iff A_notempty) | |
| 227 | next | |
| 228 | case (Int a b) | |
| 229 | then obtain f g where | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 230 | "f \<in> Pi\<^sub>E (domain x) A" "Pi' (domain x) f \<subseteq> a" "g \<in> Pi\<^sub>E (domain x) A" "Pi' (domain x) g \<subseteq> b" | 
| 51105 | 231 | by auto | 
| 232 | thus ?case using A | |
| 233 | by (auto simp: Pi'_iff PiE_iff extensional_def Int_stable_def | |
| 234 | intro!: bexI[where x="\<lambda>i. f i \<inter> g i"]) | |
| 235 | next | |
| 236 | case (UN B) | |
| 237 | then obtain b where "x \<in> b" "b \<in> B" by auto | |
| 238 | hence "\<exists>a\<in>?A. a \<subseteq> b" using UN by simp | |
| 61808 | 239 | thus ?case using \<open>b \<in> B\<close> by blast | 
| 51105 | 240 | next | 
| 241 | case (Basis s) | |
| 242 | then obtain a b where xs: "x\<in> Pi' a b" "s = Pi' a b" "\<And>i. i\<in>a \<Longrightarrow> open (b i)" by auto | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 243 | have "\<forall>i. \<exists>a. (i \<in> domain x \<and> open (b i) \<and> (x)\<^sub>F i \<in> b i) \<longrightarrow> (a\<in>A i \<and> a \<subseteq> b i)" | 
| 51105 | 244 | using open_sub[of _ b] by auto | 
| 245 | then obtain b' | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 246 | where "\<And>i. i \<in> domain x \<Longrightarrow> open (b i) \<Longrightarrow> (x)\<^sub>F i \<in> b i \<Longrightarrow> (b' i \<in>A i \<and> b' i \<subseteq> b i)" | 
| 51105 | 247 | unfolding choice_iff by auto | 
| 248 | with xs have "\<And>i. i \<in> a \<Longrightarrow> (b' i \<in>A i \<and> b' i \<subseteq> b i)" "Pi' a b' \<subseteq> Pi' a b" | |
| 249 | by (auto simp: Pi'_iff intro!: Pi'_mono) | |
| 250 | thus ?case using xs | |
| 251 | by (intro bexI[where x="Pi' a b'"]) | |
| 252 | (auto simp: Pi'_iff intro!: image_eqI[where x="restrict b' (domain x)"]) | |
| 253 | qed | |
| 254 | qed (insert A,auto simp: PiE_iff intro!: open_Pi'I) | |
| 255 | qed | |
| 256 | ||
| 61808 | 257 | subsection \<open>Metric Space of Finite Maps\<close> | 
| 50088 | 258 | |
| 259 | instantiation finmap :: (type, metric_space) metric_space | |
| 260 | begin | |
| 261 | ||
| 262 | definition dist_finmap where | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 263 | "dist P Q = Max (range (\<lambda>i. dist ((P)\<^sub>F i) ((Q)\<^sub>F i))) + (if domain P = domain Q then 0 else 1)" | 
| 50088 | 264 | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 265 | lemma finite_proj_image': "x \<notin> domain P \<Longrightarrow> finite ((P)\<^sub>F ` S)" | 
| 51104 | 266 |   by (rule finite_subset[of _ "proj P ` (domain P \<inter> S \<union> {x})"]) auto
 | 
| 267 | ||
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 268 | lemma finite_proj_image: "finite ((P)\<^sub>F ` S)" | 
| 51104 | 269 | by (cases "\<exists>x. x \<notin> domain P") (auto intro: finite_proj_image' finite_subset[where B="domain P"]) | 
| 270 | ||
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 271 | lemma finite_proj_diag: "finite ((\<lambda>i. d ((P)\<^sub>F i) ((Q)\<^sub>F i)) ` S)" | 
| 50088 | 272 | proof - | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 273 | have "(\<lambda>i. d ((P)\<^sub>F i) ((Q)\<^sub>F i)) ` S = (\<lambda>(i, j). d i j) ` ((\<lambda>i. ((P)\<^sub>F i, (Q)\<^sub>F i)) ` S)" by auto | 
| 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 274 | moreover have "((\<lambda>i. ((P)\<^sub>F i, (Q)\<^sub>F i)) ` S) \<subseteq> (\<lambda>i. (P)\<^sub>F i) ` S \<times> (\<lambda>i. (Q)\<^sub>F i) ` S" by auto | 
| 51104 | 275 | moreover have "finite \<dots>" using finite_proj_image[of P S] finite_proj_image[of Q S] | 
| 276 | by (intro finite_cartesian_product) simp_all | |
| 277 | ultimately show ?thesis by (simp add: finite_subset) | |
| 50088 | 278 | qed | 
| 279 | ||
| 51104 | 280 | lemma dist_le_1_imp_domain_eq: | 
| 281 | shows "dist P Q < 1 \<Longrightarrow> domain P = domain Q" | |
| 282 | by (simp add: dist_finmap_def finite_proj_diag split: split_if_asm) | |
| 283 | ||
| 50088 | 284 | lemma dist_proj: | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 285 | shows "dist ((x)\<^sub>F i) ((y)\<^sub>F i) \<le> dist x y" | 
| 50088 | 286 | proof - | 
| 51104 | 287 | have "dist (x i) (y i) \<le> Max (range (\<lambda>i. dist (x i) (y i)))" | 
| 288 | by (simp add: Max_ge_iff finite_proj_diag) | |
| 289 | also have "\<dots> \<le> dist x y" by (simp add: dist_finmap_def) | |
| 290 | finally show ?thesis . | |
| 291 | qed | |
| 292 | ||
| 293 | lemma dist_finmap_lessI: | |
| 51105 | 294 | assumes "domain P = domain Q" | 
| 295 | assumes "0 < e" | |
| 296 | assumes "\<And>i. i \<in> domain P \<Longrightarrow> dist (P i) (Q i) < e" | |
| 51104 | 297 | shows "dist P Q < e" | 
| 298 | proof - | |
| 299 | have "dist P Q = Max (range (\<lambda>i. dist (P i) (Q i)))" | |
| 300 | using assms by (simp add: dist_finmap_def finite_proj_diag) | |
| 301 | also have "\<dots> < e" | |
| 302 | proof (subst Max_less_iff, safe) | |
| 51105 | 303 | fix i | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 304 | show "dist ((P)\<^sub>F i) ((Q)\<^sub>F i) < e" using assms | 
| 51105 | 305 | by (cases "i \<in> domain P") simp_all | 
| 51104 | 306 | qed (simp add: finite_proj_diag) | 
| 307 | finally show ?thesis . | |
| 50088 | 308 | qed | 
| 309 | ||
| 310 | instance | |
| 311 | proof | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 312 |   fix S::"('a \<Rightarrow>\<^sub>F 'b) set"
 | 
| 51105 | 313 | show "open S = (\<forall>x\<in>S. \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> S)" (is "_ = ?od") | 
| 314 | proof | |
| 315 | assume "open S" | |
| 316 | thus ?od | |
| 317 | unfolding open_finmap_def | |
| 318 | proof (induct rule: generate_topology.induct) | |
| 319 | case UNIV thus ?case by (auto intro: zero_less_one) | |
| 320 | next | |
| 321 | case (Int a b) | |
| 322 | show ?case | |
| 323 | proof safe | |
| 324 | fix x assume x: "x \<in> a" "x \<in> b" | |
| 325 | with Int x obtain e1 e2 where | |
| 326 | "e1>0" "\<forall>y. dist y x < e1 \<longrightarrow> y \<in> a" "e2>0" "\<forall>y. dist y x < e2 \<longrightarrow> y \<in> b" by force | |
| 327 | thus "\<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> a \<inter> b" | |
| 328 | by (auto intro!: exI[where x="min e1 e2"]) | |
| 329 | qed | |
| 330 | next | |
| 331 | case (UN K) | |
| 332 | show ?case | |
| 333 | proof safe | |
| 53374 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53015diff
changeset | 334 | fix x X assume "x \<in> X" and X: "X \<in> K" | 
| 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53015diff
changeset | 335 | with UN obtain e where "e>0" "\<And>y. dist y x < e \<longrightarrow> y \<in> X" by force | 
| 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53015diff
changeset | 336 | with X show "\<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> \<Union>K" by auto | 
| 51105 | 337 | qed | 
| 338 | next | |
| 339 | case (Basis s) then obtain a b where s: "s = Pi' a b" and b: "\<And>i. i\<in>a \<Longrightarrow> open (b i)" by auto | |
| 340 | show ?case | |
| 341 | proof safe | |
| 342 | fix x assume "x \<in> s" | |
| 343 | hence [simp]: "finite a" and a_dom: "a = domain x" using s by (auto simp: Pi'_iff) | |
| 344 | obtain es where es: "\<forall>i \<in> a. es i > 0 \<and> (\<forall>y. dist y (proj x i) < es i \<longrightarrow> y \<in> b i)" | |
| 61808 | 345 | using b \<open>x \<in> s\<close> by atomize_elim (intro bchoice, auto simp: open_dist s) | 
| 51105 | 346 | hence in_b: "\<And>i y. i \<in> a \<Longrightarrow> dist y (proj x i) < es i \<Longrightarrow> y \<in> b i" by auto | 
| 347 | show "\<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> s" | |
| 348 | proof (cases, rule, safe) | |
| 349 |           assume "a \<noteq> {}"
 | |
| 61808 | 350 |           show "0 < min 1 (Min (es ` a))" using es by (auto simp: \<open>a \<noteq> {}\<close>)
 | 
| 51105 | 351 | fix y assume d: "dist y x < min 1 (Min (es ` a))" | 
| 352 | show "y \<in> s" unfolding s | |
| 353 | proof | |
| 61808 | 354 |             show "domain y = a" using d s \<open>a \<noteq> {}\<close> by (auto simp: dist_le_1_imp_domain_eq a_dom)
 | 
| 53374 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53015diff
changeset | 355 | fix i assume i: "i \<in> a" | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 356 | hence "dist ((y)\<^sub>F i) ((x)\<^sub>F i) < es i" using d | 
| 61808 | 357 |               by (auto simp: dist_finmap_def \<open>a \<noteq> {}\<close> intro!: le_less_trans[OF dist_proj])
 | 
| 53374 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53015diff
changeset | 358 | with i show "y i \<in> b i" by (rule in_b) | 
| 51105 | 359 | qed | 
| 360 | next | |
| 361 |           assume "\<not>a \<noteq> {}"
 | |
| 362 | thus "\<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> s" | |
| 61808 | 363 | using s \<open>x \<in> s\<close> by (auto simp: Pi'_def dist_le_1_imp_domain_eq intro!: exI[where x=1]) | 
| 51105 | 364 | qed | 
| 365 | qed | |
| 366 | qed | |
| 367 | next | |
| 368 | assume "\<forall>x\<in>S. \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> S" | |
| 369 | then obtain e where e_pos: "\<And>x. x \<in> S \<Longrightarrow> e x > 0" and | |
| 370 | e_in: "\<And>x y . x \<in> S \<Longrightarrow> dist y x < e x \<Longrightarrow> y \<in> S" | |
| 371 | unfolding bchoice_iff | |
| 372 | by auto | |
| 373 |     have S_eq: "S = \<Union>{Pi' a b| a b. \<exists>x\<in>S. domain x = a \<and> b = (\<lambda>i. ball (x i) (e x))}"
 | |
| 374 | proof safe | |
| 375 | fix x assume "x \<in> S" | |
| 376 |       thus "x \<in> \<Union>{Pi' a b| a b. \<exists>x\<in>S. domain x = a \<and> b = (\<lambda>i. ball (x i) (e x))}"
 | |
| 377 | using e_pos by (auto intro!: exI[where x="Pi' (domain x) (\<lambda>i. ball (x i) (e x))"]) | |
| 378 | next | |
| 379 | fix x y | |
| 380 | assume "y \<in> S" | |
| 381 | moreover | |
| 382 | assume "x \<in> (\<Pi>' i\<in>domain y. ball (y i) (e y))" | |
| 61808 | 383 | hence "dist x y < e y" using e_pos \<open>y \<in> S\<close> | 
| 51105 | 384 | by (auto simp: dist_finmap_def Pi'_iff finite_proj_diag dist_commute) | 
| 385 | ultimately show "x \<in> S" by (rule e_in) | |
| 386 | qed | |
| 387 | also have "open \<dots>" | |
| 388 | unfolding open_finmap_def | |
| 389 | by (intro generate_topology.UN) (auto intro: generate_topology.Basis) | |
| 390 | finally show "open S" . | |
| 391 | qed | |
| 50088 | 392 | next | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 393 | fix P Q::"'a \<Rightarrow>\<^sub>F 'b" | 
| 51104 | 394 |   have Max_eq_iff: "\<And>A m. finite A \<Longrightarrow> A \<noteq> {} \<Longrightarrow> (Max A = m) = (m \<in> A \<and> (\<forall>a\<in>A. a \<le> m))"
 | 
| 51489 | 395 | by (auto intro: Max_in Max_eqI) | 
| 50088 | 396 | show "dist P Q = 0 \<longleftrightarrow> P = Q" | 
| 51104 | 397 | by (auto simp: finmap_eq_iff dist_finmap_def Max_ge_iff finite_proj_diag Max_eq_iff | 
| 56633 
18f50d5f84ef
remove add_eq_zero_iff, it is replaced by add_nonneg_eq_0_iff; also removes it from the simpset
 hoelzl parents: 
56222diff
changeset | 398 | add_nonneg_eq_0_iff | 
| 51104 | 399 | intro!: Max_eqI image_eqI[where x=undefined]) | 
| 50088 | 400 | next | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 401 | fix P Q R::"'a \<Rightarrow>\<^sub>F 'b" | 
| 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 402 | let ?dists = "\<lambda>P Q i. dist ((P)\<^sub>F i) ((Q)\<^sub>F i)" | 
| 51104 | 403 | let ?dpq = "?dists P Q" and ?dpr = "?dists P R" and ?dqr = "?dists Q R" | 
| 404 | let ?dom = "\<lambda>P Q. (if domain P = domain Q then 0 else 1::real)" | |
| 405 | have "dist P Q = Max (range ?dpq) + ?dom P Q" | |
| 406 | by (simp add: dist_finmap_def) | |
| 407 | also obtain t where "t \<in> range ?dpq" "t = Max (range ?dpq)" by (simp add: finite_proj_diag) | |
| 408 | then obtain i where "Max (range ?dpq) = ?dpq i" by auto | |
| 409 | also have "?dpq i \<le> ?dpr i + ?dqr i" by (rule dist_triangle2) | |
| 410 | also have "?dpr i \<le> Max (range ?dpr)" by (simp add: finite_proj_diag) | |
| 411 | also have "?dqr i \<le> Max (range ?dqr)" by (simp add: finite_proj_diag) | |
| 412 | also have "?dom P Q \<le> ?dom P R + ?dom Q R" by simp | |
| 413 | finally show "dist P Q \<le> dist P R + dist Q R" by (simp add: dist_finmap_def ac_simps) | |
| 50088 | 414 | qed | 
| 415 | ||
| 416 | end | |
| 417 | ||
| 61808 | 418 | subsection \<open>Complete Space of Finite Maps\<close> | 
| 50088 | 419 | |
| 420 | lemma tendsto_finmap: | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 421 |   fixes f::"nat \<Rightarrow> ('i \<Rightarrow>\<^sub>F ('a::metric_space))"
 | 
| 50088 | 422 | assumes ind_f: "\<And>n. domain (f n) = domain g" | 
| 423 | assumes proj_g: "\<And>i. i \<in> domain g \<Longrightarrow> (\<lambda>n. (f n) i) ----> g i" | |
| 424 | shows "f ----> g" | |
| 51104 | 425 | unfolding tendsto_iff | 
| 426 | proof safe | |
| 427 | fix e::real assume "0 < e" | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 428 | let ?dists = "\<lambda>x i. dist ((f x)\<^sub>F i) ((g)\<^sub>F i)" | 
| 51104 | 429 | have "eventually (\<lambda>x. \<forall>i\<in>domain g. ?dists x i < e) sequentially" | 
| 430 | using finite_domain[of g] proj_g | |
| 431 | proof induct | |
| 432 | case (insert i G) | |
| 61808 | 433 | with \<open>0 < e\<close> have "eventually (\<lambda>x. ?dists x i < e) sequentially" by (auto simp add: tendsto_iff) | 
| 51104 | 434 | moreover | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 435 | from insert have "eventually (\<lambda>x. \<forall>i\<in>G. dist ((f x)\<^sub>F i) ((g)\<^sub>F i) < e) sequentially" by simp | 
| 51104 | 436 | ultimately show ?case by eventually_elim auto | 
| 437 | qed simp | |
| 438 | thus "eventually (\<lambda>x. dist (f x) g < e) sequentially" | |
| 61808 | 439 | by eventually_elim (auto simp add: dist_finmap_def finite_proj_diag ind_f \<open>0 < e\<close>) | 
| 51104 | 440 | qed | 
| 50088 | 441 | |
| 442 | instance finmap :: (type, complete_space) complete_space | |
| 443 | proof | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 444 | fix P::"nat \<Rightarrow> 'a \<Rightarrow>\<^sub>F 'b" | 
| 50088 | 445 | assume "Cauchy P" | 
| 446 | then obtain Nd where Nd: "\<And>n. n \<ge> Nd \<Longrightarrow> dist (P n) (P Nd) < 1" | |
| 447 | by (force simp: cauchy) | |
| 448 | def d \<equiv> "domain (P Nd)" | |
| 449 | with Nd have dim: "\<And>n. n \<ge> Nd \<Longrightarrow> domain (P n) = d" using dist_le_1_imp_domain_eq by auto | |
| 450 | have [simp]: "finite d" unfolding d_def by simp | |
| 451 | def p \<equiv> "\<lambda>i n. (P n) i" | |
| 452 | def q \<equiv> "\<lambda>i. lim (p i)" | |
| 453 | def Q \<equiv> "finmap_of d q" | |
| 454 | have q: "\<And>i. i \<in> d \<Longrightarrow> q i = Q i" by (auto simp add: Q_def Abs_finmap_inverse) | |
| 455 |   {
 | |
| 456 | fix i assume "i \<in> d" | |
| 457 | have "Cauchy (p i)" unfolding cauchy p_def | |
| 458 | proof safe | |
| 459 | fix e::real assume "0 < e" | |
| 61808 | 460 | with \<open>Cauchy P\<close> obtain N where N: "\<And>n. n\<ge>N \<Longrightarrow> dist (P n) (P N) < min e 1" | 
| 50088 | 461 | by (force simp: cauchy min_def) | 
| 462 | hence "\<And>n. n \<ge> N \<Longrightarrow> domain (P n) = domain (P N)" using dist_le_1_imp_domain_eq by auto | |
| 463 | with dim have dim: "\<And>n. n \<ge> N \<Longrightarrow> domain (P n) = d" by (metis nat_le_linear) | |
| 464 | show "\<exists>N. \<forall>n\<ge>N. dist ((P n) i) ((P N) i) < e" | |
| 465 | proof (safe intro!: exI[where x="N"]) | |
| 466 | fix n assume "N \<le> n" have "N \<le> N" by simp | |
| 467 | have "dist ((P n) i) ((P N) i) \<le> dist (P n) (P N)" | |
| 61808 | 468 | using dim[OF \<open>N \<le> n\<close>] dim[OF \<open>N \<le> N\<close>] \<open>i \<in> d\<close> | 
| 50088 | 469 | by (auto intro!: dist_proj) | 
| 61808 | 470 | also have "\<dots> < e" using N[OF \<open>N \<le> n\<close>] by simp | 
| 50088 | 471 | finally show "dist ((P n) i) ((P N) i) < e" . | 
| 472 | qed | |
| 473 | qed | |
| 474 | hence "convergent (p i)" by (metis Cauchy_convergent_iff) | |
| 475 | hence "p i ----> q i" unfolding q_def convergent_def by (metis limI) | |
| 476 | } note p = this | |
| 477 | have "P ----> Q" | |
| 478 | proof (rule metric_LIMSEQ_I) | |
| 479 | fix e::real assume "0 < e" | |
| 51104 | 480 | have "\<exists>ni. \<forall>i\<in>d. \<forall>n\<ge>ni i. dist (p i n) (q i) < e" | 
| 50088 | 481 | proof (safe intro!: bchoice) | 
| 482 | fix i assume "i \<in> d" | |
| 61808 | 483 | from p[OF \<open>i \<in> d\<close>, THEN metric_LIMSEQ_D, OF \<open>0 < e\<close>] | 
| 51104 | 484 | show "\<exists>no. \<forall>n\<ge>no. dist (p i n) (q i) < e" . | 
| 50088 | 485 | qed then guess ni .. note ni = this | 
| 486 | def N \<equiv> "max Nd (Max (ni ` d))" | |
| 487 | show "\<exists>N. \<forall>n\<ge>N. dist (P n) Q < e" | |
| 488 | proof (safe intro!: exI[where x="N"]) | |
| 489 | fix n assume "N \<le> n" | |
| 51104 | 490 | hence dom: "domain (P n) = d" "domain Q = d" "domain (P n) = domain Q" | 
| 50088 | 491 | using dim by (simp_all add: N_def Q_def dim_def Abs_finmap_inverse) | 
| 51104 | 492 | show "dist (P n) Q < e" | 
| 61808 | 493 | proof (rule dist_finmap_lessI[OF dom(3) \<open>0 < e\<close>]) | 
| 51104 | 494 | fix i | 
| 495 | assume "i \<in> domain (P n)" | |
| 496 | hence "ni i \<le> Max (ni ` d)" using dom by simp | |
| 50088 | 497 | also have "\<dots> \<le> N" by (simp add: N_def) | 
| 61808 | 498 | finally show "dist ((P n)\<^sub>F i) ((Q)\<^sub>F i) < e" using ni \<open>i \<in> domain (P n)\<close> \<open>N \<le> n\<close> dom | 
| 51104 | 499 | by (auto simp: p_def q N_def less_imp_le) | 
| 50088 | 500 | qed | 
| 501 | qed | |
| 502 | qed | |
| 503 | thus "convergent P" by (auto simp: convergent_def) | |
| 504 | qed | |
| 505 | ||
| 61808 | 506 | subsection \<open>Second Countable Space of Finite Maps\<close> | 
| 50088 | 507 | |
| 51105 | 508 | instantiation finmap :: (countable, second_countable_topology) second_countable_topology | 
| 50088 | 509 | begin | 
| 510 | ||
| 51106 | 511 | definition basis_proj::"'b set set" | 
| 512 | where "basis_proj = (SOME B. countable B \<and> topological_basis B)" | |
| 513 | ||
| 514 | lemma countable_basis_proj: "countable basis_proj" and basis_proj: "topological_basis basis_proj" | |
| 515 | unfolding basis_proj_def by (intro is_basis countable_basis)+ | |
| 516 | ||
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 517 | definition basis_finmap::"('a \<Rightarrow>\<^sub>F 'b) set set"
 | 
| 51106 | 518 |   where "basis_finmap = {Pi' I S|I S. finite I \<and> (\<forall>i \<in> I. S i \<in> basis_proj)}"
 | 
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 519 | |
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 520 | lemma in_basis_finmapI: | 
| 51106 | 521 | assumes "finite I" assumes "\<And>i. i \<in> I \<Longrightarrow> S i \<in> basis_proj" | 
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 522 | shows "Pi' I S \<in> basis_finmap" | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 523 | using assms unfolding basis_finmap_def by auto | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 524 | |
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 525 | lemma basis_finmap_eq: | 
| 51106 | 526 |   assumes "basis_proj \<noteq> {}"
 | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 527 | shows "basis_finmap = (\<lambda>f. Pi' (domain f) (\<lambda>i. from_nat_into basis_proj ((f)\<^sub>F i))) ` | 
| 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 528 |     (UNIV::('a \<Rightarrow>\<^sub>F nat) set)" (is "_ = ?f ` _")
 | 
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 529 | unfolding basis_finmap_def | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 530 | proof safe | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 531 | fix I::"'a set" and S::"'a \<Rightarrow> 'b set" | 
| 51106 | 532 | assume "finite I" "\<forall>i\<in>I. S i \<in> basis_proj" | 
| 533 | hence "Pi' I S = ?f (finmap_of I (\<lambda>x. to_nat_on basis_proj (S x)))" | |
| 534 | by (force simp: Pi'_def countable_basis_proj) | |
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 535 | thus "Pi' I S \<in> range ?f" by simp | 
| 51106 | 536 | next | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 537 | fix x and f::"'a \<Rightarrow>\<^sub>F nat" | 
| 56222 
6599c6278545
tuned -- no need for slightly obscure "local" prefix;
 wenzelm parents: 
53374diff
changeset | 538 | show "\<exists>I S. (\<Pi>' i\<in>domain f. from_nat_into basis_proj ((f)\<^sub>F i)) = Pi' I S \<and> | 
| 
6599c6278545
tuned -- no need for slightly obscure "local" prefix;
 wenzelm parents: 
53374diff
changeset | 539 | finite I \<and> (\<forall>i\<in>I. S i \<in> basis_proj)" | 
| 51106 | 540 | using assms by (auto intro: from_nat_into) | 
| 541 | qed | |
| 542 | ||
| 543 | lemma basis_finmap_eq_empty: "basis_proj = {} \<Longrightarrow> basis_finmap = {Pi' {} undefined}"
 | |
| 544 | by (auto simp: Pi'_iff basis_finmap_def) | |
| 50088 | 545 | |
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 546 | lemma countable_basis_finmap: "countable basis_finmap" | 
| 51106 | 547 |   by (cases "basis_proj = {}") (auto simp: basis_finmap_eq basis_finmap_eq_empty)
 | 
| 50088 | 548 | |
| 549 | lemma finmap_topological_basis: | |
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 550 | "topological_basis basis_finmap" | 
| 50088 | 551 | proof (subst topological_basis_iff, safe) | 
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 552 | fix B' assume "B' \<in> basis_finmap" | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 553 | thus "open B'" | 
| 51106 | 554 | by (auto intro!: open_Pi'I topological_basis_open[OF basis_proj] | 
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 555 | simp: topological_basis_def basis_finmap_def Let_def) | 
| 50088 | 556 | next | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 557 |   fix O'::"('a \<Rightarrow>\<^sub>F 'b) set" and x
 | 
| 51105 | 558 | assume O': "open O'" "x \<in> O'" | 
| 559 | then obtain a where a: | |
| 560 | "x \<in> Pi' (domain x) a" "Pi' (domain x) a \<subseteq> O'" "\<And>i. i\<in>domain x \<Longrightarrow> open (a i)" | |
| 561 | unfolding open_finmap_def | |
| 562 | proof (atomize_elim, induct rule: generate_topology.induct) | |
| 563 | case (Int a b) | |
| 564 | let ?p="\<lambda>a f. x \<in> Pi' (domain x) f \<and> Pi' (domain x) f \<subseteq> a \<and> (\<forall>i. i \<in> domain x \<longrightarrow> open (f i))" | |
| 565 | from Int obtain f g where "?p a f" "?p b g" by auto | |
| 566 | thus ?case by (force intro!: exI[where x="\<lambda>i. f i \<inter> g i"] simp: Pi'_def) | |
| 567 | next | |
| 568 | case (UN k) | |
| 569 | then obtain kk a where "x \<in> kk" "kk \<in> k" "x \<in> Pi' (domain x) a" "Pi' (domain x) a \<subseteq> kk" | |
| 570 | "\<And>i. i\<in>domain x \<Longrightarrow> open (a i)" | |
| 571 | by force | |
| 572 | thus ?case by blast | |
| 573 | qed (auto simp: Pi'_def) | |
| 50088 | 574 | have "\<exists>B. | 
| 51106 | 575 | (\<forall>i\<in>domain x. x i \<in> B i \<and> B i \<subseteq> a i \<and> B i \<in> basis_proj)" | 
| 50088 | 576 | proof (rule bchoice, safe) | 
| 577 | fix i assume "i \<in> domain x" | |
| 51105 | 578 | hence "open (a i)" "x i \<in> a i" using a by auto | 
| 51106 | 579 | from topological_basisE[OF basis_proj this] guess b' . | 
| 580 | thus "\<exists>y. x i \<in> y \<and> y \<subseteq> a i \<and> y \<in> basis_proj" by auto | |
| 50088 | 581 | qed | 
| 582 | then guess B .. note B = this | |
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 583 | def B' \<equiv> "Pi' (domain x) (\<lambda>i. (B i)::'b set)" | 
| 51105 | 584 | have "B' \<subseteq> Pi' (domain x) a" using B by (auto intro!: Pi'_mono simp: B'_def) | 
| 61808 | 585 | also note \<open>\<dots> \<subseteq> O'\<close> | 
| 51105 | 586 | finally show "\<exists>B'\<in>basis_finmap. x \<in> B' \<and> B' \<subseteq> O'" using B | 
| 587 | by (auto intro!: bexI[where x=B'] Pi'_mono in_basis_finmapI simp: B'_def) | |
| 50088 | 588 | qed | 
| 589 | ||
| 590 | lemma range_enum_basis_finmap_imp_open: | |
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 591 | assumes "x \<in> basis_finmap" | 
| 50088 | 592 | shows "open x" | 
| 593 | using finmap_topological_basis assms by (auto simp: topological_basis_def) | |
| 594 | ||
| 51343 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51106diff
changeset | 595 | instance proof qed (blast intro: finmap_topological_basis countable_basis_finmap topological_basis_imp_subbasis) | 
| 50088 | 596 | |
| 597 | end | |
| 598 | ||
| 61808 | 599 | subsection \<open>Polish Space of Finite Maps\<close> | 
| 51105 | 600 | |
| 601 | instance finmap :: (countable, polish_space) polish_space proof qed | |
| 602 | ||
| 603 | ||
| 61808 | 604 | subsection \<open>Product Measurable Space of Finite Maps\<close> | 
| 50088 | 605 | |
| 606 | definition "PiF I M \<equiv> | |
| 50124 | 607 |   sigma (\<Union>J \<in> I. (\<Pi>' j\<in>J. space (M j))) {(\<Pi>' j\<in>J. X j) |X J. J \<in> I \<and> X \<in> (\<Pi> j\<in>J. sets (M j))}"
 | 
| 50088 | 608 | |
| 609 | abbreviation | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 610 | "Pi\<^sub>F I M \<equiv> PiF I M" | 
| 50088 | 611 | |
| 612 | syntax | |
| 613 |   "_PiF" :: "pttrn \<Rightarrow> 'i set \<Rightarrow> 'a measure \<Rightarrow> ('i => 'a) measure"  ("(3PIF _:_./ _)" 10)
 | |
| 614 | syntax (xsymbols) | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 615 |   "_PiF" :: "pttrn \<Rightarrow> 'i set \<Rightarrow> 'a measure \<Rightarrow> ('i => 'a) measure"  ("(3\<Pi>\<^sub>F _\<in>_./ _)"  10)
 | 
| 50088 | 616 | translations | 
| 617 | "PIF x:I. M" == "CONST PiF I (%x. M)" | |
| 618 | ||
| 619 | lemma PiF_gen_subset: "{(\<Pi>' j\<in>J. X j) |X J. J \<in> I \<and> X \<in> (\<Pi> j\<in>J. sets (M j))} \<subseteq>
 | |
| 620 | Pow (\<Union>J \<in> I. (\<Pi>' j\<in>J. space (M j)))" | |
| 50244 
de72bbe42190
qualified interpretation of sigma_algebra, to avoid name clashes
 immler parents: 
50124diff
changeset | 621 | by (auto simp: Pi'_def) (blast dest: sets.sets_into_space) | 
| 50088 | 622 | |
| 623 | lemma space_PiF: "space (PiF I M) = (\<Union>J \<in> I. (\<Pi>' j\<in>J. space (M j)))" | |
| 624 | unfolding PiF_def using PiF_gen_subset by (rule space_measure_of) | |
| 625 | ||
| 626 | lemma sets_PiF: | |
| 627 | "sets (PiF I M) = sigma_sets (\<Union>J \<in> I. (\<Pi>' j\<in>J. space (M j))) | |
| 628 |     {(\<Pi>' j\<in>J. X j) |X J. J \<in> I \<and> X \<in> (\<Pi> j\<in>J. sets (M j))}"
 | |
| 629 | unfolding PiF_def using PiF_gen_subset by (rule sets_measure_of) | |
| 630 | ||
| 631 | lemma sets_PiF_singleton: | |
| 632 |   "sets (PiF {I} M) = sigma_sets (\<Pi>' j\<in>I. space (M j))
 | |
| 633 |     {(\<Pi>' j\<in>I. X j) |X. X \<in> (\<Pi> j\<in>I. sets (M j))}"
 | |
| 634 | unfolding sets_PiF by simp | |
| 635 | ||
| 636 | lemma in_sets_PiFI: | |
| 637 | assumes "X = (Pi' J S)" "J \<in> I" "\<And>i. i\<in>J \<Longrightarrow> S i \<in> sets (M i)" | |
| 638 | shows "X \<in> sets (PiF I M)" | |
| 639 | unfolding sets_PiF | |
| 640 | using assms by blast | |
| 641 | ||
| 642 | lemma product_in_sets_PiFI: | |
| 643 | assumes "J \<in> I" "\<And>i. i\<in>J \<Longrightarrow> S i \<in> sets (M i)" | |
| 644 | shows "(Pi' J S) \<in> sets (PiF I M)" | |
| 645 | unfolding sets_PiF | |
| 646 | using assms by blast | |
| 647 | ||
| 648 | lemma singleton_space_subset_in_sets: | |
| 649 | fixes J | |
| 650 | assumes "J \<in> I" | |
| 651 | assumes "finite J" | |
| 652 |   shows "space (PiF {J} M) \<in> sets (PiF I M)"
 | |
| 653 | using assms | |
| 654 | by (intro in_sets_PiFI[where J=J and S="\<lambda>i. space (M i)"]) | |
| 655 | (auto simp: product_def space_PiF) | |
| 656 | ||
| 657 | lemma singleton_subspace_set_in_sets: | |
| 658 |   assumes A: "A \<in> sets (PiF {J} M)"
 | |
| 659 | assumes "finite J" | |
| 660 | assumes "J \<in> I" | |
| 661 | shows "A \<in> sets (PiF I M)" | |
| 662 | using A[unfolded sets_PiF] | |
| 663 | apply (induct A) | |
| 664 | unfolding sets_PiF[symmetric] unfolding space_PiF[symmetric] | |
| 665 | using assms | |
| 666 | by (auto intro: in_sets_PiFI intro!: singleton_space_subset_in_sets) | |
| 667 | ||
| 50124 | 668 | lemma finite_measurable_singletonI: | 
| 50088 | 669 | assumes "finite I" | 
| 670 | assumes "\<And>J. J \<in> I \<Longrightarrow> finite J" | |
| 671 |   assumes MN: "\<And>J. J \<in> I \<Longrightarrow> A \<in> measurable (PiF {J} M) N"
 | |
| 672 | shows "A \<in> measurable (PiF I M) N" | |
| 673 | unfolding measurable_def | |
| 674 | proof safe | |
| 675 | fix y assume "y \<in> sets N" | |
| 676 |   have "A -` y \<inter> space (PiF I M) = (\<Union>J\<in>I. A -` y \<inter> space (PiF {J} M))"
 | |
| 677 | by (auto simp: space_PiF) | |
| 678 | also have "\<dots> \<in> sets (PiF I M)" | |
| 679 | proof | |
| 680 | show "finite I" by fact | |
| 681 | fix J assume "J \<in> I" | |
| 682 | with assms have "finite J" by simp | |
| 683 |     show "A -` y \<inter> space (PiF {J} M) \<in> sets (PiF I M)"
 | |
| 684 | by (rule singleton_subspace_set_in_sets[OF measurable_sets[OF assms(3)]]) fact+ | |
| 685 | qed | |
| 686 | finally show "A -` y \<inter> space (PiF I M) \<in> sets (PiF I M)" . | |
| 687 | next | |
| 688 | fix x assume "x \<in> space (PiF I M)" thus "A x \<in> space N" | |
| 689 | using MN[of "domain x"] | |
| 690 | by (auto simp: space_PiF measurable_space Pi'_def) | |
| 691 | qed | |
| 692 | ||
| 50124 | 693 | lemma countable_finite_comprehension: | 
| 50088 | 694 | fixes f :: "'a::countable set \<Rightarrow> _" | 
| 695 | assumes "\<And>s. P s \<Longrightarrow> finite s" | |
| 696 | assumes "\<And>s. P s \<Longrightarrow> f s \<in> sets M" | |
| 697 |   shows "\<Union>{f s|s. P s} \<in> sets M"
 | |
| 698 | proof - | |
| 699 |   have "\<Union>{f s|s. P s} = (\<Union>n::nat. let s = set (from_nat n) in if P s then f s else {})"
 | |
| 700 | proof safe | |
| 53374 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53015diff
changeset | 701 | fix x X s assume *: "x \<in> f s" "P s" | 
| 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53015diff
changeset | 702 | with assms obtain l where "s = set l" using finite_list by blast | 
| 61808 | 703 |     with * show "x \<in> (\<Union>n. let s = set (from_nat n) in if P s then f s else {})" using \<open>P s\<close>
 | 
| 50088 | 704 | by (auto intro!: exI[where x="to_nat l"]) | 
| 705 | next | |
| 706 |     fix x n assume "x \<in> (let s = set (from_nat n) in if P s then f s else {})"
 | |
| 707 |     thus "x \<in> \<Union>{f s|s. P s}" using assms by (auto simp: Let_def split: split_if_asm)
 | |
| 708 | qed | |
| 709 |   hence "\<Union>{f s|s. P s} = (\<Union>n. let s = set (from_nat n) in if P s then f s else {})" by simp
 | |
| 710 | also have "\<dots> \<in> sets M" using assms by (auto simp: Let_def) | |
| 711 | finally show ?thesis . | |
| 712 | qed | |
| 713 | ||
| 714 | lemma space_subset_in_sets: | |
| 715 | fixes J::"'a::countable set set" | |
| 716 | assumes "J \<subseteq> I" | |
| 717 | assumes "\<And>j. j \<in> J \<Longrightarrow> finite j" | |
| 718 | shows "space (PiF J M) \<in> sets (PiF I M)" | |
| 719 | proof - | |
| 720 |   have "space (PiF J M) = \<Union>{space (PiF {j} M)|j. j \<in> J}"
 | |
| 721 | unfolding space_PiF by blast | |
| 722 | also have "\<dots> \<in> sets (PiF I M)" using assms | |
| 723 | by (intro countable_finite_comprehension) (auto simp: singleton_space_subset_in_sets) | |
| 724 | finally show ?thesis . | |
| 725 | qed | |
| 726 | ||
| 727 | lemma subspace_set_in_sets: | |
| 728 | fixes J::"'a::countable set set" | |
| 729 | assumes A: "A \<in> sets (PiF J M)" | |
| 730 | assumes "J \<subseteq> I" | |
| 731 | assumes "\<And>j. j \<in> J \<Longrightarrow> finite j" | |
| 732 | shows "A \<in> sets (PiF I M)" | |
| 733 | using A[unfolded sets_PiF] | |
| 734 | apply (induct A) | |
| 735 | unfolding sets_PiF[symmetric] unfolding space_PiF[symmetric] | |
| 736 | using assms | |
| 737 | by (auto intro: in_sets_PiFI intro!: space_subset_in_sets) | |
| 738 | ||
| 50124 | 739 | lemma countable_measurable_PiFI: | 
| 50088 | 740 | fixes I::"'a::countable set set" | 
| 741 |   assumes MN: "\<And>J. J \<in> I \<Longrightarrow> finite J \<Longrightarrow> A \<in> measurable (PiF {J} M) N"
 | |
| 742 | shows "A \<in> measurable (PiF I M) N" | |
| 743 | unfolding measurable_def | |
| 744 | proof safe | |
| 745 | fix y assume "y \<in> sets N" | |
| 746 |   have "A -` y = (\<Union>{A -` y \<inter> {x. domain x = J}|J. finite J})" by auto
 | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 747 |   { fix x::"'a \<Rightarrow>\<^sub>F 'b"
 | 
| 50088 | 748 | from finite_list[of "domain x"] obtain xs where "set xs = domain x" by auto | 
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 749 | hence "\<exists>n. domain x = set (from_nat n)" | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 750 | by (intro exI[where x="to_nat xs"]) auto } | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 751 |   hence "A -` y \<inter> space (PiF I M) = (\<Union>n. A -` y \<inter> space (PiF ({set (from_nat n)}\<inter>I) M))"
 | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 752 | by (auto simp: space_PiF Pi'_def) | 
| 50088 | 753 | also have "\<dots> \<in> sets (PiF I M)" | 
| 50244 
de72bbe42190
qualified interpretation of sigma_algebra, to avoid name clashes
 immler parents: 
50124diff
changeset | 754 | apply (intro sets.Int sets.countable_nat_UN subsetI, safe) | 
| 50088 | 755 | apply (case_tac "set (from_nat i) \<in> I") | 
| 756 | apply simp_all | |
| 757 | apply (rule singleton_subspace_set_in_sets[OF measurable_sets[OF MN]]) | |
| 61808 | 758 | using assms \<open>y \<in> sets N\<close> | 
| 50088 | 759 | apply (auto simp: space_PiF) | 
| 760 | done | |
| 761 | finally show "A -` y \<inter> space (PiF I M) \<in> sets (PiF I M)" . | |
| 762 | next | |
| 763 | fix x assume "x \<in> space (PiF I M)" thus "A x \<in> space N" | |
| 764 | using MN[of "domain x"] by (auto simp: space_PiF measurable_space Pi'_def) | |
| 765 | qed | |
| 766 | ||
| 767 | lemma measurable_PiF: | |
| 768 | assumes f: "\<And>x. x \<in> space N \<Longrightarrow> domain (f x) \<in> I \<and> (\<forall>i\<in>domain (f x). (f x) i \<in> space (M i))" | |
| 769 | assumes S: "\<And>J S. J \<in> I \<Longrightarrow> (\<And>i. i \<in> J \<Longrightarrow> S i \<in> sets (M i)) \<Longrightarrow> | |
| 770 | f -` (Pi' J S) \<inter> space N \<in> sets N" | |
| 771 | shows "f \<in> measurable N (PiF I M)" | |
| 772 | unfolding PiF_def | |
| 773 | using PiF_gen_subset | |
| 774 | apply (rule measurable_measure_of) | |
| 775 | using f apply force | |
| 776 | apply (insert S, auto) | |
| 777 | done | |
| 778 | ||
| 50124 | 779 | lemma restrict_sets_measurable: | 
| 50088 | 780 | assumes A: "A \<in> sets (PiF I M)" and "J \<subseteq> I" | 
| 781 |   shows "A \<inter> {m. domain m \<in> J} \<in> sets (PiF J M)"
 | |
| 782 | using A[unfolded sets_PiF] | |
| 50124 | 783 | proof (induct A) | 
| 784 | case (Basic a) | |
| 50088 | 785 | then obtain K S where S: "a = Pi' K S" "K \<in> I" "(\<forall>i\<in>K. S i \<in> sets (M i))" | 
| 786 | by auto | |
| 50124 | 787 | show ?case | 
| 50088 | 788 | proof cases | 
| 789 | assume "K \<in> J" | |
| 790 |     hence "a \<inter> {m. domain m \<in> J} \<in> {Pi' K X |X K. K \<in> J \<and> X \<in> (\<Pi> j\<in>K. sets (M j))}" using S
 | |
| 791 | by (auto intro!: exI[where x=K] exI[where x=S] simp: Pi'_def) | |
| 792 | also have "\<dots> \<subseteq> sets (PiF J M)" unfolding sets_PiF by auto | |
| 793 | finally show ?thesis . | |
| 794 | next | |
| 795 | assume "K \<notin> J" | |
| 796 |     hence "a \<inter> {m. domain m \<in> J} = {}" using S by (auto simp: Pi'_def)
 | |
| 797 | also have "\<dots> \<in> sets (PiF J M)" by simp | |
| 798 | finally show ?thesis . | |
| 799 | qed | |
| 800 | next | |
| 50124 | 801 | case (Union a) | 
| 50088 | 802 |   have "UNION UNIV a \<inter> {m. domain m \<in> J} = (\<Union>i. (a i \<inter> {m. domain m \<in> J}))"
 | 
| 803 | by simp | |
| 50244 
de72bbe42190
qualified interpretation of sigma_algebra, to avoid name clashes
 immler parents: 
50124diff
changeset | 804 | also have "\<dots> \<in> sets (PiF J M)" using Union by (intro sets.countable_nat_UN) auto | 
| 50124 | 805 | finally show ?case . | 
| 50088 | 806 | next | 
| 50124 | 807 | case (Compl a) | 
| 50088 | 808 |   have "(space (PiF I M) - a) \<inter> {m. domain m \<in> J} = (space (PiF J M) - (a \<inter> {m. domain m \<in> J}))"
 | 
| 61808 | 809 | using \<open>J \<subseteq> I\<close> by (auto simp: space_PiF Pi'_def) | 
| 50124 | 810 | also have "\<dots> \<in> sets (PiF J M)" using Compl by auto | 
| 811 | finally show ?case by (simp add: space_PiF) | |
| 812 | qed simp | |
| 50088 | 813 | |
| 814 | lemma measurable_finmap_of: | |
| 815 | assumes f: "\<And>i. (\<exists>x \<in> space N. i \<in> J x) \<Longrightarrow> (\<lambda>x. f x i) \<in> measurable N (M i)" | |
| 816 | assumes J: "\<And>x. x \<in> space N \<Longrightarrow> J x \<in> I" "\<And>x. x \<in> space N \<Longrightarrow> finite (J x)" | |
| 817 |   assumes JN: "\<And>S. {x. J x = S} \<inter> space N \<in> sets N"
 | |
| 818 | shows "(\<lambda>x. finmap_of (J x) (f x)) \<in> measurable N (PiF I M)" | |
| 819 | proof (rule measurable_PiF) | |
| 820 | fix x assume "x \<in> space N" | |
| 821 | with J[of x] measurable_space[OF f] | |
| 822 | show "domain (finmap_of (J x) (f x)) \<in> I \<and> | |
| 823 | (\<forall>i\<in>domain (finmap_of (J x) (f x)). (finmap_of (J x) (f x)) i \<in> space (M i))" | |
| 824 | by auto | |
| 825 | next | |
| 826 | fix K S assume "K \<in> I" and *: "\<And>i. i \<in> K \<Longrightarrow> S i \<in> sets (M i)" | |
| 827 | with J have eq: "(\<lambda>x. finmap_of (J x) (f x)) -` Pi' K S \<inter> space N = | |
| 828 |     (if \<exists>x \<in> space N. K = J x \<and> finite K then if K = {} then {x \<in> space N. J x = K}
 | |
| 829 |       else (\<Inter>i\<in>K. (\<lambda>x. f x i) -` S i \<inter> {x \<in> space N. J x = K}) else {})"
 | |
| 830 | by (auto simp: Pi'_def) | |
| 831 |   have r: "{x \<in> space N. J x = K} = space N \<inter> ({x. J x = K} \<inter> space N)" by auto
 | |
| 832 | show "(\<lambda>x. finmap_of (J x) (f x)) -` Pi' K S \<inter> space N \<in> sets N" | |
| 833 | unfolding eq r | |
| 834 | apply (simp del: INT_simps add: ) | |
| 50244 
de72bbe42190
qualified interpretation of sigma_algebra, to avoid name clashes
 immler parents: 
50124diff
changeset | 835 | apply (intro conjI impI sets.finite_INT JN sets.Int[OF sets.top]) | 
| 50088 | 836 | apply simp apply assumption | 
| 837 | apply (subst Int_assoc[symmetric]) | |
| 50244 
de72bbe42190
qualified interpretation of sigma_algebra, to avoid name clashes
 immler parents: 
50124diff
changeset | 838 | apply (rule sets.Int) | 
| 50088 | 839 | apply (intro measurable_sets[OF f] *) apply force apply assumption | 
| 840 | apply (intro JN) | |
| 841 | done | |
| 842 | qed | |
| 843 | ||
| 844 | lemma measurable_PiM_finmap_of: | |
| 845 | assumes "finite J" | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 846 |   shows "finmap_of J \<in> measurable (Pi\<^sub>M J M) (PiF {J} M)"
 | 
| 50088 | 847 | apply (rule measurable_finmap_of) | 
| 848 | apply (rule measurable_component_singleton) | |
| 849 | apply simp | |
| 850 | apply rule | |
| 61808 | 851 | apply (rule \<open>finite J\<close>) | 
| 50088 | 852 | apply simp | 
| 853 | done | |
| 854 | ||
| 855 | lemma proj_measurable_singleton: | |
| 50124 | 856 | assumes "A \<in> sets (M i)" | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 857 |   shows "(\<lambda>x. (x)\<^sub>F i) -` A \<inter> space (PiF {I} M) \<in> sets (PiF {I} M)"
 | 
| 50088 | 858 | proof cases | 
| 859 | assume "i \<in> I" | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 860 |   hence "(\<lambda>x. (x)\<^sub>F i) -` A \<inter> space (PiF {I} M) =
 | 
| 50088 | 861 | Pi' I (\<lambda>x. if x = i then A else space (M x))" | 
| 61808 | 862 | using sets.sets_into_space[OF ] \<open>A \<in> sets (M i)\<close> assms | 
| 50088 | 863 | by (auto simp: space_PiF Pi'_def) | 
| 61808 | 864 | thus ?thesis using assms \<open>A \<in> sets (M i)\<close> | 
| 50088 | 865 | by (intro in_sets_PiFI) auto | 
| 866 | next | |
| 867 | assume "i \<notin> I" | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 868 |   hence "(\<lambda>x. (x)\<^sub>F i) -` A \<inter> space (PiF {I} M) =
 | 
| 50088 | 869 |     (if undefined \<in> A then space (PiF {I} M) else {})" by (auto simp: space_PiF Pi'_def)
 | 
| 870 | thus ?thesis by simp | |
| 871 | qed | |
| 872 | ||
| 873 | lemma measurable_proj_singleton: | |
| 50124 | 874 | assumes "i \<in> I" | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 875 |   shows "(\<lambda>x. (x)\<^sub>F i) \<in> measurable (PiF {I} M) (M i)"
 | 
| 50124 | 876 | by (unfold measurable_def, intro CollectI conjI ballI proj_measurable_singleton assms) | 
| 61808 | 877 | (insert \<open>i \<in> I\<close>, auto simp: space_PiF) | 
| 50088 | 878 | |
| 879 | lemma measurable_proj_countable: | |
| 880 | fixes I::"'a::countable set set" | |
| 881 | assumes "y \<in> space (M i)" | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 882 | shows "(\<lambda>x. if i \<in> domain x then (x)\<^sub>F i else y) \<in> measurable (PiF I M) (M i)" | 
| 50088 | 883 | proof (rule countable_measurable_PiFI) | 
| 884 | fix J assume "J \<in> I" "finite J" | |
| 885 |   show "(\<lambda>x. if i \<in> domain x then x i else y) \<in> measurable (PiF {J} M) (M i)"
 | |
| 886 | unfolding measurable_def | |
| 887 | proof safe | |
| 888 | fix z assume "z \<in> sets (M i)" | |
| 889 |     have "(\<lambda>x. if i \<in> domain x then x i else y) -` z \<inter> space (PiF {J} M) =
 | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 890 |       (\<lambda>x. if i \<in> J then (x)\<^sub>F i else y) -` z \<inter> space (PiF {J} M)"
 | 
| 50088 | 891 | by (auto simp: space_PiF Pi'_def) | 
| 61808 | 892 |     also have "\<dots> \<in> sets (PiF {J} M)" using \<open>z \<in> sets (M i)\<close> \<open>finite J\<close>
 | 
| 50088 | 893 | by (cases "i \<in> J") (auto intro!: measurable_sets[OF measurable_proj_singleton]) | 
| 894 |     finally show "(\<lambda>x. if i \<in> domain x then x i else y) -` z \<inter> space (PiF {J} M) \<in>
 | |
| 895 |       sets (PiF {J} M)" .
 | |
| 61808 | 896 | qed (insert \<open>y \<in> space (M i)\<close>, auto simp: space_PiF Pi'_def) | 
| 50088 | 897 | qed | 
| 898 | ||
| 899 | lemma measurable_restrict_proj: | |
| 900 | assumes "J \<in> II" "finite J" | |
| 901 | shows "finmap_of J \<in> measurable (PiM J M) (PiF II M)" | |
| 902 | using assms | |
| 903 | by (intro measurable_finmap_of measurable_component_singleton) auto | |
| 904 | ||
| 50124 | 905 | lemma measurable_proj_PiM: | 
| 50088 | 906 | fixes J K ::"'a::countable set" and I::"'a set set" | 
| 907 | assumes "finite J" "J \<in> I" | |
| 908 | assumes "x \<in> space (PiM J M)" | |
| 50124 | 909 |   shows "proj \<in> measurable (PiF {J} M) (PiM J M)"
 | 
| 50088 | 910 | proof (rule measurable_PiM_single) | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 911 |   show "proj \<in> space (PiF {J} M) \<rightarrow> (\<Pi>\<^sub>E i \<in> J. space (M i))"
 | 
| 50088 | 912 | using assms by (auto simp add: space_PiM space_PiF extensional_def sets_PiF Pi'_def) | 
| 913 | next | |
| 914 | fix A i assume A: "i \<in> J" "A \<in> sets (M i)" | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 915 |   show "{\<omega> \<in> space (PiF {J} M). (\<omega>)\<^sub>F i \<in> A} \<in> sets (PiF {J} M)"
 | 
| 50088 | 916 | proof | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 917 |     have "{\<omega> \<in> space (PiF {J} M). (\<omega>)\<^sub>F i \<in> A} =
 | 
| 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 918 |       (\<lambda>\<omega>. (\<omega>)\<^sub>F i) -` A \<inter> space (PiF {J} M)" by auto
 | 
| 50088 | 919 |     also have "\<dots> \<in> sets (PiF {J} M)"
 | 
| 920 | using assms A by (auto intro: measurable_sets[OF measurable_proj_singleton] simp: space_PiM) | |
| 921 | finally show ?thesis . | |
| 922 | qed simp | |
| 923 | qed | |
| 924 | ||
| 925 | lemma space_PiF_singleton_eq_product: | |
| 926 | assumes "finite I" | |
| 927 |   shows "space (PiF {I} M) = (\<Pi>' i\<in>I. space (M i))"
 | |
| 928 | by (auto simp: product_def space_PiF assms) | |
| 929 | ||
| 61808 | 930 | text \<open>adapted from @{thm sets_PiM_single}\<close>
 | 
| 50088 | 931 | |
| 932 | lemma sets_PiF_single: | |
| 933 |   assumes "finite I" "I \<noteq> {}"
 | |
| 934 |   shows "sets (PiF {I} M) =
 | |
| 935 | sigma_sets (\<Pi>' i\<in>I. space (M i)) | |
| 936 |       {{f\<in>\<Pi>' i\<in>I. space (M i). f i \<in> A} | i A. i \<in> I \<and> A \<in> sets (M i)}"
 | |
| 937 | (is "_ = sigma_sets ?\<Omega> ?R") | |
| 938 | unfolding sets_PiF_singleton | |
| 939 | proof (rule sigma_sets_eqI) | |
| 940 | interpret R: sigma_algebra ?\<Omega> "sigma_sets ?\<Omega> ?R" by (rule sigma_algebra_sigma_sets) auto | |
| 941 |   fix A assume "A \<in> {Pi' I X |X. X \<in> (\<Pi> j\<in>I. sets (M j))}"
 | |
| 942 | then obtain X where X: "A = Pi' I X" "X \<in> (\<Pi> j\<in>I. sets (M j))" by auto | |
| 943 | show "A \<in> sigma_sets ?\<Omega> ?R" | |
| 944 | proof - | |
| 61808 | 945 |     from \<open>I \<noteq> {}\<close> X have "A = (\<Inter>j\<in>I. {f\<in>space (PiF {I} M). f j \<in> X j})"
 | 
| 50244 
de72bbe42190
qualified interpretation of sigma_algebra, to avoid name clashes
 immler parents: 
50124diff
changeset | 946 | using sets.sets_into_space | 
| 50088 | 947 | by (auto simp: space_PiF product_def) blast | 
| 948 | also have "\<dots> \<in> sigma_sets ?\<Omega> ?R" | |
| 61808 | 949 |       using X \<open>I \<noteq> {}\<close> assms by (intro R.finite_INT) (auto simp: space_PiF)
 | 
| 50088 | 950 | finally show "A \<in> sigma_sets ?\<Omega> ?R" . | 
| 951 | qed | |
| 952 | next | |
| 953 | fix A assume "A \<in> ?R" | |
| 954 |   then obtain i B where A: "A = {f\<in>\<Pi>' i\<in>I. space (M i). f i \<in> B}" "i \<in> I" "B \<in> sets (M i)"
 | |
| 955 | by auto | |
| 956 | then have "A = (\<Pi>' j \<in> I. if j = i then B else space (M j))" | |
| 50244 
de72bbe42190
qualified interpretation of sigma_algebra, to avoid name clashes
 immler parents: 
50124diff
changeset | 957 | using sets.sets_into_space[OF A(3)] | 
| 50088 | 958 | apply (auto simp: Pi'_iff split: split_if_asm) | 
| 959 | apply blast | |
| 960 | done | |
| 961 |   also have "\<dots> \<in> sigma_sets ?\<Omega> {Pi' I X |X. X \<in> (\<Pi> j\<in>I. sets (M j))}"
 | |
| 962 | using A | |
| 963 | by (intro sigma_sets.Basic ) | |
| 964 | (auto intro: exI[where x="\<lambda>j. if j = i then B else space (M j)"]) | |
| 965 |   finally show "A \<in> sigma_sets ?\<Omega> {Pi' I X |X. X \<in> (\<Pi> j\<in>I. sets (M j))}" .
 | |
| 966 | qed | |
| 967 | ||
| 61808 | 968 | text \<open>adapted from @{thm PiE_cong}\<close>
 | 
| 50088 | 969 | |
| 970 | lemma Pi'_cong: | |
| 971 | assumes "finite I" | |
| 972 | assumes "\<And>i. i \<in> I \<Longrightarrow> f i = g i" | |
| 973 | shows "Pi' I f = Pi' I g" | |
| 974 | using assms by (auto simp: Pi'_def) | |
| 975 | ||
| 61808 | 976 | text \<open>adapted from @{thm Pi_UN}\<close>
 | 
| 50088 | 977 | |
| 978 | lemma Pi'_UN: | |
| 979 | fixes A :: "nat \<Rightarrow> 'i \<Rightarrow> 'a set" | |
| 980 | assumes "finite I" | |
| 981 | assumes mono: "\<And>i n m. i \<in> I \<Longrightarrow> n \<le> m \<Longrightarrow> A n i \<subseteq> A m i" | |
| 982 | shows "(\<Union>n. Pi' I (A n)) = Pi' I (\<lambda>i. \<Union>n. A n i)" | |
| 983 | proof (intro set_eqI iffI) | |
| 984 | fix f assume "f \<in> Pi' I (\<lambda>i. \<Union>n. A n i)" | |
| 61808 | 985 | then have "\<forall>i\<in>I. \<exists>n. f i \<in> A n i" "domain f = I" by (auto simp: \<open>finite I\<close> Pi'_def) | 
| 50088 | 986 | from bchoice[OF this(1)] obtain n where n: "\<And>i. i \<in> I \<Longrightarrow> f i \<in> (A (n i) i)" by auto | 
| 987 | obtain k where k: "\<And>i. i \<in> I \<Longrightarrow> n i \<le> k" | |
| 61808 | 988 | using \<open>finite I\<close> finite_nat_set_iff_bounded_le[of "n`I"] by auto | 
| 50088 | 989 | have "f \<in> Pi' I (\<lambda>i. A k i)" | 
| 990 | proof | |
| 991 | fix i assume "i \<in> I" | |
| 61808 | 992 | from mono[OF this, of "n i" k] k[OF this] n[OF this] \<open>domain f = I\<close> \<open>i \<in> I\<close> | 
| 993 | show "f i \<in> A k i " by (auto simp: \<open>finite I\<close>) | |
| 994 | qed (simp add: \<open>domain f = I\<close> \<open>finite I\<close>) | |
| 50088 | 995 | then show "f \<in> (\<Union>n. Pi' I (A n))" by auto | 
| 61808 | 996 | qed (auto simp: Pi'_def \<open>finite I\<close>) | 
| 50088 | 997 | |
| 61808 | 998 | text \<open>adapted from @{thm sets_PiM_sigma}\<close>
 | 
| 50088 | 999 | |
| 1000 | lemma sigma_fprod_algebra_sigma_eq: | |
| 51106 | 1001 | fixes E :: "'i \<Rightarrow> 'a set set" and S :: "'i \<Rightarrow> nat \<Rightarrow> 'a set" | 
| 50088 | 1002 |   assumes [simp]: "finite I" "I \<noteq> {}"
 | 
| 1003 | and S_union: "\<And>i. i \<in> I \<Longrightarrow> (\<Union>j. S i j) = space (M i)" | |
| 1004 | and S_in_E: "\<And>i. i \<in> I \<Longrightarrow> range (S i) \<subseteq> E i" | |
| 1005 | assumes E_closed: "\<And>i. i \<in> I \<Longrightarrow> E i \<subseteq> Pow (space (M i))" | |
| 1006 | and E_generates: "\<And>i. i \<in> I \<Longrightarrow> sets (M i) = sigma_sets (space (M i)) (E i)" | |
| 1007 |   defines "P == { Pi' I F | F. \<forall>i\<in>I. F i \<in> E i }"
 | |
| 1008 |   shows "sets (PiF {I} M) = sigma_sets (space (PiF {I} M)) P"
 | |
| 1009 | proof | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 1010 |   let ?P = "sigma (space (Pi\<^sub>F {I} M)) P"
 | 
| 61808 | 1011 | from \<open>finite I\<close>[THEN ex_bij_betw_finite_nat] guess T .. | 
| 51106 | 1012 | then have T: "\<And>i. i \<in> I \<Longrightarrow> T i < card I" "\<And>i. i\<in>I \<Longrightarrow> the_inv_into I T (T i) = i" | 
| 61808 | 1013 | by (auto simp add: bij_betw_def set_eq_iff image_iff the_inv_into_f_f simp del: \<open>finite I\<close>) | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 1014 |   have P_closed: "P \<subseteq> Pow (space (Pi\<^sub>F {I} M))"
 | 
| 50088 | 1015 | using E_closed by (auto simp: space_PiF P_def Pi'_iff subset_eq) | 
| 1016 | then have space_P: "space ?P = (\<Pi>' i\<in>I. space (M i))" | |
| 1017 | by (simp add: space_PiF) | |
| 1018 |   have "sets (PiF {I} M) =
 | |
| 1019 |       sigma_sets (space ?P) {{f \<in> \<Pi>' i\<in>I. space (M i). f i \<in> A} |i A. i \<in> I \<and> A \<in> sets (M i)}"
 | |
| 1020 | using sets_PiF_single[of I M] by (simp add: space_P) | |
| 1021 |   also have "\<dots> \<subseteq> sets (sigma (space (PiF {I} M)) P)"
 | |
| 50244 
de72bbe42190
qualified interpretation of sigma_algebra, to avoid name clashes
 immler parents: 
50124diff
changeset | 1022 | proof (safe intro!: sets.sigma_sets_subset) | 
| 50088 | 1023 | fix i A assume "i \<in> I" and A: "A \<in> sets (M i)" | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 1024 | have "(\<lambda>x. (x)\<^sub>F i) \<in> measurable ?P (sigma (space (M i)) (E i))" | 
| 50088 | 1025 | proof (subst measurable_iff_measure_of) | 
| 61808 | 1026 | show "E i \<subseteq> Pow (space (M i))" using \<open>i \<in> I\<close> by fact | 
| 1027 | from space_P \<open>i \<in> I\<close> show "(\<lambda>x. (x)\<^sub>F i) \<in> space ?P \<rightarrow> space (M i)" | |
| 50088 | 1028 | by auto | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 1029 | show "\<forall>A\<in>E i. (\<lambda>x. (x)\<^sub>F i) -` A \<inter> space ?P \<in> sets ?P" | 
| 50088 | 1030 | proof | 
| 1031 | fix A assume A: "A \<in> E i" | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 1032 | then have "(\<lambda>x. (x)\<^sub>F i) -` A \<inter> space ?P = (\<Pi>' j\<in>I. if i = j then A else space (M j))" | 
| 61808 | 1033 | using E_closed \<open>i \<in> I\<close> by (auto simp: space_P Pi_iff subset_eq split: split_if_asm) | 
| 50088 | 1034 | also have "\<dots> = (\<Pi>' j\<in>I. \<Union>n. if i = j then A else S j n)" | 
| 1035 | by (intro Pi'_cong) (simp_all add: S_union) | |
| 51106 | 1036 |         also have "\<dots> = (\<Union>xs\<in>{xs. length xs = card I}. \<Pi>' j\<in>I. if i = j then A else S j (xs ! T j))"
 | 
| 1037 | using T | |
| 1038 | apply auto | |
| 1039 | apply (simp_all add: Pi'_iff bchoice_iff) | |
| 1040 | apply (erule conjE exE)+ | |
| 1041 | apply (rule_tac x="map (\<lambda>n. f (the_inv_into I T n)) [0..<card I]" in exI) | |
| 1042 | apply (auto simp: bij_betw_def) | |
| 1043 | done | |
| 50088 | 1044 | also have "\<dots> \<in> sets ?P" | 
| 50244 
de72bbe42190
qualified interpretation of sigma_algebra, to avoid name clashes
 immler parents: 
50124diff
changeset | 1045 | proof (safe intro!: sets.countable_UN) | 
| 51106 | 1046 | fix xs show "(\<Pi>' j\<in>I. if i = j then A else S j (xs ! T j)) \<in> sets ?P" | 
| 50088 | 1047 | using A S_in_E | 
| 1048 | by (simp add: P_closed) | |
| 51106 | 1049 | (auto simp: P_def subset_eq intro!: exI[of _ "\<lambda>j. if i = j then A else S j (xs ! T j)"]) | 
| 50088 | 1050 | qed | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 1051 | finally show "(\<lambda>x. (x)\<^sub>F i) -` A \<inter> space ?P \<in> sets ?P" | 
| 50088 | 1052 | using P_closed by simp | 
| 1053 | qed | |
| 1054 | qed | |
| 61808 | 1055 | from measurable_sets[OF this, of A] A \<open>i \<in> I\<close> E_closed | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 1056 | have "(\<lambda>x. (x)\<^sub>F i) -` A \<inter> space ?P \<in> sets ?P" | 
| 50088 | 1057 | by (simp add: E_generates) | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 1058 |     also have "(\<lambda>x. (x)\<^sub>F i) -` A \<inter> space ?P = {f \<in> \<Pi>' i\<in>I. space (M i). f i \<in> A}"
 | 
| 50088 | 1059 | using P_closed by (auto simp: space_PiF) | 
| 1060 | finally show "\<dots> \<in> sets ?P" . | |
| 1061 | qed | |
| 1062 |   finally show "sets (PiF {I} M) \<subseteq> sigma_sets (space (PiF {I} M)) P"
 | |
| 1063 | by (simp add: P_closed) | |
| 1064 |   show "sigma_sets (space (PiF {I} M)) P \<subseteq> sets (PiF {I} M)"
 | |
| 61808 | 1065 |     using \<open>finite I\<close> \<open>I \<noteq> {}\<close>
 | 
| 50244 
de72bbe42190
qualified interpretation of sigma_algebra, to avoid name clashes
 immler parents: 
50124diff
changeset | 1066 | by (auto intro!: sets.sigma_sets_subset product_in_sets_PiFI simp: E_generates P_def) | 
| 50088 | 1067 | qed | 
| 1068 | ||
| 1069 | lemma product_open_generates_sets_PiF_single: | |
| 1070 |   assumes "I \<noteq> {}"
 | |
| 1071 | assumes [simp]: "finite I" | |
| 50881 
ae630bab13da
renamed countable_basis_space to second_countable_topology
 hoelzl parents: 
50251diff
changeset | 1072 |   shows "sets (PiF {I} (\<lambda>_. borel::'b::second_countable_topology measure)) =
 | 
| 50088 | 1073 |     sigma_sets (space (PiF {I} (\<lambda>_. borel))) {Pi' I F |F. (\<forall>i\<in>I. F i \<in> Collect open)}"
 | 
| 1074 | proof - | |
| 51106 | 1075 | from open_countable_basisE[OF open_UNIV] guess S::"'b set set" . note S = this | 
| 50088 | 1076 | show ?thesis | 
| 1077 | proof (rule sigma_fprod_algebra_sigma_eq) | |
| 1078 | show "finite I" by simp | |
| 1079 |     show "I \<noteq> {}" by fact
 | |
| 51106 | 1080 | def S'\<equiv>"from_nat_into S" | 
| 1081 | show "(\<Union>j. S' j) = space borel" | |
| 1082 | using S | |
| 1083 | apply (auto simp add: from_nat_into countable_basis_proj S'_def basis_proj_def) | |
| 1084 | apply (metis (lifting, mono_tags) UNIV_I UnionE basis_proj_def countable_basis_proj countable_subset from_nat_into_surj) | |
| 1085 | done | |
| 1086 | show "range S' \<subseteq> Collect open" | |
| 1087 | using S | |
| 1088 | apply (auto simp add: from_nat_into countable_basis_proj S'_def) | |
| 1089 | apply (metis UNIV_not_empty Union_empty from_nat_into set_mp topological_basis_open[OF basis_proj] basis_proj_def) | |
| 1090 | done | |
| 50088 | 1091 | show "Collect open \<subseteq> Pow (space borel)" by simp | 
| 1092 | show "sets borel = sigma_sets (space borel) (Collect open)" | |
| 1093 | by (simp add: borel_def) | |
| 1094 | qed | |
| 1095 | qed | |
| 1096 | ||
| 50124 | 1097 | lemma finmap_UNIV[simp]: "(\<Union>J\<in>Collect finite. PI' j : J. UNIV) = UNIV" by auto | 
| 50088 | 1098 | |
| 1099 | lemma borel_eq_PiF_borel: | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 1100 |   shows "(borel :: ('i::countable \<Rightarrow>\<^sub>F 'a::polish_space) measure) =
 | 
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1101 | PiF (Collect finite) (\<lambda>_. borel :: 'a measure)" | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1102 | unfolding borel_def PiF_def | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1103 | proof (rule measure_eqI, clarsimp, rule sigma_sets_eqI) | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 1104 |   fix a::"('i \<Rightarrow>\<^sub>F 'a) set" assume "a \<in> Collect open" hence "open a" by simp
 | 
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1105 | then obtain B' where B': "B'\<subseteq>basis_finmap" "a = \<Union>B'" | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1106 | using finmap_topological_basis by (force simp add: topological_basis_def) | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1107 |   have "a \<in> sigma UNIV {Pi' J X |X J. finite J \<and> X \<in> J \<rightarrow> sigma_sets UNIV (Collect open)}"
 | 
| 61808 | 1108 | unfolding \<open>a = \<Union>B'\<close> | 
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1109 | proof (rule sets.countable_Union) | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1110 | from B' countable_basis_finmap show "countable B'" by (metis countable_subset) | 
| 50088 | 1111 | next | 
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1112 | show "B' \<subseteq> sets (sigma UNIV | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1113 |       {Pi' J X |X J. finite J \<and> X \<in> J \<rightarrow> sigma_sets UNIV (Collect open)})" (is "_ \<subseteq> sets ?s")
 | 
| 50088 | 1114 | proof | 
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1115 | fix x assume "x \<in> B'" with B' have "x \<in> basis_finmap" by auto | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1116 | then obtain J X where "x = Pi' J X" "finite J" "X \<in> J \<rightarrow> sigma_sets UNIV (Collect open)" | 
| 51106 | 1117 | by (auto simp: basis_finmap_def topological_basis_open[OF basis_proj]) | 
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1118 | thus "x \<in> sets ?s" by auto | 
| 50088 | 1119 | qed | 
| 1120 | qed | |
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1121 |   thus "a \<in> sigma_sets UNIV {Pi' J X |X J. finite J \<and> X \<in> J \<rightarrow> sigma_sets UNIV (Collect open)}"
 | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1122 | by simp | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1123 | next | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 1124 |   fix b::"('i \<Rightarrow>\<^sub>F 'a) set"
 | 
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1125 |   assume "b \<in> {Pi' J X |X J. finite J \<and> X \<in> J \<rightarrow> sigma_sets UNIV (Collect open)}"
 | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 1126 | hence b': "b \<in> sets (Pi\<^sub>F (Collect finite) (\<lambda>_. borel))" by (auto simp: sets_PiF borel_def) | 
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1127 |   let ?b = "\<lambda>J. b \<inter> {x. domain x = J}"
 | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1128 | have "b = \<Union>((\<lambda>J. ?b J) ` Collect finite)" by auto | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1129 | also have "\<dots> \<in> sets borel" | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1130 | proof (rule sets.countable_Union, safe) | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1131 | fix J::"'i set" assume "finite J" | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1132 |     { assume ef: "J = {}"
 | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1133 | have "?b J \<in> sets borel" | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1134 | proof cases | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1135 |         assume "?b J \<noteq> {}"
 | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1136 |         then obtain f where "f \<in> b" "domain f = {}" using ef by auto
 | 
| 61808 | 1137 |         hence "?b J = {f}" using \<open>J = {}\<close>
 | 
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1138 | by (auto simp: finmap_eq_iff) | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1139 |         also have "{f} \<in> sets borel" by simp
 | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1140 | finally show ?thesis . | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1141 | qed simp | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1142 |     } moreover {
 | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1143 |       assume "J \<noteq> ({}::'i set)"
 | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1144 |       have "(?b J) = b \<inter> {m. domain m \<in> {J}}" by auto
 | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1145 |       also have "\<dots> \<in> sets (PiF {J} (\<lambda>_. borel))"
 | 
| 61808 | 1146 | using b' by (rule restrict_sets_measurable) (auto simp: \<open>finite J\<close>) | 
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1147 |       also have "\<dots> = sigma_sets (space (PiF {J} (\<lambda>_. borel)))
 | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1148 |         {Pi' (J) F |F. (\<forall>j\<in>J. F j \<in> Collect open)}"
 | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1149 | (is "_ = sigma_sets _ ?P") | 
| 61808 | 1150 |        by (rule product_open_generates_sets_PiF_single[OF \<open>J \<noteq> {}\<close> \<open>finite J\<close>])
 | 
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1151 | also have "\<dots> \<subseteq> sigma_sets UNIV (Collect open)" | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1152 | by (intro sigma_sets_mono'') (auto intro!: open_Pi'I simp: space_PiF) | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1153 | finally have "(?b J) \<in> sets borel" by (simp add: borel_def) | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1154 | } ultimately show "(?b J) \<in> sets borel" by blast | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1155 | qed (simp add: countable_Collect_finite) | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50244diff
changeset | 1156 | finally show "b \<in> sigma_sets UNIV (Collect open)" by (simp add: borel_def) | 
| 50088 | 1157 | qed (simp add: emeasure_sigma borel_def PiF_def) | 
| 1158 | ||
| 61808 | 1159 | subsection \<open>Isomorphism between Functions and Finite Maps\<close> | 
| 50088 | 1160 | |
| 50124 | 1161 | lemma measurable_finmap_compose: | 
| 50088 | 1162 | shows "(\<lambda>m. compose J m f) \<in> measurable (PiM (f ` J) (\<lambda>_. M)) (PiM J (\<lambda>_. M))" | 
| 50124 | 1163 | unfolding compose_def by measurable | 
| 50088 | 1164 | |
| 50124 | 1165 | lemma measurable_compose_inv: | 
| 50088 | 1166 | assumes inj: "\<And>j. j \<in> J \<Longrightarrow> f' (f j) = j" | 
| 1167 | shows "(\<lambda>m. compose (f ` J) m f') \<in> measurable (PiM J (\<lambda>_. M)) (PiM (f ` J) (\<lambda>_. M))" | |
| 50124 | 1168 | unfolding compose_def by (rule measurable_restrict) (auto simp: inj) | 
| 50088 | 1169 | |
| 1170 | locale function_to_finmap = | |
| 1171 | fixes J::"'a set" and f :: "'a \<Rightarrow> 'b::countable" and f' | |
| 1172 | assumes [simp]: "finite J" | |
| 1173 | assumes inv: "i \<in> J \<Longrightarrow> f' (f i) = i" | |
| 1174 | begin | |
| 1175 | ||
| 61808 | 1176 | text \<open>to measure finmaps\<close> | 
| 50088 | 1177 | |
| 1178 | definition "fm = (finmap_of (f ` J)) o (\<lambda>g. compose (f ` J) g f')" | |
| 1179 | ||
| 1180 | lemma domain_fm[simp]: "domain (fm x) = f ` J" | |
| 1181 | unfolding fm_def by simp | |
| 1182 | ||
| 1183 | lemma fm_restrict[simp]: "fm (restrict y J) = fm y" | |
| 1184 | unfolding fm_def by (auto simp: compose_def inv intro: restrict_ext) | |
| 1185 | ||
| 1186 | lemma fm_product: | |
| 1187 | assumes "\<And>i. space (M i) = UNIV" | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 1188 | shows "fm -` Pi' (f ` J) S \<inter> space (Pi\<^sub>M J M) = (\<Pi>\<^sub>E j \<in> J. S (f j))" | 
| 50088 | 1189 | using assms | 
| 1190 | by (auto simp: inv fm_def compose_def space_PiM Pi'_def) | |
| 1191 | ||
| 1192 | lemma fm_measurable: | |
| 1193 | assumes "f ` J \<in> N" | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 1194 | shows "fm \<in> measurable (Pi\<^sub>M J (\<lambda>_. M)) (Pi\<^sub>F N (\<lambda>_. M))" | 
| 50088 | 1195 | unfolding fm_def | 
| 1196 | proof (rule measurable_comp, rule measurable_compose_inv) | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 1197 | show "finmap_of (f ` J) \<in> measurable (Pi\<^sub>M (f ` J) (\<lambda>_. M)) (PiF N (\<lambda>_. M)) " | 
| 50088 | 1198 | using assms by (intro measurable_finmap_of measurable_component_singleton) auto | 
| 1199 | qed (simp_all add: inv) | |
| 1200 | ||
| 1201 | lemma proj_fm: | |
| 1202 | assumes "x \<in> J" | |
| 1203 | shows "fm m (f x) = m x" | |
| 1204 | using assms by (auto simp: fm_def compose_def o_def inv) | |
| 1205 | ||
| 1206 | lemma inj_on_compose_f': "inj_on (\<lambda>g. compose (f ` J) g f') (extensional J)" | |
| 1207 | proof (rule inj_on_inverseI) | |
| 1208 | fix x::"'a \<Rightarrow> 'c" assume "x \<in> extensional J" | |
| 1209 | thus "(\<lambda>x. compose J x f) (compose (f ` J) x f') = x" | |
| 1210 | by (auto simp: compose_def inv extensional_def) | |
| 1211 | qed | |
| 1212 | ||
| 1213 | lemma inj_on_fm: | |
| 1214 | assumes "\<And>i. space (M i) = UNIV" | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 1215 | shows "inj_on fm (space (Pi\<^sub>M J M))" | 
| 50088 | 1216 | using assms | 
| 50123 
69b35a75caf3
merge extensional dependent function space from FuncSet with the one in Finite_Product_Measure
 hoelzl parents: 
50100diff
changeset | 1217 | apply (auto simp: fm_def space_PiM PiE_def) | 
| 50088 | 1218 | apply (rule comp_inj_on) | 
| 1219 | apply (rule inj_on_compose_f') | |
| 1220 | apply (rule finmap_of_inj_on_extensional_finite) | |
| 1221 | apply simp | |
| 1222 | apply (auto) | |
| 1223 | done | |
| 1224 | ||
| 61808 | 1225 | text \<open>to measure functions\<close> | 
| 50088 | 1226 | |
| 1227 | definition "mf = (\<lambda>g. compose J g f) o proj" | |
| 1228 | ||
| 1229 | lemma mf_fm: | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 1230 | assumes "x \<in> space (Pi\<^sub>M J (\<lambda>_. M))" | 
| 50088 | 1231 | shows "mf (fm x) = x" | 
| 1232 | proof - | |
| 1233 | have "mf (fm x) \<in> extensional J" | |
| 1234 | by (auto simp: mf_def extensional_def compose_def) | |
| 1235 | moreover | |
| 50244 
de72bbe42190
qualified interpretation of sigma_algebra, to avoid name clashes
 immler parents: 
50124diff
changeset | 1236 | have "x \<in> extensional J" using assms sets.sets_into_space | 
| 50123 
69b35a75caf3
merge extensional dependent function space from FuncSet with the one in Finite_Product_Measure
 hoelzl parents: 
50100diff
changeset | 1237 | by (force simp: space_PiM PiE_def) | 
| 50088 | 1238 | moreover | 
| 1239 |   { fix i assume "i \<in> J"
 | |
| 1240 | hence "mf (fm x) i = x i" | |
| 1241 | by (auto simp: inv mf_def compose_def fm_def) | |
| 1242 | } | |
| 1243 | ultimately | |
| 1244 | show ?thesis by (rule extensionalityI) | |
| 1245 | qed | |
| 1246 | ||
| 1247 | lemma mf_measurable: | |
| 1248 | assumes "space M = UNIV" | |
| 1249 |   shows "mf \<in> measurable (PiF {f ` J} (\<lambda>_. M)) (PiM J (\<lambda>_. M))"
 | |
| 1250 | unfolding mf_def | |
| 1251 | proof (rule measurable_comp, rule measurable_proj_PiM) | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 1252 | show "(\<lambda>g. compose J g f) \<in> measurable (Pi\<^sub>M (f ` J) (\<lambda>x. M)) (Pi\<^sub>M J (\<lambda>_. M))" | 
| 50124 | 1253 | by (rule measurable_finmap_compose) | 
| 50088 | 1254 | qed (auto simp add: space_PiM extensional_def assms) | 
| 1255 | ||
| 1256 | lemma fm_image_measurable: | |
| 1257 | assumes "space M = UNIV" | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 1258 | assumes "X \<in> sets (Pi\<^sub>M J (\<lambda>_. M))" | 
| 50088 | 1259 |   shows "fm ` X \<in> sets (PiF {f ` J} (\<lambda>_. M))"
 | 
| 1260 | proof - | |
| 1261 |   have "fm ` X = (mf) -` X \<inter> space (PiF {f ` J} (\<lambda>_. M))"
 | |
| 1262 | proof safe | |
| 1263 | fix x assume "x \<in> X" | |
| 50244 
de72bbe42190
qualified interpretation of sigma_algebra, to avoid name clashes
 immler parents: 
50124diff
changeset | 1264 | with mf_fm[of x] sets.sets_into_space[OF assms(2)] show "fm x \<in> mf -` X" by auto | 
| 50088 | 1265 |     show "fm x \<in> space (PiF {f ` J} (\<lambda>_. M))" by (simp add: space_PiF assms)
 | 
| 1266 | next | |
| 1267 | fix y x | |
| 1268 | assume x: "mf y \<in> X" | |
| 1269 |     assume y: "y \<in> space (PiF {f ` J} (\<lambda>_. M))"
 | |
| 1270 | thus "y \<in> fm ` X" | |
| 1271 | by (intro image_eqI[OF _ x], unfold finmap_eq_iff) | |
| 1272 | (auto simp: space_PiF fm_def mf_def compose_def inv Pi'_def) | |
| 1273 | qed | |
| 1274 |   also have "\<dots> \<in> sets (PiF {f ` J} (\<lambda>_. M))"
 | |
| 1275 | using assms | |
| 1276 | by (intro measurable_sets[OF mf_measurable]) auto | |
| 1277 | finally show ?thesis . | |
| 1278 | qed | |
| 1279 | ||
| 1280 | lemma fm_image_measurable_finite: | |
| 1281 | assumes "space M = UNIV" | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 1282 | assumes "X \<in> sets (Pi\<^sub>M J (\<lambda>_. M::'c measure))" | 
| 50088 | 1283 | shows "fm ` X \<in> sets (PiF (Collect finite) (\<lambda>_. M::'c measure))" | 
| 1284 | using fm_image_measurable[OF assms] | |
| 1285 | by (rule subspace_set_in_sets) (auto simp: finite_subset) | |
| 1286 | ||
| 61808 | 1287 | text \<open>measure on finmaps\<close> | 
| 50088 | 1288 | |
| 1289 | definition "mapmeasure M N = distr M (PiF (Collect finite) N) (fm)" | |
| 1290 | ||
| 1291 | lemma sets_mapmeasure[simp]: "sets (mapmeasure M N) = sets (PiF (Collect finite) N)" | |
| 1292 | unfolding mapmeasure_def by simp | |
| 1293 | ||
| 1294 | lemma space_mapmeasure[simp]: "space (mapmeasure M N) = space (PiF (Collect finite) N)" | |
| 1295 | unfolding mapmeasure_def by simp | |
| 1296 | ||
| 1297 | lemma mapmeasure_PiF: | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 1298 | assumes s1: "space M = space (Pi\<^sub>M J (\<lambda>_. N))" | 
| 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 1299 | assumes s2: "sets M = sets (Pi\<^sub>M J (\<lambda>_. N))" | 
| 50088 | 1300 | assumes "space N = UNIV" | 
| 1301 | assumes "X \<in> sets (PiF (Collect finite) (\<lambda>_. N))" | |
| 1302 | shows "emeasure (mapmeasure M (\<lambda>_. N)) X = emeasure M ((fm -` X \<inter> extensional J))" | |
| 1303 | using assms | |
| 59048 | 1304 | by (auto simp: measurable_cong_sets[OF s2 refl] mapmeasure_def emeasure_distr | 
| 50123 
69b35a75caf3
merge extensional dependent function space from FuncSet with the one in Finite_Product_Measure
 hoelzl parents: 
50100diff
changeset | 1305 | fm_measurable space_PiM PiE_def) | 
| 50088 | 1306 | |
| 1307 | lemma mapmeasure_PiM: | |
| 1308 | fixes N::"'c measure" | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 1309 | assumes s1: "space M = space (Pi\<^sub>M J (\<lambda>_. N))" | 
| 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 1310 | assumes s2: "sets M = (Pi\<^sub>M J (\<lambda>_. N))" | 
| 50088 | 1311 | assumes N: "space N = UNIV" | 
| 1312 | assumes X: "X \<in> sets M" | |
| 1313 | shows "emeasure M X = emeasure (mapmeasure M (\<lambda>_. N)) (fm ` X)" | |
| 1314 | unfolding mapmeasure_def | |
| 59048 | 1315 | proof (subst emeasure_distr, subst measurable_cong_sets[OF s2 refl], rule fm_measurable) | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 1316 | have "X \<subseteq> space (Pi\<^sub>M J (\<lambda>_. N))" using assms by (simp add: sets.sets_into_space) | 
| 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
51641diff
changeset | 1317 | from assms inj_on_fm[of "\<lambda>_. N"] set_mp[OF this] have "fm -` fm ` X \<inter> space (Pi\<^sub>M J (\<lambda>_. N)) = X" | 
| 50088 | 1318 | by (auto simp: vimage_image_eq inj_on_def) | 
| 1319 | thus "emeasure M X = emeasure M (fm -` fm ` X \<inter> space M)" using s1 | |
| 1320 | by simp | |
| 1321 | show "fm ` X \<in> sets (PiF (Collect finite) (\<lambda>_. N))" | |
| 1322 | by (rule fm_image_measurable_finite[OF N X[simplified s2]]) | |
| 1323 | qed simp | |
| 1324 | ||
| 1325 | end | |
| 1326 | ||
| 1327 | end |