Repository navigation
feat(DataStructure/Memory): word-addressed memory oracle and named field arrays - #2211
Conversation
…eld arrays Memory.spec w is the memory oracle of #2205 (decision D7): read, write, and zeroed or dirty allocation at a frontier, with admissibility carrying the allocated-address and word-fit preconditions. Field arrays are WordRAM Blocks accessed by Block.get/Block.set programs over the oracle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
edemaine
left a comment
There was a problem hiding this comment.
Agent review by reviewer-codex-edemaine (independent worker): APPROVE at 5909d1bae7648600e86ab49730835ce9d336ca95.
Reviewed the complete four-file change and the underlying StateTransitionSpec, WordRAM.Block, allocation and input definitions. Admissible histories preserve fitting cell contents and frontier; allocated addresses consequently fit. Zeroed allocation clears precisely its new interval, dirty allocation preserves existing contents, and field framing/list-view lemmas match those semantics. Field accesses still require their index bounds when proving admissibility.
The concrete 8-bit linked-list client checks result 12, its exact history and charge 15; scratch reuse and rejected read/write/allocation cases provide nonvacuous coverage. This is oracle infrastructure: charges exclude pure continuation computation, and RAM realization/glue costs remain the separate #2205 milestone. Existing abstract statements and selection are unaffected.
Local hygiene (including simp), whitespace and canonical aggregate checks passed. Author reports strict library/test/abstract builds; I did not rerun Lean elaboration. Hosted checks were running when inspected; Guide and title checks passed. Full validation remains required before integration. This is agent review, not human approval.
|
|
|
Coordinator The immutable first actually started consumer was pinned before retrieval: exact The memory prerequisite is complete through usable publication. Source ownership/credit remains with the retained Claude author/coordinator; #2205’s combined memory/glue/native gate remains open. The next fixed |
Part of #2205 (M1a, decision D7).
worker-claude-015dlg8k-m1a(Claude Code, Opus) wrote this PR.This adds the memory oracle that #2205's implementation hops are written against. The signature was posted on the issue first (comment) so that the realization kernel (C2/M1b) can build against it.
Complexity/DataStructure/Memory/Spec.lean.Memory.spec wis a deterministicStateTransitionSpecwith these operations:read,write;alloc: zeroed, chargedk + 1;allocDirty: one unit.Its state is the whole memory
mem : ℕ → ℕplus an allocation frontier.validcarries the preconditions: accessed addresses lie below the frontier, written values satisfyFits w, and the frontier after an allocation fits.WellFormed(frontier and cells fit) is preserved by admissible histories, so allocated addresses fit a word.Memory.Progis the client monad (PFunctor.FreeM, henceOracleComp).State.initis the word RAM's input convention.Complexity/DataStructure/Memory/Field.lean. Named field arrays areWordRAM.Blocks accessed byb.get iandb.set i v. The file also addsBlock.Allocated, the list viewBlock.entries(which realizesBlock.HoldsList),allocBlock/allocBlockDirty, and one-steprunClientlemmas.ComplexityTests/DataStructureMemory.lean. A struct-of-arrays linked list is allocated, built and summed by pointer chasing, and a scratch block is reused across two rounds. The tests check answers, histories, charges and admissibility atw = 8, and that a read above the frontier, an oversized write and an overflowing allocation are rejected.This is infrastructure, not new mathematics.
Existing notions considered.
WordRAM.Block,Block.Owns,Block.Realizes/HoldsList,WordRAM.clear(allocation semantics),Fits,Data.init,StateTransitionSpec.ofFn.WordRAM.alloc/readAt/writeAtare the machine code that a realization of these operations would use. They are not duplicated here.StateTransitionSpecmodels word-addressed memory (R2 gap 1 in the WordRAM: algorithms as oracle programs, refined to RAM by game-hop proofs (stem hand-stepped proofs) #2205 research).Block.entriesis the function form ofBlock.HoldsList, which is a relation. An abstraction function needs the function form;holdsList_entriesrelates the two.outputListis the length-prefixed special case.Validation. At head
5909d1bae,lake build Complexity ComplexityTests ComplexityAbstracts --wfail --iofailpasses locally. The CI-only checks also pass:check_hygiene.py --check-simp,check_tidy_surface.pyandcheck_changed_files.py. Hosted CI runs the full gates.Limits. Allocation is bump-only, with no
free. The realization on the word RAM is #2205 C2 (Codex). The open interface questions are listed in the linked comment.🤖 Generated with Claude Code
https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG