Section Well_Formed_Formula.
Variable codeR : Relations L -> nat.
Variable codeArityR : nat -> nat.
Hypothesis codeArityRIsPR : isPR 1 codeArityR.
Hypothesis
codeArityRIsCorrect1 :
forall r : Relations L, codeArityR (codeR r) = S (arity L (inl _ r)).
Hypothesis
codeArityRIsCorrect2 :
forall n : nat, codeArityR n <> 0 -> exists r : Relations L, codeR r = n.
Let Formula := Formula L.
Let equal := equal L.
Let atomic := atomic L.
Let impH := impH L.
Let notH := notH L.
Let forallH := forallH L.
Definition wellFormedFormula : nat -> nat :=
evalStrongRec 0
(fun f recs : nat =>
switchPR (cPairPi1 f)
(switchPR (pred (cPairPi1 f))
(switchPR (pred (pred (cPairPi1 f)))
(switchPR (pred (pred (pred (cPairPi1 f))))
(charFunction 2 beq_nat
(codeArityR (pred (pred (pred (pred (cPairPi1 f))))))
(S (codeLength (cPairPi2 f))) *
wellFormedTerms (cPairPi2 f))
(codeNth (f - S (cPairPi2 (cPairPi2 f))) recs))
(codeNth (f - S (cPairPi2 f)) recs))
(codeNth (f - S (cPairPi1 (cPairPi2 f))) recs *
codeNth (f - S (cPairPi2 (cPairPi2 f))) recs))
(wellFormedTerm (cPairPi1 (cPairPi2 f)) *
wellFormedTerm (cPairPi2 (cPairPi2 f)))).

Lemma wellFormedFormulaIsPR : isPR 1 wellFormedFormula.