src/HOL/Probability/Sigma_Algebra.thy
author hoelzl
Thu, 29 Nov 2012 09:59:20 +0100
changeset 50283 e79a8341dd6b
parent 50252 4aa34bd43228
child 50386 d00e2b0ca069
permissions -rw-r--r--
make SML/NJ happy (give names for all fields in a record)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
41983
2dc6e382a58b standardized headers;
wenzelm
parents: 41981
diff changeset
     1
(*  Title:      HOL/Probability/Sigma_Algebra.thy
42067
66c8281349ec standardized headers
hoelzl
parents: 42065
diff changeset
     2
    Author:     Stefan Richter, Markus Wenzel, TU München
66c8281349ec standardized headers
hoelzl
parents: 42065
diff changeset
     3
    Author:     Johannes Hölzl, TU München
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41959
diff changeset
     4
    Plus material from the Hurd/Coble measure theory development,
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41959
diff changeset
     5
    translated by Lawrence Paulson.
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
     6
*)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
     7
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
     8
header {* Sigma Algebras *}
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
     9
41413
64cd30d6b0b8 explicit file specifications -- avoid secondary load path;
wenzelm
parents: 41095
diff changeset
    10
theory Sigma_Algebra
64cd30d6b0b8 explicit file specifications -- avoid secondary load path;
wenzelm
parents: 41095
diff changeset
    11
imports
42145
8448713d48b7 proved caratheodory_empty_continuous
hoelzl
parents: 42067
diff changeset
    12
  Complex_Main
50245
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
    13
  "~~/src/HOL/Library/Countable_Set"
41413
64cd30d6b0b8 explicit file specifications -- avoid secondary load path;
wenzelm
parents: 41095
diff changeset
    14
  "~~/src/HOL/Library/FuncSet"
64cd30d6b0b8 explicit file specifications -- avoid secondary load path;
wenzelm
parents: 41095
diff changeset
    15
  "~~/src/HOL/Library/Indicator_Function"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
    16
  "~~/src/HOL/Library/Extended_Real"
41413
64cd30d6b0b8 explicit file specifications -- avoid secondary load path;
wenzelm
parents: 41095
diff changeset
    17
begin
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    18
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    19
text {* Sigma algebras are an elementary concept in measure
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    20
  theory. To measure --- that is to integrate --- functions, we first have
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    21
  to measure sets. Unfortunately, when dealing with a large universe,
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    22
  it is often not possible to consistently assign a measure to every
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    23
  subset. Therefore it is necessary to define the set of measurable
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    24
  subsets of the universe. A sigma algebra is such a set that has
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    25
  three very natural and desirable properties. *}
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    26
47762
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    27
subsection {* Families of sets *}
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    28
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
    29
locale subset_class =
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
    30
  fixes \<Omega> :: "'a set" and M :: "'a set set"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
    31
  assumes space_closed: "M \<subseteq> Pow \<Omega>"
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    32
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
    33
lemma (in subset_class) sets_into_space: "x \<in> M \<Longrightarrow> x \<subseteq> \<Omega>"
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    34
  by (metis PowD contra_subsetD space_closed)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    35
47762
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    36
subsection {* Semiring of sets *}
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    37
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    38
subsubsection {* Disjoint sets *}
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    39
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    40
definition "disjoint A \<longleftrightarrow> (\<forall>a\<in>A. \<forall>b\<in>A. a \<noteq> b \<longrightarrow> a \<inter> b = {})"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    41
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    42
lemma disjointI:
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    43
  "(\<And>a b. a \<in> A \<Longrightarrow> b \<in> A \<Longrightarrow> a \<noteq> b \<Longrightarrow> a \<inter> b = {}) \<Longrightarrow> disjoint A"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    44
  unfolding disjoint_def by auto
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    45
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    46
lemma disjointD:
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    47
  "disjoint A \<Longrightarrow> a \<in> A \<Longrightarrow> b \<in> A \<Longrightarrow> a \<noteq> b \<Longrightarrow> a \<inter> b = {}"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    48
  unfolding disjoint_def by auto
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    49
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    50
lemma disjoint_empty[iff]: "disjoint {}"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    51
  by (auto simp: disjoint_def)
42065
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
    52
47762
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    53
lemma disjoint_union: 
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    54
  assumes C: "disjoint C" and B: "disjoint B" and disj: "\<Union>C \<inter> \<Union>B = {}"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    55
  shows "disjoint (C \<union> B)"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    56
proof (rule disjointI)
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    57
  fix c d assume sets: "c \<in> C \<union> B" "d \<in> C \<union> B" and "c \<noteq> d"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    58
  show "c \<inter> d = {}"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    59
  proof cases
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    60
    assume "(c \<in> C \<and> d \<in> C) \<or> (c \<in> B \<and> d \<in> B)"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    61
    then show ?thesis
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    62
    proof 
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    63
      assume "c \<in> C \<and> d \<in> C" with `c \<noteq> d` C show "c \<inter> d = {}"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    64
        by (auto simp: disjoint_def)
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    65
    next
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    66
      assume "c \<in> B \<and> d \<in> B" with `c \<noteq> d` B show "c \<inter> d = {}"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    67
        by (auto simp: disjoint_def)
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    68
    qed
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    69
  next
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    70
    assume "\<not> ((c \<in> C \<and> d \<in> C) \<or> (c \<in> B \<and> d \<in> B))"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    71
    with sets have "(c \<subseteq> \<Union>C \<and> d \<subseteq> \<Union>B) \<or> (c \<subseteq> \<Union>B \<and> d \<subseteq> \<Union>C)"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    72
      by auto
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    73
    with disj show "c \<inter> d = {}" by auto
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    74
  qed
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    75
qed
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    76
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    77
locale semiring_of_sets = subset_class +
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    78
  assumes empty_sets[iff]: "{} \<in> M"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    79
  assumes Int[intro]: "\<And>a b. a \<in> M \<Longrightarrow> b \<in> M \<Longrightarrow> a \<inter> b \<in> M"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    80
  assumes Diff_cover:
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    81
    "\<And>a b. a \<in> M \<Longrightarrow> b \<in> M \<Longrightarrow> \<exists>C\<subseteq>M. finite C \<and> disjoint C \<and> a - b = \<Union>C"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    82
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    83
lemma (in semiring_of_sets) finite_INT[intro]:
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    84
  assumes "finite I" "I \<noteq> {}" "\<And>i. i \<in> I \<Longrightarrow> A i \<in> M"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    85
  shows "(\<Inter>i\<in>I. A i) \<in> M"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    86
  using assms by (induct rule: finite_ne_induct) auto
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    87
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    88
lemma (in semiring_of_sets) Int_space_eq1 [simp]: "x \<in> M \<Longrightarrow> \<Omega> \<inter> x = x"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    89
  by (metis Int_absorb1 sets_into_space)
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    90
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    91
lemma (in semiring_of_sets) Int_space_eq2 [simp]: "x \<in> M \<Longrightarrow> x \<inter> \<Omega> = x"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    92
  by (metis Int_absorb2 sets_into_space)
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    93
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    94
lemma (in semiring_of_sets) sets_Collect_conj:
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    95
  assumes "{x\<in>\<Omega>. P x} \<in> M" "{x\<in>\<Omega>. Q x} \<in> M"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    96
  shows "{x\<in>\<Omega>. Q x \<and> P x} \<in> M"
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
    97
proof -
47762
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
    98
  have "{x\<in>\<Omega>. Q x \<and> P x} = {x\<in>\<Omega>. Q x} \<inter> {x\<in>\<Omega>. P x}"
42065
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
    99
    by auto
47762
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   100
  with assms show ?thesis by auto
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   101
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   102
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
   103
lemma (in semiring_of_sets) sets_Collect_finite_All':
47762
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   104
  assumes "\<And>i. i \<in> S \<Longrightarrow> {x\<in>\<Omega>. P i x} \<in> M" "finite S" "S \<noteq> {}"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   105
  shows "{x\<in>\<Omega>. \<forall>i\<in>S. P i x} \<in> M"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   106
proof -
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   107
  have "{x\<in>\<Omega>. \<forall>i\<in>S. P i x} = (\<Inter>i\<in>S. {x\<in>\<Omega>. P i x})"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   108
    using `S \<noteq> {}` by auto
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   109
  with assms show ?thesis by auto
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   110
qed
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   111
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   112
locale ring_of_sets = semiring_of_sets +
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   113
  assumes Un [intro]: "\<And>a b. a \<in> M \<Longrightarrow> b \<in> M \<Longrightarrow> a \<union> b \<in> M"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   114
42065
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   115
lemma (in ring_of_sets) finite_Union [intro]:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   116
  "finite X \<Longrightarrow> X \<subseteq> M \<Longrightarrow> Union X \<in> M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   117
  by (induct set: finite) (auto simp add: Un)
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   118
42065
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   119
lemma (in ring_of_sets) finite_UN[intro]:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   120
  assumes "finite I" and "\<And>i. i \<in> I \<Longrightarrow> A i \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   121
  shows "(\<Union>i\<in>I. A i) \<in> M"
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41959
diff changeset
   122
  using assms by induct auto
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41959
diff changeset
   123
47762
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   124
lemma (in ring_of_sets) Diff [intro]:
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   125
  assumes "a \<in> M" "b \<in> M" shows "a - b \<in> M"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   126
  using Diff_cover[OF assms] by auto
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   127
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   128
lemma ring_of_setsI:
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   129
  assumes space_closed: "M \<subseteq> Pow \<Omega>"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   130
  assumes empty_sets[iff]: "{} \<in> M"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   131
  assumes Un[intro]: "\<And>a b. a \<in> M \<Longrightarrow> b \<in> M \<Longrightarrow> a \<union> b \<in> M"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   132
  assumes Diff[intro]: "\<And>a b. a \<in> M \<Longrightarrow> b \<in> M \<Longrightarrow> a - b \<in> M"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   133
  shows "ring_of_sets \<Omega> M"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   134
proof
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   135
  fix a b assume ab: "a \<in> M" "b \<in> M"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   136
  from ab show "\<exists>C\<subseteq>M. finite C \<and> disjoint C \<and> a - b = \<Union>C"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   137
    by (intro exI[of _ "{a - b}"]) (auto simp: disjoint_def)
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   138
  have "a \<inter> b = a - (a - b)" by auto
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   139
  also have "\<dots> \<in> M" using ab by auto
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   140
  finally show "a \<inter> b \<in> M" .
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   141
qed fact+
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   142
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   143
lemma ring_of_sets_iff: "ring_of_sets \<Omega> M \<longleftrightarrow> M \<subseteq> Pow \<Omega> \<and> {} \<in> M \<and> (\<forall>a\<in>M. \<forall>b\<in>M. a \<union> b \<in> M) \<and> (\<forall>a\<in>M. \<forall>b\<in>M. a - b \<in> M)"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   144
proof
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   145
  assume "ring_of_sets \<Omega> M"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   146
  then interpret ring_of_sets \<Omega> M .
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   147
  show "M \<subseteq> Pow \<Omega> \<and> {} \<in> M \<and> (\<forall>a\<in>M. \<forall>b\<in>M. a \<union> b \<in> M) \<and> (\<forall>a\<in>M. \<forall>b\<in>M. a - b \<in> M)"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   148
    using space_closed by auto
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   149
qed (auto intro!: ring_of_setsI)
41981
cdf7693bbe08 reworked Probability theory: measures are not type restricted to positive extended reals
hoelzl
parents: 41959
diff changeset
   150
42065
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   151
lemma (in ring_of_sets) insert_in_sets:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   152
  assumes "{x} \<in> M" "A \<in> M" shows "insert x A \<in> M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   153
proof -
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   154
  have "{x} \<union> A \<in> M" using assms by (rule Un)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   155
  thus ?thesis by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   156
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   157
42867
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   158
lemma (in ring_of_sets) sets_Collect_disj:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   159
  assumes "{x\<in>\<Omega>. P x} \<in> M" "{x\<in>\<Omega>. Q x} \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   160
  shows "{x\<in>\<Omega>. Q x \<or> P x} \<in> M"
42867
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   161
proof -
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   162
  have "{x\<in>\<Omega>. Q x \<or> P x} = {x\<in>\<Omega>. Q x} \<union> {x\<in>\<Omega>. P x}"
42867
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   163
    by auto
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   164
  with assms show ?thesis by auto
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   165
qed
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   166
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   167
lemma (in ring_of_sets) sets_Collect_finite_Ex:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   168
  assumes "\<And>i. i \<in> S \<Longrightarrow> {x\<in>\<Omega>. P i x} \<in> M" "finite S"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   169
  shows "{x\<in>\<Omega>. \<exists>i\<in>S. P i x} \<in> M"
42867
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   170
proof -
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   171
  have "{x\<in>\<Omega>. \<exists>i\<in>S. P i x} = (\<Union>i\<in>S. {x\<in>\<Omega>. P i x})"
42867
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   172
    by auto
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   173
  with assms show ?thesis by auto
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   174
qed
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   175
42065
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   176
locale algebra = ring_of_sets +
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   177
  assumes top [iff]: "\<Omega> \<in> M"
42065
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   178
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   179
lemma (in algebra) compl_sets [intro]:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   180
  "a \<in> M \<Longrightarrow> \<Omega> - a \<in> M"
42065
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   181
  by auto
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   182
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   183
lemma algebra_iff_Un:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   184
  "algebra \<Omega> M \<longleftrightarrow>
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   185
    M \<subseteq> Pow \<Omega> \<and>
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   186
    {} \<in> M \<and>
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   187
    (\<forall>a \<in> M. \<Omega> - a \<in> M) \<and>
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   188
    (\<forall>a \<in> M. \<forall> b \<in> M. a \<union> b \<in> M)" (is "_ \<longleftrightarrow> ?Un")
42065
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   189
proof
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   190
  assume "algebra \<Omega> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   191
  then interpret algebra \<Omega> M .
42065
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   192
  show ?Un using sets_into_space by auto
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   193
next
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   194
  assume ?Un
47762
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   195
  then have "\<Omega> \<in> M" by auto
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   196
  interpret ring_of_sets \<Omega> M
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   197
  proof (rule ring_of_setsI)
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   198
    show \<Omega>: "M \<subseteq> Pow \<Omega>" "{} \<in> M"
42065
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   199
      using `?Un` by auto
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   200
    fix a b assume a: "a \<in> M" and b: "b \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   201
    then show "a \<union> b \<in> M" using `?Un` by auto
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   202
    have "a - b = \<Omega> - ((\<Omega> - a) \<union> b)"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   203
      using \<Omega> a b by auto
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   204
    then show "a - b \<in> M"
42065
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   205
      using a b  `?Un` by auto
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   206
  qed
47762
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   207
  show "algebra \<Omega> M" proof qed fact
42065
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   208
qed
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   209
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   210
lemma algebra_iff_Int:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   211
     "algebra \<Omega> M \<longleftrightarrow>
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   212
       M \<subseteq> Pow \<Omega> & {} \<in> M &
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   213
       (\<forall>a \<in> M. \<Omega> - a \<in> M) &
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   214
       (\<forall>a \<in> M. \<forall> b \<in> M. a \<inter> b \<in> M)" (is "_ \<longleftrightarrow> ?Int")
42065
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   215
proof
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   216
  assume "algebra \<Omega> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   217
  then interpret algebra \<Omega> M .
42065
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   218
  show ?Int using sets_into_space by auto
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   219
next
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   220
  assume ?Int
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   221
  show "algebra \<Omega> M"
42065
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   222
  proof (unfold algebra_iff_Un, intro conjI ballI)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   223
    show \<Omega>: "M \<subseteq> Pow \<Omega>" "{} \<in> M"
42065
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   224
      using `?Int` by auto
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   225
    from `?Int` show "\<And>a. a \<in> M \<Longrightarrow> \<Omega> - a \<in> M" by auto
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   226
    fix a b assume M: "a \<in> M" "b \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   227
    hence "a \<union> b = \<Omega> - ((\<Omega> - a) \<inter> (\<Omega> - b))"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   228
      using \<Omega> by blast
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   229
    also have "... \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   230
      using M `?Int` by auto
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   231
    finally show "a \<union> b \<in> M" .
42065
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   232
  qed
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   233
qed
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   234
42867
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   235
lemma (in algebra) sets_Collect_neg:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   236
  assumes "{x\<in>\<Omega>. P x} \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   237
  shows "{x\<in>\<Omega>. \<not> P x} \<in> M"
42867
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   238
proof -
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   239
  have "{x\<in>\<Omega>. \<not> P x} = \<Omega> - {x\<in>\<Omega>. P x}" by auto
42867
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   240
  with assms show ?thesis by auto
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   241
qed
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   242
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   243
lemma (in algebra) sets_Collect_imp:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   244
  "{x\<in>\<Omega>. P x} \<in> M \<Longrightarrow> {x\<in>\<Omega>. Q x} \<in> M \<Longrightarrow> {x\<in>\<Omega>. Q x \<longrightarrow> P x} \<in> M"
42867
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   245
  unfolding imp_conv_disj by (intro sets_Collect_disj sets_Collect_neg)
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   246
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   247
lemma (in algebra) sets_Collect_const:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   248
  "{x\<in>\<Omega>. P} \<in> M"
42867
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   249
  by (cases P) auto
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   250
42984
43864e7475df add lemma sigma_sets_singleton
hoelzl
parents: 42981
diff changeset
   251
lemma algebra_single_set:
47762
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   252
  "X \<subseteq> S \<Longrightarrow> algebra S { {}, X, S - X, S }"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   253
  by (auto simp: algebra_iff_Int)
42984
43864e7475df add lemma sigma_sets_singleton
hoelzl
parents: 42981
diff changeset
   254
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39090
diff changeset
   255
section {* Restricted algebras *}
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39090
diff changeset
   256
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39090
diff changeset
   257
abbreviation (in algebra)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   258
  "restricted_space A \<equiv> (op \<inter> A) ` M"
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39090
diff changeset
   259
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   260
lemma (in algebra) restricted_algebra:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   261
  assumes "A \<in> M" shows "algebra A (restricted_space A)"
47762
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   262
  using assms by (auto simp: algebra_iff_Int)
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   263
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   264
subsection {* Sigma Algebras *}
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   265
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   266
locale sigma_algebra = algebra +
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   267
  assumes countable_nat_UN [intro]: "\<And>A. range A \<subseteq> M \<Longrightarrow> (\<Union>i::nat. A i) \<in> M"
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   268
42984
43864e7475df add lemma sigma_sets_singleton
hoelzl
parents: 42981
diff changeset
   269
lemma (in algebra) is_sigma_algebra:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   270
  assumes "finite M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   271
  shows "sigma_algebra \<Omega> M"
42984
43864e7475df add lemma sigma_sets_singleton
hoelzl
parents: 42981
diff changeset
   272
proof
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   273
  fix A :: "nat \<Rightarrow> 'a set" assume "range A \<subseteq> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   274
  then have "(\<Union>i. A i) = (\<Union>s\<in>M \<inter> range A. s)"
42984
43864e7475df add lemma sigma_sets_singleton
hoelzl
parents: 42981
diff changeset
   275
    by auto
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   276
  also have "(\<Union>s\<in>M \<inter> range A. s) \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   277
    using `finite M` by auto
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   278
  finally show "(\<Union>i. A i) \<in> M" .
42984
43864e7475df add lemma sigma_sets_singleton
hoelzl
parents: 42981
diff changeset
   279
qed
43864e7475df add lemma sigma_sets_singleton
hoelzl
parents: 42981
diff changeset
   280
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   281
lemma countable_UN_eq:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   282
  fixes A :: "'i::countable \<Rightarrow> 'a set"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   283
  shows "(range A \<subseteq> M \<longrightarrow> (\<Union>i. A i) \<in> M) \<longleftrightarrow>
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   284
    (range (A \<circ> from_nat) \<subseteq> M \<longrightarrow> (\<Union>i. (A \<circ> from_nat) i) \<in> M)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   285
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   286
  let ?A' = "A \<circ> from_nat"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   287
  have *: "(\<Union>i. ?A' i) = (\<Union>i. A i)" (is "?l = ?r")
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   288
  proof safe
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   289
    fix x i assume "x \<in> A i" thus "x \<in> ?l"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   290
      by (auto intro!: exI[of _ "to_nat i"])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   291
  next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   292
    fix x i assume "x \<in> ?A' i" thus "x \<in> ?r"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   293
      by (auto intro!: exI[of _ "from_nat i"])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   294
  qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   295
  have **: "range ?A' = range A"
40702
cf26dd7395e4 Replace surj by abbreviation; remove surj_on.
hoelzl
parents: 39960
diff changeset
   296
    using surj_from_nat
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   297
    by (auto simp: image_compose intro!: imageI)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   298
  show ?thesis unfolding * ** ..
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   299
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   300
50245
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
   301
lemma (in sigma_algebra) countable_Union [intro]:
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
   302
  assumes "countable X" "X \<subseteq> M" shows "Union X \<in> M"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
   303
proof cases
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
   304
  assume "X \<noteq> {}"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
   305
  hence "\<Union>X = (\<Union>n. from_nat_into X n)"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
   306
    using assms by (auto intro: from_nat_into) (metis from_nat_into_surj)
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
   307
  also have "\<dots> \<in> M" using assms
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
   308
    by (auto intro!: countable_nat_UN) (metis `X \<noteq> {}` from_nat_into set_mp)
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
   309
  finally show ?thesis .
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
   310
qed simp
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
   311
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   312
lemma (in sigma_algebra) countable_UN[intro]:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   313
  fixes A :: "'i::countable \<Rightarrow> 'a set"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   314
  assumes "A`X \<subseteq> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   315
  shows  "(\<Union>x\<in>X. A x) \<in> M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   316
proof -
46731
5302e932d1e5 avoid undeclared variables in let bindings;
wenzelm
parents: 44890
diff changeset
   317
  let ?A = "\<lambda>i. if i \<in> X then A i else {}"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   318
  from assms have "range ?A \<subseteq> M" by auto
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   319
  with countable_nat_UN[of "?A \<circ> from_nat"] countable_UN_eq[of ?A M]
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   320
  have "(\<Union>x. ?A x) \<in> M" by auto
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   321
  moreover have "(\<Union>x. ?A x) = (\<Union>x\<in>X. A x)" by (auto split: split_if_asm)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   322
  ultimately show ?thesis by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   323
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   324
33533
40b44cb20c8c New theory Probability/Borel.thy, and some associated lemmas
paulson
parents: 33271
diff changeset
   325
lemma (in sigma_algebra) countable_INT [intro]:
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   326
  fixes A :: "'i::countable \<Rightarrow> 'a set"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   327
  assumes A: "A`X \<subseteq> M" "X \<noteq> {}"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   328
  shows "(\<Inter>i\<in>X. A i) \<in> M"
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   329
proof -
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   330
  from A have "\<forall>i\<in>X. A i \<in> M" by fast
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   331
  hence "\<Omega> - (\<Union>i\<in>X. \<Omega> - A i) \<in> M" by blast
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   332
  moreover
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   333
  have "(\<Inter>i\<in>X. A i) = \<Omega> - (\<Union>i\<in>X. \<Omega> - A i)" using space_closed A
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   334
    by blast
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   335
  ultimately show ?thesis by metis
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   336
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   337
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   338
lemma ring_of_sets_Pow: "ring_of_sets sp (Pow sp)"
47762
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   339
  by (auto simp: ring_of_sets_iff)
42145
8448713d48b7 proved caratheodory_empty_continuous
hoelzl
parents: 42067
diff changeset
   340
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   341
lemma algebra_Pow: "algebra sp (Pow sp)"
47762
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   342
  by (auto simp: algebra_iff_Un)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   343
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   344
lemma sigma_algebra_iff:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   345
  "sigma_algebra \<Omega> M \<longleftrightarrow>
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   346
    algebra \<Omega> M \<and> (\<forall>A. range A \<subseteq> M \<longrightarrow> (\<Union>i::nat. A i) \<in> M)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   347
  by (simp add: sigma_algebra_def sigma_algebra_axioms_def)
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   348
47762
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   349
lemma sigma_algebra_Pow: "sigma_algebra sp (Pow sp)"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   350
  by (auto simp: sigma_algebra_iff algebra_iff_Int)
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   351
42867
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   352
lemma (in sigma_algebra) sets_Collect_countable_All:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   353
  assumes "\<And>i. {x\<in>\<Omega>. P i x} \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   354
  shows "{x\<in>\<Omega>. \<forall>i::'i::countable. P i x} \<in> M"
42867
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   355
proof -
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   356
  have "{x\<in>\<Omega>. \<forall>i::'i::countable. P i x} = (\<Inter>i. {x\<in>\<Omega>. P i x})" by auto
42867
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   357
  with assms show ?thesis by auto
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   358
qed
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   359
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   360
lemma (in sigma_algebra) sets_Collect_countable_Ex:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   361
  assumes "\<And>i. {x\<in>\<Omega>. P i x} \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   362
  shows "{x\<in>\<Omega>. \<exists>i::'i::countable. P i x} \<in> M"
42867
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   363
proof -
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   364
  have "{x\<in>\<Omega>. \<exists>i::'i::countable. P i x} = (\<Union>i. {x\<in>\<Omega>. P i x})" by auto
42867
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   365
  with assms show ?thesis by auto
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   366
qed
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   367
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   368
lemmas (in sigma_algebra) sets_Collect =
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   369
  sets_Collect_imp sets_Collect_disj sets_Collect_conj sets_Collect_neg sets_Collect_const
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   370
  sets_Collect_countable_All sets_Collect_countable_Ex sets_Collect_countable_All
760094e49a2c Collect intro-rules for sigma-algebras
hoelzl
parents: 42864
diff changeset
   371
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   372
lemma (in sigma_algebra) sets_Collect_countable_Ball:
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   373
  assumes "\<And>i. {x\<in>\<Omega>. P i x} \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   374
  shows "{x\<in>\<Omega>. \<forall>i::'i::countable\<in>X. P i x} \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   375
  unfolding Ball_def by (intro sets_Collect assms)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   376
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   377
lemma (in sigma_algebra) sets_Collect_countable_Bex:
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   378
  assumes "\<And>i. {x\<in>\<Omega>. P i x} \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   379
  shows "{x\<in>\<Omega>. \<exists>i::'i::countable\<in>X. P i x} \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   380
  unfolding Bex_def by (intro sets_Collect assms)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   381
42984
43864e7475df add lemma sigma_sets_singleton
hoelzl
parents: 42981
diff changeset
   382
lemma sigma_algebra_single_set:
43864e7475df add lemma sigma_sets_singleton
hoelzl
parents: 42981
diff changeset
   383
  assumes "X \<subseteq> S"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   384
  shows "sigma_algebra S { {}, X, S - X, S }"
42984
43864e7475df add lemma sigma_sets_singleton
hoelzl
parents: 42981
diff changeset
   385
  using algebra.is_sigma_algebra[OF algebra_single_set[OF `X \<subseteq> S`]] by simp
43864e7475df add lemma sigma_sets_singleton
hoelzl
parents: 42981
diff changeset
   386
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   387
subsection {* Binary Unions *}
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   388
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   389
definition binary :: "'a \<Rightarrow> 'a \<Rightarrow> nat \<Rightarrow> 'a"
50252
4aa34bd43228 eliminated slightly odd identifiers;
wenzelm
parents: 50245
diff changeset
   390
  where "binary a b =  (\<lambda>x. b)(0 := a)"
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   391
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   392
lemma range_binary_eq: "range(binary a b) = {a,b}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   393
  by (auto simp add: binary_def)
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   394
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   395
lemma Un_range_binary: "a \<union> b = (\<Union>i::nat. binary a b i)"
44106
0e018cbcc0de tuned proofs
haftmann
parents: 42988
diff changeset
   396
  by (simp add: SUP_def range_binary_eq)
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   397
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   398
lemma Int_range_binary: "a \<inter> b = (\<Inter>i::nat. binary a b i)"
44106
0e018cbcc0de tuned proofs
haftmann
parents: 42988
diff changeset
   399
  by (simp add: INF_def range_binary_eq)
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   400
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   401
lemma sigma_algebra_iff2:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   402
     "sigma_algebra \<Omega> M \<longleftrightarrow>
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   403
       M \<subseteq> Pow \<Omega> \<and>
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   404
       {} \<in> M \<and> (\<forall>s \<in> M. \<Omega> - s \<in> M) \<and>
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   405
       (\<forall>A. range A \<subseteq> M \<longrightarrow> (\<Union>i::nat. A i) \<in> M)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   406
  by (auto simp add: range_binary_eq sigma_algebra_def sigma_algebra_axioms_def
42065
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   407
         algebra_iff_Un Un_range_binary)
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   408
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   409
subsection {* Initial Sigma Algebra *}
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   410
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   411
text {*Sigma algebras can naturally be created as the closure of any set of
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   412
  M with regard to the properties just postulated.  *}
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   413
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   414
inductive_set
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   415
  sigma_sets :: "'a set \<Rightarrow> 'a set set \<Rightarrow> 'a set set"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   416
  for sp :: "'a set" and A :: "'a set set"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   417
  where
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   418
    Basic[intro, simp]: "a \<in> A \<Longrightarrow> a \<in> sigma_sets sp A"
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   419
  | Empty: "{} \<in> sigma_sets sp A"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   420
  | Compl: "a \<in> sigma_sets sp A \<Longrightarrow> sp - a \<in> sigma_sets sp A"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   421
  | Union: "(\<And>i::nat. a i \<in> sigma_sets sp A) \<Longrightarrow> (\<Union>i. a i) \<in> sigma_sets sp A"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   422
41543
646a1399e792 tuned theorem order
hoelzl
parents: 41413
diff changeset
   423
lemma (in sigma_algebra) sigma_sets_subset:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   424
  assumes a: "a \<subseteq> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   425
  shows "sigma_sets \<Omega> a \<subseteq> M"
41543
646a1399e792 tuned theorem order
hoelzl
parents: 41413
diff changeset
   426
proof
646a1399e792 tuned theorem order
hoelzl
parents: 41413
diff changeset
   427
  fix x
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   428
  assume "x \<in> sigma_sets \<Omega> a"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   429
  from this show "x \<in> M"
41543
646a1399e792 tuned theorem order
hoelzl
parents: 41413
diff changeset
   430
    by (induct rule: sigma_sets.induct, auto) (metis a subsetD)
646a1399e792 tuned theorem order
hoelzl
parents: 41413
diff changeset
   431
qed
646a1399e792 tuned theorem order
hoelzl
parents: 41413
diff changeset
   432
646a1399e792 tuned theorem order
hoelzl
parents: 41413
diff changeset
   433
lemma sigma_sets_into_sp: "A \<subseteq> Pow sp \<Longrightarrow> x \<in> sigma_sets sp A \<Longrightarrow> x \<subseteq> sp"
646a1399e792 tuned theorem order
hoelzl
parents: 41413
diff changeset
   434
  by (erule sigma_sets.induct, auto)
646a1399e792 tuned theorem order
hoelzl
parents: 41413
diff changeset
   435
646a1399e792 tuned theorem order
hoelzl
parents: 41413
diff changeset
   436
lemma sigma_algebra_sigma_sets:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   437
     "a \<subseteq> Pow \<Omega> \<Longrightarrow> sigma_algebra \<Omega> (sigma_sets \<Omega> a)"
41543
646a1399e792 tuned theorem order
hoelzl
parents: 41413
diff changeset
   438
  by (auto simp add: sigma_algebra_iff2 dest: sigma_sets_into_sp
646a1399e792 tuned theorem order
hoelzl
parents: 41413
diff changeset
   439
           intro!: sigma_sets.Union sigma_sets.Empty sigma_sets.Compl)
646a1399e792 tuned theorem order
hoelzl
parents: 41413
diff changeset
   440
646a1399e792 tuned theorem order
hoelzl
parents: 41413
diff changeset
   441
lemma sigma_sets_least_sigma_algebra:
646a1399e792 tuned theorem order
hoelzl
parents: 41413
diff changeset
   442
  assumes "A \<subseteq> Pow S"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   443
  shows "sigma_sets S A = \<Inter>{B. A \<subseteq> B \<and> sigma_algebra S B}"
41543
646a1399e792 tuned theorem order
hoelzl
parents: 41413
diff changeset
   444
proof safe
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   445
  fix B X assume "A \<subseteq> B" and sa: "sigma_algebra S B"
41543
646a1399e792 tuned theorem order
hoelzl
parents: 41413
diff changeset
   446
    and X: "X \<in> sigma_sets S A"
646a1399e792 tuned theorem order
hoelzl
parents: 41413
diff changeset
   447
  from sigma_algebra.sigma_sets_subset[OF sa, simplified, OF `A \<subseteq> B`] X
646a1399e792 tuned theorem order
hoelzl
parents: 41413
diff changeset
   448
  show "X \<in> B" by auto
646a1399e792 tuned theorem order
hoelzl
parents: 41413
diff changeset
   449
next
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   450
  fix X assume "X \<in> \<Inter>{B. A \<subseteq> B \<and> sigma_algebra S B}"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   451
  then have [intro!]: "\<And>B. A \<subseteq> B \<Longrightarrow> sigma_algebra S B \<Longrightarrow> X \<in> B"
41543
646a1399e792 tuned theorem order
hoelzl
parents: 41413
diff changeset
   452
     by simp
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   453
  have "A \<subseteq> sigma_sets S A" using assms by auto
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   454
  moreover have "sigma_algebra S (sigma_sets S A)"
41543
646a1399e792 tuned theorem order
hoelzl
parents: 41413
diff changeset
   455
    using assms by (intro sigma_algebra_sigma_sets[of A]) auto
646a1399e792 tuned theorem order
hoelzl
parents: 41413
diff changeset
   456
  ultimately show "X \<in> sigma_sets S A" by auto
646a1399e792 tuned theorem order
hoelzl
parents: 41413
diff changeset
   457
qed
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   458
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   459
lemma sigma_sets_top: "sp \<in> sigma_sets sp A"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   460
  by (metis Diff_empty sigma_sets.Compl sigma_sets.Empty)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   461
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   462
lemma sigma_sets_Un:
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   463
  "a \<in> sigma_sets sp A \<Longrightarrow> b \<in> sigma_sets sp A \<Longrightarrow> a \<union> b \<in> sigma_sets sp A"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   464
apply (simp add: Un_range_binary range_binary_eq)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   465
apply (rule Union, simp add: binary_def)
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   466
done
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   467
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   468
lemma sigma_sets_Inter:
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   469
  assumes Asb: "A \<subseteq> Pow sp"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   470
  shows "(\<And>i::nat. a i \<in> sigma_sets sp A) \<Longrightarrow> (\<Inter>i. a i) \<in> sigma_sets sp A"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   471
proof -
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   472
  assume ai: "\<And>i::nat. a i \<in> sigma_sets sp A"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   473
  hence "\<And>i::nat. sp-(a i) \<in> sigma_sets sp A"
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   474
    by (rule sigma_sets.Compl)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   475
  hence "(\<Union>i. sp-(a i)) \<in> sigma_sets sp A"
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   476
    by (rule sigma_sets.Union)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   477
  hence "sp-(\<Union>i. sp-(a i)) \<in> sigma_sets sp A"
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   478
    by (rule sigma_sets.Compl)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   479
  also have "sp-(\<Union>i. sp-(a i)) = sp Int (\<Inter>i. a i)"
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   480
    by auto
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   481
  also have "... = (\<Inter>i. a i)" using ai
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   482
    by (blast dest: sigma_sets_into_sp [OF Asb])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   483
  finally show ?thesis .
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   484
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   485
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   486
lemma sigma_sets_INTER:
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   487
  assumes Asb: "A \<subseteq> Pow sp"
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   488
      and ai: "\<And>i::nat. i \<in> S \<Longrightarrow> a i \<in> sigma_sets sp A" and non: "S \<noteq> {}"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   489
  shows "(\<Inter>i\<in>S. a i) \<in> sigma_sets sp A"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   490
proof -
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   491
  from ai have "\<And>i. (if i\<in>S then a i else sp) \<in> sigma_sets sp A"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   492
    by (simp add: sigma_sets.intros(2-) sigma_sets_top)
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   493
  hence "(\<Inter>i. (if i\<in>S then a i else sp)) \<in> sigma_sets sp A"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   494
    by (rule sigma_sets_Inter [OF Asb])
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   495
  also have "(\<Inter>i. (if i\<in>S then a i else sp)) = (\<Inter>i\<in>S. a i)"
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   496
    by auto (metis ai non sigma_sets_into_sp subset_empty subset_iff Asb)+
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   497
  finally show ?thesis .
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   498
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   499
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   500
lemma (in sigma_algebra) sigma_sets_eq:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   501
     "sigma_sets \<Omega> M = M"
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   502
proof
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   503
  show "M \<subseteq> sigma_sets \<Omega> M"
37032
58a0757031dd speed up some proofs and fix some warnings
huffman
parents: 33536
diff changeset
   504
    by (metis Set.subsetI sigma_sets.Basic)
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   505
  next
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   506
  show "sigma_sets \<Omega> M \<subseteq> M"
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   507
    by (metis sigma_sets_subset subset_refl)
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   508
qed
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
   509
42981
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42867
diff changeset
   510
lemma sigma_sets_eqI:
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42867
diff changeset
   511
  assumes A: "\<And>a. a \<in> A \<Longrightarrow> a \<in> sigma_sets M B"
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42867
diff changeset
   512
  assumes B: "\<And>b. b \<in> B \<Longrightarrow> b \<in> sigma_sets M A"
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42867
diff changeset
   513
  shows "sigma_sets M A = sigma_sets M B"
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42867
diff changeset
   514
proof (intro set_eqI iffI)
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42867
diff changeset
   515
  fix a assume "a \<in> sigma_sets M A"
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42867
diff changeset
   516
  from this A show "a \<in> sigma_sets M B"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   517
    by induct (auto intro!: sigma_sets.intros(2-) del: sigma_sets.Basic)
42981
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42867
diff changeset
   518
next
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42867
diff changeset
   519
  fix b assume "b \<in> sigma_sets M B"
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42867
diff changeset
   520
  from this B show "b \<in> sigma_sets M A"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   521
    by induct (auto intro!: sigma_sets.intros(2-) del: sigma_sets.Basic)
42981
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42867
diff changeset
   522
qed
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42867
diff changeset
   523
42984
43864e7475df add lemma sigma_sets_singleton
hoelzl
parents: 42981
diff changeset
   524
lemma sigma_sets_subseteq: assumes "A \<subseteq> B" shows "sigma_sets X A \<subseteq> sigma_sets X B"
43864e7475df add lemma sigma_sets_singleton
hoelzl
parents: 42981
diff changeset
   525
proof
43864e7475df add lemma sigma_sets_singleton
hoelzl
parents: 42981
diff changeset
   526
  fix x assume "x \<in> sigma_sets X A" then show "x \<in> sigma_sets X B"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   527
    by induct (insert `A \<subseteq> B`, auto intro: sigma_sets.intros(2-))
42984
43864e7475df add lemma sigma_sets_singleton
hoelzl
parents: 42981
diff changeset
   528
qed
43864e7475df add lemma sigma_sets_singleton
hoelzl
parents: 42981
diff changeset
   529
47762
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   530
lemma sigma_sets_mono: assumes "A \<subseteq> sigma_sets X B" shows "sigma_sets X A \<subseteq> sigma_sets X B"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   531
proof
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   532
  fix x assume "x \<in> sigma_sets X A" then show "x \<in> sigma_sets X B"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   533
    by induct (insert `A \<subseteq> sigma_sets X B`, auto intro: sigma_sets.intros(2-))
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   534
qed
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   535
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   536
lemma sigma_sets_mono': assumes "A \<subseteq> B" shows "sigma_sets X A \<subseteq> sigma_sets X B"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   537
proof
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   538
  fix x assume "x \<in> sigma_sets X A" then show "x \<in> sigma_sets X B"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   539
    by induct (insert `A \<subseteq> B`, auto intro: sigma_sets.intros(2-))
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   540
qed
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   541
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   542
lemma sigma_sets_superset_generator: "A \<subseteq> sigma_sets X A"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   543
  by (auto intro: sigma_sets.Basic)
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   544
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   545
lemma (in sigma_algebra) restriction_in_sets:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   546
  fixes A :: "nat \<Rightarrow> 'a set"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   547
  assumes "S \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   548
  and *: "range A \<subseteq> (\<lambda>A. S \<inter> A) ` M" (is "_ \<subseteq> ?r")
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   549
  shows "range A \<subseteq> M" "(\<Union>i. A i) \<in> (\<lambda>A. S \<inter> A) ` M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   550
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   551
  { fix i have "A i \<in> ?r" using * by auto
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   552
    hence "\<exists>B. A i = B \<inter> S \<and> B \<in> M" by auto
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   553
    hence "A i \<subseteq> S" "A i \<in> M" using `S \<in> M` by auto }
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   554
  thus "range A \<subseteq> M" "(\<Union>i. A i) \<in> (\<lambda>A. S \<inter> A) ` M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   555
    by (auto intro!: image_eqI[of _ _ "(\<Union>i. A i)"])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   556
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   557
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   558
lemma (in sigma_algebra) restricted_sigma_algebra:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   559
  assumes "S \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   560
  shows "sigma_algebra S (restricted_space S)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   561
  unfolding sigma_algebra_def sigma_algebra_axioms_def
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   562
proof safe
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   563
  show "algebra S (restricted_space S)" using restricted_algebra[OF assms] .
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   564
next
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   565
  fix A :: "nat \<Rightarrow> 'a set" assume "range A \<subseteq> restricted_space S"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   566
  from restriction_in_sets[OF assms this[simplified]]
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   567
  show "(\<Union>i. A i) \<in> restricted_space S" by simp
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   568
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   569
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   570
lemma sigma_sets_Int:
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41543
diff changeset
   571
  assumes "A \<in> sigma_sets sp st" "A \<subseteq> sp"
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41543
diff changeset
   572
  shows "op \<inter> A ` sigma_sets sp st = sigma_sets A (op \<inter> A ` st)"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   573
proof (intro equalityI subsetI)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   574
  fix x assume "x \<in> op \<inter> A ` sigma_sets sp st"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   575
  then obtain y where "y \<in> sigma_sets sp st" "x = y \<inter> A" by auto
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41543
diff changeset
   576
  then have "x \<in> sigma_sets (A \<inter> sp) (op \<inter> A ` st)"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   577
  proof (induct arbitrary: x)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   578
    case (Compl a)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   579
    then show ?case
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   580
      by (force intro!: sigma_sets.Compl simp: Diff_Int_distrib ac_simps)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   581
  next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   582
    case (Union a)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   583
    then show ?case
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   584
      by (auto intro!: sigma_sets.Union
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   585
               simp add: UN_extend_simps simp del: UN_simps)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   586
  qed (auto intro!: sigma_sets.intros(2-))
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41543
diff changeset
   587
  then show "x \<in> sigma_sets A (op \<inter> A ` st)"
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41543
diff changeset
   588
    using `A \<subseteq> sp` by (simp add: Int_absorb2)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   589
next
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41543
diff changeset
   590
  fix x assume "x \<in> sigma_sets A (op \<inter> A ` st)"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   591
  then show "x \<in> op \<inter> A ` sigma_sets sp st"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   592
  proof induct
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   593
    case (Compl a)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   594
    then obtain x where "a = A \<inter> x" "x \<in> sigma_sets sp st" by auto
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41543
diff changeset
   595
    then show ?case using `A \<subseteq> sp`
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   596
      by (force simp add: image_iff intro!: bexI[of _ "sp - x"] sigma_sets.Compl)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   597
  next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   598
    case (Union a)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   599
    then have "\<forall>i. \<exists>x. x \<in> sigma_sets sp st \<and> a i = A \<inter> x"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   600
      by (auto simp: image_iff Bex_def)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   601
    from choice[OF this] guess f ..
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   602
    then show ?case
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   603
      by (auto intro!: bexI[of _ "(\<Union>x. f x)"] sigma_sets.Union
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   604
               simp add: image_iff)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   605
  qed (auto intro!: sigma_sets.intros(2-))
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   606
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   607
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   608
lemma sigma_sets_empty_eq: "sigma_sets A {} = {{}, A}"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   609
proof (intro set_eqI iffI)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   610
  fix a assume "a \<in> sigma_sets A {}" then show "a \<in> {{}, A}"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   611
    by induct blast+
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   612
qed (auto intro: sigma_sets.Empty sigma_sets_top)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   613
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   614
lemma sigma_sets_single[simp]: "sigma_sets A {A} = {{}, A}"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   615
proof (intro set_eqI iffI)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   616
  fix x assume "x \<in> sigma_sets A {A}"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   617
  then show "x \<in> {{}, A}"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   618
    by induct blast+
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   619
next
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   620
  fix x assume "x \<in> {{}, A}"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   621
  then show "x \<in> sigma_sets A {A}"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   622
    by (auto intro: sigma_sets.Empty sigma_sets_top)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   623
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   624
42987
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   625
lemma sigma_sets_sigma_sets_eq:
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   626
  "M \<subseteq> Pow S \<Longrightarrow> sigma_sets S (sigma_sets S M) = sigma_sets S M"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   627
  by (rule sigma_algebra.sigma_sets_eq[OF sigma_algebra_sigma_sets, of M S]) auto
42987
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   628
42984
43864e7475df add lemma sigma_sets_singleton
hoelzl
parents: 42981
diff changeset
   629
lemma sigma_sets_singleton:
43864e7475df add lemma sigma_sets_singleton
hoelzl
parents: 42981
diff changeset
   630
  assumes "X \<subseteq> S"
43864e7475df add lemma sigma_sets_singleton
hoelzl
parents: 42981
diff changeset
   631
  shows "sigma_sets S { X } = { {}, X, S - X, S }"
43864e7475df add lemma sigma_sets_singleton
hoelzl
parents: 42981
diff changeset
   632
proof -
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   633
  interpret sigma_algebra S "{ {}, X, S - X, S }"
42984
43864e7475df add lemma sigma_sets_singleton
hoelzl
parents: 42981
diff changeset
   634
    by (rule sigma_algebra_single_set) fact
43864e7475df add lemma sigma_sets_singleton
hoelzl
parents: 42981
diff changeset
   635
  have "sigma_sets S { X } \<subseteq> sigma_sets S { {}, X, S - X, S }"
43864e7475df add lemma sigma_sets_singleton
hoelzl
parents: 42981
diff changeset
   636
    by (rule sigma_sets_subseteq) simp
43864e7475df add lemma sigma_sets_singleton
hoelzl
parents: 42981
diff changeset
   637
  moreover have "\<dots> = { {}, X, S - X, S }"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   638
    using sigma_sets_eq by simp
42984
43864e7475df add lemma sigma_sets_singleton
hoelzl
parents: 42981
diff changeset
   639
  moreover
43864e7475df add lemma sigma_sets_singleton
hoelzl
parents: 42981
diff changeset
   640
  { fix A assume "A \<in> { {}, X, S - X, S }"
43864e7475df add lemma sigma_sets_singleton
hoelzl
parents: 42981
diff changeset
   641
    then have "A \<in> sigma_sets S { X }"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   642
      by (auto intro: sigma_sets.intros(2-) sigma_sets_top) }
42984
43864e7475df add lemma sigma_sets_singleton
hoelzl
parents: 42981
diff changeset
   643
  ultimately have "sigma_sets S { X } = sigma_sets S { {}, X, S - X, S }"
43864e7475df add lemma sigma_sets_singleton
hoelzl
parents: 42981
diff changeset
   644
    by (intro antisym) auto
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   645
  with sigma_sets_eq show ?thesis by simp
42984
43864e7475df add lemma sigma_sets_singleton
hoelzl
parents: 42981
diff changeset
   646
qed
43864e7475df add lemma sigma_sets_singleton
hoelzl
parents: 42981
diff changeset
   647
42863
b9ff5a0aa12c add restrict_sigma
hoelzl
parents: 42145
diff changeset
   648
lemma restricted_sigma:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   649
  assumes S: "S \<in> sigma_sets \<Omega> M" and M: "M \<subseteq> Pow \<Omega>"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   650
  shows "algebra.restricted_space (sigma_sets \<Omega> M) S =
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   651
    sigma_sets S (algebra.restricted_space M S)"
42863
b9ff5a0aa12c add restrict_sigma
hoelzl
parents: 42145
diff changeset
   652
proof -
b9ff5a0aa12c add restrict_sigma
hoelzl
parents: 42145
diff changeset
   653
  from S sigma_sets_into_sp[OF M]
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   654
  have "S \<in> sigma_sets \<Omega> M" "S \<subseteq> \<Omega>" by auto
42863
b9ff5a0aa12c add restrict_sigma
hoelzl
parents: 42145
diff changeset
   655
  from sigma_sets_Int[OF this]
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   656
  show ?thesis by simp
42863
b9ff5a0aa12c add restrict_sigma
hoelzl
parents: 42145
diff changeset
   657
qed
b9ff5a0aa12c add restrict_sigma
hoelzl
parents: 42145
diff changeset
   658
42987
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   659
lemma sigma_sets_vimage_commute:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   660
  assumes X: "X \<in> \<Omega> \<rightarrow> \<Omega>'"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   661
  shows "{X -` A \<inter> \<Omega> |A. A \<in> sigma_sets \<Omega>' M'}
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   662
       = sigma_sets \<Omega> {X -` A \<inter> \<Omega> |A. A \<in> M'}" (is "?L = ?R")
42987
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   663
proof
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   664
  show "?L \<subseteq> ?R"
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   665
  proof clarify
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   666
    fix A assume "A \<in> sigma_sets \<Omega>' M'"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   667
    then show "X -` A \<inter> \<Omega> \<in> ?R"
42987
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   668
    proof induct
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   669
      case Empty then show ?case
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   670
        by (auto intro!: sigma_sets.Empty)
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   671
    next
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   672
      case (Compl B)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   673
      have [simp]: "X -` (\<Omega>' - B) \<inter> \<Omega> = \<Omega> - (X -` B \<inter> \<Omega>)"
42987
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   674
        by (auto simp add: funcset_mem [OF X])
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   675
      with Compl show ?case
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   676
        by (auto intro!: sigma_sets.Compl)
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   677
    next
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   678
      case (Union F)
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   679
      then show ?case
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   680
        by (auto simp add: vimage_UN UN_extend_simps(4) simp del: UN_simps
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   681
                 intro!: sigma_sets.Union)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   682
    qed auto
42987
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   683
  qed
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   684
  show "?R \<subseteq> ?L"
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   685
  proof clarify
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   686
    fix A assume "A \<in> ?R"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   687
    then show "\<exists>B. A = X -` B \<inter> \<Omega> \<and> B \<in> sigma_sets \<Omega>' M'"
42987
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   688
    proof induct
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   689
      case (Basic B) then show ?case by auto
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   690
    next
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   691
      case Empty then show ?case
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   692
        by (auto intro!: sigma_sets.Empty exI[of _ "{}"])
42987
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   693
    next
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   694
      case (Compl B)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   695
      then obtain A where A: "B = X -` A \<inter> \<Omega>" "A \<in> sigma_sets \<Omega>' M'" by auto
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   696
      then have [simp]: "\<Omega> - B = X -` (\<Omega>' - A) \<inter> \<Omega>"
42987
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   697
        by (auto simp add: funcset_mem [OF X])
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   698
      with A(2) show ?case
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   699
        by (auto intro: sigma_sets.Compl)
42987
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   700
    next
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   701
      case (Union F)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   702
      then have "\<forall>i. \<exists>B. F i = X -` B \<inter> \<Omega> \<and> B \<in> sigma_sets \<Omega>' M'" by auto
42987
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   703
      from choice[OF this] guess A .. note A = this
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   704
      with A show ?case
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   705
        by (auto simp: vimage_UN[symmetric] intro: sigma_sets.Union)
42987
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   706
    qed
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   707
  qed
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   708
qed
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42984
diff changeset
   709
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   710
section "Disjoint families"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   711
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   712
definition
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   713
  disjoint_family_on  where
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   714
  "disjoint_family_on A S \<longleftrightarrow> (\<forall>m\<in>S. \<forall>n\<in>S. m \<noteq> n \<longrightarrow> A m \<inter> A n = {})"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   715
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   716
abbreviation
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   717
  "disjoint_family A \<equiv> disjoint_family_on A UNIV"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   718
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   719
lemma range_subsetD: "range f \<subseteq> B \<Longrightarrow> f i \<in> B"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   720
  by blast
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   721
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   722
lemma Int_Diff_disjoint: "A \<inter> B \<inter> (A - B) = {}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   723
  by blast
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   724
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   725
lemma Int_Diff_Un: "A \<inter> B \<union> (A - B) = A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   726
  by blast
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   727
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   728
lemma disjoint_family_subset:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   729
     "disjoint_family A \<Longrightarrow> (!!x. B x \<subseteq> A x) \<Longrightarrow> disjoint_family B"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   730
  by (force simp add: disjoint_family_on_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   731
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   732
lemma disjoint_family_on_bisimulation:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   733
  assumes "disjoint_family_on f S"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   734
  and "\<And>n m. n \<in> S \<Longrightarrow> m \<in> S \<Longrightarrow> n \<noteq> m \<Longrightarrow> f n \<inter> f m = {} \<Longrightarrow> g n \<inter> g m = {}"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   735
  shows "disjoint_family_on g S"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   736
  using assms unfolding disjoint_family_on_def by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
   737
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   738
lemma disjoint_family_on_mono:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   739
  "A \<subseteq> B \<Longrightarrow> disjoint_family_on f B \<Longrightarrow> disjoint_family_on f A"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   740
  unfolding disjoint_family_on_def by auto
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   741
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   742
lemma disjoint_family_Suc:
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   743
  assumes Suc: "!!n. A n \<subseteq> A (Suc n)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   744
  shows "disjoint_family (\<lambda>i. A (Suc i) - A i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   745
proof -
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   746
  {
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   747
    fix m
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   748
    have "!!n. A n \<subseteq> A (m+n)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   749
    proof (induct m)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   750
      case 0 show ?case by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   751
    next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   752
      case (Suc m) thus ?case
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   753
        by (metis Suc_eq_plus1 assms nat_add_commute nat_add_left_commute subset_trans)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   754
    qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   755
  }
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   756
  hence "!!m n. m < n \<Longrightarrow> A m \<subseteq> A n"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   757
    by (metis add_commute le_add_diff_inverse nat_less_le)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   758
  thus ?thesis
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   759
    by (auto simp add: disjoint_family_on_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   760
      (metis insert_absorb insert_subset le_SucE le_antisym not_leE)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   761
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   762
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39090
diff changeset
   763
lemma setsum_indicator_disjoint_family:
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39090
diff changeset
   764
  fixes f :: "'d \<Rightarrow> 'e::semiring_1"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39090
diff changeset
   765
  assumes d: "disjoint_family_on A P" and "x \<in> A j" and "finite P" and "j \<in> P"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39090
diff changeset
   766
  shows "(\<Sum>i\<in>P. f i * indicator (A i) x) = f j"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39090
diff changeset
   767
proof -
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39090
diff changeset
   768
  have "P \<inter> {i. x \<in> A i} = {j}"
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39090
diff changeset
   769
    using d `x \<in> A j` `j \<in> P` unfolding disjoint_family_on_def
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39090
diff changeset
   770
    by auto
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39090
diff changeset
   771
  thus ?thesis
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39090
diff changeset
   772
    unfolding indicator_def
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39090
diff changeset
   773
    by (simp add: if_distrib setsum_cases[OF `finite P`])
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39090
diff changeset
   774
qed
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39090
diff changeset
   775
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   776
definition disjointed :: "(nat \<Rightarrow> 'a set) \<Rightarrow> nat \<Rightarrow> 'a set "
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   777
  where "disjointed A n = A n - (\<Union>i\<in>{0..<n}. A i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   778
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   779
lemma finite_UN_disjointed_eq: "(\<Union>i\<in>{0..<n}. disjointed A i) = (\<Union>i\<in>{0..<n}. A i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   780
proof (induct n)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   781
  case 0 show ?case by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   782
next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   783
  case (Suc n)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   784
  thus ?case by (simp add: atLeastLessThanSuc disjointed_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   785
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   786
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   787
lemma UN_disjointed_eq: "(\<Union>i. disjointed A i) = (\<Union>i. A i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   788
  apply (rule UN_finite2_eq [where k=0])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   789
  apply (simp add: finite_UN_disjointed_eq)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   790
  done
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   791
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   792
lemma less_disjoint_disjointed: "m<n \<Longrightarrow> disjointed A m \<inter> disjointed A n = {}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   793
  by (auto simp add: disjointed_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   794
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   795
lemma disjoint_family_disjointed: "disjoint_family (disjointed A)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   796
  by (simp add: disjoint_family_on_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   797
     (metis neq_iff Int_commute less_disjoint_disjointed)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   798
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   799
lemma disjointed_subset: "disjointed A n \<subseteq> A n"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   800
  by (auto simp add: disjointed_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   801
42065
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   802
lemma (in ring_of_sets) UNION_in_sets:
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   803
  fixes A:: "nat \<Rightarrow> 'a set"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   804
  assumes A: "range A \<subseteq> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   805
  shows  "(\<Union>i\<in>{0..<n}. A i) \<in> M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   806
proof (induct n)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   807
  case 0 show ?case by simp
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   808
next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   809
  case (Suc n)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   810
  thus ?case
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   811
    by (simp add: atLeastLessThanSuc) (metis A Un UNIV_I image_subset_iff)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   812
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   813
42065
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   814
lemma (in ring_of_sets) range_disjointed_sets:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   815
  assumes A: "range A \<subseteq> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   816
  shows  "range (disjointed A) \<subseteq> M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   817
proof (auto simp add: disjointed_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   818
  fix n
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   819
  show "A n - (\<Union>i\<in>{0..<n}. A i) \<in> M" using UNION_in_sets
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   820
    by (metis A Diff UNIV_I image_subset_iff)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   821
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   822
42065
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   823
lemma (in algebra) range_disjointed_sets':
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   824
  "range A \<subseteq> M \<Longrightarrow> range (disjointed A) \<subseteq> M"
42065
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   825
  using range_disjointed_sets .
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
   826
42145
8448713d48b7 proved caratheodory_empty_continuous
hoelzl
parents: 42067
diff changeset
   827
lemma disjointed_0[simp]: "disjointed A 0 = A 0"
8448713d48b7 proved caratheodory_empty_continuous
hoelzl
parents: 42067
diff changeset
   828
  by (simp add: disjointed_def)
8448713d48b7 proved caratheodory_empty_continuous
hoelzl
parents: 42067
diff changeset
   829
8448713d48b7 proved caratheodory_empty_continuous
hoelzl
parents: 42067
diff changeset
   830
lemma incseq_Un:
8448713d48b7 proved caratheodory_empty_continuous
hoelzl
parents: 42067
diff changeset
   831
  "incseq A \<Longrightarrow> (\<Union>i\<le>n. A i) = A n"
8448713d48b7 proved caratheodory_empty_continuous
hoelzl
parents: 42067
diff changeset
   832
  unfolding incseq_def by auto
8448713d48b7 proved caratheodory_empty_continuous
hoelzl
parents: 42067
diff changeset
   833
8448713d48b7 proved caratheodory_empty_continuous
hoelzl
parents: 42067
diff changeset
   834
lemma disjointed_incseq:
8448713d48b7 proved caratheodory_empty_continuous
hoelzl
parents: 42067
diff changeset
   835
  "incseq A \<Longrightarrow> disjointed A (Suc n) = A (Suc n) - A n"
8448713d48b7 proved caratheodory_empty_continuous
hoelzl
parents: 42067
diff changeset
   836
  using incseq_Un[of A]
8448713d48b7 proved caratheodory_empty_continuous
hoelzl
parents: 42067
diff changeset
   837
  by (simp add: disjointed_def atLeastLessThanSuc_atLeastAtMost atLeast0AtMost)
8448713d48b7 proved caratheodory_empty_continuous
hoelzl
parents: 42067
diff changeset
   838
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   839
lemma sigma_algebra_disjoint_iff:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   840
  "sigma_algebra \<Omega> M \<longleftrightarrow> algebra \<Omega> M \<and>
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   841
    (\<forall>A. range A \<subseteq> M \<longrightarrow> disjoint_family A \<longrightarrow> (\<Union>i::nat. A i) \<in> M)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   842
proof (auto simp add: sigma_algebra_iff)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   843
  fix A :: "nat \<Rightarrow> 'a set"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   844
  assume M: "algebra \<Omega> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   845
     and A: "range A \<subseteq> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   846
     and UnA: "\<forall>A. range A \<subseteq> M \<longrightarrow> disjoint_family A \<longrightarrow> (\<Union>i::nat. A i) \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   847
  hence "range (disjointed A) \<subseteq> M \<longrightarrow>
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
   848
         disjoint_family (disjointed A) \<longrightarrow>
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   849
         (\<Union>i. disjointed A i) \<in> M" by blast
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   850
  hence "(\<Union>i. disjointed A i) \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   851
    by (simp add: algebra.range_disjointed_sets'[of \<Omega>] M A disjoint_family_disjointed)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   852
  thus "(\<Union>i::nat. A i) \<in> M" by (simp add: UN_disjointed_eq)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   853
qed
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   854
47762
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   855
lemma disjoint_family_on_disjoint_image:
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   856
  "disjoint_family_on A I \<Longrightarrow> disjoint (A ` I)"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   857
  unfolding disjoint_family_on_def disjoint_def by force
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   858
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   859
lemma disjoint_image_disjoint_family_on:
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   860
  assumes d: "disjoint (A ` I)" and i: "inj_on A I"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   861
  shows "disjoint_family_on A I"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   862
  unfolding disjoint_family_on_def
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   863
proof (intro ballI impI)
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   864
  fix n m assume nm: "m \<in> I" "n \<in> I" and "n \<noteq> m"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   865
  with i[THEN inj_onD, of n m] show "A n \<inter> A m = {}"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   866
    by (intro disjointD[OF d]) auto
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   867
qed
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   868
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   869
section {* Ring generated by a semiring *}
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   870
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   871
definition (in semiring_of_sets)
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   872
  "generated_ring = { \<Union>C | C. C \<subseteq> M \<and> finite C \<and> disjoint C }"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   873
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   874
lemma (in semiring_of_sets) generated_ringE[elim?]:
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   875
  assumes "a \<in> generated_ring"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   876
  obtains C where "finite C" "disjoint C" "C \<subseteq> M" "a = \<Union>C"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   877
  using assms unfolding generated_ring_def by auto
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   878
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   879
lemma (in semiring_of_sets) generated_ringI[intro?]:
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   880
  assumes "finite C" "disjoint C" "C \<subseteq> M" "a = \<Union>C"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   881
  shows "a \<in> generated_ring"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   882
  using assms unfolding generated_ring_def by auto
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   883
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   884
lemma (in semiring_of_sets) generated_ringI_Basic:
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   885
  "A \<in> M \<Longrightarrow> A \<in> generated_ring"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   886
  by (rule generated_ringI[of "{A}"]) (auto simp: disjoint_def)
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   887
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   888
lemma (in semiring_of_sets) generated_ring_disjoint_Un[intro]:
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   889
  assumes a: "a \<in> generated_ring" and b: "b \<in> generated_ring"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   890
  and "a \<inter> b = {}"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   891
  shows "a \<union> b \<in> generated_ring"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   892
proof -
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   893
  from a guess Ca .. note Ca = this
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   894
  from b guess Cb .. note Cb = this
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   895
  show ?thesis
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   896
  proof
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   897
    show "disjoint (Ca \<union> Cb)"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   898
      using `a \<inter> b = {}` Ca Cb by (auto intro!: disjoint_union)
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   899
  qed (insert Ca Cb, auto)
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   900
qed
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   901
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   902
lemma (in semiring_of_sets) generated_ring_empty: "{} \<in> generated_ring"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   903
  by (auto simp: generated_ring_def disjoint_def)
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   904
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   905
lemma (in semiring_of_sets) generated_ring_disjoint_Union:
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   906
  assumes "finite A" shows "A \<subseteq> generated_ring \<Longrightarrow> disjoint A \<Longrightarrow> \<Union>A \<in> generated_ring"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   907
  using assms by (induct A) (auto simp: disjoint_def intro!: generated_ring_disjoint_Un generated_ring_empty)
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   908
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   909
lemma (in semiring_of_sets) generated_ring_disjoint_UNION:
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   910
  "finite I \<Longrightarrow> disjoint (A ` I) \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> A i \<in> generated_ring) \<Longrightarrow> UNION I A \<in> generated_ring"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   911
  unfolding SUP_def by (intro generated_ring_disjoint_Union) auto
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   912
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   913
lemma (in semiring_of_sets) generated_ring_Int:
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   914
  assumes a: "a \<in> generated_ring" and b: "b \<in> generated_ring"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   915
  shows "a \<inter> b \<in> generated_ring"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   916
proof -
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   917
  from a guess Ca .. note Ca = this
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   918
  from b guess Cb .. note Cb = this
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   919
  def C \<equiv> "(\<lambda>(a,b). a \<inter> b)` (Ca\<times>Cb)"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   920
  show ?thesis
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   921
  proof
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   922
    show "disjoint C"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   923
    proof (simp add: disjoint_def C_def, intro ballI impI)
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   924
      fix a1 b1 a2 b2 assume sets: "a1 \<in> Ca" "b1 \<in> Cb" "a2 \<in> Ca" "b2 \<in> Cb"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   925
      assume "a1 \<inter> b1 \<noteq> a2 \<inter> b2"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   926
      then have "a1 \<noteq> a2 \<or> b1 \<noteq> b2" by auto
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   927
      then show "(a1 \<inter> b1) \<inter> (a2 \<inter> b2) = {}"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   928
      proof
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   929
        assume "a1 \<noteq> a2"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   930
        with sets Ca have "a1 \<inter> a2 = {}"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   931
          by (auto simp: disjoint_def)
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   932
        then show ?thesis by auto
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   933
      next
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   934
        assume "b1 \<noteq> b2"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   935
        with sets Cb have "b1 \<inter> b2 = {}"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   936
          by (auto simp: disjoint_def)
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   937
        then show ?thesis by auto
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   938
      qed
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   939
    qed
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   940
  qed (insert Ca Cb, auto simp: C_def)
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   941
qed
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   942
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   943
lemma (in semiring_of_sets) generated_ring_Inter:
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   944
  assumes "finite A" "A \<noteq> {}" shows "A \<subseteq> generated_ring \<Longrightarrow> \<Inter>A \<in> generated_ring"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   945
  using assms by (induct A rule: finite_ne_induct) (auto intro: generated_ring_Int)
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   946
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   947
lemma (in semiring_of_sets) generated_ring_INTER:
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   948
  "finite I \<Longrightarrow> I \<noteq> {} \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> A i \<in> generated_ring) \<Longrightarrow> INTER I A \<in> generated_ring"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   949
  unfolding INF_def by (intro generated_ring_Inter) auto
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   950
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   951
lemma (in semiring_of_sets) generating_ring:
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   952
  "ring_of_sets \<Omega> generated_ring"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   953
proof (rule ring_of_setsI)
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   954
  let ?R = generated_ring
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   955
  show "?R \<subseteq> Pow \<Omega>"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   956
    using sets_into_space by (auto simp: generated_ring_def generated_ring_empty)
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   957
  show "{} \<in> ?R" by (rule generated_ring_empty)
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   958
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   959
  { fix a assume a: "a \<in> ?R" then guess Ca .. note Ca = this
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   960
    fix b assume b: "b \<in> ?R" then guess Cb .. note Cb = this
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   961
  
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   962
    show "a - b \<in> ?R"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   963
    proof cases
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   964
      assume "Cb = {}" with Cb `a \<in> ?R` show ?thesis
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   965
        by simp
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   966
    next
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   967
      assume "Cb \<noteq> {}"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   968
      with Ca Cb have "a - b = (\<Union>a'\<in>Ca. \<Inter>b'\<in>Cb. a' - b')" by auto
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   969
      also have "\<dots> \<in> ?R"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   970
      proof (intro generated_ring_INTER generated_ring_disjoint_UNION)
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   971
        fix a b assume "a \<in> Ca" "b \<in> Cb"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   972
        with Ca Cb Diff_cover[of a b] show "a - b \<in> ?R"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   973
          by (auto simp add: generated_ring_def)
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   974
      next
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   975
        show "disjoint ((\<lambda>a'. \<Inter>b'\<in>Cb. a' - b')`Ca)"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   976
          using Ca by (auto simp add: disjoint_def `Cb \<noteq> {}`)
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   977
      next
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   978
        show "finite Ca" "finite Cb" "Cb \<noteq> {}" by fact+
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   979
      qed
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   980
      finally show "a - b \<in> ?R" .
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   981
    qed }
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   982
  note Diff = this
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   983
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   984
  fix a b assume sets: "a \<in> ?R" "b \<in> ?R"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   985
  have "a \<union> b = (a - b) \<union> (a \<inter> b) \<union> (b - a)" by auto
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   986
  also have "\<dots> \<in> ?R"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   987
    by (intro sets generated_ring_disjoint_Un generated_ring_Int Diff) auto
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   988
  finally show "a \<union> b \<in> ?R" .
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   989
qed
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   990
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   991
lemma (in semiring_of_sets) sigma_sets_generated_ring_eq: "sigma_sets \<Omega> generated_ring = sigma_sets \<Omega> M"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   992
proof
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   993
  interpret M: sigma_algebra \<Omega> "sigma_sets \<Omega> M"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   994
    using space_closed by (rule sigma_algebra_sigma_sets)
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   995
  show "sigma_sets \<Omega> generated_ring \<subseteq> sigma_sets \<Omega> M"
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   996
    by (blast intro!: sigma_sets_mono elim: generated_ringE)
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   997
qed (auto intro!: generated_ringI_Basic sigma_sets_mono)
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
   998
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   999
section {* Measure type *}
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1000
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1001
definition positive :: "'a set set \<Rightarrow> ('a set \<Rightarrow> ereal) \<Rightarrow> bool" where
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1002
  "positive M \<mu> \<longleftrightarrow> \<mu> {} = 0 \<and> (\<forall>A\<in>M. 0 \<le> \<mu> A)"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1003
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1004
definition countably_additive :: "'a set set \<Rightarrow> ('a set \<Rightarrow> ereal) \<Rightarrow> bool" where
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1005
  "countably_additive M f \<longleftrightarrow> (\<forall>A. range A \<subseteq> M \<longrightarrow> disjoint_family A \<longrightarrow> (\<Union>i. A i) \<in> M \<longrightarrow>
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1006
    (\<Sum>i. f (A i)) = f (\<Union>i. A i))"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1007
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1008
definition measure_space :: "'a set \<Rightarrow> 'a set set \<Rightarrow> ('a set \<Rightarrow> ereal) \<Rightarrow> bool" where
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1009
  "measure_space \<Omega> A \<mu> \<longleftrightarrow> sigma_algebra \<Omega> A \<and> positive A \<mu> \<and> countably_additive A \<mu>"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1010
49834
b27bbb021df1 discontinued obsolete typedef (open) syntax;
wenzelm
parents: 49789
diff changeset
  1011
typedef 'a measure = "{(\<Omega>::'a set, A, \<mu>). (\<forall>a\<in>-A. \<mu> a = 0) \<and> measure_space \<Omega> A \<mu> }"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1012
proof
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1013
  have "sigma_algebra UNIV {{}, UNIV}"
47762
d31085f07f60 add Caratheodories theorem for semi-rings of sets
hoelzl
parents: 47756
diff changeset
  1014
    by (auto simp: sigma_algebra_iff2)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1015
  then show "(UNIV, {{}, UNIV}, \<lambda>A. 0) \<in> {(\<Omega>, A, \<mu>). (\<forall>a\<in>-A. \<mu> a = 0) \<and> measure_space \<Omega> A \<mu>} "
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1016
    by (auto simp: measure_space_def positive_def countably_additive_def)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1017
qed
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1018
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1019
definition space :: "'a measure \<Rightarrow> 'a set" where
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1020
  "space M = fst (Rep_measure M)"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1021
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1022
definition sets :: "'a measure \<Rightarrow> 'a set set" where
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1023
  "sets M = fst (snd (Rep_measure M))"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1024
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1025
definition emeasure :: "'a measure \<Rightarrow> 'a set \<Rightarrow> ereal" where
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1026
  "emeasure M = snd (snd (Rep_measure M))"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1027
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1028
definition measure :: "'a measure \<Rightarrow> 'a set \<Rightarrow> real" where
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1029
  "measure M A = real (emeasure M A)"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1030
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1031
declare [[coercion sets]]
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1032
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1033
declare [[coercion measure]]
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1034
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1035
declare [[coercion emeasure]]
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1036
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1037
lemma measure_space: "measure_space (space M) (sets M) (emeasure M)"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1038
  by (cases M) (auto simp: space_def sets_def emeasure_def Abs_measure_inverse)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1039
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50096
diff changeset
  1040
interpretation sets!: sigma_algebra "space M" "sets M" for M :: "'a measure"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1041
  using measure_space[of M] by (auto simp: measure_space_def)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1042
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1043
definition measure_of :: "'a set \<Rightarrow> 'a set set \<Rightarrow> ('a set \<Rightarrow> ereal) \<Rightarrow> 'a measure" where
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1044
  "measure_of \<Omega> A \<mu> = Abs_measure (\<Omega>, sigma_sets \<Omega> A,
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1045
    \<lambda>a. if a \<in> sigma_sets \<Omega> A \<and> measure_space \<Omega> (sigma_sets \<Omega> A) \<mu> then \<mu> a else 0)"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1046
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1047
abbreviation "sigma \<Omega> A \<equiv> measure_of \<Omega> A (\<lambda>x. 0)"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1048
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1049
lemma measure_space_0: "A \<subseteq> Pow \<Omega> \<Longrightarrow> measure_space \<Omega> (sigma_sets \<Omega> A) (\<lambda>x. 0)"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1050
  unfolding measure_space_def
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1051
  by (auto intro!: sigma_algebra_sigma_sets simp: positive_def countably_additive_def)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1052
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1053
lemma (in ring_of_sets) positive_cong_eq:
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1054
  "(\<And>a. a \<in> M \<Longrightarrow> \<mu>' a = \<mu> a) \<Longrightarrow> positive M \<mu>' = positive M \<mu>"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1055
  by (auto simp add: positive_def)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1056
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1057
lemma (in sigma_algebra) countably_additive_eq:
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1058
  "(\<And>a. a \<in> M \<Longrightarrow> \<mu>' a = \<mu> a) \<Longrightarrow> countably_additive M \<mu>' = countably_additive M \<mu>"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1059
  unfolding countably_additive_def
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1060
  by (intro arg_cong[where f=All] ext) (auto simp add: countably_additive_def subset_eq)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1061
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1062
lemma measure_space_eq:
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1063
  assumes closed: "A \<subseteq> Pow \<Omega>" and eq: "\<And>a. a \<in> sigma_sets \<Omega> A \<Longrightarrow> \<mu> a = \<mu>' a"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1064
  shows "measure_space \<Omega> (sigma_sets \<Omega> A) \<mu> = measure_space \<Omega> (sigma_sets \<Omega> A) \<mu>'"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1065
proof -
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1066
  interpret sigma_algebra \<Omega> "sigma_sets \<Omega> A" using closed by (rule sigma_algebra_sigma_sets)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1067
  from positive_cong_eq[OF eq, of "\<lambda>i. i"] countably_additive_eq[OF eq, of "\<lambda>i. i"] show ?thesis
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1068
    by (auto simp: measure_space_def)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1069
qed
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1070
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1071
lemma measure_of_eq:
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1072
  assumes closed: "A \<subseteq> Pow \<Omega>" and eq: "(\<And>a. a \<in> sigma_sets \<Omega> A \<Longrightarrow> \<mu> a = \<mu>' a)"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1073
  shows "measure_of \<Omega> A \<mu> = measure_of \<Omega> A \<mu>'"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1074
proof -
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1075
  have "measure_space \<Omega> (sigma_sets \<Omega> A) \<mu> = measure_space \<Omega> (sigma_sets \<Omega> A) \<mu>'"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1076
    using assms by (rule measure_space_eq)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1077
  with eq show ?thesis
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1078
    by (auto simp add: measure_of_def intro!: arg_cong[where f=Abs_measure])
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1079
qed
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1080
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1081
lemma
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1082
  assumes A: "A \<subseteq> Pow \<Omega>"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1083
  shows sets_measure_of[simp]: "sets (measure_of \<Omega> A \<mu>) = sigma_sets \<Omega> A" (is ?sets)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1084
    and space_measure_of[simp]: "space (measure_of \<Omega> A \<mu>) = \<Omega>" (is ?space)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1085
proof -
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1086
  have "?sets \<and> ?space"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1087
  proof cases
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1088
    assume "measure_space \<Omega> (sigma_sets \<Omega> A) \<mu>"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1089
    moreover have "measure_space \<Omega> (sigma_sets \<Omega> A) \<mu> = measure_space \<Omega> (sigma_sets \<Omega> A)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1090
       (\<lambda>a. if a \<in> sigma_sets \<Omega> A then \<mu> a else 0)"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1091
      using A by (rule measure_space_eq) auto
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1092
    ultimately show "?sets \<and> ?space"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1093
      by (auto simp: Abs_measure_inverse measure_of_def sets_def space_def)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1094
  next
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1095
    assume "\<not> measure_space \<Omega> (sigma_sets \<Omega> A) \<mu>"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1096
    with A show "?sets \<and> ?space"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1097
      by (auto simp: Abs_measure_inverse measure_of_def sets_def space_def measure_space_0)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1098
  qed
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1099
  then show ?sets ?space by auto
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1100
qed
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1101
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1102
lemma (in sigma_algebra) sets_measure_of_eq[simp]:
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1103
  "sets (measure_of \<Omega> M \<mu>) = M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1104
  using space_closed by (auto intro!: sigma_sets_eq)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1105
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1106
lemma (in sigma_algebra) space_measure_of_eq[simp]:
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1107
  "space (measure_of \<Omega> M \<mu>) = \<Omega>"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1108
  using space_closed by (auto intro!: sigma_sets_eq)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1109
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1110
lemma measure_of_subset:
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1111
  "M \<subseteq> Pow \<Omega> \<Longrightarrow> M' \<subseteq> M \<Longrightarrow> sets (measure_of \<Omega> M' \<mu>) \<subseteq> sets (measure_of \<Omega> M \<mu>')"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1112
  by (auto intro!: sigma_sets_subseteq)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1113
50245
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
  1114
lemma sigma_sets_mono'':
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
  1115
  assumes "A \<in> sigma_sets C D"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
  1116
  assumes "B \<subseteq> D"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
  1117
  assumes "D \<subseteq> Pow C"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
  1118
  shows "sigma_sets A B \<subseteq> sigma_sets C D"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
  1119
proof
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
  1120
  fix x assume "x \<in> sigma_sets A B"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
  1121
  thus "x \<in> sigma_sets C D"
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
  1122
  proof induct
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
  1123
    case (Basic a) with assms have "a \<in> D" by auto
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
  1124
    thus ?case ..
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
  1125
  next
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
  1126
    case Empty show ?case by (rule sigma_sets.Empty)
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
  1127
  next
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
  1128
    from assms have "A \<in> sets (sigma C D)" by (subst sets_measure_of[OF `D \<subseteq> Pow C`])
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
  1129
    moreover case (Compl a) hence "a \<in> sets (sigma C D)" by (subst sets_measure_of[OF `D \<subseteq> Pow C`])
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
  1130
    ultimately have "A - a \<in> sets (sigma C D)" ..
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
  1131
    thus ?case by (subst (asm) sets_measure_of[OF `D \<subseteq> Pow C`])
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
  1132
  next
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
  1133
    case (Union a)
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
  1134
    thus ?case by (intro sigma_sets.Union)
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
  1135
  qed
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
  1136
qed
dea9363887a6 based countable topological basis on Countable_Set
immler
parents: 50244
diff changeset
  1137
47756
7b2836a43cc9 correct lemma name
hoelzl
parents: 47694
diff changeset
  1138
lemma in_measure_of[intro, simp]: "M \<subseteq> Pow \<Omega> \<Longrightarrow> A \<in> M \<Longrightarrow> A \<in> sets (measure_of \<Omega> M \<mu>)"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1139
  by auto
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1140
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1141
section {* Constructing simple @{typ "'a measure"} *}
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1142
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1143
lemma emeasure_measure_of:
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1144
  assumes M: "M = measure_of \<Omega> A \<mu>"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1145
  assumes ms: "A \<subseteq> Pow \<Omega>" "positive (sets M) \<mu>" "countably_additive (sets M) \<mu>"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1146
  assumes X: "X \<in> sets M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1147
  shows "emeasure M X = \<mu> X"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1148
proof -
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1149
  interpret sigma_algebra \<Omega> "sigma_sets \<Omega> A" by (rule sigma_algebra_sigma_sets) fact
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1150
  have "measure_space \<Omega> (sigma_sets \<Omega> A) \<mu>"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1151
    using ms M by (simp add: measure_space_def sigma_algebra_sigma_sets)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1152
  moreover have "measure_space \<Omega> (sigma_sets \<Omega> A) (\<lambda>a. if a \<in> sigma_sets \<Omega> A then \<mu> a else 0)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1153
    = measure_space \<Omega> (sigma_sets \<Omega> A) \<mu>"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1154
    using ms(1) by (rule measure_space_eq) auto
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1155
  moreover have "X \<in> sigma_sets \<Omega> A"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1156
    using X M ms by simp
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1157
  ultimately show ?thesis
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1158
    unfolding emeasure_def measure_of_def M
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1159
    by (subst Abs_measure_inverse) (simp_all add: sigma_sets_eq)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1160
qed
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1161
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1162
lemma emeasure_measure_of_sigma:
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1163
  assumes ms: "sigma_algebra \<Omega> M" "positive M \<mu>" "countably_additive M \<mu>"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1164
  assumes A: "A \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1165
  shows "emeasure (measure_of \<Omega> M \<mu>) A = \<mu> A"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1166
proof -
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1167
  interpret sigma_algebra \<Omega> M by fact
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1168
  have "measure_space \<Omega> (sigma_sets \<Omega> M) \<mu>"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1169
    using ms sigma_sets_eq by (simp add: measure_space_def)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1170
  moreover have "measure_space \<Omega> (sigma_sets \<Omega> M) (\<lambda>a. if a \<in> sigma_sets \<Omega> M then \<mu> a else 0)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1171
    = measure_space \<Omega> (sigma_sets \<Omega> M) \<mu>"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1172
    using space_closed by (rule measure_space_eq) auto
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1173
  ultimately show ?thesis using A
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1174
    unfolding emeasure_def measure_of_def
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1175
    by (subst Abs_measure_inverse) (simp_all add: sigma_sets_eq)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1176
qed
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1177
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1178
lemma measure_cases[cases type: measure]:
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1179
  obtains (measure) \<Omega> A \<mu> where "x = Abs_measure (\<Omega>, A, \<mu>)" "\<forall>a\<in>-A. \<mu> a = 0" "measure_space \<Omega> A \<mu>"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1180
  by atomize_elim (cases x, auto)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1181
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1182
lemma sets_eq_imp_space_eq:
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1183
  "sets M = sets M' \<Longrightarrow> space M = space M'"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50096
diff changeset
  1184
  using sets.top[of M] sets.top[of M'] sets.space_closed[of M] sets.space_closed[of M']
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1185
  by blast
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1186
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1187
lemma emeasure_notin_sets: "A \<notin> sets M \<Longrightarrow> emeasure M A = 0"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1188
  by (cases M) (auto simp: sets_def emeasure_def Abs_measure_inverse measure_space_def)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1189
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1190
lemma measure_notin_sets: "A \<notin> sets M \<Longrightarrow> measure M A = 0"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1191
  by (simp add: measure_def emeasure_notin_sets)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1192
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1193
lemma measure_eqI:
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1194
  fixes M N :: "'a measure"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1195
  assumes "sets M = sets N" and eq: "\<And>A. A \<in> sets M \<Longrightarrow> emeasure M A = emeasure N A"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1196
  shows "M = N"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1197
proof (cases M N rule: measure_cases[case_product measure_cases])
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1198
  case (measure_measure \<Omega> A \<mu> \<Omega>' A' \<mu>')
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1199
  interpret M: sigma_algebra \<Omega> A using measure_measure by (auto simp: measure_space_def)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1200
  interpret N: sigma_algebra \<Omega>' A' using measure_measure by (auto simp: measure_space_def)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1201
  have "A = sets M" "A' = sets N"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1202
    using measure_measure by (simp_all add: sets_def Abs_measure_inverse)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1203
  with `sets M = sets N` have "A = A'" by simp
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1204
  moreover with M.top N.top M.space_closed N.space_closed have "\<Omega> = \<Omega>'" by auto
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1205
  moreover { fix B have "\<mu> B = \<mu>' B"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1206
    proof cases
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1207
      assume "B \<in> A"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1208
      with eq `A = sets M` have "emeasure M B = emeasure N B" by simp
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1209
      with measure_measure show "\<mu> B = \<mu>' B"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1210
        by (simp add: emeasure_def Abs_measure_inverse)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1211
    next
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1212
      assume "B \<notin> A"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1213
      with `A = sets M` `A' = sets N` `A = A'` have "B \<notin> sets M" "B \<notin> sets N"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1214
        by auto
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1215
      then have "emeasure M B = 0" "emeasure N B = 0"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1216
        by (simp_all add: emeasure_notin_sets)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1217
      with measure_measure show "\<mu> B = \<mu>' B"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1218
        by (simp add: emeasure_def Abs_measure_inverse)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1219
    qed }
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1220
  then have "\<mu> = \<mu>'" by auto
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1221
  ultimately show "M = N"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1222
    by (simp add: measure_measure)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1223
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  1224
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1225
lemma emeasure_sigma: "A \<subseteq> Pow \<Omega> \<Longrightarrow> emeasure (sigma \<Omega> A) = (\<lambda>_. 0)"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1226
  using measure_space_0[of A \<Omega>]
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1227
  by (simp add: measure_of_def emeasure_def Abs_measure_inverse)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1228
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1229
lemma sigma_eqI:
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1230
  assumes [simp]: "M \<subseteq> Pow \<Omega>" "N \<subseteq> Pow \<Omega>" "sigma_sets \<Omega> M = sigma_sets \<Omega> N"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1231
  shows "sigma \<Omega> M = sigma \<Omega> N"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1232
  by (rule measure_eqI) (simp_all add: emeasure_sigma)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1233
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1234
section {* Measurable functions *}
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1235
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1236
definition measurable :: "'a measure \<Rightarrow> 'b measure \<Rightarrow> ('a \<Rightarrow> 'b) set" where
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1237
  "measurable A B = {f \<in> space A -> space B. \<forall>y \<in> sets B. f -` y \<inter> space A \<in> sets A}"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1238
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1239
lemma measurable_space:
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1240
  "f \<in> measurable M A \<Longrightarrow> x \<in> space M \<Longrightarrow> f x \<in> space A"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1241
   unfolding measurable_def by auto
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1242
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1243
lemma measurable_sets:
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1244
  "f \<in> measurable M A \<Longrightarrow> S \<in> sets A \<Longrightarrow> f -` S \<inter> space M \<in> sets M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1245
   unfolding measurable_def by auto
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1246
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1247
lemma measurable_sets_Collect:
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1248
  assumes f: "f \<in> measurable M N" and P: "{x\<in>space N. P x} \<in> sets N" shows "{x\<in>space M. P (f x)} \<in> sets M"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1249
proof -
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1250
  have "f -` {x \<in> space N. P x} \<inter> space M = {x\<in>space M. P (f x)}"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1251
    using measurable_space[OF f] by auto
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1252
  with measurable_sets[OF f P] show ?thesis
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1253
    by simp
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1254
qed
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1255
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1256
lemma measurable_sigma_sets:
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1257
  assumes B: "sets N = sigma_sets \<Omega> A" "A \<subseteq> Pow \<Omega>"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1258
      and f: "f \<in> space M \<rightarrow> \<Omega>"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1259
      and ba: "\<And>y. y \<in> A \<Longrightarrow> (f -` y) \<inter> space M \<in> sets M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1260
  shows "f \<in> measurable M N"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1261
proof -
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1262
  interpret A: sigma_algebra \<Omega> "sigma_sets \<Omega> A" using B(2) by (rule sigma_algebra_sigma_sets)
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50096
diff changeset
  1263
  from B sets.top[of N] A.top sets.space_closed[of N] A.space_closed have \<Omega>: "\<Omega> = space N" by force
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1264
  
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1265
  { fix X assume "X \<in> sigma_sets \<Omega> A"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1266
    then have "f -` X \<inter> space M \<in> sets M \<and> X \<subseteq> \<Omega>"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1267
      proof induct
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1268
        case (Basic a) then show ?case
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1269
          by (auto simp add: ba) (metis B(2) subsetD PowD)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1270
      next
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1271
        case (Compl a)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1272
        have [simp]: "f -` \<Omega> \<inter> space M = space M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1273
          by (auto simp add: funcset_mem [OF f])
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1274
        then show ?case
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50096
diff changeset
  1275
          by (auto simp add: vimage_Diff Diff_Int_distrib2 sets.compl_sets Compl)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1276
      next
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1277
        case (Union a)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1278
        then show ?case
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1279
          by (simp add: vimage_UN, simp only: UN_extend_simps(4)) blast
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1280
      qed auto }
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1281
  with f show ?thesis
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1282
    by (auto simp add: measurable_def B \<Omega>)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1283
qed
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1284
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1285
lemma measurable_measure_of:
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1286
  assumes B: "N \<subseteq> Pow \<Omega>"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1287
      and f: "f \<in> space M \<rightarrow> \<Omega>"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1288
      and ba: "\<And>y. y \<in> N \<Longrightarrow> (f -` y) \<inter> space M \<in> sets M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1289
  shows "f \<in> measurable M (measure_of \<Omega> N \<mu>)"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1290
proof -
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1291
  have "sets (measure_of \<Omega> N \<mu>) = sigma_sets \<Omega> N"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1292
    using B by (rule sets_measure_of)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1293
  from this assms show ?thesis by (rule measurable_sigma_sets)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1294
qed
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1295
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1296
lemma measurable_iff_measure_of:
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1297
  assumes "N \<subseteq> Pow \<Omega>" "f \<in> space M \<rightarrow> \<Omega>"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1298
  shows "f \<in> measurable M (measure_of \<Omega> N \<mu>) \<longleftrightarrow> (\<forall>A\<in>N. f -` A \<inter> space M \<in> sets M)"
47756
7b2836a43cc9 correct lemma name
hoelzl
parents: 47694
diff changeset
  1299
  by (metis assms in_measure_of measurable_measure_of assms measurable_sets)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1300
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1301
lemma measurable_cong_sets:
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1302
  assumes sets: "sets M = sets M'" "sets N = sets N'"
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1303
  shows "measurable M N = measurable M' N'"
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1304
  using sets[THEN sets_eq_imp_space_eq] sets by (simp add: measurable_def)
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1305
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1306
lemma measurable_cong:
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1307
  assumes "\<And> w. w \<in> space M \<Longrightarrow> f w = g w"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1308
  shows "f \<in> measurable M M' \<longleftrightarrow> g \<in> measurable M M'"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1309
  unfolding measurable_def using assms
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1310
  by (simp cong: vimage_inter_cong Pi_cong)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1311
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1312
lemma measurable_eqI:
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1313
     "\<lbrakk> space m1 = space m1' ; space m2 = space m2' ;
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1314
        sets m1 = sets m1' ; sets m2 = sets m2' \<rbrakk>
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1315
      \<Longrightarrow> measurable m1 m2 = measurable m1' m2'"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1316
  by (simp add: measurable_def sigma_algebra_iff2)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1317
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1318
lemma measurable_compose:
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1319
  assumes f: "f \<in> measurable M N" and g: "g \<in> measurable N L"
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1320
  shows "(\<lambda>x. g (f x)) \<in> measurable M L"
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1321
proof -
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1322
  have "\<And>A. (\<lambda>x. g (f x)) -` A \<inter> space M = f -` (g -` A \<inter> space N) \<inter> space M"
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1323
    using measurable_space[OF f] by auto
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1324
  with measurable_space[OF f] measurable_space[OF g] show ?thesis
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1325
    by (auto intro: measurable_sets[OF f] measurable_sets[OF g]
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1326
             simp del: vimage_Int simp add: measurable_def)
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1327
qed
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1328
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1329
lemma measurable_comp:
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1330
  "f \<in> measurable M N \<Longrightarrow> g \<in> measurable N L \<Longrightarrow> g \<circ> f \<in> measurable M L"
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1331
  using measurable_compose[of f M N g L] by (simp add: comp_def)
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1332
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1333
lemma measurable_const:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1334
  "c \<in> space M' \<Longrightarrow> (\<lambda>x. c) \<in> measurable M M'"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1335
  by (auto simp add: measurable_def)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1336
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1337
lemma measurable_If:
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1338
  assumes measure: "f \<in> measurable M M'" "g \<in> measurable M M'"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1339
  assumes P: "{x\<in>space M. P x} \<in> sets M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1340
  shows "(\<lambda>x. if P x then f x else g x) \<in> measurable M M'"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1341
  unfolding measurable_def
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1342
proof safe
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1343
  fix x assume "x \<in> space M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1344
  thus "(if P x then f x else g x) \<in> space M'"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1345
    using measure unfolding measurable_def by auto
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1346
next
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1347
  fix A assume "A \<in> sets M'"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1348
  hence *: "(\<lambda>x. if P x then f x else g x) -` A \<inter> space M =
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1349
    ((f -` A \<inter> space M) \<inter> {x\<in>space M. P x}) \<union>
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1350
    ((g -` A \<inter> space M) \<inter> (space M - {x\<in>space M. P x}))"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1351
    using measure unfolding measurable_def by (auto split: split_if_asm)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1352
  show "(\<lambda>x. if P x then f x else g x) -` A \<inter> space M \<in> sets M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1353
    using `A \<in> sets M'` measure P unfolding * measurable_def
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50096
diff changeset
  1354
    by (auto intro!: sets.Un)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1355
qed
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1356
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1357
lemma measurable_If_set:
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1358
  assumes measure: "f \<in> measurable M M'" "g \<in> measurable M M'"
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  1359
  assumes P: "A \<inter> space M \<in> sets M"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1360
  shows "(\<lambda>x. if x \<in> A then f x else g x) \<in> measurable M M'"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1361
proof (rule measurable_If[OF measure])
49773
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  1362
  have "{x \<in> space M. x \<in> A} = A \<inter> space M" by auto
16907431e477 tuned measurable_If; moved countably_additive equalities to Measure_Space; tuned proofs
hoelzl
parents: 47762
diff changeset
  1363
  thus "{x \<in> space M. x \<in> A} \<in> sets M" using `A \<inter> space M \<in> sets M` by auto
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1364
qed
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1365
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1366
lemma measurable_ident: "id \<in> measurable M M"
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1367
  by (auto simp add: measurable_def)
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1368
50021
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1369
lemma measurable_ident_sets:
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1370
  assumes eq: "sets M = sets M'" shows "(\<lambda>x. x) \<in> measurable M M'"
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1371
  using measurable_ident[of M]
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1372
  unfolding id_def measurable_def eq sets_eq_imp_space_eq[OF eq] .
49782
d5c6a905b57e add measurable_compose
hoelzl
parents: 49773
diff changeset
  1373
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1374
lemma sets_Least:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1375
  assumes meas: "\<And>i::nat. {x\<in>space M. P i x} \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1376
  shows "(\<lambda>x. LEAST j. P j x) -` A \<inter> space M \<in> sets M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1377
proof -
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1378
  { fix i have "(\<lambda>x. LEAST j. P j x) -` {i} \<inter> space M \<in> sets M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1379
    proof cases
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1380
      assume i: "(LEAST j. False) = i"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1381
      have "(\<lambda>x. LEAST j. P j x) -` {i} \<inter> space M =
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1382
        {x\<in>space M. P i x} \<inter> (space M - (\<Union>j<i. {x\<in>space M. P j x})) \<union> (space M - (\<Union>i. {x\<in>space M. P i x}))"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1383
        by (simp add: set_eq_iff, safe)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1384
           (insert i, auto dest: Least_le intro: LeastI intro!: Least_equality)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1385
      with meas show ?thesis
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50096
diff changeset
  1386
        by (auto intro!: sets.Int)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1387
    next
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1388
      assume i: "(LEAST j. False) \<noteq> i"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1389
      then have "(\<lambda>x. LEAST j. P j x) -` {i} \<inter> space M =
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1390
        {x\<in>space M. P i x} \<inter> (space M - (\<Union>j<i. {x\<in>space M. P j x}))"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1391
      proof (simp add: set_eq_iff, safe)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1392
        fix x assume neq: "(LEAST j. False) \<noteq> (LEAST j. P j x)"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1393
        have "\<exists>j. P j x"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1394
          by (rule ccontr) (insert neq, auto)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1395
        then show "P (LEAST j. P j x) x" by (rule LeastI_ex)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1396
      qed (auto dest: Least_le intro!: Least_equality)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1397
      with meas show ?thesis
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1398
        by auto
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1399
    qed }
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1400
  then have "(\<Union>i\<in>A. (\<lambda>x. LEAST j. P j x) -` {i} \<inter> space M) \<in> sets M"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50096
diff changeset
  1401
    by (intro sets.countable_UN) auto
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1402
  moreover have "(\<Union>i\<in>A. (\<lambda>x. LEAST j. P j x) -` {i} \<inter> space M) =
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1403
    (\<lambda>x. LEAST j. P j x) -` A \<inter> space M" by auto
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1404
  ultimately show ?thesis by auto
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1405
qed
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1406
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1407
lemma measurable_strong:
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1408
  fixes f :: "'a \<Rightarrow> 'b" and g :: "'b \<Rightarrow> 'c"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1409
  assumes f: "f \<in> measurable a b" and g: "g \<in> space b \<rightarrow> space c"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1410
      and t: "f ` (space a) \<subseteq> t"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1411
      and cb: "\<And>s. s \<in> sets c \<Longrightarrow> (g -` s) \<inter> t \<in> sets b"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1412
  shows "(g o f) \<in> measurable a c"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1413
proof -
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1414
  have fab: "f \<in> (space a -> space b)"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1415
   and ba: "\<And>y. y \<in> sets b \<Longrightarrow> (f -` y) \<inter> (space a) \<in> sets a" using f
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1416
     by (auto simp add: measurable_def)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1417
  have eq: "\<And>y. f -` g -` y \<inter> space a = f -` (g -` y \<inter> t) \<inter> space a" using t
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1418
    by force
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1419
  show ?thesis
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1420
    apply (auto simp add: measurable_def vimage_compose)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1421
    apply (metis funcset_mem fab g)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1422
    apply (subst eq, metis ba cb)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1423
    done
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1424
qed
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1425
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1426
lemma measurable_mono1:
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1427
  "M' \<subseteq> Pow \<Omega> \<Longrightarrow> M \<subseteq> M' \<Longrightarrow>
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1428
    measurable (measure_of \<Omega> M \<mu>) N \<subseteq> measurable (measure_of \<Omega> M' \<mu>') N"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1429
  using measure_of_subset[of M' \<Omega> M] by (auto simp add: measurable_def)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1430
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1431
section {* Counting space *}
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1432
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1433
definition count_space :: "'a set \<Rightarrow> 'a measure" where
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1434
  "count_space \<Omega> = measure_of \<Omega> (Pow \<Omega>) (\<lambda>A. if finite A then ereal (card A) else \<infinity>)"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1435
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1436
lemma 
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1437
  shows space_count_space[simp]: "space (count_space \<Omega>) = \<Omega>"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1438
    and sets_count_space[simp]: "sets (count_space \<Omega>) = Pow \<Omega>"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1439
  using sigma_sets_into_sp[of "Pow \<Omega>" \<Omega>]
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1440
  by (auto simp: count_space_def)
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1441
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1442
lemma measurable_count_space_eq1[simp]:
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1443
  "f \<in> measurable (count_space A) M \<longleftrightarrow> f \<in> A \<rightarrow> space M"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1444
 unfolding measurable_def by simp
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1445
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1446
lemma measurable_count_space_eq2:
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1447
  assumes "finite A"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1448
  shows "f \<in> measurable M (count_space A) \<longleftrightarrow> (f \<in> space M \<rightarrow> A \<and> (\<forall>a\<in>A. f -` {a} \<inter> space M \<in> sets M))"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1449
proof -
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1450
  { fix X assume "X \<subseteq> A" "f \<in> space M \<rightarrow> A"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1451
    with `finite A` have "f -` X \<inter> space M = (\<Union>a\<in>X. f -` {a} \<inter> space M)" "finite X"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1452
      by (auto dest: finite_subset)
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1453
    moreover assume "\<forall>a\<in>A. f -` {a} \<inter> space M \<in> sets M"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1454
    ultimately have "f -` X \<inter> space M \<in> sets M"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50096
diff changeset
  1455
      using `X \<subseteq> A` by (auto intro!: sets.finite_UN simp del: UN_simps) }
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1456
  then show ?thesis
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1457
    unfolding measurable_def by auto
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1458
qed
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1459
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1460
lemma measurable_compose_countable:
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1461
  assumes f: "\<And>i::'i::countable. (\<lambda>x. f i x) \<in> measurable M N" and g: "g \<in> measurable M (count_space UNIV)"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1462
  shows "(\<lambda>x. f (g x) x) \<in> measurable M N"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1463
  unfolding measurable_def
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1464
proof safe
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1465
  fix x assume "x \<in> space M" then show "f (g x) x \<in> space N"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1466
    using f[THEN measurable_space] g[THEN measurable_space] by auto
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1467
next
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1468
  fix A assume A: "A \<in> sets N"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1469
  have "(\<lambda>x. f (g x) x) -` A \<inter> space M = (\<Union>i. (g -` {i} \<inter> space M) \<inter> (f i -` A \<inter> space M))"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1470
    by auto
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1471
  also have "\<dots> \<in> sets M" using f[THEN measurable_sets, OF A] g[THEN measurable_sets]
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50096
diff changeset
  1472
    by (auto intro!: sets.countable_UN measurable_sets)
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1473
  finally show "(\<lambda>x. f (g x) x) -` A \<inter> space M \<in> sets M" .
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1474
qed
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1475
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1476
subsection {* Measurable method *}
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1477
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1478
lemma (in algebra) sets_Collect_finite_All:
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1479
  assumes "\<And>i. i \<in> S \<Longrightarrow> {x\<in>\<Omega>. P i x} \<in> M" "finite S"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1480
  shows "{x\<in>\<Omega>. \<forall>i\<in>S. P i x} \<in> M"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1481
proof -
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1482
  have "{x\<in>\<Omega>. \<forall>i\<in>S. P i x} = (if S = {} then \<Omega> else \<Inter>i\<in>S. {x\<in>\<Omega>. P i x})"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1483
    by auto
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1484
  with assms show ?thesis by (auto intro!: sets_Collect_finite_All')
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1485
qed
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1486
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1487
abbreviation "pred M P \<equiv> P \<in> measurable M (count_space (UNIV::bool set))"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1488
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1489
lemma pred_def: "pred M P \<longleftrightarrow> {x\<in>space M. P x} \<in> sets M"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1490
proof
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1491
  assume "pred M P"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1492
  then have "P -` {True} \<inter> space M \<in> sets M"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1493
    by (auto simp: measurable_count_space_eq2)
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1494
  also have "P -` {True} \<inter> space M = {x\<in>space M. P x}" by auto
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1495
  finally show "{x\<in>space M. P x} \<in> sets M" .
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1496
next
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1497
  assume P: "{x\<in>space M. P x} \<in> sets M"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1498
  moreover
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1499
  { fix X
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1500
    have "X \<in> Pow (UNIV :: bool set)" by simp
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1501
    then have "P -` X \<inter> space M = {x\<in>space M. ((X = {True} \<longrightarrow> P x) \<and> (X = {False} \<longrightarrow> \<not> P x) \<and> X \<noteq> {})}"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1502
      unfolding UNIV_bool Pow_insert Pow_empty by auto
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1503
    then have "P -` X \<inter> space M \<in> sets M"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50096
diff changeset
  1504
      by (auto intro!: sets.sets_Collect_neg sets.sets_Collect_imp sets.sets_Collect_conj sets.sets_Collect_const P) }
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1505
  then show "pred M P"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1506
    by (auto simp: measurable_def)
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1507
qed
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1508
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1509
lemma pred_sets1: "{x\<in>space M. P x} \<in> sets M \<Longrightarrow> f \<in> measurable N M \<Longrightarrow> pred N (\<lambda>x. P (f x))"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1510
  by (rule measurable_compose[where f=f and N=M]) (auto simp: pred_def)
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1511
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1512
lemma pred_sets2: "A \<in> sets N \<Longrightarrow> f \<in> measurable M N \<Longrightarrow> pred M (\<lambda>x. f x \<in> A)"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1513
  by (rule measurable_compose[where f=f and N=N]) (auto simp: pred_def Int_def[symmetric])
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1514
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1515
lemma measurable_count_space_const:
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1516
  "(\<lambda>x. c) \<in> measurable M (count_space UNIV)"
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1517
  by (simp add: measurable_const)
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1518
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1519
lemma measurable_count_space:
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1520
  "f \<in> measurable (count_space A) (count_space UNIV)"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1521
  by simp
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1522
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1523
lemma measurable_compose_rev:
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1524
  assumes f: "f \<in> measurable L N" and g: "g \<in> measurable M L"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1525
  shows "(\<lambda>x. f (g x)) \<in> measurable M N"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1526
  using measurable_compose[OF g f] .
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1527
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1528
ML {*
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1529
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1530
structure Measurable =
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1531
struct
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1532
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1533
datatype level = Concrete | Generic;
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1534
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1535
structure Data = Generic_Data
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1536
(
50021
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1537
  type T = {
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1538
    concrete_thms : thm Item_Net.T,
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1539
    generic_thms : thm Item_Net.T,
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1540
    dest_thms : thm Item_Net.T,
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1541
    app_thms : thm Item_Net.T }
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1542
  val empty = {
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1543
    concrete_thms = Thm.full_rules,
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1544
    generic_thms = Thm.full_rules,
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1545
    dest_thms = Thm.full_rules,
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1546
    app_thms = Thm.full_rules};
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1547
  val extend = I;
50283
e79a8341dd6b make SML/NJ happy (give names for all fields in a record)
hoelzl
parents: 50252
diff changeset
  1548
  fun merge ({concrete_thms = ct1, generic_thms = gt1, dest_thms = dt1, app_thms = at1 },
e79a8341dd6b make SML/NJ happy (give names for all fields in a record)
hoelzl
parents: 50252
diff changeset
  1549
      {concrete_thms = ct2, generic_thms = gt2, dest_thms = dt2, app_thms = at2 }) = {
e79a8341dd6b make SML/NJ happy (give names for all fields in a record)
hoelzl
parents: 50252
diff changeset
  1550
    concrete_thms = Item_Net.merge (ct1, ct2),
e79a8341dd6b make SML/NJ happy (give names for all fields in a record)
hoelzl
parents: 50252
diff changeset
  1551
    generic_thms = Item_Net.merge (gt1, gt2),
e79a8341dd6b make SML/NJ happy (give names for all fields in a record)
hoelzl
parents: 50252
diff changeset
  1552
    dest_thms = Item_Net.merge (dt1, dt2),
e79a8341dd6b make SML/NJ happy (give names for all fields in a record)
hoelzl
parents: 50252
diff changeset
  1553
    app_thms = Item_Net.merge (at1, at2) };
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1554
);
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1555
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1556
val debug =
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1557
  Attrib.setup_config_bool @{binding measurable_debug} (K false)
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1558
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1559
val backtrack =
50021
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1560
  Attrib.setup_config_int @{binding measurable_backtrack} (K 20)
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1561
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1562
val split =
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1563
  Attrib.setup_config_bool @{binding measurable_split} (K true)
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1564
50021
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1565
fun TAKE n tac = Seq.take n o tac
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1566
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1567
fun get lv =
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1568
  rev o Item_Net.content o (case lv of Concrete => #concrete_thms | Generic => #generic_thms) o
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1569
  Data.get o Context.Proof;
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1570
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1571
fun get_all ctxt = get Concrete ctxt @ get Generic ctxt;
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1572
50021
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1573
fun map_data f1 f2 f3 f4
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1574
  {generic_thms = t1,    concrete_thms = t2,    dest_thms = t3,    app_thms = t4} =
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1575
  {generic_thms = f1 t1, concrete_thms = f2 t2, dest_thms = f3 t3, app_thms = f4 t4 }
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1576
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1577
fun map_concrete_thms f = map_data f I I I
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1578
fun map_generic_thms f = map_data I f I I
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1579
fun map_dest_thms f = map_data I I f I
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1580
fun map_app_thms f = map_data I I I f
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1581
50021
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1582
fun update f lv = Data.map (case lv of Concrete => map_concrete_thms f | Generic => map_generic_thms f);
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1583
fun add thms' = update (fold Item_Net.update thms');
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1584
50021
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1585
val get_dest = Item_Net.content o #dest_thms o Data.get;
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1586
val add_dest = Data.map o map_dest_thms o Item_Net.update;
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1587
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1588
val get_app = Item_Net.content o #app_thms o Data.get;
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1589
val add_app = Data.map o map_app_thms o Item_Net.update;
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1590
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1591
fun is_too_generic thm =
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1592
  let 
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1593
    val concl = concl_of thm
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1594
    val concl' = HOLogic.dest_Trueprop concl handle TERM _ => concl
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1595
  in is_Var (head_of concl') end
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1596
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1597
fun import_theorem ctxt thm = if is_too_generic thm then [] else
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1598
  [thm] @ map_filter (try (fn th' => thm RS th')) (get_dest ctxt);
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1599
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1600
fun add_thm (raw, lv) thm ctxt = add (if raw then [thm] else import_theorem ctxt thm) lv ctxt;
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1601
50021
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1602
fun debug_tac ctxt msg f = if Config.get ctxt debug then print_tac (msg ()) THEN f else f
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1603
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1604
fun nth_hol_goal thm i =
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1605
  HOLogic.dest_Trueprop (Logic.strip_imp_concl (strip_all_body (nth (prems_of thm) (i - 1))))
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1606
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1607
fun dest_measurable_fun t =
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1608
  (case t of
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1609
    (Const (@{const_name "Set.member"}, _) $ f $ (Const (@{const_name "measurable"}, _) $ _ $ _)) => f
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1610
  | _ => raise (TERM ("not a measurability predicate", [t])))
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1611
50021
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1612
fun is_cond_formula n thm = if length (prems_of thm) < n then false else
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1613
  (case nth_hol_goal thm n of
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1614
    (Const (@{const_name "Set.member"}, _) $ _ $ (Const (@{const_name "sets"}, _) $ _)) => false
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1615
  | (Const (@{const_name "Set.member"}, _) $ _ $ (Const (@{const_name "measurable"}, _) $ _ $ _)) => false
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1616
  | _ => true)
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1617
  handle TERM _ => true;
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1618
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1619
fun indep (Bound i) t b = i < b orelse t <= i
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1620
  | indep (f $ t) top bot = indep f top bot andalso indep t top bot
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1621
  | indep (Abs (_,_,t)) top bot = indep t (top + 1) (bot + 1)
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1622
  | indep _ _ _ = true;
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1623
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1624
fun cnt_prefixes ctxt (Abs (n, T, t)) = let
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1625
      fun is_countable t = Type.of_sort (Proof_Context.tsig_of ctxt) (t, @{sort countable})
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1626
      fun cnt_walk (Abs (ns, T, t)) Ts =
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1627
          map (fn (t', t'') => (Abs (ns, T, t'), t'')) (cnt_walk t (T::Ts))
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1628
        | cnt_walk (f $ g) Ts = let
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1629
            val n = length Ts - 1
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1630
          in
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1631
            map (fn (f', t) => (f' $ g, t)) (cnt_walk f Ts) @
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1632
            map (fn (g', t) => (f $ g', t)) (cnt_walk g Ts) @
50021
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1633
            (if is_countable (type_of1 (Ts, g)) andalso loose_bvar1 (g, n)
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1634
                andalso indep g n 0 andalso g <> Bound n
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1635
              then [(f $ Bound (n + 1), incr_boundvars (~ n) g)]
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1636
              else [])
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1637
          end
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1638
        | cnt_walk _ _ = []
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1639
    in map (fn (t1, t2) => let
50021
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1640
        val T1 = type_of1 ([T], t2)
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1641
        val T2 = type_of1 ([T], t)
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1642
      in ([SOME (Abs (n, T1, Abs (n, T, t1))), NONE, NONE, SOME (Abs (n, T, t2))],
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1643
        [SOME T1, SOME T, SOME T2])
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1644
      end) (cnt_walk t [T])
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1645
    end
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1646
  | cnt_prefixes _ _ = []
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1647
50021
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1648
val split_countable_tac =
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1649
  Subgoal.FOCUS (fn {context = ctxt, ...} => SUBGOAL (fn (t, i) =>
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1650
    let
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1651
      val f = dest_measurable_fun (HOLogic.dest_Trueprop t)
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1652
      fun cert f = map (Option.map (f (Proof_Context.theory_of ctxt)))
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1653
      fun inst t (ts, Ts) = Drule.instantiate' (cert ctyp_of Ts) (cert cterm_of ts) t
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1654
      val cps = cnt_prefixes ctxt f |> map (inst @{thm measurable_compose_countable})
50096
7c9c5b1b6cd7 more measurability rules
hoelzl
parents: 50021
diff changeset
  1655
    in if null cps then no_tac else debug_tac ctxt (K "split countable fun") (resolve_tac cps i) end
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1656
    handle TERM _ => no_tac) 1)
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1657
50021
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1658
fun measurable_tac' ctxt ss facts = let
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1659
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1660
    val imported_thms =
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1661
      (maps (import_theorem (Context.Proof ctxt) o Simplifier.norm_hhf) facts) @ get_all ctxt
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1662
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1663
    fun debug_facts msg () =
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1664
      msg ^ " + " ^ Pretty.str_of (Pretty.list "[" "]"
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1665
        (map (Syntax.pretty_term ctxt o prop_of) (maps (import_theorem (Context.Proof ctxt)) facts)));
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1666
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1667
    val splitter = if Config.get ctxt split then split_countable_tac ctxt else K no_tac
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1668
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1669
    val split_app_tac =
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1670
      Subgoal.FOCUS (fn {context = ctxt, ...} => SUBGOAL (fn (t, i) =>
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1671
        let
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1672
          fun app_prefixes (Abs (n, T, (f $ g))) = let
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1673
                val ps = (if not (loose_bvar1 (g, 0)) then [(f, g)] else [])
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1674
              in map (fn (f, c) => (Abs (n, T, f), c, T, type_of c, type_of1 ([T], f $ c))) ps end
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1675
            | app_prefixes _ = []
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1676
50021
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1677
          fun dest_app (Abs (_, T, t as ((f $ Bound 0) $ c))) = (f, c, T, type_of c, type_of1 ([T], t))
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1678
            | dest_app t = raise (TERM ("not a measurability predicate of an application", [t]))
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1679
          val thy = Proof_Context.theory_of ctxt
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1680
          val tunify = Sign.typ_unify thy
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1681
          val thms = map
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1682
              (fn thm => (thm, dest_app (dest_measurable_fun (HOLogic.dest_Trueprop (concl_of thm)))))
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1683
              (get_app (Context.Proof ctxt))
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1684
          fun cert f = map (fn (t, t') => (f thy t, f thy t'))
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1685
          fun inst (f, c, T, Tc, Tf) (thm, (thmf, thmc, thmT, thmTc, thmTf)) =
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1686
            let
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1687
              val inst =
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1688
                (Vartab.empty, ~1)
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1689
                |> tunify (T, thmT)
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1690
                |> tunify (Tf, thmTf)
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1691
                |> tunify (Tc, thmTc)
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1692
                |> Vartab.dest o fst
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1693
              val subst = subst_TVars (map (apsnd snd) inst)
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1694
            in
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1695
              Thm.instantiate (cert ctyp_of (map (fn (n, (s, T)) => (TVar (n, s), T)) inst),
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1696
                cert cterm_of [(subst thmf, f), (subst thmc, c)]) thm
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1697
            end
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1698
          val cps = map_product inst (app_prefixes (dest_measurable_fun (HOLogic.dest_Trueprop t))) thms
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1699
        in if null cps then no_tac
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1700
            else debug_tac ctxt (K ("split app fun")) (resolve_tac cps i)
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1701
              ORELSE debug_tac ctxt (fn () => "FAILED") no_tac end
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1702
        handle TERM t => debug_tac ctxt (fn () => "TERM " ^ fst t ^ Pretty.str_of (Pretty.list "[" "]" (map (Syntax.pretty_term ctxt) (snd t)))) no_tac
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1703
        handle Type.TUNIFY => debug_tac ctxt (fn () => "TUNIFY") no_tac) 1)
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1704
50021
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1705
    val depth_measurable_tac = REPEAT
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1706
      (COND (is_cond_formula 1)
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1707
        (debug_tac ctxt (K "simp") (SOLVED' (asm_full_simp_tac ss) 1))
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1708
        ((debug_tac ctxt (K "single") (resolve_tac imported_thms 1)) APPEND
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1709
          (split_app_tac ctxt 1) APPEND
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1710
          (splitter 1)))
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1711
50021
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1712
  in debug_tac ctxt (debug_facts "start") depth_measurable_tac end;
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1713
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1714
fun measurable_tac ctxt facts =
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1715
  TAKE (Config.get ctxt backtrack) (measurable_tac' ctxt (simpset_of ctxt) facts);
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1716
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1717
val attr_add = Thm.declaration_attribute o add_thm;
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1718
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1719
val attr : attribute context_parser =
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1720
  Scan.lift (Scan.optional (Args.parens (Scan.optional (Args.$$$ "raw" >> K true) false --
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1721
     Scan.optional (Args.$$$ "generic" >> K Generic) Concrete)) (false, Concrete) >> attr_add);
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1722
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1723
val dest_attr : attribute context_parser =
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1724
  Scan.lift (Scan.succeed (Thm.declaration_attribute add_dest));
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1725
50021
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1726
val app_attr : attribute context_parser =
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1727
  Scan.lift (Scan.succeed (Thm.declaration_attribute add_app));
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1728
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1729
val method : (Proof.context -> Method.method) context_parser =
50021
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1730
  Scan.lift (Scan.succeed (fn ctxt => METHOD (fn facts => measurable_tac ctxt facts)));
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1731
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1732
fun simproc ss redex = let
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1733
    val ctxt = Simplifier.the_context ss;
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1734
    val t = HOLogic.mk_Trueprop (term_of redex);
50283
e79a8341dd6b make SML/NJ happy (give names for all fields in a record)
hoelzl
parents: 50252
diff changeset
  1735
    fun tac {context = ctxt, prems = _ } =
50021
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1736
      SOLVE (measurable_tac' ctxt ss (Simplifier.prems_of ss));
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1737
  in try (fn () => Goal.prove ctxt [] [] t tac RS @{thm Eq_TrueI}) () end;
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1738
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1739
end
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1740
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1741
*}
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1742
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1743
attribute_setup measurable = {* Measurable.attr *} "declaration of measurability theorems"
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1744
attribute_setup measurable_dest = {* Measurable.dest_attr *} "add dest rule for measurability prover"
50021
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1745
attribute_setup measurable_app = {* Measurable.app_attr *} "add application rule for measurability prover"
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1746
method_setup measurable = {* Measurable.method *} "measurability prover"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1747
simproc_setup measurable ("A \<in> sets M" | "f \<in> measurable M N") = {* K Measurable.simproc *}
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1748
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1749
declare
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1750
  measurable_compose_rev[measurable_dest]
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1751
  pred_sets1[measurable_dest]
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1752
  pred_sets2[measurable_dest]
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50096
diff changeset
  1753
  sets.sets_into_space[measurable_dest]
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1754
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1755
declare
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50096
diff changeset
  1756
  sets.top[measurable]
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50096
diff changeset
  1757
  sets.empty_sets[measurable (raw)]
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50096
diff changeset
  1758
  sets.Un[measurable (raw)]
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50096
diff changeset
  1759
  sets.Diff[measurable (raw)]
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1760
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1761
declare
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1762
  measurable_count_space[measurable (raw)]
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1763
  measurable_ident[measurable (raw)]
50021
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1764
  measurable_ident_sets[measurable (raw)]
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1765
  measurable_const[measurable (raw)]
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1766
  measurable_If[measurable (raw)]
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1767
  measurable_comp[measurable (raw)]
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1768
  measurable_sets[measurable (raw)]
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1769
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1770
lemma predE[measurable (raw)]: 
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1771
  "pred M P \<Longrightarrow> {x\<in>space M. P x} \<in> sets M"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1772
  unfolding pred_def .
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1773
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1774
lemma pred_intros_imp'[measurable (raw)]:
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1775
  "(K \<Longrightarrow> pred M (\<lambda>x. P x)) \<Longrightarrow> pred M (\<lambda>x. K \<longrightarrow> P x)"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1776
  by (cases K) auto
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1777
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1778
lemma pred_intros_conj1'[measurable (raw)]:
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1779
  "(K \<Longrightarrow> pred M (\<lambda>x. P x)) \<Longrightarrow> pred M (\<lambda>x. K \<and> P x)"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1780
  by (cases K) auto
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1781
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1782
lemma pred_intros_conj2'[measurable (raw)]:
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1783
  "(K \<Longrightarrow> pred M (\<lambda>x. P x)) \<Longrightarrow> pred M (\<lambda>x. P x \<and> K)"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1784
  by (cases K) auto
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1785
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1786
lemma pred_intros_disj1'[measurable (raw)]:
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1787
  "(\<not> K \<Longrightarrow> pred M (\<lambda>x. P x)) \<Longrightarrow> pred M (\<lambda>x. K \<or> P x)"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1788
  by (cases K) auto
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1789
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1790
lemma pred_intros_disj2'[measurable (raw)]:
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1791
  "(\<not> K \<Longrightarrow> pred M (\<lambda>x. P x)) \<Longrightarrow> pred M (\<lambda>x. P x \<or> K)"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1792
  by (cases K) auto
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1793
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1794
lemma pred_intros_logic[measurable (raw)]:
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1795
  "pred M (\<lambda>x. x \<in> space M)"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1796
  "pred M (\<lambda>x. P x) \<Longrightarrow> pred M (\<lambda>x. \<not> P x)"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1797
  "pred M (\<lambda>x. Q x) \<Longrightarrow> pred M (\<lambda>x. P x) \<Longrightarrow> pred M (\<lambda>x. Q x \<and> P x)"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1798
  "pred M (\<lambda>x. Q x) \<Longrightarrow> pred M (\<lambda>x. P x) \<Longrightarrow> pred M (\<lambda>x. Q x \<longrightarrow> P x)"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1799
  "pred M (\<lambda>x. Q x) \<Longrightarrow> pred M (\<lambda>x. P x) \<Longrightarrow> pred M (\<lambda>x. Q x \<or> P x)"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1800
  "pred M (\<lambda>x. Q x) \<Longrightarrow> pred M (\<lambda>x. P x) \<Longrightarrow> pred M (\<lambda>x. Q x = P x)"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1801
  "pred M (\<lambda>x. f x \<in> UNIV)"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1802
  "pred M (\<lambda>x. f x \<in> {})"
50096
7c9c5b1b6cd7 more measurability rules
hoelzl
parents: 50021
diff changeset
  1803
  "pred M (\<lambda>x. P' (f x) x) \<Longrightarrow> pred M (\<lambda>x. f x \<in> {y. P' y x})"
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1804
  "pred M (\<lambda>x. f x \<in> (B x)) \<Longrightarrow> pred M (\<lambda>x. f x \<in> - (B x))"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1805
  "pred M (\<lambda>x. f x \<in> (A x)) \<Longrightarrow> pred M (\<lambda>x. f x \<in> (B x)) \<Longrightarrow> pred M (\<lambda>x. f x \<in> (A x) - (B x))"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1806
  "pred M (\<lambda>x. f x \<in> (A x)) \<Longrightarrow> pred M (\<lambda>x. f x \<in> (B x)) \<Longrightarrow> pred M (\<lambda>x. f x \<in> (A x) \<inter> (B x))"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1807
  "pred M (\<lambda>x. f x \<in> (A x)) \<Longrightarrow> pred M (\<lambda>x. f x \<in> (B x)) \<Longrightarrow> pred M (\<lambda>x. f x \<in> (A x) \<union> (B x))"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1808
  "pred M (\<lambda>x. g x (f x) \<in> (X x)) \<Longrightarrow> pred M (\<lambda>x. f x \<in> (g x) -` (X x))"
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1809
  by (auto simp: iff_conv_conj_imp pred_def)
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1810
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1811
lemma pred_intros_countable[measurable (raw)]:
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1812
  fixes P :: "'a \<Rightarrow> 'i :: countable \<Rightarrow> bool"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1813
  shows 
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1814
    "(\<And>i. pred M (\<lambda>x. P x i)) \<Longrightarrow> pred M (\<lambda>x. \<forall>i. P x i)"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1815
    "(\<And>i. pred M (\<lambda>x. P x i)) \<Longrightarrow> pred M (\<lambda>x. \<exists>i. P x i)"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50096
diff changeset
  1816
  by (auto intro!: sets.sets_Collect_countable_All sets.sets_Collect_countable_Ex simp: pred_def)
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1817
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1818
lemma pred_intros_countable_bounded[measurable (raw)]:
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1819
  fixes X :: "'i :: countable set"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1820
  shows 
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1821
    "(\<And>i. i \<in> X \<Longrightarrow> pred M (\<lambda>x. x \<in> N x i)) \<Longrightarrow> pred M (\<lambda>x. x \<in> (\<Inter>i\<in>X. N x i))"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1822
    "(\<And>i. i \<in> X \<Longrightarrow> pred M (\<lambda>x. x \<in> N x i)) \<Longrightarrow> pred M (\<lambda>x. x \<in> (\<Union>i\<in>X. N x i))"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1823
    "(\<And>i. i \<in> X \<Longrightarrow> pred M (\<lambda>x. P x i)) \<Longrightarrow> pred M (\<lambda>x. \<forall>i\<in>X. P x i)"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1824
    "(\<And>i. i \<in> X \<Longrightarrow> pred M (\<lambda>x. P x i)) \<Longrightarrow> pred M (\<lambda>x. \<exists>i\<in>X. P x i)"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1825
  by (auto simp: Bex_def Ball_def)
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1826
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1827
lemma pred_intros_finite[measurable (raw)]:
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1828
  "finite I \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> pred M (\<lambda>x. x \<in> N x i)) \<Longrightarrow> pred M (\<lambda>x. x \<in> (\<Inter>i\<in>I. N x i))"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1829
  "finite I \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> pred M (\<lambda>x. x \<in> N x i)) \<Longrightarrow> pred M (\<lambda>x. x \<in> (\<Union>i\<in>I. N x i))"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1830
  "finite I \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> pred M (\<lambda>x. P x i)) \<Longrightarrow> pred M (\<lambda>x. \<forall>i\<in>I. P x i)"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1831
  "finite I \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> pred M (\<lambda>x. P x i)) \<Longrightarrow> pred M (\<lambda>x. \<exists>i\<in>I. P x i)"
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50096
diff changeset
  1832
  by (auto intro!: sets.sets_Collect_finite_Ex sets.sets_Collect_finite_All simp: iff_conv_conj_imp pred_def)
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1833
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1834
lemma countable_Un_Int[measurable (raw)]:
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1835
  "(\<And>i :: 'i :: countable. i \<in> I \<Longrightarrow> N i \<in> sets M) \<Longrightarrow> (\<Union>i\<in>I. N i) \<in> sets M"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1836
  "I \<noteq> {} \<Longrightarrow> (\<And>i :: 'i :: countable. i \<in> I \<Longrightarrow> N i \<in> sets M) \<Longrightarrow> (\<Inter>i\<in>I. N i) \<in> sets M"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1837
  by auto
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1838
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1839
declare
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1840
  finite_UN[measurable (raw)]
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1841
  finite_INT[measurable (raw)]
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1842
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1843
lemma sets_Int_pred[measurable (raw)]:
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1844
  assumes space: "A \<inter> B \<subseteq> space M" and [measurable]: "pred M (\<lambda>x. x \<in> A)" "pred M (\<lambda>x. x \<in> B)"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1845
  shows "A \<inter> B \<in> sets M"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1846
proof -
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1847
  have "{x\<in>space M. x \<in> A \<inter> B} \<in> sets M" by auto
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1848
  also have "{x\<in>space M. x \<in> A \<inter> B} = A \<inter> B"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1849
    using space by auto
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1850
  finally show ?thesis .
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1851
qed
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1852
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1853
lemma [measurable (raw generic)]:
50096
7c9c5b1b6cd7 more measurability rules
hoelzl
parents: 50021
diff changeset
  1854
  assumes f: "f \<in> measurable M N" and c: "c \<in> space N \<Longrightarrow> {c} \<in> sets N"
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1855
  shows pred_eq_const1: "pred M (\<lambda>x. f x = c)"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1856
    and pred_eq_const2: "pred M (\<lambda>x. c = f x)"
50096
7c9c5b1b6cd7 more measurability rules
hoelzl
parents: 50021
diff changeset
  1857
proof -
7c9c5b1b6cd7 more measurability rules
hoelzl
parents: 50021
diff changeset
  1858
  show "pred M (\<lambda>x. f x = c)"
7c9c5b1b6cd7 more measurability rules
hoelzl
parents: 50021
diff changeset
  1859
  proof cases
7c9c5b1b6cd7 more measurability rules
hoelzl
parents: 50021
diff changeset
  1860
    assume "c \<in> space N"
7c9c5b1b6cd7 more measurability rules
hoelzl
parents: 50021
diff changeset
  1861
    with measurable_sets[OF f c] show ?thesis
7c9c5b1b6cd7 more measurability rules
hoelzl
parents: 50021
diff changeset
  1862
      by (auto simp: Int_def conj_commute pred_def)
7c9c5b1b6cd7 more measurability rules
hoelzl
parents: 50021
diff changeset
  1863
  next
7c9c5b1b6cd7 more measurability rules
hoelzl
parents: 50021
diff changeset
  1864
    assume "c \<notin> space N"
7c9c5b1b6cd7 more measurability rules
hoelzl
parents: 50021
diff changeset
  1865
    with f[THEN measurable_space] have "{x \<in> space M. f x = c} = {}" by auto
7c9c5b1b6cd7 more measurability rules
hoelzl
parents: 50021
diff changeset
  1866
    then show ?thesis by (auto simp: pred_def cong: conj_cong)
7c9c5b1b6cd7 more measurability rules
hoelzl
parents: 50021
diff changeset
  1867
  qed
7c9c5b1b6cd7 more measurability rules
hoelzl
parents: 50021
diff changeset
  1868
  then show "pred M (\<lambda>x. c = f x)"
7c9c5b1b6cd7 more measurability rules
hoelzl
parents: 50021
diff changeset
  1869
    by (simp add: eq_commute)
7c9c5b1b6cd7 more measurability rules
hoelzl
parents: 50021
diff changeset
  1870
qed
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1871
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1872
lemma pred_le_const[measurable (raw generic)]:
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1873
  assumes f: "f \<in> measurable M N" and c: "{.. c} \<in> sets N" shows "pred M (\<lambda>x. f x \<le> c)"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1874
  using measurable_sets[OF f c]
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1875
  by (auto simp: Int_def conj_commute eq_commute pred_def)
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1876
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1877
lemma pred_const_le[measurable (raw generic)]:
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1878
  assumes f: "f \<in> measurable M N" and c: "{c ..} \<in> sets N" shows "pred M (\<lambda>x. c \<le> f x)"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1879
  using measurable_sets[OF f c]
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1880
  by (auto simp: Int_def conj_commute eq_commute pred_def)
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1881
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1882
lemma pred_less_const[measurable (raw generic)]:
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1883
  assumes f: "f \<in> measurable M N" and c: "{..< c} \<in> sets N" shows "pred M (\<lambda>x. f x < c)"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1884
  using measurable_sets[OF f c]
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1885
  by (auto simp: Int_def conj_commute eq_commute pred_def)
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1886
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1887
lemma pred_const_less[measurable (raw generic)]:
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1888
  assumes f: "f \<in> measurable M N" and c: "{c <..} \<in> sets N" shows "pred M (\<lambda>x. c < f x)"
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1889
  using measurable_sets[OF f c]
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1890
  by (auto simp: Int_def conj_commute eq_commute pred_def)
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1891
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1892
declare
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50096
diff changeset
  1893
  sets.Int[measurable (raw)]
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1894
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1895
lemma pred_in_If[measurable (raw)]:
50021
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1896
  "(P \<Longrightarrow> pred M (\<lambda>x. x \<in> A x)) \<Longrightarrow> (\<not> P \<Longrightarrow> pred M (\<lambda>x. x \<in> B x)) \<Longrightarrow>
d96a3f468203 add support for function application to measurability prover
hoelzl
parents: 50003
diff changeset
  1897
    pred M (\<lambda>x. x \<in> (if P then A x else B x))"
50003
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1898
  by auto
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1899
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1900
lemma sets_range[measurable_dest]:
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1901
  "A ` I \<subseteq> sets M \<Longrightarrow> i \<in> I \<Longrightarrow> A i \<in> sets M"
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1902
  by auto
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1903
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1904
lemma pred_sets_range[measurable_dest]:
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1905
  "A ` I \<subseteq> sets N \<Longrightarrow> i \<in> I \<Longrightarrow> f \<in> measurable M N \<Longrightarrow> pred M (\<lambda>x. f x \<in> A i)"
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1906
  using pred_sets2[OF sets_range] by auto
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1907
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1908
lemma sets_All[measurable_dest]:
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1909
  "\<forall>i. A i \<in> sets (M i) \<Longrightarrow> A i \<in> sets (M i)"
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1910
  by auto
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1911
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1912
lemma pred_sets_All[measurable_dest]:
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1913
  "\<forall>i. A i \<in> sets (N i) \<Longrightarrow> f \<in> measurable M (N i) \<Longrightarrow> pred M (\<lambda>x. f x \<in> A i)"
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1914
  using pred_sets2[OF sets_All, of A N f] by auto
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1915
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1916
lemma sets_Ball[measurable_dest]:
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1917
  "\<forall>i\<in>I. A i \<in> sets (M i) \<Longrightarrow> i\<in>I \<Longrightarrow> A i \<in> sets (M i)"
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1918
  by auto
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1919
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1920
lemma pred_sets_Ball[measurable_dest]:
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1921
  "\<forall>i\<in>I. A i \<in> sets (N i) \<Longrightarrow> i\<in>I \<Longrightarrow> f \<in> measurable M (N i) \<Longrightarrow> pred M (\<lambda>x. f x \<in> A i)"
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1922
  using pred_sets2[OF sets_Ball, of _ _ _ f] by auto
8c213922ed49 use measurability prover
hoelzl
parents: 50002
diff changeset
  1923
50096
7c9c5b1b6cd7 more measurability rules
hoelzl
parents: 50021
diff changeset
  1924
lemma measurable_finite[measurable (raw)]:
7c9c5b1b6cd7 more measurability rules
hoelzl
parents: 50021
diff changeset
  1925
  fixes S :: "'a \<Rightarrow> nat set"
7c9c5b1b6cd7 more measurability rules
hoelzl
parents: 50021
diff changeset
  1926
  assumes [measurable]: "\<And>i. {x\<in>space M. i \<in> S x} \<in> sets M"
7c9c5b1b6cd7 more measurability rules
hoelzl
parents: 50021
diff changeset
  1927
  shows "pred M (\<lambda>x. finite (S x))"
7c9c5b1b6cd7 more measurability rules
hoelzl
parents: 50021
diff changeset
  1928
  unfolding finite_nat_set_iff_bounded by (simp add: Ball_def)
7c9c5b1b6cd7 more measurability rules
hoelzl
parents: 50021
diff changeset
  1929
7c9c5b1b6cd7 more measurability rules
hoelzl
parents: 50021
diff changeset
  1930
lemma measurable_Least[measurable]:
7c9c5b1b6cd7 more measurability rules
hoelzl
parents: 50021
diff changeset
  1931
  assumes [measurable]: "(\<And>i::nat. (\<lambda>x. P i x) \<in> measurable M (count_space UNIV))"q
7c9c5b1b6cd7 more measurability rules
hoelzl
parents: 50021
diff changeset
  1932
  shows "(\<lambda>x. LEAST i. P i x) \<in> measurable M (count_space UNIV)"
7c9c5b1b6cd7 more measurability rules
hoelzl
parents: 50021
diff changeset
  1933
  unfolding measurable_def by (safe intro!: sets_Least) simp_all
7c9c5b1b6cd7 more measurability rules
hoelzl
parents: 50021
diff changeset
  1934
7c9c5b1b6cd7 more measurability rules
hoelzl
parents: 50021
diff changeset
  1935
lemma measurable_count_space_insert[measurable (raw)]:
7c9c5b1b6cd7 more measurability rules
hoelzl
parents: 50021
diff changeset
  1936
  "s \<in> S \<Longrightarrow> A \<in> sets (count_space S) \<Longrightarrow> insert s A \<in> sets (count_space S)"
7c9c5b1b6cd7 more measurability rules
hoelzl
parents: 50021
diff changeset
  1937
  by simp
7c9c5b1b6cd7 more measurability rules
hoelzl
parents: 50021
diff changeset
  1938
50002
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1939
hide_const (open) pred
ce0d316b5b44 add measurability prover; add support for Borel sets
hoelzl
parents: 49834
diff changeset
  1940
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1941
subsection {* Extend measure *}
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1942
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1943
definition "extend_measure \<Omega> I G \<mu> =
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1944
  (if (\<exists>\<mu>'. (\<forall>i\<in>I. \<mu>' (G i) = \<mu> i) \<and> measure_space \<Omega> (sigma_sets \<Omega> (G`I)) \<mu>') \<and> \<not> (\<forall>i\<in>I. \<mu> i = 0)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1945
      then measure_of \<Omega> (G`I) (SOME \<mu>'. (\<forall>i\<in>I. \<mu>' (G i) = \<mu> i) \<and> measure_space \<Omega> (sigma_sets \<Omega> (G`I)) \<mu>')
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1946
      else measure_of \<Omega> (G`I) (\<lambda>_. 0))"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1947
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1948
lemma space_extend_measure: "G ` I \<subseteq> Pow \<Omega> \<Longrightarrow> space (extend_measure \<Omega> I G \<mu>) = \<Omega>"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1949
  unfolding extend_measure_def by simp
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1950
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1951
lemma sets_extend_measure: "G ` I \<subseteq> Pow \<Omega> \<Longrightarrow> sets (extend_measure \<Omega> I G \<mu>) = sigma_sets \<Omega> (G`I)"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1952
  unfolding extend_measure_def by simp
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1953
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1954
lemma emeasure_extend_measure:
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1955
  assumes M: "M = extend_measure \<Omega> I G \<mu>"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1956
    and eq: "\<And>i. i \<in> I \<Longrightarrow> \<mu>' (G i) = \<mu> i"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1957
    and ms: "G ` I \<subseteq> Pow \<Omega>" "positive (sets M) \<mu>'" "countably_additive (sets M) \<mu>'"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1958
    and "i \<in> I"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1959
  shows "emeasure M (G i) = \<mu> i"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1960
proof cases
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1961
  assume *: "(\<forall>i\<in>I. \<mu> i = 0)"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1962
  with M have M_eq: "M = measure_of \<Omega> (G`I) (\<lambda>_. 0)"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1963
   by (simp add: extend_measure_def)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1964
  from measure_space_0[OF ms(1)] ms `i\<in>I`
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1965
  have "emeasure M (G i) = 0"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1966
    by (intro emeasure_measure_of[OF M_eq]) (auto simp add: M measure_space_def sets_extend_measure)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1967
  with `i\<in>I` * show ?thesis
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1968
    by simp
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1969
next
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1970
  def P \<equiv> "\<lambda>\<mu>'. (\<forall>i\<in>I. \<mu>' (G i) = \<mu> i) \<and> measure_space \<Omega> (sigma_sets \<Omega> (G`I)) \<mu>'"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1971
  assume "\<not> (\<forall>i\<in>I. \<mu> i = 0)"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1972
  moreover
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1973
  have "measure_space (space M) (sets M) \<mu>'"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1974
    using ms unfolding measure_space_def by auto default
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1975
  with ms eq have "\<exists>\<mu>'. P \<mu>'"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1976
    unfolding P_def
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1977
    by (intro exI[of _ \<mu>']) (auto simp add: M space_extend_measure sets_extend_measure)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1978
  ultimately have M_eq: "M = measure_of \<Omega> (G`I) (Eps P)"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1979
    by (simp add: M extend_measure_def P_def[symmetric])
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1980
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1981
  from `\<exists>\<mu>'. P \<mu>'` have P: "P (Eps P)" by (rule someI_ex)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1982
  show "emeasure M (G i) = \<mu> i"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1983
  proof (subst emeasure_measure_of[OF M_eq])
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1984
    have sets_M: "sets M = sigma_sets \<Omega> (G`I)"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1985
      using M_eq ms by (auto simp: sets_extend_measure)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1986
    then show "G i \<in> sets M" using `i \<in> I` by auto
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1987
    show "positive (sets M) (Eps P)" "countably_additive (sets M) (Eps P)" "Eps P (G i) = \<mu> i"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1988
      using P `i\<in>I` by (auto simp add: sets_M measure_space_def P_def)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1989
  qed fact
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1990
qed
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1991
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1992
lemma emeasure_extend_measure_Pair:
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1993
  assumes M: "M = extend_measure \<Omega> {(i, j). I i j} (\<lambda>(i, j). G i j) (\<lambda>(i, j). \<mu> i j)"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1994
    and eq: "\<And>i j. I i j \<Longrightarrow> \<mu>' (G i j) = \<mu> i j"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1995
    and ms: "\<And>i j. I i j \<Longrightarrow> G i j \<in> Pow \<Omega>" "positive (sets M) \<mu>'" "countably_additive (sets M) \<mu>'"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1996
    and "I i j"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1997
  shows "emeasure M (G i j) = \<mu> i j"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1998
  using emeasure_extend_measure[OF M _ _ ms(2,3), of "(i,j)"] eq ms(1) `I i j`
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  1999
  by (auto simp: subset_eq)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2000
39090
a2d38b8b693e Introduced sigma algebra generated by function preimages.
hoelzl
parents: 38656
diff changeset
  2001
subsection {* Sigma algebra generated by function preimages *}
a2d38b8b693e Introduced sigma algebra generated by function preimages.
hoelzl
parents: 38656
diff changeset
  2002
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2003
definition
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2004
  "vimage_algebra M S f = sigma S ((\<lambda>A. f -` A \<inter> S) ` sets M)"
39090
a2d38b8b693e Introduced sigma algebra generated by function preimages.
hoelzl
parents: 38656
diff changeset
  2005
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2006
lemma sigma_algebra_preimages:
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2007
  fixes f :: "'x \<Rightarrow> 'a"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2008
  assumes "f \<in> S \<rightarrow> space M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2009
  shows "sigma_algebra S ((\<lambda>A. f -` A \<inter> S) ` sets M)"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2010
    (is "sigma_algebra _ (?F ` sets M)")
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2011
proof (simp add: sigma_algebra_iff2, safe)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2012
  show "{} \<in> ?F ` sets M" by blast
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2013
next
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2014
  fix A assume "A \<in> sets M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2015
  moreover have "S - ?F A = ?F (space M - A)"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2016
    using assms by auto
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2017
  ultimately show "S - ?F A \<in> ?F ` sets M"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2018
    by blast
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2019
next
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2020
  fix A :: "nat \<Rightarrow> 'x set" assume *: "range A \<subseteq> ?F ` M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2021
  have "\<forall>i. \<exists>b. b \<in> M \<and> A i = ?F b"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2022
  proof safe
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2023
    fix i
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2024
    have "A i \<in> ?F ` M" using * by auto
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2025
    then show "\<exists>b. b \<in> M \<and> A i = ?F b" by auto
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2026
  qed
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2027
  from choice[OF this] obtain b where b: "range b \<subseteq> M" "\<And>i. A i = ?F (b i)"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2028
    by auto
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2029
  then have "(\<Union>i. A i) = ?F (\<Union>i. b i)" by auto
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2030
  then show "(\<Union>i. A i) \<in> ?F ` M" using b(1) by blast
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2031
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2032
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2033
lemma sets_vimage_algebra[simp]:
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2034
  "f \<in> S \<rightarrow> space M \<Longrightarrow> sets (vimage_algebra M S f) = (\<lambda>A. f -` A \<inter> S) ` sets M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2035
  using sigma_algebra.sets_measure_of_eq[OF sigma_algebra_preimages, of f S M]
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2036
  by (simp add: vimage_algebra_def)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2037
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2038
lemma space_vimage_algebra[simp]:
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2039
  "f \<in> S \<rightarrow> space M \<Longrightarrow> space (vimage_algebra M S f) = S"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2040
  using sigma_algebra.space_measure_of_eq[OF sigma_algebra_preimages, of f S M]
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2041
  by (simp add: vimage_algebra_def)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2042
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2043
lemma in_vimage_algebra[simp]:
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2044
  "f \<in> S \<rightarrow> space M \<Longrightarrow> A \<in> sets (vimage_algebra M S f) \<longleftrightarrow> (\<exists>B\<in>sets M. A = f -` B \<inter> S)"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2045
  by (simp add: image_iff)
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2046
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2047
lemma measurable_vimage_algebra:
39090
a2d38b8b693e Introduced sigma algebra generated by function preimages.
hoelzl
parents: 38656
diff changeset
  2048
  fixes S :: "'c set" assumes "f \<in> S \<rightarrow> space M"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2049
  shows "f \<in> measurable (vimage_algebra M S f) M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2050
  unfolding measurable_def using assms by force
39090
a2d38b8b693e Introduced sigma algebra generated by function preimages.
hoelzl
parents: 38656
diff changeset
  2051
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2052
lemma measurable_vimage:
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2053
  fixes g :: "'a \<Rightarrow> 'c" and f :: "'d \<Rightarrow> 'a"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2054
  assumes "g \<in> measurable M M2" "f \<in> S \<rightarrow> space M"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2055
  shows "(\<lambda>x. g (f x)) \<in> measurable (vimage_algebra M S f) M2"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2056
proof -
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2057
  note measurable_vimage_algebra[OF assms(2)]
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2058
  from measurable_comp[OF this assms(1)]
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2059
  show ?thesis by (simp add: comp_def)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2060
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2061
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2062
lemma sigma_sets_vimage:
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2063
  assumes "f \<in> S' \<rightarrow> S" and "A \<subseteq> Pow S"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2064
  shows "sigma_sets S' ((\<lambda>X. f -` X \<inter> S') ` A) = (\<lambda>X. f -` X \<inter> S') ` sigma_sets S A"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2065
proof (intro set_eqI iffI)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2066
  let ?F = "\<lambda>X. f -` X \<inter> S'"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2067
  fix X assume "X \<in> sigma_sets S' (?F ` A)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2068
  then show "X \<in> ?F ` sigma_sets S A"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2069
  proof induct
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2070
    case (Basic X) then obtain X' where "X = ?F X'" "X' \<in> A"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2071
      by auto
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2072
    then show ?case by auto
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2073
  next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2074
    case Empty then show ?case
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2075
      by (auto intro!: image_eqI[of _ _ "{}"] sigma_sets.Empty)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2076
  next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2077
    case (Compl X) then obtain X' where X: "X = ?F X'" and "X' \<in> sigma_sets S A"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2078
      by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2079
    then have "S - X' \<in> sigma_sets S A"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2080
      by (auto intro!: sigma_sets.Compl)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2081
    then show ?case
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2082
      using X assms by (auto intro!: image_eqI[where x="S - X'"])
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2083
  next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2084
    case (Union F)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2085
    then have "\<forall>i. \<exists>F'.  F' \<in> sigma_sets S A \<and> F i = f -` F' \<inter> S'"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2086
      by (auto simp: image_iff Bex_def)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2087
    from choice[OF this] obtain F' where
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2088
      "\<And>i. F' i \<in> sigma_sets S A" and "\<And>i. F i = f -` F' i \<inter> S'"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2089
      by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2090
    then show ?case
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2091
      by (auto intro!: sigma_sets.Union image_eqI[where x="\<Union>i. F' i"])
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2092
  qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2093
next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2094
  let ?F = "\<lambda>X. f -` X \<inter> S'"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2095
  fix X assume "X \<in> ?F ` sigma_sets S A"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2096
  then obtain X' where "X' \<in> sigma_sets S A" "X = ?F X'" by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2097
  then show "X \<in> sigma_sets S' (?F ` A)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2098
  proof (induct arbitrary: X)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2099
    case Empty then show ?case by (auto intro: sigma_sets.Empty)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2100
  next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2101
    case (Compl X')
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2102
    have "S' - (S' - X) \<in> sigma_sets S' (?F ` A)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2103
      apply (rule sigma_sets.Compl)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2104
      using assms by (auto intro!: Compl.hyps simp: Compl.prems)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2105
    also have "S' - (S' - X) = X"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2106
      using assms Compl by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2107
    finally show ?case .
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2108
  next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2109
    case (Union F)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2110
    have "(\<Union>i. f -` F i \<inter> S') \<in> sigma_sets S' (?F ` A)"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2111
      by (intro sigma_sets.Union Union.hyps) simp
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2112
    also have "(\<Union>i. f -` F i \<inter> S') = X"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2113
      using assms Union by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2114
    finally show ?case .
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2115
  qed auto
39092
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39090
diff changeset
  2116
qed
98de40859858 move lemmas to correct theory files
hoelzl
parents: 39090
diff changeset
  2117
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2118
subsection {* A Two-Element Series *}
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2119
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2120
definition binaryset :: "'a set \<Rightarrow> 'a set \<Rightarrow> nat \<Rightarrow> 'a set "
50252
4aa34bd43228 eliminated slightly odd identifiers;
wenzelm
parents: 50245
diff changeset
  2121
  where "binaryset A B = (\<lambda>x. {})(0 := A, Suc 0 := B)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2122
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2123
lemma range_binaryset_eq: "range(binaryset A B) = {A,B,{}}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2124
  apply (simp add: binaryset_def)
39302
d7728f65b353 renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents: 39092
diff changeset
  2125
  apply (rule set_eqI)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2126
  apply (auto simp add: image_iff)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2127
  done
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2128
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2129
lemma UN_binaryset_eq: "(\<Union>i. binaryset A B i) = A \<union> B"
44106
0e018cbcc0de tuned proofs
haftmann
parents: 42988
diff changeset
  2130
  by (simp add: SUP_def range_binaryset_eq)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2131
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2132
section {* Closed CDI *}
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2133
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2134
definition closed_cdi where
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2135
  "closed_cdi \<Omega> M \<longleftrightarrow>
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2136
   M \<subseteq> Pow \<Omega> &
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2137
   (\<forall>s \<in> M. \<Omega> - s \<in> M) &
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2138
   (\<forall>A. (range A \<subseteq> M) & (A 0 = {}) & (\<forall>n. A n \<subseteq> A (Suc n)) \<longrightarrow>
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2139
        (\<Union>i. A i) \<in> M) &
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2140
   (\<forall>A. (range A \<subseteq> M) & disjoint_family A \<longrightarrow> (\<Union>i::nat. A i) \<in> M)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2141
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2142
inductive_set
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2143
  smallest_ccdi_sets :: "'a set \<Rightarrow> 'a set set \<Rightarrow> 'a set set"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2144
  for \<Omega> M
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2145
  where
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2146
    Basic [intro]:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2147
      "a \<in> M \<Longrightarrow> a \<in> smallest_ccdi_sets \<Omega> M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2148
  | Compl [intro]:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2149
      "a \<in> smallest_ccdi_sets \<Omega> M \<Longrightarrow> \<Omega> - a \<in> smallest_ccdi_sets \<Omega> M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2150
  | Inc:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2151
      "range A \<in> Pow(smallest_ccdi_sets \<Omega> M) \<Longrightarrow> A 0 = {} \<Longrightarrow> (\<And>n. A n \<subseteq> A (Suc n))
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2152
       \<Longrightarrow> (\<Union>i. A i) \<in> smallest_ccdi_sets \<Omega> M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2153
  | Disj:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2154
      "range A \<in> Pow(smallest_ccdi_sets \<Omega> M) \<Longrightarrow> disjoint_family A
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2155
       \<Longrightarrow> (\<Union>i::nat. A i) \<in> smallest_ccdi_sets \<Omega> M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2156
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2157
lemma (in subset_class) smallest_closed_cdi1: "M \<subseteq> smallest_ccdi_sets \<Omega> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2158
  by auto
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2159
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2160
lemma (in subset_class) smallest_ccdi_sets: "smallest_ccdi_sets \<Omega> M \<subseteq> Pow \<Omega>"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2161
  apply (rule subsetI)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2162
  apply (erule smallest_ccdi_sets.induct)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2163
  apply (auto intro: range_subsetD dest: sets_into_space)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2164
  done
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2165
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2166
lemma (in subset_class) smallest_closed_cdi2: "closed_cdi \<Omega> (smallest_ccdi_sets \<Omega> M)"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2167
  apply (auto simp add: closed_cdi_def smallest_ccdi_sets)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2168
  apply (blast intro: smallest_ccdi_sets.Inc smallest_ccdi_sets.Disj) +
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2169
  done
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2170
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2171
lemma closed_cdi_subset: "closed_cdi \<Omega> M \<Longrightarrow> M \<subseteq> Pow \<Omega>"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2172
  by (simp add: closed_cdi_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2173
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2174
lemma closed_cdi_Compl: "closed_cdi \<Omega> M \<Longrightarrow> s \<in> M \<Longrightarrow> \<Omega> - s \<in> M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2175
  by (simp add: closed_cdi_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2176
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2177
lemma closed_cdi_Inc:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2178
  "closed_cdi \<Omega> M \<Longrightarrow> range A \<subseteq> M \<Longrightarrow> A 0 = {} \<Longrightarrow> (!!n. A n \<subseteq> A (Suc n)) \<Longrightarrow> (\<Union>i. A i) \<in> M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2179
  by (simp add: closed_cdi_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2180
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2181
lemma closed_cdi_Disj:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2182
  "closed_cdi \<Omega> M \<Longrightarrow> range A \<subseteq> M \<Longrightarrow> disjoint_family A \<Longrightarrow> (\<Union>i::nat. A i) \<in> M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2183
  by (simp add: closed_cdi_def)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2184
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2185
lemma closed_cdi_Un:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2186
  assumes cdi: "closed_cdi \<Omega> M" and empty: "{} \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2187
      and A: "A \<in> M" and B: "B \<in> M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2188
      and disj: "A \<inter> B = {}"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2189
    shows "A \<union> B \<in> M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2190
proof -
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2191
  have ra: "range (binaryset A B) \<subseteq> M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2192
   by (simp add: range_binaryset_eq empty A B)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2193
 have di:  "disjoint_family (binaryset A B)" using disj
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2194
   by (simp add: disjoint_family_on_def binaryset_def Int_commute)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2195
 from closed_cdi_Disj [OF cdi ra di]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2196
 show ?thesis
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2197
   by (simp add: UN_binaryset_eq)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2198
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2199
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2200
lemma (in algebra) smallest_ccdi_sets_Un:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2201
  assumes A: "A \<in> smallest_ccdi_sets \<Omega> M" and B: "B \<in> smallest_ccdi_sets \<Omega> M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2202
      and disj: "A \<inter> B = {}"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2203
    shows "A \<union> B \<in> smallest_ccdi_sets \<Omega> M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2204
proof -
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2205
  have ra: "range (binaryset A B) \<in> Pow (smallest_ccdi_sets \<Omega> M)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2206
    by (simp add: range_binaryset_eq  A B smallest_ccdi_sets.Basic)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2207
  have di:  "disjoint_family (binaryset A B)" using disj
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2208
    by (simp add: disjoint_family_on_def binaryset_def Int_commute)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2209
  from Disj [OF ra di]
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2210
  show ?thesis
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2211
    by (simp add: UN_binaryset_eq)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2212
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2213
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2214
lemma (in algebra) smallest_ccdi_sets_Int1:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2215
  assumes a: "a \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2216
  shows "b \<in> smallest_ccdi_sets \<Omega> M \<Longrightarrow> a \<inter> b \<in> smallest_ccdi_sets \<Omega> M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2217
proof (induct rule: smallest_ccdi_sets.induct)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2218
  case (Basic x)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2219
  thus ?case
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2220
    by (metis a Int smallest_ccdi_sets.Basic)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2221
next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2222
  case (Compl x)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2223
  have "a \<inter> (\<Omega> - x) = \<Omega> - ((\<Omega> - a) \<union> (a \<inter> x))"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2224
    by blast
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2225
  also have "... \<in> smallest_ccdi_sets \<Omega> M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2226
    by (metis smallest_ccdi_sets.Compl a Compl(2) Diff_Int2 Diff_Int_distrib2
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2227
           Diff_disjoint Int_Diff Int_empty_right smallest_ccdi_sets_Un
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2228
           smallest_ccdi_sets.Basic smallest_ccdi_sets.Compl)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2229
  finally show ?case .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2230
next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2231
  case (Inc A)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2232
  have 1: "(\<Union>i. (\<lambda>i. a \<inter> A i) i) = a \<inter> (\<Union>i. A i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2233
    by blast
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2234
  have "range (\<lambda>i. a \<inter> A i) \<in> Pow(smallest_ccdi_sets \<Omega> M)" using Inc
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2235
    by blast
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2236
  moreover have "(\<lambda>i. a \<inter> A i) 0 = {}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2237
    by (simp add: Inc)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2238
  moreover have "!!n. (\<lambda>i. a \<inter> A i) n \<subseteq> (\<lambda>i. a \<inter> A i) (Suc n)" using Inc
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2239
    by blast
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2240
  ultimately have 2: "(\<Union>i. (\<lambda>i. a \<inter> A i) i) \<in> smallest_ccdi_sets \<Omega> M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2241
    by (rule smallest_ccdi_sets.Inc)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2242
  show ?case
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2243
    by (metis 1 2)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2244
next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2245
  case (Disj A)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2246
  have 1: "(\<Union>i. (\<lambda>i. a \<inter> A i) i) = a \<inter> (\<Union>i. A i)"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2247
    by blast
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2248
  have "range (\<lambda>i. a \<inter> A i) \<in> Pow(smallest_ccdi_sets \<Omega> M)" using Disj
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2249
    by blast
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2250
  moreover have "disjoint_family (\<lambda>i. a \<inter> A i)" using Disj
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2251
    by (auto simp add: disjoint_family_on_def)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2252
  ultimately have 2: "(\<Union>i. (\<lambda>i. a \<inter> A i) i) \<in> smallest_ccdi_sets \<Omega> M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2253
    by (rule smallest_ccdi_sets.Disj)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2254
  show ?case
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2255
    by (metis 1 2)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2256
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2257
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2258
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2259
lemma (in algebra) smallest_ccdi_sets_Int:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2260
  assumes b: "b \<in> smallest_ccdi_sets \<Omega> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2261
  shows "a \<in> smallest_ccdi_sets \<Omega> M \<Longrightarrow> a \<inter> b \<in> smallest_ccdi_sets \<Omega> M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2262
proof (induct rule: smallest_ccdi_sets.induct)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2263
  case (Basic x)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2264
  thus ?case
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2265
    by (metis b smallest_ccdi_sets_Int1)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2266
next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2267
  case (Compl x)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2268
  have "(\<Omega> - x) \<inter> b = \<Omega> - (x \<inter> b \<union> (\<Omega> - b))"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2269
    by blast
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2270
  also have "... \<in> smallest_ccdi_sets \<Omega> M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2271
    by (metis Compl(2) Diff_disjoint Int_Diff Int_commute Int_empty_right b
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2272
           smallest_ccdi_sets.Compl smallest_ccdi_sets_Un)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2273
  finally show ?case .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2274
next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2275
  case (Inc A)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2276
  have 1: "(\<Union>i. (\<lambda>i. A i \<inter> b) i) = (\<Union>i. A i) \<inter> b"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2277
    by blast
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2278
  have "range (\<lambda>i. A i \<inter> b) \<in> Pow(smallest_ccdi_sets \<Omega> M)" using Inc
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2279
    by blast
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2280
  moreover have "(\<lambda>i. A i \<inter> b) 0 = {}"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2281
    by (simp add: Inc)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2282
  moreover have "!!n. (\<lambda>i. A i \<inter> b) n \<subseteq> (\<lambda>i. A i \<inter> b) (Suc n)" using Inc
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2283
    by blast
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2284
  ultimately have 2: "(\<Union>i. (\<lambda>i. A i \<inter> b) i) \<in> smallest_ccdi_sets \<Omega> M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2285
    by (rule smallest_ccdi_sets.Inc)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2286
  show ?case
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2287
    by (metis 1 2)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2288
next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2289
  case (Disj A)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2290
  have 1: "(\<Union>i. (\<lambda>i. A i \<inter> b) i) = (\<Union>i. A i) \<inter> b"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2291
    by blast
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2292
  have "range (\<lambda>i. A i \<inter> b) \<in> Pow(smallest_ccdi_sets \<Omega> M)" using Disj
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2293
    by blast
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2294
  moreover have "disjoint_family (\<lambda>i. A i \<inter> b)" using Disj
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2295
    by (auto simp add: disjoint_family_on_def)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2296
  ultimately have 2: "(\<Union>i. (\<lambda>i. A i \<inter> b) i) \<in> smallest_ccdi_sets \<Omega> M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2297
    by (rule smallest_ccdi_sets.Disj)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2298
  show ?case
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2299
    by (metis 1 2)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2300
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2301
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2302
lemma (in algebra) sigma_property_disjoint_lemma:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2303
  assumes sbC: "M \<subseteq> C"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2304
      and ccdi: "closed_cdi \<Omega> C"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2305
  shows "sigma_sets \<Omega> M \<subseteq> C"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2306
proof -
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2307
  have "smallest_ccdi_sets \<Omega> M \<in> {B . M \<subseteq> B \<and> sigma_algebra \<Omega> B}"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2308
    apply (auto simp add: sigma_algebra_disjoint_iff algebra_iff_Int
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2309
            smallest_ccdi_sets_Int)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2310
    apply (metis Union_Pow_eq Union_upper subsetD smallest_ccdi_sets)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2311
    apply (blast intro: smallest_ccdi_sets.Disj)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2312
    done
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2313
  hence "sigma_sets (\<Omega>) (M) \<subseteq> smallest_ccdi_sets \<Omega> M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2314
    by clarsimp
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2315
       (drule sigma_algebra.sigma_sets_subset [where a="M"], auto)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2316
  also have "...  \<subseteq> C"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2317
    proof
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2318
      fix x
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2319
      assume x: "x \<in> smallest_ccdi_sets \<Omega> M"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2320
      thus "x \<in> C"
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2321
        proof (induct rule: smallest_ccdi_sets.induct)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2322
          case (Basic x)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2323
          thus ?case
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2324
            by (metis Basic subsetD sbC)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2325
        next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2326
          case (Compl x)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2327
          thus ?case
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2328
            by (blast intro: closed_cdi_Compl [OF ccdi, simplified])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2329
        next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2330
          case (Inc A)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2331
          thus ?case
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2332
               by (auto intro: closed_cdi_Inc [OF ccdi, simplified])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2333
        next
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2334
          case (Disj A)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2335
          thus ?case
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2336
               by (auto intro: closed_cdi_Disj [OF ccdi, simplified])
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2337
        qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2338
    qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2339
  finally show ?thesis .
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2340
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2341
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2342
lemma (in algebra) sigma_property_disjoint:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2343
  assumes sbC: "M \<subseteq> C"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2344
      and compl: "!!s. s \<in> C \<inter> sigma_sets (\<Omega>) (M) \<Longrightarrow> \<Omega> - s \<in> C"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2345
      and inc: "!!A. range A \<subseteq> C \<inter> sigma_sets (\<Omega>) (M)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2346
                     \<Longrightarrow> A 0 = {} \<Longrightarrow> (!!n. A n \<subseteq> A (Suc n))
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2347
                     \<Longrightarrow> (\<Union>i. A i) \<in> C"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2348
      and disj: "!!A. range A \<subseteq> C \<inter> sigma_sets (\<Omega>) (M)
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2349
                      \<Longrightarrow> disjoint_family A \<Longrightarrow> (\<Union>i::nat. A i) \<in> C"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2350
  shows "sigma_sets (\<Omega>) (M) \<subseteq> C"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2351
proof -
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2352
  have "sigma_sets (\<Omega>) (M) \<subseteq> C \<inter> sigma_sets (\<Omega>) (M)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2353
    proof (rule sigma_property_disjoint_lemma)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2354
      show "M \<subseteq> C \<inter> sigma_sets (\<Omega>) (M)"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2355
        by (metis Int_greatest Set.subsetI sbC sigma_sets.Basic)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2356
    next
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2357
      show "closed_cdi \<Omega> (C \<inter> sigma_sets (\<Omega>) (M))"
38656
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2358
        by (simp add: closed_cdi_def compl inc disj)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2359
           (metis PowI Set.subsetI le_infI2 sigma_sets_into_sp space_closed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2360
             IntE sigma_sets.Compl range_subsetD sigma_sets.Union)
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2361
    qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2362
  thus ?thesis
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2363
    by blast
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2364
qed
d5d342611edb Rewrite the Probability theory.
hoelzl
parents: 37032
diff changeset
  2365
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2366
section {* Dynkin systems *}
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2367
42065
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
  2368
locale dynkin_system = subset_class +
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2369
  assumes space: "\<Omega> \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2370
    and   compl[intro!]: "\<And>A. A \<in> M \<Longrightarrow> \<Omega> - A \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2371
    and   UN[intro!]: "\<And>A. disjoint_family A \<Longrightarrow> range A \<subseteq> M
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2372
                           \<Longrightarrow> (\<Union>i::nat. A i) \<in> M"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2373
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2374
lemma (in dynkin_system) empty[intro, simp]: "{} \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2375
  using space compl[of "\<Omega>"] by simp
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2376
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2377
lemma (in dynkin_system) diff:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2378
  assumes sets: "D \<in> M" "E \<in> M" and "D \<subseteq> E"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2379
  shows "E - D \<in> M"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2380
proof -
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2381
  let ?f = "\<lambda>x. if x = 0 then D else if x = Suc 0 then \<Omega> - E else {}"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2382
  have "range ?f = {D, \<Omega> - E, {}}"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2383
    by (auto simp: image_iff)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2384
  moreover have "D \<union> (\<Omega> - E) = (\<Union>i. ?f i)"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2385
    by (auto simp: image_iff split: split_if_asm)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2386
  moreover
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2387
  then have "disjoint_family ?f" unfolding disjoint_family_on_def
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2388
    using `D \<in> M`[THEN sets_into_space] `D \<subseteq> E` by auto
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2389
  ultimately have "\<Omega> - (D \<union> (\<Omega> - E)) \<in> M"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2390
    using sets by auto
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2391
  also have "\<Omega> - (D \<union> (\<Omega> - E)) = E - D"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2392
    using assms sets_into_space by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2393
  finally show ?thesis .
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2394
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2395
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2396
lemma dynkin_systemI:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2397
  assumes "\<And> A. A \<in> M \<Longrightarrow> A \<subseteq> \<Omega>" "\<Omega> \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2398
  assumes "\<And> A. A \<in> M \<Longrightarrow> \<Omega> - A \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2399
  assumes "\<And> A. disjoint_family A \<Longrightarrow> range A \<subseteq> M
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2400
          \<Longrightarrow> (\<Union>i::nat. A i) \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2401
  shows "dynkin_system \<Omega> M"
42065
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
  2402
  using assms by (auto simp: dynkin_system_def dynkin_system_axioms_def subset_class_def)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2403
42988
d8f3fc934ff6 add lemma indep_distribution_eq_measure
hoelzl
parents: 42987
diff changeset
  2404
lemma dynkin_systemI':
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2405
  assumes 1: "\<And> A. A \<in> M \<Longrightarrow> A \<subseteq> \<Omega>"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2406
  assumes empty: "{} \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2407
  assumes Diff: "\<And> A. A \<in> M \<Longrightarrow> \<Omega> - A \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2408
  assumes 2: "\<And> A. disjoint_family A \<Longrightarrow> range A \<subseteq> M
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2409
          \<Longrightarrow> (\<Union>i::nat. A i) \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2410
  shows "dynkin_system \<Omega> M"
42988
d8f3fc934ff6 add lemma indep_distribution_eq_measure
hoelzl
parents: 42987
diff changeset
  2411
proof -
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2412
  from Diff[OF empty] have "\<Omega> \<in> M" by auto
42988
d8f3fc934ff6 add lemma indep_distribution_eq_measure
hoelzl
parents: 42987
diff changeset
  2413
  from 1 this Diff 2 show ?thesis
d8f3fc934ff6 add lemma indep_distribution_eq_measure
hoelzl
parents: 42987
diff changeset
  2414
    by (intro dynkin_systemI) auto
d8f3fc934ff6 add lemma indep_distribution_eq_measure
hoelzl
parents: 42987
diff changeset
  2415
qed
d8f3fc934ff6 add lemma indep_distribution_eq_measure
hoelzl
parents: 42987
diff changeset
  2416
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2417
lemma dynkin_system_trivial:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2418
  shows "dynkin_system A (Pow A)"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2419
  by (rule dynkin_systemI) auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2420
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2421
lemma sigma_algebra_imp_dynkin_system:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2422
  assumes "sigma_algebra \<Omega> M" shows "dynkin_system \<Omega> M"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2423
proof -
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2424
  interpret sigma_algebra \<Omega> M by fact
44890
22f665a2e91c new fastforce replacing fastsimp - less confusing name
nipkow
parents: 44537
diff changeset
  2425
  show ?thesis using sets_into_space by (fastforce intro!: dynkin_systemI)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2426
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2427
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2428
subsection "Intersection stable algebras"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2429
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2430
definition "Int_stable M \<longleftrightarrow> (\<forall> a \<in> M. \<forall> b \<in> M. a \<inter> b \<in> M)"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2431
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2432
lemma (in algebra) Int_stable: "Int_stable M"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2433
  unfolding Int_stable_def by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2434
42981
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42867
diff changeset
  2435
lemma Int_stableI:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2436
  "(\<And>a b. a \<in> A \<Longrightarrow> b \<in> A \<Longrightarrow> a \<inter> b \<in> A) \<Longrightarrow> Int_stable A"
42981
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42867
diff changeset
  2437
  unfolding Int_stable_def by auto
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42867
diff changeset
  2438
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42867
diff changeset
  2439
lemma Int_stableD:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2440
  "Int_stable M \<Longrightarrow> a \<in> M \<Longrightarrow> b \<in> M \<Longrightarrow> a \<inter> b \<in> M"
42981
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42867
diff changeset
  2441
  unfolding Int_stable_def by auto
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42867
diff changeset
  2442
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2443
lemma (in dynkin_system) sigma_algebra_eq_Int_stable:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2444
  "sigma_algebra \<Omega> M \<longleftrightarrow> Int_stable M"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2445
proof
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2446
  assume "sigma_algebra \<Omega> M" then show "Int_stable M"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2447
    unfolding sigma_algebra_def using algebra.Int_stable by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2448
next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2449
  assume "Int_stable M"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2450
  show "sigma_algebra \<Omega> M"
42065
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
  2451
    unfolding sigma_algebra_disjoint_iff algebra_iff_Un
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2452
  proof (intro conjI ballI allI impI)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2453
    show "M \<subseteq> Pow (\<Omega>)" using sets_into_space by auto
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2454
  next
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2455
    fix A B assume "A \<in> M" "B \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2456
    then have "A \<union> B = \<Omega> - ((\<Omega> - A) \<inter> (\<Omega> - B))"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2457
              "\<Omega> - A \<in> M" "\<Omega> - B \<in> M"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2458
      using sets_into_space by auto
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2459
    then show "A \<union> B \<in> M"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2460
      using `Int_stable M` unfolding Int_stable_def by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2461
  qed auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2462
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2463
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2464
subsection "Smallest Dynkin systems"
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2465
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41543
diff changeset
  2466
definition dynkin where
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2467
  "dynkin \<Omega> M =  (\<Inter>{D. dynkin_system \<Omega> D \<and> M \<subseteq> D})"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2468
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2469
lemma dynkin_system_dynkin:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2470
  assumes "M \<subseteq> Pow (\<Omega>)"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2471
  shows "dynkin_system \<Omega> (dynkin \<Omega> M)"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2472
proof (rule dynkin_systemI)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2473
  fix A assume "A \<in> dynkin \<Omega> M"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2474
  moreover
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2475
  { fix D assume "A \<in> D" and d: "dynkin_system \<Omega> D"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2476
    then have "A \<subseteq> \<Omega>" by (auto simp: dynkin_system_def subset_class_def) }
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2477
  moreover have "{D. dynkin_system \<Omega> D \<and> M \<subseteq> D} \<noteq> {}"
44890
22f665a2e91c new fastforce replacing fastsimp - less confusing name
nipkow
parents: 44537
diff changeset
  2478
    using assms dynkin_system_trivial by fastforce
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2479
  ultimately show "A \<subseteq> \<Omega>"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2480
    unfolding dynkin_def using assms
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2481
    by auto
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2482
next
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2483
  show "\<Omega> \<in> dynkin \<Omega> M"
44890
22f665a2e91c new fastforce replacing fastsimp - less confusing name
nipkow
parents: 44537
diff changeset
  2484
    unfolding dynkin_def using dynkin_system.space by fastforce
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2485
next
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2486
  fix A assume "A \<in> dynkin \<Omega> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2487
  then show "\<Omega> - A \<in> dynkin \<Omega> M"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2488
    unfolding dynkin_def using dynkin_system.compl by force
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2489
next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2490
  fix A :: "nat \<Rightarrow> 'a set"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2491
  assume A: "disjoint_family A" "range A \<subseteq> dynkin \<Omega> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2492
  show "(\<Union>i. A i) \<in> dynkin \<Omega> M" unfolding dynkin_def
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2493
  proof (simp, safe)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2494
    fix D assume "dynkin_system \<Omega> D" "M \<subseteq> D"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2495
    with A have "(\<Union>i. A i) \<in> D"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2496
      by (intro dynkin_system.UN) (auto simp: dynkin_def)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2497
    then show "(\<Union>i. A i) \<in> D" by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2498
  qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2499
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2500
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2501
lemma dynkin_Basic[intro]: "A \<in> M \<Longrightarrow> A \<in> dynkin \<Omega> M"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2502
  unfolding dynkin_def by auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2503
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2504
lemma (in dynkin_system) restricted_dynkin_system:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2505
  assumes "D \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2506
  shows "dynkin_system \<Omega> {Q. Q \<subseteq> \<Omega> \<and> Q \<inter> D \<in> M}"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2507
proof (rule dynkin_systemI, simp_all)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2508
  have "\<Omega> \<inter> D = D"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2509
    using `D \<in> M` sets_into_space by auto
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2510
  then show "\<Omega> \<inter> D \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2511
    using `D \<in> M` by auto
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2512
next
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2513
  fix A assume "A \<subseteq> \<Omega> \<and> A \<inter> D \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2514
  moreover have "(\<Omega> - A) \<inter> D = (\<Omega> - (A \<inter> D)) - (\<Omega> - D)"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2515
    by auto
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2516
  ultimately show "\<Omega> - A \<subseteq> \<Omega> \<and> (\<Omega> - A) \<inter> D \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2517
    using  `D \<in> M` by (auto intro: diff)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2518
next
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2519
  fix A :: "nat \<Rightarrow> 'a set"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2520
  assume "disjoint_family A" "range A \<subseteq> {Q. Q \<subseteq> \<Omega> \<and> Q \<inter> D \<in> M}"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2521
  then have "\<And>i. A i \<subseteq> \<Omega>" "disjoint_family (\<lambda>i. A i \<inter> D)"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2522
    "range (\<lambda>i. A i \<inter> D) \<subseteq> M" "(\<Union>x. A x) \<inter> D = (\<Union>x. A x \<inter> D)"
44890
22f665a2e91c new fastforce replacing fastsimp - less confusing name
nipkow
parents: 44537
diff changeset
  2523
    by ((fastforce simp: disjoint_family_on_def)+)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2524
  then show "(\<Union>x. A x) \<subseteq> \<Omega> \<and> (\<Union>x. A x) \<inter> D \<in> M"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2525
    by (auto simp del: UN_simps)
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2526
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2527
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2528
lemma (in dynkin_system) dynkin_subset:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2529
  assumes "N \<subseteq> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2530
  shows "dynkin \<Omega> N \<subseteq> M"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2531
proof -
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2532
  have "dynkin_system \<Omega> M" by default
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2533
  then have "dynkin_system \<Omega> M"
42065
2b98b4c2e2f1 add ring_of_sets and subset_class as basis for algebra
hoelzl
parents: 41983
diff changeset
  2534
    using assms unfolding dynkin_system_def dynkin_system_axioms_def subset_class_def by simp
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2535
  with `N \<subseteq> M` show ?thesis by (auto simp add: dynkin_def)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2536
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2537
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2538
lemma sigma_eq_dynkin:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2539
  assumes sets: "M \<subseteq> Pow \<Omega>"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2540
  assumes "Int_stable M"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2541
  shows "sigma_sets \<Omega> M = dynkin \<Omega> M"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2542
proof -
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2543
  have "dynkin \<Omega> M \<subseteq> sigma_sets (\<Omega>) (M)"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2544
    using sigma_algebra_imp_dynkin_system
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2545
    unfolding dynkin_def sigma_sets_least_sigma_algebra[OF sets] by auto
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2546
  moreover
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2547
  interpret dynkin_system \<Omega> "dynkin \<Omega> M"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2548
    using dynkin_system_dynkin[OF sets] .
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2549
  have "sigma_algebra \<Omega> (dynkin \<Omega> M)"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2550
    unfolding sigma_algebra_eq_Int_stable Int_stable_def
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2551
  proof (intro ballI)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2552
    fix A B assume "A \<in> dynkin \<Omega> M" "B \<in> dynkin \<Omega> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2553
    let ?D = "\<lambda>E. {Q. Q \<subseteq> \<Omega> \<and> Q \<inter> E \<in> dynkin \<Omega> M}"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2554
    have "M \<subseteq> ?D B"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2555
    proof
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2556
      fix E assume "E \<in> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2557
      then have "M \<subseteq> ?D E" "E \<in> dynkin \<Omega> M"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2558
        using sets_into_space `Int_stable M` by (auto simp: Int_stable_def)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2559
      then have "dynkin \<Omega> M \<subseteq> ?D E"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2560
        using restricted_dynkin_system `E \<in> dynkin \<Omega> M`
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2561
        by (intro dynkin_system.dynkin_subset) simp_all
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2562
      then have "B \<in> ?D E"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2563
        using `B \<in> dynkin \<Omega> M` by auto
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2564
      then have "E \<inter> B \<in> dynkin \<Omega> M"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2565
        by (subst Int_commute) simp
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2566
      then show "E \<in> ?D B"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2567
        using sets `E \<in> M` by auto
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2568
    qed
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2569
    then have "dynkin \<Omega> M \<subseteq> ?D B"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2570
      using restricted_dynkin_system `B \<in> dynkin \<Omega> M`
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2571
      by (intro dynkin_system.dynkin_subset) simp_all
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2572
    then show "A \<inter> B \<in> dynkin \<Omega> M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2573
      using `A \<in> dynkin \<Omega> M` sets_into_space by auto
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2574
  qed
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2575
  from sigma_algebra.sigma_sets_subset[OF this, of "M"]
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2576
  have "sigma_sets (\<Omega>) (M) \<subseteq> dynkin \<Omega> M" by auto
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2577
  ultimately have "sigma_sets (\<Omega>) (M) = dynkin \<Omega> M" by auto
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2578
  then show ?thesis
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2579
    by (auto simp: dynkin_def)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2580
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2581
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2582
lemma (in dynkin_system) dynkin_idem:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2583
  "dynkin \<Omega> M = M"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2584
proof -
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2585
  have "dynkin \<Omega> M = M"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2586
  proof
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2587
    show "M \<subseteq> dynkin \<Omega> M"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2588
      using dynkin_Basic by auto
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2589
    show "dynkin \<Omega> M \<subseteq> M"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2590
      by (intro dynkin_subset) auto
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2591
  qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2592
  then show ?thesis
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2593
    by (auto simp: dynkin_def)
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2594
qed
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2595
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2596
lemma (in dynkin_system) dynkin_lemma:
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41543
diff changeset
  2597
  assumes "Int_stable E"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2598
  and E: "E \<subseteq> M" "M \<subseteq> sigma_sets \<Omega> E"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2599
  shows "sigma_sets \<Omega> E = M"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2600
proof -
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2601
  have "E \<subseteq> Pow \<Omega>"
41689
3e39b0e730d6 the measure valuation is again part of the measure_space type, instead of an explicit parameter to the locale;
hoelzl
parents: 41543
diff changeset
  2602
    using E sets_into_space by force
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2603
  then have "sigma_sets \<Omega> E = dynkin \<Omega> E"
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2604
    using `Int_stable E` by (rule sigma_eq_dynkin)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2605
  moreover then have "dynkin \<Omega> E = M"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2606
    using assms dynkin_subset[OF E(1)] by simp
40859
de0b30e6c2d2 Support product spaces on sigma finite measures.
hoelzl
parents: 40702
diff changeset
  2607
  ultimately show ?thesis
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
  2608
    using assms by (auto simp: dynkin_def)
42864
403e1cba1123 add measurable_Least
hoelzl
parents: 42863
diff changeset
  2609
qed
403e1cba1123 add measurable_Least
hoelzl
parents: 42863
diff changeset
  2610
49789
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49782
diff changeset
  2611
lemma sigma_sets_induct_disjoint[consumes 3, case_names basic empty compl union]:
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49782
diff changeset
  2612
  assumes "Int_stable G"
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49782
diff changeset
  2613
    and closed: "G \<subseteq> Pow \<Omega>"
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49782
diff changeset
  2614
    and A: "A \<in> sigma_sets \<Omega> G"
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49782
diff changeset
  2615
  assumes basic: "\<And>A. A \<in> G \<Longrightarrow> P A"
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49782
diff changeset
  2616
    and empty: "P {}"
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49782
diff changeset
  2617
    and compl: "\<And>A. A \<in> sigma_sets \<Omega> G \<Longrightarrow> P A \<Longrightarrow> P (\<Omega> - A)"
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49782
diff changeset
  2618
    and union: "\<And>A. disjoint_family A \<Longrightarrow> range A \<subseteq> sigma_sets \<Omega> G \<Longrightarrow> (\<And>i. P (A i)) \<Longrightarrow> P (\<Union>i::nat. A i)"
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49782
diff changeset
  2619
  shows "P A"
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49782
diff changeset
  2620
proof -
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49782
diff changeset
  2621
  let ?D = "{ A \<in> sigma_sets \<Omega> G. P A }"
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49782
diff changeset
  2622
  interpret sigma_algebra \<Omega> "sigma_sets \<Omega> G"
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49782
diff changeset
  2623
    using closed by (rule sigma_algebra_sigma_sets)
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49782
diff changeset
  2624
  from compl[OF _ empty] closed have space: "P \<Omega>" by simp
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49782
diff changeset
  2625
  interpret dynkin_system \<Omega> ?D
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49782
diff changeset
  2626
    by default (auto dest: sets_into_space intro!: space compl union)
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49782
diff changeset
  2627
  have "sigma_sets \<Omega> G = ?D"
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49782
diff changeset
  2628
    by (rule dynkin_lemma) (auto simp: basic `Int_stable G`)
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49782
diff changeset
  2629
  with A show ?thesis by auto
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49782
diff changeset
  2630
qed
e0a4cb91a8a9 add induction rule for intersection-stable sigma-sets
hoelzl
parents: 49782
diff changeset
  2631
33271
7be66dee1a5a New theory Probability, which contains a development of measure theory
paulson
parents:
diff changeset
  2632
end