AFTD Auto-Formalizing Theoretical Domains

op1525_equal_rank_one_gram_sign

theoremverified

Two integer-valued functions with identical pairwise products agree everywhere up to one common global sign.

Statement

theorem op1525_equal_rank_one_gram_sign
    {I : Type*} (f g : I → ℤ)
    (h : ∀ i j, f i * f j = g i * g j) :
    f = g ∨ f = fun i => -g i
Source
A component of the complete-multipartite reconstruction route for OP-1525 and arXiv:2611.13901.
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

We distinguish two cases based on whether g is identically zero. If g is identically zero, evaluating the hypothesis at i = j shows that f(i)² = g(i)² = 0, so f = g = 0. Otherwise, there is an index k with g(k) ≠ 0, and setting i = j = k shows that f(k) = ±g(k). Evaluating the hypothesis at (i, k) gives f(i) f(k) = g(i) g(k); substituting f(k) and cancelling the nonzero factor g(k) then shows that f and g agree everywhere up to the sign chosen at k.

  1. If g is identically zero, then f = g.

    We split into cases based on whether g is identically zero. If g(i) = 0 for all i, we show f = g by showing f(i) = g(i) for each i. Setting j = i in the hypothesis gives f(i)² = g(i)². Since g(i) = 0, this yields f(i)² = 0, so f(i) = 0 = g(i).

    lines 5–11

      classical
      by_cases hz : ∀ i, g i = 0
      · left
        funext i
        have hi := h i i
        have hgi := hz i
        nlinarith
  2. There exists an index k with g(k) ≠ 0, and at this index either f(k) = g(k) or f(k) = -g(k).

    If g is not identically zero, there exists some index k such that g(k) ≠ 0. Setting i = j = k in the hypothesis gives f(k)² = g(k)². By `mul_self_eq_mul_self_iff.mp`, two integers with the same square are either equal or opposites, so f(k) = g(k) or f(k) = -g(k). We perform case analysis on this alternative.

    lines 12–16

    uses mul_self_eq_mul_self_iff.mp

      · push_neg at hz
        obtain ⟨k, hk⟩ := hz
        have hs := h k k
        have hk' : f k = g k ∨ f k = -g k := mul_self_eq_mul_self_iff.mp hs
        rcases hk' with heq | heq
  3. If f(k) = g(k), then f = g.

    To show f = g, we show f(i) = g(i) for all i. Setting j = k in the hypothesis gives f(i) * f(k) = g(i) * g(k). Substituting f(k) = g(k) gives f(i) * g(k) = g(i) * g(k). Since g(k) ≠ 0, right cancellation via `mul_right_cancel₀` yields f(i) = g(i).

    lines 17–21

    uses mul_right_cancel₀

        · left
          funext i
          have hi := h i k
          rw [heq] at hi
          exact mul_right_cancel₀ hk hi
  4. If f(k) = -g(k), then f = -g.

    To show f = -g, we show f(i) = -g(i) for all i. Setting j = k in the hypothesis gives f(i) * f(k) = g(i) * g(k). Substituting f(k) = -g(k) gives f(i) * (-g(k)) = g(i) * g(k), which rearranges to (f(i) + g(i)) * g(k) = 0. Since g(k) ≠ 0, `mul_eq_zero.mp` and `resolve_right` give f(i) + g(i) = 0, which implies f(i) = -g(i).

    lines 22–28

    uses mul_eq_zero.mp, resolve_right

        · right
          funext i
          have hi := h i k
          rw [heq] at hi
          have hz' : (f i + g i) * g k = 0 := by nlinarith [hi]
          have := (mul_eq_zero.mp hz').resolve_right hk
          omega
mul_self_eq_mul_self_iff.mp
Two elements have equal squares only if they are equal or opposites: a * a = b * b implies a = b or a = -b.
mul_right_cancel₀
Right cancellation with a nonzero element: if b ≠ 0 and a * b = c * b, then a = c.
mul_eq_zero.mp
If a product is zero, then at least one factor is zero: a * b = 0 implies a = 0 or b = 0.
resolve_right
Disjunctive syllogism: if a ∨ b and ¬b, then a.

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_equal_rank_one_gram_sign    {I : Type*} (f g : I → ℤ)    (h : ∀ i j, f i * f j = g i * g j) :    f = g ∨ f = fun i => -g i := by  classical  by_cases hz : ∀ i, g i = 0  · left    funext i    have hi := h i i    have hgi := hz i    nlinarith  · push_neg at hz    obtain ⟨k, hk⟩ := hz    have hs := h k k    have hk' : f k = g k ∨ f k = -g k := mul_self_eq_mul_self_iff.mp hs    rcases hk' with heq | heq    · left      funext i      have hi := h i k      rw [heq] at hi      exact mul_right_cancel₀ hk hi    · right      funext i      have hi := h i k      rw [heq] at hi      have hz' : (f i + g i) * g k = 0 := by nlinarith [hi]      have := (mul_eq_zero.mp hz').resolve_right hk      omega
See it in the graphDiscuss this resultChallenge it