src/HOL/Probability/Independent_Family.thy
author nipkow
Tue, 23 Feb 2016 16:25:08 +0100
changeset 62390 842917225d56
parent 62343 24106dc44def
child 62975 1d066f6ab25d
permissions -rw-r--r--
more canonical names
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
     1
(*  Title:      HOL/Probability/Independent_Family.thy
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
     2
    Author:     Johannes Hölzl, TU München
57235
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
     3
    Author:     Sudeep Kanav, TU München
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
     4
*)
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
     5
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61359
diff changeset
     6
section \<open>Independent families of events, event sets, and random variables\<close>
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
     7
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
     8
theory Independent_Family
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
     9
  imports Probability_Measure Infinite_Product_Measure
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    10
begin
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    11
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    12
definition (in prob_space)
42983
685df9c0626d use abbrevitation events == sets M
hoelzl
parents: 42982
diff changeset
    13
  "indep_sets F I \<longleftrightarrow> (\<forall>i\<in>I. F i \<subseteq> events) \<and>
42981
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
    14
    (\<forall>J\<subseteq>I. J \<noteq> {} \<longrightarrow> finite J \<longrightarrow> (\<forall>A\<in>Pi J F. prob (\<Inter>j\<in>J. A j) = (\<Prod>j\<in>J. prob (A j))))"
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
    15
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
    16
definition (in prob_space)
55414
eab03e9cee8a renamed '{prod,sum,bool,unit}_case' to 'case_...'
blanchet
parents: 53015
diff changeset
    17
  "indep_set A B \<longleftrightarrow> indep_sets (case_bool A B) UNIV"
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    18
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    19
definition (in prob_space)
49784
5e5b2da42a69 remove incseq assumption from measure_eqI_generator_eq
hoelzl
parents: 49781
diff changeset
    20
  indep_events_def_alt: "indep_events A I \<longleftrightarrow> indep_sets (\<lambda>i. {A i}) I"
5e5b2da42a69 remove incseq assumption from measure_eqI_generator_eq
hoelzl
parents: 49781
diff changeset
    21
5e5b2da42a69 remove incseq assumption from measure_eqI_generator_eq
hoelzl
parents: 49781
diff changeset
    22
lemma (in prob_space) indep_events_def:
5e5b2da42a69 remove incseq assumption from measure_eqI_generator_eq
hoelzl
parents: 49781
diff changeset
    23
  "indep_events A I \<longleftrightarrow> (A`I \<subseteq> events) \<and>
5e5b2da42a69 remove incseq assumption from measure_eqI_generator_eq
hoelzl
parents: 49781
diff changeset
    24
    (\<forall>J\<subseteq>I. J \<noteq> {} \<longrightarrow> finite J \<longrightarrow> prob (\<Inter>j\<in>J. A j) = (\<Prod>j\<in>J. prob (A j)))"
5e5b2da42a69 remove incseq assumption from measure_eqI_generator_eq
hoelzl
parents: 49781
diff changeset
    25
  unfolding indep_events_def_alt indep_sets_def
5e5b2da42a69 remove incseq assumption from measure_eqI_generator_eq
hoelzl
parents: 49781
diff changeset
    26
  apply (simp add: Ball_def Pi_iff image_subset_iff_funcset)
5e5b2da42a69 remove incseq assumption from measure_eqI_generator_eq
hoelzl
parents: 49781
diff changeset
    27
  apply (intro conj_cong refl arg_cong[where f=All] ext imp_cong)
5e5b2da42a69 remove incseq assumption from measure_eqI_generator_eq
hoelzl
parents: 49781
diff changeset
    28
  apply auto
5e5b2da42a69 remove incseq assumption from measure_eqI_generator_eq
hoelzl
parents: 49781
diff changeset
    29
  done
5e5b2da42a69 remove incseq assumption from measure_eqI_generator_eq
hoelzl
parents: 49781
diff changeset
    30
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
    31
lemma (in prob_space) indep_eventsI:
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
    32
  "(\<And>i. i \<in> I \<Longrightarrow> F i \<in> sets M) \<Longrightarrow> (\<And>J. J \<subseteq> I \<Longrightarrow> finite J \<Longrightarrow> J \<noteq> {} \<Longrightarrow> prob (\<Inter>i\<in>J. F i) = (\<Prod>i\<in>J. prob (F i))) \<Longrightarrow> indep_events F I"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
    33
  by (auto simp: indep_events_def)
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
    34
49784
5e5b2da42a69 remove incseq assumption from measure_eqI_generator_eq
hoelzl
parents: 49781
diff changeset
    35
definition (in prob_space)
55414
eab03e9cee8a renamed '{prod,sum,bool,unit}_case' to 'case_...'
blanchet
parents: 53015
diff changeset
    36
  "indep_event A B \<longleftrightarrow> indep_events (case_bool A B) UNIV"
49784
5e5b2da42a69 remove incseq assumption from measure_eqI_generator_eq
hoelzl
parents: 49781
diff changeset
    37
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
    38
lemma (in prob_space) indep_sets_cong:
42981
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
    39
  "I = J \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> F i = G i) \<Longrightarrow> indep_sets F I \<longleftrightarrow> indep_sets G J"
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
    40
  by (simp add: indep_sets_def, intro conj_cong all_cong imp_cong ball_cong) blast+
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
    41
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
    42
lemma (in prob_space) indep_events_finite_index_events:
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
    43
  "indep_events F I \<longleftrightarrow> (\<forall>J\<subseteq>I. J \<noteq> {} \<longrightarrow> finite J \<longrightarrow> indep_events F J)"
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
    44
  by (auto simp: indep_events_def)
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
    45
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    46
lemma (in prob_space) indep_sets_finite_index_sets:
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    47
  "indep_sets F I \<longleftrightarrow> (\<forall>J\<subseteq>I. J \<noteq> {} \<longrightarrow> finite J \<longrightarrow> indep_sets F J)"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    48
proof (intro iffI allI impI)
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    49
  assume *: "\<forall>J\<subseteq>I. J \<noteq> {} \<longrightarrow> finite J \<longrightarrow> indep_sets F J"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    50
  show "indep_sets F I" unfolding indep_sets_def
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    51
  proof (intro conjI ballI allI impI)
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    52
    fix i assume "i \<in> I"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    53
    with *[THEN spec, of "{i}"] show "F i \<subseteq> events"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    54
      by (auto simp: indep_sets_def)
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    55
  qed (insert *, auto simp: indep_sets_def)
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    56
qed (auto simp: indep_sets_def)
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    57
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    58
lemma (in prob_space) indep_sets_mono_index:
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    59
  "J \<subseteq> I \<Longrightarrow> indep_sets F I \<Longrightarrow> indep_sets F J"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    60
  unfolding indep_sets_def by auto
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    61
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    62
lemma (in prob_space) indep_sets_mono_sets:
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    63
  assumes indep: "indep_sets F I"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    64
  assumes mono: "\<And>i. i\<in>I \<Longrightarrow> G i \<subseteq> F i"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    65
  shows "indep_sets G I"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    66
proof -
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    67
  have "(\<forall>i\<in>I. F i \<subseteq> events) \<Longrightarrow> (\<forall>i\<in>I. G i \<subseteq> events)"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    68
    using mono by auto
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    69
  moreover have "\<And>A J. J \<subseteq> I \<Longrightarrow> A \<in> (\<Pi> j\<in>J. G j) \<Longrightarrow> A \<in> (\<Pi> j\<in>J. F j)"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    70
    using mono by (auto simp: Pi_iff)
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    71
  ultimately show ?thesis
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    72
    using indep by (auto simp: indep_sets_def)
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    73
qed
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    74
49772
75660d89c339 rename terminal_events to tail_event
hoelzl
parents: 47694
diff changeset
    75
lemma (in prob_space) indep_sets_mono:
75660d89c339 rename terminal_events to tail_event
hoelzl
parents: 47694
diff changeset
    76
  assumes indep: "indep_sets F I"
75660d89c339 rename terminal_events to tail_event
hoelzl
parents: 47694
diff changeset
    77
  assumes mono: "J \<subseteq> I" "\<And>i. i\<in>J \<Longrightarrow> G i \<subseteq> F i"
75660d89c339 rename terminal_events to tail_event
hoelzl
parents: 47694
diff changeset
    78
  shows "indep_sets G J"
75660d89c339 rename terminal_events to tail_event
hoelzl
parents: 47694
diff changeset
    79
  apply (rule indep_sets_mono_sets)
75660d89c339 rename terminal_events to tail_event
hoelzl
parents: 47694
diff changeset
    80
  apply (rule indep_sets_mono_index)
75660d89c339 rename terminal_events to tail_event
hoelzl
parents: 47694
diff changeset
    81
  apply (fact +)
75660d89c339 rename terminal_events to tail_event
hoelzl
parents: 47694
diff changeset
    82
  done
75660d89c339 rename terminal_events to tail_event
hoelzl
parents: 47694
diff changeset
    83
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    84
lemma (in prob_space) indep_setsI:
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    85
  assumes "\<And>i. i \<in> I \<Longrightarrow> F i \<subseteq> events"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    86
    and "\<And>A J. J \<noteq> {} \<Longrightarrow> J \<subseteq> I \<Longrightarrow> finite J \<Longrightarrow> (\<forall>j\<in>J. A j \<in> F j) \<Longrightarrow> prob (\<Inter>j\<in>J. A j) = (\<Prod>j\<in>J. prob (A j))"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    87
  shows "indep_sets F I"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    88
  using assms unfolding indep_sets_def by (auto simp: Pi_iff)
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    89
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    90
lemma (in prob_space) indep_setsD:
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    91
  assumes "indep_sets F I" and "J \<subseteq> I" "J \<noteq> {}" "finite J" "\<forall>j\<in>J. A j \<in> F j"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    92
  shows "prob (\<Inter>j\<in>J. A j) = (\<Prod>j\<in>J. prob (A j))"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    93
  using assms unfolding indep_sets_def by auto
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
    94
42982
fa0ac7bee9ac add lemma kolmogorov_0_1_law
hoelzl
parents: 42981
diff changeset
    95
lemma (in prob_space) indep_setI:
fa0ac7bee9ac add lemma kolmogorov_0_1_law
hoelzl
parents: 42981
diff changeset
    96
  assumes ev: "A \<subseteq> events" "B \<subseteq> events"
fa0ac7bee9ac add lemma kolmogorov_0_1_law
hoelzl
parents: 42981
diff changeset
    97
    and indep: "\<And>a b. a \<in> A \<Longrightarrow> b \<in> B \<Longrightarrow> prob (a \<inter> b) = prob a * prob b"
fa0ac7bee9ac add lemma kolmogorov_0_1_law
hoelzl
parents: 42981
diff changeset
    98
  shows "indep_set A B"
fa0ac7bee9ac add lemma kolmogorov_0_1_law
hoelzl
parents: 42981
diff changeset
    99
  unfolding indep_set_def
fa0ac7bee9ac add lemma kolmogorov_0_1_law
hoelzl
parents: 42981
diff changeset
   100
proof (rule indep_setsI)
fa0ac7bee9ac add lemma kolmogorov_0_1_law
hoelzl
parents: 42981
diff changeset
   101
  fix F J assume "J \<noteq> {}" "J \<subseteq> UNIV"
fa0ac7bee9ac add lemma kolmogorov_0_1_law
hoelzl
parents: 42981
diff changeset
   102
    and F: "\<forall>j\<in>J. F j \<in> (case j of True \<Rightarrow> A | False \<Rightarrow> B)"
fa0ac7bee9ac add lemma kolmogorov_0_1_law
hoelzl
parents: 42981
diff changeset
   103
  have "J \<in> Pow UNIV" by auto
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61359
diff changeset
   104
  with F \<open>J \<noteq> {}\<close> indep[of "F True" "F False"]
42982
fa0ac7bee9ac add lemma kolmogorov_0_1_law
hoelzl
parents: 42981
diff changeset
   105
  show "prob (\<Inter>j\<in>J. F j) = (\<Prod>j\<in>J. prob (F j))"
fa0ac7bee9ac add lemma kolmogorov_0_1_law
hoelzl
parents: 42981
diff changeset
   106
    unfolding UNIV_bool Pow_insert by (auto simp: ac_simps)
fa0ac7bee9ac add lemma kolmogorov_0_1_law
hoelzl
parents: 42981
diff changeset
   107
qed (auto split: bool.split simp: ev)
fa0ac7bee9ac add lemma kolmogorov_0_1_law
hoelzl
parents: 42981
diff changeset
   108
fa0ac7bee9ac add lemma kolmogorov_0_1_law
hoelzl
parents: 42981
diff changeset
   109
lemma (in prob_space) indep_setD:
fa0ac7bee9ac add lemma kolmogorov_0_1_law
hoelzl
parents: 42981
diff changeset
   110
  assumes indep: "indep_set A B" and ev: "a \<in> A" "b \<in> B"
fa0ac7bee9ac add lemma kolmogorov_0_1_law
hoelzl
parents: 42981
diff changeset
   111
  shows "prob (a \<inter> b) = prob a * prob b"
55414
eab03e9cee8a renamed '{prod,sum,bool,unit}_case' to 'case_...'
blanchet
parents: 53015
diff changeset
   112
  using indep[unfolded indep_set_def, THEN indep_setsD, of UNIV "case_bool a b"] ev
42982
fa0ac7bee9ac add lemma kolmogorov_0_1_law
hoelzl
parents: 42981
diff changeset
   113
  by (simp add: ac_simps UNIV_bool)
fa0ac7bee9ac add lemma kolmogorov_0_1_law
hoelzl
parents: 42981
diff changeset
   114
fa0ac7bee9ac add lemma kolmogorov_0_1_law
hoelzl
parents: 42981
diff changeset
   115
lemma (in prob_space)
fa0ac7bee9ac add lemma kolmogorov_0_1_law
hoelzl
parents: 42981
diff changeset
   116
  assumes indep: "indep_set A B"
42983
685df9c0626d use abbrevitation events == sets M
hoelzl
parents: 42982
diff changeset
   117
  shows indep_setD_ev1: "A \<subseteq> events"
685df9c0626d use abbrevitation events == sets M
hoelzl
parents: 42982
diff changeset
   118
    and indep_setD_ev2: "B \<subseteq> events"
42982
fa0ac7bee9ac add lemma kolmogorov_0_1_law
hoelzl
parents: 42981
diff changeset
   119
  using indep unfolding indep_set_def indep_sets_def UNIV_bool by auto
fa0ac7bee9ac add lemma kolmogorov_0_1_law
hoelzl
parents: 42981
diff changeset
   120
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   121
lemma (in prob_space) indep_sets_dynkin:
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   122
  assumes indep: "indep_sets F I"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   123
  shows "indep_sets (\<lambda>i. dynkin (space M) (F i)) I"
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   124
    (is "indep_sets ?F I")
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   125
proof (subst indep_sets_finite_index_sets, intro allI impI ballI)
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   126
  fix J assume "finite J" "J \<subseteq> I" "J \<noteq> {}"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   127
  with indep have "indep_sets F J"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   128
    by (subst (asm) indep_sets_finite_index_sets) auto
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   129
  { fix J K assume "indep_sets F K"
46731
5302e932d1e5 avoid undeclared variables in let bindings;
wenzelm
parents: 45777
diff changeset
   130
    let ?G = "\<lambda>S i. if i \<in> S then ?F i else F i"
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   131
    assume "finite J" "J \<subseteq> K"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   132
    then have "indep_sets (?G J) K"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   133
    proof induct
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   134
      case (insert j J)
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   135
      moreover def G \<equiv> "?G J"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   136
      ultimately have G: "indep_sets G K" "\<And>i. i \<in> K \<Longrightarrow> G i \<subseteq> events" and "j \<in> K"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   137
        by (auto simp: indep_sets_def)
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   138
      let ?D = "{E\<in>events. indep_sets (G(j := {E})) K }"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   139
      { fix X assume X: "X \<in> events"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   140
        assume indep: "\<And>J A. J \<noteq> {} \<Longrightarrow> J \<subseteq> K \<Longrightarrow> finite J \<Longrightarrow> j \<notin> J \<Longrightarrow> (\<forall>i\<in>J. A i \<in> G i)
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   141
          \<Longrightarrow> prob ((\<Inter>i\<in>J. A i) \<inter> X) = prob X * (\<Prod>i\<in>J. prob (A i))"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   142
        have "indep_sets (G(j := {X})) K"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   143
        proof (rule indep_setsI)
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   144
          fix i assume "i \<in> K" then show "(G(j:={X})) i \<subseteq> events"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   145
            using G X by auto
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   146
        next
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   147
          fix A J assume J: "J \<noteq> {}" "J \<subseteq> K" "finite J" "\<forall>i\<in>J. A i \<in> (G(j := {X})) i"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   148
          show "prob (\<Inter>j\<in>J. A j) = (\<Prod>j\<in>J. prob (A j))"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   149
          proof cases
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   150
            assume "j \<in> J"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   151
            with J have "A j = X" by auto
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   152
            show ?thesis
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   153
            proof cases
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   154
              assume "J = {j}" then show ?thesis by simp
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   155
            next
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   156
              assume "J \<noteq> {j}"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   157
              have "prob (\<Inter>i\<in>J. A i) = prob ((\<Inter>i\<in>J-{j}. A i) \<inter> X)"
62390
842917225d56 more canonical names
nipkow
parents: 62343
diff changeset
   158
                using \<open>j \<in> J\<close> \<open>A j = X\<close> by (auto intro!: arg_cong[where f=prob] split: if_split_asm)
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   159
              also have "\<dots> = prob X * (\<Prod>i\<in>J-{j}. prob (A i))"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   160
              proof (rule indep)
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   161
                show "J - {j} \<noteq> {}" "J - {j} \<subseteq> K" "finite (J - {j})" "j \<notin> J - {j}"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61359
diff changeset
   162
                  using J \<open>J \<noteq> {j}\<close> \<open>j \<in> J\<close> by auto
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   163
                show "\<forall>i\<in>J - {j}. A i \<in> G i"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   164
                  using J by auto
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   165
              qed
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   166
              also have "\<dots> = prob (A j) * (\<Prod>i\<in>J-{j}. prob (A i))"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61359
diff changeset
   167
                using \<open>A j = X\<close> by simp
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   168
              also have "\<dots> = (\<Prod>i\<in>J. prob (A i))"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61359
diff changeset
   169
                unfolding setprod.insert_remove[OF \<open>finite J\<close>, symmetric, of "\<lambda>i. prob  (A i)"]
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61359
diff changeset
   170
                using \<open>j \<in> J\<close> by (simp add: insert_absorb)
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   171
              finally show ?thesis .
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   172
            qed
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   173
          next
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   174
            assume "j \<notin> J"
62390
842917225d56 more canonical names
nipkow
parents: 62343
diff changeset
   175
            with J have "\<forall>i\<in>J. A i \<in> G i" by (auto split: if_split_asm)
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   176
            with J show ?thesis
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   177
              by (intro indep_setsD[OF G(1)]) auto
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   178
          qed
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   179
        qed }
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   180
      note indep_sets_insert = this
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   181
      have "dynkin_system (space M) ?D"
42987
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42985
diff changeset
   182
      proof (rule dynkin_systemI', simp_all cong del: indep_sets_cong, safe)
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   183
        show "indep_sets (G(j := {{}})) K"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   184
          by (rule indep_sets_insert) auto
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   185
      next
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   186
        fix X assume X: "X \<in> events" and G': "indep_sets (G(j := {X})) K"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   187
        show "indep_sets (G(j := {space M - X})) K"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   188
        proof (rule indep_sets_insert)
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   189
          fix J A assume J: "J \<noteq> {}" "J \<subseteq> K" "finite J" "j \<notin> J" and A: "\<forall>i\<in>J. A i \<in> G i"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   190
          then have A_sets: "\<And>i. i\<in>J \<Longrightarrow> A i \<in> events"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   191
            using G by auto
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   192
          have "prob ((\<Inter>j\<in>J. A j) \<inter> (space M - X)) =
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   193
              prob ((\<Inter>j\<in>J. A j) - (\<Inter>i\<in>insert j J. (A(j := X)) i))"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61359
diff changeset
   194
            using A_sets sets.sets_into_space[of _ M] X \<open>J \<noteq> {}\<close>
62390
842917225d56 more canonical names
nipkow
parents: 62343
diff changeset
   195
            by (auto intro!: arg_cong[where f=prob] split: if_split_asm)
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   196
          also have "\<dots> = prob (\<Inter>j\<in>J. A j) - prob (\<Inter>i\<in>insert j J. (A(j := X)) i)"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61359
diff changeset
   197
            using J \<open>J \<noteq> {}\<close> \<open>j \<notin> J\<close> A_sets X sets.sets_into_space
62390
842917225d56 more canonical names
nipkow
parents: 62343
diff changeset
   198
            by (auto intro!: finite_measure_Diff sets.finite_INT split: if_split_asm)
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   199
          finally have "prob ((\<Inter>j\<in>J. A j) \<inter> (space M - X)) =
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   200
              prob (\<Inter>j\<in>J. A j) - prob (\<Inter>i\<in>insert j J. (A(j := X)) i)" .
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   201
          moreover {
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   202
            have "prob (\<Inter>j\<in>J. A j) = (\<Prod>j\<in>J. prob (A j))"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61359
diff changeset
   203
              using J A \<open>finite J\<close> by (intro indep_setsD[OF G(1)]) auto
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   204
            then have "prob (\<Inter>j\<in>J. A j) = prob (space M) * (\<Prod>i\<in>J. prob (A i))"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   205
              using prob_space by simp }
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   206
          moreover {
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   207
            have "prob (\<Inter>i\<in>insert j J. (A(j := X)) i) = (\<Prod>i\<in>insert j J. prob ((A(j := X)) i))"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61359
diff changeset
   208
              using J A \<open>j \<in> K\<close> by (intro indep_setsD[OF G']) auto
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   209
            then have "prob (\<Inter>i\<in>insert j J. (A(j := X)) i) = prob X * (\<Prod>i\<in>J. prob (A i))"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61359
diff changeset
   210
              using \<open>finite J\<close> \<open>j \<notin> J\<close> by (auto intro!: setprod.cong) }
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   211
          ultimately have "prob ((\<Inter>j\<in>J. A j) \<inter> (space M - X)) = (prob (space M) - prob X) * (\<Prod>i\<in>J. prob (A i))"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   212
            by (simp add: field_simps)
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   213
          also have "\<dots> = prob (space M - X) * (\<Prod>i\<in>J. prob (A i))"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   214
            using X A by (simp add: finite_measure_compl)
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   215
          finally show "prob ((\<Inter>j\<in>J. A j) \<inter> (space M - X)) = prob (space M - X) * (\<Prod>i\<in>J. prob (A i))" .
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   216
        qed (insert X, auto)
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   217
      next
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   218
        fix F :: "nat \<Rightarrow> 'a set" assume disj: "disjoint_family F" and "range F \<subseteq> ?D"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   219
        then have F: "\<And>i. F i \<in> events" "\<And>i. indep_sets (G(j:={F i})) K" by auto
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   220
        show "indep_sets (G(j := {\<Union>k. F k})) K"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   221
        proof (rule indep_sets_insert)
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   222
          fix J A assume J: "j \<notin> J" "J \<noteq> {}" "J \<subseteq> K" "finite J" and A: "\<forall>i\<in>J. A i \<in> G i"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   223
          then have A_sets: "\<And>i. i\<in>J \<Longrightarrow> A i \<in> events"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   224
            using G by auto
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   225
          have "prob ((\<Inter>j\<in>J. A j) \<inter> (\<Union>k. F k)) = prob (\<Union>k. (\<Inter>i\<in>insert j J. (A(j := F k)) i))"
62390
842917225d56 more canonical names
nipkow
parents: 62343
diff changeset
   226
            using \<open>J \<noteq> {}\<close> \<open>j \<notin> J\<close> \<open>j \<in> K\<close> by (auto intro!: arg_cong[where f=prob] split: if_split_asm)
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   227
          moreover have "(\<lambda>k. prob (\<Inter>i\<in>insert j J. (A(j := F k)) i)) sums prob (\<Union>k. (\<Inter>i\<in>insert j J. (A(j := F k)) i))"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   228
          proof (rule finite_measure_UNION)
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   229
            show "disjoint_family (\<lambda>k. \<Inter>i\<in>insert j J. (A(j := F k)) i)"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   230
              using disj by (rule disjoint_family_on_bisimulation) auto
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   231
            show "range (\<lambda>k. \<Inter>i\<in>insert j J. (A(j := F k)) i) \<subseteq> events"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61359
diff changeset
   232
              using A_sets F \<open>finite J\<close> \<open>J \<noteq> {}\<close> \<open>j \<notin> J\<close> by (auto intro!: sets.Int)
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   233
          qed
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   234
          moreover { fix k
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61359
diff changeset
   235
            from J A \<open>j \<in> K\<close> have "prob (\<Inter>i\<in>insert j J. (A(j := F k)) i) = prob (F k) * (\<Prod>i\<in>J. prob (A i))"
62390
842917225d56 more canonical names
nipkow
parents: 62343
diff changeset
   236
              by (subst indep_setsD[OF F(2)]) (auto intro!: setprod.cong split: if_split_asm)
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   237
            also have "\<dots> = prob (F k) * prob (\<Inter>i\<in>J. A i)"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61359
diff changeset
   238
              using J A \<open>j \<in> K\<close> by (subst indep_setsD[OF G(1)]) auto
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   239
            finally have "prob (\<Inter>i\<in>insert j J. (A(j := F k)) i) = prob (F k) * prob (\<Inter>i\<in>J. A i)" . }
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   240
          ultimately have "(\<lambda>k. prob (F k) * prob (\<Inter>i\<in>J. A i)) sums (prob ((\<Inter>j\<in>J. A j) \<inter> (\<Union>k. F k)))"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   241
            by simp
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   242
          moreover
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   243
          have "(\<lambda>k. prob (F k) * prob (\<Inter>i\<in>J. A i)) sums (prob (\<Union>k. F k) * prob (\<Inter>i\<in>J. A i))"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   244
            using disj F(1) by (intro finite_measure_UNION sums_mult2) auto
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   245
          then have "(\<lambda>k. prob (F k) * prob (\<Inter>i\<in>J. A i)) sums (prob (\<Union>k. F k) * (\<Prod>i\<in>J. prob (A i)))"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61359
diff changeset
   246
            using J A \<open>j \<in> K\<close> by (subst indep_setsD[OF G(1), symmetric]) auto
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   247
          ultimately
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   248
          show "prob ((\<Inter>j\<in>J. A j) \<inter> (\<Union>k. F k)) = prob (\<Union>k. F k) * (\<Prod>j\<in>J. prob (A j))"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   249
            by (auto dest!: sums_unique)
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   250
        qed (insert F, auto)
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50123
diff changeset
   251
      qed (insert sets.sets_into_space, auto)
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   252
      then have mono: "dynkin (space M) (G j) \<subseteq> {E \<in> events. indep_sets (G(j := {E})) K}"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   253
      proof (rule dynkin_system.dynkin_subset, safe)
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   254
        fix X assume "X \<in> G j"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61359
diff changeset
   255
        then show "X \<in> events" using G \<open>j \<in> K\<close> by auto
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61359
diff changeset
   256
        from \<open>indep_sets G K\<close>
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   257
        show "indep_sets (G(j := {X})) K"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61359
diff changeset
   258
          by (rule indep_sets_mono_sets) (insert \<open>X \<in> G j\<close>, auto)
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   259
      qed
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   260
      have "indep_sets (G(j:=?D)) K"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   261
      proof (rule indep_setsI)
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   262
        fix i assume "i \<in> K" then show "(G(j := ?D)) i \<subseteq> events"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   263
          using G(2) by auto
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   264
      next
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   265
        fix A J assume J: "J\<noteq>{}" "J \<subseteq> K" "finite J" and A: "\<forall>i\<in>J. A i \<in> (G(j := ?D)) i"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   266
        show "prob (\<Inter>j\<in>J. A j) = (\<Prod>j\<in>J. prob (A j))"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   267
        proof cases
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   268
          assume "j \<in> J"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   269
          with A have indep: "indep_sets (G(j := {A j})) K" by auto
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   270
          from J A show ?thesis
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   271
            by (intro indep_setsD[OF indep]) auto
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   272
        next
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   273
          assume "j \<notin> J"
62390
842917225d56 more canonical names
nipkow
parents: 62343
diff changeset
   274
          with J A have "\<forall>i\<in>J. A i \<in> G i" by (auto split: if_split_asm)
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   275
          with J show ?thesis
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   276
            by (intro indep_setsD[OF G(1)]) auto
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   277
        qed
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   278
      qed
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   279
      then have "indep_sets (G(j := dynkin (space M) (G j))) K"
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   280
        by (rule indep_sets_mono_sets) (insert mono, auto)
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   281
      then show ?case
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61359
diff changeset
   282
        by (rule indep_sets_mono_sets) (insert \<open>j \<in> K\<close> \<open>j \<notin> J\<close>, auto simp: G_def)
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61359
diff changeset
   283
    qed (insert \<open>indep_sets F K\<close>, simp) }
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61359
diff changeset
   284
  from this[OF \<open>indep_sets F J\<close> \<open>finite J\<close> subset_refl]
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   285
  show "indep_sets ?F J"
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   286
    by (rule indep_sets_mono_sets) auto
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   287
qed
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   288
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   289
lemma (in prob_space) indep_sets_sigma:
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   290
  assumes indep: "indep_sets F I"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   291
  assumes stable: "\<And>i. i \<in> I \<Longrightarrow> Int_stable (F i)"
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   292
  shows "indep_sets (\<lambda>i. sigma_sets (space M) (F i)) I"
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   293
proof -
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   294
  from indep_sets_dynkin[OF indep]
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   295
  show ?thesis
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   296
  proof (rule indep_sets_mono_sets, subst sigma_eq_dynkin, simp_all add: stable)
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   297
    fix i assume "i \<in> I"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   298
    with indep have "F i \<subseteq> events" by (auto simp: indep_sets_def)
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50123
diff changeset
   299
    with sets.sets_into_space show "F i \<subseteq> Pow (space M)" by auto
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   300
  qed
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   301
qed
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   302
42987
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42985
diff changeset
   303
lemma (in prob_space) indep_sets_sigma_sets_iff:
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   304
  assumes "\<And>i. i \<in> I \<Longrightarrow> Int_stable (F i)"
42987
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42985
diff changeset
   305
  shows "indep_sets (\<lambda>i. sigma_sets (space M) (F i)) I \<longleftrightarrow> indep_sets F I"
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42985
diff changeset
   306
proof
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42985
diff changeset
   307
  assume "indep_sets F I" then show "indep_sets (\<lambda>i. sigma_sets (space M) (F i)) I"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   308
    by (rule indep_sets_sigma) fact
42987
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42985
diff changeset
   309
next
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42985
diff changeset
   310
  assume "indep_sets (\<lambda>i. sigma_sets (space M) (F i)) I" then show "indep_sets F I"
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42985
diff changeset
   311
    by (rule indep_sets_mono_sets) (intro subsetI sigma_sets.Basic)
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42985
diff changeset
   312
qed
73e2d802ea41 add lemma indep_rv_finite
hoelzl
parents: 42985
diff changeset
   313
49794
3c7b5988e094 indep_vars does not need sigma-sets
hoelzl
parents: 49784
diff changeset
   314
definition (in prob_space)
3c7b5988e094 indep_vars does not need sigma-sets
hoelzl
parents: 49784
diff changeset
   315
  indep_vars_def2: "indep_vars M' X I \<longleftrightarrow>
49781
59b219ca3513 simplified assumptions for kolmogorov_0_1_law
hoelzl
parents: 49776
diff changeset
   316
    (\<forall>i\<in>I. random_variable (M' i) (X i)) \<and>
59b219ca3513 simplified assumptions for kolmogorov_0_1_law
hoelzl
parents: 49776
diff changeset
   317
    indep_sets (\<lambda>i. { X i -` A \<inter> space M | A. A \<in> sets (M' i)}) I"
49794
3c7b5988e094 indep_vars does not need sigma-sets
hoelzl
parents: 49784
diff changeset
   318
3c7b5988e094 indep_vars does not need sigma-sets
hoelzl
parents: 49784
diff changeset
   319
definition (in prob_space)
55414
eab03e9cee8a renamed '{prod,sum,bool,unit}_case' to 'case_...'
blanchet
parents: 53015
diff changeset
   320
  "indep_var Ma A Mb B \<longleftrightarrow> indep_vars (case_bool Ma Mb) (case_bool A B) UNIV"
49794
3c7b5988e094 indep_vars does not need sigma-sets
hoelzl
parents: 49784
diff changeset
   321
3c7b5988e094 indep_vars does not need sigma-sets
hoelzl
parents: 49784
diff changeset
   322
lemma (in prob_space) indep_vars_def:
3c7b5988e094 indep_vars does not need sigma-sets
hoelzl
parents: 49784
diff changeset
   323
  "indep_vars M' X I \<longleftrightarrow>
3c7b5988e094 indep_vars does not need sigma-sets
hoelzl
parents: 49784
diff changeset
   324
    (\<forall>i\<in>I. random_variable (M' i) (X i)) \<and>
3c7b5988e094 indep_vars does not need sigma-sets
hoelzl
parents: 49784
diff changeset
   325
    indep_sets (\<lambda>i. sigma_sets (space M) { X i -` A \<inter> space M | A. A \<in> sets (M' i)}) I"
3c7b5988e094 indep_vars does not need sigma-sets
hoelzl
parents: 49784
diff changeset
   326
  unfolding indep_vars_def2
49781
59b219ca3513 simplified assumptions for kolmogorov_0_1_law
hoelzl
parents: 49776
diff changeset
   327
  apply (rule conj_cong[OF refl])
49794
3c7b5988e094 indep_vars does not need sigma-sets
hoelzl
parents: 49784
diff changeset
   328
  apply (rule indep_sets_sigma_sets_iff[symmetric])
49781
59b219ca3513 simplified assumptions for kolmogorov_0_1_law
hoelzl
parents: 49776
diff changeset
   329
  apply (auto simp: Int_stable_def)
59b219ca3513 simplified assumptions for kolmogorov_0_1_law
hoelzl
parents: 49776
diff changeset
   330
  apply (rule_tac x="A \<inter> Aa" in exI)
59b219ca3513 simplified assumptions for kolmogorov_0_1_law
hoelzl
parents: 49776
diff changeset
   331
  apply auto
59b219ca3513 simplified assumptions for kolmogorov_0_1_law
hoelzl
parents: 49776
diff changeset
   332
  done
59b219ca3513 simplified assumptions for kolmogorov_0_1_law
hoelzl
parents: 49776
diff changeset
   333
49794
3c7b5988e094 indep_vars does not need sigma-sets
hoelzl
parents: 49784
diff changeset
   334
lemma (in prob_space) indep_var_eq:
3c7b5988e094 indep_vars does not need sigma-sets
hoelzl
parents: 49784
diff changeset
   335
  "indep_var S X T Y \<longleftrightarrow>
3c7b5988e094 indep_vars does not need sigma-sets
hoelzl
parents: 49784
diff changeset
   336
    (random_variable S X \<and> random_variable T Y) \<and>
3c7b5988e094 indep_vars does not need sigma-sets
hoelzl
parents: 49784
diff changeset
   337
    indep_set
3c7b5988e094 indep_vars does not need sigma-sets
hoelzl
parents: 49784
diff changeset
   338
      (sigma_sets (space M) { X -` A \<inter> space M | A. A \<in> sets S})
3c7b5988e094 indep_vars does not need sigma-sets
hoelzl
parents: 49784
diff changeset
   339
      (sigma_sets (space M) { Y -` A \<inter> space M | A. A \<in> sets T})"
3c7b5988e094 indep_vars does not need sigma-sets
hoelzl
parents: 49784
diff changeset
   340
  unfolding indep_var_def indep_vars_def indep_set_def UNIV_bool
3c7b5988e094 indep_vars does not need sigma-sets
hoelzl
parents: 49784
diff changeset
   341
  by (intro arg_cong2[where f="op \<and>"] arg_cong2[where f=indep_sets] ext)
3c7b5988e094 indep_vars does not need sigma-sets
hoelzl
parents: 49784
diff changeset
   342
     (auto split: bool.split)
3c7b5988e094 indep_vars does not need sigma-sets
hoelzl
parents: 49784
diff changeset
   343
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   344
lemma (in prob_space) indep_sets2_eq:
42981
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   345
  "indep_set A B \<longleftrightarrow> A \<subseteq> events \<and> B \<subseteq> events \<and> (\<forall>a\<in>A. \<forall>b\<in>B. prob (a \<inter> b) = prob a * prob b)"
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   346
  unfolding indep_set_def
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   347
proof (intro iffI ballI conjI)
55414
eab03e9cee8a renamed '{prod,sum,bool,unit}_case' to 'case_...'
blanchet
parents: 53015
diff changeset
   348
  assume indep: "indep_sets (case_bool A B) UNIV"
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   349
  { fix a b assume "a \<in> A" "b \<in> B"
55414
eab03e9cee8a renamed '{prod,sum,bool,unit}_case' to 'case_...'
blanchet
parents: 53015
diff changeset
   350
    with indep_setsD[OF indep, of UNIV "case_bool a b"]
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   351
    show "prob (a \<inter> b) = prob a * prob b"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   352
      unfolding UNIV_bool by (simp add: ac_simps) }
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   353
  from indep show "A \<subseteq> events" "B \<subseteq> events"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   354
    unfolding indep_sets_def UNIV_bool by auto
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   355
next
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   356
  assume *: "A \<subseteq> events \<and> B \<subseteq> events \<and> (\<forall>a\<in>A. \<forall>b\<in>B. prob (a \<inter> b) = prob a * prob b)"
55414
eab03e9cee8a renamed '{prod,sum,bool,unit}_case' to 'case_...'
blanchet
parents: 53015
diff changeset
   357
  show "indep_sets (case_bool A B) UNIV"
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   358
  proof (rule indep_setsI)
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   359
    fix i show "(case i of True \<Rightarrow> A | False \<Rightarrow> B) \<subseteq> events"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   360
      using * by (auto split: bool.split)
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   361
  next
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   362
    fix J X assume "J \<noteq> {}" "J \<subseteq> UNIV" and X: "\<forall>j\<in>J. X j \<in> (case j of True \<Rightarrow> A | False \<Rightarrow> B)"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   363
    then have "J = {True} \<or> J = {False} \<or> J = {True,False}"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   364
      by (auto simp: UNIV_bool)
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   365
    then show "prob (\<Inter>j\<in>J. X j) = (\<Prod>j\<in>J. prob (X j))"
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   366
      using X * by auto
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   367
  qed
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   368
qed
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   369
42981
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   370
lemma (in prob_space) indep_set_sigma_sets:
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   371
  assumes "indep_set A B"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   372
  assumes A: "Int_stable A" and B: "Int_stable B"
42981
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   373
  shows "indep_set (sigma_sets (space M) A) (sigma_sets (space M) B)"
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   374
proof -
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   375
  have "indep_sets (\<lambda>i. sigma_sets (space M) (case i of True \<Rightarrow> A | False \<Rightarrow> B)) UNIV"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   376
  proof (rule indep_sets_sigma)
55414
eab03e9cee8a renamed '{prod,sum,bool,unit}_case' to 'case_...'
blanchet
parents: 53015
diff changeset
   377
    show "indep_sets (case_bool A B) UNIV"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61359
diff changeset
   378
      by (rule \<open>indep_set A B\<close>[unfolded indep_set_def])
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   379
    fix i show "Int_stable (case i of True \<Rightarrow> A | False \<Rightarrow> B)"
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   380
      using A B by (cases i) auto
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   381
  qed
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   382
  then show ?thesis
42981
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   383
    unfolding indep_set_def
42861
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   384
    by (rule indep_sets_mono_sets) (auto split: bool.split)
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   385
qed
16375b493b64 Add formalization of probabilistic independence for families of sets
hoelzl
parents:
diff changeset
   386
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   387
lemma (in prob_space) indep_eventsI_indep_vars:
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   388
  assumes indep: "indep_vars N X I"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   389
  assumes P: "\<And>i. i \<in> I \<Longrightarrow> {x\<in>space (N i). P i x} \<in> sets (N i)"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   390
  shows "indep_events (\<lambda>i. {x\<in>space M. P i (X i x)}) I"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   391
proof -
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   392
  have "indep_sets (\<lambda>i. {X i -` A \<inter> space M |A. A \<in> sets (N i)}) I"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   393
    using indep unfolding indep_vars_def2 by auto
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   394
  then show ?thesis
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   395
    unfolding indep_events_def_alt
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   396
  proof (rule indep_sets_mono_sets)
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   397
    fix i assume "i \<in> I"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   398
    then have "{{x \<in> space M. P i (X i x)}} = {X i -` {x\<in>space (N i). P i x} \<inter> space M}"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   399
      using indep by (auto simp: indep_vars_def dest: measurable_space)
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   400
    also have "\<dots> \<subseteq> {X i -` A \<inter> space M |A. A \<in> sets (N i)}"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61359
diff changeset
   401
      using P[OF \<open>i \<in> I\<close>] by blast
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   402
    finally show "{{x \<in> space M. P i (X i x)}} \<subseteq> {X i -` A \<inter> space M |A. A \<in> sets (N i)}" .
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   403
  qed
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   404
qed                              
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58876
diff changeset
   405
42981
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   406
lemma (in prob_space) indep_sets_collect_sigma:
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   407
  fixes I :: "'j \<Rightarrow> 'i set" and J :: "'j set" and E :: "'i \<Rightarrow> 'a set set"
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   408
  assumes indep: "indep_sets E (\<Union>j\<in>J. I j)"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   409
  assumes Int_stable: "\<And>i j. j \<in> J \<Longrightarrow> i \<in> I j \<Longrightarrow> Int_stable (E i)"
42981
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   410
  assumes disjoint: "disjoint_family_on I J"
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   411
  shows "indep_sets (\<lambda>j. sigma_sets (space M) (\<Union>i\<in>I j. E i)) J"
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   412
proof -
46731
5302e932d1e5 avoid undeclared variables in let bindings;
wenzelm
parents: 45777
diff changeset
   413
  let ?E = "\<lambda>j. {\<Inter>k\<in>K. E' k| E' K. finite K \<and> K \<noteq> {} \<and> K \<subseteq> I j \<and> (\<forall>k\<in>K. E' k \<in> E k) }"
42981
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   414
42983
685df9c0626d use abbrevitation events == sets M
hoelzl
parents: 42982
diff changeset
   415
  from indep have E: "\<And>j i. j \<in> J \<Longrightarrow> i \<in> I j \<Longrightarrow> E i \<subseteq> events"
42981
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   416
    unfolding indep_sets_def by auto
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   417
  { fix j
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   418
    let ?S = "sigma_sets (space M) (\<Union>i\<in>I j. E i)"
42981
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   419
    assume "j \<in> J"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   420
    from E[OF this] interpret S: sigma_algebra "space M" ?S
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50123
diff changeset
   421
      using sets.sets_into_space[of _ M] by (intro sigma_algebra_sigma_sets) auto
42981
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   422
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   423
    have "sigma_sets (space M) (\<Union>i\<in>I j. E i) = sigma_sets (space M) (?E j)"
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   424
    proof (rule sigma_sets_eqI)
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   425
      fix A assume "A \<in> (\<Union>i\<in>I j. E i)"
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   426
      then guess i ..
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   427
      then show "A \<in> sigma_sets (space M) (?E j)"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   428
        by (auto intro!: sigma_sets.intros(2-) exI[of _ "{i}"] exI[of _ "\<lambda>i. A"])
42981
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   429
    next
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   430
      fix A assume "A \<in> ?E j"
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   431
      then obtain E' K where "finite K" "K \<noteq> {}" "K \<subseteq> I j" "\<And>k. k \<in> K \<Longrightarrow> E' k \<in> E k"
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   432
        and A: "A = (\<Inter>k\<in>K. E' k)"
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   433
        by auto
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   434
      then have "A \<in> ?S" unfolding A
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   435
        by (safe intro!: S.finite_INT) auto
42981
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   436
      then show "A \<in> sigma_sets (space M) (\<Union>i\<in>I j. E i)"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   437
        by simp
42981
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   438
    qed }
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   439
  moreover have "indep_sets (\<lambda>j. sigma_sets (space M) (?E j)) J"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   440
  proof (rule indep_sets_sigma)
42981
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   441
    show "indep_sets ?E J"
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   442
    proof (intro indep_setsI)
50244
de72bbe42190 qualified interpretation of sigma_algebra, to avoid name clashes
immler
parents: 50123
diff changeset
   443
      fix j assume "j \<in> J" with E show "?E j \<subseteq> events" by (force  intro!: sets.finite_INT)
42981
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   444
    next
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   445
      fix K A assume K: "K \<noteq> {}" "K \<subseteq> J" "finite K"
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   446
        and "\<forall>j\<in>K. A j \<in> ?E j"
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   447
      then have "\<forall>j\<in>K. \<exists>E' L. A j = (\<Inter>l\<in>L. E' l) \<and> finite L \<and> L \<noteq> {} \<and> L \<subseteq> I j \<and> (\<forall>l\<in>L. E' l \<in> E l)"
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   448
        by simp
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   449
      from bchoice[OF this] guess E' ..
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   450
      from bchoice[OF this] obtain L
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   451
        where A: "\<And>j. j\<in>K \<Longrightarrow> A j = (\<Inter>l\<in>L j. E' j l)"
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   452
        and L: "\<And>j. j\<in>K \<Longrightarrow> finite (L j)" "\<And>j. j\<in>K \<Longrightarrow> L j \<noteq> {}" "\<And>j. j\<in>K \<Longrightarrow> L j \<subseteq> I j"
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   453
        and E': "\<And>j l. j\<in>K \<Longrightarrow> l \<in> L j \<Longrightarrow> E' j l \<in> E l"
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   454
        by auto
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   455
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   456
      { fix k l j assume "k \<in> K" "j \<in> K" "l \<in> L j" "l \<in> L k"
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   457
        have "k = j"
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   458
        proof (rule ccontr)
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   459
          assume "k \<noteq> j"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61359
diff changeset
   460
          with disjoint \<open>K \<subseteq> J\<close> \<open>k \<in> K\<close> \<open>j \<in> K\<close> have "I k \<inter> I j = {}"
42981
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   461
            unfolding disjoint_family_on_def by auto
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61359
diff changeset
   462
          with L(2,3)[OF \<open>j \<in> K\<close>] L(2,3)[OF \<open>k \<in> K\<close>]
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61359
diff changeset
   463
          show False using \<open>l \<in> L k\<close> \<open>l \<in> L j\<close> by auto
42981
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   464
        qed }
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   465
      note L_inj = this
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   466
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   467
      def k \<equiv> "\<lambda>l. (SOME k. k \<in> K \<and> l \<in> L k)"
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   468
      { fix x j l assume *: "j \<in> K" "l \<in> L j"
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   469
        have "k l = j" unfolding k_def
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   470
        proof (rule some_equality)
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   471
          fix k assume "k \<in> K \<and> l \<in> L k"
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   472
          with * L_inj show "k = j" by auto
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   473
        qed (insert *, simp) }
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   474
      note k_simp[simp] = this
46731
5302e932d1e5 avoid undeclared variables in let bindings;
wenzelm
parents: 45777
diff changeset
   475
      let ?E' = "\<lambda>l. E' (k l) l"
42981
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   476
      have "prob (\<Inter>j\<in>K. A j) = prob (\<Inter>l\<in>(\<Union>k\<in>K. L k). ?E' l)"
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   477
        by (auto simp: A intro!: arg_cong[where f=prob])
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   478
      also have "\<dots> = (\<Prod>l\<in>(\<Union>k\<in>K. L k). prob (?E' l))"
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   479
        using L K E' by (intro indep_setsD[OF indep]) (simp_all add: UN_mono)
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   480
      also have "\<dots> = (\<Prod>j\<in>K. \<Prod>l\<in>L j. prob (E' j l))"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57235
diff changeset
   481
        using K L L_inj by (subst setprod.UNION_disjoint) auto
42981
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   482
      also have "\<dots> = (\<Prod>j\<in>K. prob (A j))"
57418
6ab1c7cb0b8d fact consolidation
haftmann
parents: 57235
diff changeset
   483
        using K L E' by (auto simp add: A intro!: setprod.cong indep_setsD[OF indep, symmetric]) blast
42981
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   484
      finally show "prob (\<Inter>j\<in>K. A j) = (\<Prod>j\<in>K. prob (A j))" .
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   485
    qed
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   486
  next
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   487
    fix j assume "j \<in> J"
47694
05663f75964c reworked Probability theory
hoelzl
parents: 46731
diff changeset
   488
    show "Int_stable (?E j)"
42981
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   489
    proof (rule Int_stableI)
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   490
      fix a assume "a \<in> ?E j" then obtain Ka Ea
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   491
        where a: "a = (\<Inter>k\<in>Ka. Ea k)" "finite Ka" "Ka \<noteq> {}" "Ka \<subseteq> I j" "\<And>k. k\<in>Ka \<Longrightarrow> Ea k \<in> E k" by auto
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   492
      fix b assume "b \<in> ?E j" then obtain Kb Eb
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   493
        where b: "b = (\<Inter>k\<in>Kb. Eb k)" "finite Kb" "Kb \<noteq> {}" "Kb \<subseteq> I j" "\<And>k. k\<in>Kb \<Longrightarrow> Eb k \<in> E k" by auto
62343
24106dc44def prefer abbreviations for compound operators INFIMUM and SUPREMUM
haftmann
parents: 61808
diff changeset
   494
      let ?f = "\<lambda>k. (if k \<in> Ka \<inter> Kb then Ea k \<inter> Eb k else if k \<in> Kb then Eb k else if k \<in> Ka then Ea k else {})"
24106dc44def prefer abbreviations for compound operators INFIMUM and SUPREMUM
haftmann
parents: 61808
diff changeset
   495
      have "Ka \<union> Kb = (Ka \<inter> Kb) \<union> (Kb - Ka) \<union> (Ka - Kb)"
24106dc44def prefer abbreviations for compound operators INFIMUM and SUPREMUM
haftmann
parents: 61808
diff changeset
   496
        by blast
24106dc44def prefer abbreviations for compound operators INFIMUM and SUPREMUM
haftmann
parents: 61808
diff changeset
   497
      moreover have "(\<Inter>x\<in>Ka \<inter> Kb. Ea x \<inter> Eb x) \<inter>
24106dc44def prefer abbreviations for compound operators INFIMUM and SUPREMUM
haftmann
parents: 61808
diff changeset
   498
        (\<Inter>x\<in>Kb - Ka. Eb x) \<inter> (\<Inter>x\<in>Ka - Kb. Ea x) = (\<Inter>k\<in>Ka. Ea k) \<inter> (\<Inter>k\<in>Kb. Eb k)"
24106dc44def prefer abbreviations for compound operators INFIMUM and SUPREMUM
haftmann
parents: 61808
diff changeset
   499
        by auto
24106dc44def prefer abbreviations for compound operators INFIMUM and SUPREMUM
haftmann
parents: 61808
diff changeset
   500
      ultimately have "(\<Inter>k\<in>Ka \<union> Kb. ?f k) = (\<Inter>k\<in>Ka. Ea k) \<inter> (\<Inter>k\<in>Kb. Eb k)" (is "?lhs = ?rhs")
24106dc44def prefer abbreviations for compound operators INFIMUM and SUPREMUM
haftmann
parents: 61808
diff changeset
   501
        by (simp only: image_Un Inter_Un_distrib) simp
24106dc44def prefer abbreviations for compound operators INFIMUM and SUPREMUM
haftmann
parents: 61808
diff changeset
   502
      then have "a \<inter> b = (\<Inter>k\<in>Ka \<union> Kb. ?f k)"
24106dc44def prefer abbreviations for compound operators INFIMUM and SUPREMUM
haftmann
parents: 61808
diff changeset
   503
        by (simp only: a(1) b(1))
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61359
diff changeset
   504
      with a b \<open>j \<in> J\<close> Int_stableD[OF Int_stable] show "a \<inter> b \<in> ?E j"
62343
24106dc44def prefer abbreviations for compound operators INFIMUM and SUPREMUM
haftmann
parents: 61808
diff changeset
   505
        by (intro CollectI exI[of _ "Ka \<union> Kb"] exI[of _ ?f]) auto
42981
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   506
    qed
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   507
  qed
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   508
  ultimately show ?thesis
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   509
    by (simp cong: indep_sets_cong)
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   510
qed
fe7f5a26e4c6 add lemma indep_sets_collect_sigma
hoelzl
parents: 42861
diff changeset
   511
57235
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   512
lemma (in prob_space) indep_vars_restrict:
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   513
  assumes ind: "indep_vars M' X I" and K: "\<And>j. j \<in> L \<Longrightarrow> K j \<subseteq> I" and J: "disjoint_family_on K L"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   514
  shows "indep_vars (\<lambda>j. PiM (K j) M') (\<lambda>j \<omega>. restrict (\<lambda>i. X i \<omega>) (K j)) L"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   515
  unfolding indep_vars_def
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   516
proof safe
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   517
  fix j assume "j \<in> L" then show "random_variable (Pi\<^sub>M (K j) M') (\<lambda>\<omega>. \<lambda>i\<in>K j. X i \<omega>)"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   518
    using K ind by (auto simp: indep_vars_def intro!: measurable_restrict)
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   519
next
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   520
  have X: "\<And>i. i \<in> I \<Longrightarrow> X i \<in> measurable M (M' i)"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   521
    using ind by (auto simp: indep_vars_def)
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   522
  let ?proj = "\<lambda>j S. {(\<lambda>\<omega>. \<lambda>i\<in>K j. X i \<omega>) -` A \<inter> space M |A. A \<in> S}"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   523
  let ?UN = "\<lambda>j. sigma_sets (space M) (\<Union>i\<in>K j. { X i -` A \<inter> space M| A. A \<in> sets (M' i) })"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   524
  show "indep_sets (\<lambda>i. sigma_sets (space M) (?proj i (sets (Pi\<^sub>M (K i) M')))) L"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   525
  proof (rule indep_sets_mono_sets)
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   526
    fix j assume j: "j \<in> L"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   527
    have "sigma_sets (space M) (?proj j (sets (Pi\<^sub>M (K j) M'))) = 
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   528
      sigma_sets (space M) (sigma_sets (space M) (?proj j (prod_algebra (K j) M')))"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   529
      using j K X[THEN measurable_space] unfolding sets_PiM
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   530
      by (subst sigma_sets_vimage_commute) (auto simp add: Pi_iff)
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   531
    also have "\<dots> = sigma_sets (space M) (?proj j (prod_algebra (K j) M'))"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   532
      by (rule sigma_sets_sigma_sets_eq) auto
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   533
    also have "\<dots> \<subseteq> ?UN j"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   534
    proof (rule sigma_sets_mono, safe del: disjE elim!: prod_algebraE)
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   535
      fix J E assume J: "finite J" "J \<noteq> {} \<or> K j = {}"  "J \<subseteq> K j" and E: "\<forall>i. i \<in> J \<longrightarrow> E i \<in> sets (M' i)"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   536
      show "(\<lambda>\<omega>. \<lambda>i\<in>K j. X i \<omega>) -` prod_emb (K j) M' J (Pi\<^sub>E J E) \<inter> space M \<in> ?UN j"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   537
      proof cases
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   538
        assume "K j = {}" with J show ?thesis
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   539
          by (auto simp add: sigma_sets_empty_eq prod_emb_def)
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   540
      next
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   541
        assume "K j \<noteq> {}" with J have "J \<noteq> {}"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   542
          by auto
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   543
        { interpret sigma_algebra "space M" "?UN j"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   544
            by (rule sigma_algebra_sigma_sets) auto 
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   545
          have "\<And>A. (\<And>i. i \<in> J \<Longrightarrow> A i \<in> ?UN j) \<Longrightarrow> INTER J A \<in> ?UN j"
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61359
diff changeset
   546
            using \<open>finite J\<close> \<open>J \<noteq> {}\<close> by (rule finite_INT) blast }
57235
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   547
        note INT = this
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   548
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61359
diff changeset
   549
        from \<open>J \<noteq> {}\<close> J K E[rule_format, THEN sets.sets_into_space] j
57235
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   550
        have "(\<lambda>\<omega>. \<lambda>i\<in>K j. X i \<omega>) -` prod_emb (K j) M' J (Pi\<^sub>E J E) \<inter> space M
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   551
          = (\<Inter>i\<in>J. X i -` E i \<inter> space M)"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   552
          apply (subst prod_emb_PiE[OF _ ])
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   553
          apply auto []
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   554
          apply auto []
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   555
          apply (auto simp add: Pi_iff intro!: X[THEN measurable_space])
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   556
          apply (erule_tac x=i in ballE)
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   557
          apply auto
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   558
          done
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   559
        also have "\<dots> \<in> ?UN j"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   560
          apply (rule INT)
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   561
          apply (rule sigma_sets.Basic)
61808
fc1556774cfe isabelle update_cartouches -c -t;
wenzelm
parents: 61359
diff changeset
   562
          using \<open>J \<subseteq> K j\<close> E
57235
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   563
          apply auto
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   564
          done
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   565
        finally show ?thesis .
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   566
      qed
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   567
    qed
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   568
    finally show "sigma_sets (space M) (?proj j (sets (Pi\<^sub>M (K j) M'))) \<subseteq> ?UN j" .
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   569
  next
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   570
    show "indep_sets ?UN L"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   571
    proof (rule indep_sets_collect_sigma)
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   572
      show "indep_sets (\<lambda>i. {X i -` A \<inter> space M |A. A \<in> sets (M' i)}) (\<Union>j\<in>L. K j)"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   573
      proof (rule indep_sets_mono_index)
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   574
        show "indep_sets (\<lambda>i. {X i -` A \<inter> space M |A. A \<in> sets (M' i)}) I"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   575
          using ind unfolding indep_vars_def2 by auto
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   576
        show "(\<Union>l\<in>L. K l) \<subseteq> I"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   577
          using K by auto
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   578
      qed
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   579
    next
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   580
      fix l i assume "l \<in> L" "i \<in> K l"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   581
      show "Int_stable {X i -` A \<inter> space M |A. A \<in> sets (M' i)}"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   582
        apply (auto simp: Int_stable_def)
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   583
        apply (rule_tac x="A \<inter> Aa" in exI)
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   584
        apply auto
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   585
        done
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   586
    qed fact
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   587
  qed
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   588
qed
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   589
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   590
lemma (in prob_space) indep_var_restrict:
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   591
  assumes ind: "indep_vars M' X I" and AB: "A \<inter> B = {}" "A \<subseteq> I" "B \<subseteq> I"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   592
  shows "indep_var (PiM A M') (\<lambda>\<omega>. restrict (\<lambda>i. X i \<omega>) A) (PiM B M') (\<lambda>\<omega>. restrict (\<lambda>i. X i \<omega>) B)"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   593
proof -
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   594
  have *:
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   595
    "case_bool (Pi\<^sub>M A M') (Pi\<^sub>M B M') = (\<lambda>b. PiM (case_bool A B b) M')"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   596
    "case_bool (\<lambda>\<omega>. \<lambda>i\<in>A. X i \<omega>) (\<lambda>\<omega>. \<lambda>i\<in>B. X i \<omega>) = (\<lambda>b \<omega>. \<lambda>i\<in>case_bool A B b. X i \<omega>)"
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   597
    by (simp_all add: fun_eq_iff split: bool.split)
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   598
  show ?thesis
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   599
    unfolding indep_var_def * using AB
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   600
    by (intro indep_vars_restrict[OF ind]) (auto simp: disjoint_family_on_def split: bool.split)
b0b9a10e4bf4 properties of Erlang and exponentially distributed random variables (by Sudeep Kanav)
hoelzl
parents: 56154
diff changeset
   601
qed