The title is my question for now.

I also wonder if similar legality concerns may reduce the number of input FENs as checkmates used as input to the retrograde proofing or construction process. In principle this could apply to any number of men, but this might be simpler for positions with smaller numbers of units (i.e. 8 or less, to be in tablebase range)

How this question came about: it occurred to me that there are many input positions that we can statically agree are not possibly legally reachable from a standard game array, or even one in Chess960. We might exclude these positions from consideration, using a retrograde logic "generator" which would be a subset of the FIDE rules possibly mobility of each piece, and the particular king rules.

The inputs would be things like checkmate positions (that again could be reduced by considering legality).

I will look for related questions in Chess.se.

(Later I may pose other questions of the same type, e.g. how is draw by repetition handled in retrograde reasoning, and specifically in existing EGTB technology? but those are for later.)

I welcome help in improving this question, or finding existing answers.

  • Hi, I have responded to your request to improve the question. I hope I have captured what you are getting at, and not over-simplified. See my answer too
    – Laska
    Commented Feb 23 at 7:18
  • With respect I don’t think that English is a comfortable language for you to write complex technical ideas. I have tried to recast them in a more readable form but I hope I haven’t overstepped
    – Laska
    Commented Feb 23 at 15:41
  • 1
    Well, the title was more specific, perhaps a bit mathematical, that was on purpose. I already know (could provide examples) that it can have non-legal input positions. And I does make sense that it would. The computation logic being about retrograde mobility ruleset cranking from some domain of specific mate or other outcome positions, and 7 men being how far it could go so far, they must have had simpler constraints, and most likely from the retrograde ruleset logic subset chosen.
    – dbdb
    Commented Feb 28 at 3:10
  • 1
    The new title is a bit tame. I was asking for more of the high level model backing the construction of the tablebases. Even same 3men. One question being about the outcome range of positions considered. I would say, perhaps best answer first the set of mate positions. Same argument here, that they would not be able to test fo dynamic legality as continuation from a chess initial set up. Legality, might have to get some layers, or shades. Not only English being the torture, the meaning too.
    – dbdb
    Commented Feb 28 at 3:14
  • 1
    I might take some time. I need to compare the oridinigal with the current as well as your discussion. thank you for you effotrts.. will find how to get notifaction to email.
    – dbdb
    Commented Feb 28 at 3:15

2 Answers 2


Generally speaking, tablebases (and other engines) do not filter out illegal positions. Instead they filter out ill-formed positions, typically:

  1. Wrong number of kings for a side
  2. Pawns on first or last rank
  3. Player to move already delivering check

It's unclear from an orthodox perspective how to play forward from an ill-formed position, so it's right that such positions are excluded. The criteria are easy to apply.

In some engines, the stated reason for exclusion of an ill-formed position is that it is is “illegal”, but that is misleading. Many illegal positions are handled perfectly well by the engine. If an ill-formed position was not illegal, then players would have stumbled across it, and the rules would have been fixed to allow us to play forwards from it. It is exactly the ill-formedness that means the position cannot be covered by the engine.

Another source of confusion is that tablebases do use what they call "retrograde analysis" to iterate backwards from checkmate positions, to find out how they can be forced. But that is completely different from RA in determining whether a random position has an ancestor in the game array and hence is legal.

Reasons for not excluding illegal positions from engine consideration include:

  1. The FIDE Laws of Chess apply to illegal positions too. Although the notion of "illegal position" is defined in the Laws, it is never used (except in a single weird corner case in Rapid Chess I think). It's just defined so that arbiters can refer to it.
  2. It can be really hard to determine whether a position is legal. So much so that an entire genre of problem composition is built around it.
  3. Removing illegal positions doesn't make it easier to write the engine, whether it be a tablebase like Syzygy or more general engine like Stockfish.
  4. There are interesting positions which happen to be illegal.
  5. Chess problems, according to the Codex, can still be sound if the position is illegal.
  6. When composing a problem, it's sometimes a helpful approach to find an illegal diagram version first, and later to refine the diagram so that it's legal.

There are engines which obsessively disallow certain kinds of illegality (e.g. more than 8 White pawns, taking into account promoted material). As a composer, I find such behaviour inconvenient. Sure legality is nice and all, but we should be able to ignore it early in the design as there are harder challenges in composition.

The distinction between well-formed positions & legal positions parallels the distinction between well-formed formulae & valid formulae (theorems) in mathematical logic.

  • 1
    I am more interest by the set of admissible position, than caring about how non legal, it is. I don't really care about dynamic definition of legal. and even would rather have other characteristics to form position sets. I agree, compositions and also sort of still board logical positions still are flexing the chess physics muscles... if I can paraphrase extremely, my fast reading from above... Why I was being precise in the title.
    – dbdb
    Commented Feb 28 at 3:18
  • 1
    I agree so much with the first look at exemplars or caricatures of features one wants to study, and then apply logic or fact layers, to find more grey versions, that still keep the problem and the solution scheme. Why I want to handle the bigger position sets.
    – dbdb
    Commented Feb 28 at 3:25

Here notes trying to find existing threads that were proposed to me as I wrote my question title:

List of the ones I thought promising (in process of reading):

Endgame Tablebases-What are they? This does not seem to have the answer directly.

How to iterate over all FENs in Syzygy table?

Endgame FEN generator

How do endgame tablebases calculate checkmates to do retrograde analysis on?

I welcome all help. for existing such threads, or other specific enlightening links. I will add more posts to help answering this question, or a better one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.