Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Theorem 1, p. 4 — interval BFS returns a minimum-length reset sequence of X exactly when one exists, at counted cost ≤ 11·k·n²

Proved
MonoReset.IntervalBFS.theorem_1

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

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

Let (S,Σ,δ)(S, \Sigma, \delta)(S,Σ,δ) be a monotonic automaton with nnn states and kkk letters, and let X⊆SX \subseteq SX⊆S be any set of initial states. Run the algorithm of the definition item: build the preimage table, compute the minimal intervals containing XXX, run the breadth-first search over the interval automaton with the table-based evaluation of δ′\delta'δ′, stop at the first layer DDD that contains a singleton interval or is empty, and output a word read off the parent pointers, or "none". Then:

  1. (decision) the output is "none" if and only if XXX has no reset sequence;
  2. (minimum length) every output word τ\tauτ is a reset sequence of XXX, ∣δ(τ,X)∣=1|\delta(\tau, X)| = 1∣δ(τ,X)∣=1, and ∣τ∣≤∣τ′∣|\tau| \le |\tau'|∣τ∣≤∣τ′∣ for every reset sequence τ′∈Σ∗\tau' \in \Sigma^*τ′∈Σ∗ of XXX;
  3. (time O(kn2)O(kn^2)O(kn2)) if k≥1k \ge 1k≥1, the counted cost of the run satisfies
cost≤11 k n2.\mathrm{cost} \le 11\, k\, n^2 .cost≤11kn2.

The cost counts kn⋅nk n \cdot nkn⋅n units for the preimage table, one dequeue and one evaluation per letter (3 or 8 units) for every interval of every layer up to DDD, and DDD units for the output word. This is Eppstein's improvement of Natarajan's O(kn4)O(kn^4)O(kn4) algorithms, which did not guarantee a shortest sequence; the same search yields the length bound n2−2n+1n^2 - 2n + 1n2−2n+1 of Theorem 2.

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:

  • generalization: a minimum length reset sequence can be found (for X with a reset sequence) → bfsResult δ X = none ↔ no word resets X, together with the minimum-length clause for every returned word; reason: the abstract and p. 1–2 say the algorithm either produces a sequence or proves none exists; the decision clause adds this and specializes to the printed claim when a reset sequence exists
  • generalization: initial states X = {s_{i_1}, s_{i_2}, …} → every X : Finset (Fin n), including X = ∅ (output none) and singletons (output the empty word); reason: covers the source's nonempty X; the degenerate sets are included rather than excluded
  • generalization: time bounded by O(kn^2) → 0 < k → bfsCost δ X ≤ 11 * k * n ^ 2; reason: an explicit constant implies the O-bound; k ≥ 1 because Σ = {σ1, …, σk} is an alphabet, and at k = 0 any bound C·k·n² is 0 while the search still reads X
  • encoding: time of the algorithm → bfsCost: k·n·n for the kn preimage intervals, (1 + Σ_a evalCost) per interval of each layer up to bfsStop with evalCost ∈ {3, 8}, plus bfsStop for the output; reason: no machine model is formalized; the cost is the source's own unit count, computed from the layers the run visits, not from n²
  • reading: δ monotonic: δ(σ, s1), …, δ(σ, sn), after removal of adjacent duplicate states, is a subsequence of a cyclic permutation of s1, …, sn → IsMonotonic (δ a) for every letter a: n = 0, or for some start m the cyclic offsets (δ a (m + i) − δ a m) mod n are nondecreasing in i; reason: 'adjacent' is read cyclically, as 'preserves the cyclic order' requires; this reading admits more automata than the linear one (s1→s1, s2→s2, s3→s1), so the statement is the stronger one; checked equal to the cyclic de-duplication reading for every map with n ≤ 6
  • 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
Preamble
import Mathlib
import Definitions.Def_MonoReset_IntervalBFS_Model
import Definitions.Def_MonoReset_IntervalBFS_Algorithm
Formal statement
namespace MonoReset.IntervalBFS

theorem theorem_1 {n k : ℕ} (δ : Fin k → Fin n → Fin n) (hδ : ∀ a, IsMonotonic (δ a))
    (X : Finset (Fin n)) :
    (bfsResult δ X = none ↔ ∀ τ : List (Fin k), ¬ IsResetSeq δ X τ) ∧
    (∀ τ : List (Fin k), bfsResult δ X = some τ →
        IsResetSeq δ X τ ∧ ∀ τ' : List (Fin k), IsResetSeq δ X τ' → τ.length ≤ τ'.length) ∧
    (0 < k → bfsCost δ X ≤ 11 * k * n ^ 2) := 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), Theorem 1 and its proof; procedure and unit costs from p. 3 (PDF 4) and the proof of Theorem 2, p. 4 (PDF 5)
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