WFF of PropLog is Balanced

Theorem
Let $\mathbf A$ be a WFF of propositional calculus.

Then $\mathbf A$ is a balanced string.

Proof
Let $l \left({\mathbf A}\right)$ denote the number of left brackets in a string $\mathbf A$.

Let $r \left({\mathbf A}\right)$ denote the number of right brackets in a string $\mathbf A$.

We will prove by strong induction on $n$ that:


 * All WFFs of propositional calculus of length $n$ are balanced.

Induction Basis
The only WFFs of PropCalc of Length 1‎ are letters of the alphabet and the symbols $\bot$ and $\top$.

By definition, none of these consist of brackets.

So every WFF $\mathbf A$ of length $1$ has $l \left({\mathbf A}\right) = r \left({\mathbf A}\right) = 0$.

So every WFF of length $1$ is balanced.

This provides the induction basis.

Induction Hypothesis
Now, suppose all WFFs of propositional calculus of length at most $n$ are balanced.

This provides the induction hypothesis.

Induction Step
Let $\mathbf A$ be a WFF of propositional calculus of length $n + 1$.

The following cases are to be considered:


 * $\mathbf A = \neg \mathbf B$, where $\mathbf B$ is a WFF of length $k$ and hence balanced.

So $\mathbf A$ contains the same brackets as $\mathbf B$ and so must itself be balanced.


 * $\mathbf A = \left({\mathbf B \circ \mathbf C}\right)$ where $\circ$ is one of the binary connectives.

Then:
 * $l \left({\mathbf A}\right) = l \left({\mathbf B}\right) + l \left({\mathbf C}\right) + 1$
 * $r \left({\mathbf A}\right) = r \left({\mathbf B}\right) + r \left({\mathbf C}\right) + 1$.

Now, $\mathbf B$ and $\mathbf C$ are both of length strictly less than $n+1$, and are therefore balanced.

So $l \left({\mathbf B}\right) = r \left({\mathbf B}\right)$ and $l \left({\mathbf C}\right) = r \left({\mathbf C}\right)$

It follows that $l \left({\mathbf A}\right) = r \left({\mathbf A}\right)$ and so $\mathbf A$ is balanced.

We assumed that all WFFs of length $n$ and less are balanced, and demonstrated that as a consequence all WFFs of length $n+1$ are balanced.

The result now follows by strong induction.