From Undecidability.L Require Export Prelim.ARS Prelim.MoreBase.
From Undecidability.Shared.Libs.PSL Require Export Base Bijection.
From Undecidability.L Require Export L.
Hint Constructors ARS.star : cbv.
(* * The call-by-value lambda calculus L *)
(* ** Syntax   *)
Notation "'#' v" := (var v) (at level 1).
(* Notation "(λ  s )" := (lam s) (right associativity, at level 0).  *)
Instance term_eq_dec : eq_dec term.
Hint Resolve lambda_lam : core.
Instance lambda_dec s : dec (lambda s).
Instance bound_dec k s : dec (bound k s).
Proof with try ((left; econstructor; try lia; tauto) || (right; inversion 1; try lia; tauto)).
revert k; induction s; intros k.
- destruct (le_lt_dec n k) as [Hl | Hl]... destruct (le_lt_eq_dec _ _ Hl)...
- destruct (IHs1 k), (IHs2 k)...
- induction k.
+ destruct (IHs 1)...
+ destruct (IHs (S (S k)))...
Defined.
Instance closed_dec s : dec (closed s).

Lemma comb_proc_red s : closed s -> proc s \/ exists t, s ≻ t.