Skip to content

feat: check reconstructed SMT counterexamples in Lean - #201

Draft
dranov wants to merge 3 commits into
codex/veil-hygienic-bindersfrom
codex/veil-check-counterexamples
Draft

dranov wants to merge 3 commits into
codex/veil-hygienic-bindersfrom
codex/veil-check-counterexamples

Conversation

@dranov

@dranov dranov commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #199. This PR checks whether a counterexample reconstructed from an SMT model actually witnesses the reported failure in Veil.

  • For sat trace and unsat trace, Lean checks the initial state, each labelled transition, and the assertions at their positions in the trace. For a transition-relation (TR) invariant failure, it checks the original verification condition at the reconstructed theory, action arguments, pre-state, and post-state.
  • For weakest-precondition (WP) failures, Lean specializes the action's WP to the nondeterministic choices returned by SMT. When a post-state is present, the same execution must reach it. For a failing assertion, replay checks the exception ID.
  • Replay shares named-field construction and class-law proofs with the #updr certifier. Each instantiate binder keeps its own model fields, including when two instances have the same concrete type.

The result distinguishes a kernel-checked witness, a reconstruction Lean can disprove, and one Lean could not verify. An ambiguous or unmatched WP assignment yields an unverified result.

Tests

lake build VeilTest Examples passed. Targeted tests corrupt action labels, intermediate states, dependent picks, post-states, exception IDs, and instance fields. They also check that a dictionary with a false law cannot receive a checked result.

Stack created with GitHub Stacks CLI • Give Feedback 💬

@dranov
dranov added this pull request to stack #198 November 21, 2026 09:15
@dranov dranov changed the title codex/veil check counterexamples Check reconstructed trace, TR, and WP counterexamples in Lean Nov 21, 2026
@dranov dranov changed the title Check reconstructed trace, TR, and WP counterexamples in Lean feat: check reconstructed SMT counterexamples in Lean Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant