matrix_q_permanent
def
The q-permanent of an n-by-n matrix M over a commutative semiring R at parameter q in R is the sum over all permutations sigma of Fin n of q^(inv(sigma)) times the product over i of M i (sigma i), where inv(sigma) is the number of inversions of sigma.
Statement
def matrix_q_permanent {n : ℕ} {R : Type*} [CommSemiring R] (q : R) (M : Matrix (Fin n) (Fin n) R) : R
- Defined in
- arXiv:2611.14694, Section 1, Eq. (1.1)
- Verified
- 13 Nov 2026
- Axioms
- none listed
- Used by 2
- matrix_q_permanent_two_of_is_symmFor any symmetric 2-by-2 matrix A over a commutative ring R and any parameter q in R, the q-permanent of A equals A 0 0 * A 1 1 + q * (A 0…
- matrix_q_permanent_diagonal_conjFor any natural number n, any n-by-n matrix A over a commutative ring R, any diagonal matrix D = Matrix.diagonal d with d : Fin n → R, and…
Read back from the Lean
Given a natural number n, a commutative semiring R, an element q ∈ R, and an n × n matrix M with entries in R, matrix_q_permanent q M is defined as the sum over all permutations σ of Fin n of q^(invs(σ)) * ∏_{i : Fin n} M i (σ i), where invs(σ) is the number of pairs (p₁, p₂) ∈ Fin n × Fin n such that p₁ < p₂ and σ(p₂) < σ(p₁).
Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.
Lean source view module on GitHub
/-- The q-permanent of an n x n matrix over a commutative semiring R. -/ def matrix_q_permanent {n : ℕ} {R : Type*} [CommSemiring R] (q : R) (M : Matrix (Fin n) (Fin n) R) : R := let invs : Equiv.Perm (Fin n) → ℕ := fun σ => ((Finset.univ : Finset (Fin n × Fin n)).filter (fun p => p.1 < p.2 ∧ σ p.2 < σ p.1)).card ∑ σ : Equiv.Perm (Fin n), q ^ (invs σ) * ∏ i : Fin n, M i (σ i)