q-Secant inversion-enumerator interfaces
Definitionframe_2026_qsecant_interfacesThis definition bundle formalizes up--down permutations of Fin (2*n), their inversion numbers, the integer-polynomial -secant enumerator, and polynomial congruence as divisibility. It fixes the empty-permutation convention at and supplies the transparent objects used by the cubic-congruence mission.
import Mathlib
/-!
# Concrete definitions for the q-secant inversion enumerator
These declarations are separated from the open theorem so that a Prove2me
proposal can publish the definitions before presenting the congruence as its
goal item.
-/
namespace QSecantCubic
open Polynomial
/-- A zero-based version of the paper's up-down condition
`sigma_1 < sigma_2 > sigma_3 < sigma_4 > ...`. -/
def IsUpDown {m : ℕ} (sigma : Equiv.Perm (Fin m)) : Prop :=
∀ (i : ℕ) (hi : i + 1 < m),
if Even i then
sigma ⟨i, Nat.lt_of_succ_lt hi⟩ < sigma ⟨i + 1, hi⟩
else
sigma ⟨i + 1, hi⟩ < sigma ⟨i, Nat.lt_of_succ_lt hi⟩
/-- Number of inversions of a permutation. -/
def inversionNumber {m : ℕ} (sigma : Equiv.Perm (Fin m)) : ℕ :=
((Finset.univ : Finset (Fin m × Fin m)).filter
(fun ij => ij.1 < ij.2 ∧ sigma ij.2 < sigma ij.1)).card
/-- The q-secant inversion enumerator `E_{2n}(q)` in `Z[q]`. -/
noncomputable def qSecant (n : ℕ) : Polynomial ℤ := by
classical
exact
((Finset.univ : Finset (Equiv.Perm (Fin (2 * n)))).filter
IsUpDown).sum
(fun sigma => Polynomial.X ^ inversionNumber sigma)
end QSecantCubic
Read-back
What the Lean code literally says, in plain math · gpt-5.6-sol
Definitions.QSecantInterfaces / definition bundle
QSecantCubic.IsUpDown. For and a permutation of , this says that for every together with a proof that , one has if is even, and otherwise. Thus it literally imposes alternating inequalities beginning with a rise at position . For or , there is no such , so every permutation satisfies the condition vacuously.
QSecantCubic.inversionNumber. For a permutation of , this is the cardinality of the set of ordered pairs of indices satisfying and . It is a natural number and is zero when .
QSecantCubic.qSecant. For every , this is the polynomial in
The sum is over every permutation of passing the exact predicate above, with one monomial per permutation; equal inversion numbers therefore contribute repeated integer coefficients. At , the unique permutation of the empty finite type passes the condition vacuously and has zero inversions, so .
Confirmed by the mission captain (proposal self-audit).