Universal Affirmative and Universal Negative are Contrary iff First Predicate is not Vacuous

Theorem
Consider the categorical statements:
 * $\mathbf A: \quad$ The universal affirmative: $\forall x: S \left({x}\right) \implies P \left({x}\right)$
 * $\mathbf E: \quad$ The universal negative: $\forall x: S \left({x}\right) \implies \neg P \left({x}\right)$

Then $\mathbf A$ and $\mathbf E$ are contrary iff:
 * $\exists x: S \left({x}\right)$

Sufficient Condition
Let $\exists x: S \left({x}\right)$.

Suppose $\mathbf A$ and $\mathbf E$ are both true.

As $\mathbf A$ is true, then by Modus Ponendo Ponens:
 * $P \left({x}\right)$

As $\mathbf E$ is true, then by Modus Ponendo Ponens:
 * $\neg P \left({x}\right)$

It follows by Proof by Contradiction that $\mathbf A$ and $\mathbf E$ are not both true.

Thus, by definition, $\mathbf A$ and $\mathbf E$ are contrary statements.

Necessary Condition
Let $\mathbf A$ and $\mathbf E$ be contrary statements.

Suppose:
 * $\neg \exists x: S \left({x}\right)$

that is, $S \left({x}\right)$ is vacuous.

From De Morgan's Laws: Denial of Existence:
 * $\forall x: \neg S \left({x}\right) \dashv \vdash \neg \exists x: S \left({x}\right)$

it follows that $\forall x: S \left({x}\right)$ is false.

From False Statement implies Every Statement:
 * $\forall x: S \left({x}\right) \implies P \left({x}\right)$

is true, and:
 * $\forall x: S \left({x}\right) \implies \neg P \left({x}\right)$

is also true.

Thus, by definition, $\mathbf A$ and $\mathbf E$ are not contrary statements.

It follows by Proof by Contradiction that $\exists x: S \left({x}\right)$.