Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Indexed binary min-heap: generated algorithm definition

Definition
Algo_indexed_heap_Generated

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

algo2leanalgorithmsclrsdata-structuresrunning-timetextbook

The compiled semantics of indexed_heap.algo in the examples/kruskal import root. This bundle contains source-function frames, transition rules and the stable public call/run/output interfaces. Imported modules are linked through the shared execution semantics, including mutable aliases and named tick increments.

These are the algorithm definitions proved about by the corresponding analysis nodes. Named-line observations are in a separate Points bundle, so editing labels does not change the main algorithm statement. The reproduction target is Algo2Lean v0.1.4; raw generated files and platform-adapted packaging are tracked separately, and release/source links must be finalized before submission.

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

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.«indexed_heap»

open _root_.Algo2LeanGenerated

-- Independently compiled module; imported algorithms keep their own transitions.
namespace Algo2LeanGenerated

abbrev Ref_MinHeap := ObjectRef

-- Shallow class membership; fields and referenced objects are observed separately.
def is_MinHeap (h : Heap) (ref : Ref_MinHeap) : Prop :=
  ref < h.nextObject ∧ h.objectClass ref = some "indexed_heap.MinHeap"
instance (h : Heap) (ref : Ref_MinHeap) : Decidable (is_MinHeap h ref) :=
  inferInstanceAs (Decidable (ref < h.nextObject ∧ h.objectClass ref = some "indexed_heap.MinHeap"))

def field_MinHeap_vertices (h : Heap) (ref : Ref_MinHeap) : Option SeqRef :=
  if is_MinHeap h ref then (h.readField ref "vertices").bind ObjectValue.asSeq else none
def set_MinHeap_vertices (h : Heap) (ref : Ref_MinHeap) (value : SeqRef) : Heap :=
  h.writeField ref "vertices" (ObjectValue.seqValue value)
@[simp] theorem field_MinHeap_vertices_set (h : Heap) (ref : Ref_MinHeap) (value : SeqRef)
    (valid : is_MinHeap h ref) :
    field_MinHeap_vertices (set_MinHeap_vertices h ref value) ref = some value := by
  have valid' : is_MinHeap (set_MinHeap_vertices h ref value) ref := by
    simpa [set_MinHeap_vertices, is_MinHeap] using valid
  rw [field_MinHeap_vertices, if_pos valid']
  unfold set_MinHeap_vertices
  rw [Heap.readField_writeField_same h ref "vertices" _ "indexed_heap.MinHeap" valid.2]
  rfl

def field_MinHeap_positions (h : Heap) (ref : Ref_MinHeap) : Option SeqRef :=
  if is_MinHeap h ref then (h.readField ref "positions").bind ObjectValue.asSeq else none
def set_MinHeap_positions (h : Heap) (ref : Ref_MinHeap) (value : SeqRef) : Heap :=
  h.writeField ref "positions" (ObjectValue.seqValue value)
@[simp] theorem field_MinHeap_positions_set (h : Heap) (ref : Ref_MinHeap) (value : SeqRef)
    (valid : is_MinHeap h ref) :
    field_MinHeap_positions (set_MinHeap_positions h ref value) ref = some value := by
  have valid' : is_MinHeap (set_MinHeap_positions h ref value) ref := by
    simpa [set_MinHeap_positions, is_MinHeap] using valid
  rw [field_MinHeap_positions, if_pos valid']
  unfold set_MinHeap_positions
  rw [Heap.readField_writeField_same h ref "positions" _ "indexed_heap.MinHeap" valid.2]
  rfl

def field_MinHeap_keys (h : Heap) (ref : Ref_MinHeap) : Option SeqRef :=
  if is_MinHeap h ref then (h.readField ref "keys").bind ObjectValue.asSeq else none
def set_MinHeap_keys (h : Heap) (ref : Ref_MinHeap) (value : SeqRef) : Heap :=
  h.writeField ref "keys" (ObjectValue.seqValue value)
@[simp] theorem field_MinHeap_keys_set (h : Heap) (ref : Ref_MinHeap) (value : SeqRef)
    (valid : is_MinHeap h ref) :
    field_MinHeap_keys (set_MinHeap_keys h ref value) ref = some value := by
  have valid' : is_MinHeap (set_MinHeap_keys h ref value) ref := by
    simpa [set_MinHeap_keys, is_MinHeap] using valid
  rw [field_MinHeap_keys, if_pos valid']
  unfold set_MinHeap_keys
  rw [Heap.readField_writeField_same h ref "keys" _ "indexed_heap.MinHeap" valid.2]
  rfl

def field_MinHeap_size (h : Heap) (ref : Ref_MinHeap) : Option Int :=
  if is_MinHeap h ref then (h.readField ref "size").bind ObjectValue.asInt else none
def set_MinHeap_size (h : Heap) (ref : Ref_MinHeap) (value : Int) : Heap :=
  h.writeField ref "size" (ObjectValue.intValue value)
@[simp] theorem field_MinHeap_size_set (h : Heap) (ref : Ref_MinHeap) (value : Int)
    (valid : is_MinHeap h ref) :
    field_MinHeap_size (set_MinHeap_size h ref value) ref = some value := by
  have valid' : is_MinHeap (set_MinHeap_size h ref value) ref := by
    simpa [set_MinHeap_size, is_MinHeap] using valid
  rw [field_MinHeap_size, if_pos valid']
  unfold set_MinHeap_size
  rw [Heap.readField_writeField_same h ref "size" _ "indexed_heap.MinHeap" valid.2]
  rfl

/-- Build input data directly; this helper does not execute `__init__`. -/
def create_MinHeap (h : Heap) (value_vertices : SeqRef) (value_positions : SeqRef) (value_keys : SeqRef) (value_size : Int) : Heap × Ref_MinHeap :=
  let ref := h.nextObject
  let h := h.allocateObject "indexed_heap.MinHeap"
  let h := set_MinHeap_vertices h ref value_vertices
  let h := set_MinHeap_positions h ref value_positions
  let h := set_MinHeap_keys h ref value_keys
  let h := set_MinHeap_size h ref value_size
  (h, ref)

structure State_MinHeap___init__ where
  v0 : Ref_MinHeap := 0 -- self
  t1 : Unit := () -- temporary
  t2 : SeqRef := 0 -- temporary
  t3 : Ref_MinHeap := 0 -- temporary
  t4 : Int := 0 -- temporary
  t5 : SeqRef := 0 -- temporary
  t6 : Ref_MinHeap := 0 -- temporary
  t7 : Int := 0 -- temporary
  t8 : SeqRef := 0 -- temporary
  t9 : Ref_MinHeap := 0 -- temporary
  t10 : Int := 0 -- temporary

structure State_MinHeap_swap where
  v0 : Ref_MinHeap := 0 -- self
  v1 : Int := 0 -- i
  v2 : Int := 0 -- j
  v3 : Int := 0 -- a
  v4 : Int := 0 -- b
  t5 : Unit := () -- temporary

structure State_MinHeap_sift_up where
  v0 : Ref_MinHeap := 0 -- self
  v1 : Int := 0 -- i
  v2 : Int := 0 -- parent
  t3 : Unit := () -- temporary
  t4 : Bool := false -- temporary
  t5 : Unit := () -- temporary
  t6 : Ref_MinHeap := 0 -- temporary
  t7 : Int := 0 -- temporary
  t8 : Int := 0 -- temporary
  t9 : Bool := false -- temporary
  t10 : Unit := () -- temporary

structure State_MinHeap_sift_down where
  v0 : Ref_MinHeap := 0 -- self
  v1 : Int := 0 -- i
  v2 : Int := 0 -- child
  v3 : Int := 0 -- right
  t4 : Unit := () -- temporary
  t5 : Bool := false -- temporary
  t6 : Unit := () -- temporary
  t7 : Ref_MinHeap := 0 -- temporary
  t8 : Int := 0 -- temporary
  t9 : Int := 0 -- temporary
  t10 : Bool := false -- temporary
  t11 : Unit := () -- temporary
  t12 : Bool := false -- temporary
  t13 : Bool := false -- temporary

structure State_MinHeap_push_or_decrease where
  v0 : Ref_MinHeap := 0 -- self
  v1 : Int := 0 -- vertex
  v2 : Int := 0 -- key
  v3 : Int := 0 -- i
  t4 : Unit := () -- temporary
  t5 : Bool := false -- temporary
  t6 : Unit := () -- temporary
  t7 : Ref_MinHeap := 0 -- temporary
  t8 : Int := 0 -- temporary
  t9 : Ref_MinHeap := 0 -- temporary
  t10 : Int := 0 -- temporary
  t11 : Int := 0 -- temporary
  t12 : Bool := false -- temporary
  t13 : Unit := () -- temporary
  t14 : Ref_MinHeap := 0 -- temporary
  t15 : Int := 0 -- temporary

structure State_MinHeap_pop_min where
  v0 : Ref_MinHeap := 0 -- self
  v1 : Int := 0 -- vertex
  v2 : Int := 0 -- last
  t3 : Int := 0 -- temporary
  t4 : Bool := false -- temporary
  t5 : Unit := () -- temporary
  t6 : Ref_MinHeap := 0 -- temporary
  t7 : Int := 0 -- temporary
  t8 : Unit := () -- temporary
  t9 : Ref_MinHeap := 0 -- temporary
  t10 : Int := 0 -- temporary
  t11 : Int := 0 -- temporary
  t12 : Bool := false -- temporary
  t13 : Int := 0 -- temporary

structure State_MinHeap_is_empty where
  v0 : Ref_MinHeap := 0 -- self
  t1 : Bool := false -- temporary

structure State_MinHeap where
  v0 : Ref_MinHeap := 0 -- _instance
  t1 : Ref_MinHeap := 0 -- temporary
  t2 : Unit := () -- temporary
  t3 : Ref_MinHeap := 0 -- temporary
  t4 : Ref_MinHeap := 0 -- temporary

inductive Frame where
  | invalid
  | fn_MinHeap___init__ (pc : Nat) (state : State_MinHeap___init__)
  | fn_MinHeap_swap (pc : Nat) (state : State_MinHeap_swap)
  | fn_MinHeap_sift_up (pc : Nat) (state : State_MinHeap_sift_up)
  | fn_MinHeap_sift_down (pc : Nat) (state : State_MinHeap_sift_down)
  | fn_MinHeap_push_or_decrease (pc : Nat) (state : State_MinHeap_push_or_decrease)
  | fn_MinHeap_pop_min (pc : Nat) (state : State_MinHeap_pop_min)
  | fn_MinHeap_is_empty (pc : Nat) (state : State_MinHeap_is_empty)
  | fn_MinHeap (pc : Nat) (state : State_MinHeap)

inductive Result where
  | fn_MinHeap___init__ (value : Unit)
  | fn_MinHeap_swap (value : Unit)
  | fn_MinHeap_sift_up (value : Unit)
  | fn_MinHeap_sift_down (value : Unit)
  | fn_MinHeap_push_or_decrease (value : Unit)
  | fn_MinHeap_pop_min (value : Int)
  | fn_MinHeap_is_empty (value : Bool)
  | fn_MinHeap (value : Ref_MinHeap)

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

inductive Step : Configuration → Configuration → Prop where
  | MinHeap___init___pc1 (h : Heap) (s : State_MinHeap___init__) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap___init__ 1 s) stack) (Algo2LeanCore.resumeConfig h (Result.fn_MinHeap___init__ (s.t1)) stack)
  | MinHeap___init___pc2 (h : Heap) (s : State_MinHeap___init__) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap___init__ 2 s) stack) (.active h (Frame.fn_MinHeap___init__ 1 { s with t1 := () }) stack)
  | MinHeap___init___pc3 (h : Heap) (s : State_MinHeap___init__) (stack : Stack) (defined : (is_MinHeap h (s.v0))) :
      Step (.active h (Frame.fn_MinHeap___init__ 3 s) stack) (.active (set_MinHeap_size h (s.v0) ((0 : Int))) (Frame.fn_MinHeap___init__ 2 s) stack)
  | MinHeap___init___pc4 (h : Heap) (s : State_MinHeap___init__) (stack : Stack) (defined : (is_MinHeap h (s.t3))) :
      Step (.active h (Frame.fn_MinHeap___init__ 4 s) stack) (.active (set_MinHeap_keys h (s.t3) (s.t2)) (Frame.fn_MinHeap___init__ 3 s) stack)
  | MinHeap___init___pc5 (h : Heap) (s : State_MinHeap___init__) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap___init__ 5 s) stack) (.active h (Frame.fn_MinHeap___init__ 4 { s with t3 := s.v0 }) stack)
  | MinHeap___init___pc6 (h : Heap) (s : State_MinHeap___init__) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap___init__ 6 s) stack) (.active (h.allocate (fun _ => s.t4)) (Frame.fn_MinHeap___init__ 5 { s with t2 := h.nextRef }) stack)
  | MinHeap___init___pc7 (h : Heap) (s : State_MinHeap___init__) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap___init__ 7 s) stack) (.active h (Frame.fn_MinHeap___init__ 6 { s with t4 := (0 : Int) }) stack)
  | MinHeap___init___pc8 (h : Heap) (s : State_MinHeap___init__) (stack : Stack) (defined : (is_MinHeap h (s.t6))) :
      Step (.active h (Frame.fn_MinHeap___init__ 8 s) stack) (.active (set_MinHeap_positions h (s.t6) (s.t5)) (Frame.fn_MinHeap___init__ 7 s) stack)
  | MinHeap___init___pc9 (h : Heap) (s : State_MinHeap___init__) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap___init__ 9 s) stack) (.active h (Frame.fn_MinHeap___init__ 8 { s with t6 := s.v0 }) stack)
  | MinHeap___init___pc10 (h : Heap) (s : State_MinHeap___init__) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap___init__ 10 s) stack) (.active (h.allocate (fun _ => s.t7)) (Frame.fn_MinHeap___init__ 9 { s with t5 := h.nextRef }) stack)
  | MinHeap___init___pc11 (h : Heap) (s : State_MinHeap___init__) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap___init__ 11 s) stack) (.active h (Frame.fn_MinHeap___init__ 10 { s with t7 := (-(1 : Int)) }) stack)
  | MinHeap___init___pc12 (h : Heap) (s : State_MinHeap___init__) (stack : Stack) (defined : (is_MinHeap h (s.t9))) :
      Step (.active h (Frame.fn_MinHeap___init__ 12 s) stack) (.active (set_MinHeap_vertices h (s.t9) (s.t8)) (Frame.fn_MinHeap___init__ 11 s) stack)
  | MinHeap___init___pc13 (h : Heap) (s : State_MinHeap___init__) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap___init__ 13 s) stack) (.active h (Frame.fn_MinHeap___init__ 12 { s with t9 := s.v0 }) stack)
  | MinHeap___init___pc14 (h : Heap) (s : State_MinHeap___init__) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap___init__ 14 s) stack) (.active (h.allocate (fun _ => s.t10)) (Frame.fn_MinHeap___init__ 13 { s with t8 := h.nextRef }) stack)
  | MinHeap___init___pc15 (h : Heap) (s : State_MinHeap___init__) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap___init__ 15 s) stack) (.active h (Frame.fn_MinHeap___init__ 14 { s with t10 := (0 : Int) }) stack)
  | MinHeap_swap_pc1 (h : Heap) (s : State_MinHeap_swap) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_swap 1 s) stack) (Algo2LeanCore.resumeConfig h (Result.fn_MinHeap_swap (s.t5)) stack)
  | MinHeap_swap_pc2 (h : Heap) (s : State_MinHeap_swap) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_swap 2 s) stack) (.active h (Frame.fn_MinHeap_swap 1 { s with t5 := () }) stack)
  | MinHeap_swap_pc3 (h : Heap) (s : State_MinHeap_swap) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_swap 3 s) stack) (.active (h.tick "heap_swaps" 1) (Frame.fn_MinHeap_swap 2 s) stack)
  | MinHeap_swap_pc4 (h : Heap) (s : State_MinHeap_swap) (stack : Stack) (defined : (((((field_MinHeap_positions h (s.v0)).isSome = true)))) ∧ (((field_MinHeap_positions h (s.v0)).getD 0) < h.nextRef)) :
      Step (.active h (Frame.fn_MinHeap_swap 4 s) stack) (.active (h.write ((field_MinHeap_positions h (s.v0)).getD 0) s.v4 s.v1) (Frame.fn_MinHeap_swap 3 s) stack)
  | MinHeap_swap_pc5 (h : Heap) (s : State_MinHeap_swap) (stack : Stack) (defined : (((((field_MinHeap_positions h (s.v0)).isSome = true)))) ∧ (((field_MinHeap_positions h (s.v0)).getD 0) < h.nextRef)) :
      Step (.active h (Frame.fn_MinHeap_swap 5 s) stack) (.active (h.write ((field_MinHeap_positions h (s.v0)).getD 0) s.v3 s.v2) (Frame.fn_MinHeap_swap 4 s) stack)
  | MinHeap_swap_pc6 (h : Heap) (s : State_MinHeap_swap) (stack : Stack) (defined : (((((field_MinHeap_vertices h (s.v0)).isSome = true)))) ∧ (((field_MinHeap_vertices h (s.v0)).getD 0) < h.nextRef)) :
      Step (.active h (Frame.fn_MinHeap_swap 6 s) stack) (.active (h.write ((field_MinHeap_vertices h (s.v0)).getD 0) s.v2 s.v3) (Frame.fn_MinHeap_swap 5 s) stack)
  | MinHeap_swap_pc7 (h : Heap) (s : State_MinHeap_swap) (stack : Stack) (defined : (((((field_MinHeap_vertices h (s.v0)).isSome = true)))) ∧ (((field_MinHeap_vertices h (s.v0)).getD 0) < h.nextRef)) :
      Step (.active h (Frame.fn_MinHeap_swap 7 s) stack) (.active (h.write ((field_MinHeap_vertices h (s.v0)).getD 0) s.v1 s.v4) (Frame.fn_MinHeap_swap 6 s) stack)
  | MinHeap_swap_pc8 (h : Heap) (s : State_MinHeap_swap) (stack : Stack) (defined : ((((field_MinHeap_vertices h (s.v0)).isSome = true))) ∧ (((field_MinHeap_vertices h (s.v0)).getD 0) < h.nextRef)) :
      Step (.active h (Frame.fn_MinHeap_swap 8 s) stack) (.active h (Frame.fn_MinHeap_swap 7 { s with v4 := (h.read ((field_MinHeap_vertices h (s.v0)).getD 0) s.v2) }) stack)
  | MinHeap_swap_pc9 (h : Heap) (s : State_MinHeap_swap) (stack : Stack) (defined : ((((field_MinHeap_vertices h (s.v0)).isSome = true))) ∧ (((field_MinHeap_vertices h (s.v0)).getD 0) < h.nextRef)) :
      Step (.active h (Frame.fn_MinHeap_swap 9 s) stack) (.active h (Frame.fn_MinHeap_swap 8 { s with v3 := (h.read ((field_MinHeap_vertices h (s.v0)).getD 0) s.v1) }) stack)
  | MinHeap_sift_up_pc1 (h : Heap) (s : State_MinHeap_sift_up) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_sift_up 1 s) stack) (Algo2LeanCore.resumeConfig h (Result.fn_MinHeap_sift_up (s.t3)) stack)
  | MinHeap_sift_up_pc2 (h : Heap) (s : State_MinHeap_sift_up) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_sift_up 2 s) stack) (.active h (Frame.fn_MinHeap_sift_up 1 { s with t3 := () }) stack)
  | MinHeap_sift_up_pc3_true (h : Heap) (s : State_MinHeap_sift_up) (stack : Stack) (condition : s.t4 = true) :
      Step (.active h (Frame.fn_MinHeap_sift_up 3 s) stack) (.active h (Frame.fn_MinHeap_sift_up 16 s) stack)
  | MinHeap_sift_up_pc3_false (h : Heap) (s : State_MinHeap_sift_up) (stack : Stack) (condition : s.t4 = false) :
      Step (.active h (Frame.fn_MinHeap_sift_up 3 s) stack) (.active h (Frame.fn_MinHeap_sift_up 2 s) stack)
  | MinHeap_sift_up_pc4 (h : Heap) (s : State_MinHeap_sift_up) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_sift_up 4 s) stack) (.active h (Frame.fn_MinHeap_sift_up 3 { s with t4 := (decide ((s.v1 > (0 : Int)))) }) stack)
  | MinHeap_sift_up_pc5 (h : Heap) (s : State_MinHeap_sift_up) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_sift_up 5 s) stack) (.active h (Frame.fn_MinHeap_sift_up 4 { s with v1 := s.v2 }) stack)
  | MinHeap_sift_up_pc6 (h : Heap) (s : State_MinHeap_sift_up) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_sift_up 6 s) stack) (.active h (Frame.fn_MinHeap_swap 9 ({ v0 := (s.t6), v1 := s.t7, v2 := s.t8 } : State_MinHeap_swap)) ((fun value => match value with | .fn_MinHeap_swap result => (Frame.fn_MinHeap_sift_up 5 { s with t5 := result }) | _ => .invalid) :: stack))
  | MinHeap_sift_up_pc7 (h : Heap) (s : State_MinHeap_sift_up) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_sift_up 7 s) stack) (.active h (Frame.fn_MinHeap_sift_up 6 { s with t8 := s.v2 }) stack)
  | MinHeap_sift_up_pc8 (h : Heap) (s : State_MinHeap_sift_up) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_sift_up 8 s) stack) (.active h (Frame.fn_MinHeap_sift_up 7 { s with t7 := s.v1 }) stack)
  | MinHeap_sift_up_pc9 (h : Heap) (s : State_MinHeap_sift_up) (stack : Stack) (defined : (is_MinHeap h (s.t6))) :
      Step (.active h (Frame.fn_MinHeap_sift_up 9 s) stack) (.active h (Frame.fn_MinHeap_sift_up 8 { s with t6 := s.t6 }) stack)
  | MinHeap_sift_up_pc10 (h : Heap) (s : State_MinHeap_sift_up) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_sift_up 10 s) stack) (.active h (Frame.fn_MinHeap_sift_up 9 { s with t6 := s.v0 }) stack)
  | MinHeap_sift_up_pc11 (h : Heap) (s : State_MinHeap_sift_up) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_sift_up 11 s) stack) (Algo2LeanCore.resumeConfig h (Result.fn_MinHeap_sift_up (s.t10)) stack)
  | MinHeap_sift_up_pc12 (h : Heap) (s : State_MinHeap_sift_up) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_sift_up 12 s) stack) (.active h (Frame.fn_MinHeap_sift_up 11 { s with t10 := () }) stack)
  | MinHeap_sift_up_pc13_true (h : Heap) (s : State_MinHeap_sift_up) (stack : Stack) (condition : s.t9 = true) :
      Step (.active h (Frame.fn_MinHeap_sift_up 13 s) stack) (.active h (Frame.fn_MinHeap_sift_up 12 s) stack)
  | MinHeap_sift_up_pc13_false (h : Heap) (s : State_MinHeap_sift_up) (stack : Stack) (condition : s.t9 = false) :
      Step (.active h (Frame.fn_MinHeap_sift_up 13 s) stack) (.active h (Frame.fn_MinHeap_sift_up 10 s) stack)
  | MinHeap_sift_up_pc14 (h : Heap) (s : State_MinHeap_sift_up) (stack : Stack) (defined : (((((field_MinHeap_keys h (s.v0)).isSome = true))) ∧ (((((field_MinHeap_vertices h (s.v0)).isSome = true))) ∧ (((field_MinHeap_vertices h (s.v0)).getD 0) < h.nextRef)) ∧ (((field_MinHeap_keys h (s.v0)).getD 0) < h.nextRef))) :
      Step (.active h (Frame.fn_MinHeap_sift_up 14 s) stack) (.active h (Frame.fn_MinHeap_sift_up 13 { s with t9 := (decide (((h.read ((field_MinHeap_keys h (s.v0)).getD 0) (h.read ((field_MinHeap_vertices h (s.v0)).getD 0) s.v2)) ≤ (h.read ((field_MinHeap_keys h (s.v0)).getD 0) (h.read ((field_MinHeap_vertices h (s.v0)).getD 0) s.v1))))) }) stack)
  | MinHeap_sift_up_pc15 (h : Heap) (s : State_MinHeap_sift_up) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_sift_up 15 s) stack) (.active (h.tick "heap_comparisons" 1) (Frame.fn_MinHeap_sift_up 14 s) stack)
  | MinHeap_sift_up_pc16 (h : Heap) (s : State_MinHeap_sift_up) (stack : Stack) (defined : ((2 : Int) ≠ 0)) :
      Step (.active h (Frame.fn_MinHeap_sift_up 16 s) stack) (.active h (Frame.fn_MinHeap_sift_up 15 { s with v2 := (Int.fdiv (s.v1 - (1 : Int)) (2 : Int)) }) stack)
  | MinHeap_sift_down_pc1 (h : Heap) (s : State_MinHeap_sift_down) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_sift_down 1 s) stack) (Algo2LeanCore.resumeConfig h (Result.fn_MinHeap_sift_down (s.t4)) stack)
  | MinHeap_sift_down_pc2 (h : Heap) (s : State_MinHeap_sift_down) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_sift_down 2 s) stack) (.active h (Frame.fn_MinHeap_sift_down 1 { s with t4 := () }) stack)
  | MinHeap_sift_down_pc3_true (h : Heap) (s : State_MinHeap_sift_down) (stack : Stack) (condition : s.t5 = true) :
      Step (.active h (Frame.fn_MinHeap_sift_down 3 s) stack) (.active h (Frame.fn_MinHeap_sift_down 23 s) stack)
  | MinHeap_sift_down_pc3_false (h : Heap) (s : State_MinHeap_sift_down) (stack : Stack) (condition : s.t5 = false) :
      Step (.active h (Frame.fn_MinHeap_sift_down 3 s) stack) (.active h (Frame.fn_MinHeap_sift_down 2 s) stack)
  | MinHeap_sift_down_pc4 (h : Heap) (s : State_MinHeap_sift_down) (stack : Stack) (defined : ((((field_MinHeap_size h (s.v0)).isSome = true)))) :
      Step (.active h (Frame.fn_MinHeap_sift_down 4 s) stack) (.active h (Frame.fn_MinHeap_sift_down 3 { s with t5 := (decide (((((2 : Int) * s.v1) + (1 : Int)) < ((field_MinHeap_size h (s.v0)).getD 0)))) }) stack)
  | MinHeap_sift_down_pc5 (h : Heap) (s : State_MinHeap_sift_down) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_sift_down 5 s) stack) (.active h (Frame.fn_MinHeap_sift_down 4 { s with v1 := s.v2 }) stack)
  | MinHeap_sift_down_pc6 (h : Heap) (s : State_MinHeap_sift_down) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_sift_down 6 s) stack) (.active h (Frame.fn_MinHeap_swap 9 ({ v0 := (s.t7), v1 := s.t8, v2 := s.t9 } : State_MinHeap_swap)) ((fun value => match value with | .fn_MinHeap_swap result => (Frame.fn_MinHeap_sift_down 5 { s with t6 := result }) | _ => .invalid) :: stack))
  | MinHeap_sift_down_pc7 (h : Heap) (s : State_MinHeap_sift_down) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_sift_down 7 s) stack) (.active h (Frame.fn_MinHeap_sift_down 6 { s with t9 := s.v2 }) stack)
  | MinHeap_sift_down_pc8 (h : Heap) (s : State_MinHeap_sift_down) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_sift_down 8 s) stack) (.active h (Frame.fn_MinHeap_sift_down 7 { s with t8 := s.v1 }) stack)
  | MinHeap_sift_down_pc9 (h : Heap) (s : State_MinHeap_sift_down) (stack : Stack) (defined : (is_MinHeap h (s.t7))) :
      Step (.active h (Frame.fn_MinHeap_sift_down 9 s) stack) (.active h (Frame.fn_MinHeap_sift_down 8 { s with t7 := s.t7 }) stack)
  | MinHeap_sift_down_pc10 (h : Heap) (s : State_MinHeap_sift_down) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_sift_down 10 s) stack) (.active h (Frame.fn_MinHeap_sift_down 9 { s with t7 := s.v0 }) stack)
  | MinHeap_sift_down_pc11 (h : Heap) (s : State_MinHeap_sift_down) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_sift_down 11 s) stack) (Algo2LeanCore.resumeConfig h (Result.fn_MinHeap_sift_down (s.t11)) stack)
  | MinHeap_sift_down_pc12 (h : Heap) (s : State_MinHeap_sift_down) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_sift_down 12 s) stack) (.active h (Frame.fn_MinHeap_sift_down 11 { s with t11 := () }) stack)
  | MinHeap_sift_down_pc13_true (h : Heap) (s : State_MinHeap_sift_down) (stack : Stack) (condition : s.t10 = true) :
      Step (.active h (Frame.fn_MinHeap_sift_down 13 s) stack) (.active h (Frame.fn_MinHeap_sift_down 12 s) stack)
  | MinHeap_sift_down_pc13_false (h : Heap) (s : State_MinHeap_sift_down) (stack : Stack) (condition : s.t10 = false) :
      Step (.active h (Frame.fn_MinHeap_sift_down 13 s) stack) (.active h (Frame.fn_MinHeap_sift_down 10 s) stack)
  | MinHeap_sift_down_pc14 (h : Heap) (s : State_MinHeap_sift_down) (stack : Stack) (defined : (((((field_MinHeap_keys h (s.v0)).isSome = true))) ∧ (((((field_MinHeap_vertices h (s.v0)).isSome = true))) ∧ (((field_MinHeap_vertices h (s.v0)).getD 0) < h.nextRef)) ∧ (((field_MinHeap_keys h (s.v0)).getD 0) < h.nextRef))) :
      Step (.active h (Frame.fn_MinHeap_sift_down 14 s) stack) (.active h (Frame.fn_MinHeap_sift_down 13 { s with t10 := (decide (((h.read ((field_MinHeap_keys h (s.v0)).getD 0) (h.read ((field_MinHeap_vertices h (s.v0)).getD 0) s.v1)) ≤ (h.read ((field_MinHeap_keys h (s.v0)).getD 0) (h.read ((field_MinHeap_vertices h (s.v0)).getD 0) s.v2))))) }) stack)
  | MinHeap_sift_down_pc15 (h : Heap) (s : State_MinHeap_sift_down) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_sift_down 15 s) stack) (.active (h.tick "heap_comparisons" 1) (Frame.fn_MinHeap_sift_down 14 s) stack)
  | MinHeap_sift_down_pc16 (h : Heap) (s : State_MinHeap_sift_down) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_sift_down 16 s) stack) (.active h (Frame.fn_MinHeap_sift_down 15 { s with v2 := s.v3 }) stack)
  | MinHeap_sift_down_pc17_true (h : Heap) (s : State_MinHeap_sift_down) (stack : Stack) (condition : s.t13 = true) :
      Step (.active h (Frame.fn_MinHeap_sift_down 17 s) stack) (.active h (Frame.fn_MinHeap_sift_down 16 s) stack)
  | MinHeap_sift_down_pc17_false (h : Heap) (s : State_MinHeap_sift_down) (stack : Stack) (condition : s.t13 = false) :
      Step (.active h (Frame.fn_MinHeap_sift_down 17 s) stack) (.active h (Frame.fn_MinHeap_sift_down 15 s) stack)
  | MinHeap_sift_down_pc18 (h : Heap) (s : State_MinHeap_sift_down) (stack : Stack) (defined : (((((field_MinHeap_keys h (s.v0)).isSome = true))) ∧ (((((field_MinHeap_vertices h (s.v0)).isSome = true))) ∧ (((field_MinHeap_vertices h (s.v0)).getD 0) < h.nextRef)) ∧ (((field_MinHeap_keys h (s.v0)).getD 0) < h.nextRef))) :
      Step (.active h (Frame.fn_MinHeap_sift_down 18 s) stack) (.active h (Frame.fn_MinHeap_sift_down 17 { s with t13 := (decide (((h.read ((field_MinHeap_keys h (s.v0)).getD 0) (h.read ((field_MinHeap_vertices h (s.v0)).getD 0) s.v3)) < (h.read ((field_MinHeap_keys h (s.v0)).getD 0) (h.read ((field_MinHeap_vertices h (s.v0)).getD 0) s.v2))))) }) stack)
  | MinHeap_sift_down_pc19 (h : Heap) (s : State_MinHeap_sift_down) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_sift_down 19 s) stack) (.active (h.tick "heap_comparisons" 1) (Frame.fn_MinHeap_sift_down 18 s) stack)
  | MinHeap_sift_down_pc20_true (h : Heap) (s : State_MinHeap_sift_down) (stack : Stack) (condition : s.t12 = true) :
      Step (.active h (Frame.fn_MinHeap_sift_down 20 s) stack) (.active h (Frame.fn_MinHeap_sift_down 19 s) stack)
  | MinHeap_sift_down_pc20_false (h : Heap) (s : State_MinHeap_sift_down) (stack : Stack) (condition : s.t12 = false) :
      Step (.active h (Frame.fn_MinHeap_sift_down 20 s) stack) (.active h (Frame.fn_MinHeap_sift_down 15 s) stack)
  | MinHeap_sift_down_pc21 (h : Heap) (s : State_MinHeap_sift_down) (stack : Stack) (defined : ((((field_MinHeap_size h (s.v0)).isSome = true)))) :
      Step (.active h (Frame.fn_MinHeap_sift_down 21 s) stack) (.active h (Frame.fn_MinHeap_sift_down 20 { s with t12 := (decide ((s.v3 < ((field_MinHeap_size h (s.v0)).getD 0)))) }) stack)
  | MinHeap_sift_down_pc22 (h : Heap) (s : State_MinHeap_sift_down) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_sift_down 22 s) stack) (.active h (Frame.fn_MinHeap_sift_down 21 { s with v3 := (s.v2 + (1 : Int)) }) stack)
  | MinHeap_sift_down_pc23 (h : Heap) (s : State_MinHeap_sift_down) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_sift_down 23 s) stack) (.active h (Frame.fn_MinHeap_sift_down 22 { s with v2 := (((2 : Int) * s.v1) + (1 : Int)) }) stack)
  | MinHeap_push_or_decrease_pc1 (h : Heap) (s : State_MinHeap_push_or_decrease) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_push_or_decrease 1 s) stack) (Algo2LeanCore.resumeConfig h (Result.fn_MinHeap_push_or_decrease (s.t4)) stack)
  | MinHeap_push_or_decrease_pc2 (h : Heap) (s : State_MinHeap_push_or_decrease) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_push_or_decrease 2 s) stack) (.active h (Frame.fn_MinHeap_push_or_decrease 1 { s with t4 := () }) stack)
  | MinHeap_push_or_decrease_pc3 (h : Heap) (s : State_MinHeap_push_or_decrease) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_push_or_decrease 3 s) stack) (.active h (Frame.fn_MinHeap_sift_up 4 ({ v0 := (s.t7), v1 := s.t8 } : State_MinHeap_sift_up)) ((fun value => match value with | .fn_MinHeap_sift_up result => (Frame.fn_MinHeap_push_or_decrease 2 { s with t6 := result }) | _ => .invalid) :: stack))
  | MinHeap_push_or_decrease_pc4 (h : Heap) (s : State_MinHeap_push_or_decrease) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_push_or_decrease 4 s) stack) (.active h (Frame.fn_MinHeap_push_or_decrease 3 { s with t8 := s.v3 }) stack)
  | MinHeap_push_or_decrease_pc5 (h : Heap) (s : State_MinHeap_push_or_decrease) (stack : Stack) (defined : (is_MinHeap h (s.t7))) :
      Step (.active h (Frame.fn_MinHeap_push_or_decrease 5 s) stack) (.active h (Frame.fn_MinHeap_push_or_decrease 4 { s with t7 := s.t7 }) stack)
  | MinHeap_push_or_decrease_pc6 (h : Heap) (s : State_MinHeap_push_or_decrease) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_push_or_decrease 6 s) stack) (.active h (Frame.fn_MinHeap_push_or_decrease 5 { s with t7 := s.v0 }) stack)
  | MinHeap_push_or_decrease_pc7 (h : Heap) (s : State_MinHeap_push_or_decrease) (stack : Stack) (defined : (is_MinHeap h (s.t9))) :
      Step (.active h (Frame.fn_MinHeap_push_or_decrease 7 s) stack) (.active (set_MinHeap_size h (s.t9) ((s.t10 + s.t11))) (Frame.fn_MinHeap_push_or_decrease 6 s) stack)
  | MinHeap_push_or_decrease_pc8 (h : Heap) (s : State_MinHeap_push_or_decrease) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_push_or_decrease 8 s) stack) (.active h (Frame.fn_MinHeap_push_or_decrease 7 { s with t11 := (1 : Int) }) stack)
  | MinHeap_push_or_decrease_pc9 (h : Heap) (s : State_MinHeap_push_or_decrease) (stack : Stack) (defined : ((field_MinHeap_size h (s.t9)).isSome = true)) :
      Step (.active h (Frame.fn_MinHeap_push_or_decrease 9 s) stack) (.active h (Frame.fn_MinHeap_push_or_decrease 8 { s with t10 := ((field_MinHeap_size h (s.t9)).getD 0) }) stack)
  | MinHeap_push_or_decrease_pc10 (h : Heap) (s : State_MinHeap_push_or_decrease) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_push_or_decrease 10 s) stack) (.active h (Frame.fn_MinHeap_push_or_decrease 9 { s with t9 := s.v0 }) stack)
  | MinHeap_push_or_decrease_pc11 (h : Heap) (s : State_MinHeap_push_or_decrease) (stack : Stack) (defined : (((((field_MinHeap_positions h (s.v0)).isSome = true)))) ∧ (((field_MinHeap_positions h (s.v0)).getD 0) < h.nextRef)) :
      Step (.active h (Frame.fn_MinHeap_push_or_decrease 11 s) stack) (.active (h.write ((field_MinHeap_positions h (s.v0)).getD 0) s.v1 s.v3) (Frame.fn_MinHeap_push_or_decrease 10 s) stack)
  | MinHeap_push_or_decrease_pc12 (h : Heap) (s : State_MinHeap_push_or_decrease) (stack : Stack) (defined : (((((field_MinHeap_vertices h (s.v0)).isSome = true)))) ∧ (((field_MinHeap_vertices h (s.v0)).getD 0) < h.nextRef)) :
      Step (.active h (Frame.fn_MinHeap_push_or_decrease 12 s) stack) (.active (h.write ((field_MinHeap_vertices h (s.v0)).getD 0) s.v3 s.v1) (Frame.fn_MinHeap_push_or_decrease 11 s) stack)
  | MinHeap_push_or_decrease_pc13 (h : Heap) (s : State_MinHeap_push_or_decrease) (stack : Stack) (defined : (((field_MinHeap_size h (s.v0)).isSome = true))) :
      Step (.active h (Frame.fn_MinHeap_push_or_decrease 13 s) stack) (.active h (Frame.fn_MinHeap_push_or_decrease 12 { s with v3 := ((field_MinHeap_size h (s.v0)).getD 0) }) stack)
  | MinHeap_push_or_decrease_pc14 (h : Heap) (s : State_MinHeap_push_or_decrease) (stack : Stack) (defined : (((((field_MinHeap_keys h (s.v0)).isSome = true)))) ∧ (((field_MinHeap_keys h (s.v0)).getD 0) < h.nextRef)) :
      Step (.active h (Frame.fn_MinHeap_push_or_decrease 14 s) stack) (.active (h.write ((field_MinHeap_keys h (s.v0)).getD 0) s.v1 s.v2) (Frame.fn_MinHeap_push_or_decrease 13 s) stack)
  | MinHeap_push_or_decrease_pc15 (h : Heap) (s : State_MinHeap_push_or_decrease) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_push_or_decrease 15 s) stack) (.active h (Frame.fn_MinHeap_sift_up 4 ({ v0 := (s.t14), v1 := s.t15 } : State_MinHeap_sift_up)) ((fun value => match value with | .fn_MinHeap_sift_up result => (Frame.fn_MinHeap_push_or_decrease 2 { s with t13 := result }) | _ => .invalid) :: stack))
  | MinHeap_push_or_decrease_pc16 (h : Heap) (s : State_MinHeap_push_or_decrease) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_push_or_decrease 16 s) stack) (.active h (Frame.fn_MinHeap_push_or_decrease 15 { s with t15 := s.v3 }) stack)
  | MinHeap_push_or_decrease_pc17 (h : Heap) (s : State_MinHeap_push_or_decrease) (stack : Stack) (defined : (is_MinHeap h (s.t14))) :
      Step (.active h (Frame.fn_MinHeap_push_or_decrease 17 s) stack) (.active h (Frame.fn_MinHeap_push_or_decrease 16 { s with t14 := s.t14 }) stack)
  | MinHeap_push_or_decrease_pc18 (h : Heap) (s : State_MinHeap_push_or_decrease) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_push_or_decrease 18 s) stack) (.active h (Frame.fn_MinHeap_push_or_decrease 17 { s with t14 := s.v0 }) stack)
  | MinHeap_push_or_decrease_pc19 (h : Heap) (s : State_MinHeap_push_or_decrease) (stack : Stack) (defined : (((((field_MinHeap_keys h (s.v0)).isSome = true)))) ∧ (((field_MinHeap_keys h (s.v0)).getD 0) < h.nextRef)) :
      Step (.active h (Frame.fn_MinHeap_push_or_decrease 19 s) stack) (.active (h.write ((field_MinHeap_keys h (s.v0)).getD 0) s.v1 s.v2) (Frame.fn_MinHeap_push_or_decrease 18 s) stack)
  | MinHeap_push_or_decrease_pc20_true (h : Heap) (s : State_MinHeap_push_or_decrease) (stack : Stack) (condition : s.t12 = true) :
      Step (.active h (Frame.fn_MinHeap_push_or_decrease 20 s) stack) (.active h (Frame.fn_MinHeap_push_or_decrease 19 s) stack)
  | MinHeap_push_or_decrease_pc20_false (h : Heap) (s : State_MinHeap_push_or_decrease) (stack : Stack) (condition : s.t12 = false) :
      Step (.active h (Frame.fn_MinHeap_push_or_decrease 20 s) stack) (.active h (Frame.fn_MinHeap_push_or_decrease 2 s) stack)
  | MinHeap_push_or_decrease_pc21 (h : Heap) (s : State_MinHeap_push_or_decrease) (stack : Stack) (defined : (((((field_MinHeap_keys h (s.v0)).isSome = true))) ∧ (((field_MinHeap_keys h (s.v0)).getD 0) < h.nextRef))) :
      Step (.active h (Frame.fn_MinHeap_push_or_decrease 21 s) stack) (.active h (Frame.fn_MinHeap_push_or_decrease 20 { s with t12 := (decide ((s.v2 < (h.read ((field_MinHeap_keys h (s.v0)).getD 0) s.v1)))) }) stack)
  | MinHeap_push_or_decrease_pc22 (h : Heap) (s : State_MinHeap_push_or_decrease) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_push_or_decrease 22 s) stack) (.active (h.tick "heap_comparisons" 1) (Frame.fn_MinHeap_push_or_decrease 21 s) stack)
  | MinHeap_push_or_decrease_pc23_true (h : Heap) (s : State_MinHeap_push_or_decrease) (stack : Stack) (condition : s.t5 = true) :
      Step (.active h (Frame.fn_MinHeap_push_or_decrease 23 s) stack) (.active h (Frame.fn_MinHeap_push_or_decrease 14 s) stack)
  | MinHeap_push_or_decrease_pc23_false (h : Heap) (s : State_MinHeap_push_or_decrease) (stack : Stack) (condition : s.t5 = false) :
      Step (.active h (Frame.fn_MinHeap_push_or_decrease 23 s) stack) (.active h (Frame.fn_MinHeap_push_or_decrease 22 s) stack)
  | MinHeap_push_or_decrease_pc24 (h : Heap) (s : State_MinHeap_push_or_decrease) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_push_or_decrease 24 s) stack) (.active h (Frame.fn_MinHeap_push_or_decrease 23 { s with t5 := (decide ((s.v3 < (0 : Int)))) }) stack)
  | MinHeap_push_or_decrease_pc25 (h : Heap) (s : State_MinHeap_push_or_decrease) (stack : Stack) (defined : ((((field_MinHeap_positions h (s.v0)).isSome = true))) ∧ (((field_MinHeap_positions h (s.v0)).getD 0) < h.nextRef)) :
      Step (.active h (Frame.fn_MinHeap_push_or_decrease 25 s) stack) (.active h (Frame.fn_MinHeap_push_or_decrease 24 { s with v3 := (h.read ((field_MinHeap_positions h (s.v0)).getD 0) s.v1) }) stack)
  | MinHeap_pop_min_pc1 (h : Heap) (s : State_MinHeap_pop_min) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_pop_min 1 s) stack) (Algo2LeanCore.resumeConfig h (Result.fn_MinHeap_pop_min (s.t3)) stack)
  | MinHeap_pop_min_pc2 (h : Heap) (s : State_MinHeap_pop_min) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_pop_min 2 s) stack) (.active h (Frame.fn_MinHeap_pop_min 1 { s with t3 := s.v1 }) stack)
  | MinHeap_pop_min_pc3 (h : Heap) (s : State_MinHeap_pop_min) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_pop_min 3 s) stack) (.active h (Frame.fn_MinHeap_sift_down 4 ({ v0 := (s.t6), v1 := s.t7 } : State_MinHeap_sift_down)) ((fun value => match value with | .fn_MinHeap_sift_down result => (Frame.fn_MinHeap_pop_min 2 { s with t5 := result }) | _ => .invalid) :: stack))
  | MinHeap_pop_min_pc4 (h : Heap) (s : State_MinHeap_pop_min) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_pop_min 4 s) stack) (.active h (Frame.fn_MinHeap_pop_min 3 { s with t7 := (0 : Int) }) stack)
  | MinHeap_pop_min_pc5 (h : Heap) (s : State_MinHeap_pop_min) (stack : Stack) (defined : (is_MinHeap h (s.t6))) :
      Step (.active h (Frame.fn_MinHeap_pop_min 5 s) stack) (.active h (Frame.fn_MinHeap_pop_min 4 { s with t6 := s.t6 }) stack)
  | MinHeap_pop_min_pc6 (h : Heap) (s : State_MinHeap_pop_min) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_pop_min 6 s) stack) (.active h (Frame.fn_MinHeap_pop_min 5 { s with t6 := s.v0 }) stack)
  | MinHeap_pop_min_pc7_true (h : Heap) (s : State_MinHeap_pop_min) (stack : Stack) (condition : s.t4 = true) :
      Step (.active h (Frame.fn_MinHeap_pop_min 7 s) stack) (.active h (Frame.fn_MinHeap_pop_min 6 s) stack)
  | MinHeap_pop_min_pc7_false (h : Heap) (s : State_MinHeap_pop_min) (stack : Stack) (condition : s.t4 = false) :
      Step (.active h (Frame.fn_MinHeap_pop_min 7 s) stack) (.active h (Frame.fn_MinHeap_pop_min 2 s) stack)
  | MinHeap_pop_min_pc8 (h : Heap) (s : State_MinHeap_pop_min) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_pop_min 8 s) stack) (.active h (Frame.fn_MinHeap_pop_min 7 { s with t4 := (decide ((s.v2 > (0 : Int)))) }) stack)
  | MinHeap_pop_min_pc9 (h : Heap) (s : State_MinHeap_pop_min) (stack : Stack) (defined : (((((field_MinHeap_positions h (s.v0)).isSome = true)))) ∧ (((field_MinHeap_positions h (s.v0)).getD 0) < h.nextRef)) :
      Step (.active h (Frame.fn_MinHeap_pop_min 9 s) stack) (.active (h.write ((field_MinHeap_positions h (s.v0)).getD 0) s.v1 (-(1 : Int))) (Frame.fn_MinHeap_pop_min 8 s) stack)
  | MinHeap_pop_min_pc10 (h : Heap) (s : State_MinHeap_pop_min) (stack : Stack) (defined : (is_MinHeap h (s.v0))) :
      Step (.active h (Frame.fn_MinHeap_pop_min 10 s) stack) (.active (set_MinHeap_size h (s.v0) (s.v2)) (Frame.fn_MinHeap_pop_min 9 s) stack)
  | MinHeap_pop_min_pc11 (h : Heap) (s : State_MinHeap_pop_min) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_pop_min 11 s) stack) (.active h (Frame.fn_MinHeap_swap 9 ({ v0 := (s.t9), v1 := s.t10, v2 := s.t11 } : State_MinHeap_swap)) ((fun value => match value with | .fn_MinHeap_swap result => (Frame.fn_MinHeap_pop_min 10 { s with t8 := result }) | _ => .invalid) :: stack))
  | MinHeap_pop_min_pc12 (h : Heap) (s : State_MinHeap_pop_min) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_pop_min 12 s) stack) (.active h (Frame.fn_MinHeap_pop_min 11 { s with t11 := s.v2 }) stack)
  | MinHeap_pop_min_pc13 (h : Heap) (s : State_MinHeap_pop_min) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_pop_min 13 s) stack) (.active h (Frame.fn_MinHeap_pop_min 12 { s with t10 := (0 : Int) }) stack)
  | MinHeap_pop_min_pc14 (h : Heap) (s : State_MinHeap_pop_min) (stack : Stack) (defined : (is_MinHeap h (s.t9))) :
      Step (.active h (Frame.fn_MinHeap_pop_min 14 s) stack) (.active h (Frame.fn_MinHeap_pop_min 13 { s with t9 := s.t9 }) stack)
  | MinHeap_pop_min_pc15 (h : Heap) (s : State_MinHeap_pop_min) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_pop_min 15 s) stack) (.active h (Frame.fn_MinHeap_pop_min 14 { s with t9 := s.v0 }) stack)
  | MinHeap_pop_min_pc16 (h : Heap) (s : State_MinHeap_pop_min) (stack : Stack) (defined : ((((field_MinHeap_size h (s.v0)).isSome = true)))) :
      Step (.active h (Frame.fn_MinHeap_pop_min 16 s) stack) (.active h (Frame.fn_MinHeap_pop_min 15 { s with v2 := (((field_MinHeap_size h (s.v0)).getD 0) - (1 : Int)) }) stack)
  | MinHeap_pop_min_pc17 (h : Heap) (s : State_MinHeap_pop_min) (stack : Stack) (defined : ((((field_MinHeap_vertices h (s.v0)).isSome = true))) ∧ (((field_MinHeap_vertices h (s.v0)).getD 0) < h.nextRef)) :
      Step (.active h (Frame.fn_MinHeap_pop_min 17 s) stack) (.active h (Frame.fn_MinHeap_pop_min 16 { s with v1 := (h.read ((field_MinHeap_vertices h (s.v0)).getD 0) (0 : Int)) }) stack)
  | MinHeap_pop_min_pc18 (h : Heap) (s : State_MinHeap_pop_min) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_pop_min 18 s) stack) (Algo2LeanCore.resumeConfig h (Result.fn_MinHeap_pop_min (s.t13)) stack)
  | MinHeap_pop_min_pc19 (h : Heap) (s : State_MinHeap_pop_min) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_pop_min 19 s) stack) (.active h (Frame.fn_MinHeap_pop_min 18 { s with t13 := (-(1 : Int)) }) stack)
  | MinHeap_pop_min_pc20_true (h : Heap) (s : State_MinHeap_pop_min) (stack : Stack) (condition : s.t12 = true) :
      Step (.active h (Frame.fn_MinHeap_pop_min 20 s) stack) (.active h (Frame.fn_MinHeap_pop_min 19 s) stack)
  | MinHeap_pop_min_pc20_false (h : Heap) (s : State_MinHeap_pop_min) (stack : Stack) (condition : s.t12 = false) :
      Step (.active h (Frame.fn_MinHeap_pop_min 20 s) stack) (.active h (Frame.fn_MinHeap_pop_min 17 s) stack)
  | MinHeap_pop_min_pc21 (h : Heap) (s : State_MinHeap_pop_min) (stack : Stack) (defined : ((((field_MinHeap_size h (s.v0)).isSome = true)))) :
      Step (.active h (Frame.fn_MinHeap_pop_min 21 s) stack) (.active h (Frame.fn_MinHeap_pop_min 20 { s with t12 := (decide ((((field_MinHeap_size h (s.v0)).getD 0) ≤ (0 : Int)))) }) stack)
  | MinHeap_is_empty_pc1 (h : Heap) (s : State_MinHeap_is_empty) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap_is_empty 1 s) stack) (Algo2LeanCore.resumeConfig h (Result.fn_MinHeap_is_empty (s.t1)) stack)
  | MinHeap_is_empty_pc2 (h : Heap) (s : State_MinHeap_is_empty) (stack : Stack) (defined : ((((field_MinHeap_size h (s.v0)).isSome = true)))) :
      Step (.active h (Frame.fn_MinHeap_is_empty 2 s) stack) (.active h (Frame.fn_MinHeap_is_empty 1 { s with t1 := (decide ((((field_MinHeap_size h (s.v0)).getD 0) ≤ (0 : Int)))) }) stack)
  | MinHeap_pc1 (h : Heap) (s : State_MinHeap) (stack : Stack) (defined : is_MinHeap h s.t1) :
      Step (.active h (Frame.fn_MinHeap 1 s) stack) (Algo2LeanCore.resumeConfig h (Result.fn_MinHeap (s.t1)) stack)
  | MinHeap_pc2 (h : Heap) (s : State_MinHeap) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap 2 s) stack) (.active h (Frame.fn_MinHeap 1 { s with t1 := s.v0 }) stack)
  | MinHeap_pc3 (h : Heap) (s : State_MinHeap) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap 3 s) stack) (.active h (Frame.fn_MinHeap___init__ 15 ({ v0 := s.t3 } : State_MinHeap___init__)) ((fun value => match value with | .fn_MinHeap___init__ result => (Frame.fn_MinHeap 2 { s with t2 := result }) | _ => .invalid) :: stack))
  | MinHeap_pc4 (h : Heap) (s : State_MinHeap) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap 4 s) stack) (.active h (Frame.fn_MinHeap 3 { s with t3 := s.v0 }) stack)
  | MinHeap_pc5 (h : Heap) (s : State_MinHeap) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap 5 s) stack) (.active h (Frame.fn_MinHeap 4 { s with v0 := s.t4 }) stack)
  | MinHeap_pc6 (h : Heap) (s : State_MinHeap) (stack : Stack) :
      Step (.active h (Frame.fn_MinHeap 6 s) stack) (.active (h.allocateObject "indexed_heap.MinHeap") (Frame.fn_MinHeap 5 { s with t4 := h.nextObject }) stack)

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

end Algo2LeanGenerated

open Algo2LeanGenerated

def entry_MinHeap___init__ (input : Ref_MinHeap) : Frame :=
  (Frame.fn_MinHeap___init__ 15 ({ v0 := input } : State_MinHeap___init__))

def MinHeap.__init__.ValidInput (h : Heap) (input : Ref_MinHeap) : Prop := is_MinHeap h input
def MinHeap.__init__.initial (h : Heap) (input : Ref_MinHeap) : Configuration :=
  Algo2LeanCore.start h (Frame.fn_MinHeap___init__ 15 ({ v0 := input } : State_MinHeap___init__))
def MinHeap.__init__.Run (h : Heap) (input : Ref_MinHeap) (h' : Heap) (output : Unit) : Prop :=
  _root_.Algo.«indexed_heap».MinHeap.__init__.ValidInput h input ∧ Algo2LeanCore.Reaches Step (_root_.Algo.«indexed_heap».MinHeap.__init__.initial h input) (.done h' (Result.fn_MinHeap___init__ output))
def MinHeap.__init__.ValidHeapTranscript (h : Heap) (input : Ref_MinHeap) (trace : Transcript) : Prop :=
  _root_.Algo.«indexed_heap».MinHeap.__init__.ValidInput h input ∧ ∃ final, Algo2LeanCore.Valid Step (_root_.Algo.«indexed_heap».MinHeap.__init__.initial h input) trace final
def MinHeap.__init__.Call (h : Heap) (input : Ref_MinHeap) (h' : Heap) (output : Unit) : Prop :=
  _root_.Algo.«indexed_heap».MinHeap.__init__.ValidInput h input ∧ Algo2LeanCore.Summary Step h (Frame.fn_MinHeap___init__ 15 ({ v0 := input } : State_MinHeap___init__)) h' (Result.fn_MinHeap___init__ output)
-- Complete this function from the supplied local state, under any caller stack.
def MinHeap.__init__.CallFrom (state : Configuration) (finalHeap : Heap) (output : Unit) : Prop :=
  match state with
  | .active heap (Frame.fn_MinHeap___init__ pc locals) _ =>
      Algo2LeanCore.Summary Step heap (Frame.fn_MinHeap___init__ pc locals) finalHeap (Result.fn_MinHeap___init__ output)
  | _ => False
-- Object inputs carry their heap, preserving shared references and cycles.
def MinHeap.__init__.load (input : Heap × (Ref_MinHeap)) : Heap × (Ref_MinHeap) := input
def MinHeap.__init__.ValidTranscript (my_input : Heap × (Ref_MinHeap)) (trace : Transcript) : Prop :=
  let loaded := _root_.Algo.«indexed_heap».MinHeap.__init__.load my_input
  _root_.Algo.«indexed_heap».MinHeap.__init__.ValidHeapTranscript loaded.1 loaded.2 trace
def MinHeap.__init__.Returns (my_input : Heap × (Ref_MinHeap)) (my_output : Unit) : Prop :=
  let loaded := _root_.Algo.«indexed_heap».MinHeap.__init__.load my_input
  ∃ finalHeap, _root_.Algo.«indexed_heap».MinHeap.__init__.Run loaded.1 loaded.2 finalHeap my_output

-- Output and clock increments from one completed execution.
def MinHeap.__init__.ReturnsWithCost (my_input : Heap × (Ref_MinHeap)) (my_output : Unit) (costs : Clocks) : Prop :=
  let loaded := _root_.Algo.«indexed_heap».MinHeap.__init__.load my_input
  ∃ finalHeap, _root_.Algo.«indexed_heap».MinHeap.__init__.Run loaded.1 loaded.2 finalHeap my_output ∧ Heap.cost loaded.1 finalHeap = costs
theorem MinHeap.__init__.ReturnsWithCost.returns {input output costs}
    (run : _root_.Algo.«indexed_heap».MinHeap.__init__.ReturnsWithCost input output costs) : _root_.Algo.«indexed_heap».MinHeap.__init__.Returns input output := by
  obtain ⟨heap, execution, _⟩ := run
  exact ⟨heap, execution⟩
theorem MinHeap.__init__.Returns.withCost {input output}
    (run : _root_.Algo.«indexed_heap».MinHeap.__init__.Returns input output) : ∃ costs, _root_.Algo.«indexed_heap».MinHeap.__init__.ReturnsWithCost input output costs := by
  obtain ⟨heap, execution⟩ := run
  exact ⟨Heap.cost (_root_.Algo.«indexed_heap».MinHeap.__init__.load input).1 heap, heap, execution, rfl⟩

theorem MinHeap.__init__.Call.run {before input after output}
    (call : _root_.Algo.«indexed_heap».MinHeap.__init__.Call before input after output) :
    _root_.Algo.«indexed_heap».MinHeap.__init__.Run before input after output :=
  ⟨call.1, call.2.root⟩

def entry_MinHeap_swap (input : Ref_MinHeap × Int × Int) : Frame :=
  (Frame.fn_MinHeap_swap 9 ({ v0 := input.1, v1 := input.2.1, v2 := input.2.2 } : State_MinHeap_swap))

def MinHeap.swap.ValidInput (h : Heap) (input : Ref_MinHeap × Int × Int) : Prop := is_MinHeap h input.1
def MinHeap.swap.initial (h : Heap) (input : Ref_MinHeap × Int × Int) : Configuration :=
  Algo2LeanCore.start h (Frame.fn_MinHeap_swap 9 ({ v0 := input.1, v1 := input.2.1, v2 := input.2.2 } : State_MinHeap_swap))
def MinHeap.swap.Run (h : Heap) (input : Ref_MinHeap × Int × Int) (h' : Heap) (output : Unit) : Prop :=
  _root_.Algo.«indexed_heap».MinHeap.swap.ValidInput h input ∧ Algo2LeanCore.Reaches Step (_root_.Algo.«indexed_heap».MinHeap.swap.initial h input) (.done h' (Result.fn_MinHeap_swap output))
def MinHeap.swap.ValidHeapTranscript (h : Heap) (input : Ref_MinHeap × Int × Int) (trace : Transcript) : Prop :=
  _root_.Algo.«indexed_heap».MinHeap.swap.ValidInput h input ∧ ∃ final, Algo2LeanCore.Valid Step (_root_.Algo.«indexed_heap».MinHeap.swap.initial h input) trace final
def MinHeap.swap.Call (h : Heap) (input : Ref_MinHeap × Int × Int) (h' : Heap) (output : Unit) : Prop :=
  _root_.Algo.«indexed_heap».MinHeap.swap.ValidInput h input ∧ Algo2LeanCore.Summary Step h (Frame.fn_MinHeap_swap 9 ({ v0 := input.1, v1 := input.2.1, v2 := input.2.2 } : State_MinHeap_swap)) h' (Result.fn_MinHeap_swap output)
-- Complete this function from the supplied local state, under any caller stack.
def MinHeap.swap.CallFrom (state : Configuration) (finalHeap : Heap) (output : Unit) : Prop :=
  match state with
  | .active heap (Frame.fn_MinHeap_swap pc locals) _ =>
      Algo2LeanCore.Summary Step heap (Frame.fn_MinHeap_swap pc locals) finalHeap (Result.fn_MinHeap_swap output)
  | _ => False
-- Object inputs carry their heap, preserving shared references and cycles.
def MinHeap.swap.load (input : Heap × (Ref_MinHeap × Int × Int)) : Heap × (Ref_MinHeap × Int × Int) := input
def MinHeap.swap.ValidTranscript (my_input : Heap × (Ref_MinHeap × Int × Int)) (trace : Transcript) : Prop :=
  let loaded := _root_.Algo.«indexed_heap».MinHeap.swap.load my_input
  _root_.Algo.«indexed_heap».MinHeap.swap.ValidHeapTranscript loaded.1 loaded.2 trace
def MinHeap.swap.Returns (my_input : Heap × (Ref_MinHeap × Int × Int)) (my_output : Unit) : Prop :=
  let loaded := _root_.Algo.«indexed_heap».MinHeap.swap.load my_input
  ∃ finalHeap, _root_.Algo.«indexed_heap».MinHeap.swap.Run loaded.1 loaded.2 finalHeap my_output

-- Output and clock increments from one completed execution.
def MinHeap.swap.ReturnsWithCost (my_input : Heap × (Ref_MinHeap × Int × Int)) (my_output : Unit) (costs : Clocks) : Prop :=
  let loaded := _root_.Algo.«indexed_heap».MinHeap.swap.load my_input
  ∃ finalHeap, _root_.Algo.«indexed_heap».MinHeap.swap.Run loaded.1 loaded.2 finalHeap my_output ∧ Heap.cost loaded.1 finalHeap = costs
theorem MinHeap.swap.ReturnsWithCost.returns {input output costs}
    (run : _root_.Algo.«indexed_heap».MinHeap.swap.ReturnsWithCost input output costs) : _root_.Algo.«indexed_heap».MinHeap.swap.Returns input output := by
  obtain ⟨heap, execution, _⟩ := run
  exact ⟨heap, execution⟩
theorem MinHeap.swap.Returns.withCost {input output}
    (run : _root_.Algo.«indexed_heap».MinHeap.swap.Returns input output) : ∃ costs, _root_.Algo.«indexed_heap».MinHeap.swap.ReturnsWithCost input output costs := by
  obtain ⟨heap, execution⟩ := run
  exact ⟨Heap.cost (_root_.Algo.«indexed_heap».MinHeap.swap.load input).1 heap, heap, execution, rfl⟩

theorem MinHeap.swap.Call.run {before input after output}
    (call : _root_.Algo.«indexed_heap».MinHeap.swap.Call before input after output) :
    _root_.Algo.«indexed_heap».MinHeap.swap.Run before input after output :=
  ⟨call.1, call.2.root⟩

def entry_MinHeap_sift_up (input : Ref_MinHeap × Int) : Frame :=
  (Frame.fn_MinHeap_sift_up 4 ({ v0 := input.1, v1 := input.2 } : State_MinHeap_sift_up))

def MinHeap.sift_up.ValidInput (h : Heap) (input : Ref_MinHeap × Int) : Prop := is_MinHeap h input.1
def MinHeap.sift_up.initial (h : Heap) (input : Ref_MinHeap × Int) : Configuration :=
  Algo2LeanCore.start h (Frame.fn_MinHeap_sift_up 4 ({ v0 := input.1, v1 := input.2 } : State_MinHeap_sift_up))
def MinHeap.sift_up.Run (h : Heap) (input : Ref_MinHeap × Int) (h' : Heap) (output : Unit) : Prop :=
  _root_.Algo.«indexed_heap».MinHeap.sift_up.ValidInput h input ∧ Algo2LeanCore.Reaches Step (_root_.Algo.«indexed_heap».MinHeap.sift_up.initial h input) (.done h' (Result.fn_MinHeap_sift_up output))
def MinHeap.sift_up.ValidHeapTranscript (h : Heap) (input : Ref_MinHeap × Int) (trace : Transcript) : Prop :=
  _root_.Algo.«indexed_heap».MinHeap.sift_up.ValidInput h input ∧ ∃ final, Algo2LeanCore.Valid Step (_root_.Algo.«indexed_heap».MinHeap.sift_up.initial h input) trace final
def MinHeap.sift_up.Call (h : Heap) (input : Ref_MinHeap × Int) (h' : Heap) (output : Unit) : Prop :=
  _root_.Algo.«indexed_heap».MinHeap.sift_up.ValidInput h input ∧ Algo2LeanCore.Summary Step h (Frame.fn_MinHeap_sift_up 4 ({ v0 := input.1, v1 := input.2 } : State_MinHeap_sift_up)) h' (Result.fn_MinHeap_sift_up output)
-- Complete this function from the supplied local state, under any caller stack.
def MinHeap.sift_up.CallFrom (state : Configuration) (finalHeap : Heap) (output : Unit) : Prop :=
  match state with
  | .active heap (Frame.fn_MinHeap_sift_up pc locals) _ =>
      Algo2LeanCore.Summary Step heap (Frame.fn_MinHeap_sift_up pc locals) finalHeap (Result.fn_MinHeap_sift_up output)
  | _ => False
-- Object inputs carry their heap, preserving shared references and cycles.
def MinHeap.sift_up.load (input : Heap × (Ref_MinHeap × Int)) : Heap × (Ref_MinHeap × Int) := input
def MinHeap.sift_up.ValidTranscript (my_input : Heap × (Ref_MinHeap × Int)) (trace : Transcript) : Prop :=
  let loaded := _root_.Algo.«indexed_heap».MinHeap.sift_up.load my_input
  _root_.Algo.«indexed_heap».MinHeap.sift_up.ValidHeapTranscript loaded.1 loaded.2 trace
def MinHeap.sift_up.Returns (my_input : Heap × (Ref_MinHeap × Int)) (my_output : Unit) : Prop :=
  let loaded := _root_.Algo.«indexed_heap».MinHeap.sift_up.load my_input
  ∃ finalHeap, _root_.Algo.«indexed_heap».MinHeap.sift_up.Run loaded.1 loaded.2 finalHeap my_output

-- Output and clock increments from one completed execution.
def MinHeap.sift_up.ReturnsWithCost (my_input : Heap × (Ref_MinHeap × Int)) (my_output : Unit) (costs : Clocks) : Prop :=
  let loaded := _root_.Algo.«indexed_heap».MinHeap.sift_up.load my_input
  ∃ finalHeap, _root_.Algo.«indexed_heap».MinHeap.sift_up.Run loaded.1 loaded.2 finalHeap my_output ∧ Heap.cost loaded.1 finalHeap = costs
theorem MinHeap.sift_up.ReturnsWithCost.returns {input output costs}
    (run : _root_.Algo.«indexed_heap».MinHeap.sift_up.ReturnsWithCost input output costs) : _root_.Algo.«indexed_heap».MinHeap.sift_up.Returns input output := by
  obtain ⟨heap, execution, _⟩ := run
  exact ⟨heap, execution⟩
theorem MinHeap.sift_up.Returns.withCost {input output}
    (run : _root_.Algo.«indexed_heap».MinHeap.sift_up.Returns input output) : ∃ costs, _root_.Algo.«indexed_heap».MinHeap.sift_up.ReturnsWithCost input output costs := by
  obtain ⟨heap, execution⟩ := run
  exact ⟨Heap.cost (_root_.Algo.«indexed_heap».MinHeap.sift_up.load input).1 heap, heap, execution, rfl⟩

theorem MinHeap.sift_up.Call.run {before input after output}
    (call : _root_.Algo.«indexed_heap».MinHeap.sift_up.Call before input after output) :
    _root_.Algo.«indexed_heap».MinHeap.sift_up.Run before input after output :=
  ⟨call.1, call.2.root⟩

def entry_MinHeap_sift_down (input : Ref_MinHeap × Int) : Frame :=
  (Frame.fn_MinHeap_sift_down 4 ({ v0 := input.1, v1 := input.2 } : State_MinHeap_sift_down))

def MinHeap.sift_down.ValidInput (h : Heap) (input : Ref_MinHeap × Int) : Prop := is_MinHeap h input.1
def MinHeap.sift_down.initial (h : Heap) (input : Ref_MinHeap × Int) : Configuration :=
  Algo2LeanCore.start h (Frame.fn_MinHeap_sift_down 4 ({ v0 := input.1, v1 := input.2 } : State_MinHeap_sift_down))
def MinHeap.sift_down.Run (h : Heap) (input : Ref_MinHeap × Int) (h' : Heap) (output : Unit) : Prop :=
  _root_.Algo.«indexed_heap».MinHeap.sift_down.ValidInput h input ∧ Algo2LeanCore.Reaches Step (_root_.Algo.«indexed_heap».MinHeap.sift_down.initial h input) (.done h' (Result.fn_MinHeap_sift_down output))
def MinHeap.sift_down.ValidHeapTranscript (h : Heap) (input : Ref_MinHeap × Int) (trace : Transcript) : Prop :=
  _root_.Algo.«indexed_heap».MinHeap.sift_down.ValidInput h input ∧ ∃ final, Algo2LeanCore.Valid Step (_root_.Algo.«indexed_heap».MinHeap.sift_down.initial h input) trace final
def MinHeap.sift_down.Call (h : Heap) (input : Ref_MinHeap × Int) (h' : Heap) (output : Unit) : Prop :=
  _root_.Algo.«indexed_heap».MinHeap.sift_down.ValidInput h input ∧ Algo2LeanCore.Summary Step h (Frame.fn_MinHeap_sift_down 4 ({ v0 := input.1, v1 := input.2 } : State_MinHeap_sift_down)) h' (Result.fn_MinHeap_sift_down output)
-- Complete this function from the supplied local state, under any caller stack.
def MinHeap.sift_down.CallFrom (state : Configuration) (finalHeap : Heap) (output : Unit) : Prop :=
  match state with
  | .active heap (Frame.fn_MinHeap_sift_down pc locals) _ =>
      Algo2LeanCore.Summary Step heap (Frame.fn_MinHeap_sift_down pc locals) finalHeap (Result.fn_MinHeap_sift_down output)
  | _ => False
-- Object inputs carry their heap, preserving shared references and cycles.
def MinHeap.sift_down.load (input : Heap × (Ref_MinHeap × Int)) : Heap × (Ref_MinHeap × Int) := input
def MinHeap.sift_down.ValidTranscript (my_input : Heap × (Ref_MinHeap × Int)) (trace : Transcript) : Prop :=
  let loaded := _root_.Algo.«indexed_heap».MinHeap.sift_down.load my_input
  _root_.Algo.«indexed_heap».MinHeap.sift_down.ValidHeapTranscript loaded.1 loaded.2 trace
def MinHeap.sift_down.Returns (my_input : Heap × (Ref_MinHeap × Int)) (my_output : Unit) : Prop :=
  let loaded := _root_.Algo.«indexed_heap».MinHeap.sift_down.load my_input
  ∃ finalHeap, _root_.Algo.«indexed_heap».MinHeap.sift_down.Run loaded.1 loaded.2 finalHeap my_output

-- Output and clock increments from one completed execution.
def MinHeap.sift_down.ReturnsWithCost (my_input : Heap × (Ref_MinHeap × Int)) (my_output : Unit) (costs : Clocks) : Prop :=
  let loaded := _root_.Algo.«indexed_heap».MinHeap.sift_down.load my_input
  ∃ finalHeap, _root_.Algo.«indexed_heap».MinHeap.sift_down.Run loaded.1 loaded.2 finalHeap my_output ∧ Heap.cost loaded.1 finalHeap = costs
theorem MinHeap.sift_down.ReturnsWithCost.returns {input output costs}
    (run : _root_.Algo.«indexed_heap».MinHeap.sift_down.ReturnsWithCost input output costs) : _root_.Algo.«indexed_heap».MinHeap.sift_down.Returns input output := by
  obtain ⟨heap, execution, _⟩ := run
  exact ⟨heap, execution⟩
theorem MinHeap.sift_down.Returns.withCost {input output}
    (run : _root_.Algo.«indexed_heap».MinHeap.sift_down.Returns input output) : ∃ costs, _root_.Algo.«indexed_heap».MinHeap.sift_down.ReturnsWithCost input output costs := by
  obtain ⟨heap, execution⟩ := run
  exact ⟨Heap.cost (_root_.Algo.«indexed_heap».MinHeap.sift_down.load input).1 heap, heap, execution, rfl⟩

theorem MinHeap.sift_down.Call.run {before input after output}
    (call : _root_.Algo.«indexed_heap».MinHeap.sift_down.Call before input after output) :
    _root_.Algo.«indexed_heap».MinHeap.sift_down.Run before input after output :=
  ⟨call.1, call.2.root⟩

def entry_MinHeap_push_or_decrease (input : Ref_MinHeap × Int × Int) : Frame :=
  (Frame.fn_MinHeap_push_or_decrease 25 ({ v0 := input.1, v1 := input.2.1, v2 := input.2.2 } : State_MinHeap_push_or_decrease))

def MinHeap.push_or_decrease.ValidInput (h : Heap) (input : Ref_MinHeap × Int × Int) : Prop := is_MinHeap h input.1
def MinHeap.push_or_decrease.initial (h : Heap) (input : Ref_MinHeap × Int × Int) : Configuration :=
  Algo2LeanCore.start h (Frame.fn_MinHeap_push_or_decrease 25 ({ v0 := input.1, v1 := input.2.1, v2 := input.2.2 } : State_MinHeap_push_or_decrease))
def MinHeap.push_or_decrease.Run (h : Heap) (input : Ref_MinHeap × Int × Int) (h' : Heap) (output : Unit) : Prop :=
  _root_.Algo.«indexed_heap».MinHeap.push_or_decrease.ValidInput h input ∧ Algo2LeanCore.Reaches Step (_root_.Algo.«indexed_heap».MinHeap.push_or_decrease.initial h input) (.done h' (Result.fn_MinHeap_push_or_decrease output))
def MinHeap.push_or_decrease.ValidHeapTranscript (h : Heap) (input : Ref_MinHeap × Int × Int) (trace : Transcript) : Prop :=
  _root_.Algo.«indexed_heap».MinHeap.push_or_decrease.ValidInput h input ∧ ∃ final, Algo2LeanCore.Valid Step (_root_.Algo.«indexed_heap».MinHeap.push_or_decrease.initial h input) trace final
def MinHeap.push_or_decrease.Call (h : Heap) (input : Ref_MinHeap × Int × Int) (h' : Heap) (output : Unit) : Prop :=
  _root_.Algo.«indexed_heap».MinHeap.push_or_decrease.ValidInput h input ∧ Algo2LeanCore.Summary Step h (Frame.fn_MinHeap_push_or_decrease 25 ({ v0 := input.1, v1 := input.2.1, v2 := input.2.2 } : State_MinHeap_push_or_decrease)) h' (Result.fn_MinHeap_push_or_decrease output)
-- Complete this function from the supplied local state, under any caller stack.
def MinHeap.push_or_decrease.CallFrom (state : Configuration) (finalHeap : Heap) (output : Unit) : Prop :=
  match state with
  | .active heap (Frame.fn_MinHeap_push_or_decrease pc locals) _ =>
      Algo2LeanCore.Summary Step heap (Frame.fn_MinHeap_push_or_decrease pc locals) finalHeap (Result.fn_MinHeap_push_or_decrease output)
  | _ => False
-- Object inputs carry their heap, preserving shared references and cycles.
def MinHeap.push_or_decrease.load (input : Heap × (Ref_MinHeap × Int × Int)) : Heap × (Ref_MinHeap × Int × Int) := input
def MinHeap.push_or_decrease.ValidTranscript (my_input : Heap × (Ref_MinHeap × Int × Int)) (trace : Transcript) : Prop :=
  let loaded := _root_.Algo.«indexed_heap».MinHeap.push_or_decrease.load my_input
  _root_.Algo.«indexed_heap».MinHeap.push_or_decrease.ValidHeapTranscript loaded.1 loaded.2 trace
def MinHeap.push_or_decrease.Returns (my_input : Heap × (Ref_MinHeap × Int × Int)) (my_output : Unit) : Prop :=
  let loaded := _root_.Algo.«indexed_heap».MinHeap.push_or_decrease.load my_input
  ∃ finalHeap, _root_.Algo.«indexed_heap».MinHeap.push_or_decrease.Run loaded.1 loaded.2 finalHeap my_output

-- Output and clock increments from one completed execution.
def MinHeap.push_or_decrease.ReturnsWithCost (my_input : Heap × (Ref_MinHeap × Int × Int)) (my_output : Unit) (costs : Clocks) : Prop :=
  let loaded := _root_.Algo.«indexed_heap».MinHeap.push_or_decrease.load my_input
  ∃ finalHeap, _root_.Algo.«indexed_heap».MinHeap.push_or_decrease.Run loaded.1 loaded.2 finalHeap my_output ∧ Heap.cost loaded.1 finalHeap = costs
theorem MinHeap.push_or_decrease.ReturnsWithCost.returns {input output costs}
    (run : _root_.Algo.«indexed_heap».MinHeap.push_or_decrease.ReturnsWithCost input output costs) : _root_.Algo.«indexed_heap».MinHeap.push_or_decrease.Returns input output := by
  obtain ⟨heap, execution, _⟩ := run
  exact ⟨heap, execution⟩
theorem MinHeap.push_or_decrease.Returns.withCost {input output}
    (run : _root_.Algo.«indexed_heap».MinHeap.push_or_decrease.Returns input output) : ∃ costs, _root_.Algo.«indexed_heap».MinHeap.push_or_decrease.ReturnsWithCost input output costs := by
  obtain ⟨heap, execution⟩ := run
  exact ⟨Heap.cost (_root_.Algo.«indexed_heap».MinHeap.push_or_decrease.load input).1 heap, heap, execution, rfl⟩

theorem MinHeap.push_or_decrease.Call.run {before input after output}
    (call : _root_.Algo.«indexed_heap».MinHeap.push_or_decrease.Call before input after output) :
    _root_.Algo.«indexed_heap».MinHeap.push_or_decrease.Run before input after output :=
  ⟨call.1, call.2.root⟩

def entry_MinHeap_pop_min (input : Ref_MinHeap) : Frame :=
  (Frame.fn_MinHeap_pop_min 21 ({ v0 := input } : State_MinHeap_pop_min))

def MinHeap.pop_min.ValidInput (h : Heap) (input : Ref_MinHeap) : Prop := is_MinHeap h input
def MinHeap.pop_min.initial (h : Heap) (input : Ref_MinHeap) : Configuration :=
  Algo2LeanCore.start h (Frame.fn_MinHeap_pop_min 21 ({ v0 := input } : State_MinHeap_pop_min))
def MinHeap.pop_min.Run (h : Heap) (input : Ref_MinHeap) (h' : Heap) (output : Int) : Prop :=
  _root_.Algo.«indexed_heap».MinHeap.pop_min.ValidInput h input ∧ Algo2LeanCore.Reaches Step (_root_.Algo.«indexed_heap».MinHeap.pop_min.initial h input) (.done h' (Result.fn_MinHeap_pop_min output))
def MinHeap.pop_min.ValidHeapTranscript (h : Heap) (input : Ref_MinHeap) (trace : Transcript) : Prop :=
  _root_.Algo.«indexed_heap».MinHeap.pop_min.ValidInput h input ∧ ∃ final, Algo2LeanCore.Valid Step (_root_.Algo.«indexed_heap».MinHeap.pop_min.initial h input) trace final
def MinHeap.pop_min.Call (h : Heap) (input : Ref_MinHeap) (h' : Heap) (output : Int) : Prop :=
  _root_.Algo.«indexed_heap».MinHeap.pop_min.ValidInput h input ∧ Algo2LeanCore.Summary Step h (Frame.fn_MinHeap_pop_min 21 ({ v0 := input } : State_MinHeap_pop_min)) h' (Result.fn_MinHeap_pop_min output)
-- Complete this function from the supplied local state, under any caller stack.
def MinHeap.pop_min.CallFrom (state : Configuration) (finalHeap : Heap) (output : Int) : Prop :=
  match state with
  | .active heap (Frame.fn_MinHeap_pop_min pc locals) _ =>
      Algo2LeanCore.Summary Step heap (Frame.fn_MinHeap_pop_min pc locals) finalHeap (Result.fn_MinHeap_pop_min output)
  | _ => False
-- Object inputs carry their heap, preserving shared references and cycles.
def MinHeap.pop_min.load (input : Heap × (Ref_MinHeap)) : Heap × (Ref_MinHeap) := input
def MinHeap.pop_min.ValidTranscript (my_input : Heap × (Ref_MinHeap)) (trace : Transcript) : Prop :=
  let loaded := _root_.Algo.«indexed_heap».MinHeap.pop_min.load my_input
  _root_.Algo.«indexed_heap».MinHeap.pop_min.ValidHeapTranscript loaded.1 loaded.2 trace
def MinHeap.pop_min.Returns (my_input : Heap × (Ref_MinHeap)) (my_output : Int) : Prop :=
  let loaded := _root_.Algo.«indexed_heap».MinHeap.pop_min.load my_input
  ∃ finalHeap, _root_.Algo.«indexed_heap».MinHeap.pop_min.Run loaded.1 loaded.2 finalHeap my_output

-- Output and clock increments from one completed execution.
def MinHeap.pop_min.ReturnsWithCost (my_input : Heap × (Ref_MinHeap)) (my_output : Int) (costs : Clocks) : Prop :=
  let loaded := _root_.Algo.«indexed_heap».MinHeap.pop_min.load my_input
  ∃ finalHeap, _root_.Algo.«indexed_heap».MinHeap.pop_min.Run loaded.1 loaded.2 finalHeap my_output ∧ Heap.cost loaded.1 finalHeap = costs
theorem MinHeap.pop_min.ReturnsWithCost.returns {input output costs}
    (run : _root_.Algo.«indexed_heap».MinHeap.pop_min.ReturnsWithCost input output costs) : _root_.Algo.«indexed_heap».MinHeap.pop_min.Returns input output := by
  obtain ⟨heap, execution, _⟩ := run
  exact ⟨heap, execution⟩
theorem MinHeap.pop_min.Returns.withCost {input output}
    (run : _root_.Algo.«indexed_heap».MinHeap.pop_min.Returns input output) : ∃ costs, _root_.Algo.«indexed_heap».MinHeap.pop_min.ReturnsWithCost input output costs := by
  obtain ⟨heap, execution⟩ := run
  exact ⟨Heap.cost (_root_.Algo.«indexed_heap».MinHeap.pop_min.load input).1 heap, heap, execution, rfl⟩

theorem MinHeap.pop_min.Call.run {before input after output}
    (call : _root_.Algo.«indexed_heap».MinHeap.pop_min.Call before input after output) :
    _root_.Algo.«indexed_heap».MinHeap.pop_min.Run before input after output :=
  ⟨call.1, call.2.root⟩

def entry_MinHeap_is_empty (input : Ref_MinHeap) : Frame :=
  (Frame.fn_MinHeap_is_empty 2 ({ v0 := input } : State_MinHeap_is_empty))

def MinHeap.is_empty.ValidInput (h : Heap) (input : Ref_MinHeap) : Prop := is_MinHeap h input
def MinHeap.is_empty.initial (h : Heap) (input : Ref_MinHeap) : Configuration :=
  Algo2LeanCore.start h (Frame.fn_MinHeap_is_empty 2 ({ v0 := input } : State_MinHeap_is_empty))
def MinHeap.is_empty.Run (h : Heap) (input : Ref_MinHeap) (h' : Heap) (output : Bool) : Prop :=
  _root_.Algo.«indexed_heap».MinHeap.is_empty.ValidInput h input ∧ Algo2LeanCore.Reaches Step (_root_.Algo.«indexed_heap».MinHeap.is_empty.initial h input) (.done h' (Result.fn_MinHeap_is_empty output))
def MinHeap.is_empty.ValidHeapTranscript (h : Heap) (input : Ref_MinHeap) (trace : Transcript) : Prop :=
  _root_.Algo.«indexed_heap».MinHeap.is_empty.ValidInput h input ∧ ∃ final, Algo2LeanCore.Valid Step (_root_.Algo.«indexed_heap».MinHeap.is_empty.initial h input) trace final
def MinHeap.is_empty.Call (h : Heap) (input : Ref_MinHeap) (h' : Heap) (output : Bool) : Prop :=
  _root_.Algo.«indexed_heap».MinHeap.is_empty.ValidInput h input ∧ Algo2LeanCore.Summary Step h (Frame.fn_MinHeap_is_empty 2 ({ v0 := input } : State_MinHeap_is_empty)) h' (Result.fn_MinHeap_is_empty output)
-- Complete this function from the supplied local state, under any caller stack.
def MinHeap.is_empty.CallFrom (state : Configuration) (finalHeap : Heap) (output : Bool) : Prop :=
  match state with
  | .active heap (Frame.fn_MinHeap_is_empty pc locals) _ =>
      Algo2LeanCore.Summary Step heap (Frame.fn_MinHeap_is_empty pc locals) finalHeap (Result.fn_MinHeap_is_empty output)
  | _ => False
-- Object inputs carry their heap, preserving shared references and cycles.
def MinHeap.is_empty.load (input : Heap × (Ref_MinHeap)) : Heap × (Ref_MinHeap) := input
def MinHeap.is_empty.ValidTranscript (my_input : Heap × (Ref_MinHeap)) (trace : Transcript) : Prop :=
  let loaded := _root_.Algo.«indexed_heap».MinHeap.is_empty.load my_input
  _root_.Algo.«indexed_heap».MinHeap.is_empty.ValidHeapTranscript loaded.1 loaded.2 trace
def MinHeap.is_empty.Returns (my_input : Heap × (Ref_MinHeap)) (my_output : Bool) : Prop :=
  let loaded := _root_.Algo.«indexed_heap».MinHeap.is_empty.load my_input
  ∃ finalHeap, _root_.Algo.«indexed_heap».MinHeap.is_empty.Run loaded.1 loaded.2 finalHeap my_output

-- Output and clock increments from one completed execution.
def MinHeap.is_empty.ReturnsWithCost (my_input : Heap × (Ref_MinHeap)) (my_output : Bool) (costs : Clocks) : Prop :=
  let loaded := _root_.Algo.«indexed_heap».MinHeap.is_empty.load my_input
  ∃ finalHeap, _root_.Algo.«indexed_heap».MinHeap.is_empty.Run loaded.1 loaded.2 finalHeap my_output ∧ Heap.cost loaded.1 finalHeap = costs
theorem MinHeap.is_empty.ReturnsWithCost.returns {input output costs}
    (run : _root_.Algo.«indexed_heap».MinHeap.is_empty.ReturnsWithCost input output costs) : _root_.Algo.«indexed_heap».MinHeap.is_empty.Returns input output := by
  obtain ⟨heap, execution, _⟩ := run
  exact ⟨heap, execution⟩
theorem MinHeap.is_empty.Returns.withCost {input output}
    (run : _root_.Algo.«indexed_heap».MinHeap.is_empty.Returns input output) : ∃ costs, _root_.Algo.«indexed_heap».MinHeap.is_empty.ReturnsWithCost input output costs := by
  obtain ⟨heap, execution⟩ := run
  exact ⟨Heap.cost (_root_.Algo.«indexed_heap».MinHeap.is_empty.load input).1 heap, heap, execution, rfl⟩

theorem MinHeap.is_empty.Call.run {before input after output}
    (call : _root_.Algo.«indexed_heap».MinHeap.is_empty.Call before input after output) :
    _root_.Algo.«indexed_heap».MinHeap.is_empty.Run before input after output :=
  ⟨call.1, call.2.root⟩

def entry_MinHeap (_input : Unit) : Frame :=
  (Frame.fn_MinHeap 6 ({  } : State_MinHeap))

def MinHeap.ValidInput (_h : Heap) (_input : Unit) : Prop := True
def MinHeap.initial (h : Heap) (_input : Unit) : Configuration :=
  Algo2LeanCore.start h (Frame.fn_MinHeap 6 ({  } : State_MinHeap))
def MinHeap.Run (h : Heap) (input : Unit) (h' : Heap) (output : Ref_MinHeap) : Prop :=
  _root_.Algo.«indexed_heap».MinHeap.ValidInput h input ∧ Algo2LeanCore.Reaches Step (_root_.Algo.«indexed_heap».MinHeap.initial h input) (.done h' (Result.fn_MinHeap output))
def MinHeap.ValidHeapTranscript (h : Heap) (input : Unit) (trace : Transcript) : Prop :=
  _root_.Algo.«indexed_heap».MinHeap.ValidInput h input ∧ ∃ final, Algo2LeanCore.Valid Step (_root_.Algo.«indexed_heap».MinHeap.initial h input) trace final
def MinHeap.Call (h : Heap) (input : Unit) (h' : Heap) (output : Ref_MinHeap) : Prop :=
  _root_.Algo.«indexed_heap».MinHeap.ValidInput h input ∧ Algo2LeanCore.Summary Step h (Frame.fn_MinHeap 6 ({  } : State_MinHeap)) h' (Result.fn_MinHeap output)
-- Complete this function from the supplied local state, under any caller stack.
def MinHeap.CallFrom (state : Configuration) (finalHeap : Heap) (output : Ref_MinHeap) : Prop :=
  match state with
  | .active heap (Frame.fn_MinHeap pc locals) _ =>
      Algo2LeanCore.Summary Step heap (Frame.fn_MinHeap pc locals) finalHeap (Result.fn_MinHeap output)
  | _ => False
-- The value view gives each sequence input its own object.
def MinHeap.load (_input : Unit) : Heap × (Unit) :=
  let h0 : Heap := {}
  (h0, ())
def MinHeap.ValidTranscript (my_input : Unit) (trace : Transcript) : Prop :=
  let loaded := _root_.Algo.«indexed_heap».MinHeap.load my_input
  _root_.Algo.«indexed_heap».MinHeap.ValidHeapTranscript loaded.1 loaded.2 trace
def MinHeap.Returns (my_input : Unit) (my_output : Heap × (Ref_MinHeap)) : Prop :=
  let loaded := _root_.Algo.«indexed_heap».MinHeap.load my_input
  _root_.Algo.«indexed_heap».MinHeap.Run loaded.1 loaded.2 my_output.1 my_output.2

-- Output and clock increments from one completed execution.
def MinHeap.ReturnsWithCost (my_input : Unit) (my_output : Heap × (Ref_MinHeap)) (costs : Clocks) : Prop :=
  let loaded := _root_.Algo.«indexed_heap».MinHeap.load my_input
  _root_.Algo.«indexed_heap».MinHeap.Run loaded.1 loaded.2 my_output.1 my_output.2 ∧ Heap.cost loaded.1 my_output.1 = costs
theorem MinHeap.ReturnsWithCost.returns {input output costs}
    (run : _root_.Algo.«indexed_heap».MinHeap.ReturnsWithCost input output costs) : _root_.Algo.«indexed_heap».MinHeap.Returns input output := by
  obtain ⟨execution, _⟩ := run
  exact execution
theorem MinHeap.Returns.withCost {input output}
    (run : _root_.Algo.«indexed_heap».MinHeap.Returns input output) : ∃ costs, _root_.Algo.«indexed_heap».MinHeap.ReturnsWithCost input output costs := by
  exact ⟨Heap.cost (_root_.Algo.«indexed_heap».MinHeap.load input).1 output.1, run, rfl⟩

theorem MinHeap.Call.run {before input after output}
    (call : _root_.Algo.«indexed_heap».MinHeap.Call before input after output) :
    _root_.Algo.«indexed_heap».MinHeap.Run before input after output :=
  ⟨call.1, call.2.root⟩

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