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

(* Specifications: *)
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.
Lemma subFormulaIff :
forall (f1 f2 : fol.Formula L) (v : nat) (s : fol.Term L),
substituteFormula (iffH f1 f2) v s =
iffH (substituteFormula f1 v s) (substituteFormula f2 v s).