AFTD Auto-Formalizing Theoretical Domains

op869_extend_colors_update

theoremverified

Padding a color-history update agrees with updating the padded history.

Statement

theorem op869_extend_colors_update {n m : ℕ} (h : n ≤ m) (C : Fin n → Finset ℕ)
    (i : Fin n) (c : Finset ℕ) :
    op869_extend_colors h (Function.update C i c) =
      Function.update (op869_extend_colors h C) (Fin.castLE h i) c
Source
Padding and monotonicity for the finite adversary game of arXiv:2610.41516 Section 2.
Verified
18 Nov 2026
Axioms
Quot.soundpropext
Built on 1
  • op869_extend_colorsExtend color histories to a larger vertex universe by assigning no colors to new vertices.
Used by 1
  • op869_bounded_vertex_paddingFor a positive colorability bound, a bounded adversary winning position remains winning after padding its entire graph and color history…

The proof, explained

The theorem is proved by function extensionality, showing that both sides agree when evaluated at any index v in Fin m. We split into cases on whether v = Fin.castLE h i. When v = Fin.castLE h i, both sides evaluate to the updated color set c because i.val < n. When v ≠ Fin.castLE h i, the right side ignores the update by Function.update_of_ne. A further case split on whether v.val < n shows that both sides evaluate to C(v) when v.val < n (since the restricted index differs from i) and to the empty set when v.val ≥ n.

  1. It suffices to show that both sides agree when evaluated at an arbitrary index v in Fin m.

    By function extensionality (`funext`), two functions on Fin m are identical if they produce the same value for every argument v. We enable classical reasoning so that equality comparisons on finite sets and Fin types are decidable.

    lines 6–7

      classical
      funext v
  2. When v = Fin.castLE h i, both sides evaluate to c.

    We split into cases on whether v = Fin.castLE h i. In the case where they are equal, substituting v makes the right-hand side evaluate to c by definition of Function.update. On the left-hand side, since the value of Fin.castLE h i is i.val < n (by i.isLt), the definition of op869_extend_colors selects the branch for indices strictly less than n, yielding (C[i ↦ c])(i), which is also c.

    lines 8–10

      by_cases hvi : v = Fin.castLE h i
      · subst v
        simp [op869_extend_colors, i.isLt]
  3. When v ≠ Fin.castLE h i and v.val < n, both sides evaluate to C ⟨v.val, hv⟩.

    In the subcase where v.val < n, we first establish that the restricted index ⟨v.val, hv⟩ in Fin n is not equal to i (hypothesis `hbne`): if it were equal to i, taking underlying natural values with `congrArg` and applying `Fin.ext` would force v = Fin.castLE h i, contradicting the case assumption v ≠ Fin.castLE h i (`hvi`). With ⟨v.val, hv⟩ ≠ i, the left-hand side simplifies via `Function.update_of_ne` from (C[i ↦ c]) ⟨v.val, hv⟩ to C ⟨v.val, hv⟩. The right-hand side simplifies via `Function.update_of_ne` to op869_extend_colors h C v because v ≠ Fin.castLE h i, which in turn evaluates to C ⟨v.val, hv⟩ since v.val < n.

    lines 11–17

    uses Fin.ext, congrArg, Function.update_of_ne

      · by_cases hv : v.val < n
        · have hbne : (⟨v.val, hv⟩ : Fin n) ≠ i := by
            intro heq
            apply hvi
            apply Fin.ext
            exact congrArg (fun z : Fin n => z.val) heq
          simp [op869_extend_colors, hv, Function.update_of_ne, hvi, hbne]
  4. When v.val ≥ n, both sides evaluate to the empty set ∅.

    In the remaining subcase where v.val < n does not hold, the right side simplifies to op869_extend_colors h C v via `Function.update_of_ne` because v ≠ Fin.castLE h i. By definition of op869_extend_colors, any argument whose value is at least n maps to the default value ∅, so both sides simplify to ∅.

    line 18

    uses Function.update_of_ne

        · simp [op869_extend_colors, hv, Function.update_of_ne, hvi]
Fin.ext
Two elements of Fin n are equal if their underlying natural numbers are equal.
congrArg
Applying a function to equal arguments produces equal results.
Function.update_of_ne
Evaluating a function updated at a' at a different point a ≠ a' yields the original function value.

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

/-- Padding a color-history update agrees with updating the padded history. -/theorem op869_extend_colors_update {n m : ℕ} (h : n ≤ m) (C : Fin n → Finset ℕ)    (i : Fin n) (c : Finset ℕ) :    op869_extend_colors h (Function.update C i c) =      Function.update (op869_extend_colors h C) (Fin.castLE h i) c := by  classical  funext v  by_cases hvi : v = Fin.castLE h i  · subst v    simp [op869_extend_colors, i.isLt]  · by_cases hv : v.val < n    · have hbne : (⟨v.val, hv⟩ : Fin n) ≠ i := by        intro heq        apply hvi        apply Fin.ext        exact congrArg (fun z : Fin n => z.val) heq      simp [op869_extend_colors, hv, Function.update_of_ne, hvi, hbne]    · simp [op869_extend_colors, hv, Function.update_of_ne, hvi]
See it in the graphDiscuss this resultChallenge it