Chess Invariants
8 hours ago
- #concurrency
- #invariants
- #chess
- Chess is a complex concurrent system with interleaved execution and numerous rules.
- Invariants in chess are split into state invariants (predicates over a single state) and transition invariants (predicates over a step).
- Key state invariants include TypeOK, OneKingPerColor, BothKingsOnBoard, TurnParity (linking move count to player turns), PreviousPlayerNotInCheck, and NotBothInCheck.
- Transition invariants like MoveCountStrictlyIncreases, TurnAlternates, PieceCountNonIncreasing, SingleCapturePerMove, and ExactlyTwoSquaresChange describe constraints on state changes.
- Basic invariants may be violated when adding rules like castling (breaks ExactlyTwoSquaresChange) or en passant, while others like PieceCountNonIncreasing survive pawn promotion.