Skip to content

Add the simplest memory implementation with its MemorySpec simulation proof (stacked on #2) - #3

Draft
JasonGross wants to merge 5 commits into
mit-plv:mainfrom
JasonGross:fable/memory-impl
Draft

JasonGross wants to merge 5 commits into
mit-plv:mainfrom
JasonGross:fable/memory-impl

Conversation

@JasonGross

Copy link
Copy Markdown

Adds app/MemoryImpl.v and app/MemoryImplSimulates.v: the simplest memory that satisfies MemorySpec (no cache, write-through stores, one outstanding load, a one-slot response buffer, with ctrl_exec_leakage showing that its schedule depends on the leakage trace alone), and the proof that it simulates MemorySpec.spec with the spec's SpecParams instantiated by replaying the implementation on the trace.

This is the gist from the #1 thread (https://gist.github.com/andres-erbsen/d2a697b60e8455af7110bb4aa0ecafe8) ported to stdlib bits: only the bv Params.width, bv_0 _ and applied zeroes spellings changed.

Print Assumptions simulates (and ctrl_exec_leakage, public_resps_deterministic): closed under the global context.

Stacked on #2, whose first commits are #1: only the last commit, b5b2ba5, is new here.

Written by Claude Fable 5.1.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YJbiRBkJtM7x6PvYV6hmEm

JasonGross and others added 5 commits September 15, 2026 22:12
A plain `dune build` at the root recurses into quartz/test, whose rules
run the quartz tests and need a slang binary that is not part of a
granite checkout, so the build fails before compiling anything of
granite. The default alias now covers core, app, isaSpec, quartz/lang
and quartz/examples, which is what quartz's own root dune file does.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJbiRBkJtM7x6PvYV6hmEm
Bit vectors are stdlib's bits n := Zmod (2^n) (rocq-stdlib >= 9.1),
widths are Z, and the quartz submodule moves to the quartz commit that
makes the same change (mit-plv/quartz#2), so that granite and quartz
share one representation and rocq-stdpp-bitvector is no longer a
dependency.

core/Bits.v provides what stdpp.bitvector.definitions provided: the
bits notation, a Number Notation whose literals are constructor-shaped
so that closed constants still compute with Zmod.of_small_Z opaque
(simpl/cbn through of_small_Z are exponential in the nesting depth),
EqDecision/Countable/Inhabited/Finite instances, and the
granite-specific helpers on top of Zmod. Sections over an abstract
width take a Finite (bits idx_sz) hypothesis whose proof term is
canonical, because hint-generated instances differ between files and
then fail to unify.

Proof scripts change only where the two sides of a simulation used to
be syntactically equal by construction and now differ in spelling:
quartz interprets equality tests as Zmod.eqb while granite's programs
compare with Zmod.unsigned _ =? Zmod.unsigned _, so the scripts unfold
Zmod.eqb (and nonzero of an embedded boolean) before the case splits
that must hit both sides. Auto-generated hypothesis names follow the
new types, and two `clear`s that implicitly kept section variables
through the type of a kept hypothesis are made explicit or dropped.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJbiRBkJtM7x6PvYV6hmEm
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJbiRBkJtM7x6PvYV6hmEm
Bump the quartz submodule to fable/monomorphize (201186a), which stacks
Andres's monomorphization work on the stdlib-bits port. Two things in
that work reach granite. lang/let_lift.v is gone, so QuartzImpl_helpers
no longer imports it. The cpu program in Processor.v now calls the
helper constants directly (fifo1.full, btb.predPc, ...) instead of
going through the record implementations, so making fifo1.impl and the
other records opaque no longer keeps quartz's side of the lowering
lemmas folded while granite's simulation specs still spell the record
projections. QuartzImpl makes the constants opaque instead: with the
records transparent both sides reduce to the same fn.interp of the
constant, and the proof scripts go through unchanged.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJbiRBkJtM7x6PvYV6hmEm
…imulation proof

MemoryImpl is a memory with no cache, write-through stores, one
outstanding load and a one-slot response buffer; its control state, and
hence RespReady, Full and the timing of responses, is a function of the
leakage trace alone (ctrl_exec_leakage). MemoryImplSimulates instantiates
MemorySpec's SpecParams by replaying the implementation on the trace and
proves Simulates.simulates between MemoryImpl.spec and MemorySpec.spec,
so the implementation can stand in for the memory model of the pipeline
proofs.

This is Andres Erbsen's gist
https://gist.github.com/andres-erbsen/d2a697b60e8455af7110bb4aa0ecafe8
ported from stdpp bitvectors to stdlib bits: bv Params.width is
bits Params.width, and bv_0 _ and the applied zeroes are the zeroes
literal. Nothing else changed; simulates is closed under the global
context.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJbiRBkJtM7x6PvYV6hmEm
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.

1 participant