Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Proof of Theorem 1, p. 4 — layer d of the breadth-first search is the set of intervals at δ′-distance exactly d from the minimal intervals

Proved
MonoReset.IntervalBFS.bfs_layers

by mikedeng1 · Oct 24, 2026 · Mathlib 0df444a (Lean v4.33.1)

automatabreadth-first-searchmonotonic-automatonp2o-batch-pfp2ap2o-gran-per-chapterp2o-plan-paperp2o-strengthenedp2o-v1reset-sequencesynchronizing-word

Let (S,Σ,δ)(S, \Sigma, \delta)(S,Σ,δ) be any automaton (monotonicity is not needed) and X⊆SX \subseteq SX⊆S. Consider the breadth-first search of the algorithm: layer 000 is the set of minimal intervals containing XXX, and layer d+1d+1d+1 consists of the intervals δ′(σ,I)≠∞\delta'(\sigma, I) \ne \inftyδ′(σ,I)=∞, computed by the table-based evaluation, for III in layer ddd and σ∈Σ\sigma \in \Sigmaσ∈Σ, that lie in no earlier layer. Then for every d≥0d \ge 0d≥0 and every interval III,

I∈Ld  ⟺  min⁡{∣τ∣:τ∈Σ∗, τ leads some minimal interval to I}=d,I \in L_d \iff \min\{|\tau| : \tau \in \Sigma^*,\ \tau \text{ leads some minimal interval to } I\} = d,I∈Ld​⟺min{∣τ∣:τ∈Σ∗, τ leads some minimal interval to I}=d,

i.e. some word of length ddd leads a minimal interval containing XXX to III, and no shorter word does. Here "τ\tauτ leads I0I_0I0​ to III" means that applying the table-based transitions letter by letter from I0I_0I0​ ends at III (never at ∞\infty∞).

This is the correctness of "the standard breadth first search algorithm" in the proof of Theorem 1: the first layer containing a singleton interval is at the minimum distance of any singleton.

Formalization Note States are Fin n, with sis_isi​ the element i−1i-1i−1 and the cyclic order 0→1→⋯→n−1→00 \to 1 \to \cdots \to n-1 \to 00→1→⋯→n−1→0; letters are Fin k; a word is a list read left to right. An interval [si,sj][s_i, s_j][si​,sj​] is its pair of endpoints, and ∞ is none. Monotonicity is read cyclically (see the definition item).

Differences from the source:

  • reading: the shortest path from one of these intervals to a singleton can be found using the standard breadth first search algorithm → for all d and I: I ∈ (layers δ X d).1 ↔ some word of length d leads a minimal interval to I under dPrimeFast, and every word that does has length ≥ d; reason: the claim about the standard algorithm is stated as the layer invariant of the layered search the goal runs, which is what yields the shortest path
  • encoding: transitions of the interval automaton δ′ → the table-based evaluation dPrimeFast; reason: the algorithm evaluates δ′ through the preimage table; the preimage-test milestone shows dPrimeFast = dPrime1 for monotonic letters
  • encoding: states s1, …, sn in cyclic order, letters σ1, …, σk, words in Σ∗ with δ(τ1τ2, s) = δ(τ2, δ(τ1, s)) → states Fin n with s_i = i − 1 and the cyclic order of Fin n, letters Fin k, words List (Fin k) read left to right (run = left fold); reason: relabelling; same instances
  • encoding: interval [s_i, s_j] and the symbol ∞ → endpoint pair (i, j) : Fin n × Fin n with state set ivSet (i, j); ∞ is none in Option (Fin n × Fin n); reason: same objects; the n representations of S stay distinct pairs, as in the source
  • generalization: the breadth-first search runs on the monotonic automaton of Theorem 1 (standing assumption of the section, p. 2) → no monotonicity hypothesis: the layer invariant is stated for every transition function δ; reason: the layer invariant is a property of the layered search alone; it specializes to the source's monotonic automata
Preamble
import Mathlib
import Definitions.Def_MonoReset_IntervalBFS_Model
import Definitions.Def_MonoReset_IntervalBFS_Algorithm
Formal statement
namespace MonoReset.IntervalBFS

theorem bfs_layers {n k : ℕ} (δ : Fin k → Fin n → Fin n) (X : Finset (Fin n)) (d : ℕ)
    (I : Fin n × Fin n) :
    I ∈ (layers δ X d).1 ↔
      (∃ τ : List (Fin k), τ.length = d ∧
          ∃ I₀ ∈ minIntervals X, τ.foldl (fun J a => dPrimeFast δ a J) (some I₀) = some I) ∧
      ∀ τ : List (Fin k),
        (∃ I₀ ∈ minIntervals X, τ.foldl (fun J a => dPrimeFast δ a J) (some I₀) = some I) →
          d ≤ τ.length := by sorry

end MonoReset.IntervalBFS
Source
Eppstein, Reset Sequences for Monotonic Automata, author manuscript of 7 Feb 1990 (SIAM J. Comput. 19, doi:10.1137/0219033; PDF sha256 6d8caa76…), p. 4 (PDF 5), proof of Theorem 1 ("Finally, the shortest path from one of these intervals to a singleton can be found using the standard breadth first search algorithm.")
Human review
  • Endorsed by Shuze Chen · Oct 24, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 24, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me