Skip to content

Strata v0.4.0

Choose a tag to compare

@anonx3247 anonx3247 released this 26 Nov 07:41
· 2009 commits to main since this release
f39d0db

Install: curl -fsSL https://strata-lang.dev/install.sh | sh (macOS arm64).

Written proofs

  • lemma, assert … by, calc (#540): a lemma is a function that exists only for verification; verify proves it once, in its own small query, and a call gives its ensures as one fact. A recursive lemma is a proof by induction. assert e by lemma(…) / assert e by { steps } proves e from the steps alone, then adds it as one fact; calc chains prove one step per query. std.lemmas starts with six proven frame lemmas over dicts.
  • Proofs hidden by default (#540): strata view and the editors hide loop invariants, decreases, assert … by, calc and lemmas behind a marker (// ⋯ 2 invariants); --proofs shows them. strata edit from the default view puts hidden proofs back in their place (and says when a place is gone); strata diff reports proof changes apart from code changes.
  • Spec functions (#551): functions used only in contracts and proofs are one symbol in a function's own query (equal arguments give equal results) and are seen through inside lemma and assert … by proofs, so queries stay small.
  • examples/tasks (#551): enqueue is proven (157 checks) with a loop invariant, a frame and 25 proven lemmas, and all three laws are proven, no_double_claim included. claim, record, release, expire and run_worker are still partly fuzzed: their remaining checks need written proofs like enqueue's. The whole package verifies in about 50 s cold.

Verification speed and soundness

  • contracts.* verifies in 9 s instead of over 300 s (#538): a function's own call inside a lambda goes by its contract instead of being unfolded at every element.
  • #551 prover fixes: congruence for contract-only calls, set(xs.map(f)) exact, the same map/push/list literal is one value, batch answers the solver gave up on asked again alone, proof queries hold only their path's conditions.

Memory and speed of compiled programs

  • Static uniqueness (#521): compiler/unique proves which in-place updates find their value held once, and the compiled code leaves those run-time tests out (234 of 347 such sites in the compiler proven; -15% instructions on update-heavy code).
  • Small values in registers (#522): a function returning a tuple, record or sum of up to 4 words returns it in registers, and callers keep it on the stack — no heap object. 30M calls returning a tuple: 30M allocations → 1, 10.7G → 6.5G instructions. strata check of the compiler: 10.5% fewer heap objects, 5% fewer cycles.
  • Memory fixes found by per-site counters (#523): strings grow in place in small blocks, constant list literals are one shared block, for over a non-mut list borrows it, xs = xs[..n] drops the tail in place, temporary iterators move into the loop, accumulated sets passed as mut. strata check of the compiler: -8% instructions.
  • Smaller executables (#537, #539): executables are linked with -dead_strip: hello world 1.64 MB → 55 KB; the compiler, which hosts the JIT, keeps its runtime symbols.
  • A stage-2 miscompilation from small values (a stack-kept call result's fields freed twice) is fixed (#542).
  • Scoped allocation from roots: design and measurement (#545): compiler/roots assigns each allocation a home scope; measured on the compiler, regions would hold 49.5% of objects and remove 42.5% of releases (no generated-code change yet).

Tools

  • strata diff in seconds (#544): versions compared by hash, only what changed written out: one commit of the compiler 39 s / 1.6 GB → 3.2 s / 300 MB.
  • strata tour (#546): a pull request's tour (Markdown with structural diffs embedded) read in the terminal. Tours show each page's structural diffs (#550).
  • strata view in reading order (#547): imports, then types, then functions, each caller above what it uses; only the rendering changes.
  • Site: About page and tour slides on contracts over behaviour (#548).
  • A test case viewing the wrong copy of core fixed (#541).

Known

  • examples/tasks: claim, record, release, expire and run_worker are not fully proven yet (a full proof of claim exists but its queries exceed the memory limit; smaller per-element facts are the next step).
  • strata diff --graph over examples/tasks against an older version exceeds 300 s.