aa r X i v : . [ m a t h . HO ] J u l Hall’s Marriage Theorem and Pawn Diagrams
Colin McDonagh
Abstract —This paper is concerned with unreachable pawndiagrams and the subset of which can be generated usingHall’s Marriage Theorem. The result is 1 in 23 diagrams areunreachable by applying the theorem.
Index Terms —chess, combinatorics
I. I
NTRODUCTION
A. Background
A chess diagram [1] is defined as the contents of the 64squares, whereas a position also takes into account which sideis to move, castling rights and any en-passant square.Certain single-side pawn diagrams are unreachable as pawnsmay only move forward or diagonally forward. Consider“Fig. 1”. In order for a pawn to be on a3 , it must have comefrom b2 . However, since there’s a pawn on b2 , this diagramcould never arise in a game. Z0Z0Z0Z0 Z0Z0Z0Z0 O0Z0Z0Z0 PO0Z0Z0Z Z0Z0Z0Z0 a b c d e f g h
Fig. 1. A simple unreachable diagram
This paper assumes pawns can move diagonally forwardwithout limit. In reality pawns can only move diagonally bycapturing an opposition chessman (a pawn or a piece), apartfrom the King.
B. Literature Review
There doesn’t seem to be many papers written on thenumber of diagrams and positions in chess. However, oneparticular paper [2] gives a detailed method for calculating anupper bound for the number of reachable positions in chess.Said paper mentions that it over-counts the number of positionsbecause of unreachable pawn diagrams such as in “Fig. 1”,which is the motivation for this paper.II. F
ILE -R ANGES
A pawn on any valid square ( a2-h7 ) maps to a range of filesfrom which it could have started on. For example in “Fig. 2”, the pawn on d4 could have started on the b-f files. Let thisrange of files be known as a pawn’s range or file-range .If either of the edge files ( a , h ) are included in a pawn’srange, and the size of the range is greater than 1, i.e. the pawnis off its starting square, then the file-range does not uniquelyidentify the pawn. Consider “Fig. 3”, where a6 , b5 and c4have the same file-range of a-e . Z0Z0Z0Z Z0Z0Z0Z Z0Z0Z0Z a b c d e f g
Fig. 2. File-range for a pawn on d4. Line illustrates range. Z0Z0Z0 PZ0Z0Z ZPZ0Z0 Z0Z0Z0 Z0Z0Z0 a b c d e f
Fig. 3. File-range which maps multiple pawn-squares.
It’s interesting to note that a file-range which does notinclude an edge file must have an even length, as every squarea pawn advances, its range increases by one either side of thepawn. This can be seen in “Fig. 2”. Therefore a file-range of b-c is invalid. A file-range which includes an edge file canhave an odd size, as shown in “Fig. 3”.III. T HE U NREACHABLE C ONDITION
A. Hall’s Marriage Theorem
Digressing shortly, [3] let S be a finite family of finite sets.Suppose that for every subfamily R of sets in S , the numberof subsets in R is less than or equal to the total number ofelements in those subsets: | R | ≤ (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) [ X ∈ R X (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) his is known as Hall’s Marriage Theorem (which in thispaper is also referred to as Hall’s Condition). A less formaldefinition exists which is where the theorem gets its namefrom: suppose there are a finite set of single men, and, foreach man, a finite set of compatible women whom the man isattracted to. For any subset of men, if the number of menis greater than the size of the union of the mens’ sets ofcompatible women, then each man cannot find or be pairedwith a compatible woman. B. Applying Hall’s Condition
If we substitute man for pawn then we have the following:suppose there are a finite set of pawns, and, for each pawn,a finite set of files from which the pawn could have startedon. For any subset of pawns, if the number of pawns isgreater than the number of files from which the pawns couldhave started on, then the diagram is unreachable. And henceHall’s Condition can be used to verify whether a diagram isunreachable.For example, consider “Fig. 1”. The pawn on a3 has a rangeof a-b , the pawn on a2 is already on its starting square andhence its range is a , and similarly for the b2 pawn which hasa range of b . The union of ranges is { a, b }, which has a sizeof 2. Since there are 3 pawns on the board, the position isunreachable. IV. F ILE -R ANGE B UCKETS
A. Definition of a Bucket
Let the set of file-ranges which are subranges of some range r , be defined as the File-Range Bucket (or just
Bucket ) of r ,where a file-range f is a subrange of r if f ⊆ r . More directlyput: B r = { f : f ∈ r } where B r is the Bucket of r .For example, consider “Fig. 4” and “Fig. 5”. Z0Z0Z0Z Z0Z0Z0Z Z0Z0Z0Z a b c d e f g
Fig. 4. Squares covered by the b-f
Bucket. Z0Z0 Z0Z0 Z0Z0 a b c d
Fig. 5. Squares covered by the a-c
Bucket.
Buckets are a useful construct because the number of waysin which a Bucket can satisfy Hall’s Condition correspondsdirectly to a number of unreachable diagrams.V. M
ULTIPLE B UCKETS
A. Non-disjoint Buckets
An unreachable diagram may correspond to multiple Buck-ets for which Hall’s Condition is satisfied. If the Bucketsare disjoint, this is trivial problem to solve. However, whennon-disjoint, determining the number of ways in which Hall’sCondition can be satisfied for each Bucket is non-trivial.Given a collection of Buckets, S , and for some subset s ∈ S ,let the intersection I s represent the squares common to allBuckets in s . Consider “Fig. 6” as an example. Z0Z0Z0Z Z0Z0Z0Z Z0Z0Z0Z a b c d e f g
Fig. 6. Buckets a-b (1), a-c (2) and b-f (3). I is marked with circles, I is marked with a square and I is marked with small disks. B. Mapping Squares
Let the set of k-element subsets of S be represented by (cid:0) Sk (cid:1) [4]. Furthermore, let us define the prime of s as: s ′ = (cid:18) S | s | (cid:19) , s ′ = s Using the intersection s and the other |s|-fold intersections wecan then define the intersection difference of s to be: D s = I s \ [ q ∈ s ′ I q In this way, each square covered by the Buckets is distinctlymapped to some D s , as shown in “Fig. 7”. For | s | = 1 , I s represents the squares covered by the single Bucket. Thishelps simplify “Algorithm 1”. Z0Z0Z0Z Z0Z0Z0Z Z0Z0Z0Z a b c d e f g
Fig. 7. Buckets a-b (1), a-c (2) and b-f (3). D is marked with a circle, | D | = 0 , and D is marked with a small disk. Furthermore, D ismarked with a gray X , D is marked with gray squares and D is markedwith gray plus signs. C. Counting Diagrams
Hall’s Condition must hold for each Bucket. Given Buckets B , B , ...B n , and respective Bucket widths W , W , ...W n ,the set of unreachable diagrams for the Buckets can berepresented by: U = { u : u ⊆ B ∪ B ∪ . . . B n ∧ | u ∩ B i | > W i } In order to count U , we can deal with the given Buckets’intersection differences, D , which are easier to reason abouton account of being disjoint.Let P represent a counter for a number of pawns containedby a difference intersection d , and let P be associated with d through dot notation, i.e. d.P . The algorithm in “Algorithm 1”then describes how to traverse D to count the Buckets’unreachable diagrams.VI. E XTENDING B UCKETS
Many unreachable diagrams consist of an unreachablegrouping of pawns and some other reachable subset. Forexample, in “Fig. 8”, the a-c
Bucket may be combined witha selection of 0-5 pawns on the light-gray highlighted squaresto generate other unreachable diagrams. Z0Z0Z0Z0 Z0Z0Z0Z0 Z0Z0Z0Z0 Z0Z0Z0Z0 a b c d e f g h
Fig. 8. The a-c
Bucket’s unreachable diagrams are formed from meetingHall’s Condition, and placing 0-5 pawns on the light-gray highlighted squares.
One such unreachable diagram for the a-c
Bucket is givenin “Fig. 9”.
Algorithm 1
Counting Buckets’ unreachable diagramsindex ← while index ≥ do err ← SET M INIMUMS (index) if !err then COMPUTE P ERMUTATIONS index ← INCREMENT D function SET M INIMUMS (index)numPawns ← for d ∈ D do d.P ← GET M INIMUM (d)numPawns ← numPawns + d.P return numPawns > 8 function GET M INIMUM (d)dmin ← |d| for b ∈ Buckets which contain d do bmin ← minimum number of pawns b needs fromd such that it may fulfil Hall’s Condition by the end of the setMinimums traversaldmin ← min(dmin, bmin) return dmin function COMPUTE P ERMUTATIONS permutations ← for d ∈ D do permutations ← permutations * (cid:0) | d | d.P (cid:1) store permutations function INCREMENT D for i=|D|-1 to 0 doif | D i | > D i .P then D i .P ← D i .P + 1 return i return -1 Z0Z0Z0Z0 Z0Z0Z0Z0 Z0Z0Z0Z0 Z0Z0Z0Z0 a b c d e f g h
YPYPYP YP
Fig. 9. One unreachable diagram for the a-c
Bucket.
VII. D
UPLICATE D IAGRAMS
A. An Example
Any two Buckets (Buckets and extended Buckets, but forbrevity sake we’ll just refer to them as Buckets) may havea subset of common unreachable diagrams. For example,firstly consider “Fig. 10”, in which we see an unreachableiagram for the a-c Bucket. Now consider the same diagramin “‘Fig. 11”, which illustrates that the diagram also belongsto the a-d
Bucket. Z0Z0Z0Z0 Z0Z0Z0Z0 Z0Z0Z0Z0 Z0Z0Z0Z0 a b c d e f g h
YPYPYPYPYPYP
Fig. 10. Another unreachable diagram for the a-c Bucket. Z0Z0Z0Z0 Z0Z0Z0Z0 Z0Z0Z0Z0 Z0Z0Z0Z0 a b c d e f g h
YPYPYPYPYPYP
Fig. 11. The same unreachable diagram also belongs to the a-d Bucket.
B. Applying the Principle of Inclusion and Exclusion
We can account for duplicate diagrams using the Principleof Inclusion and Exclusion (PIE) sieve method. Let C bea collection of Buckets. Let I k represent the set of k-fold intersections of members of C (duplicate diagrams whichbelong to k different Buckets in C ). The general form of PIE[5] states that: (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) N [ i =1 A i (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) = N X j =1 (cid:18) ( − j +1 X S ∈ I j | S | (cid:19) In word form, PIE can count the number of distinct unreach-able diagrams by first summing the number of unreachablediagrams which belong to any single Bucket, then subtractingthe number of unreachable diagrams which belong to any 2Buckets, then adding the number of unreachable diagramswhich belong to any 3 Buckets etc.VIII. R
ESULTS
The results obtained are shown in “Table. I”.From this table, the average percentage of all conceivablesingle-side pawn diagrams which are unreachable is
TABLE ID
IAGRAMS
Pawns