Repository navigation
feat: check machines with the solvers and an explorer - #86
Merged
Merged
Conversation
AGENTS asks for a construct's conformance cases, faults included, before the compiler code that produces them. These fix what a machine's obligations are and in which order, what refutes an invariant (a trace from an init) and what is only not inductive, and what the checker must reject. Refs #82
A machine is desugared into functions of its state, so its inits, events and observers reuse the obligation machinery: the invariants are assumed of the state an event or observer reads and claimed of the state an init or event ends in. Z3 and cvc5 prove each obligation. An invariant or arithmetic obligation the solvers refute from a state is refuted only by a run from an init that a breadth-first explorer finds and the interpreter runs again; otherwise it is not_inductive, with the solvers' state, a standing of incomplete and ACC0015. An event is allowed in a reachable state only by such a run. What exploration covered is an annotation on the obligation, never an outcome. The receipt becomes version 4. `accord build` refuses a machine. `count` is a name again outside a quantifier, since machines have fields by it. Refs #82
The receipt gains the not_inductive outcome, traces, the exploration annotation and ACC0015, and the concepts name them. Machines are checked now, though not yet written as TypeScript. Refs #82
Making `count` an ordinary name changed the whole language for two cases. Those two cases' field is now `value`, since `count` is a quantifier keyword. No expected outcome changed. Refs #82
A helper invariant is marked in the checked program and reported as support beside the specification, in JSON and text; it is assumed and proved as an invariant is. Each machine obligation also carries the parameters its inputs name, so a not_inductive state or an event witness types the event's and init's parameters too. Refs #82
A review found an argument outside its type proving an event allowed, an overflowing step refuting an invariant it never broke, and two invariants sharing a name. These cases fix the intended outcomes before the code changes: each failure is reported once, by its own obligation, and no run uses a value its type can't hold. Refs #82
Arguments the explorer enumerates, and that a run may carry, are now within their parameter's type. An init's or event's invariants are proved, and a run breaks them, only where its arithmetic stays within its type; that failure belongs to the arithmetic obligation alone. `accord diff` refuses a machine, a machine's hash covers each member's role and whether an invariant is a helper, invariant names are unique, and an outcome the explorer changed no longer says it was reused. Refs #82
The review materials check the receipt contract they read, and receipt 4 adds machine outcomes and a support list. For functions it changes only the review hash, so the cards and stage 7 packets differ in that line alone; regenerated with materials.py --write. Refs #82
The wire test's known report still named receipt 3, which the contract now rejects; a stale bytecode cache hid it locally. Refs #82
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stage 10's first slice: Accord now checks
machinedeclarations, as #82's decisions anddocs/design/syntax.md("Machines", decision 7) describe. TypeScript output for machines and the ports come next.What it does
state,init,event, observers,invariantandhelper invariant, andnext { … }bodies throughifordecide. Sequence examples useexample M … gives.nextused as a name, an event withensures, an invariant that calls a function, a machine with noinit, and two invariants with one name.not_inductive, carrying the state the solvers found. It makes standing incomplete, not failed, and has code ACC0015,add_helper_invariant.not_inductive, trace refutations, exploration annotations, helper invariants assupport, and typed inputs for every parameter.accord buildandaccord diffrefuse machines for now.Process
machine*cases were committed before their code (cce0d9dandcbddd1b) and none of their expected lines changed. Two cases renamed a field fromcounttovalue, becausecountis a quantifier keyword.20240a7):diffreported a machine's lost invariants as kept;reusedflags.Verification
cargo fmt --all --checkandcargo clippy --workspace --all-targets --locked -- -D warningsare clean.cargo test --workspace --lockedwith the pinned solvers: 93 passed, 1 ignored (the existing solver-timeout helper). That includes all 21 machine cases and 6 tests intests/machines.rs.main(70a624d) and this branch, and ran all 120 non-machine cases through both. Definition hashes and every outcome are identical: 507 obligations and examples, and every standing. The only difference is the receipt version (3 to 4).Not established:
Risk note
One-way-ish for the receipt format: version 4 adds an outcome, and consumers that match outcomes exhaustively must handle
not_inductive. Nothing is published yet, so this is still reversible. The function path is unchanged, as shown above. Blast radius: the checker and receipt for programs that declare machines. Evidence: the conformance cases, the review's reproductions now passing, and the base comparison.Refs #82