Two-Colour Zig-Zag Numberlink on Rectangles: A Forbidden-Pattern Characterization, a Constructive Polynomial-Time Algorithm, and a Lean Verification

Get email updates

Z. Zzyzek

Zzyzek reports a polynomial-time algorithm that decides whether two specified pairs of terminals in a rectangular grid can be joined by disjoint paths covering every cell, and constructs the paths when they exist. For rectangles with both sides at least 11, a finite list of obstructions characterizes solvability. For a shorter side at most 10, the algorithm uses frontier dynamic programming.

What was already known

The single-pair rectangle case is a Hamiltonian path problem solved by Itai, Papadimitriou and Szwarcfiter. Adcock and collaborators proved NP-completeness with an unbounded number of pairs. This work gives the two-pair full-cover case with terminals anywhere in a rectangle.

AI involvement AI-led

Zzyzek supplied the task and guidance and credits Claude Opus 5.5 with nearly all project work, including the mathematical argument, manuscript, implementations and formal proof.

Importance Notable

A characterization and constructive polynomial-time algorithm settle the arbitrary-terminal two-pair problem for rectangles.

Technical verification Formal (Lean)

The pinned Lean package reports kernel checking of the obstruction test, the timed decision procedure, the sound and complete timed construction, and the finite case certificates.

Formal checking

The pinned Lean package reports kernel checking of the obstruction test, the timed decision procedure, the sound and complete timed construction, and the finite case certificates.

Checker
Z. Zzyzek, reporting Lean 4 verification
Scope
ZZN.T.solvableBT_main, ZZN.T.fires3T_iff_solvable, ZZN.T.solveZZNT_main, and the finite slice and window certificates at the cited commit
Basis
Reported by the linked checker

Human understanding Few

The project explains the algorithm and proof in material attributed to Claude. A human explanation of the central reasoning is undocumented.

Correction and publication history