Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Introduction and THEOREM, p. 11 — Warshall's construction M∗M^*M∗ equals M∨M2∨⋯∨MdM \vee M^2 \vee \cdots \vee M^dM∨M2∨⋯∨Md

Proved
WarshallBool.Closure.warshall_eq_powerSum

by mikedeng1 · Oct 6, 2026 · Mathlib 0df444a (Lean v4.33.1)

boolean-matricesp2o-batch-pfp2ap2o-gran-per-chapterp2o-plan-paperp2o-v1transitive-closurewarshall-algorithm

Let M=(mij)M = (m_{ij})M=(mij​) be a d×dd \times dd×d matrix each of whose entries is 000 or 111. Warshall's construction produces a matrix M∗M^*M∗ as follows: set M∗=MM^* = MM∗=M; then for i=1,2,…,di = 1, 2, \dots, di=1,2,…,d in turn, for every row jjj with mji∗=1m^*_{ji} = 1mji∗​=1 and every column kkk, set mjk∗=mjk∗∨mik∗m^*_{jk} = m^*_{jk} \vee m^*_{ik}mjk∗​=mjk∗​∨mik∗​.

Let M1=MM^1 = MM1=M and Mp+1=Mp∧MM^{p+1} = M^p \wedge MMp+1=Mp∧M be the boolean powers of MMM, where the boolean product is (A∧B)ij=⋁k(aik∧bkj)(A \wedge B)_{ij} = \bigvee_k (a_{ik} \wedge b_{kj})(A∧B)ij​=⋁k​(aik​∧bkj​). Then

M∗  =  ⋁p=1dMp  =  M∨M2∨⋯∨Md,M^* \;=\; \bigvee_{p=1}^{d} M^p \;=\; M \vee M^2 \vee \cdots \vee M^d ,M∗=p=1⋁d​Mp=M∨M2∨⋯∨Md,

the boolean sum being taken entrywise.

This is the claim Warshall's note sets out to establish: the introduction poses the problem of transforming MMM into M′=⋁i=1dMiM' = \bigvee_{i=1}^d M^iM′=⋁i=1d​Mi, the THEOREM asserts M∗=M′M^* = M'M∗=M′ for the chain definition of M′M'M′, and footnote 2 identifies the two definitions. It shows that the ddd-pass construction, with on the order of d2d^2d2 row operations, computes the transitive closure that the power sum computes with ddd boolean matrix products.

Formalization Note Matrices are functions Fin d→Fin d→Bool\mathrm{Fin}\,d \to \mathrm{Fin}\,d \to \mathrm{Bool}Find→Find→Bool with 111 as true, indexed 0,…,d−10, \dots, d-10,…,d−1. M∗M^*M∗ is the published definition FloydAlgorithms.ShortestPath.algorithm96 (Floyd's Algorithm 96 is Warshall's construction, with the inner loops over jjj and kkk in ascending order, which does not change the result). The power sum runs over p∈{1,…,d}p \in \{1, \dots, d\}p∈{1,…,d} with the page's exponents; no identity matrix (reflexive closure) is included. The boolean product is defined by "there exists kkk", not by Mathlib's matrix product over Bool, whose addition is exclusive or. The case d=0d = 0d=0 is allowed and is trivial.

Preamble
import Mathlib
import Definitions.Def_FloydAlgorithms_ShortestPath_Algorithm96
import Definitions.Def_WarshallBool_Closure_Setting
Formal statement
namespace WarshallBool.Closure

/-- Warshall (1962), p. 11, introduction display with the THEOREM ("We assert M* = M′") and
footnote 2: Warshall's construction `M*` (steps 0–4) equals `M ∨ M^2 ∨ ⋯ ∨ M^d`. -/
theorem warshall_eq_powerSum {d : ℕ} (M : Fin d → Fin d → Bool) :
    FloydAlgorithms.ShortestPath.algorithm96 M = powerSum M := by sorry

end WarshallBool.Closure
Source
Warshall, A theorem on Boolean matrices, J. ACM 9 (1962), p. 11, introduction (display M′ = ∨_{i=1}^d M^i), THEOREM ('We assert M* = M′') and footnote 2
Human review
  • Endorsed by Shuze Chen · Oct 6, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 6, 2026

    Confirmed by the mission captain (proposal self-audit).

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