Runtime proofs and countermodels
Runtime executions can supply witnesses that refute a universal claim. They also supply observations for conjecture search. Entails uses separate checks for these two results.
Replay a countermodel
entails countermodel docs/counter.entails original_safe --machine altered
The default claim is that the machine never accepts from the guarded binary
input family. Search enumerates bounded inputs in increasing width and
lexicographic order. For each input it observes the sequence of configurations.
The first witness found is replayed from its initial tape against the actual
transition function. The command reports its payload, first violating step,
and the source transition when available. Use --claim preserve-guard to
check whether cell zero changes. The altered counter gives a witness on
0000 at step 161 with the default bounds.
A countermodel exits with status 1. Status 2 reports either an exhausted local replay budget or the absence of a witness within the search bounds. Some temporal claims, such as eventual acceptance without a deadline, may need an inductive argument or a justified infinite counterexample. A limit on observation alone cannot settle them.
Rank and check candidate invariants
entails suggest docs/counter.entails original_safe --paranoid
The tactic collects state and head-region pairs from training runs. It proposes
the observed regions, their transition closure, and allowing both regions for
each observed state. It tests every distinct proposal on separate held-out
runs and ranks them by the Laplace-smoothed fit score
(fits + 1) / (samples + 2). Ties favor fewer regions. The score describes
fit on the selected finite inputs. The independent checker verifies the
initialization, transition closure, and exclusion of acceptance of the first
successful proposal. With --paranoid, Lean also checks and replays that
candidate’s proof. The command prints the certified Entails declaration.
Candidates can lose support as new observations arrive. A checked theorem retains its stated assumptions. For the original counter the transition closure fits all 16 held-out runs of width four and passes the 66-case proof check. The altered counter supplies replayed countermodels and the candidates fail the independent checker.
Relation to other methods
- Runtime verification motivates distinguishing a decisive finite witness from a temporarily inconclusive prefix. Runtime verification for LTL and TLTL
- Dynamic invariant detection motivates learning candidate predicates from traces. Daikon
- Counterexample-guided synthesis motivates alternating candidate search and validation. Program Synthesis By Sketching
The witness checker takes an initial state, deterministic transition function, and a bad-state predicate. A protocol state machine or a bounded interpreter can supply these three components. Nondeterministic systems also need the chosen transition at each step and a check that the transition is legal.