op869_orient_three_color_blocks
For each bipartite block with a three-colored owner and at most one three-colored target of a different color, its two sides can be assigned the two colors different from the owner so that the designated side has the target color when a target exists.
Statement
theorem op869_orient_three_color_blocks {V B : Type} (φ : V → Fin 3) (owner : B → V) (target : B → Option V) (selected : B → Bool) : (∀ b v, target b = some v → φ v ≠ φ (owner b)) → ∃ left right : B → Fin 3, ∀ b, left b ≠ φ (owner b) ∧ right b ≠ φ (owner b) ∧ left b ≠ right b ∧ ∀ v, target b = some v → (if selected b then left b else right b) = φ v
- Source
- arXiv:2610.41516, Lemma 2.5: reserve disjoint bipartite copies and orient them for an offline three-coloring.
- Verified
- 18 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Used by 1
- op869_oriented_blocks_three_colorableA graph made from bipartite blocks is three-colorable when each block belongs to a vertex of a three-colored owner graph, each used block…
The proof, explained
We first prove an auxiliary lemma: in any three-element set, any two distinct elements leave a third element distinct from both. For each bipartite block, we then choose two distinct colors avoiding the owner: if a target exists, we place its color on the designated side and the third color on the opposite side; if no target exists, any two colors avoiding the owner suffice. Finally, the axiom of choice promotes these pointwise choices to global coloring functions for both sides of all blocks.
In Fin 3, given two distinct elements, there exists a third element distinct from both. automation
By exhaustive case analysis on all pairs (a, b) in Fin 3 with b ≠ a, arithmetic normalization and the decision procedure find the remaining third color.
lemma op869_third_color_tmp (a b : Fin 3) (h : b ≠ a) : ∃ c : Fin 3, c ≠ a ∧ c ≠ b := by fin_cases a <;> fin_cases b <;> norm_num at * <;> decide
We assume the hypothesis that any target vertex has a color distinct from its block's owner.
We enable classical reasoning and introduce the assumption (named h) that for every block b and vertex v, if target(b) = some v, then φ(v) ≠ φ(owner(b)).
classical intro hFor any individual block, there exist valid left and right colors satisfying all block-level requirements.
We reduce the problem of finding global functions to a pointwise statement `local_choice`: for any block b, there exist colors l and r in Fin 3 that are distinct, both differ from φ(owner(b)), and when target(b) is some v, the selected side equals φ(v). We fix an arbitrary block b.
have local_choice : ∀ b : B, ∃ l r : Fin 3, l ≠ φ (owner b) ∧ r ≠ φ (owner b) ∧ l ≠ r ∧ ∀ v, target b = some v → (if selected b then l else r) = φ v := by intro b
When the block has no target, two distinct colors different from the owner's color can be chosen. automation
We consider the case where target(b) is none. By testing all three possible values of the owner's color in Fin 3, we find two distinct colors l and r different from the owner's color. Since there is no target vertex, the target condition holds vacuously.
cases ht : target b with | none => have hn : ∃ l r : Fin 3, l ≠ φ (owner b) ∧ r ≠ φ (owner b) ∧ l ≠ r := by generalize hcol : φ (owner b) = col fin_cases col <;> simp_all <;> decide obtain ⟨l, r, hl, hr, hlr⟩ := hn exact ⟨l, r, hl, hr, hlr, by simp [ht]⟩
When the block has a target vertex, we obtain a third color distinct from both the owner and the target.
In the case where target(b) = some v, the hypothesis implies that φ(v) ≠ φ(owner(b)). Applying the helper lemma `op869_third_color_tmp` to the owner's color and the target's color yields a third color c distinct from both.
uses
op869_third_color_tmp| some v => have hv : φ v ≠ φ (owner b) := h b v ht obtain ⟨c, hco, hcv⟩ := op869_third_color_tmp (φ (owner b)) (φ v) hvIf the block selects its right side, we assign the target color to the right and the third color to the left.
When `selected b` is false, the selected side is the right side. We assign left = c and right = φ(v). Both colors differ from the owner's color and from each other. If target(b) = some w, injectivity of Option.some gives w = v, so the right side correctly matches φ(w).
uses
Option.some.injcases hs : selected b with | false => refine ⟨c, φ v, hco, hv, hcv, ?_⟩ intro w hw have : w = v := (Option.some.inj hw).symm subst w simp [hs]
If the block selects its left side, we assign the target color to the left and the third color to the right.
When `selected b` is true, the selected side is the left side. We assign left = φ(v) and right = c. Both colors differ from the owner's color and from each other (using symmetry of inequality `Ne.symm`). Any target w must equal v by injectivity of Option.some, so the left side matches φ(w).
uses
Option.some.inj,Ne.symm| true => refine ⟨φ v, c, hv, hco, Ne.symm hcv, ?_⟩ intro w hw have : w = v := (Option.some.inj hw).symm subst w simp [hs]By the axiom of choice, the pointwise color choices yield the required global colorings left and right.
Using the `choose` tactic, we extract global functions left, right : B → Fin 3 from the pointwise existence statement `local_choice`, completing the proof.
choose left right hleft using local_choice exact ⟨left, right, hleft⟩
op869_third_color_tmp- In Fin 3, given two distinct elements a and b, there exists a third element c distinct from both a and b.
Option.some.inj- The constructor `some` of Option is injective: if `some x = some y`, then `x = y`.
Ne.symm- Inequality is symmetric: if `a ≠ b`, then `b ≠ a`.
- The auxiliary lemma `op869_third_color_tmp` and the subcase for blocks without a target rely on automated exhaustive finite enumeration (`fin_cases` and `decide`) over the three elements of Fin 3.
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
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
lemma op869_third_color_tmp (a b : Fin 3) (h : b ≠ a) : ∃ c : Fin 3, c ≠ a ∧ c ≠ b := by fin_cases a <;> fin_cases b <;> norm_num at * <;> decidetheorem op869_orient_three_color_blocks {V B : Type} (φ : V → Fin 3) (owner : B → V) (target : B → Option V) (selected : B → Bool) : (∀ b v, target b = some v → φ v ≠ φ (owner b)) → ∃ left right : B → Fin 3, ∀ b, left b ≠ φ (owner b) ∧ right b ≠ φ (owner b) ∧ left b ≠ right b ∧ ∀ v, target b = some v → (if selected b then left b else right b) = φ v := by classical intro h have local_choice : ∀ b : B, ∃ l r : Fin 3, l ≠ φ (owner b) ∧ r ≠ φ (owner b) ∧ l ≠ r ∧ ∀ v, target b = some v → (if selected b then l else r) = φ v := by intro b cases ht : target b with | none => have hn : ∃ l r : Fin 3, l ≠ φ (owner b) ∧ r ≠ φ (owner b) ∧ l ≠ r := by generalize hcol : φ (owner b) = col fin_cases col <;> simp_all <;> decide obtain ⟨l, r, hl, hr, hlr⟩ := hn exact ⟨l, r, hl, hr, hlr, by simp [ht]⟩ | some v => have hv : φ v ≠ φ (owner b) := h b v ht obtain ⟨c, hco, hcv⟩ := op869_third_color_tmp (φ (owner b)) (φ v) hv cases hs : selected b with | false => refine ⟨c, φ v, hco, hv, hcv, ?_⟩ intro w hw have : w = v := (Option.some.inj hw).symm subst w simp [hs] | true => refine ⟨φ v, c, hv, hco, Ne.symm hcv, ?_⟩ intro w hw have : w = v := (Option.some.inj hw).symm subst w simp [hs] choose left right hleft using local_choice exact ⟨left, right, hleft⟩