Kruskal minimum spanning forest and edge scan: generated algorithm definition
DefinitionAlgo_kruskal_GeneratedThe compiled semantics of kruskal.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.
Superseded Kruskal implementation
The earlier monolithic implementation has been replaced by a complete-algorithm wrapper and a separately callable scan after sorting.
Current entry points: Algo_kruskal_Generated_SortedRevision; Algo_kruskal_sorted_Generated.
This post is deprecated in favor of the revised implementation. Its original formal content and proofs remain available for existing imports. The linked results concern the revised implementation; their formal statements need not be identical to this one.
import Definitions.Def_Algo2LeanLib_Modules
import Definitions.Def_Algo_union_find_Generated
import Definitions.Def_Algo_sort_indices_Generated
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.«kruskal»
open _root_.Algo2LeanGenerated
-- Independently compiled module; imported algorithms keep their own transitions.
namespace Algo2LeanGenerated
abbrev Ref__a2l_import_0_UnionFind := Algo.«union_find».Algo2LeanGenerated.Ref_UnionFind
abbrev Ref__a2l_import_1_MinHeap := Algo.«indexed_heap».Algo2LeanGenerated.Ref_MinHeap
abbrev is__a2l_import_0_UnionFind := Algo.«union_find».Algo2LeanGenerated.is_UnionFind
abbrev create__a2l_import_0_UnionFind := Algo.«union_find».Algo2LeanGenerated.create_UnionFind
abbrev field__a2l_import_0_UnionFind_parent := Algo.«union_find».Algo2LeanGenerated.field_UnionFind_parent
abbrev set__a2l_import_0_UnionFind_parent := Algo.«union_find».Algo2LeanGenerated.set_UnionFind_parent
abbrev field__a2l_import_0_UnionFind_rank := Algo.«union_find».Algo2LeanGenerated.field_UnionFind_rank
abbrev set__a2l_import_0_UnionFind_rank := Algo.«union_find».Algo2LeanGenerated.set_UnionFind_rank
abbrev field__a2l_import_0_UnionFind_size := Algo.«union_find».Algo2LeanGenerated.field_UnionFind_size
abbrev set__a2l_import_0_UnionFind_size := Algo.«union_find».Algo2LeanGenerated.set_UnionFind_size
abbrev is__a2l_import_1_MinHeap := Algo.«indexed_heap».Algo2LeanGenerated.is_MinHeap
abbrev create__a2l_import_1_MinHeap := Algo.«indexed_heap».Algo2LeanGenerated.create_MinHeap
abbrev field__a2l_import_1_MinHeap_vertices := Algo.«indexed_heap».Algo2LeanGenerated.field_MinHeap_vertices
abbrev set__a2l_import_1_MinHeap_vertices := Algo.«indexed_heap».Algo2LeanGenerated.set_MinHeap_vertices
abbrev field__a2l_import_1_MinHeap_positions := Algo.«indexed_heap».Algo2LeanGenerated.field_MinHeap_positions
abbrev set__a2l_import_1_MinHeap_positions := Algo.«indexed_heap».Algo2LeanGenerated.set_MinHeap_positions
abbrev field__a2l_import_1_MinHeap_keys := Algo.«indexed_heap».Algo2LeanGenerated.field_MinHeap_keys
abbrev set__a2l_import_1_MinHeap_keys := Algo.«indexed_heap».Algo2LeanGenerated.set_MinHeap_keys
abbrev field__a2l_import_1_MinHeap_size := Algo.«indexed_heap».Algo2LeanGenerated.field_MinHeap_size
abbrev set__a2l_import_1_MinHeap_size := Algo.«indexed_heap».Algo2LeanGenerated.set_MinHeap_size
structure State_kruskal where
v0 : Int := 0 -- size
v1 : SeqRef := 0 -- sources
v2 : SeqRef := 0 -- targets
v3 : SeqRef := 0 -- weights
v4 : Int := 0 -- count
v5 : SeqRef := 0 -- chosen
v6 : Ref__a2l_import_0_UnionFind := 0 -- sets
v7 : SeqRef := 0 -- order
v8 : Int := 0 -- index
v9 : Int := 0 -- edge
v10 : Int := 0 -- a
v11 : Int := 0 -- b
v12 : Int := 0 -- left
v13 : Int := 0 -- right
t14 : SeqRef := 0 -- temporary
t15 : Bool := false -- temporary
t16 : Bool := false -- temporary
t17 : Bool := false -- temporary
t18 : Ref__a2l_import_0_UnionFind := 0 -- temporary
t19 : Int := 0 -- temporary
t20 : Int := 0 -- temporary
t21 : Int := 0 -- temporary
t22 : Ref__a2l_import_0_UnionFind := 0 -- temporary
t23 : Int := 0 -- temporary
t24 : Int := 0 -- temporary
t25 : Ref__a2l_import_0_UnionFind := 0 -- temporary
t26 : Int := 0 -- temporary
t27 : SeqRef := 0 -- temporary
t28 : SeqRef := 0 -- temporary
t29 : Int := 0 -- temporary
t30 : Ref__a2l_import_0_UnionFind := 0 -- temporary
t31 : Int := 0 -- temporary
t32 : SeqRef := 0 -- temporary
t33 : Int := 0 -- temporary
inductive Frame where
| invalid
| fn_kruskal (pc : Nat) (state : State_kruskal)
| import_0 (frame : Algo.«union_find».Algo2LeanGenerated.Frame) (inner : Algo.«union_find».Algo2LeanGenerated.Stack) (resume : Algo.«union_find».Algo2LeanGenerated.Result → Frame)
| import_2 (frame : Algo.«sort_indices».Algo2LeanGenerated.Frame) (inner : Algo.«sort_indices».Algo2LeanGenerated.Stack) (resume : Algo.«sort_indices».Algo2LeanGenerated.Result → Frame)
inductive Result where
| fn_kruskal (value : SeqRef)
abbrev Configuration := Algo2LeanCore.Config Heap (Frame) Result
abbrev Stack := Algo2LeanCore.Stack (Frame) Result
abbrev Transcript := List (Configuration)
inductive Step : Configuration → Configuration → Prop where
| kruskal_pc1 (h : Heap) (s : State_kruskal) (stack : Stack) (defined : s.t14 < h.nextRef) :
Step (.active h (Frame.fn_kruskal 1 s) stack) (Algo2LeanCore.resumeConfig h (Result.fn_kruskal (s.t14)) stack)
| kruskal_pc2 (h : Heap) (s : State_kruskal) (stack : Stack) :
Step (.active h (Frame.fn_kruskal 2 s) stack) (.active h (Frame.fn_kruskal 1 { s with t14 := s.v5 }) stack)
| kruskal_pc3_true (h : Heap) (s : State_kruskal) (stack : Stack) (condition : s.t15 = true) :
Step (.active h (Frame.fn_kruskal 3 s) stack) (.active h (Frame.fn_kruskal 27 s) stack)
| kruskal_pc3_false (h : Heap) (s : State_kruskal) (stack : Stack) (condition : s.t15 = false) :
Step (.active h (Frame.fn_kruskal 3 s) stack) (.active h (Frame.fn_kruskal 2 s) stack)
| kruskal_pc4 (h : Heap) (s : State_kruskal) (stack : Stack) :
Step (.active h (Frame.fn_kruskal 4 s) stack) (.active h (Frame.fn_kruskal 3 { s with t15 := (decide ((s.v8 < s.v4))) }) stack)
| kruskal_pc5 (h : Heap) (s : State_kruskal) (stack : Stack) :
Step (.active h (Frame.fn_kruskal 5 s) stack) (.active h (Frame.fn_kruskal 4 { s with v8 := (s.v8 + (1 : Int)) }) stack)
| kruskal_pc6 (h : Heap) (s : State_kruskal) (stack : Stack) :
Step (.active h (Frame.fn_kruskal 6 s) stack) (.active h (Frame.import_0 (Algo.«union_find».entry_UnionFind_union ((s.t18), s.t19, s.t20)) [] (fun value => match value with | .fn_UnionFind_union result => (Frame.fn_kruskal 5 { s with t17 := result }) | _ => .invalid)) stack)
| kruskal_pc7 (h : Heap) (s : State_kruskal) (stack : Stack) :
Step (.active h (Frame.fn_kruskal 7 s) stack) (.active h (Frame.fn_kruskal 6 { s with t20 := s.v11 }) stack)
| kruskal_pc8 (h : Heap) (s : State_kruskal) (stack : Stack) :
Step (.active h (Frame.fn_kruskal 8 s) stack) (.active h (Frame.fn_kruskal 7 { s with t19 := s.v10 }) stack)
| kruskal_pc9 (h : Heap) (s : State_kruskal) (stack : Stack) (defined : (is__a2l_import_0_UnionFind h (s.t18))) :
Step (.active h (Frame.fn_kruskal 9 s) stack) (.active h (Frame.fn_kruskal 8 { s with t18 := s.t18 }) stack)
| kruskal_pc10 (h : Heap) (s : State_kruskal) (stack : Stack) :
Step (.active h (Frame.fn_kruskal 10 s) stack) (.active h (Frame.fn_kruskal 9 { s with t18 := s.v6 }) stack)
| kruskal_pc11 (h : Heap) (s : State_kruskal) (stack : Stack) (defined : s.v5 < h.nextRef) :
Step (.active h (Frame.fn_kruskal 11 s) stack) (.active (h.write s.v5 s.v9 (1 : Int)) (Frame.fn_kruskal 10 s) stack)
| kruskal_pc12_true (h : Heap) (s : State_kruskal) (stack : Stack) (condition : s.t16 = true) :
Step (.active h (Frame.fn_kruskal 12 s) stack) (.active h (Frame.fn_kruskal 11 s) stack)
| kruskal_pc12_false (h : Heap) (s : State_kruskal) (stack : Stack) (condition : s.t16 = false) :
Step (.active h (Frame.fn_kruskal 12 s) stack) (.active h (Frame.fn_kruskal 5 s) stack)
| kruskal_pc13 (h : Heap) (s : State_kruskal) (stack : Stack) :
Step (.active h (Frame.fn_kruskal 13 s) stack) (.active h (Frame.fn_kruskal 12 { s with t16 := (decide ((s.v12 ≠ s.v13))) }) stack)
| kruskal_pc14 (h : Heap) (s : State_kruskal) (stack : Stack) :
Step (.active h (Frame.fn_kruskal 14 s) stack) (.active h (Frame.fn_kruskal 13 { s with v13 := s.t21 }) stack)
| kruskal_pc15 (h : Heap) (s : State_kruskal) (stack : Stack) :
Step (.active h (Frame.fn_kruskal 15 s) stack) (.active h (Frame.import_0 (Algo.«union_find».entry_UnionFind_find ((s.t22), s.t23)) [] (fun value => match value with | .fn_UnionFind_find result => (Frame.fn_kruskal 14 { s with t21 := result }) | _ => .invalid)) stack)
| kruskal_pc16 (h : Heap) (s : State_kruskal) (stack : Stack) :
Step (.active h (Frame.fn_kruskal 16 s) stack) (.active h (Frame.fn_kruskal 15 { s with t23 := s.v11 }) stack)
| kruskal_pc17 (h : Heap) (s : State_kruskal) (stack : Stack) (defined : (is__a2l_import_0_UnionFind h (s.t22))) :
Step (.active h (Frame.fn_kruskal 17 s) stack) (.active h (Frame.fn_kruskal 16 { s with t22 := s.t22 }) stack)
| kruskal_pc18 (h : Heap) (s : State_kruskal) (stack : Stack) :
Step (.active h (Frame.fn_kruskal 18 s) stack) (.active h (Frame.fn_kruskal 17 { s with t22 := s.v6 }) stack)
| kruskal_pc19 (h : Heap) (s : State_kruskal) (stack : Stack) :
Step (.active h (Frame.fn_kruskal 19 s) stack) (.active h (Frame.fn_kruskal 18 { s with v12 := s.t24 }) stack)
| kruskal_pc20 (h : Heap) (s : State_kruskal) (stack : Stack) :
Step (.active h (Frame.fn_kruskal 20 s) stack) (.active h (Frame.import_0 (Algo.«union_find».entry_UnionFind_find ((s.t25), s.t26)) [] (fun value => match value with | .fn_UnionFind_find result => (Frame.fn_kruskal 19 { s with t24 := result }) | _ => .invalid)) stack)
| kruskal_pc21 (h : Heap) (s : State_kruskal) (stack : Stack) :
Step (.active h (Frame.fn_kruskal 21 s) stack) (.active h (Frame.fn_kruskal 20 { s with t26 := s.v10 }) stack)
| kruskal_pc22 (h : Heap) (s : State_kruskal) (stack : Stack) (defined : (is__a2l_import_0_UnionFind h (s.t25))) :
Step (.active h (Frame.fn_kruskal 22 s) stack) (.active h (Frame.fn_kruskal 21 { s with t25 := s.t25 }) stack)
| kruskal_pc23 (h : Heap) (s : State_kruskal) (stack : Stack) :
Step (.active h (Frame.fn_kruskal 23 s) stack) (.active h (Frame.fn_kruskal 22 { s with t25 := s.v6 }) stack)
| kruskal_pc24 (h : Heap) (s : State_kruskal) (stack : Stack) :
Step (.active h (Frame.fn_kruskal 24 s) stack) (.active (h.tick "kruskal" 1) (Frame.fn_kruskal 23 s) stack)
| kruskal_pc25 (h : Heap) (s : State_kruskal) (stack : Stack) (defined : (s.v2 < h.nextRef)) :
Step (.active h (Frame.fn_kruskal 25 s) stack) (.active h (Frame.fn_kruskal 24 { s with v11 := (h.read s.v2 s.v9) }) stack)
| kruskal_pc26 (h : Heap) (s : State_kruskal) (stack : Stack) (defined : (s.v1 < h.nextRef)) :
Step (.active h (Frame.fn_kruskal 26 s) stack) (.active h (Frame.fn_kruskal 25 { s with v10 := (h.read s.v1 s.v9) }) stack)
| kruskal_pc27 (h : Heap) (s : State_kruskal) (stack : Stack) (defined : (s.v7 < h.nextRef)) :
Step (.active h (Frame.fn_kruskal 27 s) stack) (.active h (Frame.fn_kruskal 26 { s with v9 := (h.read s.v7 s.v8) }) stack)
| kruskal_pc28 (h : Heap) (s : State_kruskal) (stack : Stack) :
Step (.active h (Frame.fn_kruskal 28 s) stack) (.active (h.tick "kruskal" 1) (Frame.fn_kruskal 4 s) stack)
| kruskal_pc29 (h : Heap) (s : State_kruskal) (stack : Stack) :
Step (.active h (Frame.fn_kruskal 29 s) stack) (.active h (Frame.fn_kruskal 28 { s with v8 := (0 : Int) }) stack)
| kruskal_pc30 (h : Heap) (s : State_kruskal) (stack : Stack) :
Step (.active h (Frame.fn_kruskal 30 s) stack) (.active h (Frame.fn_kruskal 29 { s with v7 := s.t27 }) stack)
| kruskal_pc31 (h : Heap) (s : State_kruskal) (stack : Stack) :
Step (.active h (Frame.fn_kruskal 31 s) stack) (.active h (Frame.import_2 (Algo.«sort_indices».entry_sort_indices (s.t28, s.t29)) [] (fun value => match value with | .fn_sort_indices result => (Frame.fn_kruskal 30 { s with t27 := result }))) stack)
| kruskal_pc32 (h : Heap) (s : State_kruskal) (stack : Stack) :
Step (.active h (Frame.fn_kruskal 32 s) stack) (.active h (Frame.fn_kruskal 31 { s with t29 := s.v4 }) stack)
| kruskal_pc33 (h : Heap) (s : State_kruskal) (stack : Stack) :
Step (.active h (Frame.fn_kruskal 33 s) stack) (.active h (Frame.fn_kruskal 32 { s with t28 := s.v3 }) stack)
| kruskal_pc34 (h : Heap) (s : State_kruskal) (stack : Stack) :
Step (.active h (Frame.fn_kruskal 34 s) stack) (.active h (Frame.fn_kruskal 33 { s with v6 := s.t30 }) stack)
| kruskal_pc35 (h : Heap) (s : State_kruskal) (stack : Stack) :
Step (.active h (Frame.fn_kruskal 35 s) stack) (.active h (Frame.import_0 (Algo.«union_find».entry_UnionFind s.t31) [] (fun value => match value with | .fn_UnionFind result => (Frame.fn_kruskal 34 { s with t30 := result }) | _ => .invalid)) stack)
| kruskal_pc36 (h : Heap) (s : State_kruskal) (stack : Stack) :
Step (.active h (Frame.fn_kruskal 36 s) stack) (.active h (Frame.fn_kruskal 35 { s with t31 := s.v0 }) stack)
| kruskal_pc37 (h : Heap) (s : State_kruskal) (stack : Stack) :
Step (.active h (Frame.fn_kruskal 37 s) stack) (.active h (Frame.fn_kruskal 36 { s with v5 := s.t32 }) stack)
| kruskal_pc38 (h : Heap) (s : State_kruskal) (stack : Stack) :
Step (.active h (Frame.fn_kruskal 38 s) stack) (.active (h.allocate (fun _ => s.t33)) (Frame.fn_kruskal 37 { s with t32 := h.nextRef }) stack)
| kruskal_pc39 (h : Heap) (s : State_kruskal) (stack : Stack) :
Step (.active h (Frame.fn_kruskal 39 s) stack) (.active h (Frame.fn_kruskal 38 { s with t33 := (0 : Int) }) stack)
| import_0 (h : Heap) (frame : Algo.«union_find».Algo2LeanGenerated.Frame) (inner : Algo.«union_find».Algo2LeanGenerated.Stack)
(resume : Algo.«union_find».Algo2LeanGenerated.Result → Frame) (caller : Stack) (after : Algo.«union_find».Algo2LeanGenerated.Configuration)
(transition : Algo.«union_find».Algo2LeanGenerated.Step (.active h frame inner) after) :
Step (.active h (Frame.import_0 frame inner resume) caller)
(Algo2LeanCore.ModuleCall.config Frame.import_0 resume caller after)
| import_2 (h : Heap) (frame : Algo.«sort_indices».Algo2LeanGenerated.Frame) (inner : Algo.«sort_indices».Algo2LeanGenerated.Stack)
(resume : Algo.«sort_indices».Algo2LeanGenerated.Result → Frame) (caller : Stack) (after : Algo.«sort_indices».Algo2LeanGenerated.Configuration)
(transition : Algo.«sort_indices».Algo2LeanGenerated.Step (.active h frame inner) after) :
Step (.active h (Frame.import_2 frame inner resume) caller)
(Algo2LeanCore.ModuleCall.config Frame.import_2 resume caller after)
theorem terminal (h : Heap) (result : Result) :
Algo2LeanCore.Terminal Step (.done h result) := by
intro next transition
cases transition
theorem import_0_simulates :
Algo2LeanCore.ModuleCall.Simulates Frame.import_0 Algo.«union_find».Algo2LeanGenerated.Step Step := by
apply Algo2LeanCore.ModuleCall.Delegates.simulates
· exact Step.import_0
· exact Algo.«union_find».Algo2LeanGenerated.terminal
theorem import_2_simulates :
Algo2LeanCore.ModuleCall.Simulates Frame.import_2 Algo.«sort_indices».Algo2LeanGenerated.Step Step := by
apply Algo2LeanCore.ModuleCall.Delegates.simulates
· exact Step.import_2
· exact Algo.«sort_indices».Algo2LeanGenerated.terminal
end Algo2LeanGenerated
open Algo2LeanGenerated
def entry_kruskal (input : Int × SeqRef × SeqRef × SeqRef × Int) : Frame :=
(Frame.fn_kruskal 39 ({ v0 := input.1, v1 := input.2.1, v2 := input.2.2.1, v3 := input.2.2.2.1, v4 := input.2.2.2.2 } : State_kruskal))
def kruskal.ValidInput (h : Heap) (input : Int × SeqRef × SeqRef × SeqRef × Int) : Prop := input.2.1 < h.nextRef ∧ input.2.2.1 < h.nextRef ∧ input.2.2.2.1 < h.nextRef
def kruskal.initial (h : Heap) (input : Int × SeqRef × SeqRef × SeqRef × Int) : Configuration :=
Algo2LeanCore.start h (Frame.fn_kruskal 39 ({ v0 := input.1, v1 := input.2.1, v2 := input.2.2.1, v3 := input.2.2.2.1, v4 := input.2.2.2.2 } : State_kruskal))
def kruskal.Run (h : Heap) (input : Int × SeqRef × SeqRef × SeqRef × Int) (h' : Heap) (output : SeqRef) : Prop :=
_root_.Algo.«kruskal».kruskal.ValidInput h input ∧ Algo2LeanCore.Reaches Step (_root_.Algo.«kruskal».kruskal.initial h input) (.done h' (Result.fn_kruskal output))
def kruskal.ValidHeapTranscript (h : Heap) (input : Int × SeqRef × SeqRef × SeqRef × Int) (trace : Transcript) : Prop :=
_root_.Algo.«kruskal».kruskal.ValidInput h input ∧ ∃ final, Algo2LeanCore.Valid Step (_root_.Algo.«kruskal».kruskal.initial h input) trace final
def kruskal.Call (h : Heap) (input : Int × SeqRef × SeqRef × SeqRef × Int) (h' : Heap) (output : SeqRef) : Prop :=
_root_.Algo.«kruskal».kruskal.ValidInput h input ∧ Algo2LeanCore.Summary Step h (Frame.fn_kruskal 39 ({ v0 := input.1, v1 := input.2.1, v2 := input.2.2.1, v3 := input.2.2.2.1, v4 := input.2.2.2.2 } : State_kruskal)) h' (Result.fn_kruskal output)
-- Complete this function from the supplied local state, under any caller stack.
def kruskal.CallFrom (state : Configuration) (finalHeap : Heap) (output : SeqRef) : Prop :=
match state with
| .active heap (Frame.fn_kruskal pc locals) _ =>
Algo2LeanCore.Summary Step heap (Frame.fn_kruskal pc locals) finalHeap (Result.fn_kruskal output)
| _ => False
-- The value view gives each sequence input its own object.
def kruskal.load (input : Int × Seq × Seq × Seq × Int) : Heap × (Int × SeqRef × SeqRef × SeqRef × Int) :=
let h0 : Heap := {}
let h1 := h0.allocate input.2.1
let h2 := h1.allocate input.2.2.1
let h3 := h2.allocate input.2.2.2.1
(h3, (input.1, (0 : SeqRef), (1 : SeqRef), (2 : SeqRef), input.2.2.2.2))
def kruskal.ValidTranscript (my_input : Int × Seq × Seq × Seq × Int) (trace : Transcript) : Prop :=
let loaded := _root_.Algo.«kruskal».kruskal.load my_input
_root_.Algo.«kruskal».kruskal.ValidHeapTranscript loaded.1 loaded.2 trace
def kruskal.Returns (my_input : Int × Seq × Seq × Seq × Int) (my_output : Seq) : Prop :=
let loaded := _root_.Algo.«kruskal».kruskal.load my_input
∃ finalHeap result, _root_.Algo.«kruskal».kruskal.Run loaded.1 loaded.2 finalHeap result ∧ finalHeap.store result = my_output
-- Output and clock increments from one completed execution.
def kruskal.ReturnsWithCost (my_input : Int × Seq × Seq × Seq × Int) (my_output : Seq) (costs : Clocks) : Prop :=
let loaded := _root_.Algo.«kruskal».kruskal.load my_input
∃ finalHeap result, _root_.Algo.«kruskal».kruskal.Run loaded.1 loaded.2 finalHeap result ∧ finalHeap.store result = my_output ∧ Heap.cost loaded.1 finalHeap = costs
theorem kruskal.ReturnsWithCost.returns {input output costs}
(run : _root_.Algo.«kruskal».kruskal.ReturnsWithCost input output costs) : _root_.Algo.«kruskal».kruskal.Returns input output := by
obtain ⟨heap, result, execution, value, _⟩ := run
exact ⟨heap, result, execution, value⟩
theorem kruskal.Returns.withCost {input output}
(run : _root_.Algo.«kruskal».kruskal.Returns input output) : ∃ costs, _root_.Algo.«kruskal».kruskal.ReturnsWithCost input output costs := by
obtain ⟨heap, result, execution, value⟩ := run
exact ⟨Heap.cost (_root_.Algo.«kruskal».kruskal.load input).1 heap, heap, result, execution, value, rfl⟩
theorem kruskal.Call.run {before input after output}
(call : _root_.Algo.«kruskal».kruskal.Call before input after output) :
_root_.Algo.«kruskal».kruskal.Run before input after output :=
⟨call.1, call.2.root⟩
end Algo.«kruskal»