Require Export fol.
Section Fol_Properties.
Variable L : Language.
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).
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 lt_depth := lt_depth L.
Section Free_Variables.
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.