AFTD Auto-Formalizing Theoretical Domains

signed_element_order_sum_decomposition

theoremverifiedformalization

For any natural number n, the signed element order sum D_n = ∑_{σ ∈ S_n} sgn(σ) o(σ) (perm_signed_order_sum n : ℤ) decomposes as D_n = D_n^* - V_n in ℤ, where D_n^* = ∑_{σ ∈ S_n} sgn(σ) lcm(2, o(σ)) (perm_signed_lcm_two_order_sum n : ℤ) and V_n = ∑_{σ ∈ S_n, o(σ) odd} o(σ) (perm_odd_order_sum n : ℤ).

Statement

theorem signed_element_order_sum_decomposition (n : ℕ) : perm_signed_order_sum n = perm_signed_lcm_two_order_sum n - perm_odd_order_sum n
Formalizes
arXiv:2611.29409 Lemma 3.1
Verified
25 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 6
  • perm_signed_order_sumThe signed element order sum D_n = ∑_{σ ∈ S_n} sgn(σ) o(σ) over the symmetric group S_n of degree n, defined as perm_signed_order_sum n.
  • perm_signed_lcm_two_order_sumThe signed lcm order sum D_n^* = ∑_{σ ∈ S_n} sgn(σ) lcm(2, o(σ)) over the symmetric group S_n of degree n, defined as…
  • perm_odd_order_sumThe sum V_n of orders of odd-order permutations in the symmetric group S_n of degree n, valued in the integers ℤ: ∑_{σ ∈ S_n, o(σ) odd}…
  • perm_signed_lcm_two_sub_orderFor any finite type α and permutation σ of α, the signed difference (sgn(σ) : ℤ) * lcm(2, o(σ)) - (sgn(σ) : ℤ) * o(σ) equals o(σ) if o(σ)…
  • 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…

Read back from the Lean

For every natural number $n$, the signed sum of the orders of permutations of Fin n (weighted by the signature of each permutation) equals the signed sum of $\operatorname{lcm}(2, \operatorname{orderOf}(\sigma))$ over all permutations $\sigma$ of Fin n (weighted by the signature of $\sigma$), minus the sum of the orders of all permutations of Fin n that have odd order (all computed in $\mathbb{Z}$).

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

The proof, explained

The proof establishes the equivalent rearranged identity D_n^* - D_n = V_n by merging the two sums on the left into a single sum over all permutations σ ∈ S_n. It reduces the equality to the pointwise identity sgn(σ) lcm(2, o(σ)) - sgn(σ) o(σ) = if Odd(o(σ)) then o(σ) else 0, and finishes with linear arithmetic.

  1. The difference D_n^* - D_n = V_n can be expressed as an equality between two sums over all permutations in S_n.

    We set out to prove the equivalent identity D_n^* - D_n = V_n (`hdiff`). After unfolding the definitions of D_n^*, D_n, and V_n, Finset.sum_sub_distrib merges the two sums on the left-hand side into a single sum over S_n of the difference sgn(σ) lcm(2, o(σ)) - sgn(σ) o(σ). Then Finset.sum_filter rewrites the filtered sum V_n on the right-hand side as a sum over all permutations in S_n where non-odd order terms are set to 0.

    lines 3–6

    uses Finset.sum_sub_distrib, Finset.sum_filter

      have hdiff : perm_signed_lcm_two_order_sum n - perm_signed_order_sum n = perm_odd_order_sum n := by
        unfold perm_signed_lcm_two_order_sum perm_signed_order_sum perm_odd_order_sum
        rw [← Finset.sum_sub_distrib]
        rw [Finset.sum_filter]
  2. The identity D_n^* - D_n = V_n holds.

    By Finset.sum_congr, it suffices to prove that the summands match for each permutation σ ∈ S_n. For any such σ, the lemma perm_signed_lcm_two_sub_order directly states that sgn(σ) lcm(2, o(σ)) - sgn(σ) o(σ) equals o(σ) when o(σ) is odd and 0 otherwise, which exactly matches the conditional summand.

    lines 7–9

    uses Finset.sum_congr, perm_signed_lcm_two_sub_order

        apply Finset.sum_congr rfl
        intro σ _
        exact perm_signed_lcm_two_sub_order σ
  3. D_n = D_n^* - V_n. automation

    Linear integer arithmetic deduces D_n = D_n^* - V_n from D_n^* - D_n = V_n (`hdiff`).

    line 10

      linarith
Finset.sum_sub_distrib
The difference of two sums over the same finite set equals the sum of their pointwise differences.
Finset.sum_filter
A sum over the elements of a finite set satisfying a predicate equals the sum over the entire set with terms replaced by zero when the predicate is false.
Finset.sum_congr
Two sums over equal finite sets are equal if their terms are equal at every element.
perm_signed_lcm_two_sub_order
For any permutation σ, the difference sgn(σ) lcm(2, o(σ)) - sgn(σ) o(σ) equals o(σ) if o(σ) is odd, and 0 if o(σ) is even.

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

/-- Decomposition of the signed element order sum D_n as D_n* - V_n (arXiv:2611.29409 Lemma 3.1). -/theorem signed_element_order_sum_decomposition (n : ℕ) : perm_signed_order_sum n = perm_signed_lcm_two_order_sum n - perm_odd_order_sum n := by  have hdiff : perm_signed_lcm_two_order_sum n - perm_signed_order_sum n = perm_odd_order_sum n := by    unfold perm_signed_lcm_two_order_sum perm_signed_order_sum perm_odd_order_sum    rw [← Finset.sum_sub_distrib]    rw [Finset.sum_filter]    apply Finset.sum_congr rfl    intro σ _    exact perm_signed_lcm_two_sub_order σ  linarith
See it in the graphDiscuss this resultChallenge it