\documentclass[11pt,letterpaper]{article} \usepackage[T1]{fontenc} \usepackage{lmodern} \setlength{\emergencystretch}{2em} \usepackage{amsmath,amssymb,amsthm,graphicx,lineno} \usepackage[hidelinks]{hyperref} \newtheorem{theorem}{Theorem} \newtheorem{lemma}[theorem]{Lemma} \newcommand{\vc}{\operatorname{vc}} \title{Covering the Edges of an Induced Grid Graph with Boundaries of Side-Two Squares} % Author order and correspondence supplied by the corresponding author. \author{Mingxuan Wu\thanks{Corresponding author: \texttt{2059515536@qq.com}.} \and Yijun Pan} \date{} \begin{document} \maketitle \begin{abstract} Given a finite unit grid graph and an integer $K$, can its edge set be expressed as the union of the boundaries of exactly $K$ distinct axis-aligned squares of side two? We prove NP-completeness even for induced grid graphs in which every edge belongs to a legal square. In a staggered square tiling, shared boundary edges impose pairwise covering constraints. Once forced squares are selected, these constraints form an odd subdivision of a cubic planar vertex-cover instance. Starting from the unit-step traces of a plane orthogonal drawing, we verify in Lean~4 the equivalence of the decision instances, the inducedness of the output, bounds on its size and coordinates, and the correctness of a certificate verifier. \end{abstract} \linenumbers \section{Problem and Main Result} Shiota asked the complexity of geometric graph covering in the open problems session of CCCG 2025 \cite{shiota}. A square is specified by its integer lower left corner; its boundary consists of eight unit edges. Its eight boundary vertices induce an eight-cycle in the unit grid. Squares may overlap. We take the selected squares to be distinct. Section~\ref{sec:budgets} also treats the convention in which a placement can be counted repeatedly. The input lists vertices and edges explicitly and gives the budget in binary. \begin{theorem}\label{thm:main} Deciding whether exactly $K$ squares cover the entire edge set, with no extra edges, is NP-complete, even for vertex-induced subgraphs of the integer grid in which every edge belongs to a legal square. \end{theorem} Write $m$ for the number of input edge records. For a legal square with lower left corner $(x,y)$, the horizontal edge from $(x,y)$ to $(x+1,y)$ occurs in the input. Distinct corners give distinct such edges. Thus a feasible budget satisfies $0\le K\le m$, and a witness can list $K$ input indices, using $O(K\log(m+1))$ bits for nonempty inputs. Decode each index as the lower or left endpoint of its unit edge. Check that the $K$ resulting corners are distinct and that the list of their $8K$ boundary edges and the input edge list contain each other. An accepting witness gives exactly the required squares. Conversely, the bottom horizontal edge of each selected square supplies a witness index. Mutual containment treats repeated input records correctly. When $K=0$ the witness is empty and accepts precisely when the edge list is empty. The verifier first rejects out-of-range budgets and malformed witnesses. On a bounded witness, pairwise distinctness and the two containment scans together use at most $K^2+16Km\le17m^2$ equality tests between corners or between edges. Decoding by a linear scan for each index also takes polynomial time. Coordinates in the scans differ from input coordinates by at most two in each component, so binary arithmetic and comparisons take polynomial bit time. This proves membership in NP. Iwama, Miyano and Ono \cite{borders} study spreadsheet border drawing, allowing styles on rectangles of variable size, including a clearing operation in their Theorem~4. Kundu et al.\ \cite{rectangles} study covering points by rectangular boundaries of variable dimensions. Here the size is fixed, and every unit edge of every chosen boundary must itself be present. For the graph embedding we use the odd-subdivision approach of Bringmann, Cabello and Emmerich \cite[Lemma~3.1]{triangular}; our additional geometric constraints make that embedding realizable as a system of square-covering constraints. \section{Shared Boundaries Encode Vertex Cover} Use triangular-lattice coordinates with basis vectors at $60^\circ$. Denote the triangular lattice by $T$ and number the six neighbor directions in cyclic order as \[ (1,0),\ (0,1),\ (-1,1),\ (-1,0),\ (0,-1),\ (1,-1). \] Let $N(p)$ be the open neighborhood of $p$, and let $N[A]$ denote $A$ together with all its neighbors. At each index $p=(i,j)$ place a square $B_p$ at lower left corner $(2i+j,2j)$ in the orthogonal grid. For finite $S\subset T$, let $G(S)$ consist of all boundary edges of the $B_p$, $p\in S$, and their endpoints. \begin{figure}[ht]\centering \includegraphics[width=.38\linewidth]{brick.png} \caption{The central square shares its boundary with six neighbors. Dots indicate its eight boundary vertices.} \end{figure} \begin{lemma}\label{lem:bricks} The legal squares in $G(S)$ have index set $C=S\cup\{p:N(p)\subseteq S\}$. Put $F=\{p\in C:N(p)\not\subseteq C\}$ and $U=C\setminus F$. The minimum number of squares in a cover is $|F|+\vc(T[U])$. \end{lemma} \begin{proof} The lower edge of any legal square has even height $2j$. Vertical edges in the strip just above that height have horizontal coordinate congruent to $j$ modulo two. Thus every legal square is some $B_p$. Every unit edge on the tiling belongs to precisely two tiles. The two lateral neighbors share two edges each; the other four neighbors share one apiece. For $p\notin S$, completeness of the perimeter is therefore equivalent to $N(p)\subseteq S$. A square in $F$ shares an edge with a noncandidate. That edge belongs to the input, by legality, and forces selection of the square. For adjacent candidates, at least one is in $S$: a candidate outside $S$ requires all its neighbors in $S$. Their common edge is consequently present. After selecting $F$, each adjacent pair in $U$ therefore requires one endpoint. Conversely, an input edge still uncovered has an owner in $S\subseteq C$. This owner lies outside $F$; its other owner is thus a candidate and also lies outside $F$. Every remaining covering constraint is accounted for. \end{proof} \section{Routing an Odd Subdivision} Take a simple, three-connected cubic planar graph $H$ of girth greater than three, a class on which vertex cover is NP-complete \cite{uehara}. Set $n=|V(H)|$. Three-connectivity implies biconnectivity, and the maximum degree is three, so the source graph meets the biconnectivity and degree hypotheses of the following drawing theorem. The polynomial-time orthogonal drawing algorithm of Biedl and Kant \cite[Theorem~3.5]{drawing} gives a plane drawing on an $n$ by $n$ integer grid with at most two bends per edge. Subdivide each polyline into unit steps. Each resulting path is simple and its interior avoids all other paths and original vertices. For each visited grid point $p=(i,j)$ introduce two sites \[ a(p)=(1+2i+j,-i+j),\qquad b(p)=(2+2i+j,-i+j). \] West and south ports use $a$; east and north ports use $b$. An east step joins $b(i,j)$ to $a(i+1,j)$ and a north step joins $b(i,j)$ to $a(i,j+1)$; reverse steps use the same segments. Use the internal link $ab$ when ports on both sides are occupied. Let the side with more ports represent $p$, breaking a tie in favor of $a$. The colors $x-y\bmod 3$ distinguish the two types of site, and within either color the original $(i,j)$ is recovered uniquely. The sites and links lie in the honeycomb obtained by deleting color zero from $T$. Since the degree at $p$ is at most three, the nonrepresentative site, when used, has one external port and the internal link. It only subdivides a route. Thus the original edges have internally disjoint honeycomb paths with the prescribed incidences. Scale the honeycomb by 40. On each original edge replace exactly the first host segment by a detour and keep all others straight. In a canonical orientation the detour follows the unit steps through \[ (0,0),(15,0),(15,5),(20,5),(25,0),(40,0). \] Use lattice rotations and endpoint reversal for the other orientations. The straight segment has length 40 and the detour length 45. For $\ell_e$ host segments the replacement path for $e$ has length $2r_e+1$, where $r_e=20\ell_e+2$. Write $A$ for the resulting lattice vertices, including the representatives of original vertices. \begin{figure}[ht]\centering \includegraphics[width=.78\linewidth]{detour.png} \caption{One detour adds five steps and preserves both endpoints. Labels are triangular-lattice coordinates.} \end{figure} \section{Local Shapes and Stability} The lattice distance to the origin is $d((x,y),0)=\max(|x|,|y|,|x+y|)$. With unit basis vectors this dominates Euclidean distance. Disjoint unit host segments have Euclidean separation at least $\sqrt{3}/2$: this is the separation of adjacent parallel grid lines, and for nonparallel disjoint segments a closest pair can be chosen with one point an endpoint. Collinear disjoint unit segments have separation at least one. A detour stays within five of its baseline. After scaling, nonincident routed segments are therefore at least $20\sqrt{3}-10>4$ apart. Two incident host rays form a $120^\circ$ angle. Baseline points at parameters $t,s$ from the common endpoint have Euclidean separation at least $(\sqrt{3}/2)(t+s)$. For each off-baseline point $(x,y)$ of the canonical detour choose $(x+y,0)$ as its baseline witness. Its parameter is in $[15,25]$ and its distance to the point is at most five, also when measured from the opposite end. If just one point is off the baseline the separation is at least $15\sqrt{3}/2-5>4$; if both are off it is at least $15\sqrt{3}-10>4$. Hence points from distinct incident routes within distance four lie on the straight portions, where their triangular distance equals $t+s$. Number the five pieces of a detour from 0 to 4. For pairs $(0,2)$, $(0,3)$, $(0,4)$, $(1,3)$, $(1,4)$, $(2,4)$ the respective lower bounds on separation are $5,10,10,5,10,5$, using $y,x+y,x,x+y,x,y$. At turns the two rays meet at $120^\circ$. It follows that the only adjacent vertices in $T[A]$ are intended path neighbors. A ball of radius two sees at most two consecutive pieces of one detour. Since every piece has length at least five, the ball cannot contain both ends of a piece. If distinct hosts are visible they are pairwise incident, hence share a single endpoint since the honeycomb is triangle-free. The center is within six of this endpoint, and the whole ball is within eight, in the straight portion of each visible arm. Convexity along a line now shows that inside any such ball the routed set agrees with an empty set, a point, a ray, a line, a $120^\circ$ bend, or a three-ray junction, up to lattice symmetry and translation. \begin{lemma}\label{lem:stable} For $S=N[A]$, one has $N(p)\subseteq S$ if and only if $p\in A$. \end{lemma} \begin{proof} The test depends only on $A$ within distance two of $p$. For each of the local templates, a center farther than two from its origin can see at most one arm in its radius-two ball. For example, distance at most two to ray 0 is equivalent to $|y|\le2,\ x\ge-2,\ x+y\ge-2$; for ray 2 the inequalities are $|x+y|\le2,\ y\ge-2,\ x\le2$. Joint satisfaction places the center in the origin's radius-two ball. Opposite rays give the same bound directly. Away from the origin the ball thus sees a line or the empty set. For a horizontal line the closed neighborhood is $|y|\le1$; precisely the middle row has all six neighbors in that strip. For centers within distance two of the origin, Table~\ref{tab:templates} gives a witness direction whenever the center lies outside the template. Entries can be verified by testing each indicated neighbor and its own six neighbors for membership in the specified template. If the center belongs to the template its six neighbors belong to the closed neighborhood by definition. \end{proof} \begin{table}[ht]\centering\small \caption{Witness directions. A dash means the center belongs to the template. The ray uses direction 0, the line 0 and 3, the bend 0 and 2, and the junction 0, 2 and 4.}\label{tab:templates} \begin{tabular}{r|ccccc} Center & Point & Ray & Line & Bend & Junction\\\hline $(-2,0)$ & 1 & 1 & -- & 2 & 2 \\ $(-2,1)$ & 1 & 1 & 1 & 3 & 3 \\ $(-2,2)$ & 0 & 0 & 0 & -- & -- \\ $(-1,-1)$ & 2 & 2 & 4 & 2 & 2 \\ $(-1,0)$ & 2 & 2 & -- & 3 & 3 \\ $(-1,1)$ & 1 & 1 & 1 & -- & -- \\ $(-1,2)$ & 0 & 0 & 0 & 0 & 0 \\ $(0,-2)$ & 0 & 0 & 0 & 0 & -- \\ $(0,-1)$ & 3 & 3 & 4 & 3 & -- \\ $(0,0)$ & -- & -- & -- & -- & -- \\ $(0,1)$ & 0 & 1 & 1 & 1 & 1 \\ $(0,2)$ & 0 & 0 & 0 & 0 & 0 \\ $(1,-2)$ & 0 & 0 & 0 & 0 & 0 \\ $(1,-1)$ & 0 & 4 & 4 & 4 & 5 \\ $(1,0)$ & 0 & -- & -- & -- & -- \\ $(1,1)$ & 0 & 1 & 1 & 1 & 1 \\ $(2,-2)$ & 0 & 0 & 0 & 0 & 0 \\ $(2,-1)$ & 0 & 4 & 4 & 4 & 4 \\ $(2,0)$ & 0 & -- & -- & -- & -- \\ \end{tabular} \end{table} \section{Inducedness of the Orthogonal Output} \begin{lemma}\label{lem:induced} For $S=N[A]$, all pairs of orthogonally adjacent vertices of $G(S)$ are joined by an edge of $G(S)$. \end{lemma} \begin{proof} One endpoint of a vertical unit edge has odd height. If present, it is the midpoint of a vertical side and supplies both incident vertical edges. Of two horizontally adjacent points at odd height, one is a tile center and cannot be present. For horizontal edges at even height, translation and left-right reflection reduce the test to the left half of the bottom of $B_{(0,0)}$ (applying the same symmetry to $A$). A missing edge with both endpoints present requires its two owners $(0,0),(0,-1)$ to be absent from $S$, while $(-1,0),(1,-1)$ must be present to supply its endpoints. Take witnesses in $A$ at distance at most one from each of the last two sites. Removing the closed neighborhoods of both absent owners leaves just $(-2,0),(-2,1)$ on the left and $(2,-2),(2,-1)$ on the right. All are in the radius-two ball about the origin, and any such left-right pair is at distance four. The local template contains a shortest path between the witnesses, since on different arms one can walk through their common origin. Each of its four steps increases $x$ by one. Its midpoint has $x=0$ and $-2\le y\le1$ (using both endpoints). It is in the same ball and thus belongs to $A$, yet lies within one step of an absent owner. This contradicts $S=N[A]$. \end{proof} \section{Budgets and Size}\label{sec:budgets} Let $R=\sum_e r_e$. For any vertex cover $X$ of $H$, number the $2r_e$ internal vertices of each replacement path from left to right. If its left endpoint is selected, choose the even positions; otherwise the right endpoint is selected and the odd positions suffice. This yields a cover of $T[A]$ of size $|X|+R$. Conversely, take any cover $Y$ of $T[A]$ and let $X$ be its original vertices. The matching between successive internal pairs forces $r_e$ internal choices on every path. If both original endpoints are missing, the first and last internal vertices are forced, and there are $r_e-1$ disjoint intermediate edges still to cover. With $u(X)$ the number of uncovered original edges, internal disjointness gives $|Y|\ge|X|+R+u(X)$. Adding one endpoint per uncovered edge turns $X$ into a cover of $H$. These bounds prove $\vc(T[A])=R+\vc(H)$. By Lemmas~\ref{lem:bricks} and~\ref{lem:stable}, $C=S$, $U=A$ and the minimum number of squares is $|F|+R+\vc(H)$. For a nonnegative source budget $k$, set $K=|F|+R+\min(k,n)$. There are $|F|+n+2R$ candidates since each original edge contributes $2r_e$ distinct internal vertices. A minimum cover of size at most $K$ can therefore be padded to exactly $K$ with unused legal squares. Existence of an exact cover here means exact \emph{cardinality} and equality of the edge union; shared edges may be covered repeatedly. The target instance is feasible if and only if $\vc(H)\le k$. Lemma~\ref{lem:induced} gives the stronger input restriction in Theorem~\ref{thm:main}. Let $m_H=|E(H)|$, and let $L$ be the total number of orthogonal unit steps. Each drawn edge has at most three straight segments, each of length at most $n$, so $L\le3nm_H$. A unit step uses one crossing segment and at most one internal connector; each original edge also uses at most one terminal connector. Hence the total host count $h$ satisfies $h\le2L+m_H$. Listing the routed vertices takes at most $n+46h$ records, since even a detour contributes only 46 vertices including both endpoints. Closing the neighborhood uses at most seven entries per record, and each resulting candidate supplies eight boundary edges. The output therefore has at most $56(n+46(2L+m_H))$ edge records, counting repetitions. Since $m_H=3n/2$, this is $O(n^2)$. Translate the drawing into $[0,n]^2$. More generally, for traces and vertex positions in $[-b,b]^2$, the host sites are in $[-(3b+2),3b+2]^2$. Scaling by 40 and taking the routed points gives coordinate magnitude at most $120b+130$. The closed neighborhood adds at most one per coordinate. Applying the brick map $(i,j)\mapsto(2i+j,2j)$ and including the square endpoints yields the bound $360b+400$. Taking $b=n$, the output coordinates have $O(\log(n+1))$ bits. Vertex and edge lists, forced squares, and the budget can all be produced by enumeration and membership scans of polynomial-length lists. Together with the cited drawing algorithm, this proves polynomial bit time for the reduction. \paragraph{Counting repeated placements.} If one square may be selected several times, the problem is still NP-complete under the restrictions of Theorem~\ref{thm:main}. On the constructed instances there are at least $K$ distinct legal squares. Removing repetitions from any feasible multiset gives a cover with at most $K$ distinct squares. Adding unused legal squares up to $K$ preserves the edge union. Conversely, every solution with distinct squares is also a multiset solution. This proves hardness by the same reduction. For membership in NP with a binary budget, list distinct corners by input-edge indices and give each a positive binary multiplicity. There are at most $m$ such corners for $m$ input edge records. Checking their boundary union and that the multiplicities sum to $K$ takes polynomial bit time, even when $K>m$. For $K=0$ the empty certificate covers exactly the empty edge set. This extension is a corollary proved here. The Lean verifier below uses distinct placements. \section{Machine-Checked Component} The supplement uses Lean 4.19.0. The input to \texttt{DrawingInput.lean} consists of labeled vertices and nonempty unit-step edge traces. The hypotheses require distinct vertex positions, simple paths, avoidance of other vertices, intersection only at common endpoints, at most one shared endpoint for each pair of distinct edges, and at most three incidences at each point. These properties hold for the drawings used above. The construction reads the first step and the reverse of the last step to compute outward directions. If two incident edges used the same outward direction, their traces would meet both at the endpoint and at its grid neighbor. This supplies the distinct ports required by the routing construction. The following statements locate the main interfaces in the supplement. All names are relative to the namespace \texttt{SquareCover}. \begin{itemize}\raggedright \item \texttt{TraceDrawing.certificate\_reduction} identifies vertex-cover feasibility at budget $k$ with acceptance of a bounded certificate at the constructed budget $K$. Its proof uses the geometric and budget equivalence in \texttt{SquareCover.lean}. \item For the same output list, \texttt{GridDrawing.output\_grid\_induced} proves inducedness and \texttt{GridDrawing.legal\_square\_on\_each\_edge} puts every listed edge on a legal square. \item The number of edge records is bounded by \texttt{GridDrawing.outputSizeBound}. Both endpoint coordinates are bounded by \texttt{GridDrawing.outputCoordinateBound}. \item \texttt{bounded\_certificate\_iff} applies to any finite list of grid edges. The counted verifier in \texttt{ComparisonModel.lean} agrees with the Boolean checker. The theorem \texttt{ComparisonModel.comparison\_bound} proves the bound of $17m^2$ equality tests on bounded witnesses. \end{itemize} The source NP-completeness theorem and the construction of a planar orthogonal drawing from an abstract graph are invoked from the literature. Lean starts at the supplied traces. The comparison model counts equality tests between corners or edges. The cost of parsing binary encodings, accessing list indices, and implementing the complete reduction on a bit machine is accounted for by the paper's polynomial-time arguments. \begin{thebibliography}{9} \bibitem{shiota} T. Shiota, Geometric Graph Covering, Question 4 in \emph{Open Problems from CCCG 2025}, Canadian Conference on Computational Geometry, 2025. \href{https://cccg-wads-2025.eecs.yorku.ca/CCCG_2025_Open_Problems.pdf}{Problem statement}. \bibitem{uehara} R. Uehara, \emph{NP-complete problems on a 3-connected cubic planar graph and their applications}, Tokyo Woman's Christian University technical report TWCU-M-0004, 1996. \href{https://www.jaist.ac.jp/~uehara/pdf/triangle.pdf}{Report}. \bibitem{drawing} T. Biedl and G. Kant, \emph{A Better Heuristic for Orthogonal Graph Drawings}, Utrecht University technical report UU-CS-1995-04, 1995, Theorem 3.5. \href{https://ics-archive.science.uu.nl/research/techreps/repo/CS-1995/1995-04.pdf}{Report}; \href{https://doi.org/10.1016/S0925-7721(97)00026-6}{journal version}. \bibitem{borders} K. Iwama, E. Miyano and H. Ono, Drawing Borders Efficiently, \emph{Theory of Computing Systems} 44 (2009), 230--244. \href{https://doi.org/10.1007/s00224-008-9117-y}{doi:10.1007/s00224-008-9117-y}. \bibitem{triangular} K. Bringmann, S. Cabello and M. T. M. Emmerich, Maximum Volume Subset Selection for Anchored Boxes, SoCG 2017, LIPIcs 77, 22:1--22:15. \href{https://doi.org/10.4230/LIPIcs.SoCG.2017.22}{doi:10.4230/LIPIcs.SoCG.2017.22}. \bibitem{rectangles} M. Kundu, D. Lokshtanov, S. Nandi, S. Saurabh and K. Singanporia, Covering Points with Rectangular Boundaries, ESA 2026, LIPIcs 388, 153:1--153:17. \href{https://doi.org/10.4230/LIPIcs.ESA.2026.153}{doi:10.4230/LIPIcs.ESA.2026.153}. \end{thebibliography} \section*{AI Disclosure} OpenAI Codex and DeepSeek contributed to the research and the development of the Lean formalization. Codex also contributed to the mathematical arguments, literature search, preparation of the figures, and drafting of the Chinese and English manuscripts. \end{document}