(*Trace has form
 ((v,s, formula_input), formula_output, [subTrace1], [subTrace2])*)

Definition codeNewVar (l : nat) : nat :=
  evalStrongRec 0
    (fun n Hrecs : nat =>
     switchPR n
       (max (S (cPairPi1 (pred n)))
          (codeNth (n - S (cPairPi2 (pred n))) Hrecs)) 0) l.

Lemma codeNewVarIsPR : isPR 1 codeNewVar.