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 make_predecessors_correct_2:
forall n instr s,
code!n = Some instr -> In s (successors instr) ->
exists l, make_predecessors!s = Some l /\ In n l.