AFTD Auto-Formalizing Theoretical Domains

prioritized_borel_double_cycle_amplification

theoremverified

Two different closed walks from one state spelling the same word give 2^n different closed walks spelling a common word of n times the original length.

Statement

theorem prioritized_borel_double_cycle_amplification {Q : Type} (T : Q → Bool → Q → Prop)
    (q : Q) (x y : List (Bool × Q)) (hx : Op1385StateWalk T q x q) (hy : Op1385StateWalk T q y q)
    (hw : x.map Prod.fst = y.map Prod.fst) (hne : x ≠ y) (n : ℕ) :
    ∃ (w : List Bool) (F : Finset (List (Bool × Q))), w.length = n*x.length ∧ F.card = 2^n ∧
      ∀ z ∈ F, Op1385StateWalk T q z q ∧ z.map Prod.fst = w
Source
State projections for arXiv:2611.10136, Conjecture 19. The equal-word double-cycle obstruction is the EDA condition in General Algorithms for Testing the Ambiguity of Finite Automata, https://cs.nyu.edu/~mohri/pub/amb.pdf.
Verified
28 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 2
  • Op1385StateWalkA walk of a fixed binary-labeled state graph records its sequence of public directions and successor states.
  • prioritized_borel_no_double_cycle_segmentsIf a finite state-transition graph admits at most one closed state walk for each start and public word, segments that stay inside a…
Used by 1

The proof, explained

The proof proceeds by induction on n. For the base case n = 0, the empty walk from q to q trivially spells the empty word. For the induction step, given a set of 2^n closed walks spelling w, each walk is extended by appending either x or y, yielding candidate walks that all spell w followed by the common word spelled by x and y. Because x and y have equal lengths but are distinct, right-cancellation of list concatenation ensures that appending x versus y produces disjoint sets of walks, doubling the number of walks to 2^(n + 1).

  1. The two closed walks x and y have the same length (|x| = |y|).

    Because x and y spell the same boolean word (hypothesis hw), applying List.length to both sides via congrArg yields that their lengths are equal, since projecting a list preserves its length.

    lines 6–7

    uses congrArg, List.length

      classical
      have hlen : x.length = y.length := by simpa using congrArg List.length hw
  2. The base case n = 0 holds with the empty word and the singleton set containing only the empty walk.

    For n = 0, we choose the empty word w = [] and the set of walks F = {[]}. The word length is 0 = 0 * |x|, and the set cardinality is 1 = 2^0. The only walk in F is the empty list [], which is a valid closed walk at q by the root constructor of Op1385StateWalk and trivially spells [].

    lines 8–14

    uses Finset.mem_singleton.mp

      induction n with
      | zero =>
        refine ⟨[],{[]},by simp,by simp,?_⟩
        intro z hz
        have he : z = [] := Finset.mem_singleton.mp hz
        subst z
        exact ⟨.root,rfl⟩
  3. From the induction hypothesis for n, we obtain the induction data and define list concatenation as an injective embedding.

    The induction hypothesis provides a word w of length n * |x| and a set F of 2^n closed walks at q spelling w. Appending a fixed list a to the right defines an embedding of lists, whose injectivity follows from right-cancellation of list concatenation (List.append_cancel_right).

    lines 15–18

    uses List.append_cancel_right

      | succ n ih =>
        obtain ⟨w,F,hwlen,hcard,hF⟩ := ih
        let embed (a : List (Bool × Q)) : List (Bool × Q) ↪ List (Bool × Q) :=
          ⟨(fun l => l ++ a), fun _ _ h => List.append_cancel_right h⟩
  4. Extending the walks in F by appending x versus appending y produces disjoint sets.

    Suppose for contradiction that some walk l belongs to both F extended by x and F extended by y. Then l = u ++ x = v ++ y for some u, v ∈ F. Because x and y have the same length (|x| = |y|), right-cancellation with equal suffix lengths (List.append_inj_right') implies x = y, which contradicts the hypothesis hne that x ≠ y.

    lines 19–25

    uses Finset.disjoint_left, Finset.mem_map.mp, List.append_inj_right'

        have hd : Disjoint (F.map (embed x)) (F.map (embed y)) := by
          rw [Finset.disjoint_left]
          intro l hl hr
          obtain ⟨u,_,hu⟩ := Finset.mem_map.mp hl
          obtain ⟨v,_,hv⟩ := Finset.mem_map.mp hr
          have heq : u ++ x = v ++ y := hu.trans hv.symm
          exact hne (List.append_inj_right' heq hlen)
  5. The extended word and the union of the two extended walk sets satisfy the length and cardinality requirements for n + 1.

    We choose the new word to be w ++ (x.map Prod.fst) and the new set of walks to be the union of F extended by x and F extended by y. The new word has length |w| + |x| = n * |x| + |x| = (n + 1) * |x|. Since the two extended sets are disjoint and each is an injective image of F, the cardinality of the union is |F| + |F| = 2^n + 2^n = 2^(n + 1).

    lines 26–29

    uses Nat.succ_mul, Finset.card_union_of_disjoint, Finset.card_map, pow_succ

        refine ⟨w ++ x.map Prod.fst,F.map (embed x) ∪ F.map (embed y),?_,?_,?_⟩
        · simp [hwlen,Nat.succ_mul]
        · rw [Finset.card_union_of_disjoint hd,Finset.card_map,Finset.card_map,hcard,pow_succ]
          omega
  6. Every walk in the union is a valid closed walk from q to q spelling the new word.

    Any walk in the union is of the form t ++ x or t ++ y for some t ∈ F. By the induction hypothesis, t is a closed walk at q; appending x (or y), which is also a closed walk at q, yields a closed walk at q via op1385_walk_append. Furthermore, projecting via Prod.fst yields the projection of t (which is w) followed by the projection of x (or y, which equals the projection of x by hw), matching the target word.

    lines 30–35

    uses Finset.mem_union.mp, Finset.mem_map.mp, op1385_walk_append, List.map_append

        · intro z hz
          rcases Finset.mem_union.mp hz with hz | hz
          · obtain ⟨t,ht,rfl⟩ := Finset.mem_map.mp hz
            exact ⟨op1385_walk_append (hF t ht).1 hx,by change (t ++ x).map Prod.fst = _; rw [List.map_append,(hF t ht).2]⟩
          · obtain ⟨t,ht,rfl⟩ := Finset.mem_map.mp hz
            exact ⟨op1385_walk_append (hF t ht).1 hy,by change (t ++ y).map Prod.fst = _; rw [List.map_append,(hF t ht).2,hw]⟩
congrArg
Applying a function to both sides of an equality preserves equality: if a₁ = a₂, then f(a₁) = f(a₂).
List.length
The length (number of elements) of a list.
Finset.mem_singleton.mp
An element belongs to a singleton set {a} only if it is equal to a.
List.append_cancel_right
Right-cancellation for list concatenation: if as ++ bs = cs ++ bs, then as = cs.
Finset.disjoint_left
Two finite sets are disjoint if and only if every element of the first set is not in the second set.
Finset.mem_map.mp
An element belongs to the image of a set under an embedding only if it is the image of some element in that set.
List.append_inj_right'
If two concatenated lists are equal (s₁ ++ t₁ = s₂ ++ t₂) and their suffix lists have equal lengths, then their suffix lists are equal (t₁ = t₂).
Nat.succ_mul
Multiplication distributes over successor: (n + 1) * m = n * m + m.
Finset.card_union_of_disjoint
The cardinality of the union of two disjoint finite sets is the sum of their cardinalities.
Finset.card_map
Mapping a finite set through an injective function preserves its cardinality.
pow_succ
Successor power rule for monoids: a^(n + 1) = a^n * a.
Finset.mem_union.mp
An element belongs to the union of two sets only if it belongs to the first set or the second set.
op1385_walk_append
Concatenating a valid state walk from p to q with a valid state walk from q to r yields a valid state walk from p to r.
List.map_append
Mapping a function over the concatenation of two lists equals concatenating the mapped lists: map f (l₁ ++ l₂) = map f l₁ ++ map f l₂.

Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

theorem prioritized_borel_double_cycle_amplification {Q : Type} (T : Q → Bool → Q → Prop)    (q : Q) (x y : List (Bool × Q)) (hx : Op1385StateWalk T q x q) (hy : Op1385StateWalk T q y q)    (hw : x.map Prod.fst = y.map Prod.fst) (hne : x ≠ y) (n : ℕ) :    ∃ (w : List Bool) (F : Finset (List (Bool × Q))), w.length = n*x.length ∧ F.card = 2^n ∧      ∀ z ∈ F, Op1385StateWalk T q z q ∧ z.map Prod.fst = w := by  classical  have hlen : x.length = y.length := by simpa using congrArg List.length hw  induction n with  | zero =>    refine ⟨[],{[]},by simp,by simp,?_⟩    intro z hz    have he : z = [] := Finset.mem_singleton.mp hz    subst z    exact ⟨.root,rfl⟩  | succ n ih =>    obtain ⟨w,F,hwlen,hcard,hF⟩ := ih    let embed (a : List (Bool × Q)) : List (Bool × Q) ↪ List (Bool × Q) :=      ⟨(fun l => l ++ a), fun _ _ h => List.append_cancel_right h⟩    have hd : Disjoint (F.map (embed x)) (F.map (embed y)) := by      rw [Finset.disjoint_left]      intro l hl hr      obtain ⟨u,_,hu⟩ := Finset.mem_map.mp hl      obtain ⟨v,_,hv⟩ := Finset.mem_map.mp hr      have heq : u ++ x = v ++ y := hu.trans hv.symm      exact hne (List.append_inj_right' heq hlen)    refine ⟨w ++ x.map Prod.fst,F.map (embed x) ∪ F.map (embed y),?_,?_,?_⟩    · simp [hwlen,Nat.succ_mul]    · rw [Finset.card_union_of_disjoint hd,Finset.card_map,Finset.card_map,hcard,pow_succ]      omega    · intro z hz      rcases Finset.mem_union.mp hz with hz | hz      · obtain ⟨t,ht,rfl⟩ := Finset.mem_map.mp hz        exact ⟨op1385_walk_append (hF t ht).1 hx,by change (t ++ x).map Prod.fst = _; rw [List.map_append,(hF t ht).2]⟩      · obtain ⟨t,ht,rfl⟩ := Finset.mem_map.mp hz        exact ⟨op1385_walk_append (hF t ht).1 hy,by change (t ++ y).map Prod.fst = _; rw [List.map_append,(hF t ht).2,hw]⟩
See it in the graphDiscuss this resultChallenge it