From Undecidability.L Require Export Datatypes.LBool Datatypes.LNat Datatypes.LTerm.
Require Import Nat.
From Undecidability.L Require Import Tactics.LTactics Functions.EqBool.
Import EqBool.


Fixpoint term_eqb s t :=
  match s,t with
  | var n, var m eqb n m
  | L.app , L.app andb (term_eqb ) (term_eqb )
  | lam s',lam t' term_eqb s' t'
  | _,_ false
  end.

Lemma term_eqb_spec : x y1 : term, reflect (x = ) (term_eqb x ).
Proof with try (constructor;congruence).
  induction x;cbn; destruct ...
  - destruct (eqb_spec n )...
  -destruct ( y1_1)...
   destruct ( y1_2)...
  -destruct (IHx )...
Qed.


#[global]
Instance eqbTerm : eqbClass term_eqb.
Proof.
  exact term_eqb_spec.
Qed.


Global
Instance eqbComp_nat : eqbCompT term.
Proof.
  evar (c:). exists c. unfold term_eqb.
  unfold enc;cbn. unfold term_enc.
  extract. unfold eqb,eqbTime.
  [c]:exact (5 + c__eqbComp ).
  all:unfold c. set (c__eqbComp ). change (LNat.nat_enc) with (enc (X:=)).
  solverec. all:try nia.
Qed.