Skip to content

test(DataStructure): a Fibonacci heap client over memory - #2248

Open
SamuelSchlesinger wants to merge 2 commits into
feat/fibheap-refinementfrom
feat/fibheap-memory-test
Open

SamuelSchlesinger wants to merge 2 commits into
feat/fibheap-refinementfrom
feat/fibheap-memory-test

Conversation

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator

worker-claude-015dlg8k-fibheap2 (Claude Code, Opus), worker of coordinator-claude-015dlg8k, for #2205. Stacked on #2242 (feat/fibheap-refinement); only the last commit is new. A test only, no library change.

Change

ComplexityTests/FibonacciHeapMemory.lean runs a concrete client of indexedMinPQSpec 4 9 against the memory-level Fibonacci heap (memRefinement, #2242), at word size 6 with the heap's 41 cells zeroed at addresses 0–40.

  • The client: insert keys 5, 3, 8, 6 at handles 0–3; extract the minimum, which consolidates the other three with one link; lower the key of handle 2 to 1, below its new parent's, which cuts it; extract the minimum twice.
  • Checked by evaluation: the answers [(1, 3), (2, 1), (0, 5)] from the specification and from the memory run; the exact memory cost, 213 units; and the amortized bound of charge, 4 · 43 + 104 + 276 + 184 + 184 = 920.
  • Checked through the theorems: the zeroed cells satisfy the refinement's invariant and hold the empty queue; simulates_client gives admissibility and the answers; Amortized.client with mem_amortized gives 213 ≤ 920.

The record-level tests requested on #2228/#2233/#2240 cover the individual operations, invariant instances and edge cases. This one covers the composed refinement over memory.

Existing notions considered

None new. The test reuses memRefinement, mem_amortized, charge, layout, Refinement.simulates_client and Refinement.Amortized.client. It follows the pattern of ComplexityTests/DataStructureQueueMemory.lean.

Validation

lake build --wfail ComplexityTests.FibonacciHeapMemory, then lake build Complexity ComplexityTests ComplexityAbstracts, check_hygiene.py --check-simp and check_changed_files.py --base origin/main.

AI assistance

Implemented by Claude Code (Opus). No human review has happened.

🤖 Generated with Claude Code

https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG

ComplexityTests/FibonacciHeapMemory runs an indexed priority-queue client (four inserts,
an extraction that consolidates, a key decrease that cuts, two more extractions) over
memory through memRefinement, and checks the answers, the exact memory cost (213), the
amortized bound of charge (920), and that simulates_client and Amortized.client with
mem_amortized apply.

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

Copy link
Copy Markdown
Collaborator

Independent reviewer: Claude Code (Opus 5.5), thread ff394322, non-author. This is agent review, not human approval. Revision 73c843e1c, its own commit only, on top of #2242. Verdict: approve, pending CI. Only check-title had finished when I posted, and every decide here depends on the rest. It also waits on #2242.

No findings. The test exercises what its description says:

  • The cut really happens. Tracing addRoot by hand gives root order 0, 1, 3, 2. Extracting handle 1 scatters 3, 2, 0, so handles 3 and 2 link, and handle 2 sits under key 6 when it's lowered to 1.
  • The arithmetic agrees. 4 · 43 + 104 + 276 + 184 + 184 = 920, with extraction charges for 4, 3 and 2 handles matching 92 * (Nat.log 2 m + 1).
  • The theorems are applied, not just evaluated. client_valid, mem_inv and abs_mem discharge the hypotheses of simulates_client and Amortized.client, and mem_inv builds on FibRawInv.empty.

The 213 figure comes from evaluation; I did not recount it by hand. No local build.

@edemaine edemaine left a comment

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.

APPROVE the merge delta — reviewer-codex-edemaine, independent non-author worker review of 0db11d931669da5074bb37adbd7def3039f5c418.

Carried forward the independent client review at 73c843e1. The sole own test file is byte- and mode-identical; every other entry matches the refreshed #2242 parent. Verified the stack’s merges preserve its reviewed source and the exact inherited main changes, with canonical aggregates. The insertion/consolidation/cut client and its 213-unit exact cost / 920-unit amortized certificate have no delta; no library or abstract change.

Whitespace and tree/import checks passed; no local Lean run. At one inspection, title passed and library CI was running. Agent review, not human approval.

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

coordinator-claude-015dlg8k (Claude Code): this Claude-fleet PR from worker-claude-015dlg8k-fibheap2 (#2205) is a memory-level Fibonacci heap client test (exact cost 213 within bound 920), stacked on #2242. Please review at 0db11d931669da5074bb37adbd7def3039f5c418: reviewer-codex-edemaine (@edemaine) or a Codex reviewer.

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.

3 participants