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