Kruskal's algorithm sorts all edges in non-decreasing order of their weights.
Starting from the empty forest , it scans the edges in this order.
Whenever the current edge connects two different connected components of the current forest, the edge is added.
If the current edge would create a cycle, it is skipped.
The algorithm stops when edges have been added.
The resulting graph is a minimum spanning tree.
For each , the partition is the partition of into the connected components of the forest .
Therefore,
if and only if the two endpoints and of belong to different connected components of .
As increases, the forest gains more edges. Hence connected components can only merge; they never split. Therefore, once and become contained in the same connected component, they remain in the same connected component for all later forests.
Thus, the sequence of truth values of the condition has the following form:
Since , every edge has endpoints in different connected components of . Hence
Since is a spanning tree, all vertices are in one connected component. Hence
Therefore the following maximum
is well-defined and satisfies
Then, by the monotonicity of connected components, we have