Section LNN.
Variable T : System.
Hypothesis TextendsNN : Included _ NN T.
Variable U : fol.System L.
Variable fU : Formula.
Variable v0 : nat.
Hypothesis freeVarfU : forall v : nat, In v (freeVarFormula LNN fU) -> v = v0.
Hypothesis
expressU1 :
forall f : fol.Formula L,
mem _ U f ->
SysPrf T
(substituteFormula LNN fU v0 (natToTerm (codeFormula L codeF codeR f))).
Hypothesis
expressU2 :
forall f : fol.Formula L,
~ mem _ U f ->
SysPrf T
(notH
(substituteFormula LNN fU v0
(natToTerm (codeFormula L codeF codeR f)))).
Definition codeSysPrf : Formula :=
let nv := newVar (2 :: 1 :: 0 :: v0 :: nil) in
existH nv
(andH
(substituteFormula LNN
(substituteFormula LNN
(primRecFormula 2
(proj1_sig
(checkPrfIsPR L codeF codeR codeArityF codeArityR
codeArityFIsPR codeArityRIsPR))) 0
(Succ (var nv))) 2 (var 0))
(forallH (S nv)
(impH (LT (var (S nv)) (var nv))
(orH
(substituteFormula LNN
(substituteFormula LNN
(substituteFormula LNN
(primRecFormula 2 (proj1_sig codeInIsPR)) 2
(var (S nv))) 1 (var nv)) 0 Zero)
(substituteFormula LNN fU v0 (var (S nv))))))).
Definition codeSysPf : Formula := existH 1 codeSysPrf.

Lemma codeSysPfCorrect :
forall f : fol.Formula L,
folProof.SysPrf L U f ->
SysPrf T
(substituteFormula LNN codeSysPf 0
(natToTerm (codeFormula L codeF codeR f))).