AFTD Auto-Formalizing Theoretical Domains

op874_no_partial_mixed_closed_set

theoremverified

In a strongly connected directed two-out graph with no globally mixed bit assignment, no nonempty finite set can have a bit assignment where every vertex has an opposite-bit successor inside the set.

Statement

theorem op874_no_partial_mixed_closed_set {X : Type*} [Fintype X] [DecidableEq X]
    (p q : Equiv.Perm X)
    (hstrong : ∀ u v, ∃ w : List Bool, w.foldl (fun x bit => if bit then p x else q x) u = v)
    (hno : ∀ b : X → Bool, ∃ x, b x = b (p x) ∧ b x = b (q x))
    (S : Finset X) (hS : S.Nonempty) (b0 : X → Bool)
    (hmixed : ∀ x ∈ S, (p x ∈ S ∧ b0 x ≠ b0 (p x)) ∨ (q x ∈ S ∧ b0 x ≠ b0 (q x))) : False
Source
Any closed-support mixed bit assignment extends along paths.
Verified
22 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1
  • op874_extend_bits_along_pathsIf every vertex can reach a prescribed finite set, any Boolean assignment on that set extends so that every outside vertex has an outgoing…
Used by 1

The proof, explained

Suppose for contradiction that such a subset S and partial bit assignment b0 exist. Because the graph is strongly connected, every vertex can reach the nonempty set S. Extending b0 along reachability paths produces a global bit assignment under which every vertex outside S has an opposite-bit successor. But by assumption, every global bit assignment has a vertex whose successors are both monochromatic, and this vertex can lie neither inside S (by the mixed condition on S) nor outside S (by the construction of the extension).

  1. Any sequence of steps along the permutations p and q forms a path in the reflexive-transitive closure of the graph's edge relation R.

    Define the directed adjacency relation R(u, v) as p(u) = v ∨ q(u) = v. By induction on the sequence of choices w, any walk starting at u follows edges in R: the empty list reaches u itself by reflexivity (`Relation.ReflTransGen.refl`), and for a non-empty list `bit :: w`, taking the step determined by `bit` and applying `Relation.ReflTransGen.head` with the induction hypothesis completes the path.

    lines 7–14

    uses Relation.ReflTransGen.refl, List.foldl_cons, Relation.ReflTransGen.head

      let R : X → X → Prop := fun u v => p u = v ∨ q u = v
      have walk (u : X) (w : List Bool) : Relation.ReflTransGen R u (w.foldl (fun x bit => if bit then p x else q x) u) := by
        induction w generalizing u with
        | nil => exact Relation.ReflTransGen.refl
        | cons bit w ih =>
          simp only [List.foldl_cons]
          apply Relation.ReflTransGen.head _ (ih _)
          cases bit <;> simp [R]
  2. Every vertex in X can reach the subset S via a path in R.

    Since S is nonempty, fix an element z ∈ S. By strong connectivity (`hstrong`), there is a directed walk from any given vertex u to z. By the walk lemma, this walk corresponds to a path in the reflexive-transitive closure of R ending in S.

    lines 15–18

      obtain ⟨z, hz⟩ := hS
      have hreach (u : X) : ∃ v ∈ S, Relation.ReflTransGen R u v := by
        obtain ⟨w, hw⟩ := hstrong u z
        exact ⟨z, hz, hw ▸ walk u w⟩
  3. The bit assignment b0 on S extends to a global bit assignment b on X such that every vertex outside S has an outgoing edge to an opposite-bit vertex.

    Applying the lemma `op874_extend_bits_along_paths` with the reachability condition yields an extension b : X → Bool agreeing with b0 on S such that each x ∉ S has an R-neighbor with an opposite bit.

    line 19

    uses op874_extend_bits_along_paths

      obtain ⟨b, hb, hout⟩ := op874_extend_bits_along_paths R S b0 hreach
  4. There is a vertex x whose two successors p(x) and q(x) both share the same bit as x under b.

    By hypothesis `hno`, no bit assignment on X is globally mixed, so there must exist a vertex x with b(x) = b(p(x)) = b(q(x)).

    line 20

      obtain ⟨x, hxp, hxq⟩ := hno b
  5. The vertex x cannot belong to S.

    If x ∈ S, then by the hypothesis `hmixed`, x must have a successor y ∈ {p(x), q(x)} in S with b0(x) ≠ b0(y). But on S, b coincides with b0, while b(x) = b(p(x)) = b(q(x)), which forces b0(x) = b0(y), a contradiction.

    lines 21–24

      by_cases hx : x ∈ S
      · rcases hmixed x hx with ⟨hp, hn⟩ | ⟨hq, hn⟩
        · exact hn ((hb x hx).symm.trans (hxp.trans (hb (p x) hp)))
        · exact hn ((hb x hx).symm.trans (hxq.trans (hb (q x) hq)))
  6. The vertex x cannot lie outside S, which completes the proof of False.

    If x ∉ S, the extension guarantees the existence of a successor y with R(x, y) and b(x) ≠ b(y). Since R(x, y) means y = p(x) or y = q(x), this contradicts b(x) = b(p(x)) and b(x) = b(q(x)).

    lines 25–28

      · obtain ⟨y, hxy, hxyb⟩ := hout x hx
        rcases hxy with h | h
        · exact hxyb (h ▸ hxp)
        · exact hxyb (h ▸ hxq)
Relation.ReflTransGen.refl
Every vertex can reach itself in zero steps in the reflexive-transitive closure of a relation.
List.foldl_cons
Folding an accumulator across a list whose head is `a` and tail is `l` is equivalent to folding across `l` starting from the updated accumulator.
Relation.ReflTransGen.head
Prepending a single edge step to a path in the reflexive-transitive closure yields a valid path in the reflexive-transitive closure.
op874_extend_bits_along_paths
If every vertex can reach a subset S along paths in a relation R, any bit assignment on S extends to the entire graph such that every vertex outside S has an R-successor with an opposite bit.

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 op874_no_partial_mixed_closed_set {X : Type*} [Fintype X] [DecidableEq X]    (p q : Equiv.Perm X)    (hstrong : ∀ u v, ∃ w : List Bool, w.foldl (fun x bit => if bit then p x else q x) u = v)    (hno : ∀ b : X → Bool, ∃ x, b x = b (p x) ∧ b x = b (q x))    (S : Finset X) (hS : S.Nonempty) (b0 : X → Bool)    (hmixed : ∀ x ∈ S, (p x ∈ S ∧ b0 x ≠ b0 (p x)) ∨ (q x ∈ S ∧ b0 x ≠ b0 (q x))) : False := by  let R : X → X → Prop := fun u v => p u = v ∨ q u = v  have walk (u : X) (w : List Bool) : Relation.ReflTransGen R u (w.foldl (fun x bit => if bit then p x else q x) u) := by    induction w generalizing u with    | nil => exact Relation.ReflTransGen.refl    | cons bit w ih =>      simp only [List.foldl_cons]      apply Relation.ReflTransGen.head _ (ih _)      cases bit <;> simp [R]  obtain ⟨z, hz⟩ := hS  have hreach (u : X) : ∃ v ∈ S, Relation.ReflTransGen R u v := by    obtain ⟨w, hw⟩ := hstrong u z    exact ⟨z, hz, hw ▸ walk u w⟩  obtain ⟨b, hb, hout⟩ := op874_extend_bits_along_paths R S b0 hreach  obtain ⟨x, hxp, hxq⟩ := hno b  by_cases hx : x ∈ S  · rcases hmixed x hx with ⟨hp, hn⟩ | ⟨hq, hn⟩    · exact hn ((hb x hx).symm.trans (hxp.trans (hb (p x) hp)))    · exact hn ((hb x hx).symm.trans (hxq.trans (hb (q x) hq)))  · obtain ⟨y, hxy, hxyb⟩ := hout x hx    rcases hxy with h | h    · exact hxyb (h ▸ hxp)    · exact hxyb (h ▸ hxq)
See it in the graphDiscuss this resultChallenge it