Construction and formal verification of a special topology on {\mathbb{Z}}^{n}: characterization of connected subsets
Problem 5712 of the American Mathematical Monthly asks whether the integers carry a topology whose connected subsets are exactly the sets of consecutive integers. The question generalizes to Z^n, where consecutiveness becomes accessibility by finite paths of unit lattice steps.
A basis is defined on Z^n by parity of the coordinate sum: points with an even sum get the point plus its unit neighbors as a neighborhood, and points with an odd sum get a singleton. The proof shows this is a basis and that subspace connectedness is equivalent to path accessibility, and derives the integer case as a corollary. The argument is verified in Lean 4/Mathlib, with Z^n represented as Fin n → ℤ and paths encoded through Relation.EqvGen and ReflTransGen. IsPreconnected is used instead of IsConnected so that the empty set is handled correctly.
The general theorem for Z^n and the integer-interval corollary, including the formulas for the basic neighborhoods, compile in Lean 4.36.0-rc1 with Mathlib. The build has no errors, sorry, or new axioms.
