Documentation

CslibFrontier.Algorithms.Lean.Dijkstra.Native.Common

Shared native IndexedMinPQ realization kernel for Dijkstra's algorithm #

Both the binary-heap and Fibonacci-heap native Dijkstra endpoints execute the exact same word-level relaxation (relaxTarget, relaxWord), out-edge scan (scanWord), early-exit main loop (loopWord), and header/allocation entry (runWord) from Dijkstra.Native.Word. They differ only in the priority queue's runtime register layout, framed memory refinement, dirty allocator, and uniform Realizes certificates for insert, decreaseKey and erased extractMin.

NativeMethods packages a priority queue's explicit register layout encoding handleWords : Handle ↪ (Fin width → ℕ), framed refinement framed, and method certificates, without hidden WordEncoding defaults or fixed-width specialization. Its per-stage argument bundles (UpdateArgs, TargetData, RelaxData, ScanData, StepData) are named structures encoded with word_enc_structure. NativeAllocator extends NativeMethods with a dirty reservation primitive in the graph input's zero tail to yield realizes_runWord.

Main definitions #

Main results #

word_enc_structure argument records #

Vertex handle word and tentative distance key passed to insert or decreaseKey.

  • vertex : ℕ

    Target vertex index.

  • key : ℕ

    Tentative distance key.

@[reducible, inline]

The tuple word encoding of the fields of updateArgsWords.

Distance table, target vertex, source distance and edge weight for relaxTarget.

  • Direct-address tentative-distance table.

  • vertex : ℕ

    Target vertex index.

  • dist : ℕ

    Distance of the current source vertex.

  • weight : ℕ

    Edge weight.

theorem Cslib.Algorithms.Lean.Dijkstra.Native.targetDataWords_fits {w : ℕ} {a : TargetData} (h_table : ∀ (j : Fin 2), WordRAM.Fits w (WordRAM.Realization.blockWords a.table j)) (h_vertex : WordRAM.Fits w a.vertex) (h_dist : WordRAM.Fits w a.dist) (h_weight : WordRAM.Fits w a.weight) (j✝ : Fin 5) :
@[reducible, inline]

The tuple word encoding of the fields of targetDataWords.

Table, graph dimensions and edge coordinates for relaxWord.

  • Direct-address tentative-distance table.

  • n : ℕ

    Vertex count of the input graph.

  • m : ℕ

    Edge count of the input graph.

  • vertex : ℕ

    Source vertex index.

  • dist : ℕ

    Distance of vertex.

  • edge : ℕ

    Outgoing edge offset index from vertex.

@[reducible, inline]

The tuple word encoding of the fields of relaxDataWords.

theorem Cslib.Algorithms.Lean.Dijkstra.Native.relaxDataWords_fits {w : ℕ} {a : RelaxData} (h_table : ∀ (j : Fin 2), WordRAM.Fits w (WordRAM.Realization.blockWords a.table j)) (h_n : WordRAM.Fits w a.n) (h_m : WordRAM.Fits w a.m) (h_vertex : WordRAM.Fits w a.vertex) (h_dist : WordRAM.Fits w a.dist) (h_edge : WordRAM.Fits w a.edge) (j✝ : Fin 7) :

Table, graph dimensions and extracted vertex/distance for scanWord.

  • Direct-address tentative-distance table.

  • n : ℕ

    Vertex count of the input graph.

  • m : ℕ

    Edge count of the input graph.

  • vertex : ℕ

    Extracted vertex index.

  • dist : ℕ

    Extracted vertex distance.

theorem Cslib.Algorithms.Lean.Dijkstra.Native.scanDataWords_fits {w : ℕ} {a : ScanData} (h_table : ∀ (j : Fin 2), WordRAM.Fits w (WordRAM.Realization.blockWords a.table j)) (h_n : WordRAM.Fits w a.n) (h_m : WordRAM.Fits w a.m) (h_vertex : WordRAM.Fits w a.vertex) (h_dist : WordRAM.Fits w a.dist) (j✝ : Fin 6) :
@[reducible, inline]

The tuple word encoding of the fields of scanDataWords.

Table, graph dimensions and remaining round budget for loopWord.

  • Direct-address tentative-distance table.

  • n : ℕ

    Vertex count of the input graph.

  • m : ℕ

    Edge count of the input graph.

  • rounds : ℕ

    Remaining extraction rounds.

@[reducible, inline]

The tuple word encoding of the fields of stepDataWords.

theorem Cslib.Algorithms.Lean.Dijkstra.Native.stepDataWords_fits {w : ℕ} {a : StepData} (h_table : ∀ (j : Fin 2), WordRAM.Fits w (WordRAM.Realization.blockWords a.table j)) (h_n : WordRAM.Fits w a.n) (h_m : WordRAM.Fits w a.m) (h_rounds : WordRAM.Fits w a.rounds) (j✝ : Fin 5) :

Left-handle polymorphic realization combinators #

NativeMethods: shared realization of relaxTarget, relaxWord, scanWord, loopWord #

A uniform native IndexedMinPQ method family over Memory.Prog for Dijkstra's algorithm, parameterized by an explicit register layout encoding handleWords, static validity Valid, a framed memory refinement framed, and zero-local-work Realizes certificates for insert, decreaseKey, and handle-erased extractMin.

Composite framed refinement of Dijkstra.spec pairing M.framed hV with the direct-address distance table T and immutable adjacency arrays A.

NativeAllocator: shared realization of runWord #

Dirty-allocation extension of NativeMethods for Dijkstra.Native.runWord on the standard graph input encoding ListInstance.encode.