Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Algo.dijkstra.priority_queue.Generated definitions

Definition
Algo_dijkstra_priority_queue_Generated

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

algo2leanalgorithmsclrsdata-structuresrunning-timetextbook

Definitions and required structural lemmas from Algo.dijkstra.priority_queue.Generated. 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_Algo2LeanLib_Modules
import Definitions.Def_Algo2LeanLib_Interface

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

namespace Algo.«dijkstra».«priority_queue»

open _root_.Algo2LeanGenerated

-- Independently compiled module; imported algorithms keep their own transitions.
namespace «PriorityQueue»

inductive Result where
  | fn_PriorityQueue_push_or_decrease (value : Unit)
  | fn_PriorityQueue_pop_min (value : Int)
  | fn_PriorityQueue_is_empty (value : Bool)

/-- Executable method entries; behavior and cost laws are separate assumptions. -/
structure Code extends Algo2LeanCore.InterfaceCode Heap Result where
  valid : Heap → ObjectRef → Bool
  entry_PriorityQueue_push_or_decrease : ObjectRef × Int × Int → Frame
  entry_PriorityQueue_pop_min : ObjectRef → Frame
  entry_PriorityQueue_is_empty : ObjectRef → Frame

/-- The supplied code executes this operation with the stated heap effects. -/
def push_or_decrease.Call (code : Code) (before : Heap) (input : ObjectRef × Int × Int)
    (after : Heap) (output : Unit) : Prop :=
  code.valid before input.1 = true ∧
    Algo2LeanCore.Summary code.Step before (code.entry_PriorityQueue_push_or_decrease input) after (.fn_PriorityQueue_push_or_decrease output)

/-- The supplied code executes this operation with the stated heap effects. -/
def pop_min.Call (code : Code) (before : Heap) (input : ObjectRef)
    (after : Heap) (output : Int) : Prop :=
  code.valid before input = true ∧
    Algo2LeanCore.Summary code.Step before (code.entry_PriorityQueue_pop_min input) after (.fn_PriorityQueue_pop_min output)

/-- The supplied code executes this operation with the stated heap effects. -/
def is_empty.Call (code : Code) (before : Heap) (input : ObjectRef)
    (after : Heap) (output : Bool) : Prop :=
  code.valid before input = true ∧
    Algo2LeanCore.Summary code.Step before (code.entry_PriorityQueue_is_empty input) after (.fn_PriorityQueue_is_empty output)

end «PriorityQueue»

namespace Algo2LeanGenerated

abbrev Ref_PriorityQueue := ObjectRef

inductive Frame where
  | invalid

inductive Result where
  | unused

abbrev Configuration := Algo2LeanCore.Config Heap (Frame) Result
abbrev Stack := Algo2LeanCore.Stack (Frame) Result
abbrev Transcript := List (Configuration)

inductive Step : Configuration → Configuration → Prop where

theorem terminal (h : Heap) (result : Result) :
    Algo2LeanCore.Terminal Step (.done h result) := by
  intro next transition
  cases transition

end Algo2LeanGenerated

open Algo2LeanGenerated

end Algo.«dijkstra».«priority_queue»
Source
https://github.com/lunjiah/algo2lean/blob/0f79d5e4242e6477531c9ee4410409f5b1c92f76/examples/dijkstra/priority_queue.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