Definition codeFreeVarTermTerms : nat -> nat :=
  evalStrongRec 0
    (fun t recs : nat =>
     cPair
       (switchPR (cPairPi1 t) (cPairPi2 (codeNth (t - S (cPairPi2 t)) recs))
          (S (cPair (cPairPi2 t) 0)))
       (switchPR t
          (codeApp (cPairPi1 (codeNth (t - S (cPairPi1 (pred t))) recs))
             (cPairPi2 (codeNth (t - S (cPairPi2 (pred t))) recs))) 0)).Definition codeFreeVarTerm (t : nat) : nat :=
  cPairPi1 (codeFreeVarTermTerms t).Definition codeFreeVarTerms (t : nat) : nat :=
  cPairPi2 (codeFreeVarTermTerms t).

(* Specifications: *)
Lemma codeFreeVarTermCorrect : forall t : Term, codeFreeVarTerm (codeTerm L codeF t) = codeList (freeVarTerm L t).
Lemma codeFreeVarTermsCorrect : forall (n : nat) (ts : Terms n), codeFreeVarTerms (codeTerms L codeF n ts) = codeList (freeVarTerms L n ts).
Lemma codeFreeVarTermTermsIsPR : isPR 1 codeFreeVarTermTerms.
Lemma codeFreeVarTermIsPR : isPR 1 codeFreeVarTerm.
Lemma codeFreeVarTermsIsPR : isPR 1 codeFreeVarTerms.