Section subAllCloseFrom.
Fixpoint closeFrom (a n : nat) (f : fol.Formula L) {struct n} :
fol.Formula L :=
match n with
| O => f
| S m => fol.forallH L (a + m) (closeFrom a m f)
end.
Opaque le_lt_dec.

Lemma subAllCloseFrom1 :
forall (n m : nat) (map : nat -> fol.Term L) (f : fol.Formula L)
(T : fol.System L),
(forall v : nat,
v < n -> forall w : nat, In w (freeVarTerm L (map (m + v))) -> w < m) ->
folProof.SysPrf L T (closeFrom m n f) ->
folProof.SysPrf L T
(subAllFormula f
(fun x : nat =>
match le_lt_dec m x with
| left _ =>
match le_lt_dec (m + n) x with
| left _ => fol.var L x
| right _ => map x
end
| right _ => fol.var L x
end)).