TITLE: Formal definition of “counterexample”.
QUESTION [6 upvotes]: What is the preferred formal definition of “counterexample” as in: zero is a counterexample for "every integer is either positive or negative". Where in the literature is the notion of “counterexample” formally defined? And what are the main theorems involving this notion? And what questions concerning it remain open?

REPLY [4 votes]: My guess is that formally, a counterexample to $$\forall(x \in X, y \in Y)\varphi$$ is a basically a substitution $(x:= x_0, y:= y_0)$ together with a proof that $$(x:= x_0, y:= y_0) \varphi \rightarrow \bot.$$
Unfortunately, this means that the "set-of-counterexamples function" fails to be preserved by equality of booleans. For instance, the booleans $$\forall x \in \mathbb{R},x+1=x \qquad \forall x \in \mathbb{R},x^2=x$$ are equal, in that they're both FALSE; but, the corresponding sets of counterexamples are different. For instance, $(x:=1)$ gives a counterexample to the former, but not to the latter.
(I don't know whether or not this is an actual problem.)
By the way, we can think of a substitution like $(x:= x_0,y:= y_0)$ as being a bit like an ordered tuple, in this case $(x_0,y_0)$. The difference is that the "order" is replaced by a name for each individual element; so in this case, $x_0$ is in the "$x$" position (rather than the 1st position) and $y_0$ is in the "$y$" position (rather than the 2nd position.) I think computer scientists call such things records, which are viewed as elements of "named cartesian products" (aka "record types.")