(* Author: Russell O'Connor *)
(* This file is Public Domain *)
Unset Standard Proposition Elimination Names.
Record Language : Type := language
{Relations : Set; Functions : Set; arity : Relations + Functions -> nat}.
Section First_Order_Logic.
Variable L : Language.
Inductive Term : Set :=
| var : nat -> Term
| apply : forall f : Functions L, Terms (arity L (inr _ f)) -> Term
with Terms : nat -> Set :=
| Tnil : Terms 0
| Tcons : forall n : nat, Term -> Terms n -> Terms (S n).
Scheme Term_Terms_ind := Induction for Term Sort Prop
with Terms_Term_ind := Induction for Terms Sort Prop.
Scheme Term_Terms_rec := Minimality for Term Sort Set
with Terms_Term_rec := Minimality for Terms Sort Set.
Scheme Term_Terms_rec_full := Induction for Term
Sort Set
with Terms_Term_rec_full := Induction for Terms Sort Set.
Inductive Formula : Set :=
| equal : Term -> Term -> Formula
| atomic : forall r : Relations L, Terms (arity L (inl _ r)) -> Formula
| impH : Formula -> Formula -> Formula
| notH : Formula -> Formula
| forallH : nat -> Formula -> Formula.
Definition Formulas := list Formula.
Definition System := Ensemble Formula.
Definition mem := Ensembles.In.
Section Fol_Full.
Definition orH (A B : Formula) := impH (notH A) B.
Definition andH (A B : Formula) := notH (orH (notH A) (notH B)).
Definition iffH (A B : Formula) := andH (impH A B) (impH B A).
Definition existH (x : nat) (A : Formula) := notH (forallH x (notH A)).
End Fol_Full.
Section Fol_Plus.
Definition ifThenElseH (A B C : Formula) := andH (impH A B) (impH (notH A) C).
End Fol_Plus.
Section Formula_Decideability.
Definition language_decideable :=
((forall x y : Functions L, {x = y} + {x <> y}) *
(forall x y : Relations L, {x = y} + {x <> y}))%type.
Hypothesis language_dec : language_decideable.
Let nilTermsHelp : forall n : nat, n = 0 -> Terms n.
intros.
induction n as [| n Hrecn].
apply Tnil.
discriminate H.
Defined.

Lemma nilTerms : forall x : Terms 0, Tnil = x.
Let consTermsHelp : forall n : nat, Terms n -> Set.