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 next_n_configs M (n: nat) (Xs: list Config) :
exists L, (forall X Y, In X Xs -> reachable_n M n X Y -> In Y L) /\ (length L <= (Nat.pow (1 + length M) n) * length Xs * (1+n)).