Inclusion-exclusion principle #
This file proves several variants of the inclusion-exclusion principle.
The inclusion-exclusion principle says that the sum/integral of a function over a finite union of
sets can be calculated as the alternating sum over n > 0
of the sum/integral of the function over
the intersection of n
of the sets.
By taking complements, it also says that the sum/integral of a function over a finite intersection
of complements of sets can be calculated as the alternating sum over n ≥ 0
of the sum/integral of
the function over the intersection of n
of the sets.
By taking the function to be constant 1
, we instead get a result about the cardinality/measure of
the sets.
Main declarations #
Per the above explanation, this file contains the following variants of inclusion-exclusion:
Finset.inclusion_exclusion_sum_biUnion
: Sum of a function over a finite union of setsFinset.inclusion_exclusion_card_biUnion
: Cardinality of a finite union of setsFinset.inclusion_exclusion_sum_inf_compl
: Sum of a function over a finite intersection of complements of setsFinset.inclusion_exclusion_card_inf_compl
: Cardinality of a finite intersection of complements of sets
TODO #
- Use (a slight variant of)
Finset.prod_indicator_biUnion_sub_indicator
to prove the integral version of inclusion-exclusion. - Prove that truncating the series alternatively gives an upper/lower bound to the true value.
Inclusion-exclusion principle for the sum of a function over a union.
The sum of a function f
over the union of the S i
over i ∈ s
is the alternating sum of the
sums of f
over the intersections of the S i
.
Inclusion-exclusion principle for the cardinality of a union.
The cardinality of the union of the S i
over i ∈ s
is the alternating sum of the cardinalities
of the intersections of the S i
.
Inclusion-exclusion principle for the sum of a function over an intersection of complements.
The sum of a function f
over the intersection of the complements of the S i
over i ∈ s
is the
alternating sum of the sums of f
over the intersections of the S i
.
Inclusion-exclusion principle for the cardinality of an intersection of complements.
The cardinality of the intersection of the complements of the S i
over i ∈ s
is the
alternating sum of the cardinalities of the intersections of the S i
.