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