Skip to content

SVL v0.4.0 — refinement types enforced; re-scored 6.25/10

Choose a tag to compare

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

What is in this release

D2: refinement types are now enforced, not refused. { v: T | P(v) } used to parse
and be refused by strict mode with unsupported type annotation kind; the feature registry
recorded it as engine-only with "no obligation is generated yet".

svl/refinement_types.py now discharges them through Z3 on the compile path.

Introduction (must prove) vs elimination (may assume)

Direction Where Rule
Introduction let x: {v: T | P} = e; a call to a refined parameter; return against a refined result prove P[value/v]
Elimination inside a function, a refined parameter; after a proven let binding P may be assumed

Only QF_LIA over int/bool is modelled. Anything the encoder declines — /, %,
calls, arrays, floats, structs — is silence, never a discharge and never a false
positive.

Measured

let x: {v: int | v > 0} = 5            -> accepted
let x: {v: int | v > 0} = -5           -> REFUSED  ("no assignment satisfies it")
let x: {v: int | v > 0} = 2 - 3        -> REFUSED
g(0 - 1)  where g(x: {v: int | v > 0}) -> REFUSED at the call site
g(7)                                  -> accepted
type {v: int | v > 0} { return 0 - 3 } -> REFUSED
x: {v: int | v > 5} ==> {v: int | v > 3} -> accepted   (elimination)
x: {v: int | v > 0} ==> {v: int | v > 3} -> REFUSED, x=1 (not provable)
x: int ==> {v: int | v > 0}              -> REFUSED, x=0 (no assumption to lean on)
predicate with `/` or a call             -> silence

x: int giving no assumption is the point of the feature, not a false positive: you
cannot produce a positive value from an arbitrary int.

Three stale assertions, all claiming the old contract

  1. test_svl_strict_types.py listed refinement under UNSUPPORTED.
  2. Spike H11 asserted "strict refuses / lenient accepts". The honest contract
    inverts when a feature becomes enforced.
  3. Spike H14 asserted FEATURES['refinement'].status != 'enforced' as a proxy for
    "the type-family engine is not wired" — and broke the moment refinement became
    enforced. It now asserts the actual thing: no family syntax reaches the parser.

Re-score: 6.25 / 10 (6th of 9)

SVL_FORMAL_RATING.md §16. D2 6 → 7 (+0.15), everything else unchanged.

§16.3 states plainly that the D2 move is borderline. For 7: refinement types are the
most expressive item on the H2–H16 surface, now enforced and discharged; the core is
sound and every non-enforced kind is honestly refused by name. Against 7: 9 of 17
TypeExpr kinds remain unenforced
(linear, unique, kind_star, kind_arrow,
vec, dynamic, forall, intersection, union). The judgement is that a sound core
plus a genuinely expressive enforced feature differs from a wide unchecked surface, and
SVL's remaining gaps are all loud. SVL is now 0.05 below Dafny (6.30).

Verification

Gate Result
pytest 240 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, [], []) — 8 kinds enforced
mutation checks 6/6 · 2/2 · 3/3 · 4/4 · 4/4 reintroduced defects falsified their pinned test
clean-venv install pip install . → svlc version 0.4.0, sieve runs correct

Asset

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

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

Not claimed

Full refinement support. Predicates over floats, arrays or structs, or using /,
% or calls, are declined rather than checked. The checker is QF_LIA over int/bool.