yewenjie 58 minutes ago

> Chess is a lot trickier than it looks. It has so many rules: castling, en passant, pawn promotion, pinning, the discovered check, and the deadlock case of stalemate.

Nit: Pinning and the discovered check are not really rules, but rather names of tactics.

  • JohnKemeny 53 minutes ago

    Well, if a piece is pinned it's illegal to move it.

    Rule 3.9.2: No piece can be moved that will either expose the king of the same colour to check or leave that king in check.

    • TheOtherHobbes 47 minutes ago

      Unlike en-passant and castling, pinning and discovered checks are consequences of lower-level rules.

      At the "Is this move legal?" level, they don't need unique rules of its own if the lower-level rules are specified correctly.

      • JohnKemeny 26 minutes ago

        3.9.2: no piece can be moved if that exposes or leaves its own king in check.

        • 333c 6 minutes ago

          That's a consequence of not being allowed to put yourself in check (by any means).

    • gobdovan 41 minutes ago

      You can also pin a pawn to a queen, but the pawn can still legally move.

    • munchler 9 minutes ago

      The point is that, logically, the first part of that rule (“expose the king”) is implied by the second part (“leave that king”), so the first part is redundant. You could simplify the rule to:

      No piece can be moved that will leave the king of the same color in check.

  • juujian 45 minutes ago

    And discovered check means that it is not sufficient to check the position of the piece you have moved, you also need to check the position of other pieces to see whether there is a new check.

NicoHartmann 49 minutes ago

I can't wait to show this to my manager next time he asks why it's taking three weeks to build a simple CRUD app.

"Look, if this guys TLA+ logic struggles to model a 1,500-year-old game without crying over a French pawn-capture rule, you can't expect me to integrate Stripe billing without a few state invariant violations."