Notation Formula := (Formula L) (only parsing).Notation Formulas := (Formulas L) (only parsing).Notation System := (System L) (only parsing).Notation Term := (Term L) (only parsing).Notation Terms := (Terms L) (only parsing).Fixpoint freeVarTerm (s : fol.Term L) : list nat :=
  match s with
  | fol.var v => v :: nil
  | fol.apply f ts => freeVarTerms (arity L (inr _ f)) ts
  end
 
 with freeVarTerms (n : nat) (ss : fol.Terms L n) {struct ss} : 
 list nat :=
  match ss with
  | Tnil => nil (A:=nat)
  | Tcons m t ts => freeVarTerm t ++ freeVarTerms m ts
  end.

Lemma freeVarTermApply : forall (f : Functions L) (ts : fol.Terms L _), freeVarTerm (apply f ts) = freeVarTerms _ ts.