src/HOL/Probability/Borel_Space.thy
changeset 50003 8c213922ed49
parent 50002 ce0d316b5b44
child 50021 d96a3f468203
equal deleted inserted replaced
50002:ce0d316b5b44 50003:8c213922ed49
    34   unfolding borel_def by auto
    34   unfolding borel_def by auto
    35 
    35 
    36 lemma pred_Collect_borel[measurable (raw)]: "Sigma_Algebra.pred borel P \<Longrightarrow> {x. P x} \<in> sets borel"
    36 lemma pred_Collect_borel[measurable (raw)]: "Sigma_Algebra.pred borel P \<Longrightarrow> {x. P x} \<in> sets borel"
    37   unfolding borel_def pred_def by auto
    37   unfolding borel_def pred_def by auto
    38 
    38 
    39 lemma borel_open[simp, measurable (raw generic)]:
    39 lemma borel_open[measurable (raw generic)]:
    40   assumes "open A" shows "A \<in> sets borel"
    40   assumes "open A" shows "A \<in> sets borel"
    41 proof -
    41 proof -
    42   have "A \<in> {S. open S}" unfolding mem_Collect_eq using assms .
    42   have "A \<in> {S. open S}" unfolding mem_Collect_eq using assms .
    43   thus ?thesis unfolding borel_def by auto
    43   thus ?thesis unfolding borel_def by auto
    44 qed
    44 qed
    45 
    45 
    46 lemma borel_closed[simp, measurable (raw generic)]:
    46 lemma borel_closed[measurable (raw generic)]:
    47   assumes "closed A" shows "A \<in> sets borel"
    47   assumes "closed A" shows "A \<in> sets borel"
    48 proof -
    48 proof -
    49   have "space borel - (- A) \<in> sets borel"
    49   have "space borel - (- A) \<in> sets borel"
    50     using assms unfolding closed_def by (blast intro: borel_open)
    50     using assms unfolding closed_def by (blast intro: borel_open)
    51   thus ?thesis by simp
    51   thus ?thesis by simp
    52 qed
    52 qed
    53 
    53 
    54 lemma borel_insert[measurable]:
    54 lemma borel_singleton[measurable]:
    55   "A \<in> sets borel \<Longrightarrow> insert x A \<in> sets (borel :: 'a::t2_space measure)"
    55   "A \<in> sets borel \<Longrightarrow> insert x A \<in> sets (borel :: 'a::t1_space measure)"
    56   unfolding insert_def by (rule Un) auto
    56   unfolding insert_def by (rule Un) auto
    57 
    57 
    58 lemma borel_comp[intro, simp, measurable]: "A \<in> sets borel \<Longrightarrow> - A \<in> sets borel"
    58 lemma borel_comp[measurable]: "A \<in> sets borel \<Longrightarrow> - A \<in> sets borel"
    59   unfolding Compl_eq_Diff_UNIV by simp
    59   unfolding Compl_eq_Diff_UNIV by simp
    60 
    60 
    61 lemma borel_measurable_vimage:
    61 lemma borel_measurable_vimage:
    62   fixes f :: "'a \<Rightarrow> 'x::t2_space"
    62   fixes f :: "'a \<Rightarrow> 'x::t2_space"
    63   assumes borel[measurable]: "f \<in> borel_measurable M"
    63   assumes borel[measurable]: "f \<in> borel_measurable M"
    72 proof (rule measurable_measure_of, simp_all)
    72 proof (rule measurable_measure_of, simp_all)
    73   fix S :: "'x set" assume "open S" thus "f -` S \<inter> space M \<in> sets M"
    73   fix S :: "'x set" assume "open S" thus "f -` S \<inter> space M \<in> sets M"
    74     using assms[of S] by simp
    74     using assms[of S] by simp
    75 qed
    75 qed
    76 
    76 
    77 lemma borel_singleton[simp, intro]:
    77 lemma borel_measurable_const[measurable (raw)]:
    78   fixes x :: "'a::t1_space"
       
    79   shows "A \<in> sets borel \<Longrightarrow> insert x A \<in> sets borel"
       
    80   proof (rule insert_in_sets)
       
    81     show "{x} \<in> sets borel"
       
    82       using closed_singleton[of x] by (rule borel_closed)
       
    83   qed simp
       
    84 
       
    85 lemma borel_measurable_const[simp, intro, measurable (raw)]:
       
    86   "(\<lambda>x. c) \<in> borel_measurable M"
    78   "(\<lambda>x. c) \<in> borel_measurable M"
    87   by auto
    79   by auto
    88 
    80 
    89 lemma borel_measurable_indicator[simp, intro!]:
    81 lemma borel_measurable_indicator:
    90   assumes A: "A \<in> sets M"
    82   assumes A: "A \<in> sets M"
    91   shows "indicator A \<in> borel_measurable M"
    83   shows "indicator A \<in> borel_measurable M"
    92   unfolding indicator_def [abs_def] using A
    84   unfolding indicator_def [abs_def] using A
    93   by (auto intro!: measurable_If_set)
    85   by (auto intro!: measurable_If_set)
    94 
    86 
   135 
   127 
   136 lemma borel_measurable_euclidean_component:
   128 lemma borel_measurable_euclidean_component:
   137   "(f :: 'a \<Rightarrow> 'b::euclidean_space) \<in> borel_measurable M \<Longrightarrow>(\<lambda>x. f x $$ i) \<in> borel_measurable M"
   129   "(f :: 'a \<Rightarrow> 'b::euclidean_space) \<in> borel_measurable M \<Longrightarrow>(\<lambda>x. f x $$ i) \<in> borel_measurable M"
   138   by simp
   130   by simp
   139 
   131 
   140 lemma [simp, intro, measurable]:
   132 lemma [measurable]:
   141   fixes a b :: "'a\<Colon>ordered_euclidean_space"
   133   fixes a b :: "'a\<Colon>ordered_euclidean_space"
   142   shows lessThan_borel: "{..< a} \<in> sets borel"
   134   shows lessThan_borel: "{..< a} \<in> sets borel"
   143     and greaterThan_borel: "{a <..} \<in> sets borel"
   135     and greaterThan_borel: "{a <..} \<in> sets borel"
   144     and greaterThanLessThan_borel: "{a<..<b} \<in> sets borel"
   136     and greaterThanLessThan_borel: "{a<..<b} \<in> sets borel"
   145     and atMost_borel: "{..a} \<in> sets borel"
   137     and atMost_borel: "{..a} \<in> sets borel"
   149     and atLeastLessThan_borel: "{a..<b} \<in> sets borel"
   141     and atLeastLessThan_borel: "{a..<b} \<in> sets borel"
   150   unfolding greaterThanAtMost_def atLeastLessThan_def
   142   unfolding greaterThanAtMost_def atLeastLessThan_def
   151   by (blast intro: borel_open borel_closed)+
   143   by (blast intro: borel_open borel_closed)+
   152 
   144 
   153 lemma 
   145 lemma 
   154   shows hafspace_less_borel[simp, intro]: "{x::'a::euclidean_space. a < x $$ i} \<in> sets borel"
   146   shows hafspace_less_borel: "{x::'a::euclidean_space. a < x $$ i} \<in> sets borel"
   155     and hafspace_greater_borel[simp, intro]: "{x::'a::euclidean_space. x $$ i < a} \<in> sets borel"
   147     and hafspace_greater_borel: "{x::'a::euclidean_space. x $$ i < a} \<in> sets borel"
   156     and hafspace_less_eq_borel[simp, intro]: "{x::'a::euclidean_space. a \<le> x $$ i} \<in> sets borel"
   148     and hafspace_less_eq_borel: "{x::'a::euclidean_space. a \<le> x $$ i} \<in> sets borel"
   157     and hafspace_greater_eq_borel[simp, intro]: "{x::'a::euclidean_space. x $$ i \<le> a} \<in> sets borel"
   149     and hafspace_greater_eq_borel: "{x::'a::euclidean_space. x $$ i \<le> a} \<in> sets borel"
   158   by simp_all
   150   by simp_all
   159 
   151 
   160 lemma borel_measurable_less[simp, intro, measurable]:
   152 lemma borel_measurable_less[measurable]:
   161   fixes f :: "'a \<Rightarrow> real"
   153   fixes f :: "'a \<Rightarrow> real"
   162   assumes f: "f \<in> borel_measurable M"
   154   assumes f: "f \<in> borel_measurable M"
   163   assumes g: "g \<in> borel_measurable M"
   155   assumes g: "g \<in> borel_measurable M"
   164   shows "{w \<in> space M. f w < g w} \<in> sets M"
   156   shows "{w \<in> space M. f w < g w} \<in> sets M"
   165 proof -
   157 proof -
   167     using Rats_dense_in_real by (auto simp add: Rats_def)
   159     using Rats_dense_in_real by (auto simp add: Rats_def)
   168   with f g show ?thesis
   160   with f g show ?thesis
   169     by simp
   161     by simp
   170 qed
   162 qed
   171 
   163 
   172 lemma [simp, intro]:
   164 lemma
   173   fixes f :: "'a \<Rightarrow> real"
   165   fixes f :: "'a \<Rightarrow> real"
   174   assumes f[measurable]: "f \<in> borel_measurable M"
   166   assumes f[measurable]: "f \<in> borel_measurable M"
   175   assumes g[measurable]: "g \<in> borel_measurable M"
   167   assumes g[measurable]: "g \<in> borel_measurable M"
   176   shows borel_measurable_le[measurable]: "{w \<in> space M. f w \<le> g w} \<in> sets M"
   168   shows borel_measurable_le[measurable]: "{w \<in> space M. f w \<le> g w} \<in> sets M"
   177     and borel_measurable_eq[measurable]: "{w \<in> space M. f w = g w} \<in> sets M"
   169     and borel_measurable_eq[measurable]: "{w \<in> space M. f w = g w} \<in> sets M"
   631   assumes g: "g \<in> borel_measurable M"
   623   assumes g: "g \<in> borel_measurable M"
   632   shows "(\<lambda>x. if g x \<in> A then f (g x) else c) \<in> borel_measurable M"
   624   shows "(\<lambda>x. if g x \<in> A then f (g x) else c) \<in> borel_measurable M"
   633   using measurable_comp[OF g borel_measurable_continuous_on_open'[OF cont], of c]
   625   using measurable_comp[OF g borel_measurable_continuous_on_open'[OF cont], of c]
   634   by (simp add: comp_def)
   626   by (simp add: comp_def)
   635 
   627 
   636 lemma borel_measurable_uminus[simp, intro, measurable (raw)]:
   628 lemma borel_measurable_uminus[measurable (raw)]:
   637   fixes g :: "'a \<Rightarrow> real"
   629   fixes g :: "'a \<Rightarrow> real"
   638   assumes g: "g \<in> borel_measurable M"
   630   assumes g: "g \<in> borel_measurable M"
   639   shows "(\<lambda>x. - g x) \<in> borel_measurable M"
   631   shows "(\<lambda>x. - g x) \<in> borel_measurable M"
   640   by (rule borel_measurable_continuous_on[OF _ g]) (auto intro: continuous_on_minus continuous_on_id)
   632   by (rule borel_measurable_continuous_on[OF _ g]) (auto intro: continuous_on_minus continuous_on_id)
   641 
   633 
   642 lemma euclidean_component_prod:
   634 lemma euclidean_component_prod:
   643   fixes x :: "'a :: euclidean_space \<times> 'b :: euclidean_space"
   635   fixes x :: "'a :: euclidean_space \<times> 'b :: euclidean_space"
   644   shows "x $$ i = (if i < DIM('a) then fst x $$ i else snd x $$ (i - DIM('a)))"
   636   shows "x $$ i = (if i < DIM('a) then fst x $$ i else snd x $$ (i - DIM('a)))"
   645   unfolding euclidean_component_def basis_prod_def inner_prod_def by auto
   637   unfolding euclidean_component_def basis_prod_def inner_prod_def by auto
   646 
   638 
   647 lemma borel_measurable_Pair[simp, intro, measurable (raw)]:
   639 lemma borel_measurable_Pair[measurable (raw)]:
   648   fixes f :: "'a \<Rightarrow> 'b::ordered_euclidean_space" and g :: "'a \<Rightarrow> 'c::ordered_euclidean_space"
   640   fixes f :: "'a \<Rightarrow> 'b::ordered_euclidean_space" and g :: "'a \<Rightarrow> 'c::ordered_euclidean_space"
   649   assumes f: "f \<in> borel_measurable M"
   641   assumes f: "f \<in> borel_measurable M"
   650   assumes g: "g \<in> borel_measurable M"
   642   assumes g: "g \<in> borel_measurable M"
   651   shows "(\<lambda>x. (f x, g x)) \<in> borel_measurable M"
   643   shows "(\<lambda>x. (f x, g x)) \<in> borel_measurable M"
   652 proof (intro borel_measurable_iff_halfspace_le[THEN iffD2] allI impI)
   644 proof (intro borel_measurable_iff_halfspace_le[THEN iffD2] allI impI)
   673     by (auto simp: continuous_on_closed closed_closedin vimage_def)
   665     by (auto simp: continuous_on_closed closed_closedin vimage_def)
   674 qed
   666 qed
   675 
   667 
   676 lemma borel_measurable_continuous_Pair:
   668 lemma borel_measurable_continuous_Pair:
   677   fixes f :: "'a \<Rightarrow> 'b::ordered_euclidean_space" and g :: "'a \<Rightarrow> 'c::ordered_euclidean_space"
   669   fixes f :: "'a \<Rightarrow> 'b::ordered_euclidean_space" and g :: "'a \<Rightarrow> 'c::ordered_euclidean_space"
   678   assumes [simp]: "f \<in> borel_measurable M"
   670   assumes [measurable]: "f \<in> borel_measurable M"
   679   assumes [simp]: "g \<in> borel_measurable M"
   671   assumes [measurable]: "g \<in> borel_measurable M"
   680   assumes H: "continuous_on UNIV (\<lambda>x. H (fst x) (snd x))"
   672   assumes H: "continuous_on UNIV (\<lambda>x. H (fst x) (snd x))"
   681   shows "(\<lambda>x. H (f x) (g x)) \<in> borel_measurable M"
   673   shows "(\<lambda>x. H (f x) (g x)) \<in> borel_measurable M"
   682 proof -
   674 proof -
   683   have eq: "(\<lambda>x. H (f x) (g x)) = (\<lambda>x. (\<lambda>x. H (fst x) (snd x)) (f x, g x))" by auto
   675   have eq: "(\<lambda>x. H (f x) (g x)) = (\<lambda>x. (\<lambda>x. H (fst x) (snd x)) (f x, g x))" by auto
   684   show ?thesis
   676   show ?thesis
   685     unfolding eq by (rule borel_measurable_continuous_on[OF H]) auto
   677     unfolding eq by (rule borel_measurable_continuous_on[OF H]) auto
   686 qed
   678 qed
   687 
   679 
   688 lemma borel_measurable_add[simp, intro, measurable (raw)]:
   680 lemma borel_measurable_add[measurable (raw)]:
   689   fixes f g :: "'a \<Rightarrow> 'c::ordered_euclidean_space"
   681   fixes f g :: "'a \<Rightarrow> 'c::ordered_euclidean_space"
   690   assumes f: "f \<in> borel_measurable M"
   682   assumes f: "f \<in> borel_measurable M"
   691   assumes g: "g \<in> borel_measurable M"
   683   assumes g: "g \<in> borel_measurable M"
   692   shows "(\<lambda>x. f x + g x) \<in> borel_measurable M"
   684   shows "(\<lambda>x. f x + g x) \<in> borel_measurable M"
   693   using f g
   685   using f g
   694   by (rule borel_measurable_continuous_Pair)
   686   by (rule borel_measurable_continuous_Pair)
   695      (auto intro: continuous_on_fst continuous_on_snd continuous_on_add)
   687      (auto intro: continuous_on_fst continuous_on_snd continuous_on_add)
   696 
   688 
   697 lemma borel_measurable_setsum[simp, intro, measurable (raw)]:
   689 lemma borel_measurable_setsum[measurable (raw)]:
   698   fixes f :: "'c \<Rightarrow> 'a \<Rightarrow> real"
   690   fixes f :: "'c \<Rightarrow> 'a \<Rightarrow> real"
   699   assumes "\<And>i. i \<in> S \<Longrightarrow> f i \<in> borel_measurable M"
   691   assumes "\<And>i. i \<in> S \<Longrightarrow> f i \<in> borel_measurable M"
   700   shows "(\<lambda>x. \<Sum>i\<in>S. f i x) \<in> borel_measurable M"
   692   shows "(\<lambda>x. \<Sum>i\<in>S. f i x) \<in> borel_measurable M"
   701 proof cases
   693 proof cases
   702   assume "finite S"
   694   assume "finite S"
   703   thus ?thesis using assms by induct auto
   695   thus ?thesis using assms by induct auto
   704 qed simp
   696 qed simp
   705 
   697 
   706 lemma borel_measurable_diff[simp, intro, measurable (raw)]:
   698 lemma borel_measurable_diff[measurable (raw)]:
   707   fixes f :: "'a \<Rightarrow> real"
   699   fixes f :: "'a \<Rightarrow> real"
   708   assumes f: "f \<in> borel_measurable M"
   700   assumes f: "f \<in> borel_measurable M"
   709   assumes g: "g \<in> borel_measurable M"
   701   assumes g: "g \<in> borel_measurable M"
   710   shows "(\<lambda>x. f x - g x) \<in> borel_measurable M"
   702   shows "(\<lambda>x. f x - g x) \<in> borel_measurable M"
   711   unfolding diff_minus using assms by fast
   703   unfolding diff_minus using assms by simp
   712 
   704 
   713 lemma borel_measurable_times[simp, intro, measurable (raw)]:
   705 lemma borel_measurable_times[measurable (raw)]:
   714   fixes f :: "'a \<Rightarrow> real"
   706   fixes f :: "'a \<Rightarrow> real"
   715   assumes f: "f \<in> borel_measurable M"
   707   assumes f: "f \<in> borel_measurable M"
   716   assumes g: "g \<in> borel_measurable M"
   708   assumes g: "g \<in> borel_measurable M"
   717   shows "(\<lambda>x. f x * g x) \<in> borel_measurable M"
   709   shows "(\<lambda>x. f x * g x) \<in> borel_measurable M"
   718   using f g
   710   using f g
   722 lemma continuous_on_dist:
   714 lemma continuous_on_dist:
   723   fixes f :: "'a :: t2_space \<Rightarrow> 'b :: metric_space"
   715   fixes f :: "'a :: t2_space \<Rightarrow> 'b :: metric_space"
   724   shows "continuous_on A f \<Longrightarrow> continuous_on A g \<Longrightarrow> continuous_on A (\<lambda>x. dist (f x) (g x))"
   716   shows "continuous_on A f \<Longrightarrow> continuous_on A g \<Longrightarrow> continuous_on A (\<lambda>x. dist (f x) (g x))"
   725   unfolding continuous_on_eq_continuous_within by (auto simp: continuous_dist)
   717   unfolding continuous_on_eq_continuous_within by (auto simp: continuous_dist)
   726 
   718 
   727 lemma borel_measurable_dist[simp, intro, measurable (raw)]:
   719 lemma borel_measurable_dist[measurable (raw)]:
   728   fixes g f :: "'a \<Rightarrow> 'b::ordered_euclidean_space"
   720   fixes g f :: "'a \<Rightarrow> 'b::ordered_euclidean_space"
   729   assumes f: "f \<in> borel_measurable M"
   721   assumes f: "f \<in> borel_measurable M"
   730   assumes g: "g \<in> borel_measurable M"
   722   assumes g: "g \<in> borel_measurable M"
   731   shows "(\<lambda>x. dist (f x) (g x)) \<in> borel_measurable M"
   723   shows "(\<lambda>x. dist (f x) (g x)) \<in> borel_measurable M"
   732   using f g
   724   using f g
   767 
   759 
   768 lemma borel_measurable_const_add[measurable (raw)]:
   760 lemma borel_measurable_const_add[measurable (raw)]:
   769   "f \<in> borel_measurable M \<Longrightarrow> (\<lambda>x. a + f x ::'a::real_normed_vector) \<in> borel_measurable M"
   761   "f \<in> borel_measurable M \<Longrightarrow> (\<lambda>x. a + f x ::'a::real_normed_vector) \<in> borel_measurable M"
   770   using affine_borel_measurable_vector[of f M a 1] by simp
   762   using affine_borel_measurable_vector[of f M a 1] by simp
   771 
   763 
   772 lemma borel_measurable_setprod[simp, intro, measurable (raw)]:
   764 lemma borel_measurable_setprod[measurable (raw)]:
   773   fixes f :: "'c \<Rightarrow> 'a \<Rightarrow> real"
   765   fixes f :: "'c \<Rightarrow> 'a \<Rightarrow> real"
   774   assumes "\<And>i. i \<in> S \<Longrightarrow> f i \<in> borel_measurable M"
   766   assumes "\<And>i. i \<in> S \<Longrightarrow> f i \<in> borel_measurable M"
   775   shows "(\<lambda>x. \<Prod>i\<in>S. f i x) \<in> borel_measurable M"
   767   shows "(\<lambda>x. \<Prod>i\<in>S. f i x) \<in> borel_measurable M"
   776 proof cases
   768 proof cases
   777   assume "finite S"
   769   assume "finite S"
   778   thus ?thesis using assms by induct auto
   770   thus ?thesis using assms by induct auto
   779 qed simp
   771 qed simp
   780 
   772 
   781 lemma borel_measurable_inverse[simp, intro, measurable (raw)]:
   773 lemma borel_measurable_inverse[measurable (raw)]:
   782   fixes f :: "'a \<Rightarrow> real"
   774   fixes f :: "'a \<Rightarrow> real"
   783   assumes f: "f \<in> borel_measurable M"
   775   assumes f: "f \<in> borel_measurable M"
   784   shows "(\<lambda>x. inverse (f x)) \<in> borel_measurable M"
   776   shows "(\<lambda>x. inverse (f x)) \<in> borel_measurable M"
   785 proof -
   777 proof -
   786   have *: "\<And>x::real. inverse x = (if x \<in> UNIV - {0} then inverse x else 0)" by auto
   778   have "(\<lambda>x::real. if x \<in> UNIV - {0} then inverse x else 0) \<in> borel_measurable borel"
   787   show ?thesis
   779     by (intro borel_measurable_continuous_on_open' continuous_on_inverse continuous_on_id) auto
   788     apply (subst *)
   780   also have "(\<lambda>x::real. if x \<in> UNIV - {0} then inverse x else 0) = inverse" by (intro ext) auto
   789     apply (rule borel_measurable_continuous_on_open)
   781   finally show ?thesis using f by simp
   790     apply (auto intro!: f continuous_on_inverse continuous_on_id)
   782 qed
   791     done
   783 
   792 qed
   784 lemma borel_measurable_divide[measurable (raw)]:
   793 
   785   "f \<in> borel_measurable M \<Longrightarrow> g \<in> borel_measurable M \<Longrightarrow> (\<lambda>x. f x / g x::real) \<in> borel_measurable M"
   794 lemma borel_measurable_divide[simp, intro, measurable (raw)]:
   786   by (simp add: field_divide_inverse)
   795   fixes f :: "'a \<Rightarrow> real"
   787 
   796   assumes "f \<in> borel_measurable M"
   788 lemma borel_measurable_max[measurable (raw)]:
   797   and "g \<in> borel_measurable M"
   789   "f \<in> borel_measurable M \<Longrightarrow> g \<in> borel_measurable M \<Longrightarrow> (\<lambda>x. max (g x) (f x) :: real) \<in> borel_measurable M"
   798   shows "(\<lambda>x. f x / g x) \<in> borel_measurable M"
   790   by (simp add: max_def)
   799   unfolding field_divide_inverse
   791 
   800   by (rule borel_measurable_inverse borel_measurable_times assms)+
   792 lemma borel_measurable_min[measurable (raw)]:
   801 
   793   "f \<in> borel_measurable M \<Longrightarrow> g \<in> borel_measurable M \<Longrightarrow> (\<lambda>x. min (g x) (f x) :: real) \<in> borel_measurable M"
   802 lemma borel_measurable_max[intro, simp, measurable (raw)]:
   794   by (simp add: min_def)
   803   fixes f g :: "'a \<Rightarrow> real"
   795 
   804   assumes "f \<in> borel_measurable M"
   796 lemma borel_measurable_abs[measurable (raw)]:
   805   assumes "g \<in> borel_measurable M"
   797   "f \<in> borel_measurable M \<Longrightarrow> (\<lambda>x. \<bar>f x :: real\<bar>) \<in> borel_measurable M"
   806   shows "(\<lambda>x. max (g x) (f x)) \<in> borel_measurable M"
   798   unfolding abs_real_def by simp
   807   unfolding max_def by (auto intro!: assms measurable_If)
   799 
   808 
   800 lemma borel_measurable_nth[measurable (raw)]:
   809 lemma borel_measurable_min[intro, simp, measurable (raw)]:
       
   810   fixes f g :: "'a \<Rightarrow> real"
       
   811   assumes "f \<in> borel_measurable M"
       
   812   assumes "g \<in> borel_measurable M"
       
   813   shows "(\<lambda>x. min (g x) (f x)) \<in> borel_measurable M"
       
   814   unfolding min_def by (auto intro!: assms measurable_If)
       
   815 
       
   816 lemma borel_measurable_abs[simp, intro, measurable (raw)]:
       
   817   assumes "f \<in> borel_measurable M"
       
   818   shows "(\<lambda>x. \<bar>f x :: real\<bar>) \<in> borel_measurable M"
       
   819 proof -
       
   820   have *: "\<And>x. \<bar>f x\<bar> = max 0 (f x) + max 0 (- f x)" by (simp add: max_def)
       
   821   show ?thesis unfolding * using assms by auto
       
   822 qed
       
   823 
       
   824 lemma borel_measurable_nth[simp, intro, measurable (raw)]:
       
   825   "(\<lambda>x::real^'n. x $ i) \<in> borel_measurable borel"
   801   "(\<lambda>x::real^'n. x $ i) \<in> borel_measurable borel"
   826   using borel_measurable_euclidean_component'
   802   by (simp add: nth_conv_component)
   827   unfolding nth_conv_component by auto
       
   828 
   803 
   829 lemma convex_measurable:
   804 lemma convex_measurable:
   830   fixes a b :: real
   805   fixes a b :: real
   831   assumes X: "X \<in> borel_measurable M" "X ` space M \<subseteq> { a <..< b}"
   806   assumes X: "X \<in> borel_measurable M" "X ` space M \<subseteq> { a <..< b}"
   832   assumes q: "convex_on { a <..< b} q"
   807   assumes q: "convex_on { a <..< b} q"
   841   also have "?qX \<longleftrightarrow> (\<lambda>x. q (X x)) \<in> borel_measurable M"
   816   also have "?qX \<longleftrightarrow> (\<lambda>x. q (X x)) \<in> borel_measurable M"
   842     using X by (intro measurable_cong) auto
   817     using X by (intro measurable_cong) auto
   843   finally show ?thesis .
   818   finally show ?thesis .
   844 qed
   819 qed
   845 
   820 
   846 lemma borel_measurable_ln[simp, intro, measurable (raw)]:
   821 lemma borel_measurable_ln[measurable (raw)]:
   847   assumes f: "f \<in> borel_measurable M"
   822   assumes f: "f \<in> borel_measurable M"
   848   shows "(\<lambda>x. ln (f x)) \<in> borel_measurable M"
   823   shows "(\<lambda>x. ln (f x)) \<in> borel_measurable M"
   849 proof -
   824 proof -
   850   { fix x :: real assume x: "x \<le> 0"
   825   { fix x :: real assume x: "x \<le> 0"
   851     { fix x::real assume "x \<le> 0" then have "\<And>u. exp u = x \<longleftrightarrow> False" by auto }
   826     { fix x::real assume "x \<le> 0" then have "\<And>u. exp u = x \<longleftrightarrow> False" by auto }
   862   also have "(\<lambda>x. if x \<in> {0<..} then ln x else ln 0) = ln"
   837   also have "(\<lambda>x. if x \<in> {0<..} then ln x else ln 0) = ln"
   863     by (simp add: fun_eq_iff not_less ln_imp)
   838     by (simp add: fun_eq_iff not_less ln_imp)
   864   finally show ?thesis .
   839   finally show ?thesis .
   865 qed
   840 qed
   866 
   841 
   867 lemma borel_measurable_log[simp, intro, measurable (raw)]:
   842 lemma borel_measurable_log[measurable (raw)]:
   868   "f \<in> borel_measurable M \<Longrightarrow> g \<in> borel_measurable M \<Longrightarrow> (\<lambda>x. log (g x) (f x)) \<in> borel_measurable M"
   843   "f \<in> borel_measurable M \<Longrightarrow> g \<in> borel_measurable M \<Longrightarrow> (\<lambda>x. log (g x) (f x)) \<in> borel_measurable M"
   869   unfolding log_def by auto
   844   unfolding log_def by auto
   870 
   845 
   871 lemma measurable_count_space_eq2_countable:
   846 lemma measurable_count_space_eq2_countable:
   872   fixes f :: "'a => 'c::countable"
   847   fixes f :: "'a => 'c::countable"
   900   unfolding ceiling_def[abs_def] by simp
   875   unfolding ceiling_def[abs_def] by simp
   901 
   876 
   902 lemma borel_measurable_real_floor: "(\<lambda>x::real. real \<lfloor>x\<rfloor>) \<in> borel_measurable borel"
   877 lemma borel_measurable_real_floor: "(\<lambda>x::real. real \<lfloor>x\<rfloor>) \<in> borel_measurable borel"
   903   by simp
   878   by simp
   904 
   879 
   905 lemma borel_measurable_real_natfloor[intro, simp]:
   880 lemma borel_measurable_real_natfloor:
   906   "f \<in> borel_measurable M \<Longrightarrow> (\<lambda>x. real (natfloor (f x))) \<in> borel_measurable M"
   881   "f \<in> borel_measurable M \<Longrightarrow> (\<lambda>x. real (natfloor (f x))) \<in> borel_measurable M"
   907   by simp
   882   by simp
   908 
   883 
   909 subsection "Borel space on the extended reals"
   884 subsection "Borel space on the extended reals"
   910 
   885 
   911 lemma borel_measurable_ereal[simp, intro, measurable (raw)]:
   886 lemma borel_measurable_ereal[measurable (raw)]:
   912   assumes f: "f \<in> borel_measurable M" shows "(\<lambda>x. ereal (f x)) \<in> borel_measurable M"
   887   assumes f: "f \<in> borel_measurable M" shows "(\<lambda>x. ereal (f x)) \<in> borel_measurable M"
   913   using continuous_on_ereal f by (rule borel_measurable_continuous_on)
   888   using continuous_on_ereal f by (rule borel_measurable_continuous_on)
   914 
   889 
   915 lemma borel_measurable_real_of_ereal[simp, intro, measurable (raw)]:
   890 lemma borel_measurable_real_of_ereal[measurable (raw)]:
   916   fixes f :: "'a \<Rightarrow> ereal" 
   891   fixes f :: "'a \<Rightarrow> ereal" 
   917   assumes f: "f \<in> borel_measurable M"
   892   assumes f: "f \<in> borel_measurable M"
   918   shows "(\<lambda>x. real (f x)) \<in> borel_measurable M"
   893   shows "(\<lambda>x. real (f x)) \<in> borel_measurable M"
   919 proof -
   894 proof -
   920   have "(\<lambda>x. if f x \<in> UNIV - { \<infinity>, - \<infinity> } then real (f x) else 0) \<in> borel_measurable M"
   895   have "(\<lambda>x. if f x \<in> UNIV - { \<infinity>, - \<infinity> } then real (f x) else 0) \<in> borel_measurable M"
   935   { fix x have "H (f x) = ?F x" by (cases "f x") auto }
   910   { fix x have "H (f x) = ?F x" by (cases "f x") auto }
   936   with f H show ?thesis by simp
   911   with f H show ?thesis by simp
   937 qed
   912 qed
   938 
   913 
   939 lemma
   914 lemma
   940   fixes f :: "'a \<Rightarrow> ereal" assumes f[simp]: "f \<in> borel_measurable M"
   915   fixes f :: "'a \<Rightarrow> ereal" assumes f[measurable]: "f \<in> borel_measurable M"
   941   shows borel_measurable_ereal_abs[intro, simp, measurable(raw)]: "(\<lambda>x. \<bar>f x\<bar>) \<in> borel_measurable M"
   916   shows borel_measurable_ereal_abs[measurable(raw)]: "(\<lambda>x. \<bar>f x\<bar>) \<in> borel_measurable M"
   942     and borel_measurable_ereal_inverse[simp, intro, measurable(raw)]: "(\<lambda>x. inverse (f x) :: ereal) \<in> borel_measurable M"
   917     and borel_measurable_ereal_inverse[measurable(raw)]: "(\<lambda>x. inverse (f x) :: ereal) \<in> borel_measurable M"
   943     and borel_measurable_uminus_ereal[intro, measurable(raw)]: "(\<lambda>x. - f x :: ereal) \<in> borel_measurable M"
   918     and borel_measurable_uminus_ereal[measurable(raw)]: "(\<lambda>x. - f x :: ereal) \<in> borel_measurable M"
   944   by (auto simp del: abs_real_of_ereal simp: borel_measurable_ereal_cases[OF f] measurable_If)
   919   by (auto simp del: abs_real_of_ereal simp: borel_measurable_ereal_cases[OF f] measurable_If)
   945 
   920 
   946 lemma borel_measurable_uminus_eq_ereal[simp]:
   921 lemma borel_measurable_uminus_eq_ereal[simp]:
   947   "(\<lambda>x. - f x :: ereal) \<in> borel_measurable M \<longleftrightarrow> f \<in> borel_measurable M" (is "?l = ?r")
   922   "(\<lambda>x. - f x :: ereal) \<in> borel_measurable M \<longleftrightarrow> f \<in> borel_measurable M" (is "?l = ?r")
   948 proof
   923 proof
   966   note * = this
   941   note * = this
   967   from assms show ?thesis
   942   from assms show ?thesis
   968     by (subst *) (simp del: space_borel split del: split_if)
   943     by (subst *) (simp del: space_borel split del: split_if)
   969 qed
   944 qed
   970 
   945 
   971 lemma
   946 lemma [measurable]:
   972   fixes f g :: "'a \<Rightarrow> ereal"
   947   fixes f g :: "'a \<Rightarrow> ereal"
   973   assumes f: "f \<in> borel_measurable M"
   948   assumes f: "f \<in> borel_measurable M"
   974   assumes g: "g \<in> borel_measurable M"
   949   assumes g: "g \<in> borel_measurable M"
   975   shows borel_measurable_ereal_le[intro,simp,measurable(raw)]: "{x \<in> space M. f x \<le> g x} \<in> sets M"
   950   shows borel_measurable_ereal_le: "{x \<in> space M. f x \<le> g x} \<in> sets M"
   976     and borel_measurable_ereal_less[intro,simp,measurable(raw)]: "{x \<in> space M. f x < g x} \<in> sets M"
   951     and borel_measurable_ereal_less: "{x \<in> space M. f x < g x} \<in> sets M"
   977     and borel_measurable_ereal_eq[intro,simp,measurable(raw)]: "{w \<in> space M. f w = g w} \<in> sets M"
   952     and borel_measurable_ereal_eq: "{w \<in> space M. f w = g w} \<in> sets M"
   978     and borel_measurable_ereal_neq[intro,simp]: "{w \<in> space M. f w \<noteq> g w} \<in> sets M"
   953   using f g by (simp_all add: set_Collect_ereal2)
   979   using f g by (auto simp: f g set_Collect_ereal2[OF f g] intro!: sets_Collect_neg)
   954 
       
   955 lemma borel_measurable_ereal_neq:
       
   956   "f \<in> borel_measurable M \<Longrightarrow> g \<in> borel_measurable M \<Longrightarrow> {w \<in> space M. f w \<noteq> (g w :: ereal)} \<in> sets M"
       
   957   by simp
   980 
   958 
   981 lemma borel_measurable_ereal_iff:
   959 lemma borel_measurable_ereal_iff:
   982   shows "(\<lambda>x. ereal (f x)) \<in> borel_measurable M \<longleftrightarrow> f \<in> borel_measurable M"
   960   shows "(\<lambda>x. ereal (f x)) \<in> borel_measurable M \<longleftrightarrow> f \<in> borel_measurable M"
   983 proof
   961 proof
   984   assume "(\<lambda>x. ereal (f x)) \<in> borel_measurable M"
   962   assume "(\<lambda>x. ereal (f x)) \<in> borel_measurable M"
  1100   fixes f :: "'a \<Rightarrow> ereal" assumes f: "f \<in> borel_measurable M"
  1078   fixes f :: "'a \<Rightarrow> ereal" assumes f: "f \<in> borel_measurable M"
  1101   shows borel_measurable_ereal_eq_const: "{x\<in>space M. f x = c} \<in> sets M"
  1079   shows borel_measurable_ereal_eq_const: "{x\<in>space M. f x = c} \<in> sets M"
  1102     and borel_measurable_ereal_neq_const: "{x\<in>space M. f x \<noteq> c} \<in> sets M"
  1080     and borel_measurable_ereal_neq_const: "{x\<in>space M. f x \<noteq> c} \<in> sets M"
  1103   using f by auto
  1081   using f by auto
  1104 
  1082 
  1105 lemma [intro, simp, measurable(raw)]:
  1083 lemma [measurable(raw)]:
  1106   fixes f :: "'a \<Rightarrow> ereal"
  1084   fixes f :: "'a \<Rightarrow> ereal"
  1107   assumes [simp]: "f \<in> borel_measurable M" "g \<in> borel_measurable M"
  1085   assumes [measurable]: "f \<in> borel_measurable M" "g \<in> borel_measurable M"
  1108   shows borel_measurable_ereal_add: "(\<lambda>x. f x + g x) \<in> borel_measurable M"
  1086   shows borel_measurable_ereal_add: "(\<lambda>x. f x + g x) \<in> borel_measurable M"
  1109     and borel_measurable_ereal_times: "(\<lambda>x. f x * g x) \<in> borel_measurable M"
  1087     and borel_measurable_ereal_times: "(\<lambda>x. f x * g x) \<in> borel_measurable M"
  1110     and borel_measurable_ereal_min: "(\<lambda>x. min (g x) (f x)) \<in> borel_measurable M"
  1088     and borel_measurable_ereal_min: "(\<lambda>x. min (g x) (f x)) \<in> borel_measurable M"
  1111     and borel_measurable_ereal_max: "(\<lambda>x. max (g x) (f x)) \<in> borel_measurable M"
  1089     and borel_measurable_ereal_max: "(\<lambda>x. max (g x) (f x)) \<in> borel_measurable M"
  1112   by (auto simp add: borel_measurable_ereal2 measurable_If min_def max_def)
  1090   by (simp_all add: borel_measurable_ereal2 min_def max_def)
  1113 
  1091 
  1114 lemma [simp, intro, measurable(raw)]:
  1092 lemma [measurable(raw)]:
  1115   fixes f g :: "'a \<Rightarrow> ereal"
  1093   fixes f g :: "'a \<Rightarrow> ereal"
  1116   assumes "f \<in> borel_measurable M"
  1094   assumes "f \<in> borel_measurable M"
  1117   assumes "g \<in> borel_measurable M"
  1095   assumes "g \<in> borel_measurable M"
  1118   shows borel_measurable_ereal_diff: "(\<lambda>x. f x - g x) \<in> borel_measurable M"
  1096   shows borel_measurable_ereal_diff: "(\<lambda>x. f x - g x) \<in> borel_measurable M"
  1119     and borel_measurable_ereal_divide: "(\<lambda>x. f x / g x) \<in> borel_measurable M"
  1097     and borel_measurable_ereal_divide: "(\<lambda>x. f x / g x) \<in> borel_measurable M"
  1120   unfolding minus_ereal_def divide_ereal_def using assms by auto
  1098   using assms by (simp_all add: minus_ereal_def divide_ereal_def)
  1121 
  1099 
  1122 lemma borel_measurable_ereal_setsum[simp, intro,measurable (raw)]:
  1100 lemma borel_measurable_ereal_setsum[measurable (raw)]:
  1123   fixes f :: "'c \<Rightarrow> 'a \<Rightarrow> ereal"
  1101   fixes f :: "'c \<Rightarrow> 'a \<Rightarrow> ereal"
  1124   assumes "\<And>i. i \<in> S \<Longrightarrow> f i \<in> borel_measurable M"
  1102   assumes "\<And>i. i \<in> S \<Longrightarrow> f i \<in> borel_measurable M"
  1125   shows "(\<lambda>x. \<Sum>i\<in>S. f i x) \<in> borel_measurable M"
  1103   shows "(\<lambda>x. \<Sum>i\<in>S. f i x) \<in> borel_measurable M"
  1126 proof cases
  1104 proof cases
  1127   assume "finite S"
  1105   assume "finite S"
  1128   thus ?thesis using assms
  1106   thus ?thesis using assms
  1129     by induct auto
  1107     by induct auto
  1130 qed simp
  1108 qed simp
  1131 
  1109 
  1132 lemma borel_measurable_ereal_setprod[simp, intro,measurable (raw)]:
  1110 lemma borel_measurable_ereal_setprod[measurable (raw)]:
  1133   fixes f :: "'c \<Rightarrow> 'a \<Rightarrow> ereal"
  1111   fixes f :: "'c \<Rightarrow> 'a \<Rightarrow> ereal"
  1134   assumes "\<And>i. i \<in> S \<Longrightarrow> f i \<in> borel_measurable M"
  1112   assumes "\<And>i. i \<in> S \<Longrightarrow> f i \<in> borel_measurable M"
  1135   shows "(\<lambda>x. \<Prod>i\<in>S. f i x) \<in> borel_measurable M"
  1113   shows "(\<lambda>x. \<Prod>i\<in>S. f i x) \<in> borel_measurable M"
  1136 proof cases
  1114 proof cases
  1137   assume "finite S"
  1115   assume "finite S"
  1138   thus ?thesis using assms by induct auto
  1116   thus ?thesis using assms by induct auto
  1139 qed simp
  1117 qed simp
  1140 
  1118 
  1141 lemma borel_measurable_SUP[simp, intro,measurable (raw)]:
  1119 lemma borel_measurable_SUP[measurable (raw)]:
  1142   fixes f :: "'d\<Colon>countable \<Rightarrow> 'a \<Rightarrow> ereal"
  1120   fixes f :: "'d\<Colon>countable \<Rightarrow> 'a \<Rightarrow> ereal"
  1143   assumes "\<And>i. i \<in> A \<Longrightarrow> f i \<in> borel_measurable M"
  1121   assumes "\<And>i. i \<in> A \<Longrightarrow> f i \<in> borel_measurable M"
  1144   shows "(\<lambda>x. SUP i : A. f i x) \<in> borel_measurable M" (is "?sup \<in> borel_measurable M")
  1122   shows "(\<lambda>x. SUP i : A. f i x) \<in> borel_measurable M" (is "?sup \<in> borel_measurable M")
  1145   unfolding borel_measurable_ereal_iff_ge
  1123   unfolding borel_measurable_ereal_iff_ge
  1146 proof
  1124 proof
  1149     by (auto simp: less_SUP_iff)
  1127     by (auto simp: less_SUP_iff)
  1150   then show "?sup -` {a<..} \<inter> space M \<in> sets M"
  1128   then show "?sup -` {a<..} \<inter> space M \<in> sets M"
  1151     using assms by auto
  1129     using assms by auto
  1152 qed
  1130 qed
  1153 
  1131 
  1154 lemma borel_measurable_INF[simp, intro,measurable (raw)]:
  1132 lemma borel_measurable_INF[measurable (raw)]:
  1155   fixes f :: "'d :: countable \<Rightarrow> 'a \<Rightarrow> ereal"
  1133   fixes f :: "'d :: countable \<Rightarrow> 'a \<Rightarrow> ereal"
  1156   assumes "\<And>i. i \<in> A \<Longrightarrow> f i \<in> borel_measurable M"
  1134   assumes "\<And>i. i \<in> A \<Longrightarrow> f i \<in> borel_measurable M"
  1157   shows "(\<lambda>x. INF i : A. f i x) \<in> borel_measurable M" (is "?inf \<in> borel_measurable M")
  1135   shows "(\<lambda>x. INF i : A. f i x) \<in> borel_measurable M" (is "?inf \<in> borel_measurable M")
  1158   unfolding borel_measurable_ereal_iff_less
  1136   unfolding borel_measurable_ereal_iff_less
  1159 proof
  1137 proof
  1162     by (auto simp: INF_less_iff)
  1140     by (auto simp: INF_less_iff)
  1163   then show "?inf -` {..<a} \<inter> space M \<in> sets M"
  1141   then show "?inf -` {..<a} \<inter> space M \<in> sets M"
  1164     using assms by auto
  1142     using assms by auto
  1165 qed
  1143 qed
  1166 
  1144 
  1167 lemma [simp, intro, measurable (raw)]:
  1145 lemma [measurable (raw)]:
  1168   fixes f :: "nat \<Rightarrow> 'a \<Rightarrow> ereal"
  1146   fixes f :: "nat \<Rightarrow> 'a \<Rightarrow> ereal"
  1169   assumes "\<And>i. f i \<in> borel_measurable M"
  1147   assumes "\<And>i. f i \<in> borel_measurable M"
  1170   shows borel_measurable_liminf: "(\<lambda>x. liminf (\<lambda>i. f i x)) \<in> borel_measurable M"
  1148   shows borel_measurable_liminf: "(\<lambda>x. liminf (\<lambda>i. f i x)) \<in> borel_measurable M"
  1171     and borel_measurable_limsup: "(\<lambda>x. limsup (\<lambda>i. f i x)) \<in> borel_measurable M"
  1149     and borel_measurable_limsup: "(\<lambda>x. limsup (\<lambda>i. f i x)) \<in> borel_measurable M"
  1172   unfolding liminf_SUPR_INFI limsup_INFI_SUPR using assms by auto
  1150   unfolding liminf_SUPR_INFI limsup_INFI_SUPR using assms by auto
  1173 
  1151 
       
  1152 lemma sets_Collect_eventually_sequientially[measurable]:
       
  1153   "(\<And>i. {x\<in>space M. P x i} \<in> sets M) \<Longrightarrow> {x\<in>space M. eventually (P x) sequentially} \<in> sets M"
       
  1154   unfolding eventually_sequentially by simp
       
  1155 
       
  1156 lemma convergent_ereal:
       
  1157   fixes X :: "nat \<Rightarrow> ereal"
       
  1158   shows "convergent X \<longleftrightarrow> limsup X = liminf X"
       
  1159   using ereal_Liminf_eq_Limsup_iff[of sequentially]
       
  1160   by (auto simp: convergent_def)
       
  1161 
       
  1162 lemma convergent_ereal_limsup:
       
  1163   fixes X :: "nat \<Rightarrow> ereal"
       
  1164   shows "convergent X \<Longrightarrow> limsup X = lim X"
       
  1165   by (auto simp: convergent_def limI lim_imp_Limsup)
       
  1166 
       
  1167 lemma sets_Collect_ereal_convergent[measurable]: 
       
  1168   fixes f :: "nat \<Rightarrow> 'a => ereal"
       
  1169   assumes f[measurable]: "\<And>i. f i \<in> borel_measurable M"
       
  1170   shows "{x\<in>space M. convergent (\<lambda>i. f i x)} \<in> sets M"
       
  1171   unfolding convergent_ereal by auto
       
  1172 
       
  1173 lemma borel_measurable_extreal_lim[measurable (raw)]:
       
  1174   fixes f :: "nat \<Rightarrow> 'a \<Rightarrow> ereal"
       
  1175   assumes [measurable]: "\<And>i. f i \<in> borel_measurable M"
       
  1176   shows "(\<lambda>x. lim (\<lambda>i. f i x)) \<in> borel_measurable M"
       
  1177 proof -
       
  1178   have "\<And>x. lim (\<lambda>i. f i x) = (if convergent (\<lambda>i. f i x) then limsup (\<lambda>i. f i x) else (THE i. False))"
       
  1179     using convergent_ereal_limsup by (simp add: lim_def convergent_def)
       
  1180   then show ?thesis
       
  1181     by simp
       
  1182 qed
       
  1183 
  1174 lemma borel_measurable_ereal_LIMSEQ:
  1184 lemma borel_measurable_ereal_LIMSEQ:
  1175   fixes u :: "nat \<Rightarrow> 'a \<Rightarrow> ereal"
  1185   fixes u :: "nat \<Rightarrow> 'a \<Rightarrow> ereal"
  1176   assumes u': "\<And>x. x \<in> space M \<Longrightarrow> (\<lambda>i. u i x) ----> u' x"
  1186   assumes u': "\<And>x. x \<in> space M \<Longrightarrow> (\<lambda>i. u i x) ----> u' x"
  1177   and u: "\<And>i. u i \<in> borel_measurable M"
  1187   and u: "\<And>i. u i \<in> borel_measurable M"
  1178   shows "u' \<in> borel_measurable M"
  1188   shows "u' \<in> borel_measurable M"
  1179 proof -
  1189 proof -
  1180   have "\<And>x. x \<in> space M \<Longrightarrow> u' x = liminf (\<lambda>n. u n x)"
  1190   have "\<And>x. x \<in> space M \<Longrightarrow> u' x = liminf (\<lambda>n. u n x)"
  1181     using u' by (simp add: lim_imp_Liminf[symmetric])
  1191     using u' by (simp add: lim_imp_Liminf[symmetric])
  1182   then show ?thesis by (simp add: u cong: measurable_cong)
  1192   with u show ?thesis by (simp cong: measurable_cong)
  1183 qed
  1193 qed
  1184 
  1194 
  1185 lemma borel_measurable_psuminf[simp, intro, measurable (raw)]:
  1195 lemma borel_measurable_extreal_suminf[measurable (raw)]:
  1186   fixes f :: "nat \<Rightarrow> 'a \<Rightarrow> ereal"
  1196   fixes f :: "nat \<Rightarrow> 'a \<Rightarrow> ereal"
  1187   assumes "\<And>i. f i \<in> borel_measurable M" and pos: "\<And>i x. x \<in> space M \<Longrightarrow> 0 \<le> f i x"
  1197   assumes [measurable]: "\<And>i. f i \<in> borel_measurable M"
  1188   shows "(\<lambda>x. (\<Sum>i. f i x)) \<in> borel_measurable M"
  1198   shows "(\<lambda>x. (\<Sum>i. f i x)) \<in> borel_measurable M"
  1189   apply (subst measurable_cong)
  1199   unfolding suminf_def sums_def[abs_def] lim_def[symmetric] by simp
  1190   apply (subst suminf_ereal_eq_SUPR)
       
  1191   apply (rule pos)
       
  1192   using assms by auto
       
  1193 
  1200 
  1194 section "LIMSEQ is borel measurable"
  1201 section "LIMSEQ is borel measurable"
  1195 
  1202 
  1196 lemma borel_measurable_LIMSEQ:
  1203 lemma borel_measurable_LIMSEQ:
  1197   fixes u :: "nat \<Rightarrow> 'a \<Rightarrow> real"
  1204   fixes u :: "nat \<Rightarrow> 'a \<Rightarrow> real"