Fixpoint freeVarFormula (A : fol.Formula L) : list nat :=
match A with
| fol.equal t s => freeVarTerm t ++ freeVarTerm s
| fol.atomic r ts => freeVarTerms _ ts
| fol.impH A B => freeVarFormula A ++ freeVarFormula B
| fol.notH A => freeVarFormula A
| fol.forallH v A => list_remove _ eq_nat_dec v (freeVarFormula A)
end.
Definition ClosedSystem (T : fol.System L) :=
forall (v : nat) (f : fol.Formula L),
mem _ T f -> ~ In v (freeVarFormula f).
Definition closeList (l : list nat) (x : fol.Formula L) :
fol.Formula L :=
list_rec (fun _ => fol.Formula L) x
(fun (a : nat) _ (rec : fol.Formula L) => forallH a rec) l.
Definition close (x : fol.Formula L) : fol.Formula L :=
closeList (no_dup _ eq_nat_dec (freeVarFormula x)) x.

Lemma freeVarClosedList1 :
forall (l : list nat) (v : nat) (x : fol.Formula L),
In v l -> ~ In v (freeVarFormula (closeList l x)).