For bounded weak compositions, start with the unrestricted stars and bars set and let be its subset where . For an index subset , subtract from each coordinate with . This is a bijection from to nonnegative tuples summing to
Thus
where a negative remaining sum gives zero, in accordance with the stipulated convention. Apply the avoidance form of the inclusion-exclusion principle:
Expanding by subset size gives the alternating single-index, pair-index and higher-index sums. The empty subset supplies .
For finitely many finite sets , the inclusion-exclusion principle states
To see why, an element belonging to exactly of the sets contributes
by the binomial theorem. Elements outside the union contribute zero. Equivalently, if these sets lie in a finite universe , the number avoiding all of them is
In the ambient set of all functions from to itself, let be the forbidden event . Apply the avoidance form of the inclusion-exclusion principle from part (i).
For a proper subset of the cyclic difference constraints, with , the selected edges form disjoint paths around the cycle, including isolated vertices. There are components. On each component, choosing one value of arbitrarily determines all the other values by the prescribed differences. No consistency condition occurs because the cycle has been broken. Therefore
This also works for , whose two directed constraints use the same pair of vertices: any single constraint leaves one freely chosen value.
If all constraints hold, summing them around the cycle gives the necessary condition
It holds when is odd and fails when is even, the latter sum being congruent to . When it holds, choose in ways and determine every other value; the final constraint is then consistent. Thus the full intersection has size for odd and for even .
There are subsets of size . By the binomial theorem,
Hence the number of admissible functions is
For finite sets , the inclusion-exclusion principle states
To prove it, count the contribution of one element. If it belongs to exactly of the sets, it is counted by intersections of size . Its total weight is
using the binomial theorem. An element belonging to none contributes zero. Summing these weights gives the cardinality of the union and proves the inclusion-exclusion principle. Equivalently, within a finite ambient set , the number avoiding every is the sum over all , with sign and the empty intersection interpreted as .
For a finite family of subsets of a finite set , the inclusion-exclusion principle states
Let be the set of permutations with the two-cycle in their cycle decomposition of a permutation. Two distinct specified pairs sharing a label cannot both occur, so their intersection is empty. An intersection containing pairwise disjoint specified pairs fixes those labels and leaves choices for the other labels.
The number of ways to choose disjoint unordered pairs is : first order the selected labels, then divide by the two orders within each pair, by the orders of the pairs, and by the orders of the unused labels. Applying inclusion-exclusion to the complement of the union yields the count of permutations without two-cycles:
The term is . Fixed points and cycles of length at least three are allowed; the restriction concerns two-cycles, not whether a permutation can be expressed as a product of transpositions.
Dividing by gives partial sums of the absolutely convergent exponential series, so
For finite sets , the inclusion-exclusion principle states
It counts each element once: an element in exactly of the sets contributes , by the binomial theorem.
For the cyclic digit run problem, let mean that the three digits starting at position form a run, for . Every run of length at least three contains one of these triples, so we need . Introduce the five differences
A starting digit and these five residues determine a unique string, including runs that cross and . In these coordinates requires or .
Each single event fixes two differences, with two choices of sign; the initial digit and the other three differences are free. Thus . For intersections of two events, adjacent starting positions force three consecutive differences to have the same sign, giving . There are three such pairs. The other three pairs have disjoint constrained difference positions, with independent signs and one free difference, giving each. Consequently the sum of pair-intersection sizes is .
For triple intersections, and each force four consecutive differences to have the same sign, leaving one free difference, and each has size . The other two triples, and , divide the five differences into two blocks with independent signs; each has size . The triple-intersection sum is therefore . Finally, all four events force all five differences to have the same sign, giving strings.
The inclusion-exclusion principle now gives the number of strings
Using differences makes the overlap conditions explicit and prevents double-counting long cyclic digit runs.
Let , and take another admissible compact H-hull in the image complex upper half-plane. Form the hull , including its relative closure and filling bounded complementary components if needed. Its mapping-out function of a compact H-hull is
Indeed, this composition maps the correct remaining domain onto , and its constant term at infinity is zero. Since , the chain rule gives
Both derivatives are positive by local Schwarz reflection principle and boundary orientation. Therefore the assumed avoidance formula gives
The conditioning event has positive probability because .
It remains to justify that these equalities determine the law. For a proper simple curve from to infinity, its complement has two sides, each connected to an interval of the real boundary. Any point off the curve lies in a thin polygonal tube attached to that boundary which avoids both the curve and zero; its closure, with an end cap, is an admissible compact H-hull. A countable collection of tubes with rational geometry therefore reconstructs the complement as the union of the tubes avoided by the curve.
The joint distribution of their avoidance indicators is also determined. Avoiding finitely many tubes is equivalent to avoiding the filled union when that union is admissible. If the union separates from infinity, avoidance is impossible and the joint probability is zero. Otherwise a simple curve cannot enter the bounded complementary pockets without crossing the union, so filling does not change the avoidance event. Finite joint avoidance probabilities consequently come from the same single-hull formulas; inclusion-exclusion principle supplies every finite indicator pattern. These patterns determine the random complement and hence the unparameterized simple trace.
Thus avoidance probabilities determine a simple chordal curve law, and the conditional image law above equals the original law. This proves the derivative avoidance criterion for chordal restriction, giving the chordal restriction property. Simplicity is essential to this reconstruction argument; it should not be replaced by a claim that arbitrary random closed sets are determined by these hull-avoidance tests.
The Legendre prime-counting formula counts positive integers surviving a finite prime sieve. For , put and let be the primes at most . By inclusion-exclusion principle, the number of positive integers at most divisible by none of these primes is
The empty product is . Every composite number at most has a prime factor at most , so the survivors are precisely and the primes between and . Consequently
For , the sieving primes are , and
As a direct check, the primes are .