Table with Four Coins

Source

I got this problem from Rustan Leino, who says it's crossed the desk of Jan van de Snepscheut, but it may have been due to someone else.

I solved it and wrote up my solution.

Problem    

A square table has a coin at each corner. Design an execution sequence, each of whose steps consists of one of the following operations:

  • ONE: The operation chooses a coin (possibly a different one with each execution of the operation) and flips it.
  • SIDE: The operation chooses a side of the table and flips the two coins along that side.
  • DIAG: The operation chooses a diagonal of the table and flips the two coins along that diagonal.

such that at some point during the execution (not necessarily at the end), a state where all coins are turned the same way (all heads or all tails) obtains.

Solution     Reveal