The rounds of breadth-first search and inductive counting #
Round n of the breadth-first search of a relation r from a is the set
Relation.reachableWithin r a n of elements reached within n steps. The rounds grow, each is
the previous one together with its successors, and once a round adds nothing it is the set of all
reachable elements; on a finite type with N elements, round N - 1 already is.
The method of inductive counting of Immerman and Szelepcsényi certifies that an element is
not reachable, using only the sizes of the rounds. Its principle is that a subset of a finite
set with at least as many elements is the whole set (Set.eq_of_subset_of_ncard_le). So a list
of distinct members of round n, with at least as many entries as the round has members,
contains every member of the round (Relation.IsRoundList), and an element missing from such a
list is outside the round. Membership of each entry is itself certified by a walk of exactly n
steps that may stay put (Relation.relatesWithinSteps_iff_relatesInSteps_reflGen). A
nondeterministic machine guesses such a list one entry at a time and only counts the entries, so
it needs to store just the size of the round, never the round.
The statements about all reachable elements come in two forms: for a finite type, and for any
type on which few elements are reachable from a (..._of_encard_le), as for the configurations
of a space-bounded machine.
Nothing here mentions a machine; these are the facts about the configuration graph that the inductive counting algorithm relies on.
Main definitions #
Relation.reachableWithin: roundnof the breadth-first search, as a set.Relation.IsRoundList: a list certifying the contents of roundnby its length.
Main results #
Relation.reachableWithin_succ,Relation.reachableWithin_mono: the round recursion.Relation.reachableWithin_eq_of_succ_eq,Relation.reachableWithin_eq_of_card_le: a round that adds nothing, or the round with index one less than the number of elements, is the set of all reachable elements.Relation.IsRoundList.mem_iff,Relation.exists_isRoundList: soundness and completeness of round lists.Relation.not_relatesWithinSteps_succ_iff: the inductive counting step, which certifies that an element is outside roundn + 1by a list for roundn.Relation.forall_reflTransGen_iff_exists_isRoundList,Relation.not_reflTransGen_iff_exists_isRoundList: on a finite type, unreachability as a certificate.
References #
The rounds of breadth-first search #
An element is in round n exactly when r relates a to it within n steps.
Round 0 consists of the starting element.
An element is in round n + 1 exactly when it is at most one step away from round n.
The round recursion. Round n + 1 is round n together with the successors of its
members.
The rounds grow.
Every round consists of reachable elements.
Every reachable element is in some round.
A round that adds nothing is final. Once round n + 1 equals round n, round n
contains every reachable element, so breadth-first search may stop.
Round N is finite once at most N + 1 elements are reachable.
Round lists #
A list certifying the contents of round n of the search from a: distinct members of the
round, at least as many as the round has. The counting principle makes the list exhaustive
(Relation.IsRoundList.mem_iff), so that an element missing from it is outside the round; this is
the certificate that the inductive counting algorithm guesses one entry at a time
Sipser, Theorem 8.27.
- nodup : l.Nodup
The entries are distinct.
- relatesWithinSteps (b : α) : b ∈ l → RelatesWithinSteps r a b n
Every entry is in round
n. There are at least as many entries as members of round
n.
Instances For
A list of distinct members of a finite round, as many as the round has, is a round list: the form in which the count is a natural number.
Round lists are sound. By the counting principle, a round list contains every member of the round.
A round list contains exactly the members of the round.
The length of a round list is the size of the round: the count that the inductive counting algorithm carries from one round to the next.
Round lists are complete. A finite round can always be listed.
Universal statements about a finite round are certified by a round list. A property
holds throughout round n exactly when some round list consists of elements with the
property.
An element is outside a finite round exactly when some round list does not contain it.
The inductive counting step. An element c is outside round n + 1 exactly when some
round list for round n contains neither c nor a predecessor of c. Checking such a list needs
only the size of round n, which is how the size of round n + 1 is computed from it.
Unreachability as a certificate #
A property of every reachable element is certified by a round list for round N, once at most
N + 1 elements are reachable.
A property of every reachable element is certified by a round list. On a finite type with
at most N + 1 elements, every element reachable from a has property p exactly when some round
list for round N consists of elements with property p. With p the property of not being
accepting, this is what a nondeterministic machine certifies to accept the complement of a
language decided by reachability Sipser, Theorem 8.27.
Unreachability is certified by a round list. On a finite type with at most N + 1
elements, b is not reachable from a exactly when some round list for round N does not
contain b.