A strategy profile $(x, y) \in X \times Y$ is a Nash equilibrium of the zero-sum game with payoff matrix $P$ if and only if $x$ and $y$ are optimal solutions to the maximin and minimax programs respectively, i.e.
\begin{align*}
\min_{y' \in Y} p(x, y') &= \max_{x' \in X} \min_{y' \in Y} p(x', y'), \\
\max_{x' \in X} p(x', y) &= \min_{y' \in Y} \max_{x' \in X} p(x', y').
\end{align*}