Repository navigation
SVL v0.6.0 — kind correctness + vec<T,n> bounds; score unchanged at 6.40
What is in this release
Two more D2 engines wired — both were accepted syntax that nothing checked.
1. Kind correctness for type constructors
type Box<a> = ... declares a constructor of kind * -> *, but Box<int, int> and a bare
Box compiled without complaint.
svl/kind_inference.py had a real KindInference and was permissive: _apply_kind_one
returns KindExpr.star() on a kind mismatch and unify_kinds "defaults to *". The engine
ran and said yes to everything. check_kind_correctness now adds the discipline:
Box<int> → accepted
Pair<int, int> → accepted
Box<int, int> → REFUSED: 'Box' takes 1 type argument(s) but was given 2
Box → REFUSED: 'Box' is a type constructor ... cannot be used as a type
Option<int> → silence (undeclared — not guessed at)
struct P{...} → unaffected
2. vec<T, n> dependent bounds
vec<int, 3> = [1,2] compiled and silently behaved as a 2-element array. The bound is now
checked against an array literal or zeros(k) initializer when both sides are literal,
and nested bounds recurse:
vec<int,3> = [1,2,3] / zeros(3) → accepted
vec<int,3> = [1,2] / zeros(2) → REFUSED
vec<int, n> (symbolic size) → silence
vec<vec<int,3>, 2> = [[1,2],[4,5,6]] → REFUSED (an element has 2 element(s))
Pitfalls worth knowing
- A permissive engine is not a checker. Read what a solver does on mismatch, not
just on success. This one defaulted to the top element on disagreement. - A bare type name parses as
TypeExpr.kind == 'struct', not'ident'— an incomplete
application shows up asstruct. - The
vecannotation must lower to the same shape an array literal synthesizes
(List<T>). ReturningType.array(T)producedKind mismatch: List<int> vs [int]and
rejected every well-formedvecbinding. - Registry honesty:
kind_star/kind_arrowstayed engine-only with notes —
constructor arity is checked, but*has no type-level meaning in SVL yet, so calling
them enforced would overclaim.
Re-score: 6.40 / 10, unchanged (5th of 9)
SVL_FORMAL_RATING.md §18. D2 stays at 8.
The number did not move, and §18.3 says why plainly. This pass closed two silent gaps
rather than adding band-9 capability. Band 9 is "best-in-class", and:
- 6 of 17 kinds remain unenforced —
kind_star/kind_arrow(engine-only: the engine
exists but*has no type-level meaning and there is no HKT syntax), and
dynamic/forall/intersection/union(parse-only, no engine). - There is no parametric polymorphism —
structhas no type parameters andList<T>is
a nominal handle, not a generic.
A sound, well-checked type system with 6 of 17 advertised kinds unenforced is not
best-in-class.
§18.5: no remaining move is cheap. The D2 engine work is exhausted — the next D2 step
needs new language syntax, not wiring. The two +0.20 items left (D1 GC+closures+generics,
D4 codegen-bound proofs) are both architecture-scale.
Verification
| Gate | Result |
|---|---|
| pytest | 287 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, [], []) — 11 enforced, 6 non-enforced |
| mutation checks | 6/6 · 2/2 · 3/3 · 4/4 · 4/4 · 5/5 · 6/6 reintroduced defects falsified their pinned test |
| clean-venv install | pip install . → svlc version 0.6.0, sieve runs correct |
Asset
svl-sieve-v0.6.0.wasm — the attested examples/sieve.svl build. Verify it:
python3 examples/attest.py --verify svl-sieve-v0.6.0.wasmNot claimed
- HKT support. Arity checking is not higher-kinded types.
*has no type-level meaning
in SVL; there is no parameterized type declaration and no HKT application syntax. - Symbolic
vecbounds. A non-literal size or an undeterminable initializer is silence,
not a checked bound. - Undeclared constructors.
Option<int>with no declaration is not checked, deliberately
— unknown-identifier policy is a separate question.