From Undecidability.StackMachines.Util Require Import Nat_facts List_facts.
Local Definition rt_rt1n := @clos_rt_rt1n_iff Config.
Definition terminal (M: SMN) (X: Config) : Prop :=
forall (Y: Config), not (step M X Y).
(* reachability in at most n steps *)
Inductive reachable_n (M: SMN) : nat -> Config -> Config -> Prop :=
| rn_refl n X : reachable_n M n X X
| rn_step n X Y Z: step M X Y -> reachable_n M n Y Z -> reachable_n M (1+n) X Z.

Lemma reachable_SnE {M n X Z} : reachable_n M (1+n) X Z ->
X = Z \/ (exists Y, step M X Y /\ reachable_n M n Y Z).