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