Documentation

CslibFrontier.DataStructure.PriorityQueue.WordRAM.FibonacciHeap.MinPQ

Fibonacci Heap with Handles and Satellite Values #

This file implements the relational priority-queue specification Cslib.DataStructure.PriorityQueue.minPQSpec (returning an opaque handle h : Fin n_max on insert and (u, v, h) on extractMin) as a Word-RAM StateTransitionImpl over Cslib.WordRAM.Basis.exact (and lifted to Basis.standard), layered on top of Cslib.DataStructure.PriorityQueue.WordRAM.FibonacciHeap.

Over capacity n_max in a contiguous memory block [base, base + 11 * n_max + 1):

Main definitions #

Main results #

References #

Register file (rMinPQ = 48), embedding f42, and footprint size #

@[reducible, inline]

Total register count of the key–value Fibonacci heap with handle allocation.

@[reducible, inline]

Outer bump-pointer frontier register (base before allocSpan, base + space n_max after).

@[reducible, inline]

Persistent base address of val[0..n_max-1] (base + 9 * n_max + 1). Also serves as the relocated image of the inner FibonacciHeap.frontierReg.

@[reducible, inline]

Persistent base address of freeStack[0..n_max-1] (base + 10 * n_max + 1).

@[reducible, inline]

Persistent bump-pointer watermark fresh for never-allocated handles.

@[reducible, inline]

Persistent stack height freeTop for recycled handles in freeStack.

@[reducible, inline]

Caller input register carrying the satellite value v on insert.

@[reducible, inline]

Output register carrying the satellite value v on get and extractMin.

Injective register embedding from the inner rFib = 42 Fibonacci heap into rMinPQ = 48, mapping FibonacciHeap.frontierReg (R[1]) to valBaseReg (R[42]) so outerFrontierReg (R[1]) remains outside Set.range f42.

@[reducible, inline]

Persistent register holding handle capacity n_max (R[0]).

@[reducible, inline]

Persistent base address of key[0..n_max-1] (R[2]).

@[reducible, inline]

Persistent constant register 0 (R[11]).

@[reducible, inline]

Persistent constant register 1 (R[12]).

@[reducible, inline]

Caller high tag bit (R[17], ≠ 0 selects extractMin).

@[reducible, inline]

Caller middle tag bit (R[18]).

@[reducible, inline]

Caller low tag bit (R[19]).

@[reducible, inline]

Handle register (R[20], input for get/decreaseKey, scratch for insert).

@[reducible, inline]

Key input register (R[21], u for insert, u' for decreaseKey).

@[reducible, inline]

Primary output flag register (R[22]).

@[reducible, inline]

Output handle register (R[23], h.val for insert and non-empty extractMin).

@[reducible, inline]

Output key register (R[24], u for present get and non-empty extractMin).

@[reducible, inline]

Scratch pointer register for zeroFillCode (R[25]).

@[reducible, inline]

Scratch zero register for zeroFillCode (R[26]).

@[reducible, inline]

Scratch one register for zeroFillCode (R[27]).

@[reducible, inline]

Scratch address register (R[35]).

Persistent registers are 0..16 and 42..45 (false); caller/scratch registers are 17..41 and 46..47 (true).

Static memory footprint on capacity n_max: 11 * n_max + 1 words (9 * n_max + 1 for the inner Fibonacci heap plus n_max for val and n_max for freeStack).

Fresh-initialization instruction bound (allocSpan 15 + initSetup 18 = 33).

Instruction bound for isEmpty (including dispatch).

Instruction bound for get (including dispatch and value read).

Amortized instruction bound for insert (including handle allocation, value write, and +80 root potential).

Amortized instruction bound for decreaseKey (including dispatch and cascading cuts).

Amortized instruction bound for extractMin (420 * (Nat.log 2 n + 1)).

Per-operation amortized instruction charge for the key–value Fibonacci heap, charging tExt (MinPQ.size s) on .extractMin in terms of the current number of stored elements MinPQ.size s.

Since MinPQ.size s ≤ n_max, charge n_max s .extractMin ≤ tExt n_max.

Concrete integer potential 80 * (numRoots + 2 * numMarked) inherited from the inner Fibonacci heap.

Structured Basis.exact subprograms and subroutineCode #

Copy outerFrontierReg into valBaseReg, run FibonacciHeap.allocSpan.rename f42 to set baseReg = base and valBaseReg = base + 9 * n_max + 1, then advance freeBaseReg and outerFrontierReg by n_max each (15 steps total).

get h: runs FibonacciHeap.getKeyCode.rename f42 and, when outFlag ≠ 0, loads the satellite value outValReg ← val[argV].

Handle-allocation branch of insertCode: pops a recycled handle from freeStack[freeTopReg - 1] when freeTopReg ≠ 0, or allocates freshReg and increments freshReg when freeTopReg = 0.

insert u v: allocates a handle argV from freeStack (if freeTopReg > 0) or bumps freshReg via allocHandleBranch, stores val[argV] ← inValReg, runs FibonacciHeap.insertCode.rename f42 with key argK = u, and outputs outV ← argV.

decreaseKey h u': delegates directly to FibonacciHeap.decreaseKeyCode.rename f42.

extractMin: runs FibonacciHeap.extractMinCode.rename f42 and, when outFlag ≠ 0, loads outValReg ← val[outV] and pushes outV onto freeStack[freeTopReg].

Uniform SubroutineCode .exact rMinPQ 1 for the key–value Fibonacci heap with handles.

Calling convention: encode, argMatch, decode #

Raw register encoding for PriorityQueue.MinPQ.Op n_max using 1-bit tags (tag2, tag1, tag0).

Register encoding for PriorityQueue.MinPQ.Op n_max bounded by U on decreaseKey so arguments_fit holds on arbitrary states; coincides with rawEncode on every operation valid in a represented state (encode_eq_rawEncode_of_rep).

Standard argument-matching predicate for PriorityQueue.MinPQ.Op n_max.

Argument-matching predicate paired with encode U for WordRAM.StateTransitionImpl.

Output decoder for minPQSpec n_max U V.

theorem Cslib.DataStructure.PriorityQueue.WordRAM.FibonacciHeap.MinPQ.arguments_fit {n_max U V w base : ℕ} (hS : WordRAM.Fits w (base + space n_max)) (hU : WordRAM.Fits w U) (hV : WordRAM.Fits w V) {s : MinPQ.State n_max} (o : MinPQ.Op n_max) (hv : (minPQSpec n_max U V).valid s o) (i : Fin rMinPQ) :

Representation invariant (AllocRep, Rep) and framing lemmas #

Full machine-state representation invariant for an internal allocator state s : PriorityQueue.MinPQ.AllocState n_max.

Existential relational representation invariant over abstract state e : PriorityQueue.MinPQ.State n_max.

theorem Cslib.DataStructure.PriorityQueue.WordRAM.FibonacciHeap.MinPQ.owns_val_addr {n_max base idx : ℕ} (hidx : idx < n_max) :
{ base := base, length := space n_max }.Owns (base + FibonacciHeap.space n_max + idx)
theorem Cslib.DataStructure.PriorityQueue.WordRAM.FibonacciHeap.MinPQ.owns_free_addr {n_max base idx : ℕ} (hidx : idx < n_max) :
{ base := base, length := space n_max }.Owns (base + FibonacciHeap.space n_max + n_max + idx)
theorem Cslib.DataStructure.PriorityQueue.WordRAM.FibonacciHeap.MinPQ.fib_footprint_subset {n_max base : ℕ} :
{ base := base, length := FibonacciHeap.space n_max }.footprint ⊆ { base := base, length := space n_max }.footprint
theorem Cslib.DataStructure.PriorityQueue.WordRAM.FibonacciHeap.MinPQ.modifies_of_fib {n_max base : ℕ} {m₁ m₂ : ℕ → ℕ} (h : WordRAM.Modifies { base := base, length := FibonacciHeap.space n_max }.footprint m₁ m₂) :
WordRAM.Modifies { base := base, length := space n_max }.footprint m₁ m₂
theorem Cslib.DataStructure.PriorityQueue.WordRAM.FibonacciHeap.MinPQ.AllocRep.supported {n_max U V w base : ℕ} {s : MinPQ.AllocState n_max} {x x' : WordRAM.Data rMinPQ} (hreg : ∀ (i : Fin rMinPQ), inputReg i = false → x'.regs i = x.regs i) (hmem : ∀ a ∈ { base := base, length := space n_max }.footprint, x'.mem a = x.mem a) (hb' : WordRAM.Data.Bounded w x') (h : AllocRep n_max U V w base s x) :
AllocRep n_max U V w base s x'
theorem Cslib.DataStructure.PriorityQueue.WordRAM.FibonacciHeap.MinPQ.Rep.supported {n_max U V w base : ℕ} {e : MinPQ.State n_max} {x x' : WordRAM.Data rMinPQ} (hreg : ∀ (i : Fin rMinPQ), inputReg i = false → x'.regs i = x.regs i) (hmem : ∀ a ∈ { base := base, length := space n_max }.footprint, x'.mem a = x.mem a) (hb' : WordRAM.Data.Bounded w x') (h : Rep n_max U V w base e x) :
Rep n_max U V w base e x'
theorem Cslib.DataStructure.PriorityQueue.WordRAM.FibonacciHeap.MinPQ.rawArgMatch_of_argMatch {n_max U V w base : ℕ} {s : MinPQ.AllocState n_max} {x : WordRAM.Data rMinPQ} {o : MinPQ.Op n_max} (hrep : AllocRep n_max U V w base s x) (hv : (minPQSpec n_max U V).valid s.entries o) (harg : argMatch U o x.regs) :
theorem Cslib.DataStructure.PriorityQueue.WordRAM.FibonacciHeap.MinPQ.encode_eq_rawEncode_of_rep {n_max U V w base : ℕ} {e : MinPQ.State n_max} {x : WordRAM.Data rMinPQ} {o : MinPQ.Op n_max} (hr : Rep n_max U V w base e x) (hv : (minPQSpec n_max U V).valid e o) :

Initialization: incCur_eval, allocSpan_exec, initSetup_exec #

theorem Cslib.DataStructure.PriorityQueue.WordRAM.FibonacciHeap.MinPQ.allocSpan_exec {n_max w base : ℕ} (hS : WordRAM.Fits w (base + space n_max)) {x : WordRAM.Data rMinPQ} (hx : WordRAM.Data.Bounded w x) (hfr : x.regs outerFrontierReg = base) (hpar : ∀ (j : Fin 1), x.regs (![nReg] j) = ![n_max] j) :
∃ (x₁ : WordRAM.Data rMinPQ), WordRAM.ExecWithin w allocSpan x x₁ 15 ∧ x₁.mem = x.mem ∧ x₁.regs baseReg = base ∧ x₁.regs outerFrontierReg = base + space n_max ∧ ∀ (j : Fin 1), x₁.regs (![nReg] j) = ![n_max] j
theorem Cslib.DataStructure.PriorityQueue.WordRAM.FibonacciHeap.MinPQ.initSetup_exec {n_max U V w base : ℕ} {x₁ : WordRAM.Data rMinPQ} (hx₁ : WordRAM.Data.Bounded w x₁) (hb₁ : x₁.regs baseReg = base) (hfr₁ : x₁.regs outerFrontierReg = base + space n_max) (hpar₁ : ∀ (j : Fin 1), x₁.regs (![nReg] j) = ![n_max] j) (hz : ∀ a ∈ { base := base, length := space n_max }.footprint, x₁.mem a = 0) :
∃ (y : WordRAM.Data rMinPQ), WordRAM.ExecWithin w initSetup x₁ y 18 ∧ y.regs outerFrontierReg = base + space n_max ∧ Rep n_max U V w base (MinPQ.empty n_max) y ∧ potential y ≤ 0 ∧ WordRAM.Modifies { base := base, length := space n_max }.footprint x₁.mem y.mem

Operation specifications: isEmptyCode, getCode, insertCode #

theorem Cslib.DataStructure.PriorityQueue.WordRAM.FibonacciHeap.MinPQ.AllocRep.fits_stop {n_max U V w base : ℕ} {s : MinPQ.AllocState n_max} {x : WordRAM.Data rMinPQ} (hrep : AllocRep n_max U V w base s x) :
WordRAM.Fits w (base + space n_max)
theorem Cslib.DataStructure.PriorityQueue.WordRAM.FibonacciHeap.MinPQ.getCode_exec {n_max U V w base : ℕ} {s : MinPQ.AllocState n_max} {x : WordRAM.Data rMinPQ} (h : Fin n_max) (hrep : AllocRep n_max U V w base s x) (hv_reg : x.regs argV = ↑h) :
∃ (y : WordRAM.Data rMinPQ) (t : ℕ), WordRAM.ExecWithin w getCode x y t ∧ decode (MinPQ.Op.get h) y.regs = some (MinPQ.stepAlloc s (MinPQ.Op.get h)).2 ∧ AllocRep n_max U V w base (MinPQ.stepAlloc s (MinPQ.Op.get h)).1 y ∧ WordRAM.Modifies { base := base, length := space n_max }.footprint x.mem y.mem ∧ t + potential y ≤ 11 + potential x
theorem Cslib.DataStructure.PriorityQueue.WordRAM.FibonacciHeap.MinPQ.insertCode_exec {n_max U V w base u v : ℕ} {s : MinPQ.AllocState n_max} {x : WordRAM.Data rMinPQ} (hrep : AllocRep n_max U V w base s x) (hv : (minPQSpec n_max U V).valid s.entries (MinPQ.Op.insert u v)) (hk_reg : x.regs argK = u) (hval_reg : x.regs inValReg = v) :
∃ (y : WordRAM.Data rMinPQ) (t : ℕ), WordRAM.ExecWithin w insertCode x y t ∧ decode (MinPQ.Op.insert u v) y.regs = some (MinPQ.stepAlloc s (MinPQ.Op.insert u v)).2 ∧ AllocRep n_max U V w base (MinPQ.stepAlloc s (MinPQ.Op.insert u v)).1 y ∧ WordRAM.Modifies { base := base, length := space n_max }.footprint x.mem y.mem ∧ t + potential y ≤ 129 + potential x
theorem Cslib.DataStructure.PriorityQueue.WordRAM.FibonacciHeap.MinPQ.decreaseKeyCode_exec {n_max U V w base : ℕ} {s : MinPQ.AllocState n_max} {x : WordRAM.Data rMinPQ} (h : Fin n_max) (u' : ℕ) (hrep : AllocRep n_max U V w base s x) (hv : (minPQSpec n_max U V).valid s.entries (MinPQ.Op.decreaseKey h u')) (hv_reg : x.regs argV = ↑h) (hk_reg : x.regs argK = u') :

Unified dispatcher and WordRAM.StateTransitionImpl certificate #

theorem Cslib.DataStructure.PriorityQueue.WordRAM.FibonacciHeap.MinPQ.dispatchCode_exec_raw {n_max U V w base : ℕ} {e : MinPQ.State n_max} {x : WordRAM.Data rMinPQ} (o : MinPQ.Op n_max) (hr : Rep n_max U V w base e x) (hv : (minPQSpec n_max U V).valid e o) (harg : rawArgMatch o x.regs) :
∃ (y : WordRAM.Data rMinPQ) (s' : (minPQSpec n_max U V).State) (a : (minPQSpec n_max U V).Result o) (m : ℕ), WordRAM.Exec w dispatchCode x y m ∧ (minPQSpec n_max U V).step e o s' a ∧ decode o y.regs = some a ∧ Rep n_max U V w base s' y ∧ WordRAM.Modifies { base := base, length := space n_max }.footprint x.mem y.mem ∧ m + potential y ≤ charge n_max e o + potential x

Unified dispatcher dispatchCode implements all five MinPQ operations within charge n_max e o amortized instructions over Basis.exact.

theorem Cslib.DataStructure.PriorityQueue.WordRAM.FibonacciHeap.MinPQ.dispatchCode_exec {n_max U V w base : ℕ} {e : MinPQ.State n_max} {x : WordRAM.Data rMinPQ} (o : MinPQ.Op n_max) (hr : Rep n_max U V w base e x) (hv : (minPQSpec n_max U V).valid e o) (harg : argMatch U o x.regs) :
∃ (y : WordRAM.Data rMinPQ) (s' : (minPQSpec n_max U V).State) (a : (minPQSpec n_max U V).Result o) (m : ℕ), WordRAM.Exec w dispatchCode x y m ∧ (minPQSpec n_max U V).step e o s' a ∧ decode o y.regs = some a ∧ Rep n_max U V w base s' y ∧ WordRAM.Modifies { base := base, length := space n_max }.footprint x.mem y.mem ∧ m + potential y ≤ charge n_max e o + potential x

Unified standalone and inline-subroutine relational certificate for the key–value Fibonacci heap with handles over Basis.exact.

Canonical native formats of key/value queue observations.

The native format is an equality presentation of each existing result type.

One fixed result bank: presence flag, key, satellite value, and handle.

Native conversion reads the actual original operation tags from the machine.

Insertion places its returned handle in the first payload slot and writes its presence tag; all other observations retain their payloads. Every flag is normalized to zero or one.

Conversion pays at most nine native instructions and changes only its two output slots.

The fixed native suffix preserves the heap representation and its amortized potential.

theorem Cslib.DataStructure.PriorityQueue.WordRAM.FibonacciHeap.MinPQ.resultRecoding_ready {n_max U V w base : ℕ} (hS : WordRAM.Fits w (base + space n_max)) (hU : WordRAM.Fits w U) (hV : WordRAM.Fits w V) {s : (minPQSpec n_max U V).State} {x : WordRAM.Data rMinPQ} {o : (minPQSpec n_max U V).Op} {y : WordRAM.Data rMinPQ} {m : ℕ} (_hr : (impl hS hU hV).toStandard.rep s x) (_hv : (minPQSpec n_max U V).valid s o) (harg : (impl hS hU hV).toStandard.argMatch o x.regs) (he : WordRAM.Exec w subroutineCode.toStandard.code x y m) :
(resultRecoding hS hU hV).ready o y

Original operation execution preserves the opcode words consumed by native conversion.

Standalone Basis.standard DynamicProgram and Amortized implementations #

Standalone DynamicProgram implementation of the key–value Fibonacci heap over Basis.standard.

Standalone DynamicCertificate for the key–value Fibonacci heap over Basis.standard.

theorem Cslib.DataStructure.PriorityQueue.WordRAM.FibonacciHeap.MinPQ.amortized {n_max U V w base : ℕ} (hS : WordRAM.Fits w (base + space n_max)) (hU : WordRAM.Fits w U) (hV : WordRAM.Fits w V) :
Amortized (certificate hS hU hV).impl WordRAM.DynamicProgram.OperationTrace.instructions (fun (x : (minPQSpec n_max U V).State) (x_1 : WordRAM.Data rMinPQ) => potential x_1) fun (s : (minPQSpec n_max U V).State) (o : (minPQSpec n_max U V).Op) => charge n_max s o + 10

Standalone Amortized certificate for the key–value Fibonacci heap over Basis.standard, charging nine native conversion instructions and one trailing halt per operation.

theorem Cslib.DataStructure.PriorityQueue.WordRAM.FibonacciHeap.MinPQ.run_client_amortized {n_max U V w base : ℕ} (hS : WordRAM.Fits w (base + space n_max)) (hU : WordRAM.Fits w U) (hV : WordRAM.Fits w V) {α : Type u_1} (p : (minPQSpec n_max U V).Client α) {s : MinPQ.State n_max} {x : WordRAM.Data rMinPQ} (hr : Rep n_max U V w base s x) (hv : (minPQSpec n_max U V).DemonicValid s p) :
∃ (a : α) (y : WordRAM.Data rMinPQ) (traces : List WordRAM.DynamicProgram.OperationTrace) (s' : (minPQSpec n_max U V).State) (tr : (minPQSpec n_max U V).Transcript), Executes ((dynamicProgram hS hU hV).ExecOp w) p x a y traces ∧ (minPQSpec n_max U V).ClientRun s p a s' tr ∧ Rep n_max U V w base s' y ∧ traces.length = List.length tr ∧ total WordRAM.DynamicProgram.OperationTrace.instructions traces + potential y ≤ (minPQSpec n_max U V).totalCostTranscript (fun (st : (minPQSpec n_max U V).State) (o : (minPQSpec n_max U V).Op) => charge n_max st o + 10) s tr + potential x

Adaptive-client amortized execution bound for any demonically admissible MinPQ client p over Basis.standard.

Standalone end-to-end Basis.exact flat-program adaptive-client theorems #

Compiled flat Program .exact rMinPQ for O(n_max) dirty-memory reusable initialization.

Compiled flat Program .exact rMinPQ serving all five priority-queue operations.

Initial register assignment supplying n_max in nReg (R[0]), base in outerFrontierReg (R[1]), and 0 elsewhere.

Deliver operation o's 3-bit tag into tag2..tag0 (R[17..19]), handle/key arguments into argV, argK (R[20..21]), and satellite value into inValReg (R[46]), leaving all other registers unchanged.

Count isEmpty and get queries in an operation sequence.

Count insert operations in an operation sequence.

Count decreaseKey operations in an operation sequence.

Count extractMin operations in an operation sequence.

Sum of Nat.log 2 (MinPQ.size s) + 1 over all extractMin steps along a relational transcript tr starting from state s, where MinPQ.size s is the number of stored elements immediately before each extractMin.

inductive Cslib.DataStructure.PriorityQueue.WordRAM.FibonacciHeap.MinPQ.RunsClient {n_max U V : ℕ} {α : Type u_1} (w base : ℕ) :
MinPQ.State n_max → WordRAM.Data rMinPQ → (minPQSpec n_max U V).Client α → α → (minPQSpec n_max U V).Transcript → MinPQ.State n_max → WordRAM.Data rMinPQ → ℕ → Prop

Sequential flat-program execution of an adaptive client p : (minPQSpec n_max U V).Client α by repeated calls to opProg: each .liftBind o k call prepares input registers via prepareRegs, runs opProg from pc = 0 to halt, decodes a valid minPQSpec transition (s₁, a), modifies memory only within [base, base + space n_max), continues with k a, records the resulting return value v and transcript tr, and accumulates total instructions executed (including each trailing halt).

theorem Cslib.DataStructure.PriorityQueue.WordRAM.FibonacciHeap.MinPQ.RunsClient.pure_iff {n_max U V : ℕ} {α : Type u_1} {w base : ℕ} {s s' : MinPQ.State n_max} {x z : WordRAM.Data rMinPQ} {a v : α} {tr : (minPQSpec n_max U V).Transcript} {total : ℕ} :
RunsClient w base s x (PFunctor.FreeM.pure a) v tr s' z total ↔ v = a ∧ tr = [] ∧ s' = s ∧ z = x ∧ total = 0
theorem Cslib.DataStructure.PriorityQueue.WordRAM.FibonacciHeap.MinPQ.RunsClient.liftBind_iff {n_max U V : ℕ} {α : Type u_1} {w base : ℕ} {s s₂ : MinPQ.State n_max} {x z : WordRAM.Data rMinPQ} {o : MinPQ.Op n_max} {k : (minPQSpec n_max U V).Result o → (minPQSpec n_max U V).Client α} {v : α} {tr : (minPQSpec n_max U V).Transcript} {total : ℕ} :
RunsClient w base s x (PFunctor.FreeM.liftBind o k) v tr s₂ z total ↔ ∃ (s₁ : (minPQSpec n_max U V).State) (a : (minPQSpec n_max U V).Result o) (tr_rest : List (minPQSpec n_max U V).Step) (pc : ℕ) (y : WordRAM.Data rMinPQ) (steps : ℕ) (rest : ℕ), tr = { op := o, result := a, nextState := s₁ } :: tr_rest ∧ total = steps + 1 + rest ∧ WordRAM.Runs w opProg { pc := 0, data := { regs := prepareRegs o x.regs, mem := x.mem } } { pc := pc, data := y } steps ∧ (∃ (out : ℕ), WordRAM.step w opProg { pc := pc, data := y } = WordRAM.Outcome.halt out) ∧ (minPQSpec n_max U V).step s o s₁ a ∧ decode o y.regs = some a ∧ WordRAM.Modifies { base := base, length := space n_max }.footprint x.mem y.mem ∧ RunsClient w base s₁ y (k a) v tr_rest s₂ z rest
theorem Cslib.DataStructure.PriorityQueue.WordRAM.FibonacciHeap.MinPQ.run_client_exact_fresh {n_max U V w base : ℕ} (hS : WordRAM.Fits w (base + space n_max)) (hU : WordRAM.Fits w U) (hV : WordRAM.Fits w V) {mem₀ : ℕ → ℕ} (hmem : ∀ (a : ℕ), WordRAM.Fits w (mem₀ a)) (hzero : ∀ a ∈ { base := base, length := space n_max }.footprint, mem₀ a = 0) {α : Type u_1} (p : (minPQSpec n_max U V).Client α) (hv : (minPQSpec n_max U V).DemonicValid (MinPQ.empty n_max) p) :
∃ (pc₀ : ℕ) (x₀ : WordRAM.Data rMinPQ) (t_init : ℕ) (v : α) (tr : (minPQSpec n_max U V).Transcript) (s_fin : MinPQ.State n_max) (z : WordRAM.Data rMinPQ) (t_ops : ℕ), WordRAM.Runs w initFreshProg { pc := 0, data := { regs := initRegs n_max base, mem := mem₀ } } { pc := pc₀, data := x₀ } t_init ∧ (∃ (out : ℕ), WordRAM.step w initFreshProg { pc := pc₀, data := x₀ } = WordRAM.Outcome.halt out) ∧ WordRAM.Modifies { base := base, length := space n_max }.footprint mem₀ x₀.mem ∧ RunsClient w base (MinPQ.empty n_max) x₀ p v tr s_fin z t_ops ∧ (minPQSpec n_max U V).ClientRun (MinPQ.empty n_max) p v s_fin tr ∧ t_init + 1 ≤ 421 ∧ t_ops ≤ 421 * (numQueries tr.ops + numInserts tr.ops + numDecreaseKeys tr.ops + extractLogSum (MinPQ.empty n_max) tr) ∧ t_ops ≤ 421 * (numQueries tr.ops + numInserts tr.ops + numDecreaseKeys tr.ops + numExtractMins tr.ops * (Nat.log 2 n_max + 1))

Standalone Basis.exact adaptive-client theorem with O(1) fresh initialization on zeroed [base, base + 11 * n_max + 1) and per-extraction O(log n + 1) amortized cost in the current number of stored elements n = MinPQ.size s.

theorem Cslib.DataStructure.PriorityQueue.WordRAM.FibonacciHeap.MinPQ.run_client_exact_reusable {n_max U V w base : ℕ} (hS : WordRAM.Fits w (base + space n_max)) (hU : WordRAM.Fits w U) (hV : WordRAM.Fits w V) {mem₀ : ℕ → ℕ} (hmem : ∀ (a : ℕ), WordRAM.Fits w (mem₀ a)) {α : Type u_1} (p : (minPQSpec n_max U V).Client α) (hv : (minPQSpec n_max U V).DemonicValid (MinPQ.empty n_max) p) :
∃ (pc₀ : ℕ) (x₀ : WordRAM.Data rMinPQ) (t_init : ℕ) (v : α) (tr : (minPQSpec n_max U V).Transcript) (s_fin : MinPQ.State n_max) (z : WordRAM.Data rMinPQ) (t_ops : ℕ), WordRAM.Runs w initClearProg { pc := 0, data := { regs := initRegs n_max base, mem := mem₀ } } { pc := pc₀, data := x₀ } t_init ∧ (∃ (out : ℕ), WordRAM.step w initClearProg { pc := pc₀, data := x₀ } = WordRAM.Outcome.halt out) ∧ WordRAM.Modifies { base := base, length := space n_max }.footprint mem₀ x₀.mem ∧ RunsClient w base (MinPQ.empty n_max) x₀ p v tr s_fin z t_ops ∧ (minPQSpec n_max U V).ClientRun (MinPQ.empty n_max) p v s_fin tr ∧ t_init + 1 ≤ 421 * (n_max + 1) ∧ t_ops ≤ 421 * (numQueries tr.ops + numInserts tr.ops + numDecreaseKeys tr.ops + extractLogSum (MinPQ.empty n_max) tr) ∧ t_ops ≤ 421 * (numQueries tr.ops + numInserts tr.ops + numDecreaseKeys tr.ops + numExtractMins tr.ops * (Nat.log 2 n_max + 1))

Standalone Basis.exact adaptive-client theorem with O(n_max) reusable initialization on arbitrary w-bounded memory mem₀ and per-extraction O(log n + 1) amortized cost in the current number of stored elements n = MinPQ.size s.