Section REACHABLE.
Context {A: Type} (code: PTree.t A) (successors: A -> list positive).
Inductive reachable: positive -> positive -> Prop :=
| reachable_refl: forall n, reachable n n
| reachable_left: forall n1 n2 n3 i,
code!n1 = Some i -> In n2 (successors i) -> reachable n2 n3 ->
reachable n1 n3.
Scheme reachable_ind := Induction for reachable Sort Prop.

Lemma reachable_trans:
forall n1 n2, reachable n1 n2 -> forall n3, reachable n2 n3 -> reachable n1 n3.