Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Fibonacci Dijkstra: correctness and running time of every completed output

Proved
FibonacciDijkstraAnalysis.output_with_cost_correct

by lunjia · Oct 11, 2026 · Mathlib 0df444a (Lean v4.33.1)

algo2leanalgorithmsclrsdata-structuresrunning-timetextbook

This result is part of the Algo2Lean formalization series for Introduction to Algorithms (CLRS), fourth edition.

For a represented directed graph with nonnegative integer weights and an in-range source, every dijkstra_fibonacci.ReturnsWithCost output records the shortest distances and satisfies

T≤23(E+1)+(12(2⌊log⁡2V⌋+2)+3)V.T\leq 23(E+1)+\bigl(12(2\lfloor\log_2 V\rfloor+2)+3\bigr)V.T≤23(E+1)+(12(2⌊log2​V⌋+2)+3)V.

V is the vertex count, E is the number of adjacency entries, and T sums the thirteen chosen source-clock increments. Unreachable vertices have distance -1. This is the ordinary-value view of the reusable Call theorem; it does not duplicate the algorithm or heap proof. CLRS fourth edition, §22.3, Theorem 22.6 supplies the textbook correctness reference.

<!-- algo2lean-provenance-v0.1.4 -->

Algo2Lean provenance and reproduction. These definitions target Algo2Lean v0.1.4, using the compiler source at public commit 0f79d5e4242e6477531c9ee4410409f5b1c92f76, and Lean 4.33.1. The versioned compiler location is Algo2Lean v0.1.4. Compile all supplied .algo files and imports to reproduce the raw generated definitions. Release publication and exact website parity require their separately recorded checks; this metadata alone does not assert them. Prove2Me imports and declaration packaging are mechanically adapted, with original hashes, compiler-reported source ranges, and adaptations recorded in transplant provenance. Exact reproduction does not prove the compiler correct.

Preamble
import Definitions.Def_Algo_dijkstra_dijkstra_fibonacci_Analysis
import Theorems.Thm_FibonacciDijkstraAnalysis_summary

set_option autoImplicit true
set_option backward.isDefEq.respectTransparency false
set_option backward.defeqAttrib.useBackward true

set_option autoImplicit false
Formal statement
theorem FibonacciDijkstraAnalysis.output_with_cost_correct :
    ∀ (heap : Algo2LeanGenerated.Heap) (graph : Algo.graph.Algo2LeanGenerated.Ref_Graph)
      (size source : Int) (heads : Algo2LeanGenerated.CollectionRef)
      (adjacency : Algo2Lean.Dijkstra.Adjacency) (output : Algo2LeanGenerated.Seq)
      (costs : Algo2LeanGenerated.Clocks),
      ComposableDijkstraAnalysis.GraphRep heap graph size heads adjacency →
        LE.le.{0} (0 : Int) source →
          LT.lt.{0} source size →
            Algo.dijkstra.dijkstra_fibonacci.dijkstra_fibonacci.ReturnsWithCost
                (Prod.mk.{0, 0} heap (Prod.mk.{0, 0} graph source)) output costs →
              Algo2Lean.Dijkstra.ShortestDistances (Algo2Lean.Dijkstra.representedEdges size adjacency)
                  source output ∧
                LE.le.{0} (FibonacciDijkstraAnalysis.clockWork costs)
                  (FibonacciDijkstraAnalysis.runtimeBound size adjacency) := by
  sorry
Source
https://github.com/lunjiah/algo2lean/blob/0f79d5e4242e6477531c9ee4410409f5b1c92f76/examples/analysis/dijkstra/dijkstra_fibonacci.lean#L201-L215
Human review
  • Endorsed by Shuze Chen · Oct 11, 2026

    Confirmed by the moderator at approval.

  • Endorsed by lunjia · Oct 11, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me