# Sparkle 0.2.1 **Status.** `v0.2.1` is the release this page describes. **Until the tag `v0.2.1` exists, name the candidate by its full 40-hex commit SHA** (the SHA is recorded in the evidence package of [RELEASE-CHECKLIST.md](RELEASE-CHECKLIST.md)); do not write a pin that does not exist. `v0.2.0` is already tagged (`eeb3ed1e`) and stays there. It does **not** contain `SparkleProof`, the proof consumer fixture or the public corpus, so a project that wants those pins `v0.2.1`, not `v0.2.0`. The product version is written in one place: `version := v!"0.2.1"` in the `package` of [`lakefile.lean`](../../lakefile.lean). (`lake-manifest.json` has a `"version"` field too; that is the manifest *format*, not the product.) Other `0.1.0` strings in the repository (`docbuild`, `proofs`, old examples) are the versions of those separate packages and are not changed here. The phase-by-phase development history stays in [../CHANGELOG.md](../CHANGELOG.md); this page is the user-facing summary. ## What can now be used from outside * **`SparkleProof.Core` and `SparkleProof.Single`**, one `lean_lib` with two modules: the statement and its meaning (`U1Stmt`, `Contract`, `InputsOk`, `st0`, `srcOf`, `OutputsStmt`, …), `#ved_strict_audit` and the extraction lemmas `SparkleProof.u1_*` (Core), and `#ved_u1` (Single). The old `Tools.VedU1Entry` / `Tools.VedU1Contract` / `Tools.VedStrictAudit` imports keep working and give the same command and the same theorem type. * **A proof consumer fixture** (`Tests/Downstream/ProofConsumer`): a separate Lake project that `require`s Sparkle by URL and commit, produces a theorem with `#ved_u1`, uses it in another module, and pins one refusal. `scripts/ci/proof_consumer.sh` builds it in a fresh directory; the `proof-consumer` job of `downstream-smoke.yml` runs it. * **A public corpus** (`Tests/ProofCorpus/manifest.tsv`, eight cases) and its runner `scripts/proof/run_core.py`: accepted, sequential, public-lemma reuse, one intended refusal, two tamper refusals and two limit controls. A timeout or resource limit is never counted as an expected refusal. The `ved-corpus` job of `ved.yml` runs it. * **Entrances**: the README's three ways in, one procedure to depend on Sparkle ([How_To_Use.md](../reference/How_To_Use.md)), and [CONTRIBUTING.md](../../CONTRIBUTING.md). * **Tutorial examples Ex7–Ex9** (`docs/research/examples/tutorial/`): one input on the DSL and IR sides, an SV round trip that is proved versus one that is not, and why the crypto rows are refused ([CryptoNotProved.md](../research/CryptoNotProved.md)). * **Crypto design fixes** found by the hardware co-simulation (their tests are in CI): `sha512BlockHW` σ1 uses ROTR61 (it used ROTR63, so block outputs differed from FIPS 180-4), `gmulHW` runs its last iteration (bit 0 of the first operand was ignored; `done` is now at +130), and `hmacSha512HW` latches the inner digest as the message of its fourth block. `bip32-ckd-hw-jit-test` is also checked against BIP-32 test vector 1. * **A third batch of hardware co-simulation tests** (bus framing, network stack, remaining crypto and curve cores), in [`notes/ip/hw-cosim-coverage.md`](../../notes/ip/hw-cosim-coverage.md), together with probes for the defects it found (see "Known limitations"). ## Public API [`docs/reference/PublicAPI.md`](../reference/PublicAPI.md) is the one place that says what a downstream project may depend on, and marks every item public, experimental or internal. In short: public are the two `SparkleProof.*` imports, the three `Tools.*` compatibility imports, the commands `#ved_u1` and `#ved_strict_audit`, the names `f.ved_u1`, `f.ved_mod`, `f.ved_contract`, and the `SparkleProof.u1_*` lemmas. Everything else in `Tools.*` is experimental or internal. ## What the guarantee covers, and what it does not (Full statement: PublicAPI.md sections 5 and 7, [../VED.md](../VED.md).) * **Source → IR (public, strict U1 theorem).** For a declaration `f` accepted by `#ved_u1`, `f.ved_u1 : U1Stmt f.ved_contract f.ved_mod f'` says that the IR module `f.ved_mod` that **that one synthesis run returned** computes, on every output at every cycle, what the declaration derived term `f'` computes, under stated conditions: inputs fit their widths and reset is held at 0, registers start at the recorded initial values, the single-clock cycle model of `Sparkle/IR/Semantics.lean`; the clock value is not constrained and `defaultDomain` specialisation is not "every domain". The output part (`OutputsStmt`) is about every well-ordered arrangement of the module's statements; a statement about running `m.body` itself in its written order also needs `woCheck [] m.body = true` (`SparkleProof.u1_output_agrees`, PublicAPI.md section 5). It does not prove the synthesiser correct in general. * **Axioms.** Only `propext`, `Classical.choice`, `Quot.sound` are reachable (`#ved_strict_audit`; no name exceptions; no `sorry`, `native_decide` or added axiom). * **IR → SystemVerilog model (experimental, conditional).** Theorems exist under a width-checking hypothesis and for a syntactic fragment; they are not part of `SparkleProof`. * **Not claimed: a general source → final SystemVerilog text proof.** `#ved_write_checked` fixes which checked design was written; it does not prove the printer. * **A refusal is not a counterexample.** It says this entry could not build the theorem. Resource limits are not machine-separated from refusals by the entry itself; the corpus runner decides them first and never counts them as an expected refusal. ## Compatibility * **Sparkle API compatibility** is what PublicAPI.md section 6 says: 0.2.x keeps the public items with the same name and meaning; a minor release may change experimental and internal items; a soundness fix has priority even in a patch release and comes with a migration note. * **Lean toolchain compatibility is a separate matter.** The toolchain of this release is the content of `lean-toolchain` at the pinned commit: `leanprover/lean4:v4.32.1`. It is the only Lean version this release was built and checked with; no other Lean version is promised. A downstream project takes the toolchain file from the pin, not from `main`. * **Operating system.** The proof paths (the VED checks, the corpus, the proof consumer and the docs examples) were checked only on GitHub Actions `ubuntu-latest`; they are not claimed on other systems. The general downstream smoke test (a non-proof design used from another Lake project) also passes in CI on macOS and on Windows under WSL. ## Migrating from v0.2.0 to v0.2.1 v0.2.0 has no `SparkleProof`. A project that used v0.2.0 through `Tools.*` imports keeps working unchanged on v0.2.1 (nothing is removed); a project that wants the public entry changes two things: the pin, and optionally the import. `lakefile.toml` of the downstream project: ```diff [[require]] name = "sparkle" git = "https://github.com/Verilean/sparkle.git" -rev = "v0.2.0" +rev = "v0.2.1" # until the tag exists: the full 40-hex candidate SHA ``` and take `lean-toolchain` from the new pin (`curl -s https://raw.githubusercontent.com/Verilean/sparkle//lean-toolchain > lean-toolchain`); then `lake update sparkle` and `lake build`. In Lean source: ```diff -import Tools.VedU1Entry +import SparkleProof.Single ``` The command, the theorem type and the axioms are the same with both spellings. ### Old entry → public entry Every name below exists in this checkout (module files under `Tools/`, commands as `elab` definitions in the module named). Old entries stay in this release. Status words as in PublicAPI.md section 1. | Old entry | Where it is defined | Public entry / status | |---|---|---| | `import Tools.VedU1Entry` (`#ved_u1`) | `Tools/VedU1Entry.lean` | `import SparkleProof.Single`; the old import stays, **public** (compatibility) | | `import Tools.VedU1Contract` (`U1Stmt`, `Contract`, `InputsOk`, …) | `Tools/VedU1Contract.lean` | `import SparkleProof.Core`; old import stays, **public** (compatibility) | | `import Tools.VedStrictAudit` (`#ved_strict_audit`) | `Tools/VedStrictAudit.lean` | `import SparkleProof.Core` (or `Single`); old import stays, **public** (compatibility) | | `#ved_u1 f` | `Tools/VedU1Entry.lean` | same command via `SparkleProof.Single`; **public** | | `#ved_strict_audit d` | `Tools/VedStrictAudit.lean` | same command via `SparkleProof.Core`; **public** | | `.2.2.2.2` projections of `f.ved_u1` | (the shape of `U1Stmt`) | `SparkleProof.u1_corr`, `u1_shape`, `u1_width`, `u1_order`, `u1_outputs`, `u1_output_agrees`, `u1_output_at`; the conjunction shape is **not** a promise | | `#ved_axioms_raw`, `#ved_audit_generated`, `#ved_audit_current_namespace` | `Tools/VedStrictAudit.lean` | read-only reports; **experimental** (the last one is not named in PublicAPI.md and is internal) | | `import Tools.DeepElab` (`#verify_elab_deep`) | `Tools/DeepElab.lean` | no public equivalent; command **experimental** | | `import Tools.VedU1Deep` (`#ved_u1_deep`) | `Tools/VedU1Deep.lean` | no public equivalent; **experimental** | | `import Tools.VedU1PackedEntry` (`#ved_u1_packed`) | `Tools/VedU1PackedEntry.lean` | no public equivalent; **experimental** | | `import Tools.VedU1StructOut` (`#ved_u1_struct`) | `Tools/VedU1StructOut.lean` | no public equivalent; **experimental** | | `import Tools.VedMemEntry` (`#ved_u1_mem`, `#ved_u1_mem_packed`) | `Tools/VedMemEntry.lean` | no public equivalent; **experimental** | | `import Tools.VedU1HierEntry` (`#ved_u1_hier`) | `Tools/VedU1HierEntry.lean` | no public equivalent; **experimental** | | `import Tools.VedU2HierRegEntry` (`#ved_u2_hier`) | `Tools/VedU2HierRegEntry.lean` | no public equivalent; **experimental** | | `import Tools.VedWriteChecked` (`#ved_write_checked`) | `Tools/VedWriteChecked.lean` | no public equivalent; **experimental** | | `import Tools.SVParser`, `Tools.SVParser.VerifyEmit`, `…SimMacro`, `…RoundtripProof`, `…Macro`, `…DslEmit` | `Tools/SVParser*.lean`, `Tools/SVParser/` | no public equivalent; **experimental** (`Tools.SVParser.*`) | | `#ved_u1_write`, `import Tools.VedInvocation` | `Tools/VedInvocation.lean` | internal writer hook; **internal**, not an extension API | | `#ved_u1_packed_write`, `#ved_u1_hier_write`, `#ved_u2_hier_write`, `import Tools.VedWriteForms` | `Tools/VedWriteForms.lean` | internal; the experimental way to write checked files is `#ved_write_checked` | | `#ved_mem_classify` | `Tools/VedMemClassify.lean` | **internal** | | `import Tools.VedU2HierEntry`, `VedU1ScriptSeqGen`, `VedMemPack`, `VedMemWidth`, `VedMemOrder`, `VedMemLoop`, `VedU1OrderFast`, `VedU2HierBudget`, `VedU2HierProj`, `VedU2HierMultiOut`, `VedH3ChildEntry`, `VedH3ChildTblEntry`, `VedComposeMultiCircuit`, `VedComposeConnectGen`, `VedComposeStep`, `DeepFinArms` | `Tools/.lean` | **internal** (`Tools.VedU1*`, `VedU2Hier*`, `VedMem*`, `VedH3*`, `VedCompose*`, `Deep*` families); may change in any release | | `import Tools.VedSupplement` (user-supplied lemma, `ved.mem.userLemma`) | `Tools/VedSupplement.lean` | not part of the public entry; **internal** | | `checkU1E`, `ProofSrc.term`, `vedU1EntryOn` | `Tools/VedU1Entry.lean` | **internal**; accepts any statement and module, so it does not carry the guarantee | ## Known limitations * **The v0.2.0 tutorial Docker image build failed**: its Dockerfile lacked `COPY IP ./IP`, so the tutorial chapters that import IP modules could not be built. It is fixed on `main` by #190 (`docker/tutorial/Dockerfile` now copies `IP/`), and therefore in v0.2.1. Pushing a `v*` tag starts the image publication workflow (`.github/workflows/docker-image.yml`); its result for `v0.2.1` is checked by the checklist, and is not claimed here. * **Open defects found by the hardware co-simulation probes.** Each probe fails today and is **not** in CI; nothing below is claimed fixed (from `notes/ip/hw-cosim-coverage.md`): * *network, `ethernet-rx-sop-payload-hw-jit-probe`*: in `rxFramer`, the sop cycle of every frame after the first reports `payloadValid` with the new destination-MAC byte 0. * *network, `ipv4-rx-headerok-hw-jit-probe`*: `headerOk` is valid one cycle after `done` (documented: together with `done`), and a valid header with TTL ≠ 64 or ident ≠ 0 gets `headerOk = 0`. * *network, `http-request-parser-hw-jit-probe`*: the byte after a recognised `GET ` is skipped. * *network, `memcached-server-hw-jit-probe`*: a command terminated by a bare LF is never executed. * *network, `usb-webserver-e2e-hw-jit-probe`*: `usbWebServer` sends only the first byte of its response (no flow control from `txSequencer` into the UART). * *network, `net-hazards-hw-jit-probe`*: parser counters wrap, so a packet followed by payload with `valid` high can yield a second `done`, and builders restart on a trigger while busy. * *merkle, `merkle-hw-overflow-probe`*: `merkleRootHW` loses the root at the 16th leaf, although the documentation allows up to 16. * *crypto, `*-busy-start-probe`*: a `start` pulse while busy restarts the core (or corrupts the header for `rlpHeaderHW` / `eip1559EnvelopeHW`; lets a stale multiply latch into `ghashFullHW` / `gcmTagAccumulatorHW`); the intended convention is "ignored" and is undocumented. * *JIT, `fp381-mont-hw-jit-probe`*: the C backend's wide multiply uses only the low 64 bits of each operand, so `montMulHW` (384×32) returns 0 under the JIT. * *AES simulation*: `aes128BlockHW` cannot be elaborated for the JIT (`Cannot synthesise Signal.map … Unbound variable (slice_src)`), so it has no JIT co-sim; only the Signal-level `aes-hw-test` covers it. * **`#sim` file names.** `#sim f` writes `.lake/build/gen/sim/_jit.c`, so two `#sim` targets whose names end the same (`A.top`, `B.top`) share one file; a module replayed from a build cache does not rewrite it and then simulates the other design. In this repository the clashing test tops were renamed and `scripts/ci/sim_names.py` (CI config workflow) refuses new clashes; in your own project, keep the last name component of every `#sim` target distinct. * **Proof scope.** The experimental routes are not part of the 0.2.x promise (PublicAPI.md section 3); the entry refuses several real crypto circuits (point operations, signing demo, sponge; see [CryptoNotProved.md](../research/CryptoNotProved.md)). * **Only `ubuntu-latest` was checked** for the proof paths (see Compatibility).