Documentation

CslibFrontier.Algorithms.Lean.Dijkstra.Native.Fibonacci.Memory

The existing Dijkstra client over the framed Fibonacci heap #

The existing indexed queue, distance table and adjacency arrays share one memory through Memory.Framed.prod. Initialization reserves the original heap's 9 n + 5 cells without clearing them: the actual input convention supplies zero memory beyond its frontier. The heap's nonzero potential is retained in the composite amortized certificate.

These are source and memory-cost results. The native caller separately charges register arithmetic, argument delivery, loop control, its initialized prefix and final halt.

Main definitions #

Main results #

Interpret the existing indexed Fibonacci methods through their existing record layout.

The original three Dijkstra interfaces over one shared memory.

The heap, distance table and immutable graph, composed through the existing framed product.

The product uses exactly the original linked method table.

theorem Cslib.Algorithms.Lean.Dijkstra.Native.Fibonacci.methods_eq (n K V w K' V' w' base : ℕ) (T : WordRAM.Block) (A : DataStructure.AdjacencyList.Memory.Layout) :
methods n K V w base T A = methods n K' V' w' base T A

Bounds and handler width restrict validity, without changing any source method.

Composite charges: the original Fibonacci amortized charge, one unit per table query and three units per graph query.

The heap's original nonzero potential telescopes across both other disjoint structures.

Read the unchanged graph header, reserve the distance table and original Fibonacci layout in the input's zero tail, and run the existing early-exit Dijkstra client.

theorem Cslib.Algorithms.Lean.Dijkstra.Native.Fibonacci.inv_input (G : Dijkstra.ListInstance) {w K V : ℕ} (hn : WordRAM.Fits w G.n) (hK : WordRAM.Fits w K) (hT : DataStructure.Dictionary.Memory.Valid { base := (DataStructure.Memory.State.init G.encode).frontier, length := G.n } w G.n V) (hA : (Memory.inputGraph G.n G.m).Valid G.n) (hfit : WordRAM.Fits w ((DataStructure.Memory.State.init G.encode).frontier + G.n + (9 * G.n + 5))) :
have s₀ := DataStructure.Memory.State.init G.encode; have s' := { mem := s₀.mem, frontier := s₀.frontier + G.n + (9 * G.n + 5) }; (framed hn hK (s₀.frontier + G.n) hT hA G.adj).inv s' ∧ (framed hn hK (s₀.frontier + G.n) hT hA G.adj).abs s' = init G

Dirty reservations after the original input establish the exact empty-queue, empty-table and graph state, without a clearing loop or an extra zero-memory premise.