Lesson 8
Permutations
Taught
Permutations
A bijection from a set to itself maps the set onto itself and may rearrange its elements. Counting was the first thing we did with finite sets, and the second is this: fix the set and ask in how many ways its points can be rearranged among themselves. The rearranging functions can be composed, and this chapter studies that composition.
Two-Row Notation
Let be a set. A permutation of is a bijection .
When is finite and non-empty a permutation is settled by naming the value it takes at each point, and there are only finitely many points to name. So the whole function fits in a table of two rows: the points along the top, their values underneath.
Definition 8.2 (Blocks and -sets).
For write
so that . A finite set with cardinality is an -set, and a subset of a set that is itself a -set is a -subset of it.
The block counts as the cut does: is a bijection from onto , injective by uniqueness of differences and surjective because every positive number is a successor. So , and an -set is exactly a set equinumerous with . We take the block rather than the cut as the standing domain here only because it makes the tables below read as they do everywhere else, starting at one.
Definition 8.3 (Two-row notation).
Let be an -set with , let be a listing of its elements, and let be a permutation of . Write
for the permutation sending each to . The columns may be reordered at will: any listing of the domain along the top, with the matching values underneath, denotes the same function.
The last sentence is equality of functions and nothing more. A table names a function by naming its value at each point, and the order in which the points are named is no part of the function.
Example 8.4 (A permutation of four points).
On the rule , , , is the permutation
the second table being the first with its columns shuffled. A two-row table fails to describe a permutation exactly when its bottom row is not a rearrangement of its top: a repeated value breaks injectivity, and a missing one breaks surjectivity.
Definition 8.5 (The symmetric group).
The set of all permutations of a set is written and called the symmetric group on . When one writes rather than .
The word group is traditional and we use it as a name only. What stands behind it is that carries a multiplication and is closed under composition and inverses: composition sends bijections to bijections, the identity map is a bijection since it is its own inverse, and the inverse of a bijection is a bijection. No abstract definition of a group is needed below; we use only the set and its composition.
Working in rather than in for an arbitrary -set loses nothing. A listing of is a bijection , and carries permutations of to permutations of , reversibly. That is what two-row notation already does silently when it writes the points in a row.
Definition 8.6 (Product of permutations).
Let . The product is the composite , so that
One applies first and second. The permutations and are the factors of the product.
Example 8.7 (Multiplying in ).
Take
in . To compute , follow each point through and then through :
so that
the second computed the same way in the other order. So : the multiplication is not commutative, though particular pairs may commute.
Remark (Authors who read left to right).
Some texts write the value of a function to the right of its argument, in place of , and then read a product left to right. We keep the order fixed for composition, so always means ” first, then ”. When reading another source, work one product out by hand before trusting its convention.
The bottom row of a two-row table for an element of is a rearrangement of , and conversely each rearrangement of is the bottom row of exactly one element of , the one whose top row runs in ascending order. So is matched point for point with the orderings of , which is why permutations are so often described as arrangements rather than as functions.
Permutations describe any situation in which objects trade places, one object to a place. Number the places through ; a process that carries whatever sits in place to place is recorded by the permutation with , and performing two such processes in turn is recorded by the product.
Every set has two permutations we already know. One is the identity, a bijection because it is its own inverse. The other is the transposition of the counting chapter, which exchanges and and fixes every other point; it is its own inverse, hence a permutation of whatever set it is defined on. So is never empty, and holds more than one element as soon as holds two distinct points.
Write out every element of and of in two-row notation, with the top row ascending, and check that you have two and six of them respectively.
With and as in the example of multiplication in , compute and , and decide whether either is the identity. Compute and and observe that they differ.
Let be a set and let be a bijection. Show that is a bijection from onto , and that it carries products to products.
Counting Permutations
The theorem on cardinality of a product already suggests how many bijections run between two -sets: values are available for the first point, then for the second once the first is used, and so on down. The shorthand for that descending product is the factorial.
Define for by the recursion
so that for . The number is the factorial of .
That the recursion defines exactly one function is the recursion theorem, applied as it was for addition. The value is the empty product, chosen for the same reason the empty sum is : it starts the recursion, and it spares us a separate case in every count below.
Theorem 8.9 (Number of bijections between -sets).
Let and be -sets for some . Then there are exactly bijections from to . In particular , and the empty set has exactly one permutation, in agreement with .
Discussion.
The claim is a counting statement about a set we have not yet named: writing for the set of bijections , we must show . The factorial was defined by a recursion on , so the proof is an induction on whose step must produce the factor . At both sets are empty and the empty function is the only function between them, so there is one, which is . For the step we split according to where a chosen point of goes: there are possible values, the pieces of the split are pairwise disjoint and cover , and each piece is matched with the bijections between two -sets by restricting to what is left of . By the inductive hypothesis each piece has elements, and the cardinality of a product gives the total , which is the recursion clause for the factorial.
Proof.
We induct on . If then , and the empty function is the only function ; it is a bijection, so there is of them.
Suppose the claim holds for all pairs of -sets, and let . Fix and, for each , let be the set of bijections with . Every bijection lies in exactly one , namely the one indexed by its value at , so the are pairwise disjoint and their union is .
Fix . Restriction to carries a member of to a bijection , by the proposition that bijections remove points; and every such bijection extends to exactly one member of , by sending to . So is matched with the set of bijections between two -sets, which the inductive hypothesis counts as , and .
The index set is an -set, so is a union of pairwise disjoint sets each of cardinality ; matching it with and applying the cardinality of a product gives
which is the claim at . Taking gives .
Example 8.10 (The sets , and ).
holds only the identity on . holds the two elements
and holds :
Without the theorem one would need care to be sure such a list is complete; with it, six is enough.
Example 8.11 (Selections and orderings).
A competition offers five water events, six running events, four cycling events and seven self-defence events. One event may be chosen from each category in ways, by the cardinality of a product applied three times. If a competitor also fixes the order in which to attempt the four chosen events, each selection admits orders, so there are full programmes.
Example 8.12 (Non-attacking rooks).
Eight rooks stand on a chessboard with no two attacking, which means no two share a row or a column, since a rook commands both. Each row holds at most one rook and there are eight rooks for eight rows, so every row holds exactly one; the same count puts exactly one in each column. Let be the column of the rook in row . The column condition says precisely that is injective, hence a permutation of by the theorem that injective and bijective agree on a finite set; and conversely each places one rook in each row, in the columns , no two equal. So the acceptable positions are matched with , and there are of them.
If the rooks are told apart, say by eight colours, choose the squares first in ways and then distribute the colours over them in ways, for arrangements.
Seven beads of distinct colours are strung on a cord whose ends are then tied, and two necklaces count as the same when one can be turned or flipped into the other. Before the knot the beads lie in a row, and there are rows. Fix one necklace and ask how many rows display it: choose which bead is to sit at the left end, then which of that bead’s two neighbours follows it, and the rest of the row is forced, so rows, all different because the colours are. Every row displays exactly one necklace, so fourteen times the number of necklaces is , and there are necklaces.
Said the other way, call two rows equivalent when one is a rotation of the other or of its reversal; that is an equivalence relation, its classes are the necklaces, and each class holds fourteen rows.
Show that for every , and that for every , with equality only at and .
Give a second proof of the theorem on the number of bijections that does not partition , but instead builds a bijection one value at a time and appeals to the product of cardinalities directly. Which of the two proofs makes the appearance of more transparent?
Let be an -set. Show that the permutations of fixing a chosen point of number , and that those moving every point of number fewer than as soon as .
Symmetries of Regular Polygons
Permutations record how labelled places trade their occupants. The symmetries of a regular polygon are an example: each rigid motion carrying the polygon onto itself shuffles the corners, and the motion is settled by the shuffle.
Remark (What is borrowed from geometry).
The plane, the length of a segment and the measure of an angle are borrowed here in the same spirit as the rules of school algebra were borrowed earlier: openly, and without being built. Two geometric facts are used and not proved: that a symmetry of a polygon carries corners to corners, and that a symmetry is settled by what it does to the corners. Everything else in this section is a statement about permutations, and is proved.
Definition 8.14 (Symmetry of a figure).
A figure is a subset of the plane. A symmetry of is a bijection of the plane onto itself such that and such that the distance from to equals the distance from to , for all points and . Briefly: a rigid motion of the plane carrying onto itself.
A polygon with corners, where , is a figure consisting of points , the corners, together with the segments joining to for , where means ; those segments are the edges. A polygon with corners is an -gon, and it is regular if all its edges have the same length and all its interior angles the same measure.
Label the corner positions of an -gon by . A symmetry then determines a permutation : let be the label of the position to which carries the corner that started at position . Distinct symmetries determine distinct permutations, since a symmetry is settled by what it does to the corners, so the map is injective and an -gon has at most symmetries. Composing symmetries multiplies the permutations: if and answer to and , then answers to , because both sides send a corner to the same place. Questions of the form “what happens if these motions are performed in turn?” therefore become products in .
Example 8.16 (Symmetries of an equilateral triangle).
Let be an equilateral triangle with its corner positions labelled , and let be the line through position and the midpoint of the opposite edge. Writing for the six symmetries of and for the permutations they determine, the dictionary is
The six permutations listed are distinct and , so the list is complete in two senses at once: the triangle has no further symmetries, and every element of comes from one.
For the triangle every permutation of the corners comes from a symmetry. For larger polygons this fails. For a square with corners labelled in order round the boundary, the permutation
holds position still while exchanging the two positions next to it, and no motion preserving distance can do that, since the two exchanged corners are at different distances from the first. For a regular -gon the count is exactly .
Proposition 8.17 (Number of symmetries of a regular -gon).
A regular -gon has exactly symmetries. Equivalently, the permutations in determined by those symmetries form a -subset of .
Discussion.
The claim is a count, and the object counted is the set of symmetries, which we have already matched injectively with a subset of ; so it is enough to count the permutations that arise. A symmetry is settled by what it does to the corners, and in fact by what it does to two neighbouring corners, so the count is a product of two choices in the manner of the cardinality of a product. The first corner may go to any of the positions, which is the first factor. Its neighbour is one edge away from it, and a motion preserving distance must leave it one edge away from wherever the first corner went, so only the two positions adjacent to that one are available, which is the second factor. That those two choices determine the rest is the geometric fact we have assumed: the remaining corners are reached by stepping round the boundary, and each step is forced once the direction and the starting position are fixed.
Proof.
Label the corner positions in order round the boundary and let come from a symmetry .
There are possible values for . The corners at positions and are joined by an edge, so carries them to corners joined by an edge, and hence is one of the two positions adjacent to : two possible values. Once and are fixed, so is the direction in which runs round the boundary, and every further corner is reached from the previous one by one edge in that direction; so are determined.
Each of the pairs of choices is realised, by a turn when the direction is preserved and by a reflection when it is reversed, and distinct pairs give distinct permutations, hence distinct symmetries. So there are exactly symmetries.
Remark.
The same can be counted a second way, by kind rather than by choice: there are turns, through none, one, …, steps round the boundary, and reflections. When is odd every reflection has its line through one corner and the midpoint of the opposite edge; when is even, half of the lines pass through two opposite corners and half through the midpoints of two opposite edges. Either way the total is .
Definition 8.18 (Dihedral group).
The set of permutations in determined by the symmetries of a regular -gon is written and called the dihedral group of degree . By the proposition, and .
Working with the motions of a regular -gon is therefore the same as computing inside , since composing motions is multiplying permutations. The triangle gives , as the example showed; for the inclusion is proper, since .
Example 8.19 (A regular nine-gon).
A regular nine-gon has symmetries. With the positions labelled through round the boundary, the two symmetries carrying position to position are
a turn through four steps and a reflection in the line through position and the centre. The reflection is recognisable from its table without any picture: it fixes and pairs off the remaining positions, which is what an involution with one fixed point looks like.
Example 8.20 (Composing motions by multiplying).
Take the six symmetries of the equilateral triangle and their permutations as listed above. The composite answers to the product
Following , and through the five factors from the right gives , and , so the product is and the composite motion is the reflection . Once the dictionary between motions and permutations is fixed, the computation needs no picture.
For the square with corners labelled round the boundary, list the eight elements of in two-row notation, and name an element of that is not one of them.
With the triangle dictionary above, compute and and read the answers as repeated turns.
Show that is closed under products and under inverses. Argue geometrically, from the fact that a composite of rigid motions carrying the polygon onto itself is one, and that the inverse of such a motion is one.
Cycles and Parity
Two-row notation is complete but bulky: it names values to describe a function that may move only two points. Cycle notation is shorter. It records a permutation by its orbits, and the order and the parity of a permutation can both be read off the same decomposition.
Throughout, is fixed unless said otherwise, and is the identity permutation of .
Inverses, Powers and Order
A permutation is a bijection, so it has an inverse, and that inverse is again a bijection of the same set: gives , with sending each back to . In two-row notation this is easy: exchange the rows, then reorder the columns so that the top row ascends again.
Example 8.21 (Computing an inverse).
If
then exchanging the rows gives
In practice one writes a blank table and, under each along the top, records the unique with ; it is unique because is a bijection.
Definition 8.22 (Powers of a permutation).
Let . Define for by the recursion
so that and is the -fold product . Write also
for , so that has its usual meaning.
Example 8.23 (Powers both ways).
If
then
Comparing the first and last tables shows to be the inverse of , which the theorem below predicts.
Theorem 8.24 (Laws of exponents).
Let and let . Then
- ;
- ;
- , that is, when is positive.
Discussion.
Three identities between permutations, each of them an equality of functions on . The powers were defined by a recursion on the exponent, so each part is an induction on one exponent with the other held fixed, and each inductive step is the recursion clause together with associativity of composition. For the first we fix and induct on ; the base is the identity law , and the step moves one factor across the bracket. The second is the same induction on , now using the first part at each step to add exponents. For the third, to say that a permutation is the inverse of is to say that it composes with to the identity on both sides, and cancels from the inside out. We induct on for that too.
Proof.
For the first, fix and induct on . At we have , by the identity laws. Suppose . Then
the second step by associativity of composition, the fourth and fifth by the recursion clauses for powers and for addition.
For the second, fix and induct on . At both sides are , since . Suppose . Then
using the first part and the recursion clause for multiplication.
For the third, induct on . At both sides are . Suppose . The first part gives , so
the second step by associativity, the third because , and the last by the inductive hypothesis. In the other order, the first part applied to gives , and
So is a two-sided inverse of , and inverses are unique.
Remark.
With the third part in hand the notation is consistent: it does not matter whether one inverts and then takes the power or takes the power and then inverts. All three laws then hold for exponents of either sign, once the statements are read with the convention ; we have written them for because that is where we have arithmetic, and a negative exponent is here an abbreviation rather than a number.
Definition 8.25 (Order of a permutation).
Let . The order of , written , is the least with , if there is one.
Proposition 8.26 (Every permutation has an order).
Let . Then for some , so is defined and lies in .
Discussion.
The claim is an existence statement, and since all we know is that is finite, we use the pigeonhole principle. We have infinitely many powers and only permutations for them to be, so two of the powers coincide. Cancelling the smaller from the larger (multiplying by an inverse, using the laws of exponents) leaves a positive power equal to the identity. Once the set of positive with is known to be non-empty, well-ordering supplies its least member, which is what the definition asks for.
Proof.
The map from to has a domain of elements and a range inside a set of elements, so it is not injective by the pigeonhole principle: there are in that block with . Write with . Composing with on the left and using the laws of exponents,
So is non-empty, and well-ordering gives it a least member, which is .
Theorem 8.27 (Powers repeat with the order).
Let with . Then are pairwise distinct, and every power with is one of them.
Discussion.
Two assertions. The second says that the list exhausts the powers, and the tool is division with remainder: writing with , the laws of exponents split into , and the first factor is the identity by the definition of the order, leaving with in range. The first assertion is a uniqueness claim and goes by contradiction: two equal powers among the first would cancel to give a positive power below equal to the identity, and the order was chosen least, so no such power exists.
Proof.
Let . Division with remainder gives with and , so by the laws of exponents
and is one of .
Suppose with and . Writing with and composing with as before gives with , contradicting the leastness of . So the powers listed are pairwise distinct.
Let
Compute until the identity appears, and state .
Show that if for some , then divides , in the sense that for some . Division with remainder is the whole of the argument.
Show that for every , and that exactly when .
Cycles and Disjoint Decomposition
Draw a point for each and an arrow from to . Because is a function, exactly one arrow leaves each point; because it is injective, exactly one arrow arrives at each. A picture of that kind can only be a collection of separate closed loops, some of them loops from a point to itself. The notation that matches the picture is the following.
Let with . A permutation is an -cycle, or a cycle of length , if there are distinct with
and for every . The set is the orbit of the cycle, written , and one writes
for this permutation. A point with is said to be moved by .
A -cycle fixes and fixes everything else, so it is the identity; in a product one leaves such factors out, since they do nothing. For the listing inside the brackets may start wherever one likes,
since all of those tables send each to the same place; and the inverse of a cycle is the same cycle read backwards,
The permutation
sends and fixes and , so , which is the same cycle as .
Definition 8.30 (Disjoint cycles).
A family of cycles in is disjoint if their orbits are pairwise disjoint: no cycle in the family moves a point moved by another.
Example 8.31 (Two disjoint cycles).
In the cycles and are disjoint, since . In two-row notation,
Products of permutations do not commute in general, but disjoint cycles do, because each acts inside its own orbit and fixes everything outside it. The argument has nothing to do with cycles, so we state it for arbitrary maps.
Theorem 8.32 (Maps with disjoint supports commute).
Let and be sets and let satisfy
- , and for every ;
- , and for every .
Then .
Discussion.
The claim is an equality of two functions with domain , so by equality of functions we compare values at an arbitrary point, and the domain is a union, so the comparison splits into the two cases and . Each case is the same short argument run with the hypotheses exchanged: one of the two maps fixes , so one composite is immediately the other map’s value at ; and that value stays in the set where the first map fixes everything, so the other composite is the same. Only the two hypotheses are used.
Proof.
Let .
If then by the second hypothesis, so ; and by the first hypothesis, so fixes it and .
If then by the first hypothesis, so ; and by the second, so fixes it and .
In both cases the two composites agree at , so they are equal.
Corollary 8.33 (Disjoint cycles commute).
If and are disjoint cycles in , then .
Proof.
Put and . Then and fixes every point of , by the definition of a cycle. Disjointness puts inside , so , and fixes every point of . The theorem applies with and .
Example 8.34 (A product of disjoint cycles).
In ,
Neither nor is moved by either factor, and the table records that by fixing them.
Every permutation is such a product.
Theorem 8.35 (Cycle decomposition).
Every permutation in is a product of pairwise disjoint cycles. The identity is the empty product, or equally a product of -cycles, which one omits from the written expression.
Discussion.
The proof is a construction together with two checks. The construction follows the arrows of the picture: start at a point, apply repeatedly, and see that the trail must return to its start. That it returns at all is the pigeonhole principle, since is finite; that it returns to the start rather than to some later point of the trail uses injectivity, and we get it by taking the first repetition and cancelling. The trail is then the orbit of a cycle on which agrees with that cycle. The first check is that a second trail, begun at a point not yet used, is disjoint from the first, which is again cancellation. The second is that the product of all the cycles obtained equals : on each orbit the product acts as the one factor that moves that orbit, by disjointness, and off all of them both sides fix every point. The process stops because each round uses at least one new point of the finite set .
Proof.
Let and let . Among the values , lying in the -set , two coincide by the pigeonhole principle. Let be least such that for some . If were positive, composing both sides with would give with , contradicting leastness. So and , and the points are pairwise distinct, again by leastness. Write
a cycle whose orbit is that set and on which agrees with .
Now build the decomposition. Put for . If every point outside is fixed by , then and we are done. Otherwise choose a point moved by and lying outside , and form . The two orbits are disjoint: if then composing with or , whichever exponent is the smaller, expresses as a power of applied to , and the theorem on powers repeating puts that power inside , contrary to the choice of .
Repeat. Each round adds at least one point to the union of the orbits, and is finite, so after finitely many rounds every point moved by lies in some orbit. Let be the cycles obtained; they are pairwise disjoint by the argument just given, applied to each pair. Their product agrees with at every point: a point in is fixed by every factor but , which sends it where does, and a point in no orbit is fixed by every factor and by . So , and the order of the factors is immaterial by the corollary on disjoint cycles.
Remark (Reading off the decomposition).
The proof is an algorithm, and it is the one used in practice. Given in two-row form, begin at any point not yet written down, apply until the starting point returns, close the bracket, and start again elsewhere. Only cycles of length at least two need be written. In the picture of arrows, the cycles are exactly the separate loops.
Remark (Uniqueness).
The decomposition is unique up to the order of the factors and up to where each bracket starts. For suppose are two products of pairwise disjoint cycles of length at least two, and let . Then , so lies in the orbit of exactly one , say after renumbering. Both and agree with on the orbit they contain in, so the two orbits are the same set — each is the trail of under — and the two cycles agree there and fix everything else, hence . Matching the remaining factors the same way shows the two collections coincide.
Example 8.36 (Three decompositions).
-
-
-
If and , the product is not written as a product of disjoint cycles, since the factors share the points and . Following each point through and then gives , which is.
Show that an -cycle has order .
Write each of the following as a product of disjoint cycles and give its order.
- , as an element of .
Let be a product of pairwise disjoint cycles of lengths . Show that exactly when every divides , in the sense of the problem on divisibility, and deduce that is the least such . Say where disjointness is used.
Show that is a transposition if and only if it is a -cycle, and that for every cycle and every .
Let and let satisfy for every . Show that . Which elements of have the same property?
Transpositions and the Sign
A -cycle exchanges and and fixes every other point of , which is exactly the transposition written in cycle notation. In particular and , which is the proposition that a transposition is its own inverse read in the new notation. Transpositions move as few points as a permutation other than the identity can, and every permutation is a product of them.
Theorem 8.37 (Factorisation into transpositions).
Let . Then every permutation in is a product of transpositions.
Discussion.
The statement is universally quantified over , and the cycle decomposition has already reduced any such statement to a statement about a single cycle: if each factor of a disjoint decomposition is a product of transpositions then so is the whole, by substitution. So there are two things to do. The identity is not covered by the decomposition, since its decomposition is empty, and it is handled separately by writing it as a transposition composed with itself. A cycle of length at least two is handled by exhibiting the factorisation outright, and the exhibited product is then checked point by point against the cycle.
Proof.
If then , which is available since .
Otherwise the cycle decomposition writes as a product of cycles of length at least two, so it is enough to factor one such cycle. We claim
Evaluate the right-hand side from the right. The point is sent to by the first factor, and is fixed by all the others, so . For , the point is fixed by every factor until sends it to , and the next factor sends to , which the remaining factors fix; so . The point is fixed until the last factor sends it to , and nothing follows, so . Any point outside the orbit is fixed by every factor. So the two sides agree everywhere.
Substituting these factorisations into the decomposition writes as a product of transpositions.
Remark (Non-uniqueness).
The transposition factors are not disjoint in general, and cannot be: a -cycle moves three points, while a product of disjoint transpositions moves an even number. The factorisation is not unique either, since may be inserted anywhere, and the order of non-disjoint factors matters, and being different permutations. What is unique is the evenness or oddness of the number of factors, and we prove this next.
To prove it we count, for a given permutation, the pairs of points whose order it reverses.
Definition 8.38 (Reversals, parity and sign).
Let and let be a -subset of , written so that . Then reverses if . Write for the number of -subsets of reversed by .
The permutation is even if is even and odd if is odd; that alternative is the parity of . The sign of is
The count exists because the -subsets of form a finite set, and each is reversed or not by the trichotomy of the order. The two values and are just labels for the parity, and the only property of the labels we shall use is that multiplying them behaves as adding parities does, with recording that two odd numbers add to an even one.
Example 8.39 (Counting reversals).
The identity reverses nothing, so and the identity is even. For
the three -subsets are , with , not reversed; , with , reversed; and , with , reversed. So and is even.
The proof uses two facts about : multiplying by a transposition of neighbours changes it by exactly one, and every permutation is a product of such transpositions. The second was set as a problem in the chapter on sequences, where it justified the claim that rearranging a sum does not change it; here it is proved, and in the language of rather than of rearrangements.
Proposition 8.40 (A neighbour swap changes one reversal).
Let , let with , and put . Then exactly one of
holds. In particular and have different parities.
Discussion.
Both and are counts over the same index set, the -subsets of , so the claim is that the two counts differ by one, and we sort the -subsets into three kinds and compare the counts kind by kind. The permutation agrees with except that its values at and are exchanged: a -subset avoiding both and sees the same two values in the same positions, so its status is unchanged; a -subset meeting exactly one of them is paired with the -subset meeting the other, and the two statuses are exchanged between the members of the pair, leaving their total unchanged; and the single -subset has its status reversed, because the two values are exchanged while the two positions are not. Summing the three kinds, the totals agree except for one, and trichotomy makes the two displayed alternatives exclusive. The last sentence is then the remainder classes at : a number and its successor never have the same parity.
Proof.
Write , so that , , and for every other . Sort the -subsets of into three kinds.
Neither point in . Both values are the same for as for , so the subset is reversed by one exactly when it is reversed by the other.
Exactly one point in . Such subsets come in pairs and with . Suppose , so that and is the smaller point in both subsets. Then reverses exactly when , which is exactly when reverses ; and reverses exactly when reverses . So the two statuses are exchanged within the pair and the number of reversed subsets among the two is the same for as for . The case is the same argument with the larger point.
The subset . Here reverses it exactly when , that is when , which is exactly when does not reverse it.
Adding the three kinds, the counts agree on the first two and differ by exactly one on the third. So is increased by one or is increased by one, and not both, by trichotomy. A number and its successor fall in different remainder classes for the divisor , so the parities differ.
Proposition 8.41 (Neighbour swaps suffice).
Let . Then every permutation in is a product of transpositions of the form with .
Discussion.
By the theorem on factorisation into transpositions the claim reduces to a single transposition with , since substituting a factorisation of each factor factorises the product. We induct on the gap between them, where . At the transposition is already a neighbour swap. For the step, conjugating a transposition by a neighbour swap moves one of its two points one place along: is , whose middle factor has a smaller gap and whose outer factors are neighbour swaps. Checking that identity is a comparison of values at the three points involved, everything else being fixed by all three factors.
Proof.
By the theorem on factorisation into transpositions it is enough to write a single transposition , with , as a product of neighbour swaps. Write with and induct on .
If then is itself a neighbour swap.
Suppose the claim holds for , and let , so that and . Put . We claim . Evaluating the right-hand side from the right: is fixed by , sent to by the middle factor, and sent to by the last, so . The point is sent to by the first factor, then to by the middle, and is fixed by the last, so . The point is sent to by the first factor, fixed by the middle, and returned to by the last, so . Every other point is fixed by all three factors. So the two sides agree everywhere.
The middle factor has gap and is a product of neighbour swaps by the inductive hypothesis, and is a neighbour swap, so is a product of neighbour swaps.
Theorem 8.42 (Properties of the sign).
Let with .
- .
- Every transposition is odd.
- If is a product of transpositions, then when is even and when is odd.
Discussion.
Three claims about the parity of . The first says that the parity of is settled by the parities of and , and we use the proposition on neighbour swaps together with the proposition that neighbour swaps suffice: writing as a product of neighbour swaps and multiplying them onto one at a time flips the parity times, so the parity of is that of shifted by ; taking to be the identity, whose count is , identifies the parity of with the parity of , and the two statements together are the claim. The second is a direct count of reversals for , sorting the -subsets by whether they meet and where their other point lies; the answer is one more than an even number. The third is then an induction on using the first two.
Proof.
For the first, write as a product of neighbour swaps. Then
by associativity, and each of the steps changes the parity of the reversal count, by the proposition on neighbour swaps. So has the parity of when is even and the opposite parity when is odd. Taking , where is even, shows that is even exactly when is even. Combining the two: has the parity of when is even and the opposite when is odd, which in the sign notation is the stated product rule.
For the second, let with , and sort the -subsets of . One meeting neither nor is not reversed, since fixes both its points. The subset is reversed, since . A subset or with is reversed exactly when lies strictly between and : if or then keeps its position relative to both, and if then is reversed because while , and is reversed because . So each such contributes two reversals and nothing else contributes, giving
which is odd.
For the third, induct on . At the claim is the second part. Suppose it holds for and let . Then , so by the first two parts
which changes the value from to or from to exactly as the parity of changes to the parity of .
Corollary 8.43 (The number of transposition factors has a fixed parity).
If are two factorisations of the same into transpositions, then and are both even or both odd.
Proof.
The third part of the theorem computes from each factorisation, giving when the number of factors is even and when it is odd. Since is one value, and cannot have different parities.
An -cycle is a product of transpositions, by the factorisation exhibited above, so
A cycle of odd length is even and a cycle of even length is odd, which reads perversely until one remembers that the length counts points and the sign counts swaps. For a product of cycles of lengths , disjoint or not, the first part of the theorem multiplies the signs together, so the product is even exactly when an even number of the are even.
Example 8.44 (Computing the sign).
For
a single cycle of length five, the sign is and is even. For
three of the four lengths are even, namely , and , so three of the four factors are odd and .
Remark (Parity as an obstruction).
Any sequence of exchanges of two of labelled objects is a product of transpositions in . If the rearrangement one is aiming at is odd, then no even number of exchanges reaches it, and if it is even, no odd number does. So parity rules out many proposed sequences of exchanges without examining the intermediate states: one only computes the sign of the target rearrangement.
Write
as a product of disjoint cycles and then as a product of transpositions, and compute in both ways.
Show that the even permutations in are closed under products and under inverses, and that the odd ones are closed under neither.
Let . Show that the even permutations in and the odd ones are equinumerous, by fixing a transposition and considering the map . Conclude that is twice the number of even permutations.
Let . Show that is a product of transpositions of the form with , and that no product of fewer such transpositions equals .
Let . Show that every permutation in is a product of transpositions of the form with , and that every permutation in is a product of factors each equal to or to .
Fifteen tiles numbered to lie in a frame with one cell empty, and a move slides into the empty cell a tile from a cell sharing an edge with it. Decide whether a sequence of moves carries the first arrangement below to the second, and prove your answer.
Binomial Coefficients
Counting the permutations of an -set asked in how many ways its points can be arranged. The remaining question of the chapter asks in how many ways they can be chosen: not how a set may be reordered, but how many subsets of a given size it has. The two questions are linked, because choosing points and then arranging them is the same as arranging of the points, and this gives the count of subsets as a quotient of factorials.
Counting Subsets
Definition 8.45 (Binomial coefficient).
Let and let be an -set. The binomial coefficient , read ” choose ”, is the number of -subsets of :
The definition names a set and the notation does not, so the first thing to check is that the count does not depend on which -set was taken. It does not: two -sets are equinumerous, and a bijection carries -subsets to -subsets in both directions, since the image of a -subset under an injection is a -subset and undoes it. The count is also finite, since the -subsets form a subset of the finite set .
Theorem 8.46 (Basic properties of binomial coefficients).
Let . Then
- and ;
- whenever ;
- whenever ;
- , and when ;
- .
Discussion.
The first four parts follow from the definition, by naming the subsets counted. For the first, the empty set is the one -subset of anything and is the one -subset of itself, both by cardinality classifying finite sets. The second is the theorem on subsets of a finite set, which forbids a subset larger than the whole. The third is an equality of two counts, so it asks for a bijection between the two collections, and complementation is one, being its own inverse. The fourth counts singletons and then applies the third. The fifth is different: it is a statement about a sum, so we partition by cardinality — the classes are pairwise disjoint and cover it, since every subset of a finite set is finite with exactly one cardinality — and add the pieces up with the cardinality of a disjoint union, the total being by the problem on power sets.
Proof.
Fix an -set .
For the first, a -subset is equinumerous with and hence empty, so is the only one; an -subset has , so by the theorem on subsets of a finite set, which makes a proper subset strictly smaller.
For the second, a -subset would give by that theorem, contradicting ; so there are none.
For the third, sends -subsets to -subsets, by the cardinality of a disjoint union applied to , and it is its own inverse, hence a bijection between the two collections. Equinumerous finite sets have equal cardinality.
For the fourth, is a bijection from onto the collection of -subsets, so ; the third part then gives .
For the fifth, every subset of is finite with exactly one cardinality, and that cardinality is at most by the theorem on subsets of a finite set, so the collections of -subsets for are pairwise disjoint and their union is . Adding their cardinalities gives
the last equality being the problem on the cardinality of a power set.
The link between choosing and arranging is made by counting the injections between two finite sets, so we count them first.
Proposition 8.47 (Counting injections).
Let be a -set and an -set with . Then the number of injections is
the product of the numbers running down from .
Discussion.
A count again. An injection is built by choosing values one point at a time, and each choice removes one candidate from the target, so we induct on , with fixed and fixed. At the domain is empty, the empty function is the only function and it is injective, and the empty product is . For the step we split the injections from a -set according to the value taken at a chosen point : the pieces are pairwise disjoint and cover, there are of them, and each is matched by restriction with the injections from a -set into a set with one point removed, which the inductive hypothesis counts. Adding equal pieces is the cardinality of a product, and the arithmetic gives the next factor down because the removed point shrinks the target from to and shifts every factor.
Proof.
Induct on , the claim being taken for all and all -sets at once.
If then , the empty function is the unique function and is injective, and the empty product is .
Suppose the claim holds for and let . Fix and, for , let be the set of injections with . Every injection lies in exactly one . Restriction to matches with the injections from that -set into , an -set: an injection cannot take the value anywhere else, so the restriction lands there, and every injection extends to exactly one member of . By the inductive hypothesis,
Summing over the values of , the number of injections is
which is the claim at .
Theorem 8.48 (Factorial formula for binomial coefficients).
Let with . Then
Discussion.
The claim is an identity between products of natural numbers, and the method is to count one set in two ways and equate the answers. The set is the collection of injections from a -set into an -set . Counted directly, the previous proposition gives the descending product. Counted by what an injection is made of, an injection is an image together with a bijection onto it: the image is a -subset of , of which there are , and the bijections from onto a fixed -subset number by the theorem on the number of bijections. Equating the two answers gives equal to the descending product, and multiplying by completes the descending product to , which is the displayed identity.
Proof.
Fix an -set and a -set , and let be the set of injections . By the proposition on counting injections,
Count a second way. Each determines its image , a -subset of , and is a bijection from onto that image, by an injection onto its range. Conversely a -subset together with a bijection determines an , and different pairs give different injections. There are choices of and, for each, exactly bijections by the theorem on the number of bijections. So
Equating and multiplying both sides by ,
the last step because the descending product and between them use each of the factors exactly once. When both sides are , so the identity holds there too.
Remark.
The identity is normally written as a quotient,
and we shall write it that way below. The division is exact by the theorem, and we allow it on the same terms as subtraction: whenever the answer lies in . For computing a single coefficient by hand the descending product is faster,
while the two-factorial form is the better one to manipulate.
Theorem 8.49 (Pascal's identity).
Let with . Then
Discussion.
The claim is that one count equals a sum of two counts, and a sum of counts comes from a partition of the set being counted. So we fix an -set , single out a point of it, and sort the -subsets of by whether they contain : two collections, disjoint and exhaustive. Those avoiding are exactly the -subsets of the -set , which is the first term. Those containing are matched with the -subsets of by removing , a map undone by putting it back, which is the second. The cardinality of a disjoint union adds them.
Proof.
Let be an -set, fix and put , an -set.
A -subset of either contains or does not, and not both. Those that do not are precisely the -subsets of , and there are of them.
Those that do are precisely the sets with a -subset of : removing from such a subset leaves a subset of of cardinality , by the corollary on removing a point, and adjoining to a -subset of returns it. So there are of them.
The two collections are disjoint and their union is the collection of all -subsets of , so their cardinalities add to .
Pascal’s identity together with the boundary values determines every binomial coefficient without any factorials at all, each from two earlier ones. Setting the values out in rows indexed by , with running left to right, gives Pascal’s triangle:
Each interior entry is the sum of the two entries above it, one directly above and one to the left of that, which is Pascal’s identity. The rows add to , which is the fifth part of the theorem on basic properties, and each row is a palindrome, which is the third.
Example 8.50 (Two small counts).
The number of -subsets of a -set is
and the number of -subsets is
Example 8.51 (Shortest routes).
On a grid of streets blocks tall and blocks wide, a shortest walk from the bottom left corner to the top right uses blocks, of which are walked upwards and across. Such a walk is settled by saying which of its steps are the ones across, so there are shortest routes. On a square grid blocks each way there are .
Compute , and from the factorial formula, and check the first two against the symmetry .
Prove the factorial formula a second time, by induction on with Pascal’s identity as the inductive step, treating and separately.
How many -subsets does a -set have? If the -set is partitioned into four -sets, how many of those -subsets lie inside a single part?
Identities and the Binomial Theorem
Let with . Then
Discussion.
An identity between two products, so again we count one set in two ways. The set is the collection of pairs in which is a -subset of an -set and is a point of — a committee together with its chair, if one likes. Choosing the committee first and then the chair from within it gives followed by , which is the left-hand side; choosing the chair first from all of and then the rest of the committee from what remains gives followed by , which is the right. Each count is an application of the cardinality of a product to a partition of the same collection, sorted the two different ways. The factorial formula gives a second proof by cancellation, and we record that as well.
Proof.
Let be an -set and let be the set of pairs with a -subset of and .
Sorting by its second coordinate, each of the possible occurs in exactly pairs, one for each of its points, so .
Sorting by its first coordinate, each of the possible occurs in one pair for each -subset containing ; those are the sets with a -subset of , as in the proof of Pascal’s identity, so there are of them. Hence .
Equating the two gives the identity. Alternatively, from the factorial formula,
Theorem 8.53 (The hockey-stick identity).
Let . Then
Discussion.
The left-hand side is a sum whose number of terms depends on , so the proof is an induction on with held fixed. At both sides are , by the first part of the theorem on basic properties. The step adds one term to the sum: the inductive hypothesis replaces everything before it by a single coefficient, and what is left is a sum of two coefficients to which Pascal’s identity applies. So the whole argument is one application of the inductive hypothesis followed by one application of Pascal, and the only care needed is in matching the indices.
Proof.
Fix and induct on . At the sum has the single term , and the right-hand side is .
Suppose the identity holds at . Then
the second line by the inductive hypothesis and the third by Pascal’s identity, applied with upper index and lower index .
Remark.
The name records the shape the summed entries make in Pascal’s triangle: they run down one diagonal and the answer sits one place off the end, like the blade at the foot of a stick.
A binomial is a sum of two terms, and expanding a power of one produces the binomial coefficients as the coefficients of the resulting terms. That is where the name comes from.
Theorem 8.54 (The binomial theorem).
Let and let . Then
Discussion.
Behind the statement is a count: multiplying out copies of produces one term for each way of taking from some of the copies and from the rest, so appears once for each -subset of the copies, which is times. That is the reason the theorem is true, but it is not yet a proof, because “multiplying out” is not among our operations. What we have is the recursion defining powers, so the proof is an induction on : multiply the inductive hypothesis by , distribute, and reassemble. Pascal’s identity appears in the reassembly: after shifting the index of one of the two sums so that both run over the same power of , the two coefficients standing in front of each term are and , which Pascal’s identity adds to the coefficient wanted at .
Proof.
Induct on . At both sides are , the left because and the right because the only term is .
Suppose the identity holds at . Then, distributing,
In the first sum put , so that runs from to :
Renaming as and separating the terms and , which occur in only one of the two sums each,
by Pascal’s identity, and the two separated terms are the cases and since .
Remark (Where the theorem applies).
The proof uses nothing about and beyond the commutative, associative and distributive laws and the recursion defining powers. So it holds verbatim wherever those laws hold — for the real numbers of school algebra, and for expressions in an unknown — and that is how it is used in practice. We have stated it in because that is the arithmetic built so far.
Corollary 8.55 (Sum of the binomial coefficients, again).
For every ,
Proof.
Put in the binomial theorem: every term is , and the left-hand side is .
That is the fifth part of the theorem on basic properties, proved a second time and by quite a different route: the first proof partitioned the power set, and this one multiplies out a product. The first proof and the corollary together give a proof that , running in the opposite direction to the one the problem asked for.
Example 8.56 (A single coefficient).
Working in school algebra, where the theorem applies by the remark above, the coefficient of in is the coefficient of in
namely . Only one term of twelve is needed.
Show that for every the binomial coefficients with even lower index add to the same total as those with odd lower index, and that each total is .
Expand in two ways and compare the coefficients of to obtain Vandermonde’s identity
for and , reading as when . Then prove the same identity by counting the -subsets of a set split into an -set and an -set.
Show that exactly when , and read off from that where a row of Pascal’s triangle attains its largest entry, treating and separately. The absorption identity compares consecutive entries of a row.
Show that
for every .
Multinomial Coefficients
A binomial coefficient counts the ways of cutting an -set into two labelled pieces of prescribed sizes: a -subset and everything else. The same works with more than two pieces.
Definition 8.57 (Multinomial coefficient).
Let , let , and let with . Let be an -set. The multinomial coefficient
is the number of -tuples of pairwise disjoint subsets of with and for each . Empty pieces are allowed, when some is .
The pieces are labelled by their position in the tuple, so two tuples listing the same pieces in a different order are different objects; the same convention was already in force for binomial coefficients, where the -subset was distinguished from its complement. Equivalently, such a tuple assigns each point of to one of labelled bins, with bin receiving points.
At the definition returns the binomial coefficient, since a pair of the required kind is settled by alone:
Theorem 8.58 (Factorial formula for multinomial coefficients).
Let with each . Then
Discussion.
Once more we count one set two ways, and the set is the collection of listings of an -set — that is, of bijections . Counted directly there are of them, by the theorem on the number of bijections. Counted by construction, a listing is assembled from a tuple of the kind the coefficient counts, together with an ordering inside each piece: read the first entries of the listing as the first piece in order, the next as the second, and so on. That correspondence is reversible, so the number of listings is the number of tuples multiplied by through , one factor for each piece by the theorem on the number of bijections again. Equating the two counts is the identity.
Proof.
Let be an -set. The listings of , meaning the bijections , number .
Given a listing , cut into the consecutive blocks of lengths and let be the image of the -th block. The blocks are pairwise disjoint and cover , so the are pairwise disjoint and cover , and since is injective. The listing also determines an ordering of each , namely the order in which its points appear.
Conversely a tuple of the required kind, together with an ordering of each , reassembles into exactly one listing, by writing the pieces out one after another. So the listings correspond to such data, and there are tuples with orderings of the -th piece for each. Hence
where a piece with contributes the factor .
Remark.
As before we write the identity as a quotient,
the division being exact by the theorem. The multinomial coefficient can also be built from binomial ones by choosing the pieces in turn, which is the content of a problem below.
Example 8.59 (Assigning students to projects).
Nine students are to be assigned to three named projects needing four, two and three students. The assignments number
Had the projects been unnamed and only their sizes fixed, the count would be different, since the pieces would no longer be distinguished by position.
Example 8.60 (A bag of shopping).
A bag is packed with four bananas, five tins of tuna, two boxes of cereal, four lemons, three bottles of cola and six light bulbs, twenty-four items in all, alike within each kind and distinguishable between kinds. The orders in which the bag can be packed number
since an order is settled by saying which of the twenty-four positions each kind occupies.
Theorem 8.61 (The multinomial theorem).
Let and let . Then
the sum running over all -tuples in with .
Discussion.
The statement generalises the binomial theorem from two summands to , and it is proved the same way, by induction on with the recursion for powers supplying the step. The bookkeeping is heavier because the terms are indexed by tuples rather than by a single number, so we describe the step first: multiplying by and distributing turns each term indexed by a tuple summing to into terms, one for each coordinate raised by one, and every tuple summing to arises this way from exactly the tuples obtained by lowering one of its positive coordinates. Collecting like terms, the coefficient wanted at is the sum of the coefficients at over those predecessors, and that sum identity is Pascal’s identity in its multinomial form, which the factorial formula supplies directly.
Proof.
Write for the set of -tuples in summing to . We first record the identity, for ,
which follows from the factorial formula: the -th summand is multiplied by and divided by , so the whole sum is multiplied by and divided by .
Now induct on . At the only tuple is and both sides are .
Suppose the identity holds at . Multiplying by and distributing,
Each inner term is for the tuple got from by raising the -th coordinate by one; and conversely each tuple in arises exactly once from each tuple got by lowering one of its positive coordinates. Collecting the terms belonging to a fixed , its coefficient is
by the recorded identity, which is the claim at .
Remark.
At the theorem is the binomial theorem and the recorded identity is Pascal’s, since a tuple has two coordinates to lower. The remark about where the binomial theorem applies carries over unchanged: the proof uses only the commutative, associative and distributive laws.
Example 8.62 (A term with no unknown in it).
Working in school algebra, a term of the expansion of
has the form
with . All three exponents vanish exactly when , which forces and each . So the constant term is when is four times , and otherwise.
Show that
whenever , by choosing the pieces one after another. Then check the identity a second time from the factorial formulas.
How many distinct arrangements are there of the eleven letters of ? State the count as a multinomial coefficient before evaluating it.
Expand by the multinomial theorem, and check the answer by multiplying the three factors out directly. How many terms does the expansion of have, before like terms are collected, and how many after?
Let . By counting the partitions of a -set into -subsets, show that is divisible by and not by .
Exercises
Answers are checked in your browser, as often as you like. Nothing is sent anywhere and
nothing is kept but your own work. A formula may be written with the symbols themselves or
with ~ & | -> <-> ^, and \and, \or, \to expand as you type.
The coefficient of in is:
The largest order of an element of is:
The largest order of an element of is:
An element of of order is:
In let and .
The number of with is:
The number of with is:
For let be the number of permutations of an -set that move every point of it.
For , the sum equals:
Let and . The integers are placed in order, clockwise, at of positions spaced round a circle, so that no two consecutive integers, and included, sit in adjacent positions. Arrangements that differ by a rotation of the circle count as the same.
The number of such arrangements is:
Exercises in Lean
The proofs below are checked in your browser. Nothing is sent anywhere, and nothing is
stored but your own work. Type \to for →,
\and for ∧, \< and
\> for ⟨ ⟩.
This chapter asks four new things of the checker: the factorial and the binomial coefficient on , the powers of a map, a name for a permutation, and the transposition as a map in its own right. The arithmetic comes first, written the way the Peano sheet wrote addition.
Factorials and binomial coefficients
The factorial of Definition 8.8 is written n !, with a space, since n! is a single name to Lean. Like addition, it is not computed, and its two clauses are equations to rewrite with:
Nat.factorial_zero 0 ! = succ 0
Nat.factorial_succ (succ n) ! = succ n * n !The binomial coefficient choose n k of Definition 8.45 is a count of subsets, and the checker has no counts, so it takes instead what Theorem 8.46 and Theorem 8.49 proved about that count:
Nat.choose_zero_right choose n 0 = succ 0
Nat.choose_eq_zero_of_lt n < k → choose n k = 0
Nat.choose_succ_succ choose (succ n) (succ k) = choose n k + choose n (succ k)The last is Pascal’s identity with both indices moved up by one, so that no subtraction appears.
Example.
, from the two clauses and the arithmetic of the Peano sheet.
Example.
A -subset of the empty set would be larger than the set it sits in.
The first part of Problem 8.4 .
The second half of the first part of Theorem 8.46 , this time from Pascal’s identity rather than by naming the one -subset.
The first half of its fourth part.
Powers
The power of Definition 8.22 is written σ^[t], which is Lean’s own notation for a map composed with itself times. The recursion is not computed either, and its clauses are
Function.iterate_zero_apply σ^[0] x = x
Function.iterate_succ_apply σ^[succ t] x = σ^[t] (σ x)the second being read at a point. The checker cannot form an inverse, so the laws set below are the ones that need none.
Example.
The first part of Theorem 8.24 , by induction on . The point is left under the quantifier so that the inductive hypothesis can be used at . The result is listed below as Function.iterate_add_apply.
The second part.
The first half of Theorem 8.27 , with the division already made: is any exponent at which is the identity.
Permutations and transpositions
Definition 8.1 is the last sheet’s BijOn with the two sets equal, and it is written
Perm σ A is BijOn σ A Aso obtain ⟨hm, hi, hs⟩ takes a permutation apart and refine ⟨?_, ?_, ?_⟩ builds one. An equation between two maps on a set is read at each point of the set, as equality of functions reads it.
The transposition is written swap a b. Its value at depends on whether is , or neither, and the checker cannot decide an equation between two objects, so its definition comes as three equations:
swap_apply_left swap a b a = b
swap_apply_right swap a b b = a
swap_apply_of_ne_of_ne x ≠ a → x ≠ b → swap a b x = xAn argument about swap a b x for an unknown x goes by cases, and excluded middle supplies them: rcases Classical.em (x = a) with h | h leaves one goal with h : x = a and one with h : ¬x = a.
Example.
A transposition is its own inverse. It is listed below as swap_swap.
Theorem 8.32 , read at each point of .
A transposition is a permutation of any set that holds its two points.
The second part of Problem 8.16 for a cycle of length two, with in the place of .
The identity from the proof of Proposition 8.41 , with in the place of .
Part of Problem 8.3 : is a permutation of the domain of . The checker cannot invert a bijection, so arrives as , together with the two equations that make it the inverse.
What the checker understands
Tactics
| intro h | assume the hypothesis of an implication, naming it h |
| exact e | give the proof outright |
| apply f | reduce the goal to the hypotheses of f |
| assumption | close the goal with a hypothesis already present |
| trivial | close the goal True |
| exfalso | replace the goal with False |
| by_contra h | assume the negation of the goal |
| constructor | split ∧ into both halves, or ↔ into both directions |
| left / right | choose which half of a ∨ to prove |
| rcases h with a | b | argue by cases on a disjunction |
| obtain ⟨a, b⟩ := h | take a conjunction or an existential apart |
| cases h | as above, keeping the name |
| refine e | give the proof with holes left in it |
| have h : p := … | record an intermediate result |
| show p | restate the goal in an equal form |
| use w | give a witness for ∃ |
| specialize h a | instantiate a ∀ hypothesis |
| rw [h] | rewrite with an equation, ← to go backwards |
| rfl | both sides compute to the same thing |
| decide / norm_num | settle a closed computation |
| tauto | close a goal that is true by pure logic |
| induction n with k ih | the fifth Peano condition: prove the goal at 0, then at succ k from ih |
Results you may cite
| Classical.em | ∀ (a : Prop), a ∨ ¬a — the law of excluded middle |
| Classical.byContradiction | ∀ {a : Prop}, (¬a → False) → a — proof by contradiction; the tactic by_contra does this for you |
| Classical.byCases | ∀ {a b : Prop}, (a → b) → (¬a → b) → b — split on whether a holds |
| not_not | ∀ {a : Prop}, ¬¬a ↔ a — double negation |
| not_and_or | ∀ {a b : Prop}, ¬(a ∧ b) ↔ ¬a ∨ ¬b — De Morgan |
| not_or | ∀ {a b : Prop}, ¬(a ∨ b) ↔ ¬a ∧ ¬b — De Morgan |
| not_imp | ∀ {a b : Prop}, ¬(a → b) ↔ a ∧ ¬b |
| and_comm | ∀ {a b : Prop}, a ∧ b ↔ b ∧ a |
| or_comm | ∀ {a b : Prop}, a ∨ b ↔ b ∨ a |
| Set.ext | ∀ {A B : Obj}, (∀ x : Obj, x ∈ A ↔ x ∈ B) → A = B — extensionality: sets with the same elements are equal |
| Set.ext_iff | ∀ {A B : Obj}, A = B ↔ (∀ x : Obj, x ∈ A ↔ x ∈ B) — extensionality and substitution, in one biconditional |
| Set.subset_antisymm | ∀ {A B : Obj}, A ⊆ B → B ⊆ A → A = B — mutual inclusion is equality |
| Set.empty_subset | ∀ {A : Obj}, ∅ ⊆ A — the empty set is a subset of every set |
| Set.pair_eq | ∀ {a b c d : Obj}, ((a, b) = (c, d)) ↔ (a = c ∧ b = d) — two ordered pairs are equal exactly when their coordinates are |
| Nat.succ_inj | ∀ {m n : ℕ}, succ m = succ n → m = n — the third Peano condition: the successor is injective |
| Nat.succ_ne_zero | ∀ (n : ℕ), succ n ≠ 0 — the fourth: zero is nobody's successor |
| Nat.pred | ∀ {n : ℕ}, n ≠ 0 → ∃ m : ℕ, n = succ m — predecessors: everything but zero is a successor |
| Nat.add_zero | ∀ (m : ℕ), m + 0 = m — the first clause of addition |
| Nat.add_succ | ∀ (m n : ℕ), m + succ n = succ (m + n) — the second clause of addition |
| Nat.zero_add | ∀ (n : ℕ), 0 + n = n — addition from the left |
| Nat.succ_add | ∀ (m n : ℕ), succ m + n = succ (m + n) — addition from the left, at a successor |
| Nat.add_assoc | ∀ (m n p : ℕ), (m + n) + p = m + (n + p) — addition is associative |
| Nat.add_comm | ∀ (m n : ℕ), m + n = n + m — addition is commutative |
| Nat.add_ne_zero | ∀ {a : ℕ} (b : ℕ), a ≠ 0 → a + b ≠ 0 — positivity is absorbing |
| Nat.mul_zero | ∀ (m : ℕ), m * 0 = 0 — the first clause of multiplication |
| Nat.mul_succ | ∀ (m n : ℕ), m * succ n = m * n + m — the second clause of multiplication |
| Nat.zero_mul | ∀ (m : ℕ), 0 * m = 0 — multiplication from the left |
| Nat.succ_mul | ∀ (m n : ℕ), succ m * n = m * n + n — multiplication from the left, at a successor |
| Nat.add_right_cancel | ∀ {m n k : ℕ}, m + k = n + k → m = n — cancellation, from the last sheet |
| Nat.add_eq_zero | ∀ {m n : ℕ}, m + n = 0 → m = 0 ∧ n = 0 — a sum is zero only when both parts are, from the last sheet |
| Nat.mul_comm | ∀ (m n : ℕ), m * n = n * m — multiplication is commutative, from the last sheet |
| Nat.mul_add | ∀ (m n p : ℕ), m * (n + p) = m * n + m * p — multiplication distributes over addition, from the last sheet |
| Nat.mul_assoc | ∀ (m n p : ℕ), (m * n) * p = m * (n * p) — multiplication associates, from the problems of the last chapter |
| Nat.add_mul | ∀ (m n p : ℕ), (m + n) * p = m * p + n * p — distributivity on the other side |
| Nat.add_left_cancel | ∀ {a m n : ℕ}, a + m = a + n → m = n — uniqueness of differences |
| Nat.lt_trichotomy | ∀ (m n : ℕ), m < n ∨ m = n ∨ n < m — trichotomy, from the theorem that ℕ is strictly ordered |
| Nat.lt_irrefl | ∀ (n : ℕ), ¬(n < n) — anti-reflexivity, from the last sheet |
| Nat.lt_trans | ∀ {m n p : ℕ}, m < n → n < p → m < p — transitivity of the strict order, from the last sheet |
| Nat.lt_succ_self | ∀ (n : ℕ), n < succ n — every number is below its successor, from the last sheet |
| Nat.not_lt_zero | ∀ {n : ℕ}, ¬(n < 0) — nothing lies below zero |
| Nat.lt_succ_iff | ∀ {m n : ℕ}, m < succ n ↔ m < n ∨ m = n — nothing lies strictly between n and succ n |
| Num.inj | ∀ {m n : ℕ}, ↑m = ↑n → m = n — distinct numbers name distinct objects of ω |
| swap_apply_left | ∀ (a b : Obj), swap a b a = b — the transposition sends a to b |
| swap_apply_right | ∀ (a b : Obj), swap a b b = a — and b to a |
| swap_apply_of_ne_of_ne | ∀ {a b x : Obj}, x ≠ a → x ≠ b → swap a b x = x — and fixes every other point |
| swap_swap | ∀ (a b x : Obj), swap a b (swap a b x) = x — a transposition is its own inverse |
| Function.iterate_zero_apply | ∀ (f : Obj → Obj) (x : Obj), f^[0] x = x — the first clause of the powers of a map |
| Function.iterate_succ_apply | ∀ (f : Obj → Obj) (n : ℕ) (x : Obj), f^[succ n] x = f^[n] (f x) — the second clause: f^[succ n] is f^[n] ∘ f |
| Function.iterate_add_apply | ∀ (f : Obj → Obj) (m n : ℕ) (x : Obj), f^[m + n] x = f^[m] (f^[n] x) — the first law of exponents |
| Nat.factorial_zero | 0 ! = succ 0 — the first clause of the factorial |
| Nat.factorial_succ | ∀ (n : ℕ), (succ n) ! = succ n * n ! — the second clause of the factorial |
| Nat.choose_zero_right | ∀ (n : ℕ), choose n 0 = succ 0 — the empty set is the one 0-subset |
| Nat.choose_eq_zero_of_lt | ∀ {n k : ℕ}, n < k → choose n k = 0 — no subset is larger than the whole |
| Nat.choose_succ_succ | ∀ (n k : ℕ), choose (succ n) (succ k) = choose n k + choose n (succ k) — Pascal's identity |
From the logical core
| And.intro | ∀ {a b : Prop}, a → b → a ∧ b |
| And.left | ∀ {a b : Prop}, a ∧ b → a |
| And.right | ∀ {a b : Prop}, a ∧ b → b |
| And.symm | ∀ {a b : Prop}, a ∧ b → b ∧ a |
| Or.inl | ∀ {a b : Prop}, a → a ∨ b |
| Or.inr | ∀ {a b : Prop}, b → a ∨ b |
| Or.elim | ∀ {a b c : Prop}, a ∨ b → (a → c) → (b → c) → c |
| Or.symm | ∀ {a b : Prop}, a ∨ b → b ∨ a |
| Iff.intro | ∀ {a b : Prop}, (a → b) → (b → a) → (a ↔ b) |
| Iff.mp | ∀ {a b : Prop}, (a ↔ b) → a → b |
| Iff.mpr | ∀ {a b : Prop}, (a ↔ b) → b → a |
| Iff.symm | ∀ {a b : Prop}, (a ↔ b) → (b ↔ a) |
| Iff.rfl | ∀ {a : Prop}, a ↔ a |
| Iff.trans | ∀ {a b c : Prop}, (a ↔ b) → (b ↔ c) → (a ↔ c) |
| True.intro | True |
| False.elim | ∀ {a : Prop}, False → a |
| absurd | ∀ {a b : Prop}, a → ¬a → b |
| id | ∀ {a : Prop}, a → a |
| mt | ∀ {a b : Prop}, (a → b) → ¬b → ¬a |
| Eq.refl | ∀ {α : Type} (a : α), a = a |
| Eq.symm | ∀ {α : Type} {a b : α}, a = b → b = a |
| Eq.trans | ∀ {α : Type} {a b c : α}, a = b → b = c → a = c |
| congrArg | ∀ {α : Type} {β : Type} {a b : α} (f : α → β), a = b → f a = f b |
| Exists.intro | ∀ {α : Type} {p : α → Prop} (w : α), p w → ∃ x : α, p x |
| Exists.elim | ∀ {α : Type} {p : α → Prop} {b : Prop}, (∃ x : α, p x) → (∀ y : α, p y → b) → b |