ch:refinement-types: ch:refinement-types
Problem, result, and invariant. Build a producer and consumer for the chapter’s difference-constraint certificates. The observable result is the eight-case report in appendix E. The consumer invariant is that every accepted proof names existing graph edges, follows adjacent endpoints, and establishes the requested bound or a strictly negative closed cycle.
Representation. Represent an atom
First complete version. Generate graph edges from assumptions, exact lengths, and literal shifts. At each array read generate both
Remaining cases. Recompute the verification-condition list from the object program instead of trusting a producer-supplied list. Add fuelled finite search, but accept a search result only after replay. Exercise
A failing version. Accept a path without checking adjacent endpoints. The program still typechecks, but a path can splice unrelated edges and the malformed-certificate case fails. Weakening the generated lower goal or accepting a zero-weight cycle supplies two independent controls with named failures.
Acceptance test. Run the four gates recorded in appendix E. Require the exact eight PASS lines, the frozen final summary, and audit output []. Replay at least one bound-weakening mutation and one malformed-evidence mutation; each must keep the source type-correct while making the output oracle fail.
Mathematical boundary. The artifact executes graph construction, finite search, certificate replay, and finite qualifier enumeration on the named corpus. It proves neither certificate exactness nor checker correctness, array safety, Liquid relative completeness, or proof-carrying-code soundness.