Theorem·T34
The parse-balance invariant for formulas
Every formula drives its own formula parse balance down to exactly zero, and never earlier: the running balance stays positive until the very last symbol.
For a language
and
with
:
and
In words
For any formula of the language, with n its length as a symbol sequence: its formula parse balance reaches exactly zero after reading all n symbols, and it never reaches down to zero earlier - the running balance stays at least one at every position before the last.
Never needed: F05 · F10 · F13 · A03 · A04 · A05 · A09 (computed from the citation graph, not asserted).
Proof
- 1Setup. By structural induction on : it suffices to prove the claim for every formula produced by each of the five clauses of D083 - equality, relation application, negation, a binary connective, or a quantifier - assuming it already holds of any formula(s) the clause is applied to.
- 2
- 3
- 4
- 5Inner step ( ). Exactly as in the proof of T31 (via D080's recursive clause and associativity): . By L66 with , , : By the inner IH, the first term is ; by L67 applied to the term , the second is . Since (T29): . For positivity, let . If : Locality (as in L66's proof) gives by the inner IH. Otherwise for , and by L66: , using L67 (positivity, applied to ); as (naturals), by order-preservation of the embedding.
- 6Case rel, conclude. T05 on gives the inner claim at , i.e. for : and for every . This is the theorem for this .
- 7
- 8Case bin. Let , each already satisfy the theorem (IH), . Exactly as in case eq, with replaced by and L67 replaced by the IH on : (bin case of D090, matching the eq case's weight), so the identical two-step L66 argument (head then , then that combined with ) gives for , and the identical positivity argument (head region trivial via the base clause, then Locality plus L66 across each tail, using the IH's positivity on then on in place of L67) gives for every . This is the theorem for this .
- 9
- 10Case quant, positivity. For : . For : , shown above. For , write , : by L66 with : (IH, positivity). This is the theorem for this .
- 11All five clauses of D083 preserve the theorem. By structural induction, the theorem holds for every .
∎
Remarks
The formula-level counterpart of T31, proved the same way - structural induction with a numerical sub-induction where a clause takes a variable-length list of arguments (here, only the relation clause) - but with five cases instead of two, since a formula is built by one of five rules rather than two. Negation, the binary connectives, and the quantifiers all have a *fixed* arity (one formula, two formulas, or one variable plus one formula), so unlike function application their cases need no inner induction at all: the head's own weight already accounts for exactly how many further pieces are pending. Term arguments are handled by falling back on the already-established term invariant rather than re-deriving it. Combined with the definition, this is what will make the analogous uniqueness statement for formulas provable: a formula, like a term, never "finishes early".