Definition codeSubFormula (f v s : nat) : nat :=
let C := cPair 0 (pow3 f + (v + (s + f))) in
cPairPi1
(boundedSearch
(fun p x : nat =>
ltBool 0 (checkSubFormulaTrace (cPair (cPairPi1 p) x)))
(cPair (cTriple v s f)
(S
(boundComputation f (cTriple C C (ReplaceFormulaTerm f C))
(ReplaceFormulaTerm f C))))).

Lemma codeSubFormulaIsPR : isPR 3 codeSubFormula.
End Code_Substitute_Formula.