Answers.Body: <p>Yes the characterization is correct, and there are 58,084,310 legal collections in total.</p>
  <p>To make headway, we need the right level of discourse, avoiding loss of accuracy while avoiding diving into trivialities.</p>
  <p><strong>Necessity &amp; sufficiency of the deletion moves</strong></p>
  <p>Two kinds of operation were suggested to be necessary &amp; sufficient to reach all legal collections:</p>
  <pre><code>(1) Delete a (non-K) officer &amp; promote at most 1 wP and 1bP
  (2) Delete a P &amp; promote at most 1P of that color and at most 2Ps of the other color.
  </code></pre>
  <p>Firstly, the two criteria are necessary. To unblock a file a capture must take place. Capturing an officer will allow both pawns from a file to promote. A pawn capturing a pawn from a neighbouring file is more efficient, as it allows three pawns to promote.</p>
  <p>The condition is also sufficient, as can be seen by dividing up the board into 4 pairs of files. We have to make assumptions that the kings can keep out of the way of the action. See later for an example which explores the validity of this assumption.</p>
  <p><strong>&quot;Supply &amp; demand&quot;</strong></p>
  <p>Maybe worth moving on to the question of which collections are achievable in this way:</p>
  <ol>
  <li>Count the number of visible &quot;non-starting officers&quot; for each side (queens beyond the first; other officers beyond the second of that type): N_w &amp; N_b</li>
  <li>Count the number of &quot;awol pawns&quot; on each side: (pawns morphed into NSOs aren't counted): A_w &amp; A_b</li>
  <li>Count the number of &quot;missing officers&quot; for each sides (missing queen, or other officers less than the second of that type): M_w &amp; M_b</li>
  </ol>
  <p>Then the following elegant &quot;supply &amp; demand&quot; inequalities are necessary and sufficient criteria for a legal collection:</p>
  <pre><code>M_b + 2*A_b &gt;= N_w - M_w - A_w
  M_w + 2*A_w &gt;= N_b - M_b - A_b
  </code></pre>
  <p>Grouping the terms by White &amp; Black, the left hand side is the &quot;supply&quot;, the right hand side is the &quot;demand&quot;. The supply is always non-negative, so if the demand is zero or less, it's always satisfied. Similarly, a supply of 8+ will meet any demand that can occur.</p>
  <p>Here's an example. Can we have 18 queens on the board? Yes!</p>
  <pre><code>N_w = N_b = 8
  (because 8 promoted pawns on each side)
  
  A_w = A_b = 0
  (every missing pawn was promoted)
  
  M_w = M_b = 6
  (all Rs, Bs &amp; Ns were captured)
  
  M_b + 2*A_b &gt;= N_w - M_w - A_w
  translates to:
  6 + 2*0 &gt;= 8 - 6 - 0
  6 &gt;= 2
  </code></pre>
  <p>So this is legal. Similarly for White supply for Black demand. Even if we had the knights still on the board, so M_b = M_w = 4, the inequality would be 4 &gt;= 4, so still legal.</p>
  <p><strong>Aside on mate/stalemate</strong></p>
  <p>Some wonder if such a position can be achieved without mate or stalemate, which is a fair question. The answer is yes. It's like asking to prove that 450g of cornflakes will all fit in a box. It's a matter of common experience that one can just shake the pack and the cornflakes settle down. There are not too many cornflakes in the box. Although it's obviously illegal, it's possible to arrange the kings and up to 34(!) white queens on the board without mate or stalemate looming. At this density, it getting a bit tight, but this thought experiment shows that when we are dealing with merely 18 queens, where moreover friendly queens can shield against enemy ones, there a vast amount of slack, and no need to worry about forced mates or stalemates. Even with 18 queens, the chessboard is a very empty box of cornflakes :-)</p>
  <p><strong>Counting the collections</strong></p>
  <p>Let's focus on just the White units first. How many legal White collections are there? 8,694. Here's a quick proof.</p>
  <p>Let k be the number of visible promotions to rook, knight or bishop (i.e. officers beyond the original complement of 2 for any of these types). (For symmetry reasons, queens are dealt with in a couple of paragraphs instead.)</p>
  <p>Let v(k) be the number of different combinations of R,N,B which achieve this.</p>
  <pre><code>v(0) = 27:
  because there may be 0-2 remaining of each of R,N,B. 
  
  For k&gt;0, v(k) = (k^2 + 15*k + 38)/2
  e.g.:
  
  v(1) = again 27:
  3 ways to pick one of R,N,B to be 3; 
  &amp; 0-2 possible for each of the other two types.
  
  v(2) = 36:
  27 ways to have 4,0-2,0-2; 
  &amp; 9 ways to have 3,3,0-2.
  </code></pre>
  <p>Then the other 8-k pawns may still be Ps, or turned into Qs, or captured.</p>
  <p>Let q be the number of visible queen promotions (i.e. queens beyond the original complement of 1).</p>
  <p>Let u_k(q) be the number of different combinatorial ways we can achieve this (in terms of surviving pawns, queens and captured pawns)</p>
  <pre><code>u_k(0) = 2*(9-k)
  because we can have 0 to 8-k pawns, and the rest are captured,
  independently we have 0 or 1 queen.
  
  For q&gt;0, u_k(q) = (9-k-q)
  
  s(k) = sum(q=0,...,8-k) [u_k(q)]
  = 2*(9-k) + (8-k) + (7-k) + ... 1
  = (9-k)(12-k)/2.
  
  Check:
  s(8) = 2: 0-1Q
  s(7) = 5: 0P,0-2Q; 1P;0-1Q
  ...
  s(0) = 54: = 55-1
  
  So the total number of of legal White collections is:
  sum(k=0...8) [s(k)*v(k)]
  = 8,694
  </code></pre>
  <p>All of these white collections are indeed achievable, e.g. if Black has only bare king remaining, but in fact in many other situations too: the supply/demand inequalities are not very demanding.</p>
  <p>The next exercise involves counting for each combination of N_w, M_w ,A_w how many White collections exist.</p>
  <p>I computed the following table of numbers of collections, sorted according to the total number of pieces on the board, as shown in this table:</p>
  <p><a href="https://i.sstatic.net/fgIzm.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/fgIzm.png" alt="enter image description here" /></a></p>
  <p>For each number of units from 2-32, this shows</p>
  <ul>
  <li>v_0: the number of basic candidates without worrying about supply-demand,</li>
  <li>v_1: the number who have a single fail against supply-demand,</li>
  <li>v_2:  the number who have a double fail against supply-demand.</li>
  </ul>
  <p>To avoid double counting, the number of legal positions is computed as v_1 - 2*v_2 + v_3. My calculations match <a href="https://kirill-kryukov.com/chess/nulp/number%20of%20endgames,%20Chess,%202-32%20pieces.html" rel="nofollow noreferrer">Kryukov's prior results</a>  exactly.</p>
  <p>Note that there are no fails until one reaches 25 units. That's because with 8 captures, all candidate promotion collections can be achieved.</p>
  <p><strong>An &quot;extra credit&quot; open question</strong> (work in progress)</p>
  <p>Retro enthusiasts further distinguish between the colour of squares the bishops are on, since that is an invariant. This has a major, visible impact on potential legality, is part of the essential classification for chess tablebases, and is also an aesthetic concern in composition. The corresponding term then is &quot;non-standard officers&quot; (queens or &quot;tinted&quot; bishops beyond the first; rooks or knights beyond the second). The count of missing officers is based on the same 5 types. The determination of which additional inequalities are necessary and sufficient to characterize legal collections is now substantially more complicated.</p>
  <p>The best approach may be to first apply the adapted supply/demand inequalities. Then can ask how many extra pawn captures are required to &quot;nudge&quot; certain bishops to the correct tint?</p>
  <p>A pawn capture of an officer/pawn will result in a batch of respectively 2/3 pawns all promoted on same tint squares, but it seems that for each such batch, we are free to choose the tint independently.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-21T12:33:32.990Z
Answers.Text: @domotorp: yes! There's all kinds of random constraints: e.g. if 20 bishops are on the board, then the number of white & black light-tint bishops differs by at most 2. Need some systematic way to simplify the possibilities in order to be able to focus on real limiting factors
Answers.UserDisplayName: Laska
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-21T14:35:25.837Z
Answers.Text: Cool write-up of a lot of things, especially the bishop tint. I agree there are 8694 legal collections considering only pieces of a single color. However, I think there are 58084310 legal collections total. This write-up by someone else agrees: https://www.stmintz.com/ccc/index.php?id=77068 (see section 2.2 and especially the inequality constraint (1))
Answers.UserDisplayName: A. Rex
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-25T14:56:38.707Z
Answers.Text: @A.Rex ok I found the bug which was just in the totting up. The main spreadsheets were ok, phew! Answer updated, thanks for support
Answers.UserDisplayName: Laska
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-20T08:13:17.583Z
Answers.Text: Yes, you are right, the tint of the bishops is a brilliant observation! If no pieces are missing, except for $x$ black and $2x$ white pawns, and there are $2x$ additional white bishops, then an even number of them must be on white-squares (so with the original white-squared white bishop, an odd number of them).
Answers.UserDisplayName: domotorp
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-19T19:04:04.663Z
Answers.LastActivityDate: 2021-01-25T14:55:09.140Z
Answers.LastEditDate: 2021-01-25T14:55:09.140Z
Answers.UserDisplayName: Laska
Body: <p>Call a collection of (white <em>and</em> black) chess pieces <em>legal</em> if it occurs in the position of a legal chess game. For example, <code>KQRRBBNNPPPPPPPPkqrrbbnnpppppppp</code> is the collection at the beginning of the game. It seems any subset of this (still containing the two kings) is possible as well. But sometimes you can have lots of promotions, so for example <code>Kkqqqqqqqq</code> is possible if black promotes all eight pawns to queens while all other pieces are captured.</p>
  <p><strong>Which collections of pieces are legal?</strong></p>
  <p><a href="https://mathoverflow.net/a/138167/1079">This answer on MathOverflow</a> conjectures/states without proof that the legal collections are those that can be obtained from the starting collection using the following two operations:</p>
  <ol>
  <li><p>Delete any (non-king) piece and promote at most one white and at most one black pawn.</p>
  </li>
  <li><p>Delete a pawn and promote at most one pawn of the same color and at most two pawns of the opposite color.</p>
  </li>
  </ol>
  <p>Is this characterization correct?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-12-14T17:46:09.303Z
Comments.Text: Certainly any legal collection can be generated by those two operations: in order to promote a white pawn, that pawn must somehow "overtake" its opposing black pawn. So either 1) the pawn must move to a different rank by taking a piece. Doing so also allows the opposing black pawn to promote. Or 2) The opposing black pawn must be taken. If it is pawn that takes this opposing black pawn, then the two white pawns can promote, as can the black pawn whose rank is cleared by the capturing pawn. What's not obvious, however, is that all such collections are actually possible!
Comments.UserDisplayName: Mathmo123
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-12-14T17:49:16.660Z
Comments.Text: For example, KQQQQQQQQQRRBBNNk can be generated from those operations... Is there any way that many promotions can actually happen without the black king already being in checkmate? It seems hard to answer such a question for all possible collections!
Comments.UserDisplayName: Mathmo123
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-12-14T18:19:07.177Z
Comments.Text: Indeed. Perhaps a program could achieve the task given a desired collection? Your particular configuration is a popular one to attempt: https://chess.stackexchange.com/q/19936/25684
Comments.UserDisplayName: A. Rex
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-12-14T22:46:00.380Z
Comments.Text: @Mathmo123 Or 3) the opposing pawn moves out of the way by capturing.
Comments.UserDisplayName: Steve Bennett
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-12-15T09:18:34.937Z
Comments.Text: Is it possible to get to Kkqqqqqqqq without achieving checkmate before it happens?
Comments.UserDisplayName: JeffUK
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-12-15T11:25:47.270Z
Comments.Text: @SteveBennett True, although that is included in (1) with the roles of white and black swapped (if the black pawn captures, that pawn and its opposing white pawn can promote)
Comments.UserDisplayName: Mathmo123
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-12-15T11:52:11.833Z
Comments.Text: @JeffUK Yes, see the linked question just above. (In that example, white has all their other pieces, but I think the same principle applies.)
Comments.UserDisplayName: Steve Bennett
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-12-15T16:22:23.013Z
Comments.Text: @JeffUK yes, you can put all queens in one corner for instance. Qa1-a3-c1-c3 fill out that square, then e.g. e8 is save. (also the winning sides king can block checks)
Comments.UserDisplayName: koedem
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-12-15T16:35:43.903Z
Comments.Text: @koedem Yeah I'm seeing it now,  if you put the Qs on all black squares any non-perpendicular white square is safe and vice-versa,  I would love to see a game that actually ends in that position! Edit : https://chess.stackexchange.com/questions/4123/maximum-number-of-queens-possible
Comments.UserDisplayName: JeffUK
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-12-15T16:42:26.070Z
Comments.Text: It's not possible to get 18 queens without sacrificing 4 pieces to allow the pawns to be doubled,  does that break the mathoverflow proof by exception?
Comments.UserDisplayName: JeffUK
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-01-18T21:28:33.577Z
Comments.Text: @Mathmo123 1. "Pass" is a better than than "overtake". 2. For a white pawn to promote, the opposing black pawn must move out of the way. If the white pawn moves out of the way, it just gets a new black pawn in its way. 3. The pawn must move to a different file, not a different rank.
Comments.UserDisplayName: Acccumulation
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-01-18T21:34:09.307Z
Comments.Text: @Acccumulation Your point 2 is not necessarily true; it could have already passed the black pawn on the adjacent rank.
Comments.UserDisplayName: D M
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-01-20T03:15:29.713Z
Comments.Text: @Mathmo123: You ask if so many promotions take place without checkmate. From a math perspective it could be fiddly to list all the cases. From a chess perspective, we know that the situation is loose enough that Black king can share a board with White king and up to 39 black queens without mate or stalemate. So there's a huge amount of slack
Comments.UserDisplayName: Laska
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-01-20T03:18:18.830Z
Comments.Text: @JeffUK for 18 queens need 8 officer captures, and that's what the mathoverflow allows
Comments.UserDisplayName: Laska
Tags: <pawn-promotion><mathematics><pieces>
Title: Which collections of pieces are legal?
ThreadText: # Which collections of pieces are legal?
  
  (Asked by: username_0 on 2020-12-14)
  
  Call a collection of (white *and* black) chess pieces *legal* if it occurs in the position of a legal chess game. For example, `KQRRBBNNPPPPPPPPkqrrbbnnpppppppp` is the collection at the beginning of the game. It seems any subset of this (still containing the two kings) is possible as well. But sometimes you can have lots of promotions, so for example `Kkqqqqqqqq` is possible if black promotes all eight pawns to queens while all other pieces are captured.
  
  **Which collections of pieces are legal?**
  
  [This answer on MathOverflow](https://mathoverflow.net/a/138167/1079) conjectures/states without proof that the legal collections are those that can be obtained from the starting collection using the following two operations:
  
  1. Delete any (non-king) piece and promote at most one white and at most one black pawn.
  2. Delete a pawn and promote at most one pawn of the same color and at most two pawns of the opposite color.
  
  Is this characterization correct?
  
  **Tags:** pawn-promotion, mathematics, pieces
  
  > **Comments:**
  > **username_1**: Certainly any legal collection can be generated by those two operations: in order to promote a white pawn, that pawn must somehow "overtake" its opposing black pawn. So either 1) the pawn must move to a different rank by taking a piece. Doing so also allows the opposing black pawn to promote. Or 2) The opposing black pawn must be taken. If it is pawn that takes this opposing black pawn, then the two white pawns can promote, as can the black pawn whose rank is cleared by the capturing pawn. What's not obvious, however, is that all such collections are actually possible!  
  > **username_1**: For example, KQQQQQQQQQRRBBNNk can be generated from those operations... Is there any way that many promotions can actually happen without the black king already being in checkmate? It seems hard to answer such a question for all possible collections!  
  > **username_0**: Indeed. Perhaps a program could achieve the task given a desired collection? Your particular configuration is a popular one to attempt: https://chess.stackexchange.com/q/19936/25684  
  > **username_2**: @username_1 Or 3) the opposing pawn moves out of the way by capturing.  
  > **username_3**: Is it possible to get to Kkqqqqqqqq without achieving checkmate before it happens?  
  > **username_1**: @SteveBennett True, although that is included in (1) with the roles of white and black swapped (if the black pawn captures, that pawn and its opposing white pawn can promote)  
  > **username_2**: @username_3 Yes, see the linked question just above. (In that example, white has all their other pieces, but I think the same principle applies.)  
  > **username_4**: @username_3 yes, you can put all queens in one corner for instance. Qa1-a3-c1-c3 fill out that square, then e.g. e8 is save. (also the winning sides king can block checks)  
  > **username_3**: @username_4 Yeah I'm seeing it now,  if you put the Qs on all black squares any non-perpendicular white square is safe and vice-versa,  I would love to see a game that actually ends in that position! Edit : https://chess.stackexchange.com/questions/4123/maximum-number-of-queens-possible  
  > **username_3**: It's not possible to get 18 queens without sacrificing 4 pieces to allow the pawns to be doubled,  does that break the mathoverflow proof by exception?  
  > **username_5**: @username_1 1. "Pass" is a better than than "overtake". 2. For a white pawn to promote, the opposing black pawn must move out of the way. If the white pawn moves out of the way, it just gets a new black pawn in its way. 3. The pawn must move to a different file, not a different rank.  
  > **username_6**: @username_5 Your point 2 is not necessarily true; it could have already passed the black pawn on the adjacent rank.  
  > **username_7**: @username_1: You ask if so many promotions take place without checkmate. From a math perspective it could be fiddly to list all the cases. From a chess perspective, we know that the situation is loose enough that Black king can share a board with White king and up to 39 black queens without mate or stalemate. So there's a huge amount of slack  
  > **username_7**: @username_3 for 18 queens need 8 officer captures, and that's what the mathoverflow allows  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_7 on 2021-01-19. Score: 6
  
  Yes the characterization is correct, and there are 58,084,310 legal collections in total.
  To make headway, we need the right level of discourse, avoiding loss of accuracy while avoiding diving into trivialities.
  Necessity & sufficiency of the deletion moves
  Two kinds of operation were suggested to be necessary & sufficient to reach all legal collections:
  (1) Delete a (non-K) officer & promote at most 1 wP and 1bP
  (2) Delete a P & promote at most 1P of that color and at most 2Ps of the other color.
  
  Firstly, the two criteria are necessary. To unblock a file a capture must take place. Capturing an officer will allow both pawns from a file to promote. A pawn capturing a pawn from a neighbouring file is more efficient, as it allows three pawns to promote.
  The condition is also sufficient, as can be seen by dividing up the board into 4 pairs of files. We have to make assumptions that the kings can keep out of the way of the action. See later for an example which explores the validity of this assumption.
  "Supply & demand"
  Maybe worth moving on to the question of which collections are achievable in this way:
  
  Count the number of visible "non-starting officers" for each side (queens beyond the first; other officers beyond the second of that type): N_w & N_b
  Count the number of "awol pawns" on each side: (pawns morphed into NSOs aren't counted): A_w & A_b
  Count the number of "missing officers" for each sides (missing queen, or other officers less than the second of that type): M_w & M_b
  
  Then the following elegant "supply & demand" inequalities are necessary and sufficient criteria for a legal collection:
  M_b + 2*A_b >= N_w - M_w - A_w
  M_w + 2*A_w >= N_b - M_b - A_b
  
  Grouping the terms by White & Black, the left hand side is the "supply", the right hand side is the "demand". The supply is always non-negative, so if the demand is zero or less, it's always satisfied. Similarly, a supply of 8+ will meet any demand that can occur.
  Here's an example. Can we have 18 queens on the board? Yes!
  N_w = N_b = 8
  (because 8 promoted pawns on each side)
  
  A_w = A_b = 0
  (every missing pawn was promoted)
  
  M_w = M_b = 6
  (all Rs, Bs & Ns were captured)
  
  M_b + 2*A_b >= N_w - M_w - A_w
  translates to:
  6 + 2*0 >= 8 - 6 - 0
  6 >= 2
  
  So this is legal. Similarly for White supply for Black demand. Even if we had the knights still on the board, so M_b = M_w = 4, the inequality would be 4 >= 4, so still legal.
  Aside on mate/stalemate
  Some wonder if such a position can be achieved without mate or stalemate, which is a fair question. The answer is yes. It's like asking to prove that 450g of cornflakes will all fit in a box. It's a matter of common experience that one can just shake the pack and the cornflakes settle down. There are not too many cornflakes in the box. Although it's obviously illegal, it's possible to arrange the kings and up to 34(!) white queens on the board without mate or stalemate looming. At this density, it getting a bit tight, but this thought experiment shows that when we are dealing with merely 18 queens, where moreover friendly queens can shield against enemy ones, there a vast amount of slack, and no need to worry about forced mates or stalemates. Even with 18 queens, the chessboard is a very empty box of cornflakes :-)
  Counting the collections
  Let's focus on just the White units first. How many legal White collections are there? 8,694. Here's a quick proof.
  Let k be the number of visible promotions to rook, knight or bishop (i.e. officers beyond the original complement of 2 for any of these types). (For symmetry reasons, queens are dealt with in a couple of paragraphs instead.)
  Let v(k) be the number of different combinations of R,N,B which achieve this.
  v(0) = 27:
  because there may be 0-2 remaining of each of R,N,B. 
  
  For k>0, v(k) = (k^2 + 15*k + 38)/2
  e.g.:
  
  v(1) = again 27:
  3 ways to pick one of R,N,B to be 3; 
  & 0-2 possible for each of the other two types.
  
  v(2) = 36:
  27 ways to have 4,0-2,0-2; 
  & 9 ways to have 3,3,0-2.
  
  Then the other 8-k pawns may still be Ps, or turned into Qs, or captured.
  Let q be the number of visible queen promotions (i.e. queens beyond the original complement of 1).
  Let u_k(q) be the number of different combinatorial ways we can achieve this (in terms of surviving pawns, queens and captured pawns)
  u_k(0) = 2*(9-k)
  because we can have 0 to 8-k pawns, and the rest are captured,
  independently we have 0 or 1 queen.
  
  For q>0, u_k(q) = (9-k-q)
  
  s(k) = sum(q=0,...,8-k) [u_k(q)]
  = 2*(9-k) + (8-k) + (7-k) + ... 1
  = (9-k)(12-k)/2.
  
  Check:
  s(8) = 2: 0-1Q
  s(7) = 5: 0P,0-2Q; 1P;0-1Q
  ...
  s(0) = 54: = 55-1
  
  So the total number of of legal White collections is:
  sum(k=0...8) [s(k)*v(k)]
  = 8,694
  
  All of these white collections are indeed achievable, e.g. if Black has only bare king remaining, but in fact in many other situations too: the supply/demand inequalities are not very demanding.
  The next exercise involves counting for each combination of N_w, M_w ,A_w how many White collections exist.
  I computed the following table of numbers of collections, sorted according to the total number of pieces on the board, as shown in this table:
  
  For each number of units from 2-32, this shows
  
  v_0: the number of basic candidates without worrying about supply-demand,
  v_1: the number who have a single fail against supply-demand,
  v_2:  the number who have a double fail against supply-demand.
  
  To avoid double counting, the number of legal positions is computed as v_1 - 2*v_2 + v_3. My calculations match Kryukov's prior results  exactly.
  Note that there are no fails until one reaches 25 units. That's because with 8 captures, all candidate promotion collections can be achieved.
  An "extra credit" open question (work in progress)
  Retro enthusiasts further distinguish between the colour of squares the bishops are on, since that is an invariant. This has a major, visible impact on potential legality, is part of the essential classification for chess tablebases, and is also an aesthetic concern in composition. The corresponding term then is "non-standard officers" (queens or "tinted" bishops beyond the first; rooks or knights beyond the second). The count of missing officers is based on the same 5 types. The determination of which additional inequalities are necessary and sufficient to characterize legal collections is now substantially more complicated.
  The best approach may be to first apply the adapted supply/demand inequalities. Then can ask how many extra pawn captures are required to "nudge" certain bishops to the correct tint?
  A pawn capture of an officer/pawn will result in a batch of respectively 2/3 pawns all promoted on same tint squares, but it seems that for each such batch, we are free to choose the tint independently.
  
  > **Comments:**
  > **username_8**: Yes, you are right, the tint of the bishops is a brilliant observation! If no pieces are missing, except for $x$ black and $2x$ white pawns, and there are $2x$ additional white bishops, then an even number of them must be on white-squares (so with the original white-squared white bishop, an odd number of them).  
  > **username_7**: @username_8: yes! There's all kinds of random constraints: e.g. if 20 bishops are on the board, then the number of white & black light-tint bishops differs by at most 2. Need some systematic way to simplify the possibilities in order to be able to focus on real limiting factors  
  > **username_0**: Cool write-up of a lot of things, especially the bishop tint. I agree there are 8694 legal collections considering only pieces of a single color. However, I think there are 58084310 legal collections total. This write-up by someone else agrees: https://www.stmintz.com/ccc/index.php?id=77068 (see section 2.2 and especially the inequality constraint (1))  
  > **username_7**: @A.Rex ok I found the bug which was just in the totting up. The main spreadsheets were ok, phew! Answer updated, thanks for support  
  
  ---
  
  