AFTD Auto-Formalizing Theoretical Domains

op874_no_even_auxiliary_cycle

theoremverified

The no-global-mixed-bits hypothesis excludes every nonempty simple even directed cycle.

Statement

theorem op874_no_even_auxiliary_cycle {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)) (n : ℕ) [NeZero n] (heven : Even n) (c : Fin n → X) (hinj : Function.Injective c) (harc : ∀ i, p (c i) = c (i+1) ∨ q (c i) = c (i+1)) : False
Source
Mixed-set obstruction excludes alternating even directed cycles.
Verified
22 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1
  • op874_no_partial_mixed_closed_setIn a strongly connected directed two-out graph with no globally mixed bit assignment, no nonempty finite set can have a bit assignment…
Used by 1
  • op874_no_auxiliary_two_cycleIn a strongly connected no-even auxiliary graph, two distinct vertices cannot be joined by arcs in both directions.

The proof, explained

The theorem shows that no simple even directed cycle whose edges are generated by permutations p and q can exist under the given hypotheses. The strategy is to derive a contradiction via op874_no_partial_mixed_closed_set, which forbids any nonempty subset from admitting a boolean coloring that flips across some outgoing transition from every vertex. Taking S to be the image of the cycle, we color each vertex by the parity of its cycle index; because n is even and the cycle is simple, consecutive vertices always receive opposite colors. Since every cycle vertex has an arc of p or q leading to the next vertex in S, this coloring satisfies the alternating condition on S, yielding a contradiction.

  1. The cycle length n is at least 2.

    Assuming classical logic, since n is nonzero (by NeZero.ne) and even, linear arithmetic establishes that 2 ≤ n.

    lines 2–6

    uses NeZero.ne

      classical
      have hn : 2 ≤ n := by
        have hn0 := NeZero.ne n
        rcases heven with ⟨k, hk⟩
        omega
  2. Define the cycle's vertex set S and an alternating boolean coloring `bits`, noting that each cycle vertex belongs to S.

    Let S be the image of the cycle map c, so c(i) ∈ S for all i (using Finset.mem_image.mpr and Finset.mem_univ). Define a boolean coloring `bits` on X that assigns true to a vertex v precisely when v = c(i) for some even index i.

    lines 7–9

    uses Finset.mem_image.mpr, Finset.mem_univ

      let S : Finset X := Finset.univ.image c
      let bits : X → Bool := fun v => decide (∃ i : Fin n, c i = v ∧ i.val % 2 = 0)
      have hmem (i : Fin n) : c i ∈ S := Finset.mem_image.mpr ⟨i, Finset.mem_univ _, rfl⟩
  3. On vertices of the cycle, `bits (c i)` is true if and only if the index i is even.

    Because c is injective, any cycle vertex c(j) equals c(i) if and only if j = i. Hence, the existential condition that c(i) is the image of an even index reduces to i % 2 = 0.

    lines 10–18

      have hbits (i : Fin n) : bits (c i) = decide (i.val % 2 = 0) := by
        have heq : (∃ j : Fin n, c j = c i ∧ j.val % 2 = 0) ↔ i.val % 2 = 0 := by
          constructor
          · rintro ⟨j, hj, hpar⟩
            have : j = i := hinj hj
            simpa [this] using hpar
          · intro hpar
            exact ⟨i, rfl, hpar⟩
        simp only [bits, heq]
  4. The numerical value of (i + 1) in Fin n is i + 1 when i + 1 < n, and 0 when i = n - 1.

    By Fin.val_add and Fin.val_one (since 1 < n), (i + 1).val = (i + 1) % n. If i + 1 < n, the modulus has no effect by Nat.mod_eq_of_lt. Otherwise, since i < n, we must have i + 1 = n, in which case the remainder modulo n is 0.

    lines 19–26

    uses Fin.val_add, Fin.val_one, Nat.mod_eq_of_lt

      have hval (i : Fin n) : (i+1).val = if i.val + 1 < n then i.val + 1 else 0 := by
        rw [Fin.val_add]
        have hone : (1 : Fin n).val = 1 := by simp [Fin.val_one, Nat.mod_eq_of_lt (by omega : 1 < n)]
        rw [hone]
        split_ifs with h
        · exact Nat.mod_eq_of_lt h
        · have heq : i.val + 1 = n := by have := i.isLt; omega
          simp [heq]
  5. Consecutive cycle vertices receive opposite colors under `bits`.

    Using hbits and the explicit value of (i + 1).val, we compare the parity of i and (i + 1).val. If i + 1 < n, then i and i + 1 have opposite parities. If i + 1 = n, then i = n - 1 is odd (since n is even) while the wrap-around index 0 is even, so the colors differ in both cases.

    lines 27–37

      have hdiff (i : Fin n) : bits (c i) ≠ bits (c (i+1)) := by
        rw [hbits, hbits, hval]
        rcases heven with ⟨k, hk⟩
        split_ifs with h
        · by_cases hi : i.val % 2 = 0
          · have hj : (i.val + 1) % 2 ≠ 0 := by omega
            simp [hi, hj]
          · have hj : (i.val + 1) % 2 = 0 := by omega
            simp [hi, hj]
        · have hi : i.val % 2 ≠ 0 := by have := i.isLt; omega
          simp [hi]
  6. The existence of this alternating cycle contradicts the no-partial-mixed-closed-set theorem, proving False.

    We apply op874_no_partial_mixed_closed_set to S, with nonemptiness witnessed by c(0) ∈ S, and the coloring `bits`. For each v ∈ S, written as c(i) via Finset.mem_image.mp, the cycle hypothesis ensures an arc p(c(i)) = c(i+1) or q(c(i)) = c(i+1). In either case, the successor lies in S and has the opposite color by hdiff, fulfilling the premise of op874_no_partial_mixed_closed_set and completing the proof.

    lines 38–45

    uses op874_no_partial_mixed_closed_set, Finset.mem_image.mp

      refine op874_no_partial_mixed_closed_set p q hstrong hno S ⟨c 0, hmem 0⟩ bits ?_
      intro v hv
      obtain ⟨i, _, rfl⟩ := Finset.mem_image.mp hv
      rcases harc i with hp | hq
      · left
        exact ⟨hp ▸ hmem (i+1), hp ▸ hdiff i⟩
      · right
        exact ⟨hq ▸ hmem (i+1), hq ▸ hdiff i⟩
NeZero.ne
A nonzero natural number (or element of a type with zero) is not equal to zero.
Finset.mem_image.mpr
An element y belongs to the image f(s) if there is some x in s with f(x) = y.
Finset.mem_univ
Every element of a finite type belongs to the universal finset Finset.univ.
Fin.val_add
The numerical value of the sum of two elements of Fin n is their sum modulo n.
Fin.val_one
The numerical value of 1 in Fin n is 1 (for n > 1).
Nat.mod_eq_of_lt
If a < b, then a % b = a.
Finset.mem_image.mp
If y belongs to f(s), then there exists some x in s such that f(x) = y.
op874_no_partial_mixed_closed_set
Under the global non-mixed hypotheses on permutations p and q, no nonempty subset S can have a boolean coloring such that every element of S has an outgoing transition under p or q staying in S that flips the color.

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_even_auxiliary_cycle {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)) (n : ℕ) [NeZero n] (heven : Even n) (c : Fin n → X) (hinj : Function.Injective c) (harc : ∀ i, p (c i) = c (i+1) ∨ q (c i) = c (i+1)) : False := by  classical  have hn : 2 ≤ n := by    have hn0 := NeZero.ne n    rcases heven with ⟨k, hk⟩    omega  let S : Finset X := Finset.univ.image c  let bits : X → Bool := fun v => decide (∃ i : Fin n, c i = v ∧ i.val % 2 = 0)  have hmem (i : Fin n) : c i ∈ S := Finset.mem_image.mpr ⟨i, Finset.mem_univ _, rfl⟩  have hbits (i : Fin n) : bits (c i) = decide (i.val % 2 = 0) := by    have heq : (∃ j : Fin n, c j = c i ∧ j.val % 2 = 0) ↔ i.val % 2 = 0 := by      constructor      · rintro ⟨j, hj, hpar⟩        have : j = i := hinj hj        simpa [this] using hpar      · intro hpar        exact ⟨i, rfl, hpar⟩    simp only [bits, heq]  have hval (i : Fin n) : (i+1).val = if i.val + 1 < n then i.val + 1 else 0 := by    rw [Fin.val_add]    have hone : (1 : Fin n).val = 1 := by simp [Fin.val_one, Nat.mod_eq_of_lt (by omega : 1 < n)]    rw [hone]    split_ifs with h    · exact Nat.mod_eq_of_lt h    · have heq : i.val + 1 = n := by have := i.isLt; omega      simp [heq]  have hdiff (i : Fin n) : bits (c i) ≠ bits (c (i+1)) := by    rw [hbits, hbits, hval]    rcases heven with ⟨k, hk⟩    split_ifs with h    · by_cases hi : i.val % 2 = 0      · have hj : (i.val + 1) % 2 ≠ 0 := by omega        simp [hi, hj]      · have hj : (i.val + 1) % 2 = 0 := by omega        simp [hi, hj]    · have hi : i.val % 2 ≠ 0 := by have := i.isLt; omega      simp [hi]  refine op874_no_partial_mixed_closed_set p q hstrong hno S ⟨c 0, hmem 0⟩ bits ?_  intro v hv  obtain ⟨i, _, rfl⟩ := Finset.mem_image.mp hv  rcases harc i with hp | hq  · left    exact ⟨hp ▸ hmem (i+1), hp ▸ hdiff i⟩  · right    exact ⟨hq ▸ hmem (i+1), hq ▸ hdiff i⟩
See it in the graphDiscuss this resultChallenge it