Metakit / Verify a state machine

What causes report.ok to be false

By default (strict: true), Prove.machine sets report.ok = false when any transition is:

  1. refuted. The solver proposed a (before, input) pair that passed both Schemas and the guard. Transition.run replayed it and produced a state stateSchema refuses.
  2. undecided without an entry in allowUnknown: an Opaque term, a non-linear expression, a solver timeout (timeoutMs, default 10,000) or a proposal that did not replay prevented a proof, and no reason was documented.
  3. pinBroken: a transition listed in pin returned undecided or refuted instead of proved, even with strict: false.

Prove.machine throws when it is called, before it proves anything, if allowUnknown has an empty or whitespace-only reason or names one transition twice, if pin or allowUnknown holds a transition taken from another machine, or if one transition is in both. A pinned transition must be proved, so there is nothing to allow.

To see what a failed result asks of you: a refuted transition needs its guard or writes fixed (read the witness below); an undecided one needs the cause removed (an Opaque term, a non-linear expression, a number field that may be NaN), a higher timeoutMs if the solver gave up, or an entry in allowUnknown that says why it is acceptable.

A transition is undecided and names a field that "may hold NaN"

The checkers treat every number as ordered: x <= 0 is what is left when x > 0 is false. That is not so of NaN, which plain Schema.Number accepts and evaluation refuses to compare. A proof that reads such a field, in the guard, in an invariant or in a written value, stays undecided and its reason names the path. Declare the field Schema.Finite or Schema.Int to have it proved. A counterexample is still reported: its values are ordinary numbers.