Fixpoint freeVarMap (l : list nat) : (nat -> fol.Term L) -> list nat :=
match l with
| nil => fun _ => nil
| a :: l' => fun m => freeVarTerm L (m a) ++ freeVarMap l' m
end.

(* Specifications: *)
Lemma freeVarMap_ext :
forall (l : list nat) (f1 f2 : nat -> fol.Term L),
(forall m : nat, In m l -> f1 m = f2 m) -> freeVarMap l f1 = freeVarMap l f2.
Lemma freeVarMap1 :
forall (l : list nat) (m : nat -> fol.Term L) (v n : nat),
In v (freeVarTerm L (m n)) -> In n l -> In v (freeVarMap l m).