src/HOL/Probability/Borel.thy
author hoelzl
Thu, 26 Aug 2010 18:41:54 +0200
changeset 39083 e46acc0ea1fe
parent 38705 aaee86c0e237
child 39087 96984bf6fa5b
permissions -rw-r--r--
introduced integration on subalgebras
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
     1
(* Author: Armin Heller, Johannes Hoelzl, TU Muenchen *)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
     2
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
     3
header {*Borel spaces*}
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
     4
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
     5
theory Borel
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
     6
  imports Sigma_Algebra Positive_Infinite_Real Multivariate_Analysis
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
     7
begin
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
     8
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
     9
section "Generic Borel spaces"
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
    10
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    11
definition "borel_space = sigma (UNIV::'a::topological_space set) open"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    12
abbreviation "borel_measurable M \<equiv> measurable M borel_space"
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
    13
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    14
interpretation borel_space: sigma_algebra borel_space
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    15
  using sigma_algebra_sigma by (auto simp: borel_space_def)
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
    16
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
    17
lemma in_borel_measurable:
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
    18
   "f \<in> borel_measurable M \<longleftrightarrow>
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    19
    (\<forall>S \<in> sets (sigma UNIV open).
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    20
      f -` S \<inter> space M \<in> sets M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    21
  by (auto simp add: measurable_def borel_space_def)
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
    22
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    23
lemma in_borel_measurable_borel_space:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    24
   "f \<in> borel_measurable M \<longleftrightarrow>
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    25
    (\<forall>S \<in> sets borel_space.
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    26
      f -` S \<inter> space M \<in> sets M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    27
  by (auto simp add: measurable_def borel_space_def)
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
    28
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    29
lemma space_borel_space[simp]: "space borel_space = UNIV"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    30
  unfolding borel_space_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    31
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    32
lemma borel_space_open[simp]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    33
  assumes "open A" shows "A \<in> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    34
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    35
  have "A \<in> open" unfolding mem_def using assms .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    36
  thus ?thesis unfolding borel_space_def sigma_def by (auto intro!: sigma_sets.Basic)
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
    37
qed
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
    38
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    39
lemma borel_space_closed[simp]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    40
  assumes "closed A" shows "A \<in> sets borel_space"
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
    41
proof -
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    42
  have "space borel_space - (- A) \<in> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    43
    using assms unfolding closed_def by (blast intro: borel_space_open)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    44
  thus ?thesis by simp
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
    45
qed
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
    46
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    47
lemma (in sigma_algebra) borel_measurable_vimage:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    48
  fixes f :: "'a \<Rightarrow> 'x::t2_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    49
  assumes borel: "f \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    50
  shows "f -` {x} \<inter> space M \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    51
proof (cases "x \<in> f ` space M")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    52
  case True then obtain y where "x = f y" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    53
  from closed_sing[of "f y"]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    54
  have "{f y} \<in> sets borel_space" by (rule borel_space_closed)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    55
  with assms show ?thesis
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    56
    unfolding in_borel_measurable_borel_space `x = f y` by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    57
next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    58
  case False hence "f -` {x} \<inter> space M = {}" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    59
  thus ?thesis by auto
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
    60
qed
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
    61
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    62
lemma (in sigma_algebra) borel_measurableI:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    63
  fixes f :: "'a \<Rightarrow> 'x\<Colon>topological_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    64
  assumes "\<And>S. open S \<Longrightarrow> f -` S \<inter> space M \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    65
  shows "f \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    66
  unfolding borel_space_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    67
proof (rule measurable_sigma)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    68
  fix S :: "'x set" assume "S \<in> open" thus "f -` S \<inter> space M \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    69
    using assms[of S] by (simp add: mem_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    70
qed simp_all
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
    71
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    72
lemma borel_space_singleton[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    73
  fixes x :: "'a::t1_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    74
  shows "A \<in> sets borel_space \<Longrightarrow> insert x A \<in> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    75
  proof (rule borel_space.insert_in_sets)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    76
    show "{x} \<in> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    77
      using closed_sing[of x] by (rule borel_space_closed)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    78
  qed simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    79
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    80
lemma (in sigma_algebra) borel_measurable_const[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    81
  "(\<lambda>x. c) \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    82
  by (auto intro!: measurable_const)
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
    83
39083
e46acc0ea1fe introduced integration on subalgebras
hoelzl
parents: 38705
diff changeset
    84
lemma (in sigma_algebra) borel_measurable_indicator[simp, intro!]:
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    85
  assumes A: "A \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    86
  shows "indicator A \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    87
  unfolding indicator_def_raw using A
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    88
  by (auto intro!: measurable_If_set borel_measurable_const)
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
    89
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    90
lemma borel_measurable_translate:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    91
  assumes "A \<in> sets borel_space" and trans: "\<And>B. open B \<Longrightarrow> f -` B \<in> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    92
  shows "f -` A \<in> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    93
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    94
  have "A \<in> sigma_sets UNIV open" using assms
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    95
    by (simp add: borel_space_def sigma_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    96
  thus ?thesis
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    97
  proof (induct rule: sigma_sets.induct)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    98
    case (Basic a) thus ?case using trans[of a] by (simp add: mem_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
    99
  next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   100
    case (Compl a)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   101
    moreover have "UNIV \<in> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   102
      by (metis borel_space.top borel_space_def_raw mem_def space_sigma)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   103
    ultimately show ?case
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   104
      by (auto simp: vimage_Diff borel_space.Diff)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   105
  qed (auto simp add: vimage_UN)
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   106
qed
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   107
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   108
section "Borel spaces on euclidean spaces"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   109
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   110
lemma lessThan_borel[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   111
  fixes a :: "'a\<Colon>ordered_euclidean_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   112
  shows "{..< a} \<in> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   113
  by (blast intro: borel_space_open)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   114
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   115
lemma greaterThan_borel[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   116
  fixes a :: "'a\<Colon>ordered_euclidean_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   117
  shows "{a <..} \<in> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   118
  by (blast intro: borel_space_open)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   119
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   120
lemma greaterThanLessThan_borel[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   121
  fixes a b :: "'a\<Colon>ordered_euclidean_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   122
  shows "{a<..<b} \<in> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   123
  by (blast intro: borel_space_open)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   124
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   125
lemma atMost_borel[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   126
  fixes a :: "'a\<Colon>ordered_euclidean_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   127
  shows "{..a} \<in> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   128
  by (blast intro: borel_space_closed)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   129
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   130
lemma atLeast_borel[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   131
  fixes a :: "'a\<Colon>ordered_euclidean_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   132
  shows "{a..} \<in> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   133
  by (blast intro: borel_space_closed)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   134
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   135
lemma atLeastAtMost_borel[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   136
  fixes a b :: "'a\<Colon>ordered_euclidean_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   137
  shows "{a..b} \<in> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   138
  by (blast intro: borel_space_closed)
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   139
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   140
lemma greaterThanAtMost_borel[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   141
  fixes a b :: "'a\<Colon>ordered_euclidean_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   142
  shows "{a<..b} \<in> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   143
  unfolding greaterThanAtMost_def by blast
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   144
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   145
lemma atLeastLessThan_borel[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   146
  fixes a b :: "'a\<Colon>ordered_euclidean_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   147
  shows "{a..<b} \<in> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   148
  unfolding atLeastLessThan_def by blast
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   149
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   150
lemma hafspace_less_borel[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   151
  fixes a :: real
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   152
  shows "{x::'a::euclidean_space. a < x $$ i} \<in> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   153
  by (auto intro!: borel_space_open open_halfspace_component_gt)
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   154
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   155
lemma hafspace_greater_borel[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   156
  fixes a :: real
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   157
  shows "{x::'a::euclidean_space. x $$ i < a} \<in> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   158
  by (auto intro!: borel_space_open open_halfspace_component_lt)
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   159
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   160
lemma hafspace_less_eq_borel[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   161
  fixes a :: real
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   162
  shows "{x::'a::euclidean_space. a \<le> x $$ i} \<in> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   163
  by (auto intro!: borel_space_closed closed_halfspace_component_ge)
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   164
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   165
lemma hafspace_greater_eq_borel[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   166
  fixes a :: real
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   167
  shows "{x::'a::euclidean_space. x $$ i \<le> a} \<in> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   168
  by (auto intro!: borel_space_closed closed_halfspace_component_le)
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   169
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   170
lemma (in sigma_algebra) borel_measurable_less[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   171
  fixes f :: "'a \<Rightarrow> real"
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   172
  assumes f: "f \<in> borel_measurable M"
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   173
  assumes g: "g \<in> borel_measurable M"
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   174
  shows "{w \<in> space M. f w < g w} \<in> sets M"
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   175
proof -
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   176
  have "{w \<in> space M. f w < g w} =
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   177
        (\<Union>r. (f -` {..< of_rat r} \<inter> space M) \<inter> (g -` {of_rat r <..} \<inter> space M))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   178
    using Rats_dense_in_real by (auto simp add: Rats_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   179
  then show ?thesis using f g
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   180
    by simp (blast intro: measurable_sets)
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   181
qed
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   182
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   183
lemma (in sigma_algebra) borel_measurable_le[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   184
  fixes f :: "'a \<Rightarrow> real"
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   185
  assumes f: "f \<in> borel_measurable M"
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   186
  assumes g: "g \<in> borel_measurable M"
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   187
  shows "{w \<in> space M. f w \<le> g w} \<in> sets M"
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   188
proof -
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   189
  have "{w \<in> space M. f w \<le> g w} = space M - {w \<in> space M. g w < f w}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   190
    by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   191
  thus ?thesis using f g
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   192
    by simp blast
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   193
qed
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   194
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   195
lemma (in sigma_algebra) borel_measurable_eq[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   196
  fixes f :: "'a \<Rightarrow> real"
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   197
  assumes f: "f \<in> borel_measurable M"
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   198
  assumes g: "g \<in> borel_measurable M"
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   199
  shows "{w \<in> space M. f w = g w} \<in> sets M"
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   200
proof -
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   201
  have "{w \<in> space M. f w = g w} =
33536
fd28b7399f2b eliminated hard tabulators;
wenzelm
parents: 33535
diff changeset
   202
        {w \<in> space M. f w \<le> g w} \<inter> {w \<in> space M. g w \<le> f w}"
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   203
    by auto
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   204
  thus ?thesis using f g by auto
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   205
qed
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   206
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   207
lemma (in sigma_algebra) borel_measurable_neq[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   208
  fixes f :: "'a \<Rightarrow> real"
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   209
  assumes f: "f \<in> borel_measurable M"
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   210
  assumes g: "g \<in> borel_measurable M"
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   211
  shows "{w \<in> space M. f w \<noteq> g w} \<in> sets M"
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   212
proof -
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   213
  have "{w \<in> space M. f w \<noteq> g w} = space M - {w \<in> space M. f w = g w}"
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   214
    by auto
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   215
  thus ?thesis using f g by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   216
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   217
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   218
subsection "Borel space equals sigma algebras over intervals"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   219
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   220
lemma rational_boxes:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   221
  fixes x :: "'a\<Colon>ordered_euclidean_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   222
  assumes "0 < e"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   223
  shows "\<exists>a b. (\<forall>i. a $$ i \<in> \<rat>) \<and> (\<forall>i. b $$ i \<in> \<rat>) \<and> x \<in> {a <..< b} \<and> {a <..< b} \<subseteq> ball x e"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   224
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   225
  def e' \<equiv> "e / (2 * sqrt (real (DIM ('a))))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   226
  then have e: "0 < e'" using assms by (auto intro!: divide_pos_pos)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   227
  have "\<forall>i. \<exists>y. y \<in> \<rat> \<and> y < x $$ i \<and> x $$ i - y < e'" (is "\<forall>i. ?th i")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   228
  proof
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   229
    fix i from Rats_dense_in_real[of "x $$ i - e'" "x $$ i"] e
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   230
    show "?th i" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   231
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   232
  from choice[OF this] guess a .. note a = this
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   233
  have "\<forall>i. \<exists>y. y \<in> \<rat> \<and> x $$ i < y \<and> y - x $$ i < e'" (is "\<forall>i. ?th i")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   234
  proof
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   235
    fix i from Rats_dense_in_real[of "x $$ i" "x $$ i + e'"] e
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   236
    show "?th i" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   237
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   238
  from choice[OF this] guess b .. note b = this
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   239
  { fix y :: 'a assume *: "Chi a < y" "y < Chi b"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   240
    have "dist x y = sqrt (\<Sum>i<DIM('a). (dist (x $$ i) (y $$ i))\<twosuperior>)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   241
      unfolding setL2_def[symmetric] by (rule euclidean_dist_l2)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   242
    also have "\<dots> < sqrt (\<Sum>i<DIM('a). e^2 / real (DIM('a)))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   243
    proof (rule real_sqrt_less_mono, rule setsum_strict_mono)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   244
      fix i assume i: "i \<in> {..<DIM('a)}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   245
      have "a i < y$$i \<and> y$$i < b i" using * i eucl_less[where 'a='a] by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   246
      moreover have "a i < x$$i" "x$$i - a i < e'" using a by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   247
      moreover have "x$$i < b i" "b i - x$$i < e'" using b by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   248
      ultimately have "\<bar>x$$i - y$$i\<bar> < 2 * e'" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   249
      then have "dist (x $$ i) (y $$ i) < e/sqrt (real (DIM('a)))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   250
        unfolding e'_def by (auto simp: dist_real_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   251
      then have "(dist (x $$ i) (y $$ i))\<twosuperior> < (e/sqrt (real (DIM('a))))\<twosuperior>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   252
        by (rule power_strict_mono) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   253
      then show "(dist (x $$ i) (y $$ i))\<twosuperior> < e\<twosuperior> / real DIM('a)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   254
        by (simp add: power_divide)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   255
    qed auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   256
    also have "\<dots> = e" using `0 < e` by (simp add: real_eq_of_nat DIM_positive)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   257
    finally have "dist x y < e" . }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   258
  with a b show ?thesis
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   259
    apply (rule_tac exI[of _ "Chi a"])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   260
    apply (rule_tac exI[of _ "Chi b"])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   261
    using eucl_less[where 'a='a] by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   262
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   263
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   264
lemma ex_rat_list:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   265
  fixes x :: "'a\<Colon>ordered_euclidean_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   266
  assumes "\<And> i. x $$ i \<in> \<rat>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   267
  shows "\<exists> r. length r = DIM('a) \<and> (\<forall> i < DIM('a). of_rat (r ! i) = x $$ i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   268
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   269
  have "\<forall>i. \<exists>r. x $$ i = of_rat r" using assms unfolding Rats_def by blast
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   270
  from choice[OF this] guess r ..
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   271
  then show ?thesis by (auto intro!: exI[of _ "map r [0 ..< DIM('a)]"])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   272
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   273
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   274
lemma open_UNION:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   275
  fixes M :: "'a\<Colon>ordered_euclidean_space set"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   276
  assumes "open M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   277
  shows "M = UNION {(a, b) | a b. {Chi (of_rat \<circ> op ! a) <..< Chi (of_rat \<circ> op ! b)} \<subseteq> M}
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   278
                   (\<lambda> (a, b). {Chi (of_rat \<circ> op ! a) <..< Chi (of_rat \<circ> op ! b)})"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   279
    (is "M = UNION ?idx ?box")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   280
proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   281
  fix x assume "x \<in> M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   282
  obtain e where e: "e > 0" "ball x e \<subseteq> M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   283
    using openE[OF assms `x \<in> M`] by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   284
  then obtain a b where ab: "x \<in> {a <..< b}" "\<And>i. a $$ i \<in> \<rat>" "\<And>i. b $$ i \<in> \<rat>" "{a <..< b} \<subseteq> ball x e"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   285
    using rational_boxes[OF e(1)] by blast
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   286
  then obtain p q where pq: "length p = DIM ('a)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   287
                            "length q = DIM ('a)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   288
                            "\<forall> i < DIM ('a). of_rat (p ! i) = a $$ i \<and> of_rat (q ! i) = b $$ i"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   289
    using ex_rat_list[OF ab(2)] ex_rat_list[OF ab(3)] by blast
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   290
  hence p: "Chi (of_rat \<circ> op ! p) = a"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   291
    using euclidean_eq[of "Chi (of_rat \<circ> op ! p)" a]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   292
    unfolding o_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   293
  from pq have q: "Chi (of_rat \<circ> op ! q) = b"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   294
    using euclidean_eq[of "Chi (of_rat \<circ> op ! q)" b]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   295
    unfolding o_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   296
  have "x \<in> ?box (p, q)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   297
    using p q ab by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   298
  thus "x \<in> UNION ?idx ?box" using ab e p q exI[of _ p] exI[of _ q] by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   299
qed auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   300
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   301
lemma halfspace_span_open:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   302
  "sets (sigma UNIV (range (\<lambda> (a, i). {x\<Colon>'a\<Colon>ordered_euclidean_space. x $$ i < a})))
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   303
    \<subseteq> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   304
  by (auto intro!: borel_space.sigma_sets_subset[simplified] borel_space_open
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   305
                   open_halfspace_component_lt simp: sets_sigma)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   306
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   307
lemma halfspace_lt_in_halfspace:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   308
  "{x\<Colon>'a. x $$ i < a} \<in> sets (sigma UNIV (range (\<lambda> (a, i). {x\<Colon>'a\<Colon>ordered_euclidean_space. x $$ i < a})))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   309
  unfolding sets_sigma by (rule sigma_sets.Basic) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   310
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   311
lemma halfspace_gt_in_halfspace:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   312
  "{x\<Colon>'a. a < x $$ i} \<in> sets (sigma UNIV (range (\<lambda> (a, i). {x\<Colon>'a\<Colon>ordered_euclidean_space. x $$ i < a})))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   313
    (is "?set \<in> sets ?SIGMA")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   314
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   315
  interpret sigma_algebra ?SIGMA by (rule sigma_algebra_sigma) simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   316
  have *: "?set = (\<Union>n. space ?SIGMA - {x\<Colon>'a. x $$ i < a + 1 / real (Suc n)})"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   317
  proof (safe, simp_all add: not_less)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   318
    fix x assume "a < x $$ i"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   319
    with reals_Archimedean[of "x $$ i - a"]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   320
    obtain n where "a + 1 / real (Suc n) < x $$ i"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   321
      by (auto simp: inverse_eq_divide field_simps)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   322
    then show "\<exists>n. a + 1 / real (Suc n) \<le> x $$ i"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   323
      by (blast intro: less_imp_le)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   324
  next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   325
    fix x n
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   326
    have "a < a + 1 / real (Suc n)" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   327
    also assume "\<dots> \<le> x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   328
    finally show "a < x" .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   329
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   330
  show "?set \<in> sets ?SIGMA" unfolding *
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   331
    by (safe intro!: countable_UN Diff halfspace_lt_in_halfspace)
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   332
qed
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   333
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   334
lemma (in sigma_algebra) sets_sigma_subset:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   335
  assumes "A = space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   336
  assumes "B \<subseteq> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   337
  shows "sets (sigma A B) \<subseteq> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   338
  by (unfold assms sets_sigma, rule sigma_sets_subset, rule assms)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   339
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   340
lemma open_span_halfspace:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   341
  "sets borel_space \<subseteq> sets (sigma UNIV (range (\<lambda> (a, i). {x::'a::ordered_euclidean_space. x $$ i < a})))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   342
    (is "_ \<subseteq> sets ?SIGMA")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   343
proof (unfold borel_space_def, rule sigma_algebra.sets_sigma_subset, safe)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   344
  show "sigma_algebra ?SIGMA" by (rule sigma_algebra_sigma) simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   345
  then interpret sigma_algebra ?SIGMA .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   346
  fix S :: "'a set" assume "S \<in> open" then have "open S" unfolding mem_def .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   347
  from open_UNION[OF this]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   348
  obtain I where *: "S =
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   349
    (\<Union>(a, b)\<in>I.
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   350
        (\<Inter> i<DIM('a). {x. (Chi (real_of_rat \<circ> op ! a)::'a) $$ i < x $$ i}) \<inter>
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   351
        (\<Inter> i<DIM('a). {x. x $$ i < (Chi (real_of_rat \<circ> op ! b)::'a) $$ i}))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   352
    unfolding greaterThanLessThan_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   353
    unfolding eucl_greaterThan_eq_halfspaces[where 'a='a]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   354
    unfolding eucl_lessThan_eq_halfspaces[where 'a='a]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   355
    by blast
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   356
  show "S \<in> sets ?SIGMA"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   357
    unfolding *
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   358
    by (auto intro!: countable_UN Int countable_INT halfspace_lt_in_halfspace halfspace_gt_in_halfspace)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   359
qed auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   360
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   361
lemma halfspace_span_halfspace_le:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   362
  "sets (sigma UNIV (range (\<lambda> (a, i). {x\<Colon>'a\<Colon>ordered_euclidean_space. x $$ i < a}))) \<subseteq>
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   363
   sets (sigma UNIV (range (\<lambda> (a, i). {x. x $$ i \<le> a})))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   364
  (is "_ \<subseteq> sets ?SIGMA")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   365
proof (rule sigma_algebra.sets_sigma_subset, safe)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   366
  show "sigma_algebra ?SIGMA" by (rule sigma_algebra_sigma) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   367
  then interpret sigma_algebra ?SIGMA .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   368
  fix a i
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   369
  have *: "{x::'a. x$$i < a} = (\<Union>n. {x. x$$i \<le> a - 1/real (Suc n)})"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   370
  proof (safe, simp_all)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   371
    fix x::'a assume *: "x$$i < a"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   372
    with reals_Archimedean[of "a - x$$i"]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   373
    obtain n where "x $$ i < a - 1 / (real (Suc n))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   374
      by (auto simp: field_simps inverse_eq_divide)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   375
    then show "\<exists>n. x $$ i \<le> a - 1 / (real (Suc n))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   376
      by (blast intro: less_imp_le)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   377
  next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   378
    fix x::'a and n
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   379
    assume "x$$i \<le> a - 1 / real (Suc n)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   380
    also have "\<dots> < a" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   381
    finally show "x$$i < a" .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   382
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   383
  show "{x. x$$i < a} \<in> sets ?SIGMA" unfolding *
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   384
    by (safe intro!: countable_UN)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   385
       (auto simp: sets_sigma intro!: sigma_sets.Basic)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   386
qed auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   387
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   388
lemma halfspace_span_halfspace_ge:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   389
  "sets (sigma UNIV (range (\<lambda> (a, i). {x\<Colon>'a\<Colon>ordered_euclidean_space. x $$ i < a}))) \<subseteq> 
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   390
   sets (sigma UNIV (range (\<lambda> (a, i). {x. a \<le> x $$ i})))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   391
  (is "_ \<subseteq> sets ?SIGMA")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   392
proof (rule sigma_algebra.sets_sigma_subset, safe)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   393
  show "sigma_algebra ?SIGMA" by (rule sigma_algebra_sigma) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   394
  then interpret sigma_algebra ?SIGMA .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   395
  fix a i have *: "{x::'a. x$$i < a} = space ?SIGMA - {x::'a. a \<le> x$$i}" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   396
  show "{x. x$$i < a} \<in> sets ?SIGMA" unfolding *
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   397
    by (safe intro!: Diff)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   398
       (auto simp: sets_sigma intro!: sigma_sets.Basic)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   399
qed auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   400
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   401
lemma halfspace_le_span_halfspace_gt:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   402
  "sets (sigma UNIV (range (\<lambda> (a, i). {x\<Colon>'a\<Colon>ordered_euclidean_space. x $$ i \<le> a}))) \<subseteq> 
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   403
   sets (sigma UNIV (range (\<lambda> (a, i). {x. a < x $$ i})))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   404
  (is "_ \<subseteq> sets ?SIGMA")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   405
proof (rule sigma_algebra.sets_sigma_subset, safe)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   406
  show "sigma_algebra ?SIGMA" by (rule sigma_algebra_sigma) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   407
  then interpret sigma_algebra ?SIGMA .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   408
  fix a i have *: "{x::'a. x$$i \<le> a} = space ?SIGMA - {x::'a. a < x$$i}" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   409
  show "{x. x$$i \<le> a} \<in> sets ?SIGMA" unfolding *
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   410
    by (safe intro!: Diff)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   411
       (auto simp: sets_sigma intro!: sigma_sets.Basic)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   412
qed auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   413
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   414
lemma halfspace_le_span_atMost:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   415
  "sets (sigma UNIV (range (\<lambda> (a, i). {x\<Colon>'a\<Colon>ordered_euclidean_space. x $$ i \<le> a}))) \<subseteq>
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   416
   sets (sigma UNIV (range (\<lambda>a. {..a\<Colon>'a\<Colon>ordered_euclidean_space})))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   417
  (is "_ \<subseteq> sets ?SIGMA")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   418
proof (rule sigma_algebra.sets_sigma_subset, safe)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   419
  show "sigma_algebra ?SIGMA" by (rule sigma_algebra_sigma) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   420
  then interpret sigma_algebra ?SIGMA .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   421
  fix a i
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   422
  show "{x. x$$i \<le> a} \<in> sets ?SIGMA"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   423
  proof cases
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   424
    assume "i < DIM('a)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   425
    then have *: "{x::'a. x$$i \<le> a} = (\<Union>k::nat. {.. (\<chi>\<chi> n. if n = i then a else real k)})"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   426
    proof (safe, simp_all add: eucl_le[where 'a='a] split: split_if_asm)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   427
      fix x
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   428
      from real_arch_simple[of "Max ((\<lambda>i. x$$i)`{..<DIM('a)})"] guess k::nat ..
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   429
      then have "\<And>i. i < DIM('a) \<Longrightarrow> x$$i \<le> real k"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   430
        by (subst (asm) Max_le_iff) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   431
      then show "\<exists>k::nat. \<forall>ia. ia \<noteq> i \<longrightarrow> ia < DIM('a) \<longrightarrow> x $$ ia \<le> real k"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   432
        by (auto intro!: exI[of _ k])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   433
    qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   434
    show "{x. x$$i \<le> a} \<in> sets ?SIGMA" unfolding *
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   435
      by (safe intro!: countable_UN)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   436
         (auto simp: sets_sigma intro!: sigma_sets.Basic)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   437
  next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   438
    assume "\<not> i < DIM('a)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   439
    then show "{x. x$$i \<le> a} \<in> sets ?SIGMA"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   440
      using top by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   441
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   442
qed auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   443
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   444
lemma halfspace_le_span_greaterThan:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   445
  "sets (sigma UNIV (range (\<lambda> (a, i). {x\<Colon>'a\<Colon>ordered_euclidean_space. x $$ i \<le> a}))) \<subseteq>
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   446
   sets (sigma UNIV (range (\<lambda>a. {a<..})))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   447
  (is "_ \<subseteq> sets ?SIGMA")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   448
proof (rule sigma_algebra.sets_sigma_subset, safe)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   449
  show "sigma_algebra ?SIGMA" by (rule sigma_algebra_sigma) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   450
  then interpret sigma_algebra ?SIGMA .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   451
  fix a i
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   452
  show "{x. x$$i \<le> a} \<in> sets ?SIGMA"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   453
  proof cases
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   454
    assume "i < DIM('a)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   455
    have "{x::'a. x$$i \<le> a} = space ?SIGMA - {x::'a. a < x$$i}" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   456
    also have *: "{x::'a. a < x$$i} = (\<Union>k::nat. {(\<chi>\<chi> n. if n = i then a else -real k) <..})" using `i <DIM('a)`
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   457
    proof (safe, simp_all add: eucl_less[where 'a='a] split: split_if_asm)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   458
      fix x
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   459
      from real_arch_lt[of "Max ((\<lambda>i. -x$$i)`{..<DIM('a)})"]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   460
      guess k::nat .. note k = this
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   461
      { fix i assume "i < DIM('a)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   462
        then have "-x$$i < real k"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   463
          using k by (subst (asm) Max_less_iff) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   464
        then have "- real k < x$$i" by simp }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   465
      then show "\<exists>k::nat. \<forall>ia. ia \<noteq> i \<longrightarrow> ia < DIM('a) \<longrightarrow> -real k < x $$ ia"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   466
        by (auto intro!: exI[of _ k])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   467
    qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   468
    finally show "{x. x$$i \<le> a} \<in> sets ?SIGMA"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   469
      apply (simp only:)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   470
      apply (safe intro!: countable_UN Diff)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   471
      by (auto simp: sets_sigma intro!: sigma_sets.Basic)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   472
  next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   473
    assume "\<not> i < DIM('a)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   474
    then show "{x. x$$i \<le> a} \<in> sets ?SIGMA"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   475
      using top by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   476
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   477
qed auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   478
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   479
lemma atMost_span_atLeastAtMost:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   480
  "sets (sigma UNIV (range (\<lambda>a. {..a\<Colon>'a\<Colon>ordered_euclidean_space}))) \<subseteq>
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   481
   sets (sigma UNIV (range (\<lambda>(a,b). {a..b})))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   482
  (is "_ \<subseteq> sets ?SIGMA")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   483
proof (rule sigma_algebra.sets_sigma_subset, safe)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   484
  show "sigma_algebra ?SIGMA" by (rule sigma_algebra_sigma) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   485
  then interpret sigma_algebra ?SIGMA .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   486
  fix a::'a
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   487
  have *: "{..a} = (\<Union>n::nat. {- real n *\<^sub>R One .. a})"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   488
  proof (safe, simp_all add: eucl_le[where 'a='a])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   489
    fix x
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   490
    from real_arch_simple[of "Max ((\<lambda>i. - x$$i)`{..<DIM('a)})"]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   491
    guess k::nat .. note k = this
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   492
    { fix i assume "i < DIM('a)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   493
      with k have "- x$$i \<le> real k"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   494
        by (subst (asm) Max_le_iff) (auto simp: field_simps)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   495
      then have "- real k \<le> x$$i" by simp }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   496
    then show "\<exists>n::nat. \<forall>i<DIM('a). - real n \<le> x $$ i"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   497
      by (auto intro!: exI[of _ k])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   498
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   499
  show "{..a} \<in> sets ?SIGMA" unfolding *
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   500
    by (safe intro!: countable_UN)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   501
       (auto simp: sets_sigma intro!: sigma_sets.Basic)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   502
qed auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   503
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   504
lemma borel_space_eq_greaterThanLessThan:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   505
  "sets borel_space = sets (sigma UNIV (range (\<lambda> (a, b). {a <..< (b :: 'a \<Colon> ordered_euclidean_space)})))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   506
    (is "_ = sets ?SIGMA")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   507
proof (rule antisym)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   508
  show "sets ?SIGMA \<subseteq> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   509
    by (rule borel_space.sets_sigma_subset) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   510
  show "sets borel_space \<subseteq> sets ?SIGMA"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   511
    unfolding borel_space_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   512
  proof (rule sigma_algebra.sets_sigma_subset, safe)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   513
    show "sigma_algebra ?SIGMA" by (rule sigma_algebra_sigma) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   514
    then interpret sigma_algebra ?SIGMA .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   515
    fix M :: "'a set" assume "M \<in> open"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   516
    then have "open M" by (simp add: mem_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   517
    show "M \<in> sets ?SIGMA"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   518
      apply (subst open_UNION[OF `open M`])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   519
      apply (safe intro!: countable_UN)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   520
      by (auto simp add: sigma_def intro!: sigma_sets.Basic)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   521
  qed auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   522
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   523
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   524
lemma borel_space_eq_atMost:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   525
  "sets borel_space = sets (sigma UNIV (range (\<lambda> a. {.. a::'a\<Colon>ordered_euclidean_space})))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   526
    (is "_ = sets ?SIGMA")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   527
proof (rule antisym)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   528
  show "sets borel_space \<subseteq> sets ?SIGMA"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   529
    using halfspace_le_span_atMost halfspace_span_halfspace_le open_span_halfspace
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   530
    by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   531
  show "sets ?SIGMA \<subseteq> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   532
    by (rule borel_space.sets_sigma_subset) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   533
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   534
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   535
lemma borel_space_eq_atLeastAtMost:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   536
  "sets borel_space = sets (sigma UNIV (range (\<lambda> (a :: 'a\<Colon>ordered_euclidean_space, b). {a .. b})))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   537
   (is "_ = sets ?SIGMA")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   538
proof (rule antisym)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   539
  show "sets borel_space \<subseteq> sets ?SIGMA"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   540
    using atMost_span_atLeastAtMost halfspace_le_span_atMost
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   541
      halfspace_span_halfspace_le open_span_halfspace
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   542
    by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   543
  show "sets ?SIGMA \<subseteq> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   544
    by (rule borel_space.sets_sigma_subset) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   545
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   546
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   547
lemma borel_space_eq_greaterThan:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   548
  "sets borel_space = sets (sigma UNIV (range (\<lambda> (a :: 'a\<Colon>ordered_euclidean_space). {a <..})))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   549
   (is "_ = sets ?SIGMA")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   550
proof (rule antisym)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   551
  show "sets borel_space \<subseteq> sets ?SIGMA"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   552
    using halfspace_le_span_greaterThan
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   553
      halfspace_span_halfspace_le open_span_halfspace
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   554
    by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   555
  show "sets ?SIGMA \<subseteq> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   556
    by (rule borel_space.sets_sigma_subset) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   557
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   558
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   559
lemma borel_space_eq_halfspace_le:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   560
  "sets borel_space = sets (sigma UNIV (range (\<lambda> (a, i). {x::'a::ordered_euclidean_space. x$$i \<le> a})))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   561
   (is "_ = sets ?SIGMA")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   562
proof (rule antisym)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   563
  show "sets borel_space \<subseteq> sets ?SIGMA"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   564
    using open_span_halfspace halfspace_span_halfspace_le by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   565
  show "sets ?SIGMA \<subseteq> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   566
    by (rule borel_space.sets_sigma_subset) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   567
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   568
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   569
lemma borel_space_eq_halfspace_less:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   570
  "sets borel_space = sets (sigma UNIV (range (\<lambda> (a, i). {x::'a::ordered_euclidean_space. x$$i < a})))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   571
   (is "_ = sets ?SIGMA")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   572
proof (rule antisym)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   573
  show "sets borel_space \<subseteq> sets ?SIGMA"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   574
    using open_span_halfspace .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   575
  show "sets ?SIGMA \<subseteq> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   576
    by (rule borel_space.sets_sigma_subset) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   577
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   578
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   579
lemma borel_space_eq_halfspace_gt:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   580
  "sets borel_space = sets (sigma UNIV (range (\<lambda> (a, i). {x::'a::ordered_euclidean_space. a < x$$i})))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   581
   (is "_ = sets ?SIGMA")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   582
proof (rule antisym)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   583
  show "sets borel_space \<subseteq> sets ?SIGMA"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   584
    using halfspace_le_span_halfspace_gt open_span_halfspace halfspace_span_halfspace_le by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   585
  show "sets ?SIGMA \<subseteq> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   586
    by (rule borel_space.sets_sigma_subset) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   587
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   588
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   589
lemma borel_space_eq_halfspace_ge:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   590
  "sets borel_space = sets (sigma UNIV (range (\<lambda> (a, i). {x::'a::ordered_euclidean_space. a \<le> x$$i})))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   591
   (is "_ = sets ?SIGMA")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   592
proof (rule antisym)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   593
  show "sets borel_space \<subseteq> sets ?SIGMA"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   594
    using halfspace_span_halfspace_ge open_span_halfspace by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   595
  show "sets ?SIGMA \<subseteq> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   596
    by (rule borel_space.sets_sigma_subset) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   597
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   598
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   599
lemma (in sigma_algebra) borel_measurable_halfspacesI:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   600
  fixes f :: "'a \<Rightarrow> 'c\<Colon>ordered_euclidean_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   601
  assumes "sets borel_space = sets (sigma UNIV (range F))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   602
  and "\<And>a i. S a i = f -` F (a,i) \<inter> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   603
  and "\<And>a i. \<not> i < DIM('c) \<Longrightarrow> S a i \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   604
  shows "f \<in> borel_measurable M = (\<forall>i<DIM('c). \<forall>a::real. S a i \<in> sets M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   605
proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   606
  fix a :: real and i assume i: "i < DIM('c)" and f: "f \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   607
  then show "S a i \<in> sets M" unfolding assms
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   608
    by (auto intro!: measurable_sets sigma_sets.Basic simp: assms(1) sigma_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   609
next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   610
  assume a: "\<forall>i<DIM('c). \<forall>a. S a i \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   611
  { fix a i have "S a i \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   612
    proof cases
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   613
      assume "i < DIM('c)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   614
      with a show ?thesis unfolding assms(2) by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   615
    next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   616
      assume "\<not> i < DIM('c)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   617
      from assms(3)[OF this] show ?thesis .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   618
    qed }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   619
  then have "f \<in> measurable M (sigma UNIV (range F))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   620
    by (auto intro!: measurable_sigma simp: assms(2))
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   621
  then show "f \<in> borel_measurable M" unfolding measurable_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   622
    unfolding assms(1) by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   623
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   624
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   625
lemma (in sigma_algebra) borel_measurable_iff_halfspace_le:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   626
  fixes f :: "'a \<Rightarrow> 'c\<Colon>ordered_euclidean_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   627
  shows "f \<in> borel_measurable M = (\<forall>i<DIM('c). \<forall>a. {w \<in> space M. f w $$ i \<le> a} \<in> sets M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   628
  by (rule borel_measurable_halfspacesI[OF borel_space_eq_halfspace_le]) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   629
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   630
lemma (in sigma_algebra) borel_measurable_iff_halfspace_less:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   631
  fixes f :: "'a \<Rightarrow> 'c\<Colon>ordered_euclidean_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   632
  shows "f \<in> borel_measurable M \<longleftrightarrow> (\<forall>i<DIM('c). \<forall>a. {w \<in> space M. f w $$ i < a} \<in> sets M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   633
  by (rule borel_measurable_halfspacesI[OF borel_space_eq_halfspace_less]) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   634
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   635
lemma (in sigma_algebra) borel_measurable_iff_halfspace_ge:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   636
  fixes f :: "'a \<Rightarrow> 'c\<Colon>ordered_euclidean_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   637
  shows "f \<in> borel_measurable M = (\<forall>i<DIM('c). \<forall>a. {w \<in> space M. a \<le> f w $$ i} \<in> sets M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   638
  by (rule borel_measurable_halfspacesI[OF borel_space_eq_halfspace_ge]) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   639
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   640
lemma (in sigma_algebra) borel_measurable_iff_halfspace_greater:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   641
  fixes f :: "'a \<Rightarrow> 'c\<Colon>ordered_euclidean_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   642
  shows "f \<in> borel_measurable M \<longleftrightarrow> (\<forall>i<DIM('c). \<forall>a. {w \<in> space M. a < f w $$ i} \<in> sets M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   643
  by (rule borel_measurable_halfspacesI[OF borel_space_eq_halfspace_gt]) auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   644
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   645
lemma (in sigma_algebra) borel_measurable_iff_le:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   646
  "(f::'a \<Rightarrow> real) \<in> borel_measurable M = (\<forall>a. {w \<in> space M. f w \<le> a} \<in> sets M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   647
  using borel_measurable_iff_halfspace_le[where 'c=real] by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   648
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   649
lemma (in sigma_algebra) borel_measurable_iff_less:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   650
  "(f::'a \<Rightarrow> real) \<in> borel_measurable M = (\<forall>a. {w \<in> space M. f w < a} \<in> sets M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   651
  using borel_measurable_iff_halfspace_less[where 'c=real] by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   652
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   653
lemma (in sigma_algebra) borel_measurable_iff_ge:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   654
  "(f::'a \<Rightarrow> real) \<in> borel_measurable M = (\<forall>a. {w \<in> space M. a \<le> f w} \<in> sets M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   655
  using borel_measurable_iff_halfspace_ge[where 'c=real] by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   657
lemma (in sigma_algebra) borel_measurable_iff_greater:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   658
  "(f::'a \<Rightarrow> real) \<in> borel_measurable M = (\<forall>a. {w \<in> space M. a < f w} \<in> sets M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   659
  using borel_measurable_iff_halfspace_greater[where 'c=real] by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   660
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   661
subsection "Borel measurable operators"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   662
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   663
lemma (in sigma_algebra) affine_borel_measurable_vector:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   664
  fixes f :: "'a \<Rightarrow> 'x::real_normed_vector"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   665
  assumes "f \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   666
  shows "(\<lambda>x. a + b *\<^sub>R f x) \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   667
proof (rule borel_measurableI)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   668
  fix S :: "'x set" assume "open S"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   669
  show "(\<lambda>x. a + b *\<^sub>R f x) -` S \<inter> space M \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   670
  proof cases
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   671
    assume "b \<noteq> 0"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   672
    with `open S` have "((\<lambda>x. (- a + x) /\<^sub>R b) ` S) \<in> open" (is "?S \<in> open")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   673
      by (auto intro!: open_affinity simp: scaleR.add_right mem_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   674
    hence "?S \<in> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   675
      unfolding borel_space_def by (auto simp: sigma_def intro!: sigma_sets.Basic)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   676
    moreover
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   677
    from `b \<noteq> 0` have "(\<lambda>x. a + b *\<^sub>R f x) -` S = f -` ?S"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   678
      apply auto by (rule_tac x="a + b *\<^sub>R f x" in image_eqI, simp_all)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   679
    ultimately show ?thesis using assms unfolding in_borel_measurable_borel_space
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   680
      by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   681
  qed simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   682
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   683
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   684
lemma (in sigma_algebra) affine_borel_measurable:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   685
  fixes g :: "'a \<Rightarrow> real"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   686
  assumes g: "g \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   687
  shows "(\<lambda>x. a + (g x) * b) \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   688
  using affine_borel_measurable_vector[OF assms] by (simp add: mult_commute)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   689
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   690
lemma (in sigma_algebra) borel_measurable_add[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   691
  fixes f :: "'a \<Rightarrow> real"
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   692
  assumes f: "f \<in> borel_measurable M"
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   693
  assumes g: "g \<in> borel_measurable M"
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   694
  shows "(\<lambda>x. f x + g x) \<in> borel_measurable M"
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   695
proof -
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   696
  have 1: "\<And>a. {w\<in>space M. a \<le> f w + g w} = {w \<in> space M. a + g w * -1 \<le> f w}"
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   697
    by auto
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   698
  have "\<And>a. (\<lambda>w. a + (g w) * -1) \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   699
    by (rule affine_borel_measurable [OF g])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   700
  then have "\<And>a. {w \<in> space M. (\<lambda>w. a + (g w) * -1)(w) \<le> f w} \<in> sets M" using f
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   701
    by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   702
  then have "\<And>a. {w \<in> space M. a \<le> f w + g w} \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   703
    by (simp add: 1)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   704
  then show ?thesis
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   705
    by (simp add: borel_measurable_iff_ge)
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   706
qed
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   707
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   708
lemma (in sigma_algebra) borel_measurable_square:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   709
  fixes f :: "'a \<Rightarrow> real"
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   710
  assumes f: "f \<in> borel_measurable M"
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   711
  shows "(\<lambda>x. (f x)^2) \<in> borel_measurable M"
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   712
proof -
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   713
  {
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   714
    fix a
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   715
    have "{w \<in> space M. (f w)\<twosuperior> \<le> a} \<in> sets M"
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   716
    proof (cases rule: linorder_cases [of a 0])
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   717
      case less
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   718
      hence "{w \<in> space M. (f w)\<twosuperior> \<le> a} = {}"
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   719
        by auto (metis less order_le_less_trans power2_less_0)
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   720
      also have "... \<in> sets M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   721
        by (rule empty_sets)
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   722
      finally show ?thesis .
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   723
    next
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   724
      case equal
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   725
      hence "{w \<in> space M. (f w)\<twosuperior> \<le> a} =
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   726
             {w \<in> space M. f w \<le> 0} \<inter> {w \<in> space M. 0 \<le> f w}"
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   727
        by auto
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   728
      also have "... \<in> sets M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   729
        apply (insert f)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   730
        apply (rule Int)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   731
        apply (simp add: borel_measurable_iff_le)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   732
        apply (simp add: borel_measurable_iff_ge)
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   733
        done
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   734
      finally show ?thesis .
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   735
    next
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   736
      case greater
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   737
      have "\<forall>x. (f x ^ 2 \<le> sqrt a ^ 2) = (- sqrt a  \<le> f x & f x \<le> sqrt a)"
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   738
        by (metis abs_le_interval_iff abs_of_pos greater real_sqrt_abs
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   739
                  real_sqrt_le_iff real_sqrt_power)
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   740
      hence "{w \<in> space M. (f w)\<twosuperior> \<le> a} =
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   741
             {w \<in> space M. -(sqrt a) \<le> f w} \<inter> {w \<in> space M. f w \<le> sqrt a}"
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   742
        using greater by auto
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   743
      also have "... \<in> sets M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   744
        apply (insert f)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   745
        apply (rule Int)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   746
        apply (simp add: borel_measurable_iff_ge)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   747
        apply (simp add: borel_measurable_iff_le)
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   748
        done
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   749
      finally show ?thesis .
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   750
    qed
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   751
  }
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   752
  thus ?thesis by (auto simp add: borel_measurable_iff_le)
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   753
qed
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   754
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   755
lemma times_eq_sum_squares:
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   756
   fixes x::real
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   757
   shows"x*y = ((x+y)^2)/4 - ((x-y)^ 2)/4"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   758
by (simp add: power2_eq_square ring_distribs diff_divide_distrib [symmetric])
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   759
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   760
lemma (in sigma_algebra) borel_measurable_uminus[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   761
  fixes g :: "'a \<Rightarrow> real"
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   762
  assumes g: "g \<in> borel_measurable M"
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   763
  shows "(\<lambda>x. - g x) \<in> borel_measurable M"
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   764
proof -
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   765
  have "(\<lambda>x. - g x) = (\<lambda>x. 0 + (g x) * -1)"
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   766
    by simp
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   767
  also have "... \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   768
    by (fast intro: affine_borel_measurable g)
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   769
  finally show ?thesis .
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   770
qed
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   771
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   772
lemma (in sigma_algebra) borel_measurable_times[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   773
  fixes f :: "'a \<Rightarrow> real"
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   774
  assumes f: "f \<in> borel_measurable M"
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   775
  assumes g: "g \<in> borel_measurable M"
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   776
  shows "(\<lambda>x. f x * g x) \<in> borel_measurable M"
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   777
proof -
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   778
  have 1: "(\<lambda>x. 0 + (f x + g x)\<twosuperior> * inverse 4) \<in> borel_measurable M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   779
    using assms by (fast intro: affine_borel_measurable borel_measurable_square)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   780
  have "(\<lambda>x. -((f x + -g x) ^ 2 * inverse 4)) =
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   781
        (\<lambda>x. 0 + ((f x + -g x) ^ 2 * inverse -4))"
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 35347
diff changeset
   782
    by (simp add: minus_divide_right)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   783
  also have "... \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   784
    using f g by (fast intro: affine_borel_measurable borel_measurable_square f g)
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   785
  finally have 2: "(\<lambda>x. -((f x + -g x) ^ 2 * inverse 4)) \<in> borel_measurable M" .
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   786
  show ?thesis
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   787
    apply (simp add: times_eq_sum_squares diff_minus)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   788
    using 1 2 by simp
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   789
qed
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   790
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   791
lemma (in sigma_algebra) borel_measurable_diff[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   792
  fixes f :: "'a \<Rightarrow> real"
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   793
  assumes f: "f \<in> borel_measurable M"
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   794
  assumes g: "g \<in> borel_measurable M"
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   795
  shows "(\<lambda>x. f x - g x) \<in> borel_measurable M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   796
  unfolding diff_minus using assms by fast
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
   797
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   798
lemma (in sigma_algebra) borel_measurable_setsum[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   799
  fixes f :: "'c \<Rightarrow> 'a \<Rightarrow> real"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   800
  assumes "\<And>i. i \<in> S \<Longrightarrow> f i \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   801
  shows "(\<lambda>x. \<Sum>i\<in>S. f i x) \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   802
proof cases
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   803
  assume "finite S"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   804
  thus ?thesis using assms by induct auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   805
qed simp
35692
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   806
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   807
lemma (in sigma_algebra) borel_measurable_inverse[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   808
  fixes f :: "'a \<Rightarrow> real"
35692
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   809
  assumes "f \<in> borel_measurable M"
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   810
  shows "(\<lambda>x. inverse (f x)) \<in> borel_measurable M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   811
  unfolding borel_measurable_iff_ge unfolding inverse_eq_divide
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   812
proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   813
  fix a :: real
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   814
  have *: "{w \<in> space M. a \<le> 1 / f w} =
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   815
      ({w \<in> space M. 0 < f w} \<inter> {w \<in> space M. a * f w \<le> 1}) \<union>
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   816
      ({w \<in> space M. f w < 0} \<inter> {w \<in> space M. 1 \<le> a * f w}) \<union>
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   817
      ({w \<in> space M. f w = 0} \<inter> {w \<in> space M. a \<le> 0})" by (auto simp: le_divide_eq)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   818
  show "{w \<in> space M. a \<le> 1 / f w} \<in> sets M" using assms unfolding *
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   819
    by (auto intro!: Int Un)
35692
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   820
qed
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   821
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   822
lemma (in sigma_algebra) borel_measurable_divide[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   823
  fixes f :: "'a \<Rightarrow> real"
35692
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   824
  assumes "f \<in> borel_measurable M"
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   825
  and "g \<in> borel_measurable M"
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   826
  shows "(\<lambda>x. f x / g x) \<in> borel_measurable M"
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   827
  unfolding field_divide_inverse
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   828
  by (rule borel_measurable_inverse borel_measurable_times assms)+
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   829
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   830
lemma (in sigma_algebra) borel_measurable_max[intro, simp]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   831
  fixes f g :: "'a \<Rightarrow> real"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   832
  assumes "f \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   833
  assumes "g \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   834
  shows "(\<lambda>x. max (g x) (f x)) \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   835
  unfolding borel_measurable_iff_le
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   836
proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   837
  fix a
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   838
  have "{x \<in> space M. max (g x) (f x) \<le> a} =
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   839
    {x \<in> space M. g x \<le> a} \<inter> {x \<in> space M. f x \<le> a}" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   840
  thus "{x \<in> space M. max (g x) (f x) \<le> a} \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   841
    using assms unfolding borel_measurable_iff_le
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   842
    by (auto intro!: Int)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   843
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   844
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   845
lemma (in sigma_algebra) borel_measurable_min[intro, simp]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   846
  fixes f g :: "'a \<Rightarrow> real"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   847
  assumes "f \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   848
  assumes "g \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   849
  shows "(\<lambda>x. min (g x) (f x)) \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   850
  unfolding borel_measurable_iff_ge
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   851
proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   852
  fix a
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   853
  have "{x \<in> space M. a \<le> min (g x) (f x)} =
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   854
    {x \<in> space M. a \<le> g x} \<inter> {x \<in> space M. a \<le> f x}" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   855
  thus "{x \<in> space M. a \<le> min (g x) (f x)} \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   856
    using assms unfolding borel_measurable_iff_ge
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   857
    by (auto intro!: Int)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   858
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   859
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   860
lemma (in sigma_algebra) borel_measurable_abs[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   861
  assumes "f \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   862
  shows "(\<lambda>x. \<bar>f x :: real\<bar>) \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   863
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   864
  have *: "\<And>x. \<bar>f x\<bar> = max 0 (f x) + max 0 (- f x)" by (simp add: max_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   865
  show ?thesis unfolding * using assms by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   866
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   867
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   868
section "Borel space over the real line with infinity"
35692
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   869
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   870
lemma borel_space_Real_measurable:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   871
  "A \<in> sets borel_space \<Longrightarrow> Real -` A \<in> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   872
proof (rule borel_measurable_translate)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   873
  fix B :: "pinfreal set" assume "open B"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   874
  then obtain T x where T: "open T" "Real ` (T \<inter> {0..}) = B - {\<omega>}" and
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   875
    x: "\<omega> \<in> B \<Longrightarrow> 0 \<le> x" "\<omega> \<in> B \<Longrightarrow> {Real x <..} \<subseteq> B"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   876
    unfolding open_pinfreal_def by blast
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   877
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   878
  have "Real -` B = Real -` (B - {\<omega>})" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   879
  also have "\<dots> = Real -` (Real ` (T \<inter> {0..}))" using T by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   880
  also have "\<dots> = (if 0 \<in> T then T \<union> {.. 0} else T \<inter> {0..})"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   881
    apply (auto simp add: Real_eq_Real image_iff)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   882
    apply (rule_tac x="max 0 x" in bexI)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   883
    by (auto simp: max_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   884
  finally show "Real -` B \<in> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   885
    using `open T` by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   886
qed simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   887
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   888
lemma borel_space_real_measurable:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   889
  "A \<in> sets borel_space \<Longrightarrow> (real -` A :: pinfreal set) \<in> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   890
proof (rule borel_measurable_translate)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   891
  fix B :: "real set" assume "open B"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   892
  { fix x have "0 < real x \<longleftrightarrow> (\<exists>r>0. x = Real r)" by (cases x) auto }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   893
  note Ex_less_real = this
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   894
  have *: "real -` B = (if 0 \<in> B then real -` (B \<inter> {0 <..}) \<union> {0, \<omega>} else real -` (B \<inter> {0 <..}))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   895
    by (force simp: Ex_less_real)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   896
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   897
  have "open (real -` (B \<inter> {0 <..}) :: pinfreal set)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   898
    unfolding open_pinfreal_def using `open B`
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   899
    by (auto intro!: open_Int exI[of _ "B \<inter> {0 <..}"] simp: image_iff Ex_less_real)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   900
  then show "(real -` B :: pinfreal set) \<in> sets borel_space" unfolding * by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   901
qed simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   902
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   903
lemma (in sigma_algebra) borel_measurable_Real[intro, simp]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   904
  assumes "f \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   905
  shows "(\<lambda>x. Real (f x)) \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   906
  unfolding in_borel_measurable_borel_space
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   907
proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   908
  fix S :: "pinfreal set" assume "S \<in> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   909
  from borel_space_Real_measurable[OF this]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   910
  have "(Real \<circ> f) -` S \<inter> space M \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   911
    using assms
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   912
    unfolding vimage_compose in_borel_measurable_borel_space
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   913
    by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   914
  thus "(\<lambda>x. Real (f x)) -` S \<inter> space M \<in> sets M" by (simp add: comp_def)
35748
5f35613d9a65 Equality of integral and infinite sum.
hoelzl
parents: 35704
diff changeset
   915
qed
35692
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   916
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   917
lemma (in sigma_algebra) borel_measurable_real[intro, simp]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   918
  fixes f :: "'a \<Rightarrow> pinfreal"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   919
  assumes "f \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   920
  shows "(\<lambda>x. real (f x)) \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   921
  unfolding in_borel_measurable_borel_space
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   922
proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   923
  fix S :: "real set" assume "S \<in> sets borel_space"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   924
  from borel_space_real_measurable[OF this]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   925
  have "(real \<circ> f) -` S \<inter> space M \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   926
    using assms
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   927
    unfolding vimage_compose in_borel_measurable_borel_space
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   928
    by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   929
  thus "(\<lambda>x. real (f x)) -` S \<inter> space M \<in> sets M" by (simp add: comp_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   930
qed
35692
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   931
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   932
lemma (in sigma_algebra) borel_measurable_Real_eq:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   933
  assumes "\<And>x. x \<in> space M \<Longrightarrow> 0 \<le> f x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   934
  shows "(\<lambda>x. Real (f x)) \<in> borel_measurable M \<longleftrightarrow> f \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   935
proof
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   936
  have [simp]: "(\<lambda>x. Real (f x)) -` {\<omega>} \<inter> space M = {}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   937
    by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   938
  assume "(\<lambda>x. Real (f x)) \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   939
  hence "(\<lambda>x. real (Real (f x))) \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   940
    by (rule borel_measurable_real)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   941
  moreover have "\<And>x. x \<in> space M \<Longrightarrow> real (Real (f x)) = f x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   942
    using assms by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   943
  ultimately show "f \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   944
    by (simp cong: measurable_cong)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   945
qed auto
35692
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   946
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   947
lemma (in sigma_algebra) borel_measurable_pinfreal_eq_real:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   948
  "f \<in> borel_measurable M \<longleftrightarrow>
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   949
    ((\<lambda>x. real (f x)) \<in> borel_measurable M \<and> f -` {\<omega>} \<inter> space M \<in> sets M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   950
proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   951
  assume "f \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   952
  then show "(\<lambda>x. real (f x)) \<in> borel_measurable M" "f -` {\<omega>} \<inter> space M \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   953
    by (auto intro: borel_measurable_vimage borel_measurable_real)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   954
next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   955
  assume *: "(\<lambda>x. real (f x)) \<in> borel_measurable M" "f -` {\<omega>} \<inter> space M \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   956
  have "f -` {\<omega>} \<inter> space M = {x\<in>space M. f x = \<omega>}" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   957
  with * have **: "{x\<in>space M. f x = \<omega>} \<in> sets M" by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   958
  have f: "f = (\<lambda>x. if f x = \<omega> then \<omega> else Real (real (f x)))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   959
    by (simp add: expand_fun_eq Real_real)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   960
  show "f \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   961
    apply (subst f)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   962
    apply (rule measurable_If)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   963
    using * ** by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   964
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   965
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   966
lemma (in sigma_algebra) less_eq_ge_measurable:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   967
  fixes f :: "'a \<Rightarrow> 'c::linorder"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   968
  shows "{x\<in>space M. a < f x} \<in> sets M \<longleftrightarrow> {x\<in>space M. f x \<le> a} \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   969
proof
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   970
  assume "{x\<in>space M. f x \<le> a} \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   971
  moreover have "{x\<in>space M. a < f x} = space M - {x\<in>space M. f x \<le> a}" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   972
  ultimately show "{x\<in>space M. a < f x} \<in> sets M" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   973
next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   974
  assume "{x\<in>space M. a < f x} \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   975
  moreover have "{x\<in>space M. f x \<le> a} = space M - {x\<in>space M. a < f x}" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   976
  ultimately show "{x\<in>space M. f x \<le> a} \<in> sets M" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   977
qed
35692
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
   978
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   979
lemma (in sigma_algebra) greater_eq_le_measurable:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   980
  fixes f :: "'a \<Rightarrow> 'c::linorder"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   981
  shows "{x\<in>space M. f x < a} \<in> sets M \<longleftrightarrow> {x\<in>space M. a \<le> f x} \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   982
proof
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   983
  assume "{x\<in>space M. a \<le> f x} \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   984
  moreover have "{x\<in>space M. f x < a} = space M - {x\<in>space M. a \<le> f x}" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   985
  ultimately show "{x\<in>space M. f x < a} \<in> sets M" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   986
next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   987
  assume "{x\<in>space M. f x < a} \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   988
  moreover have "{x\<in>space M. a \<le> f x} = space M - {x\<in>space M. f x < a}" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   989
  ultimately show "{x\<in>space M. a \<le> f x} \<in> sets M" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   990
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   991
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   992
lemma (in sigma_algebra) less_eq_le_pinfreal_measurable:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   993
  fixes f :: "'a \<Rightarrow> pinfreal"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   994
  shows "(\<forall>a. {x\<in>space M. a < f x} \<in> sets M) \<longleftrightarrow> (\<forall>a. {x\<in>space M. a \<le> f x} \<in> sets M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   995
proof
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   996
  assume a: "\<forall>a. {x\<in>space M. a \<le> f x} \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   997
  show "\<forall>a. {x \<in> space M. a < f x} \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   998
  proof
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
   999
    fix a show "{x \<in> space M. a < f x} \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1000
    proof (cases a)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1001
      case (preal r)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1002
      have "{x\<in>space M. a < f x} = (\<Union>i. {x\<in>space M. a + inverse (of_nat (Suc i)) \<le> f x})"
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
  1003
      proof safe
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1004
        fix x assume "a < f x" and [simp]: "x \<in> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1005
        with ex_pinfreal_inverse_of_nat_Suc_less[of "f x - a"]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1006
        obtain n where "a + inverse (of_nat (Suc n)) < f x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1007
          by (cases "f x", auto simp: pinfreal_minus_order)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1008
        then have "a + inverse (of_nat (Suc n)) \<le> f x" by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1009
        then show "x \<in> (\<Union>i. {x \<in> space M. a + inverse (of_nat (Suc i)) \<le> f x})"
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
  1010
          by auto
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
  1011
      next
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1012
        fix i x assume [simp]: "x \<in> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1013
        have "a < a + inverse (of_nat (Suc i))" using preal by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1014
        also assume "a + inverse (of_nat (Suc i)) \<le> f x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1015
        finally show "a < f x" .
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
  1016
      qed
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1017
      with a show ?thesis by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1018
    qed simp
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 35347
diff changeset
  1019
  qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 35347
diff changeset
  1020
next
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1021
  assume a': "\<forall>a. {x \<in> space M. a < f x} \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1022
  then have a: "\<forall>a. {x \<in> space M. f x \<le> a} \<in> sets M" unfolding less_eq_ge_measurable .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1023
  show "\<forall>a. {x \<in> space M. a \<le> f x} \<in> sets M" unfolding greater_eq_le_measurable[symmetric]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1024
  proof
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1025
    fix a show "{x \<in> space M. f x < a} \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1026
    proof (cases a)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1027
      case (preal r)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1028
      show ?thesis
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1029
      proof cases
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1030
        assume "a = 0" then show ?thesis by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1031
      next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1032
        assume "a \<noteq> 0"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1033
        have "{x\<in>space M. f x < a} = (\<Union>i. {x\<in>space M. f x \<le> a - inverse (of_nat (Suc i))})"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1034
        proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1035
          fix x assume "f x < a" and [simp]: "x \<in> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1036
          with ex_pinfreal_inverse_of_nat_Suc_less[of "a - f x"]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1037
          obtain n where "inverse (of_nat (Suc n)) < a - f x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1038
            using preal by (cases "f x") auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1039
          then have "f x \<le> a - inverse (of_nat (Suc n)) "
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1040
            using preal by (cases "f x") (auto split: split_if_asm)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1041
          then show "x \<in> (\<Union>i. {x \<in> space M. f x \<le> a - inverse (of_nat (Suc i))})"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1042
            by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1043
        next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1044
          fix i x assume [simp]: "x \<in> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1045
          assume "f x \<le> a - inverse (of_nat (Suc i))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1046
          also have "\<dots> < a" using `a \<noteq> 0` preal by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1047
          finally show "f x < a" .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1048
        qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1049
        with a show ?thesis by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1050
      qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1051
    next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1052
      case infinite
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1053
      have "f -` {\<omega>} \<inter> space M = (\<Inter>n. {x\<in>space M. of_nat n < f x})"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1054
      proof (safe, simp_all, safe)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1055
        fix x assume *: "\<forall>n::nat. Real (real n) < f x"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1056
        show "f x = \<omega>"    proof (rule ccontr)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1057
          assume "f x \<noteq> \<omega>"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1058
          with real_arch_lt[of "real (f x)"] obtain n where "f x < of_nat n"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1059
            by (auto simp: pinfreal_noteq_omega_Ex)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1060
          with *[THEN spec, of n] show False by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1061
        qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1062
      qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1063
      with a' have \<omega>: "f -` {\<omega>} \<inter> space M \<in> sets M" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1064
      moreover have "{x \<in> space M. f x < a} = space M - f -` {\<omega>} \<inter> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1065
        using infinite by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1066
      ultimately show ?thesis by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1067
    qed
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 35347
diff changeset
  1068
  qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 35347
diff changeset
  1069
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 35347
diff changeset
  1070
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1071
lemma (in sigma_algebra) borel_measurable_pinfreal_iff_greater:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1072
  "(f::'a \<Rightarrow> pinfreal) \<in> borel_measurable M \<longleftrightarrow> (\<forall>a. {x\<in>space M. a < f x} \<in> sets M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1073
proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1074
  fix a assume f: "f \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1075
  have "{x\<in>space M. a < f x} = f -` {a <..} \<inter> space M" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1076
  with f show "{x\<in>space M. a < f x} \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1077
    by (auto intro!: measurable_sets)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1078
next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1079
  assume *: "\<forall>a. {x\<in>space M. a < f x} \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1080
  hence **: "\<forall>a. {x\<in>space M. f x < a} \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1081
    unfolding less_eq_le_pinfreal_measurable
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1082
    unfolding greater_eq_le_measurable .
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 35347
diff changeset
  1083
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1084
  show "f \<in> borel_measurable M" unfolding borel_measurable_pinfreal_eq_real borel_measurable_iff_greater
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1085
  proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1086
    have "f -` {\<omega>} \<inter> space M = space M - {x\<in>space M. f x < \<omega>}" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1087
    then show \<omega>: "f -` {\<omega>} \<inter> space M \<in> sets M" using ** by auto
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 35347
diff changeset
  1088
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1089
    fix a
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1090
    have "{w \<in> space M. a < real (f w)} =
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1091
      (if 0 \<le> a then {w\<in>space M. Real a < f w} - (f -` {\<omega>} \<inter> space M) else space M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1092
    proof (split split_if, safe del: notI)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1093
      fix x assume "0 \<le> a"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1094
      { assume "a < real (f x)" then show "Real a < f x" "x \<notin> f -` {\<omega>} \<inter> space M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1095
          using `0 \<le> a` by (cases "f x", auto) }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1096
      { assume "Real a < f x" "x \<notin> f -` {\<omega>}" then show "a < real (f x)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1097
          using `0 \<le> a` by (cases "f x", auto) }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1098
    next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1099
      fix x assume "\<not> 0 \<le> a" then show "a < real (f x)" by (cases "f x") auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1100
    qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1101
    then show "{w \<in> space M. a < real (f w)} \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1102
      using \<omega> * by (auto intro!: Diff)
35582
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 35347
diff changeset
  1103
  qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 35347
diff changeset
  1104
qed
b16d99a72dc9 Add Lebesgue integral and probability space.
hoelzl
parents: 35347
diff changeset
  1105
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1106
lemma (in sigma_algebra) borel_measurable_pinfreal_iff_less:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1107
  "(f::'a \<Rightarrow> pinfreal) \<in> borel_measurable M \<longleftrightarrow> (\<forall>a. {x\<in>space M. f x < a} \<in> sets M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1108
  using borel_measurable_pinfreal_iff_greater unfolding less_eq_le_pinfreal_measurable greater_eq_le_measurable .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1109
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1110
lemma (in sigma_algebra) borel_measurable_pinfreal_iff_le:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1111
  "(f::'a \<Rightarrow> pinfreal) \<in> borel_measurable M \<longleftrightarrow> (\<forall>a. {x\<in>space M. f x \<le> a} \<in> sets M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1112
  using borel_measurable_pinfreal_iff_greater unfolding less_eq_ge_measurable .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1113
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1114
lemma (in sigma_algebra) borel_measurable_pinfreal_iff_ge:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1115
  "(f::'a \<Rightarrow> pinfreal) \<in> borel_measurable M \<longleftrightarrow> (\<forall>a. {x\<in>space M. a \<le> f x} \<in> sets M)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1116
  using borel_measurable_pinfreal_iff_greater unfolding less_eq_le_pinfreal_measurable .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1117
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1118
lemma (in sigma_algebra) borel_measurable_pinfreal_eq_const:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1119
  fixes f :: "'a \<Rightarrow> pinfreal" assumes "f \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1120
  shows "{x\<in>space M. f x = c} \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1121
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1122
  have "{x\<in>space M. f x = c} = (f -` {c} \<inter> space M)" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1123
  then show ?thesis using assms by (auto intro!: measurable_sets)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1124
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1125
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1126
lemma (in sigma_algebra) borel_measurable_pinfreal_neq_const:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1127
  fixes f :: "'a \<Rightarrow> pinfreal"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1128
  assumes "f \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1129
  shows "{x\<in>space M. f x \<noteq> c} \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1130
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1131
  have "{x\<in>space M. f x \<noteq> c} = space M - (f -` {c} \<inter> space M)" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1132
  then show ?thesis using assms by (auto intro!: measurable_sets)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1133
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1134
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1135
lemma (in sigma_algebra) borel_measurable_pinfreal_less[intro,simp]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1136
  fixes f g :: "'a \<Rightarrow> pinfreal"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1137
  assumes f: "f \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1138
  assumes g: "g \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1139
  shows "{x \<in> space M. f x < g x} \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1140
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1141
  have "(\<lambda>x. real (f x)) \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1142
    "(\<lambda>x. real (g x)) \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1143
    using assms by (auto intro!: borel_measurable_real)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1144
  from borel_measurable_less[OF this]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1145
  have "{x \<in> space M. real (f x) < real (g x)} \<in> sets M" .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1146
  moreover have "{x \<in> space M. f x \<noteq> \<omega>} \<in> sets M" using f by (rule borel_measurable_pinfreal_neq_const)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1147
  moreover have "{x \<in> space M. g x = \<omega>} \<in> sets M" using g by (rule borel_measurable_pinfreal_eq_const)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1148
  moreover have "{x \<in> space M. g x \<noteq> \<omega>} \<in> sets M" using g by (rule borel_measurable_pinfreal_neq_const)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1149
  moreover have "{x \<in> space M. f x < g x} = ({x \<in> space M. g x = \<omega>} \<inter> {x \<in> space M. f x \<noteq> \<omega>}) \<union>
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1150
    ({x \<in> space M. g x \<noteq> \<omega>} \<inter> {x \<in> space M. f x \<noteq> \<omega>} \<inter> {x \<in> space M. real (f x) < real (g x)})"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1151
    by (auto simp: real_of_pinfreal_strict_mono_iff)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1152
  ultimately show ?thesis by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1153
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1154
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1155
lemma (in sigma_algebra) borel_measurable_pinfreal_le[intro,simp]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1156
  fixes f :: "'a \<Rightarrow> pinfreal"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1157
  assumes f: "f \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1158
  assumes g: "g \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1159
  shows "{x \<in> space M. f x \<le> g x} \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1160
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1161
  have "{x \<in> space M. f x \<le> g x} = space M - {x \<in> space M. g x < f x}" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1162
  then show ?thesis using g f by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1163
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1164
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1165
lemma (in sigma_algebra) borel_measurable_pinfreal_eq[intro,simp]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1166
  fixes f :: "'a \<Rightarrow> pinfreal"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1167
  assumes f: "f \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1168
  assumes g: "g \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1169
  shows "{w \<in> space M. f w = g w} \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1170
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1171
  have "{x \<in> space M. f x = g x} = {x \<in> space M. g x \<le> f x} \<inter> {x \<in> space M. f x \<le> g x}" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1172
  then show ?thesis using g f by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1173
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1174
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1175
lemma (in sigma_algebra) borel_measurable_pinfreal_neq[intro,simp]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1176
  fixes f :: "'a \<Rightarrow> pinfreal"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1177
  assumes f: "f \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1178
  assumes g: "g \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1179
  shows "{w \<in> space M. f w \<noteq> g w} \<in> sets M"
35692
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
  1180
proof -
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1181
  have "{w \<in> space M. f w \<noteq> g w} = space M - {w \<in> space M. f w = g w}" by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1182
  thus ?thesis using f g by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1183
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1184
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1185
lemma (in sigma_algebra) borel_measurable_pinfreal_add[intro, simp]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1186
  fixes f :: "'a \<Rightarrow> pinfreal"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1187
  assumes measure: "f \<in> borel_measurable M" "g \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1188
  shows "(\<lambda>x. f x + g x) \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1189
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1190
  have *: "(\<lambda>x. f x + g x) =
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1191
     (\<lambda>x. if f x = \<omega> then \<omega> else if g x = \<omega> then \<omega> else Real (real (f x) + real (g x)))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1192
     by (auto simp: expand_fun_eq pinfreal_noteq_omega_Ex)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1193
  show ?thesis using assms unfolding *
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1194
    by (auto intro!: measurable_If)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1195
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1196
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1197
lemma (in sigma_algebra) borel_measurable_pinfreal_times[intro, simp]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1198
  fixes f :: "'a \<Rightarrow> pinfreal" assumes "f \<in> borel_measurable M" "g \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1199
  shows "(\<lambda>x. f x * g x) \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1200
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1201
  have *: "(\<lambda>x. f x * g x) =
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1202
     (\<lambda>x. if f x = 0 then 0 else if g x = 0 then 0 else if f x = \<omega> then \<omega> else if g x = \<omega> then \<omega> else
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1203
      Real (real (f x) * real (g x)))"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1204
     by (auto simp: expand_fun_eq pinfreal_noteq_omega_Ex)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1205
  show ?thesis using assms unfolding *
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1206
    by (auto intro!: measurable_If)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1207
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1208
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1209
lemma (in sigma_algebra) borel_measurable_pinfreal_setsum[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1210
  fixes f :: "'c \<Rightarrow> 'a \<Rightarrow> pinfreal"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1211
  assumes "\<And>i. i \<in> S \<Longrightarrow> f i \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1212
  shows "(\<lambda>x. \<Sum>i\<in>S. f i x) \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1213
proof cases
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1214
  assume "finite S"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1215
  thus ?thesis using assms
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1216
    by induct auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1217
qed (simp add: borel_measurable_const)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1218
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1219
lemma (in sigma_algebra) borel_measurable_pinfreal_min[intro, simp]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1220
  fixes f g :: "'a \<Rightarrow> pinfreal"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1221
  assumes "f \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1222
  assumes "g \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1223
  shows "(\<lambda>x. min (g x) (f x)) \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1224
  using assms unfolding min_def by (auto intro!: measurable_If)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1225
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1226
lemma (in sigma_algebra) borel_measurable_pinfreal_max[intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1227
  fixes f g :: "'a \<Rightarrow> pinfreal"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1228
  assumes "f \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1229
  and "g \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1230
  shows "(\<lambda>x. max (g x) (f x)) \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1231
  using assms unfolding max_def by (auto intro!: measurable_If)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1232
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1233
lemma (in sigma_algebra) borel_measurable_SUP[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1234
  fixes f :: "'d\<Colon>countable \<Rightarrow> 'a \<Rightarrow> pinfreal"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1235
  assumes "\<And>i. i \<in> A \<Longrightarrow> f i \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1236
  shows "(SUP i : A. f i) \<in> borel_measurable M" (is "?sup \<in> borel_measurable M")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1237
  unfolding borel_measurable_pinfreal_iff_greater
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1238
proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1239
  fix a
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1240
  have "{x\<in>space M. a < ?sup x} = (\<Union>i\<in>A. {x\<in>space M. a < f i x})"
38705
aaee86c0e237 moved generic lemmas in Probability to HOL
hoelzl
parents: 38656
diff changeset
  1241
    by (auto simp: less_Sup_iff SUPR_def[where 'a=pinfreal] SUPR_fun_expand[where 'c=pinfreal])
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1242
  then show "{x\<in>space M. a < ?sup x} \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1243
    using assms by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1244
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1245
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1246
lemma (in sigma_algebra) borel_measurable_INF[simp, intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1247
  fixes f :: "'d :: countable \<Rightarrow> 'a \<Rightarrow> pinfreal"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1248
  assumes "\<And>i. i \<in> A \<Longrightarrow> f i \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1249
  shows "(INF i : A. f i) \<in> borel_measurable M" (is "?inf \<in> borel_measurable M")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1250
  unfolding borel_measurable_pinfreal_iff_less
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1251
proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1252
  fix a
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1253
  have "{x\<in>space M. ?inf x < a} = (\<Union>i\<in>A. {x\<in>space M. f i x < a})"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1254
    by (auto simp: Inf_less_iff INFI_def[where 'a=pinfreal] INFI_fun_expand)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1255
  then show "{x\<in>space M. ?inf x < a} \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1256
    using assms by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1257
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1258
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1259
lemma (in sigma_algebra) borel_measurable_pinfreal_diff:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1260
  fixes f g :: "'a \<Rightarrow> pinfreal"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1261
  assumes "f \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1262
  assumes "g \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1263
  shows "(\<lambda>x. f x - g x) \<in> borel_measurable M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1264
  unfolding borel_measurable_pinfreal_iff_greater
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1265
proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1266
  fix a
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1267
  have "{x \<in> space M. a < f x - g x} = {x \<in> space M. g x + a < f x}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1268
    by (simp add: pinfreal_less_minus_iff)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1269
  then show "{x \<in> space M. a < f x - g x} \<in> sets M"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37887
diff changeset
  1270
    using assms by auto
35692
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
  1271
qed
f1315bbf1bc9 Moved theorems in Lebesgue to the right places
hoelzl
parents: 35582
diff changeset
  1272
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents:
diff changeset
  1273
end