Section EQ_DEC.
#[global]
Instance ivar_hasEqDec : hasEqDec ivar :=
Nat.eq_dec.
Context {L : language}.
Hypothesis function_symbols_hasEqDec : hasEqDec L.(function_symbols).
Hypothesis constant_symbols_hasEqDec : hasEqDec L.(constant_symbols).
Proof with try first [now right; congruence | now left; congruence].
- pose proof ivar_hasEqDec as ivar_hasEqDec.
red in ivar_hasEqDec, function_symbols_hasEqDec, constant_symbols_hasEqDec.
clear trm_eq_dec. trm_ind2 t1 t2...
+ pose proof (ivar_hasEqDec x x') as [? | ?]...
+ pose proof (function_symbols_hasEqDec f f') as [f_eq_f' | f_ne_f']...
subst f'. pose proof (trms_eq_dec (L.(function_arity_table) f) ts ts') as [EQ | NE]...
right. intros CONTRA. eapply NE. inv CONTRA.
apply @projT2_eq_fromEqDec with (B := fun f : L.(function_symbols) => trms L (function_arity_table L f)) in H0.
* exact H0.
* exact function_symbols_hasEqDec.
+ pose proof (constant_symbols_hasEqDec c c') as [? | ?]...
- clear trms_eq_dec. trms_ind2 ts1 ts2...
pose proof (trm_eq_dec t t') as [? | ?]; pose proof (IH ts2) as [EQ | NE]...
right. intros CONTRA. eapply NE. inv CONTRA.
apply @projT2_eq_fromEqDec with (B := fun n : nat => trms L n) in H1.
+ exact H1.
+ exact nat_hasEqDec.
Defined.
#[global]
Instance trm_hasEqDec : hasEqDec (trm L) :=
trm_eq_dec.
#[global]
Instance trms_hasEqDec (n : nat) : hasEqDec (trms L n) :=
trms_eq_dec n.
Hypothesis relation_symbols_hasEqDec : hasEqDec L.(relation_symbols).

Lemma frm_eq_dec (p : frm L) (p' : frm L)
: {p = p'} + {p <> p'}.