Breadth-first search by rounds #
A round of breadth-first search (Cslib.Reachability.expand) appends to the list of the elements
found so far every successor of one of them that has not been found yet. The found elements stay
distinct, a round only appends, and a round adds nothing exactly when the found elements are
closed under successors. So if at most N distinct elements are reachable from start, after
N rounds from [start] (Cslib.Reachability.search) the found elements are exactly the
reachable ones (Cslib.Reachability.mem_search_iff): each round before closure finds a new
element. The number of rounds, not a search for a fixed point, keeps the algorithm a plain
iteration, as polynomial-time certificates need.
Main definitions #
Cslib.Reachability.expand: one round of breadth-first search.Cslib.Reachability.search: a number of rounds from a start element.
Main results #
Cslib.Reachability.nodup_search: the found elements are distinct.Cslib.Reachability.reflTransGen_of_mem_search: the found elements are reachable.Cslib.Reachability.mem_search_iff: after as many rounds as there are reachable elements, the found elements are the reachable ones.
References #
Append an element unless it is already in the list.
Instances For
One round of breadth-first search: append, in order, every successor of a found element that has not been found yet.
Instances For
rounds rounds of breadth-first search from start.
Instances For
A round only appends.
A round keeps the found elements distinct.
The rounds only append.
The found elements are distinct.
The found elements are reachable.
Each round before the found elements are closed finds a new element.
After as many rounds as there are reachable elements, the found elements are the reachable
ones. If every list of distinct elements reachable from start has at most bound entries, then
after at least bound rounds the found elements are closed under successors, so they include
every reachable element.