Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Algo.dijkstra.dijkstra_fibonacci.Facts definitions

Definition
Algo_dijkstra_dijkstra_fibonacci_Facts

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

algo2leanalgorithmsclrsdata-structuresrunning-timetextbook

Definitions and required structural lemmas from Algo.dijkstra.dijkstra_fibonacci.Facts. Source declarations are retained by compiler-reported ranges; imports are redirected to the corresponding definition bundles. This bundle contains no theorem stubs.

<!-- 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.

Definition code
import Definitions.Def_Algo_dijkstra_dijkstra_fibonacci_Generated
import Definitions.Def_Algo_fibonacci_heap_Facts
import Definitions.Def_Algo_dijkstra_dijkstra_Facts

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


-- Generated by Algo2Lean 0.1.4 https://github.com/lunjiah/algo2lean

-- Optional proof certificate; execution remains the generated Step relation.
namespace «Algo».«dijkstra».«dijkstra_fibonacci»

open Algo2LeanCore _root_.Algo2LeanGenerated

def FibonacciHeap_as_PriorityQueue_facts : Algo2LeanCore.InterfaceFacts FibonacciHeap_as_PriorityQueue.toInterfaceCode :=
  Algo2LeanCore.InterfaceAdapter.facts Algo.«fibonacci_heap».Algo2LeanGenerated.next Algo.«fibonacci_heap».Algo2LeanGenerated.step_next


def use_dijkstra_dijkstra_0_facts : Algo.«dijkstra».«dijkstra».DependencyFacts use_dijkstra_dijkstra_0 where
  «PriorityQueue» := FibonacciHeap_as_PriorityQueue_facts

namespace Algo2LeanGenerated

private def next_dijkstra_fibonacci (h : Heap) (s : State_dijkstra_fibonacci) (stack : Stack) : Nat → Configuration
  | 1 => (Algo2LeanCore.resumeConfig h (Result.fn_dijkstra_fibonacci (s.t5)) stack)
  | 2 => (.active h (Frame.import_3_use_dijkstra_dijkstra_0 (Algo.«dijkstra».«dijkstra».entry_dijkstra use_dijkstra_dijkstra_0 (s.t6, s.t7, s.t8, s.t9, s.t10)) [] (fun value => match value with | .fn_dijkstra result => (Frame.fn_dijkstra_fibonacci 1 { s with t5 := result }) | _ => .invalid)) stack)
  | 3 => (.active h (Frame.fn_dijkstra_fibonacci 2 { s with t10 := s.v3 }) stack)
  | 4 => (.active h (Frame.fn_dijkstra_fibonacci 3 { s with t9 := s.v2 }) stack)
  | 5 => (.active h (Frame.fn_dijkstra_fibonacci 4 { s with t8 := s.v4 }) stack)
  | 6 => (.active h (Frame.fn_dijkstra_fibonacci 5 { s with t7 := s.v1 }) stack)
  | 7 => (.active h (Frame.fn_dijkstra_fibonacci 6 { s with t6 := s.v0 }) stack)
  | 8 => (.active h (Frame.fn_dijkstra_fibonacci 7 { s with v4 := s.t11 }) stack)
  | 9 => (.active h (Frame.import_1 (Algo.«fibonacci_heap».entry_FibonacciHeap ()) [] (fun value => match value with | .fn_FibonacciHeap result => (Frame.fn_dijkstra_fibonacci 8 { s with t11 := result }) | _ => .invalid)) stack)
  | 10 => (.active h (Frame.fn_dijkstra_fibonacci 9 { s with v3 := s.t12 }) stack)
  | 11 => (.active (h.allocate (fun _ => s.t13)) (Frame.fn_dijkstra_fibonacci 10 { s with t12 := h.nextRef }) stack)
  | 12 => (.active h (Frame.fn_dijkstra_fibonacci 11 { s with t13 := (0 : Int) }) stack)
  | 13 => (Algo2LeanCore.resumeConfig h (Result.fn_dijkstra_fibonacci (s.t15)) stack)
  | 14 => (.active h (Frame.fn_dijkstra_fibonacci 13 { s with t15 := s.v2 }) stack)
  | 15 => if s.t14 then (.active h (Frame.fn_dijkstra_fibonacci 14 s) stack) else (.active h (Frame.fn_dijkstra_fibonacci 12 s) stack)
  | 16 => (.active h (Frame.fn_dijkstra_fibonacci 15 { s with t14 := ((decide ((s.v1 < (0 : Int)))) || (decide ((s.v1 ≥ ((field__a2l_import_0_Graph_size h (s.v0)).getD 0))))) }) stack)
  | 17 => (.active h (Frame.fn_dijkstra_fibonacci 16 { s with v2 := s.t16 }) stack)
  | 18 => (.active (h.allocate (fun _ => s.t17)) (Frame.fn_dijkstra_fibonacci 17 { s with t16 := h.nextRef }) stack)
  | 19 => (.active h (Frame.fn_dijkstra_fibonacci 18 { s with t17 := (-(1 : Int)) }) stack)
  | pc => .active h (.fn_dijkstra_fibonacci pc s) stack

/-- A total projection used only to certify uniqueness of actual transitions. -/
def next : Configuration → Configuration
  | .done h result => .done h result
  | .active h frame stack => match frame with
    | .invalid => .active h .invalid stack
    | .fn_dijkstra_fibonacci pc s => next_dijkstra_fibonacci h s stack pc
    | .import_1 frame inner resume =>
      ModuleCall.config Frame.import_1 resume stack (Algo.«fibonacci_heap».Algo2LeanGenerated.next (.active h frame inner))
    | .import_3_use_dijkstra_dijkstra_0 frame inner resume =>
      ModuleCall.config Frame.import_3_use_dijkstra_dijkstra_0 resume stack ((Algo.«dijkstra».«dijkstra».Algo2LeanGenerated.next use_dijkstra_dijkstra_0 use_dijkstra_dijkstra_0_facts) (.active h frame inner))

/-- Each generated rule agrees with the projection; guards remain in Step. -/
theorem step_next {before after : Configuration} (transition : Step before after) :
    next before = after := by
  cases transition with
  | dijkstra_fibonacci_pc1 h s stack defined => rfl
  | dijkstra_fibonacci_pc2 h s stack => rfl
  | dijkstra_fibonacci_pc3 h s stack => rfl
  | dijkstra_fibonacci_pc4 h s stack => rfl
  | dijkstra_fibonacci_pc5 h s stack => rfl
  | dijkstra_fibonacci_pc6 h s stack => rfl
  | dijkstra_fibonacci_pc7 h s stack => rfl
  | dijkstra_fibonacci_pc8 h s stack => rfl
  | dijkstra_fibonacci_pc9 h s stack => rfl
  | dijkstra_fibonacci_pc10 h s stack => rfl
  | dijkstra_fibonacci_pc11 h s stack => rfl
  | dijkstra_fibonacci_pc12 h s stack => rfl
  | dijkstra_fibonacci_pc13 h s stack defined => rfl
  | dijkstra_fibonacci_pc14 h s stack => rfl
  | dijkstra_fibonacci_pc15_true h s stack condition => simp [next, next_dijkstra_fibonacci, condition]
  | dijkstra_fibonacci_pc15_false h s stack condition => simp [next, next_dijkstra_fibonacci, condition]
  | dijkstra_fibonacci_pc16 h s stack defined => rfl
  | dijkstra_fibonacci_pc17 h s stack => rfl
  | dijkstra_fibonacci_pc18 h s stack => rfl
  | dijkstra_fibonacci_pc19 h s stack => rfl
  | import_1 h frame inner resume caller after transition =>
    exact congrArg (ModuleCall.config Frame.import_1 resume caller) (Algo.«fibonacci_heap».Algo2LeanGenerated.step_next transition)
  | import_3_use_dijkstra_dijkstra_0 h frame inner resume caller after transition =>
    exact congrArg (ModuleCall.config Frame.import_3_use_dijkstra_dijkstra_0 resume caller) ((Algo.«dijkstra».«dijkstra».Algo2LeanGenerated.step_next use_dijkstra_dijkstra_0 use_dijkstra_dijkstra_0_facts) transition)

/-- Imported determinism composes without reopening imported transition rules. -/
theorem deterministic : Deterministic Step := by
  intro before left right first second
  exact (step_next first).symm.trans (step_next second)

end Algo2LeanGenerated

end «Algo».«dijkstra».«dijkstra_fibonacci»

namespace Algo.«dijkstra».«dijkstra_fibonacci»

open Algo2LeanCore _root_.Algo2LeanGenerated Algo2LeanGenerated

theorem dijkstra_fibonacci.Run.eq_of_call {before after expectedHeap input output expected}
    (run : _root_.Algo.«dijkstra».«dijkstra_fibonacci».dijkstra_fibonacci.Run before input after output)
    (call : _root_.Algo.«dijkstra».«dijkstra_fibonacci».dijkstra_fibonacci.Call before input expectedHeap expected) :
    after = expectedHeap ∧ output = expected := by
  have same := Reaches.eq_of_terminal (step := Step) deterministic
    run.2 call.2.root (terminal _ _) (terminal _ _)
  cases same
  exact ⟨rfl, rfl⟩

end Algo.«dijkstra».«dijkstra_fibonacci»
Source
https://github.com/lunjiah/algo2lean/blob/0f79d5e4242e6477531c9ee4410409f5b1c92f76/examples/dijkstra/dijkstra_fibonacci.algo

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