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_right:
forall n1 n2 n3 i,
reachable n1 n2 -> code!n2 = Some i -> In n3 (successors i) ->
reachable n1 n3.