| author | wenzelm | 
| Sat, 01 Apr 2023 19:15:38 +0200 | |
| changeset 77775 | 3cc55085d490 | 
| parent 75087 | f3fcc7c5a0db | 
| permissions | -rw-r--r-- | 
| 37665 | 1 | (* Title: HOL/Library/Indicator_Function.thy | 
| 2 | Author: Johannes Hoelzl (TU Muenchen) | |
| 3 | *) | |
| 4 | ||
| 60500 | 5 | section \<open>Indicator Function\<close> | 
| 37665 | 6 | |
| 7 | theory Indicator_Function | |
| 63099 
af0e964aad7b
Moved material from AFP/Randomised_Social_Choice to distribution
 eberlm parents: 
63092diff
changeset | 8 | imports Complex_Main Disjoint_Sets | 
| 37665 | 9 | begin | 
| 10 | ||
| 73536 | 11 | definition "indicator S x = of_bool (x \<in> S)" | 
| 37665 | 12 | |
| 67683 
817944aeac3f
Lots of new material about matrices, etc.
 paulson <lp15@cam.ac.uk> parents: 
64966diff
changeset | 13 | text\<open>Type constrained version\<close> | 
| 
817944aeac3f
Lots of new material about matrices, etc.
 paulson <lp15@cam.ac.uk> parents: 
64966diff
changeset | 14 | abbreviation indicat_real :: "'a set \<Rightarrow> 'a \<Rightarrow> real" where "indicat_real S \<equiv> indicator S" | 
| 
817944aeac3f
Lots of new material about matrices, etc.
 paulson <lp15@cam.ac.uk> parents: 
64966diff
changeset | 15 | |
| 37665 | 16 | lemma indicator_simps[simp]: | 
| 17 | "x \<in> S \<Longrightarrow> indicator S x = 1" | |
| 18 | "x \<notin> S \<Longrightarrow> indicator S x = 0" | |
| 19 | unfolding indicator_def by auto | |
| 20 | ||
| 45425 | 21 | lemma indicator_pos_le[intro, simp]: "(0::'a::linordered_semidom) \<le> indicator S x" | 
| 37665 | 22 | and indicator_le_1[intro, simp]: "indicator S x \<le> (1::'a::linordered_semidom)" | 
| 45425 | 23 | unfolding indicator_def by auto | 
| 24 | ||
| 25 | lemma indicator_abs_le_1: "\<bar>indicator S x\<bar> \<le> (1::'a::linordered_idom)" | |
| 37665 | 26 | unfolding indicator_def by auto | 
| 27 | ||
| 63309 | 28 | lemma indicator_eq_0_iff: "indicator A x = (0::'a::zero_neq_one) \<longleftrightarrow> x \<notin> A" | 
| 54408 | 29 | by (auto simp: indicator_def) | 
| 30 | ||
| 63309 | 31 | lemma indicator_eq_1_iff: "indicator A x = (1::'a::zero_neq_one) \<longleftrightarrow> x \<in> A" | 
| 54408 | 32 | by (auto simp: indicator_def) | 
| 33 | ||
| 63958 
02de4a58e210
HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
 hoelzl parents: 
63649diff
changeset | 34 | lemma indicator_UNIV [simp]: "indicator UNIV = (\<lambda>x. 1)" | 
| 
02de4a58e210
HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
 hoelzl parents: 
63649diff
changeset | 35 | by auto | 
| 
02de4a58e210
HOL-Analysis: add measurable sets with finite measures, prove affine transformation rule for the Lebesgue measure
 hoelzl parents: 
63649diff
changeset | 36 | |
| 63099 
af0e964aad7b
Moved material from AFP/Randomised_Social_Choice to distribution
 eberlm parents: 
63092diff
changeset | 37 | lemma indicator_leI: | 
| 63309 | 38 | "(x \<in> A \<Longrightarrow> y \<in> B) \<Longrightarrow> (indicator A x :: 'a::linordered_nonzero_semiring) \<le> indicator B y" | 
| 63099 
af0e964aad7b
Moved material from AFP/Randomised_Social_Choice to distribution
 eberlm parents: 
63092diff
changeset | 39 | by (auto simp: indicator_def) | 
| 
af0e964aad7b
Moved material from AFP/Randomised_Social_Choice to distribution
 eberlm parents: 
63092diff
changeset | 40 | |
| 57446 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 41 | lemma split_indicator: "P (indicator S x) \<longleftrightarrow> ((x \<in> S \<longrightarrow> P 1) \<and> (x \<notin> S \<longrightarrow> P 0))" | 
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 42 | unfolding indicator_def by auto | 
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 43 | |
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 44 | lemma split_indicator_asm: "P (indicator S x) \<longleftrightarrow> (\<not> (x \<in> S \<and> \<not> P 1 \<or> x \<notin> S \<and> \<not> P 0))" | 
| 37665 | 45 | unfolding indicator_def by auto | 
| 46 | ||
| 45425 | 47 | lemma indicator_inter_arith: "indicator (A \<inter> B) x = indicator A x * (indicator B x::'a::semiring_1)" | 
| 48 | unfolding indicator_def by (auto simp: min_def max_def) | |
| 49 | ||
| 63309 | 50 | lemma indicator_union_arith: | 
| 51 | "indicator (A \<union> B) x = indicator A x + indicator B x - indicator A x * (indicator B x :: 'a::ring_1)" | |
| 45425 | 52 | unfolding indicator_def by (auto simp: min_def max_def) | 
| 53 | ||
| 54 | lemma indicator_inter_min: "indicator (A \<inter> B) x = min (indicator A x) (indicator B x::'a::linordered_semidom)" | |
| 37665 | 55 | and indicator_union_max: "indicator (A \<union> B) x = max (indicator A x) (indicator B x::'a::linordered_semidom)" | 
| 45425 | 56 | unfolding indicator_def by (auto simp: min_def max_def) | 
| 57 | ||
| 63309 | 58 | lemma indicator_disj_union: | 
| 59 |   "A \<inter> B = {} \<Longrightarrow> indicator (A \<union> B) x = (indicator A x + indicator B x :: 'a::linordered_semidom)"
 | |
| 57446 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 60 | by (auto split: split_indicator) | 
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 61 | |
| 63309 | 62 | lemma indicator_compl: "indicator (- A) x = 1 - (indicator A x :: 'a::ring_1)" | 
| 63 | and indicator_diff: "indicator (A - B) x = indicator A x * (1 - indicator B x ::'a::ring_1)" | |
| 37665 | 64 | unfolding indicator_def by (auto simp: min_def max_def) | 
| 65 | ||
| 63309 | 66 | lemma indicator_times: | 
| 67 | "indicator (A \<times> B) x = indicator A (fst x) * (indicator B (snd x) :: 'a::semiring_1)" | |
| 37665 | 68 | unfolding indicator_def by (cases x) auto | 
| 69 | ||
| 63309 | 70 | lemma indicator_sum: | 
| 71 | "indicator (A <+> B) x = (case x of Inl x \<Rightarrow> indicator A x | Inr x \<Rightarrow> indicator B x)" | |
| 37665 | 72 | unfolding indicator_def by (cases x) auto | 
| 73 | ||
| 59002 
2c8b2fb54b88
cleaning up some theorem names; remove unnecessary assumptions; more complete pmf theory
 hoelzl parents: 
58881diff
changeset | 74 | lemma indicator_image: "inj f \<Longrightarrow> indicator (f ` X) (f x) = (indicator X x::_::zero_neq_one)" | 
| 64966 
d53d7ca3303e
added inj_def (redundant, analogous to surj_def, bij_def);
 wenzelm parents: 
64267diff
changeset | 75 | by (auto simp: indicator_def inj_def) | 
| 59002 
2c8b2fb54b88
cleaning up some theorem names; remove unnecessary assumptions; more complete pmf theory
 hoelzl parents: 
58881diff
changeset | 76 | |
| 61633 | 77 | lemma indicator_vimage: "indicator (f -` A) x = indicator A (f x)" | 
| 63309 | 78 | by (auto split: split_indicator) | 
| 61633 | 79 | |
| 73928 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73536diff
changeset | 80 | lemma mult_indicator_cong: | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73536diff
changeset | 81 | fixes f g :: "_ \<Rightarrow> 'a :: semiring_1" | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73536diff
changeset | 82 | shows "(\<And>x. x \<in> A \<Longrightarrow> f x = g x) \<Longrightarrow> indicator A x * f x = indicator A x * g x" | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73536diff
changeset | 83 | by (auto simp: indicator_def) | 
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73536diff
changeset | 84 | |
| 
3b76524f5a85
Imported lots of material from Stirling_Formula/Gamma_Asymptotics
 paulson <lp15@cam.ac.uk> parents: 
73536diff
changeset | 85 | lemma | 
| 63309 | 86 | fixes f :: "'a \<Rightarrow> 'b::semiring_1" | 
| 87 | assumes "finite A" | |
| 64267 | 88 | shows sum_mult_indicator[simp]: "(\<Sum>x \<in> A. f x * indicator B x) = (\<Sum>x \<in> A \<inter> B. f x)" | 
| 89 | and sum_indicator_mult[simp]: "(\<Sum>x \<in> A. indicator B x * f x) = (\<Sum>x \<in> A \<inter> B. f x)" | |
| 37665 | 90 | unfolding indicator_def | 
| 64267 | 91 | using assms by (auto intro!: sum.mono_neutral_cong_right split: if_split_asm) | 
| 37665 | 92 | |
| 64267 | 93 | lemma sum_indicator_eq_card: | 
| 37665 | 94 | assumes "finite A" | 
| 61954 | 95 | shows "(\<Sum>x \<in> A. indicator B x) = card (A Int B)" | 
| 64267 | 96 | using sum_mult_indicator [OF assms, of "\<lambda>x. 1::nat"] | 
| 97 | unfolding card_eq_sum by simp | |
| 37665 | 98 | |
| 64267 | 99 | lemma sum_indicator_scaleR[simp]: | 
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
54408diff
changeset | 100 | "finite A \<Longrightarrow> | 
| 63309 | 101 |     (\<Sum>x \<in> A. indicator (B x) (g x) *\<^sub>R f x) = (\<Sum>x \<in> {x\<in>A. g x \<in> B x}. f x :: 'a::real_vector)"
 | 
| 64267 | 102 | by (auto intro!: sum.mono_neutral_cong_right split: if_split_asm simp: indicator_def) | 
| 56993 
e5366291d6aa
introduce Bochner integral: generalizes Lebesgue integral from real-valued function to functions on real-normed vector spaces
 hoelzl parents: 
54408diff
changeset | 103 | |
| 57446 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 104 | lemma LIMSEQ_indicator_incseq: | 
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 105 | assumes "incseq A" | 
| 73536 | 106 |   shows "(\<lambda>i. indicator (A i) x :: 'a::{topological_space,zero_neq_one}) \<longlonglongrightarrow> indicator (\<Union>i. A i) x"
 | 
| 63309 | 107 | proof (cases "\<exists>i. x \<in> A i") | 
| 108 | case True | |
| 57446 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 109 | then obtain i where "x \<in> A i" | 
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 110 | by auto | 
| 63649 | 111 | then have *: | 
| 57446 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 112 | "\<And>n. (indicator (A (n + i)) x :: 'a) = 1" | 
| 60585 | 113 | "(indicator (\<Union>i. A i) x :: 'a) = 1" | 
| 60500 | 114 | using incseqD[OF \<open>incseq A\<close>, of i "n + i" for n] \<open>x \<in> A i\<close> by (auto simp: indicator_def) | 
| 63649 | 115 | show ?thesis | 
| 116 | by (rule LIMSEQ_offset[of _ i]) (use * in simp) | |
| 63309 | 117 | next | 
| 118 | case False | |
| 119 | then show ?thesis by (simp add: indicator_def) | |
| 120 | qed | |
| 57446 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 121 | |
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 122 | lemma LIMSEQ_indicator_UN: | 
| 73536 | 123 |   "(\<lambda>k. indicator (\<Union>i<k. A i) x :: 'a::{topological_space,zero_neq_one}) \<longlonglongrightarrow> indicator (\<Union>i. A i) x"
 | 
| 57446 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 124 | proof - | 
| 61969 | 125 | have "(\<lambda>k. indicator (\<Union>i<k. A i) x::'a) \<longlonglongrightarrow> indicator (\<Union>k. \<Union>i<k. A i) x" | 
| 57446 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 126 | by (intro LIMSEQ_indicator_incseq) (auto simp: incseq_def intro: less_le_trans) | 
| 60585 | 127 | also have "(\<Union>k. \<Union>i<k. A i) = (\<Union>i. A i)" | 
| 57446 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 128 | by auto | 
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 129 | finally show ?thesis . | 
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 130 | qed | 
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 131 | |
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 132 | lemma LIMSEQ_indicator_decseq: | 
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 133 | assumes "decseq A" | 
| 73536 | 134 |   shows "(\<lambda>i. indicator (A i) x :: 'a::{topological_space,zero_neq_one}) \<longlonglongrightarrow> indicator (\<Inter>i. A i) x"
 | 
| 63309 | 135 | proof (cases "\<exists>i. x \<notin> A i") | 
| 136 | case True | |
| 57446 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 137 | then obtain i where "x \<notin> A i" | 
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 138 | by auto | 
| 63649 | 139 | then have *: | 
| 57446 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 140 | "\<And>n. (indicator (A (n + i)) x :: 'a) = 0" | 
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 141 | "(indicator (\<Inter>i. A i) x :: 'a) = 0" | 
| 60500 | 142 | using decseqD[OF \<open>decseq A\<close>, of i "n + i" for n] \<open>x \<notin> A i\<close> by (auto simp: indicator_def) | 
| 63649 | 143 | show ?thesis | 
| 144 | by (rule LIMSEQ_offset[of _ i]) (use * in simp) | |
| 63309 | 145 | next | 
| 146 | case False | |
| 147 | then show ?thesis by (simp add: indicator_def) | |
| 148 | qed | |
| 57446 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 149 | |
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 150 | lemma LIMSEQ_indicator_INT: | 
| 73536 | 151 |   "(\<lambda>k. indicator (\<Inter>i<k. A i) x :: 'a::{topological_space,zero_neq_one}) \<longlonglongrightarrow> indicator (\<Inter>i. A i) x"
 | 
| 57446 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 152 | proof - | 
| 61969 | 153 | have "(\<lambda>k. indicator (\<Inter>i<k. A i) x::'a) \<longlonglongrightarrow> indicator (\<Inter>k. \<Inter>i<k. A i) x" | 
| 57446 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 154 | by (intro LIMSEQ_indicator_decseq) (auto simp: decseq_def intro: less_le_trans) | 
| 60585 | 155 | also have "(\<Inter>k. \<Inter>i<k. A i) = (\<Inter>i. A i)" | 
| 57446 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 156 | by auto | 
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 157 | finally show ?thesis . | 
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 158 | qed | 
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 159 | |
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 160 | lemma indicator_add: | 
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 161 |   "A \<inter> B = {} \<Longrightarrow> (indicator A x::_::monoid_add) + indicator B x = indicator (A \<union> B) x"
 | 
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 162 | unfolding indicator_def by auto | 
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 163 | |
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 164 | lemma of_real_indicator: "of_real (indicator A x) = indicator A x" | 
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 165 | by (simp split: split_indicator) | 
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 166 | |
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 167 | lemma real_of_nat_indicator: "real (indicator A x :: nat) = indicator A x" | 
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 168 | by (simp split: split_indicator) | 
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 169 | |
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 170 | lemma abs_indicator: "\<bar>indicator A x :: 'a::linordered_idom\<bar> = indicator A x" | 
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 171 | by (simp split: split_indicator) | 
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 172 | |
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 173 | lemma mult_indicator_subset: | 
| 63309 | 174 | "A \<subseteq> B \<Longrightarrow> indicator A x * indicator B x = (indicator A x :: 'a::comm_semiring_1)" | 
| 57446 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 175 | by (auto split: split_indicator simp: fun_eq_iff) | 
| 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 176 | |
| 70381 
b151d1f00204
More results about measure and integration theory
 paulson <lp15@cam.ac.uk> parents: 
69313diff
changeset | 177 | lemma indicator_times_eq_if: | 
| 
b151d1f00204
More results about measure and integration theory
 paulson <lp15@cam.ac.uk> parents: 
69313diff
changeset | 178 | fixes f :: "'a \<Rightarrow> 'b::comm_ring_1" | 
| 
b151d1f00204
More results about measure and integration theory
 paulson <lp15@cam.ac.uk> parents: 
69313diff
changeset | 179 | shows "indicator S x * f x = (if x \<in> S then f x else 0)" "f x * indicator S x = (if x \<in> S then f x else 0)" | 
| 
b151d1f00204
More results about measure and integration theory
 paulson <lp15@cam.ac.uk> parents: 
69313diff
changeset | 180 | by auto | 
| 
b151d1f00204
More results about measure and integration theory
 paulson <lp15@cam.ac.uk> parents: 
69313diff
changeset | 181 | |
| 
b151d1f00204
More results about measure and integration theory
 paulson <lp15@cam.ac.uk> parents: 
69313diff
changeset | 182 | lemma indicator_scaleR_eq_if: | 
| 
b151d1f00204
More results about measure and integration theory
 paulson <lp15@cam.ac.uk> parents: 
69313diff
changeset | 183 | fixes f :: "'a \<Rightarrow> 'b::real_vector" | 
| 
b151d1f00204
More results about measure and integration theory
 paulson <lp15@cam.ac.uk> parents: 
69313diff
changeset | 184 | shows "indicator S x *\<^sub>R f x = (if x \<in> S then f x else 0)" | 
| 
b151d1f00204
More results about measure and integration theory
 paulson <lp15@cam.ac.uk> parents: 
69313diff
changeset | 185 | by simp | 
| 
b151d1f00204
More results about measure and integration theory
 paulson <lp15@cam.ac.uk> parents: 
69313diff
changeset | 186 | |
| 62648 | 187 | lemma indicator_sums: | 
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57446diff
changeset | 188 |   assumes "\<And>i j. i \<noteq> j \<Longrightarrow> A i \<inter> A j = {}"
 | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57446diff
changeset | 189 | shows "(\<lambda>i. indicator (A i) x::real) sums indicator (\<Union>i. A i) x" | 
| 63309 | 190 | proof (cases "\<exists>i. x \<in> A i") | 
| 191 | case True | |
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57446diff
changeset | 192 | then obtain i where i: "x \<in> A i" .. | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57446diff
changeset | 193 |   with assms have "(\<lambda>i. indicator (A i) x::real) sums (\<Sum>i\<in>{i}. indicator (A i) x)"
 | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57446diff
changeset | 194 | by (intro sums_finite) (auto split: split_indicator) | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57446diff
changeset | 195 |   also have "(\<Sum>i\<in>{i}. indicator (A i) x) = indicator (\<Union>i. A i) x"
 | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57446diff
changeset | 196 | using i by (auto split: split_indicator) | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57446diff
changeset | 197 | finally show ?thesis . | 
| 63309 | 198 | next | 
| 199 | case False | |
| 200 | then show ?thesis by simp | |
| 201 | qed | |
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57446diff
changeset | 202 | |
| 63099 
af0e964aad7b
Moved material from AFP/Randomised_Social_Choice to distribution
 eberlm parents: 
63092diff
changeset | 203 | text \<open> | 
| 63309 | 204 | The indicator function of the union of a disjoint family of sets is the | 
| 63099 
af0e964aad7b
Moved material from AFP/Randomised_Social_Choice to distribution
 eberlm parents: 
63092diff
changeset | 205 | sum over all the individual indicators. | 
| 
af0e964aad7b
Moved material from AFP/Randomised_Social_Choice to distribution
 eberlm parents: 
63092diff
changeset | 206 | \<close> | 
| 63309 | 207 | |
| 63099 
af0e964aad7b
Moved material from AFP/Randomised_Social_Choice to distribution
 eberlm parents: 
63092diff
changeset | 208 | lemma indicator_UN_disjoint: | 
| 69313 | 209 | "finite A \<Longrightarrow> disjoint_family_on f A \<Longrightarrow> indicator (\<Union>(f ` A)) x = (\<Sum>y\<in>A. indicator (f y) x)" | 
| 63309 | 210 | by (induct A rule: finite_induct) | 
| 75087 | 211 | (auto simp: disjoint_family_on_def indicator_def split: if_splits split_of_bool_asm) | 
| 63099 
af0e964aad7b
Moved material from AFP/Randomised_Social_Choice to distribution
 eberlm parents: 
63092diff
changeset | 212 | |
| 57446 
06e195515deb
some lemmas about the indicator function; removed lemma sums_def2
 hoelzl parents: 
57418diff
changeset | 213 | end |