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