Fibonacci Heap: decreaseKey and Cascading Cuts #
This file proves the exact-Word-RAM specification decreaseKeyCode_exec (O(1) amortized time
under potential = 80 * (numRoots + 2 * numMarked)):
- No-cut key decrease (
ValidSubtree.lower_key_no_cut): Whenvis already a root or loweringkey[v]tok ≤ key[v]preservesIndexedMinPQ.PrioLT (p, key[p]) (v, k),FibRawInvholds without cutting any edges. - Single-edge cut (
cutNodeCode_raw,cutNode_forest): ExecutescutNodeCodein at most36instructions, splicingcurinto the circular root list, updating parent degree/child pointers, clearingpar[cur]andmark[cur], and adjustingpotentialby-80whencurwas marked or+80whencurwas unmarked. - Cascading cuts (
decreaseKeyCode_exec): AppliesExecWithin.loop_potential_retainto pay every cascading-cut iteration (≤ 50instructions including loop step) out of the-80drop inpotential, marks the stopping non-root ancestor (+160), updatesminRootReg, and restoresFibInvwithin amortized charge330(335 ≤ tDec nincluding dispatch).
Main definitions #
cutNodeCodeanddecreaseKeyCodeare defined inComplexity/Algorithms/WordRAM/PriorityQueue/FibonacciHeap/Program.leanand verified here againstCutInvandFibInv.
Main results #
Cslib.Algorithms.WordRAM.PriorityQueue.FibonacciHeap.cutNodeCode_raw,cutNode_forest: single-edge pointer and forest cut specifications.Cslib.Algorithms.WordRAM.PriorityQueue.FibonacciHeap.decreaseKeyCode_exec:O(1)amortizeddecreaseKeyspecification with cascading cuts.
References #
Pure forest lemmas for decreaseKey #
Inside a valid root tree T with Nodup nodes, st.par u = 0 holds iff u = T.root.
Lowering key[v] to k ≤ st.key v preserves ValidSubtree st' none T whenever v = T.root or
v has parent p (st.par v = p.val + 1) with ¬IndexedMinPQ.PrioLT (v, k) (p, st.key p).
Scalar counter bounds under CutInv.
Once cascading cuts finish (pending = none) and minRoot is updated against (v, st.key v),
CutInv upgrades back to FibRawInv.
evalCascGuard specification #
evalCascGuard sets iterCur ← 1 iff par[cur] ≠ 0 ∧ mark[cur] ≠ 0, and 0 otherwise, in
at most 8 instructions while preserving BaseRegs, RawState.ofData, and all registers other
than s0, s1, s2, iterCur.
cutNodeCode machine execution #
Raw machine specification of cutNodeCode: cuts cur (zReg) from p (pReg) and splices
cur after m (minRootReg = m.val + 1) in at most 36 instructions.
Forest-level cut transition (cutNode_forest) #
Unified forest transition for cutNodeCode: given a pre-key-decrease witness st_pre agreeing
with st = RawState.ofData n base x everywhere except possibly st.key cur ≤ st_pre.key cur,
cutting cur (st.par cur = p.val + 1) establishes CutInv n K_max s' st' v m (some p) and
preserves ∀ T ∈ ts', p ∈ T.nodes → T.root ≠ v.
Final minRootReg update tail and decreaseKeyCode_exec #
decreaseKeyCode lowers key[v] to k ≤ k₀ (s v = some k₀), performs cascading cuts when
parent heap order is violated, updates minRootReg, and restores FibInv in amortized time
t + potential y ≤ 330 + potential x.