Repository navigation
Conversation
Represent quantification, function arguments and function results with proved equivalences. Normalize Fin.mk projections and Nat-to-Int round trips during embedding, including the generated weakest-precondition and transition-relation obligations from Veil ufmg-smite#173. Check domain inhabitation when adding a quantified result bound, and refuse residual finite sorts and aliases at the SMT boundary. Cover empty Fin, symbolic bounds, custom cast instances and unsupported function spaces in trust mode.
Select the finite normalization and embedding rules from the original goal, supplied facts and relevant context. Retain real witnesses of function domains and send mixed Fin/user-sort UNSAT results through proof reconstruction even in trust mode. Check aliases, constructor fields and type arguments before declaring uninterpreted sorts. Report unsupported Fin function arity during embedding. Add regressions for aliases, explicit inhabitation, context relevance and empty carriers.
(cherry picked from commit d2e3b88)
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.
Veil generates obligations over fields such as
coverage : Fin maxId → Nat, wheremaxIdis a parameter and may be zero. This PR embedsFin nas the integers satisfying0 ≤ i ∧ i < nand reconstructs proofs for reads, writes, and frame conditions over those fields. It targets the fork’smain. The motivating example is verse-lab/veil#173.What this fixes over #4
We ran identical Lean examples on #4 at ecf8e34 and on this implementation. Two examples give closed proofs of
Falseunder+truston #4. This branch rejects both.@Nat.cast Int c 0 = 0for arbitraryc : NatCast Int. Choosing the cast that always returns one gives1 = 0. This implementation uses proved rewrites for the casts introduced by the embedding.Falsefromf : α → Fin 0andh : ∀ a, (f a).val = 0. Both hypotheses hold whenα := Empty. The new output rule checks inhabitation before introducing a range constraint over an abstract SMT argument sort.Six true obligations that failed on #4 reconstruct here: reflexivity of a quantified field read,
(∃ _ : Fin n, True) ↔ 0 < n, positivity from an aliased index, preservation of a bound after a whole-field write, wraparound from3to0inFin 4, and the extracted weakest-precondition obligation from Veil ufmg-smite#173. The simpler result bound forf : Nat → Fin npassed on both revisions. Fin regression suiteVeil proof reconstruction
We tested Veil at 18a1c985 with a temporary port to its no-mathlib dependency and
veil.smt.trust false.propext,Classical.choice, andQuot.sound.veil.smt.finiteModelFind false, all 20 passed at four seconds per query.EWD840 still had six undischarged conditions. The deliberately buggy circular buffer failed its put-safety condition. Fin-indexed counterexamples can also fail to render because the returned field interpretation expects an integer index.
The Lean SMT regression suite passed 121/122 files. The sole mismatch,
Test/BitVec/Rewrites.lean, produced the same diagnostics as the parent.Veil symbolic verification benchmarks
Across all 25 existing symbolic examples, Veil’s pinned Lean SMT (
b528077) and the no-mathlib port of this PR (0579b2c) both verified all 1,653 invariant obligations. Total wall time was 900.2 s on the pin and 906.6 s with the PR (+0.7%). This comparison uses the second pass plus a longer run for Distributed Reliable Broadcast, which exceeded the three-minute cap on both builds. Across the 23 examples that completed in both passes, the PR averaged 3.0% more wall time on the shared host.With proof reconstruction enabled (
veil.smt.trust false), the three Fin-indexed examples improved from 17/37 to 37/37 obligations proved. Two-action coverage went from 4/6 to 6/6, four-action coverage from 9/25 to 25/25, and indexed routing from 4/6 to 6/6.Trusted-mode blockers for separate PRs
Default proof reconstruction rejects both statements below. With
+trust, each can still be accepted on this branch.def x : Int := 0, the tactic accepts¬ ∃ i : Fin 2, (i.val : Int) ≠ x. The witness is1. The generated query binds anotherxand compares(distinct x x). A test merge of the fork’s name-capture fix emitted(distinct x_1 x)and rejected the example.rel : LT Intandi : Fin 1, the tactic accepts@LT.lt Int rel (i.val : Int) 1. Takingrelto be always false refutes it. The integer translator needs to check the supplied instance before emitting SMT’s built-in<.The regression file checks default-mode rejection and records the two trusted-mode failures so each follow-up can clear its expected diagnostic. Blocker reproducers