Vacuously true

From CS2800 wiki


When [math]P [/math] is a false proposition, we say that "if [math]P [/math] then [math]Q [/math]" is vacuously true; the statement is true, but only because it doesn't say anything.

This is a definition that often leads to confusion. Why is "if [math]P [/math] then [math]Q [/math]" true if [math]P [/math] is false? Well, it is not making any claim at all, since it is discussing the world where [math]P [/math] is true, which isn't the world under consideration. It is often useful to consider this statement to be true.

For example, you might write a specification for a program by saying that "if the input is positive, then the output is positive". The following function should satisfy this specification (i.e. we would consider the statement "if the input is positive, then the output of f is positive" to be true):

def f(x):
  return x

The function still satisfies its specification, even if you pass in -5; the specification is making no claims about this case.

A common example of a vacuous truth is "for all [math]x \href{/cs2800/wiki/index.php/%5Cin}{\in} \href{/cs2800/wiki/index.php?title=%5Cemptyset&action=edit&redlink=1}{\emptyset} [/math], P". This statement is always true (regardless of [math]P [/math]), but only because there are no [math]x [/math] in the empty set.