Skip to content

SVL v0.5.0 — linear/unique enforced; re-scored 6.40/10, 5th of 9

Choose a tag to compare

@sudo-ai-git sudo-ai-git released this 13 Nov 06:58
· 7 commits to main since this release

What is in this release

D2: linear/unique are now enforced on the compile path. They used to be engine-only
and refused by strict mode with unsupported type annotation kind.

SVL has value semantics — values are i32/f64 in WASM and there is no runtime ownership —
so the discipline is static, over variable usage, the same shape as Rust's move
checker:

Term Definition
move a bare variable where ownership transfers — the whole RHS of a let/assignment, an argument, or a return value
use a variable inside a larger expression (x + 1, f(x + 1)), which borrows it

A moved value may not be used or moved again — a hard error. An unconsumed linear
is a warning, not an error (a false positive would reject a correct program). unique
is affine: at most one use, so an unconsumed one is not even a warning.

Measured

let x: linear int = 5; let y = x; return y       -> accepted
let x: linear int = 5; let y = x; let z = x       -> REFUSED (second move)
let x: linear int = 5; let y = x; let z = x + 1   -> REFUSED (use after move)
let x: linear int = 5; let y = x + 1; let z = x   -> accepted (borrow then move)
return x / g(x) with a linear x                   -> accepted (move)
g(x) twice                                        -> REFUSED
unique int, same rules                             -> enforced, affine
unannotated variables                              -> completely unaffected

Four engine defects, all in the file the registry named

  1. Unreachable duplicate code — borrow_variable had a second copy of the borrow block
    after return True, two branches of which appended to a non-existent key.
  2. Computed-then-discarded — _check_unused_linear worked out the answer, then
    pass # Could warn here.
  3. Region-vs-variable confusion — it tested var.region.is_linear, true for every
    variable in a function with one linear value, so unannotated locals were reported as
    unconsumed.
  4. Substring match — is_linear was 'linear' in str(ann).lower().

Plus infer_regions_for_function declared parameters and never walked the body.

The corpus did its job

unsupported_linear / unsupported_unique were MUST-REFUSE labels; those programs are
well-formed now, so the corpus reported 2 disagreements. Replaced with violation cases plus
five must-pass uses. Spikes H3 and H15 also asserted "strict refuses".

Re-score: 6.40 / 10, 5th of 9

SVL_FORMAL_RATING.md §17. D2 7 → 8 (+0.15) — a second engine is enforced, 10 of 17
TypeExpr kinds. The rank moved past Dafny (6.30).

Still not enforced: kind_star/kind_arrow (engine-only — svl/kind_inference.py exists),
and vec/dynamic/forall/intersection/union (parse-only, no engine). §17.3 lists
what each would need.

Verification

Gate Result
pytest 264 passed
spike suite 41/43 (the 2 are the declared stubs H36/H37)
corpus 25 compiled, 0 refused
probes 30 PASS / 0 FAIL / 3 INFO
differential execution 22/22 agree
verifier corpus 0 disagreements
feature registry (True, [], []) — 10 kinds enforced
mutation checks 6/6 · 2/2 · 3/3 · 4/4 · 4/4 · 5/5 reintroduced defects falsified their pinned test
clean-venv install pip install . → svlc version 0.5.0, sieve runs correct

Asset

svl-sieve-v0.5.0.wasm — the attested examples/sieve.svl build. Verify it:

python3 examples/attest.py --verify svl-sieve-v0.5.0.wasm

Not claimed

  • Runtime ownership. The linear discipline is static: it constrains variable usage, not
    heap ownership. A linear value that is never consumed passes (warning only).
  • Full linear-type support. No borrow regions, no lifetime inference, no Drop
    discipline. The engine's region model is present but the enforced rules are the move rules
    above.