Section FullFOL.
Context {Sigma : Signature}.
Definition form_shift n := var_term (S n).
Notation "↑" := form_shift.
(* **** Subformula *)
Inductive sf : form -> form -> Prop :=
| SImplL phi psi : sf phi (phi --> psi)
| SImplR phi psi : sf psi (phi --> psi)
(* | SEq s t s' t' : sf (Pr s' t') (Eq s t) *)
| SDisjL phi psi : sf phi (phi ∨ psi)
| SDisjR phi psi : sf psi (phi ∨ psi)
| SConjL phi psi : sf phi (phi ∧ psi)
| SConjR phi psi : sf psi (phi ∧ psi)
| SAll phi t : sf (phi [t .: ids]) (∀ phi)
| SEx phi t : sf (phi [t .: ids]) (∃ phi).
(* ** Formula size *)
Fixpoint size (phi : form ) :=
match phi with
| Pred _ _ => 0
| Fal => 0
| Impl phi psi
| Conj phi psi
| Disj phi psi => S (size phi + size psi)
| All phi
| Ex phi => S (size phi)
end.
(* **** Forall and Vector.t technology **)
Inductive Forall (A : Type) (P : A -> Type) : forall n, vector A n -> Type :=
| Forall_nil : Forall P (@Vector.nil A)
| Forall_cons : forall n (x : A) (l : vector A n), P x -> Forall P l -> Forall P (@Vector.cons A x n l).
Inductive vec_in (A : Type) (a : A) : forall n, vector A n -> Type :=
| vec_inB n (v : vector A n) : vec_in a (cons a v)
| vec_inS a' n (v :vector A n) : vec_in a v -> vec_in a (cons a' v).
Hint Constructors vec_in : core.

Lemma strong_term_ind (p : term -> Type) :
(forall x, p (var_term x)) -> (forall F v, (forall t, vec_in t v -> p t) -> p (Func F v)) -> forall (t : term), p t.