Skip to content

chore: backport Lean SMT fixes - #196

Merged
dranov merged 8 commits into
mainfrom
codex/pin-veil-no-mathlib
Nov 21, 2026
Merged

dranov merged 8 commits into
mainfrom
codex/pin-veil-no-mathlib

Conversation

@dranov

@dranov dranov commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Pin Lean SMT to b8633e75c15b51134b4e6d6d3d15668d959e519f. The veil-no-mathlib branch replays Veil’s fork changes and the upstream main changes through cbec5bd on upstream no_mathlib.
  • Backport Lean SMT #285 with a Lean-side check for Nonempty evidence before translating an unused quantifier over a data sort. The check uses the goal’s instances, which keeps cached translations independent of temporary solver binders. Veil preserves this evidence before symbolic trace simplification in both solver modes.
  • Fixes SMT preprocessing throws on Nat-valued fields over a Fin n domain #173. Veil can now reconstruct action-preservation proofs for Nat-valued fields such as coverage : Fin maxId → Nat with veil.smt.trust false. The backported embedding handles symbolic bounds, including zero. Lean SMT PR #5
  • The pin also includes fixes for wrapping BitVec literals, six-argument Bool relations, conditional proof reconstruction, Int literals in state updates, Nat.max, and BitVec proof reconstruction with the pinned cvc5 1.3.2. Veil 4.35’s release dependency branch still points to 293dab6.

Addresses #189, #177, #178, #181, #118, and #188.

Validation

  • All 128 no-mathlib Lean SMT test files matched their expected output, including the Fin regressions and the two known trusted-mode blockers documented in Lean SMT PR first version of full port ord_live.lean port (from ord_live.ivy) has issues #5. The inhabited-domain examples pass, and trusted SMT rejects vacuous hypotheses over a sort that may be empty, including when a nested existential introduces a temporary instance.
  • The Veil library and the trusted trace regression built against the hardened pin. Veil sat trace with an unused quantified variable gives a cvc5 error #188 finds a satisfying trace with trusted SMT enabled.
  • With veil.smt.trust false, Veil proved all 37 Fin-indexed coverage and routing conditions on the pinned commit (previously 17/37). These include the two-action reproducer from Veil #173.

Before and after on the seven reported issues

Issue Before on main (d6229a1e) After on this PR (5fc19229) Fix on veil-no-mathlib
#118 · Nat.max in an action A Nat.cast error blocked the trace and the positivity proof. The trace shows the clock advancing from 1 to 2. Positivity passes with trust on and off. d7a2143
#173 · Symbolic Fin n fields All four published theorem cases failed, as did all 16 preservation checks in a four-action model matching the report. All four theorems reconstruct. The model passes 25/25 checks with trust off, including all 16 preservation checks. b8633e7
#177 · Six-argument relation Four preservation checks failed with trust off, including both checks for clear. All four reconstruct, including for clear, which leaves the relation untouched. f9a3b88
#178 · Propositional conditional The final assumption step failed on distinctN. smt [h] proves the original theorem. 8a3005e
#181 · Int literals in updates Initialization and preservation failed with cannot translate Type. The trace failed with cannot translate 0. Both checks pass, and the trace shows t advancing from 0 to 1. Initialization and action literals also pass when tested separately. f1942fd
#188 · Unused quantified variable Trusted sat trace failed because cvc5 treated -> as an undeclared symbol. The trace succeeds with node = Fin 1 and flag = false. The trust-off control succeeds on both revisions. 489070b
#189 · Wrapped BitVec literal Trusted SMT proved the false invariant f N = 2#2 even though explicit model checking found a violation. SMT returns the same counterexample (5#2 = 1#2) and proves the corrected invariant with trust on and off. be130ba

For #188, Lean SMT requires Nonempty evidence for the unused quantifier’s domain. Veil preserves that evidence before simplifying trusted traces. Veil commit 76fcbf2

For #173, the report included the theorem cases but omitted the full four-action module, so the module-level comparison used a reconstruction of the reported scenario.

@dranov
dranov marked this pull request as draft November 21, 2026 04:07
Pin Lean SMT to the hardened #285 backport. Derive Nonempty from Veil’s Inhabited instances before symbolic trace simplification in either solver mode.
@dranov
dranov marked this pull request as ready for review November 21, 2026 14:35
@dranov
dranov merged commit 578ec0b into main Nov 21, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment