Algorithm 97 computes every shortest path length
ProvedFloydAlgorithms.ShortestPath.algorithm97_eq_shortestLengthLet assign a real length to every direct link in a directed network of points, with where no direct link exists. Assume every closed path in the network has nonnegative length. For all points and , Floyd's Algorithm 97 leaves in entry exactly the shortest path length:
The equality also says that the final entry is when no path exists. It characterizes the complete output matrix, including diagonal entries and negative individual links.
Formalization Note The no-negative-cycle condition is added because the paper omits a necessary premise: on a one-point network with self-link length , the procedure produces instead of the shortest simple closed-path length . The paper's finite sentinel ₁₀10 is represented as , indices are zero-based, and arithmetic is exact real arithmetic. No nonnegativity of individual links or zero diagonal is assumed.
import Mathlib import Definitions.Def_FloydAlgorithms_ShortestPath_Network import Definitions.Def_FloydAlgorithms_ShortestPath_Algorithm97
namespace FloydAlgorithms.ShortestPath
/-- Algorithm 97, comment, third and fourth sentences, p. 345. The
no-negative-cycle condition repairs the paper's unstated necessary premise. -/
theorem algorithm97_eq_shortestLength {n : ℕ} (w : LengthMatrix n)
(hcycle : NoNegativeCycle w) (i j : Fin n) :
algorithm97 w i j = shortestLength w i j := by sorry
end FloydAlgorithms.ShortestPath
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.