For finite sets , the inclusion-exclusion principle states
To prove it, count one element at a time. An element belonging to exactly of the sets occurs in of their -fold intersections, so its total coefficient on the right is , using . An element in no set has coefficient zero. Every element of the union is therefore counted once, proving the identity.
For the keypad, an initial zero can never be entered: it has no preceding pair of ones and the first key is not two. Define four classes of valid four-digit sequences. Let contain sequences starting with two, with the last three digits arbitrary; let contain sequences with no zeros; let contain sequences of the form with ; and let contain sequences with .
These classes exhaust the valid codes. A sequence starting with two is unrestricted thereafter. Otherwise a zero cannot occur in position two, a zero in position three requires the first two digits to be ones, and a zero in position four requires digits two and three to be ones. Positions three and four cannot both be zero, since the last zero would then lack the required preceding pair. Thus a code outside either belongs to or has precisely one of the zero patterns covered by .
Their sizes are
The only nonempty pairwise intersections are , consisting of first digit two and three nonzero remaining digits, and , containing the single code . Hence and . All other pairwise intersections vanish, and therefore so do all intersections of three or four classes. Applying inclusion-exclusion gives
This counts sequences actually enterable under the history-dependent zero-key rule, rather than simply counting sequences which contain the substring .
A real sequence converges to if, for every , there is an integer such that for every . A convergent series is one whose partial sums converge to a finite real limit.
If , then . This necessary condition is the term test for divergence. Its converse fails: the harmonic series has terms but diverges. For a direct proof, each block from to contains terms each at least , so contributes at least . Infinitely many such blocks make the partial sums unbounded.
For the positive sequences in the final request, the inequality makes decreasing and bounded below by zero. The bounded monotone sequence theorem gives . Summing the decrements gives
Suppose . Since , this implies
But clipping preserves divergence of a positive series: if infinitely many , the clipped series has infinitely many terms equal to ; otherwise its tail equals the divergent tail of . Either case contradicts the displayed bound. Hence the only possible limit is
This proves the minimum-decrement convergence criterion without assuming that the divergent positive sequence itself tends to zero.
We use these countability facts: the integers are countable; a finite Cartesian product of countable sets is countable; a countable union of countable sets is countable; and every subset of a countable set is countable. Finite products can be enumerated by listing index tuples in increasing maximum coordinate, and countable unions by diagonal enumeration of pairs of indices.
Fix . For each degree bound , there are finitely many monomials with . An integer polynomial of total degree at most is specified by an integer coefficient for each of them, so these polynomials form a finite Cartesian product of copies of and are countable. Every polynomial has some finite degree bound. Taking the union over proves the countability of integer polynomial rings:
It is infinite because it contains all integer constant polynomials.
For , each nonzero polynomial has only finitely many real roots: repeated application of the factor theorem bounds their number by its degree. The real algebraic numbers are the union of these finite root sets over the countably many nonzero integer polynomials. Thus they are countable. If the real transcendental numbers were countable too, their union with the algebraic numbers would make countable, contrary to the allowed uncountability assumption. Hence there are uncountably many real transcendental numbers.
To construct an algebraically independent real sequence, choose outside the algebraic numbers. Suppose already satisfy the required nonvanishing condition. For each nonzero , write
At least one coefficient polynomial is nonzero, and the inductive hypothesis makes its value at nonzero. Consequently is a nonzero one-variable polynomial and has only finitely many real roots. There are countably many choices of , so the union of all these forbidden roots is countable. Choose outside it, which is possible because is uncountable. This extends the nonvanishing condition to . Recursion therefore gives
In particular the chosen numbers are distinct, since a relation is forbidden. Clearing rational denominators shows that every finite initial segment consists of algebraically independent elements over .
For finite sets , the inclusion-exclusion principle states
To prove it, consider an element belonging to exactly of the sets. If , it contributes zero to both sides. If , its contribution on the right is
which is its contribution to the union. Summing these contributions proves the formula.
For the keypad, a first digit zero cannot be entered. Define four families of valid codes: consists of all codes with no zero; consists of codes beginning with ; consists of with ; and consists of with . They cover every valid code. Indeed, if the first digit is not , a zero in the second position is impossible; a zero in the third requires the prefix ; a zero in the fourth requires the middle pair . In the third-position case the last digit cannot also be zero. Hence the only remaining zero-containing possibilities are exactly and .
Their cardinalities are
The only nonempty pairwise intersections are , with codes, and , with one code. All triple and fourfold intersections are empty. Applying inclusion-exclusion therefore gives
The restriction concerns actual preceding keypresses. It cannot license two successive zeros unless the first-key condition is already satisfied.

There are unlisted articles, also show them or only show them.