Answers.Body: <p>I haven’t come across this question before. I don’t have the time to execute it, but hope these remarks and suggested approach are helpful.</p>
  <p>First let’s clarify:
  (1) without loss of generality, white is mating black
  (2) position must be legal - in particularly white king must be on the board even if it doesn’t otherwise contribute to the mate.
  (3) legitimately promoted non-standard material is fine.
  (4) position must be minimal in that no subset of pieces can be removed to allow a position which still satisfies 1,2&amp;3 above.</p>
  <p>An algorithm could involve putting bK and the checking unit(s). Then consider all the flights, and the different ways they might be blocked. If a black unit might also interfere with check, then that interference needs to be covered. Then can find all the positions for wK if it’s not already placed. This gives a long list of positions which can be checked briefly for legality.</p>
  <p>Mostly the positions will be left/right symmetric but there are a very few involving castling.</p>
  <p>There are also some quite subtle positions where the position is only mate if we cannot prove that en passant is legal defence. Even some involving dead position rule.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-20T09:00:59.657Z
Answers.Text: It would probably be clever to start small with the checkmates with a given material (which has been calculated at least implicitely during the generation of tablebases for <=7 pieces).
Answers.UserDisplayName: Hauke Reddmann
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-21T18:34:21.953Z
Answers.Text: @Laska Yes, you seem to grasp the main ideas and your clarifications are correct. However, I want to be clear on one minor point that, unless I'm mistaken, you didn't fully understand. It doesn't matter what moves construct the position as long as it is legal. I can't think of any positions that can be constructed by castling that cannot be constructed simply by moving the pieces around the long way (unless pawns get in the way I guess?). I hadn't considered en passant but I'm not exactly sure what you mean by "cannot prove that en passant is legal defense".
Answers.UserDisplayName: Playingwithnumbers
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-21T18:41:52.680Z
Answers.Text: Dead positions are of course relevant; both in determining whether such positions exist at all for a particular material configuration and for implememting an algorithm like the type you suggested.
Answers.UserDisplayName: Playingwithnumbers
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-21T19:36:32.937Z
Answers.Text: @Hauke Reddmann Yes we have the answers for up to 7 pieces buried in the Lomonosov tablebases. This problem is much easier to solve than tablebases are so I felt that people might be able to get farther with this alone. The n=1 and n=2 cases are not difficult. For n=1 pawn can be ignored, bishop/knight don't have any, rook has 1 on the corner and 1 on the edge although these are the same checkmate just shifted end of the board, and the queen has 2 on the edge and 2 on the corner but 1 of them is the same as the rook. This treats some placements of the king/queen/rook as identical checkmates.
Answers.UserDisplayName: Playingwithnumbers
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-21T20:27:09.600Z
Answers.Text: @Playingwithnumbers: Regarding castling - Kg1 Rf1 Rf2/Ka1 ;-)
Answers.UserDisplayName: Hauke Reddmann
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-20T08:34:37.283Z
Answers.LastActivityDate: 2021-03-20T18:43:36.550Z
Answers.LastEditDate: 2021-03-20T18:43:36.550Z
Answers.UserDisplayName: Laska
Body: <p>What is the number of distinct checkmate positions in each of the following categories given the following conditions?</p>
  <ol>
  <li><p>We are not interested in whether the position can be forced or not or even what sequences of moves can produce the positions. Similarly, these positions are irrespective of player color.</p>
  </li>
  <li><p>Promotion is only allowed if it will produce a set of pieces not possible from the initial set like 3 knights.</p>
  </li>
  <li><p>Redundant pieces like duplicate attackers and other pieces not contributing to the mate are not present.</p>
  </li>
  </ol>
  <p>Then how many exist in each of these categories?</p>
  <ol>
  <li><p>A checkmate can exist on a corner, edge or the center, that is to say with 3 adjacent squares, 5, or 8.</p>
  </li>
  <li><p>Let n denote the number of pieces on the board excluding kings. Consider the number of partitions in 2 parts of n. Except for the single case of giving all of the pieces to one player this is the number of ways to divide the pieces between black and white. Of course this doesn't account for what the pieces are, but the question is only about the total number not what the positions actually are.</p>
  </li>
  <li><p>Then what is the number of checkmates for each relevant partition of each n subdivided by corner, edge, or center? Individual solutions for n=1 up to n=30 as much as possible (not that any positions with 32 pieces would satisfy condition #3. It is probably satisfied only for much smaller n). Although it is obvious I should also mention that for n&gt;15 the real number of relevant partitions is smaller because neither player can have &gt;16 pieces.</p>
  </li>
  </ol>
  <p>Again it doesn't matter whether the solution is constructive or not. I suppose a full solution at all is unlikely and a constructive solution would a wonderful bonus.</p>
  
Tags: <theory><checkmate><mathematics>
Title: Number of distinct checkmate positions
ThreadText: # Number of distinct checkmate positions
  
  (Asked by: username_0 on 2021-03-18)
  
  What is the number of distinct checkmate positions in each of the following categories given the following conditions?
  
  1. We are not interested in whether the position can be forced or not or even what sequences of moves can produce the positions. Similarly, these positions are irrespective of player color.
  2. Promotion is only allowed if it will produce a set of pieces not possible from the initial set like 3 knights.
  3. Redundant pieces like duplicate attackers and other pieces not contributing to the mate are not present.
  
  Then how many exist in each of these categories?
  
  1. A checkmate can exist on a corner, edge or the center, that is to say with 3 adjacent squares, 5, or 8.
  2. Let n denote the number of pieces on the board excluding kings. Consider the number of partitions in 2 parts of n. Except for the single case of giving all of the pieces to one player this is the number of ways to divide the pieces between black and white. Of course this doesn't account for what the pieces are, but the question is only about the total number not what the positions actually are.
  3. Then what is the number of checkmates for each relevant partition of each n subdivided by corner, edge, or center? Individual solutions for n=1 up to n=30 as much as possible (not that any positions with 32 pieces would satisfy condition #3. It is probably satisfied only for much smaller n). Although it is obvious I should also mention that for n>15 the real number of relevant partitions is smaller because neither player can have >16 pieces.
  
  Again it doesn't matter whether the solution is constructive or not. I suppose a full solution at all is unlikely and a constructive solution would a wonderful bonus.
  
  **Tags:** theory, checkmate, mathematics
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-03-20. Score: 3
  
  I haven’t come across this question before. I don’t have the time to execute it, but hope these remarks and suggested approach are helpful.
  
  First let’s clarify:
  (1) without loss of generality, white is mating black
  (2) position must be legal - in particularly white king must be on the board even if it doesn’t otherwise contribute to the mate.
  (3) legitimately promoted non-standard material is fine.
  (4) position must be minimal in that no subset of pieces can be removed to allow a position which still satisfies 1,2&3 above.
  
  An algorithm could involve putting bK and the checking unit(s). Then consider all the flights, and the different ways they might be blocked. If a black unit might also interfere with check, then that interference needs to be covered. Then can find all the positions for wK if it’s not already placed. This gives a long list of positions which can be checked briefly for legality.
  
  Mostly the positions will be left/right symmetric but there are a very few involving castling.
  
  There are also some quite subtle positions where the position is only mate if we cannot prove that en passant is legal defence. Even some involving dead position rule.
  
  > **Comments:**
  > **username_2**: It would probably be clever to start small with the checkmates with a given material (which has been calculated at least implicitely during the generation of tablebases for <=7 pieces).  
  > **username_0**: @username_1 Yes, you seem to grasp the main ideas and your clarifications are correct. However, I want to be clear on one minor point that, unless I'm mistaken, you didn't fully understand. It doesn't matter what moves construct the position as long as it is legal. I can't think of any positions that can be constructed by castling that cannot be constructed simply by moving the pieces around the long way (unless pawns get in the way I guess?). I hadn't considered en passant but I'm not exactly sure what you mean by "cannot prove that en passant is legal defense".  
  > **username_0**: Dead positions are of course relevant; both in determining whether such positions exist at all for a particular material configuration and for implememting an algorithm like the type you suggested.  
  > **username_0**: @username_2 Yes we have the answers for up to 7 pieces buried in the Lomonosov tablebases. This problem is much easier to solve than tablebases are so I felt that people might be able to get farther with this alone. The n=1 and n=2 cases are not difficult. For n=1 pawn can be ignored, bishop/knight don't have any, rook has 1 on the corner and 1 on the edge although these are the same checkmate just shifted end of the board, and the queen has 2 on the edge and 2 on the corner but 1 of them is the same as the rook. This treats some placements of the king/queen/rook as identical checkmates.  
  > **username_2**: @username_0: Regarding castling - Kg1 Rf1 Rf2/Ka1 ;-)  
  
  ---
  
  