Let primRecSigmaFormulaHelp (n : nat) (SigA SigB : Formula) : Formula :=
andH
(existH 0
(andH SigA
(substituteFormula LNN (substituteFormula LNN betaFormula 1 Zero) 2
(var (S (S n))))))
(forallH (S (S (S n)))
(impH (LT (var (S (S (S n)))) (var (S n)))
(existH 0
(existH (S n)
(andH
(substituteFormula LNN
(substituteFormula LNN
(substituteFormula LNN betaFormula 1
(var (S (S (S n))))) 2
(var (S (S n)))) 0 (var (S n)))
(andH
(substituteFormula LNN SigB (S (S n))
(var (S (S (S n)))))
(substituteFormula LNN
(substituteFormula LNN betaFormula 1
(Succ (var (S (S (S n)))))) 2
(var (S (S n)))))))))).
Let primRecPiFormulaHelp (n : nat) (SigA SigB : Formula) : Formula :=
andH
(forallH 0
(impH SigA
(substituteFormula LNN (substituteFormula LNN betaFormula 1 Zero) 2
(var (S (S n))))))
(forallH (S (S (S n)))
(impH (LT (var (S (S (S n)))) (var (S n)))
(forallH 0
(forallH (S n)
(impH
(substituteFormula LNN
(substituteFormula LNN
(substituteFormula LNN betaFormula 1
(var (S (S (S n))))) 2
(var (S (S n)))) 0 (var (S n)))
(impH
(substituteFormula LNN SigB (S (S n))
(var (S (S (S n)))))
(substituteFormula LNN
(substituteFormula LNN betaFormula 1
(Succ (var (S (S (S n)))))) 2
(var (S (S n)))))))))).

(* Specifications: *)
Lemma freeVarPrimRecSigmaFormulaHelp1 :
forall (n : nat) (A B : Formula) (v : nat),
In v (freeVarFormula LNN (primRecSigmaFormulaHelp n A B)) ->
In v (freeVarFormula LNN A) \/
In v (freeVarFormula LNN B) \/ v = S (S n) \/ v = S n.
Lemma freeVarPrimRecPiFormulaHelp1 :
forall (n : nat) (A B : Formula) (v : nat),
In v (freeVarFormula LNN (primRecPiFormulaHelp n A B)) ->
In v (freeVarFormula LNN A) \/
In v (freeVarFormula LNN B) \/ v = S (S n) \/ v = S n.