AFTD Auto-Formalizing Theoretical Domains

op1525_multipartite_profile_card_injective

theoremverified

If two integer profiles of equally sized blocks differ by the difference of two adjacent one-block transitions, and their quadratic mixed-pair scores agree, then the profiles are equal.

Statement

theorem op1525_multipartite_profile_card_injective (r : ℕ) (i j : Fin r)
    (f g : Fin (r + 1) → ℤ)
    (hchange : ∀ k : Fin (r + 1), f k - g k =
      ((if k = i.castSucc then 1 else 0) - (if k = i.succ then 1 else 0)) -
      ((if k = j.castSucc then 1 else 0) - (if k = j.succ then 1 else 0)))
    (hscore : ∑ k : Fin (r + 1), f k * (k.val : ℤ) * ((r : ℤ) - k.val) =
      ∑ k : Fin (r + 1), g k * (k.val : ℤ) * ((r : ℤ) - k.val)) : f = g
Source
The decisive profile-recovery step in the multipartite route for OP-1525.
Verified
17 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 2
  • LinearOrder.toTotalPreorderEvery LinearOrder is a TotalPreorder.
  • TotalPreorderA total preorder: a preorder where ≤ is total (complete). This is weaker than LinearOrder — it does NOT require antisymmetry or…

The proof, explained

The proof equates the quadratic mixed-pair scores of the two profiles to show that their weighted difference sum vanishes. Substituting the assumed transition formula into this sum evaluates the indicator functions, simplifying the score difference to $2(i - j) = 0$. This forces the transition indices $i$ and $j$ to be equal. With $i = j$, the difference $f(k) - g(k)$ cancels out completely for every index $k$, establishing $f = g$.

  1. The weighted difference sum $\sum_{k=0}^r (f(k) - g(k)) k (r - k)$ is equal to $0$.

    Under classical logic, we consider the difference of the two profile score sums. Distributing multiplication over subtraction (`sub_mul`) and splitting the sum across the difference (`Finset.sum_sub_distrib`), the sum decomposes into $\sum_k f(k) k (r - k) - \sum_k g(k) k (r - k)$. Because the two scores are assumed equal (`hscore`), linear arithmetic (`linarith`) confirms that their difference vanishes.

    lines 8–11

    uses sub_mul, Finset.sum_sub_distrib

      classical
      have he : (∑ k : Fin (r + 1), (f k - g k) * (k.val : ℤ) * ((r : ℤ) - k.val)) = 0 := by
        simp only [sub_mul, Finset.sum_sub_distrib]
        linarith
  2. Evaluating the weighted difference sum yields the algebraic relation $i(r - i) - (i + 1)(r - (i + 1)) - (j(r - j) - (j + 1)(r - (j + 1))) = 0$.

    We substitute the difference $f(k) - g(k)$ with the assumption `hchange`. Distributing the sum over subtractions and products, each term becomes an indicator function picking out a single index ($i$, $i+1$, $j$, or $j+1$). The sifting identity `Finset.sum_ite_eq'`, combined with universe membership (`Finset.mem_univ`) and value identities for index embeddings (`Fin.val_castSucc`, `Fin.val_succ`, `Nat.cast_add`, `Nat.cast_one`), evaluates the sum into the difference of the quadratic terms at the consecutive indices.

    lines 12–15

    uses sub_mul, Finset.sum_sub_distrib, ite_mul, one_mul, zero_mul, Finset.sum_ite_eq', Finset.mem_univ, if_true, Fin.val_castSucc, Fin.val_succ, Nat.cast_add, Nat.cast_one

      simp_rw [hchange] at he
      simp only [sub_mul, Finset.sum_sub_distrib, ite_mul, one_mul, zero_mul,
        Finset.sum_ite_eq', Finset.mem_univ, if_true, Fin.val_castSucc, Fin.val_succ,
        Nat.cast_add, Nat.cast_one] at he
  3. The transition indices are equal: $i = j$.

    The quadratic difference $k(r - k) - (k + 1)(r - (k + 1))$ simplifies to $2k + 1 - r$. Thus the relation from the previous step reduces to $(2i + 1 - r) - (2j + 1 - r) = 2(i - j) = 0$, implying $i = j$ as integers via nonlinear arithmetic (`nlinarith`). Injectivity of the natural-to-integer embedding (`Int.ofNat.inj`) gives $i.\text{val} = j.\text{val}$, and index extensionality (`Fin.ext`) yields $i = j$ in $\operatorname{Fin} r$.

    lines 16–17

    uses Fin.ext, Int.ofNat.inj

      have hij : (i.val : ℤ) = (j.val : ℤ) := by nlinarith
      have hij' : i = j := Fin.ext (Int.ofNat.inj hij)
  4. The profiles are equal: $f = g$.

    Substituting $j$ with $i$, the right-hand side of `hchange` becomes the difference of two identical expressions, which reduces to zero (`sub_self`). Consequently, $f(k) - g(k) = 0$ for every index $k$, so $f(k) = g(k)$ by linear arithmetic (`linarith`). Function extensionality (`funext`) concludes that $f = g$.

    lines 18–22

    uses sub_self

      subst j
      funext k
      have hk := hchange k
      simp only [sub_self] at hk
      linarith
sub_mul
Multiplication distributes over subtraction on the right: $(a - b) c = a c - b c$.
Finset.sum_sub_distrib
A finite sum of differences is the difference of the finite sums: $\sum_{x \in s} (f(x) - g(x)) = \sum_{x \in s} f(x) - \sum_{x \in s} g(x)$.
ite_mul
Multiplication by a constant distributes into an if-then-else expression on the right.
one_mul
Multiplying by 1 on the left leaves an element unchanged: $1 \cdot a = a$.
zero_mul
Multiplying by 0 on the left yields 0: $0 \cdot a = 0$.
Finset.sum_ite_eq'
The sum of an indicator term $(\text{if } x = a \text{ then } b(x) \text{ else } 0)$ over a finite set $s$ evaluates to $b(a)$ if $a \in s$, and $0$ otherwise.
Finset.mem_univ
Every element of a finite type belongs to the universal finset `Finset.univ`.
if_true
An if-then-else expression whose condition is True evaluates to the 'then' branch.
Fin.val_castSucc
Embedding an index $i \in \operatorname{Fin} n$ into $\operatorname{Fin}(n+1)$ via `castSucc` preserves its numerical value.
Fin.val_succ
The numerical value of the successor $j.\text{succ} \in \operatorname{Fin}(n+1)$ is $j + 1$.
Nat.cast_add
Coercion from natural numbers to a ring preserves addition: $\uparrow(m + n) = \uparrow m + \uparrow n$.
Nat.cast_one
Coercion from natural numbers preserves 1: $\uparrow 1 = 1$.
Fin.ext
Two bounded indices in $\operatorname{Fin} n$ are equal if their underlying numerical values are equal.
Int.ofNat.inj
The canonical injection from $\mathbb{N}$ to $\mathbb{Z}$ is injective: if $(a : \mathbb{Z}) = (b : \mathbb{Z})$, then $a = b$.
sub_self
Subtracting an element from itself yields zero: $a - a = 0$.

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 op1525_multipartite_profile_card_injective (r : ℕ) (i j : Fin r)    (f g : Fin (r + 1) → ℤ)    (hchange : ∀ k : Fin (r + 1), f k - g k =      ((if k = i.castSucc then 1 else 0) - (if k = i.succ then 1 else 0)) -      ((if k = j.castSucc then 1 else 0) - (if k = j.succ then 1 else 0)))    (hscore : ∑ k : Fin (r + 1), f k * (k.val : ℤ) * ((r : ℤ) - k.val) =      ∑ k : Fin (r + 1), g k * (k.val : ℤ) * ((r : ℤ) - k.val)) : f = g := by  classical  have he : (∑ k : Fin (r + 1), (f k - g k) * (k.val : ℤ) * ((r : ℤ) - k.val)) = 0 := by    simp only [sub_mul, Finset.sum_sub_distrib]    linarith  simp_rw [hchange] at he  simp only [sub_mul, Finset.sum_sub_distrib, ite_mul, one_mul, zero_mul,    Finset.sum_ite_eq', Finset.mem_univ, if_true, Fin.val_castSucc, Fin.val_succ,    Nat.cast_add, Nat.cast_one] at he  have hij : (i.val : ℤ) = (j.val : ℤ) := by nlinarith  have hij' : i = j := Fin.ext (Int.ofNat.inj hij)  subst j  funext k  have hk := hchange k  simp only [sub_self] at hk  linarith
See it in the graphDiscuss this resultChallenge it