intros.
unfold andH, fol.andH in |- *.
rewrite subFormulaNot.
rewrite subFormulaOr.
repeat rewrite subFormulaNot.
reflexivity.
Qed.

Lemma subFormulaExist :
forall (f : fol.Formula L) (x v : nat) (s : fol.Term L),
let nv := newVar (v :: freeVarTerm s ++ freeVarFormula f) in
substituteFormula (existH x f) v s =
match eq_nat_dec x v with
| left _ => existH x f
| right _ =>
match In_dec eq_nat_dec x (freeVarTerm s) with
| right _ => existH x (substituteFormula f v s)
| left _ =>
existH nv (substituteFormula (substituteFormula f x (var nv)) v s)
end
end.