Soundness

A verifier’s one job is that "verified" can be believed. This page lists the mechanisms that protect that, and the places where the verdict rests on something that is trusted rather than checked. Each mechanism has a rule in CLAUDE.md or a decision record; the page summarises and points.

Reject, never approximate

Invariant 3: a construct cerastes does not model is rejected with a diagnostic, never approximated. A program that cerastes verify accepts is one whose every construct the encoder understands. Concretely:

  • The encoder works from allow-lists. A construct that is not listed is rejected at its source line (src/backend/encode.cpp; the diagnostics are in src/backend/diagnostics.def).

  • VIR’s type checker fails closed: a conversion the front end left implicit, or an operand of the wrong type, is rejected instead of being computed in the wrong type (src/vir/check.cpp).

  • The driver’s command line is an allow-list too, so no EDG option such as --diag_suppress can reach the front end.

  • Rejections are tested with rejected tests, and the harness self-test requires every back-end diagnostic to be named by a test, with a short list of reasoned exceptions ("Every back-end diagnostic has a test" in tests/README.md).

The reference lists what is rejected today: Verifying a program and Memory and ownership.

No unchecked assumptions in the emitted Viper

Invariant 4: no inhale or assume appears in emitted Viper without a comment // cerastes:inhale-ok <reason> on its line. Those are the places where an encoder becomes unsound, so each one has a written reason, and scripts/lint_viper.py fails the build otherwise. The lint runs over the Viper of every verify test and every VIR self-test case, and goes further than inhale: its docstring lists the rules, among them

  • a bodyless Viper method must carry a cerastes:trusted-contract tag;

  • every assert, requires, ensures and invariant line and every call of a method needs a position-map entry, so no failure can be reported without a source position;

  • termination: every method and loop needs a decreases clause, and the unchecked forms (decreases *, backward goto, labels that carry invariants) are refused;

  • wildcard permission amounts, which Silicon chooses, are refused.

scripts/test_lint_viper.py tests the lint, so a rule cannot decay unnoticed.

The memory model’s axioms

The Viper domain cerastes emits for memory is Block, the model of blocks of memory and pointers into them (decision 0028, item 2). An axiom is an assumption Silicon cannot check, so each one is recorded and linted:

  • There are exactly four, loc_inv, loc_nonnull, member_inv and member_lv. Each has its own record, with the reason it is needed and a model in which it holds (decisions 0033, 0034, 0035 and 0036).

  • The lint accepts the domain only directly under a cerastes:domain-ok tag, and an axiom only with its exact text and a cerastes:axiom-ok tag naming its record. A fifth axiom, or a changed one, fails the lint until it has a record.

  • The trusted methods that create or end objects (alloc_<type> for an address-taken local, alloc_arr_<type> and zero_arr_<type> for an array and its zero fill, alloc_struct_<n>_<tag> for a structure local, which carries the rows of an array member’s block and is emitted for every structure type with an array member whether or not it is called, copy_arr_<type> for the copy of an array member between two structures, program_start for the globals, and the typed views of vlibc’s malloc, calloc and free and of vlibc_malloc, vlibc_calloc and vlibc_free, which for a structure with an array member hold each array member by quantified permissions and, for calloc, state the zero values one clause per element, up to 24 values) are assumptions too: the lint pins the text of each one’s contract to the shape its decision record justifies, including the token’s value that says which allocator a block belongs to (0050).

copy_arr_<type>(d, s, n, rd) is the one that needs an argument beyond the shape: it is the contract of the loop d[k] = s[k] over two different blocks (decision 0063 item 13). It takes and returns full permission to the destination’s elements and the amount rd of the source’s, where rd is the source’s first-slot amount (the least of its value and flag permission, so write when the caller owns the source whole), and it requires that block_of(d) != block_of(s). Lowering writes that disequality as an internal row before every call, so an omitted guard cannot give a proof, it can only give a tool failure. Whether the call is guarded is decided from the two places' roots: no call at all for one named object copied onto itself, no guard between two named objects (structure locals and globals, whose blocks Silicon proves different), and if (d != s) where either place is reached through a pointer.

Adding an axiom needs its own decision record and lint tag first.

A user quantifier adds one more kind of domain, and no axiom. A well-formedness method (f__wf) whose contract reads elements under a quantifier declares a domain Hvq_<method> of ghost functions (one per pointer parameter and state), under a cerastes:domain-ok 0061 tag; the lint refuses an axiom there. The assumed facts about the ghost functions are assumptions Silicon cannot check, so each has one of four shapes, argued in decision 0061: the element type’s range, the tie to a scalar ghost of the same read, equality between two parameters on one block, and the keep fact of a reads_range atom that comes back, which the lint accepts only under the guards of both atoms (without them it would let a wrong contract verify). The lint also refuses a quantifier with no type range for the bound variable and a computed loc term in the body (the form with one binder, which does not finish on neighbours).

A read pure function adds two more things Silicon is asked to accept, argued in decision 0062. First, its Viper function has a definitional axiom that Silicon emits only for a function that verified; the lint requires a decreases line on every pf_ function (with none Silicon checks nothing, and a recursive function that never decreases would verify), a pf_<name>__<id>__wf method that holds the definition check, and a body, an ensures and a requires of the exact shapes the encoding specification lists (the permission is wildcard in those lines and nowhere else). Second, the facts a well-formedness method assumes about an application’s ghost function are assumptions: the result’s type range, the callee’s ensures at the arguments (only under the callee’s own precondition, because an ensures outside it may be false and would make every later row vacuous: the lint refuses the unguarded form), and the keep fact for a reads atom that comes back (only under both atoms' guards and the inclusion of the callee’s interval). The driver accepts exactly one Silicon warning, Could not resolve expression …​ during the axiomatisation of function for a pf_ function and before the verdict: it is printed when no explored path evaluates an expression, and the replacement symbol is used only inside the definitional axiom, whose value never depends on it for an argument that satisfies the requires (the argument, with its source, is in the decision).

Trusted contracts

Some results rest on a contract that nothing here verifies.

  • The single-unit assumption. A contract declared for a function defined in another file is trusted; callers in this unit are verified against it and nothing checks the definition. See the single-unit assumption.

  • vlibc. The contracts of abort, exit, malloc, free and the rest of what vlibc declares are trusted (decisions 0030 and 0046). The safeguards: every trusted declaration carries a cerastes:trusted-contract vlibc: tag with a reason; the committed list tests/vlibc/trusted_contracts.txt holds every one, and scripts/vlibc_contracts.py compares it with the headers on every check.sh (and refuses a vlibc_ contract that is not its standard name’s word for word), so moving the vlibc pin to a commit that changes a trusted contract fails until the list changes, and changing the list is a golden change (invariant 1) that gets an audit. Trust is by the declaration’s path and shape, and the encoder rejects a user program that redirects a trusted function to other code, for example with an alias or an assembler label.

  • The front end’s IL. The IL facts the back end relies on are recorded with their evidence in internal/il-inventory.md, and the walker’s goldens are cross-checked against an independent print of the IL (scripts/walker_oracle.py).

Audits

Every change to src/backend, src/vir or src/viper gets an independent review for unsoundness before it is committed. plan.md ("During the session") makes it part of the process, and .claude/agents/soundness-auditor.md holds the checklist the project’s reviewer uses; it is a good one for a human reviewer too. It asks, for a diff:

  • is any inhale, assume or axiom added without a tag and a justification;

  • is any C or C++ operation encoded without the checks its semantics require (overflow, division by zero, shift range, conversions, permissions);

  • is any construct silently accepted that should be rejected;

  • does every encoding rule have a must-fail test;

  • and for test infrastructure: can a test pass vacuously (an empty golden, a skipped file counted as passed, an expectation never checked).

The decision records name the audit rounds a change went through and what each found.

Where the arguments are

plan.md describes a directory internal/soundness/ for the arguments the encoder relies on. It does not exist yet. Today an argument lives in the decision record of the rule it justifies, and in section 3 of internal/encoding.md for integer lowering.