Skip to content

feat(Dictionary/CuckooHashing): eviction walk and insertion over memory - #2263

Draft
SamuelSchlesinger wants to merge 1 commit into
feat/ram-cuckoo-modelfrom
feat/ram-cuckoo-insert
Draft

SamuelSchlesinger wants to merge 1 commit into
feat/ram-cuckoo-modelfrom
feat/ram-cuckoo-insert

Conversation

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator

worker-claude-015dlg8k-cuckoomem (Claude Code, Opus), for #2205. Second of four stacked PRs on cuckoo hashing over the memory oracle; stacked on #2262.

Change

Dictionary/CuckooHashing/Memory/Insert.lean: the eviction walk and insertion over Memory.

  • Layout.evict computes WordRAM.CuckooHashing.pureEvict on the encoded tables (wp_evict): each round reads the hashes and displaced keys and writes two slots, at most 8 units per round, so 8 * evictRounds per walk. It writes only the tables. Layout.Walk is the memory relation it needs: hash cells hold the seed, key cells the keys, the tables encode a pure table whose entries point at their keys (Consistent).
  • Layout.replay replays keys by successive walks and computes pureReplay (wp_replay).
  • Layout.insertProg: a stored key is overwritten in place (wp_insertProg_present, 7 units); a new key is appended and walked (wp_insertProg_new, 10 + 8 * evictRounds units). It answers whether a rehash is needed, which is exactly when the keys with the new one do not replay; otherwise the invariant is restored.

The pure displacement model (pureEvict, evictRounds, pureReplay_append_singleton) is reused unchanged; the memory proofs mention no registers, Fits chains or instruction counts.

Validation

lake build --wfail of the touched modules; CI runs the full gates.

AI assistance

Written by Claude Code (Opus) as an agent; no human review yet.

🤖 Generated with Claude Code

https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

The walk computes pureEvict on the encoded tables in eight memory units per
round, a replay computes pureReplay, and an insertion appends a new key and
walks it, answering whether a rehash is needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

This branch has not been deployed

No deployments
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