Module Leftmost.
(* ** Leftmost reduction *)
Reserved Notation "s '≻lm' t" (at level 50).
Inductive step_lm : term -> term -> Prop :=
| step_lmApp  s t     : app (lam s) (lam t) ≻lm subst s 0 (lam t)
| step_lmAppR s t  t' : t ≻lm t' -> app (lam s) t ≻lm app (lam s) t'
| step_lmAppL s s' t  : s ≻lm s' -> app s t ≻lm app s' t
where "s '≻lm' t" := (step_lm s t).
Hint Constructors step_lm : core.
Ltac inv_step_lm :=
match goal with
| H : step_lm (lam _) _ |- _ => inv H
| H : step_lm (var _) _ |- _ => inv H
| H : star step_lm (lam _) _ |- _ => inv H
| H : star step_lm (var _) _ |- _ => inv H
end.
(* *** Small-Step_Lm Time Measure *)
Instance pow_step_lm_congL k:
Proper ((pow step_lm k) ==> eq ==> (pow step_lm k)) app.
(* *** Small-Step_Lm Space Measure *)
Definition redWithMaxSizeL := redWithMaxSize size step_lm.

Lemma timeBS_correct_lm s t k:
(timeBS k s t <-> pow step_lm k s t /\ lambda t).