Repository navigation
Proof: WebAssembly backend semantic preservation (source ⇓ v ⟹ wasm ⇓ encode(v)) #520
Copy link
Copy link
Open
Labels
majorMajor issue — significant scope, broader impact than a feature/bugMajor issue — significant scope, broader impact than a feature/bugpriority:p3Low - nice to haveLow - nice to havescope:repoConfined to this repositoryConfined to this repositorystatus:readyFully specified and ready to be picked upFully specified and ready to be picked uptech-debtKnown shortcut, drift, or hygiene owed - includes cleanupKnown shortcut, drift, or hygiene owed - includes cleanup
Description
Parent: #513
Statement
Prove semantic preservation for the WebAssembly backend in lib/codegen.ml:
For every closed AffineScript program
ethat evaluates to valuevunder the source operational semantics, the compiled WASM modulecompile(e)evaluates to a WASM valuev'that is the WASM encoding ofv.
⟨ e, σ ⟩ ⇓_{AS} v ⟹ ⟨ compile(e), σ' ⟩ ⇓_{WASM} encode(v)
Mechanisation
Why3 (existing WASM proof literature uses Why3) or Coq (WasmCert-Coq has primitives we can pull from). Target: formal/Codegen/Wasm/{Lowering.v, Preservation.v}.
Subgoals (do these first, in order)
- Match compilation soundness: emitted
block/br_ifdiscriminator sequence agrees with sourcematcharm semantics (codegen: integer/lowers to floating-point division on the JS-family backends #478 issue ci: Bump actions/setup-node from 4.0.2 to 6.3.0 #1). - Struct-layout invariant: field offsets populated globally + propagated to params/returns/lets (codegen: integer
/lowers to floating-point division on the JS-family backends #478 issue ci: Bump dtolnay/rust-toolchain from f7ccc83f9ed1e5b9c81d8a67d7ad1a747e22a561 to efa25f7f19611383d5b0ccf2d1c8914531636bf9 #2). - Indirect call ABI:
call_indirect's type signature matches the source-level function type at the call site. - Linear-memory mutation: writes to compiled
mutcells do not violate the borrow-graph soundness lemma (proven in Proof: borrow-graph soundness (no use-after-move + no conflict + BorrowOutlivesOwner) #515).
Reference
- WasmCert-Isabelle for the WASM operational semantics (#typed-wasm work has been adjacent — see PRs Cross-module imports: TopConst not threaded by gen_imports / flatten_imports #107/feat(codegen): thread imported TopConst across module boundaries (closes #107) #109/docs(coc): route conduct reports to OU address #115/Codegen: --vscode-extension flag to inline extraImports wiring #116/affine-vscode: align docs with --vscode-extension + npm publish manifest #117).
- Typed-WASM L7 (aliasing) / L10 (linearity) / L13 (module isolation) custom-section encoding — proven separately under the typed-wasm umbrella; this issue is the semantic preservation, not the isolation-fact encoding.
Size
XL. Estimate: 6+ weeks. The largest single proof on this list. Recommend splitting into the 4 subgoals above and shipping them as separate PRs.
Status
NOT STARTED.
🤖 Generated with Claude Code
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
majorMajor issue — significant scope, broader impact than a feature/bugMajor issue — significant scope, broader impact than a feature/bugpriority:p3Low - nice to haveLow - nice to havescope:repoConfined to this repositoryConfined to this repositorystatus:readyFully specified and ready to be picked upFully specified and ready to be picked uptech-debtKnown shortcut, drift, or hygiene owed - includes cleanupKnown shortcut, drift, or hygiene owed - includes cleanup
Activity