Use invariant() to assert state which your program assumes to be true.