Section Code_Term_Formula_Proof.
Variable L : Language.
Variable codeF : Functions L -> nat.
Variable codeR : Relations L -> nat.
Hypothesis codeFInj : forall f g : Functions L, codeF f = codeF g -> f = g.
Hypothesis codeRInj : forall R S : Relations L, codeR R = codeR S -> R = S.
Let Formula := Formula L.
Let Formulas := Formulas L.
Let System := System L.
Let Term := Term L.
Let Terms := Terms L.
Let var := var L.
Let apply := apply L.
Let equal := equal L.
Let atomic := atomic L.
Let impH := impH L.
Let notH := notH L.
Let forallH := forallH L.
Let orH := orH L.
Let andH := andH L.
Let existH := existH L.
Let iffH := iffH L.
Let ifThenElseH := ifThenElseH L.
Let Prf := Prf L.
Let SysPrf := SysPrf L.
Fixpoint codeTerm (t : Term) : nat :=
match t with
| fol.var n => cPair 0 n
| fol.apply f ts => cPair (S (codeF f)) (codeTerms _ ts)
end
with codeTerms (n : nat) (ts : Terms n) {struct ts} : nat :=
match ts with
| Tnil => 0
| Tcons n t ss => S (cPair (codeTerm t) (codeTerms n ss))
end.

(* Specifications: *)
Lemma codeTermInj : forall t s : Term, codeTerm t = codeTerm s -> t = s.
Lemma codeTermsInj :
forall (n : nat) (ts ss : Terms n),
codeTerms n ts = codeTerms n ss -> ts = ss.