Skip to content

Iprop module-linking - #143

Closed
Isabelle9999 wants to merge 18 commits into
cajal-technologies:mainfrom
Isabelle9999:module-linking-clean
Closed

Iprop module-linking#143
Isabelle9999 wants to merge 18 commits into
cajal-technologies:mainfrom
Isabelle9999:module-linking-clean

Conversation

@Isabelle9999

@Isabelle9999 Isabelle9999 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Overview

module linking :: function specs carry iProp ownership (pointsTo_u64, separating conjunction ∗), so the frame rule guarantees that callers' private memory is untouched across function calls automatically without manual disjointness proofs.

This is the standard Iris-Wasm pattern (PLDI'23, §2.2) adapted for Talos's big-step fuel semantics.

Why we needed wp_wasm_iProp

Talos's existing wp_wasm takes Q : Store Unit → List Value → Prop , which is a Prop-level postcondition. This works for intra-module proofs (swap, merge_sort) where Prop composition suffices. But for module
linking, function specs need iProp postconditions (pointsTo_u64, ∗) so the frame rule operates at the iProp level where ∗ is native.

The solution: a parallel wp_wasm_iProp that takes Φ : Store Unit → List Value → IProp WasmHeapGF as postcondition. Both WPs coexist, existing proofs use wp_wasm unchanged, module linking uses wp_wasm_iProp. A bridge theorem connects them:

wp_wasm_iProp_pure : wp_wasm Q = wp_wasm_iProp (fun st' vs => ⌜Q st' vs⌝)

This is Talos-specific: Iris-Wasm (small-step) has wp_bind built into Iris generically. Our big-step fuel semantics requires explicit fuel composition (wp_wasm_iProp_call), which is the standard adaptation every Iris instantiation makes for its language (HeapLang has wp_rec, Iris-Wasm has wp_invoke_native, we have wp_wasm_iProp_call).

This parallel architecture means each per-construct rule (block, call, loop) needs both Prop and iProp versions, which cost more maintenance cost.

Generated with Claude Code

@Isabelle9999
Isabelle9999 force-pushed the module-linking-clean branch 2 times, most recently from ad18dff to c83a93e Compare July 13, 2026 17:21
@Isabelle9999
Isabelle9999 marked this pull request as ready for review July 13, 2026 17:34
@Isabelle9999
Isabelle9999 requested a review from mfornet as a code owner July 13, 2026 17:34
@mfornet

mfornet commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Merge this on top of latest branch of #133 to keep them in sync

@Isabelle9999

Copy link
Copy Markdown
Contributor Author

Merge this on top of latest branch of #133 to keep them in sync
I will rebase after the iprop fix, because funcSatisfies needs iProp postconditions for the frame rule


open Wasm

axiom dlmalloc_alloc_spec

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@El3ssar this might be enough for you for the moment for the encode/decode experiment

@Isabelle9999 please open an issue tracking this axiom: the goal is to convert it to a theorem

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

…rship, soundness bridge

- WasmHeap: GenHeap instantiation (UInt32 → Option UInt8), pointsTo notation,
  pointsTo_u64/u32 (8/4-byte ownership), arrayAt with element lemmas
- WasmRules: load_sound/store_sound bridging physical and ghost memory
- WasmWP: Prop-level wp_wasm_prop definition (exists fuel, exec matches Q)
- iris-lean added as dependency (BSD, Lean 4.31-matched)
@Isabelle9999
Isabelle9999 force-pushed the module-linking-clean branch from c83a93e to 0145c08 Compare July 26, 2026 15:27
@Isabelle9999

Isabelle9999 commented Jul 26, 2026

Copy link
Copy Markdown
Contributor Author

rebased onto #156 and got rid of conflicts

@Isabelle9999

Copy link
Copy Markdown
Contributor Author

closing to adapt to small-step

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants