equal
deleted
inserted
replaced
3 *) |
3 *) |
4 |
4 |
5 section \<open>Indicator Function\<close> |
5 section \<open>Indicator Function\<close> |
6 |
6 |
7 theory Indicator_Function |
7 theory Indicator_Function |
8 imports Complex_Main |
8 imports Complex_Main Disjoint_Sets |
9 begin |
9 begin |
10 |
10 |
11 definition "indicator S x = (if x \<in> S then 1 else 0)" |
11 definition "indicator S x = (if x \<in> S then 1 else 0)" |
12 |
12 |
13 lemma indicator_simps[simp]: |
13 lemma indicator_simps[simp]: |
24 |
24 |
25 lemma indicator_eq_0_iff: "indicator A x = (0::_::zero_neq_one) \<longleftrightarrow> x \<notin> A" |
25 lemma indicator_eq_0_iff: "indicator A x = (0::_::zero_neq_one) \<longleftrightarrow> x \<notin> A" |
26 by (auto simp: indicator_def) |
26 by (auto simp: indicator_def) |
27 |
27 |
28 lemma indicator_eq_1_iff: "indicator A x = (1::_::zero_neq_one) \<longleftrightarrow> x \<in> A" |
28 lemma indicator_eq_1_iff: "indicator A x = (1::_::zero_neq_one) \<longleftrightarrow> x \<in> A" |
|
29 by (auto simp: indicator_def) |
|
30 |
|
31 lemma indicator_leI: |
|
32 "(x \<in> A \<Longrightarrow> y \<in> B) \<Longrightarrow> (indicator A x :: 'a :: linordered_nonzero_semiring) \<le> indicator B y" |
29 by (auto simp: indicator_def) |
33 by (auto simp: indicator_def) |
30 |
34 |
31 lemma split_indicator: "P (indicator S x) \<longleftrightarrow> ((x \<in> S \<longrightarrow> P 1) \<and> (x \<notin> S \<longrightarrow> P 0))" |
35 lemma split_indicator: "P (indicator S x) \<longleftrightarrow> ((x \<in> S \<longrightarrow> P 1) \<and> (x \<notin> S \<longrightarrow> P 0))" |
32 unfolding indicator_def by auto |
36 unfolding indicator_def by auto |
33 |
37 |
159 also have "(\<Sum>i\<in>{i}. indicator (A i) x) = indicator (\<Union>i. A i) x" |
163 also have "(\<Sum>i\<in>{i}. indicator (A i) x) = indicator (\<Union>i. A i) x" |
160 using i by (auto split: split_indicator) |
164 using i by (auto split: split_indicator) |
161 finally show ?thesis . |
165 finally show ?thesis . |
162 qed simp |
166 qed simp |
163 |
167 |
|
168 text \<open> |
|
169 The indicator function of the union of a disjoint family of sets is the |
|
170 sum over all the individual indicators. |
|
171 \<close> |
|
172 lemma indicator_UN_disjoint: |
|
173 assumes "finite A" "disjoint_family_on f A" |
|
174 shows "indicator (UNION A f) x = (\<Sum>y\<in>A. indicator (f y) x)" |
|
175 using assms by (induction A rule: finite_induct) |
|
176 (auto simp: disjoint_family_on_def indicator_def split: if_splits) |
|
177 |
164 end |
178 end |