AFTD Auto-Formalizing Theoretical Domains

op874_cycle_common_hidden_color_exposed

theoremverified

Let σ be a permutation of a finite set of vertices, and suppose each vertex has a unique marked one of three ports, numbered outside, forward, and backward. At every successor interface, the marked ports do not lie in both exposed pairs {outside,backward} and {outside,forward}. Then the marked port at every vertex is forward or backward, so it is exposed outside.

Statement

theorem op874_cycle_common_hidden_color_exposed
    {V : Type*} [Fintype V] [DecidableEq V] (σ : V ≃ V)
    (p : V → Fin 3 → Prop)
    (hsome : ∀ v, p v 0 ∨ p v 1 ∨ p v 2)
    (hunique : ∀ v i j, i ≠ j → ¬ (p v i ∧ p v j))
    (hcross : ∀ v, ¬ (p v 0 ∧ p (σ v) 0) ∧
      ¬ (p v 0 ∧ p (σ v) 1) ∧ ¬ (p v 2 ∧ p (σ v) 0) ∧
      ¬ (p v 2 ∧ p (σ v) 1)) :
    ∀ v, ¬ p v 0
Source
Cycle-interface counting for OP-874, based on the local-state criterion in arXiv:2610.41950.
Verified
28 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1
  • op874_permutation_disjoint_coverLet A and B be disjoint subsets of a finite set and let σ be a permutation. If every element v is in A or its image σ(v) is in B, then A…

The proof, explained

We define A and B as the sets of vertices where port 1 and port 2 are marked, respectively. The uniqueness of marked ports guarantees that A and B are disjoint, while the interface crossing constraints along with the existence of marked ports ensure that for every vertex v, either v ∈ A or σ(v) ∈ B. By a combinatorial lemma on finite permutations (op874_permutation_disjoint_cover), A and B must cover all vertices, meaning every vertex has either port 1 or port 2 marked. Consequently, uniqueness prevents any vertex from having port 0 marked.

  1. Let A and B be the finite sets of vertices where port 1 and port 2 are marked, respectively.

    Working in classical logic, we define the subsets A = {v ∈ V | p(v, 1)} and B = {v ∈ V | p(v, 2)} by filtering the finite set of all vertices in V.

    lines 10–12

      classical
      let A := Finset.univ.filter fun v => p v 1
      let B := Finset.univ.filter fun v => p v 2
  2. The sets A and B are disjoint.

    To show A and B are disjoint, we verify that no vertex v can belong to both sets. If v ∈ A and v ∈ B, then both p(v, 1) and p(v, 2) hold. Because 1 ≠ 2, this contradicts the uniqueness hypothesis (hunique) that no vertex can have two distinct marked ports.

    lines 13–16

    uses Finset.disjoint_left.mpr, Finset.mem_filter.mp

      have hdis : Disjoint A B := by
        apply Finset.disjoint_left.mpr
        intro v ha hb
        exact hunique v 1 2 (by decide) ⟨(Finset.mem_filter.mp ha).2, (Finset.mem_filter.mp hb).2⟩
  3. For every vertex v, either v ∈ A or σ(v) ∈ B.

    Unfolding the definitions of A and B, this claim is equivalent to p(v, 1) ∨ p(σ(v), 2). Since every vertex has at least one marked port (hsome), we have p(v, 0) ∨ p(v, 1) ∨ p(v, 2) and p(σ(v), 0) ∨ p(σ(v), 1) ∨ p(σ(v), 2). The crossing hypothesis (hcross) forbids the four pairs where v has port 0 or 2 while σ(v) has port 0 or 1. Propositional case analysis (tauto) verifies that if p(v, 1) is false, the remaining allowed cases force p(σ(v), 2) to hold.

    lines 17–23

    uses Finset.mem_filter, Finset.mem_univ, true_and

      have hcov : ∀ v, v ∈ A ∨ σ v ∈ B := by
        intro v
        simp only [A, B, Finset.mem_filter, Finset.mem_univ, true_and]
        have h1 := hsome v
        have h2 := hsome (σ v)
        have hc := hcross v
        tauto
  4. Every vertex v belongs to A or B (v ∈ A ∨ v ∈ B).

    Applying the helper lemma op874_permutation_disjoint_cover to the permutation σ and the disjoint sets A and B satisfying ∀ v, v ∈ A ∨ σ(v) ∈ B, we deduce that A and B together cover the entire vertex set V.

    line 24

    uses op874_permutation_disjoint_cover

      have hall := op874_permutation_disjoint_cover σ A B hdis hcov
  5. For every vertex v, port 0 is not marked (¬p(v, 0)).

    Suppose for contradiction that p(v, 0) holds for some vertex v. Because A and B cover V, we know that v ∈ A or v ∈ B, which simplifies to p(v, 1) ∨ p(v, 2). If p(v, 1) holds, then both port 0 and port 1 are marked at v, contradicting port uniqueness (hunique) since 0 ≠ 1. If p(v, 2) holds, then both port 0 and port 2 are marked at v, again contradicting uniqueness since 0 ≠ 2. Hence, port 0 cannot be marked at any vertex.

    lines 25–30

    uses Finset.mem_filter, Finset.mem_univ, true_and

      intro v hv
      have hd := hall v
      simp only [A, B, Finset.mem_filter, Finset.mem_univ, true_and] at hd
      rcases hd with h1 | h2
      · exact hunique v 0 1 (by decide) ⟨hv, h1⟩
      · exact hunique v 0 2 (by decide) ⟨hv, h2⟩
Finset.disjoint_left.mpr
Two finite sets are disjoint if no element of the first belongs to the second.
Finset.mem_filter.mp
If an element belongs to the filter of a finite set by a predicate, then it satisfies that predicate (and is in the set).
Finset.mem_filter
An element belongs to the filter of a finite set by a predicate if and only if it belongs to the set and satisfies the predicate.
Finset.mem_univ
Every element of a finite type belongs to the universal finite set of that type.
true_and
The conjunction of True with any proposition p simplifies to p.
op874_permutation_disjoint_cover
For any permutation σ on a finite set and any two disjoint finite sets A and B, if every element v satisfies v ∈ A or σ(v) ∈ B, then A and B cover the entire set: every element v satisfies v ∈ A or v ∈ B.

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_cycle_common_hidden_color_exposed    {V : Type*} [Fintype V] [DecidableEq V] (σ : V ≃ V)    (p : V → Fin 3 → Prop)    (hsome : ∀ v, p v 0 ∨ p v 1 ∨ p v 2)    (hunique : ∀ v i j, i ≠ j → ¬ (p v i ∧ p v j))    (hcross : ∀ v, ¬ (p v 0 ∧ p (σ v) 0) ∧      ¬ (p v 0 ∧ p (σ v) 1) ∧ ¬ (p v 2 ∧ p (σ v) 0) ∧      ¬ (p v 2 ∧ p (σ v) 1)) :    ∀ v, ¬ p v 0 := by  classical  let A := Finset.univ.filter fun v => p v 1  let B := Finset.univ.filter fun v => p v 2  have hdis : Disjoint A B := by    apply Finset.disjoint_left.mpr    intro v ha hb    exact hunique v 1 2 (by decide) ⟨(Finset.mem_filter.mp ha).2, (Finset.mem_filter.mp hb).2⟩  have hcov : ∀ v, v ∈ A ∨ σ v ∈ B := by    intro v    simp only [A, B, Finset.mem_filter, Finset.mem_univ, true_and]    have h1 := hsome v    have h2 := hsome (σ v)    have hc := hcross v    tauto  have hall := op874_permutation_disjoint_cover σ A B hdis hcov  intro v hv  have hd := hall v  simp only [A, B, Finset.mem_filter, Finset.mem_univ, true_and] at hd  rcases hd with h1 | h2  · exact hunique v 0 1 (by decide) ⟨hv, h1⟩  · exact hunique v 0 2 (by decide) ⟨hv, h2⟩
See it in the graphDiscuss this resultChallenge it