Section Predecessor.
Context {A: Type}.
Variable code: PTree.t A.
Variable successors: A -> list positive.
Fixpoint add_successors (pred: PTree.t (list positive))
(from: positive) (tolist: list positive)
{struct tolist} : PTree.t (list positive) :=
match tolist with
| nil => pred
| to :: rem => add_successors (PTree.set to (from :: pred!!!to) pred) from rem
end.
Definition make_predecessors : PTree.t (list positive) :=
PTree.fold (fun pred pc instr => add_successors pred pc (successors instr))
code (PTree.empty (list positive)).

Lemma reachable_predecessors:
forall p q,
reachable code successors p q ->
reachable make_predecessors (fun l => l) q p.