Section Substitution_Properties.
Let existH := existH L.

Lemma subFormulaExist2 :
forall (f : fol.Formula L) (x v : nat) (s : fol.Term L),
exists nv : nat,
~ In nv (freeVarTerm s) /\
nv <> v /\
~ In nv (list_remove _ eq_nat_dec x (freeVarFormula f)) /\
substituteFormula (existH x f) v s =
match eq_nat_dec x v with
| left _ => existH x f
| right _ =>
existH nv (substituteFormula (substituteFormula f x (var nv)) v s)
end.