Documentation

CslibFrontier.DataStructure.PriorityQueue.FibonacciHeap.Native.Domain

Source forest domains for native Fibonacci updates #

The existing forest and record proofs supply the pointer and exact-subtraction conditions needed by native source blocks. These are consequences of the existing Cascading invariant, not a replacement heap model or a complete native decrease-key theorem.

Main results #

theorem Cslib.DataStructure.PriorityQueue.FibonacciHeap.Native.cascadeStep_progress {n K w : ℕ} {s : IndexedMinPQ.State n} {g : Cell → ℕ} {v m z : Fin n} {ts : List (WordRAM.FibonacciHeap.FHTree n)} (hfit : WordRAM.Fits w n) (h : Cascading n K s (view n g) v m (some z) ts) (hv : ∃ T ∈ ts, T.root = v) (hzv : ∀ T ∈ ts, z ∈ T.nodes → T.root ≠ v) (hz : z ∈ WordRAM.FibonacciHeap.forestNodes ts) :
Record.wp (Cell.ok n) w (cascadeStep ↑z) (fun (next : Option ℕ) (g' : Cell → ℕ) (x : ℕ) => next = none ∨ ∃ (p : Fin n) (ts' : List (WordRAM.FibonacciHeap.FHTree n)), next = some ↑p ∧ Cascading n K s (view n g') v m (some p) ts' ∧ (∃ T ∈ ts', T.root = v) ∧ (∀ T ∈ ts', p ∈ T.nodes → T.root ≠ v) ∧ p ∈ WordRAM.FibonacciHeap.forestNodes ts' ∧ (view n g').numMarked < (view n g).numMarked) g

A continuing original cascade step has a typed parent in the updated forest and strictly fewer marked nodes. Stopping branches require no continuing forest witness. This is the source progress fact used to justify native while nontruncation.

theorem Cslib.DataStructure.PriorityQueue.FibonacciHeap.Native.cutSafe_of_cascading {n K w base : ℕ} {s : IndexedMinPQ.State n} {mem : Memory.State} {v m cur p : Fin n} {pending : Option (Fin n)} {ts : List (WordRAM.FibonacciHeap.FHTree n)} (hfit : WordRAM.Fits w (base + (9 * n + 5))) (halloc : (layout n base).Inv mem) (h : Cascading n K s (view n ((layout n base).abs mem)) v m pending ts) (hcur : cur ∈ WordRAM.FibonacciHeap.forestNodes ts) (hpar : (view n ((layout n base).abs mem)).par cur = ↑p + 1) :
cutSafe w ![n, base, ↑cur, ↑p] mem

The original Cascading forest supplies every cut domain, including the mark/count subtraction after the actual unlink run. The lower refinement transports the source record facts to literal memory addresses; the full heap invariant need not hold between the blocks.