Permutations avoiding two patterns of length three
DefinitionLength-three pattern from one-line values#✓fully proved
Given a bijection \(v\) from \(\{0, 1, 2\}\) to itself, this is the permutation of \(\{0, 1, 2\}\) that sends \(i\) to \(v(i)\). The values are listed zero-based, so \(v = (0, 2, 1)\) gives the pattern \(132\) in the usual one-based one-line notation.
public def pattern3 (v : Fin 3 → Fin 3) (hv : Function.Bijective v := by decide) :
Equiv.Perm (Fin 3) where
toFun := v
invFun := Fintype.bijInv hv
left_inv := Fintype.leftInverse_bijInv hv
right_inv := Fintype.rightInverse_bijInv hv
Sources
- Han, Joint Distributions of 10 Classical Statistics over Permutations Avoiding Two Patterns of Length 3, INTEGERS 26 (2026), Article A18, Section 1.
Used by 13
DefinitionNumber of permutations avoiding two patterns of length three#✓fully proved
For a natural number \(n\) and permutations \(\tau\) and \(\rho\) of \(\{0, 1, 2\}\), \(A_n(\tau, \rho)\) is the number of permutations of \(\{0, 1, \dots, n - 1\}\) that contain neither \(\tau\) nor \(\rho\) as a classical pattern.
public def twoPatternAvoiderCount (n : ℕ) (τ ρ : Equiv.Perm (Fin 3)) : ℕ :=
(Finset.univ.filter fun σ : Equiv.Perm (Fin n) =>
¬ HasPattern σ τ ∧ ¬ HasPattern σ ρ).card
def HasPattern {n k : ℕ} (σ : Equiv.Perm (Fin n))
(π : Fin k → Fin k) : Prop :=
∃ e : Fin k → Fin n, (∀ i j : Fin k, i < j → e i < e j) ∧
∀ i j : Fin k, σ (e i) < σ (e j) ↔ π i < π j
WantedExt/Combinatorics/Enumerative/OddFibonacciWanted.lean:62
Sources
- Han, Joint Distributions of 10 Classical Statistics over Permutations Avoiding Two Patterns of Length 3, INTEGERS 26 (2026), Article A18, Theorem 1.
TheoremPermutations of length three avoiding \(123\) and \(132\)#✓fully proved
Exactly \(4\) permutations of \(\{0, 1, 2\}\) avoid both patterns \(123\) and \(132\), that is, \(A_3(123, 132) = 4\): of the six permutations of length \(3\), only \(123\) and \(132\) themselves are excluded.
public theorem twoPatternAvoiderCount_three_123_132 :
twoPatternAvoiderCount 3 (pattern3 ![0, 1, 2]) (pattern3 ![0, 2, 1]) = 4
public def twoPatternAvoiderCount (n : ℕ) (τ ρ : Equiv.Perm (Fin 3)) : ℕ :=
(Finset.univ.filter fun σ : Equiv.Perm (Fin n) =>
¬ HasPattern σ τ ∧ ¬ HasPattern σ ρ).card
WantedExt/Combinatorics/Enumerative/TwoPatternAvoidanceCountsWanted.lean:70
public def pattern3 (v : Fin 3 → Fin 3) (hv : Function.Bijective v := by decide) :
Equiv.Perm (Fin 3) where
toFun := v
invFun := Fintype.bijInv hv
left_inv := Fintype.leftInverse_bijInv hv
right_inv := Fintype.rightInverse_bijInv hv
WantedExt/Combinatorics/Enumerative/TwoPatternAvoidanceCountsWanted.lean:48
Sources
- Han, Joint Distributions of 10 Classical Statistics over Permutations Avoiding Two Patterns of Length 3, INTEGERS 26 (2026), Article A18, Theorem 1.
TheoremPermutations of length four avoiding \(132\) and \(321\)#✓fully proved
Exactly \(7\) permutations of \(\{0, 1, 2, 3\}\) avoid both patterns \(132\) and \(321\), that is, \(A_4(132, 321) = 7 = 1 + \binom{4}{2}\).
public theorem twoPatternAvoiderCount_four_132_321 :
twoPatternAvoiderCount 4 (pattern3 ![0, 2, 1]) (pattern3 ![2, 1, 0]) = 7
public def twoPatternAvoiderCount (n : ℕ) (τ ρ : Equiv.Perm (Fin 3)) : ℕ :=
(Finset.univ.filter fun σ : Equiv.Perm (Fin n) =>
¬ HasPattern σ τ ∧ ¬ HasPattern σ ρ).card
WantedExt/Combinatorics/Enumerative/TwoPatternAvoidanceCountsWanted.lean:70
public def pattern3 (v : Fin 3 → Fin 3) (hv : Function.Bijective v := by decide) :
Equiv.Perm (Fin 3) where
toFun := v
invFun := Fintype.bijInv hv
left_inv := Fintype.leftInverse_bijInv hv
right_inv := Fintype.rightInverse_bijInv hv
WantedExt/Combinatorics/Enumerative/TwoPatternAvoidanceCountsWanted.lean:48
Sources
- Han, Joint Distributions of 10 Classical Statistics over Permutations Avoiding Two Patterns of Length 3, INTEGERS 26 (2026), Article A18, Theorem 1.
TheoremSimion–Schmidt enumeration of permutations avoiding two patterns of length three#●ready to prove
For every \(n \ge 1\), writing \(A_n(\tau, \rho)\) for the number of permutations of \(\{0, 1, \dots, n - 1\}\) avoiding both patterns \(\tau\) and \(\rho\): (a) \(A_n(123, 132) = A_n(123, 213) = A_n(321, 231) = A_n(321, 312) = 2^{n-1}\); (b) \(A_n(231, 312) = A_n(132, 213) = 2^{n-1}\); (c) \(A_n(213, 312) = A_n(132, 231) = 2^{n-1}\); (d) \(A_n(213, 231) = A_n(132, 312) = 2^{n-1}\); (e) \(A_n(132, 321) = A_n(123, 231) = A_n(123, 312) = A_n(213, 321) = 1 + \binom{n}{2}\); (f) \(A_n(123, 321)\) equals \(n\) if \(n \le 2\), equals \(4\) if \(n \in \{3, 4\}\), and equals \(0\) if \(n \ge 5\).
MetaMathlibExt.twoPatternAvoiderCount_length_three · 17 lines
public theorem_wanted twoPatternAvoiderCount_length_three {n : ℕ} (hn : 1 ≤ n) :
(twoPatternAvoiderCount n (pattern3 ![0, 1, 2]) (pattern3 ![0, 2, 1]) = 2 ^ (n - 1) ∧
twoPatternAvoiderCount n (pattern3 ![0, 1, 2]) (pattern3 ![1, 0, 2]) = 2 ^ (n - 1) ∧
twoPatternAvoiderCount n (pattern3 ![2, 1, 0]) (pattern3 ![1, 2, 0]) = 2 ^ (n - 1) ∧
twoPatternAvoiderCount n (pattern3 ![2, 1, 0]) (pattern3 ![2, 0, 1]) = 2 ^ (n - 1)) ∧
(twoPatternAvoiderCount n (pattern3 ![1, 2, 0]) (pattern3 ![2, 0, 1]) = 2 ^ (n - 1) ∧
twoPatternAvoiderCount n (pattern3 ![0, 2, 1]) (pattern3 ![1, 0, 2]) = 2 ^ (n - 1)) ∧
(twoPatternAvoiderCount n (pattern3 ![1, 0, 2]) (pattern3 ![2, 0, 1]) = 2 ^ (n - 1) ∧
twoPatternAvoiderCount n (pattern3 ![0, 2, 1]) (pattern3 ![1, 2, 0]) = 2 ^ (n - 1)) ∧
(twoPatternAvoiderCount n (pattern3 ![1, 0, 2]) (pattern3 ![1, 2, 0]) = 2 ^ (n - 1) ∧
twoPatternAvoiderCount n (pattern3 ![0, 2, 1]) (pattern3 ![2, 0, 1]) = 2 ^ (n - 1)) ∧
(twoPatternAvoiderCount n (pattern3 ![0, 2, 1]) (pattern3 ![2, 1, 0]) = 1 + n.choose 2 ∧
twoPatternAvoiderCount n (pattern3 ![0, 1, 2]) (pattern3 ![1, 2, 0]) = 1 + n.choose 2 ∧
twoPatternAvoiderCount n (pattern3 ![0, 1, 2]) (pattern3 ![2, 0, 1]) = 1 + n.choose 2 ∧
twoPatternAvoiderCount n (pattern3 ![1, 0, 2]) (pattern3 ![2, 1, 0]) = 1 + n.choose 2) ∧
twoPatternAvoiderCount n (pattern3 ![0, 1, 2]) (pattern3 ![2, 1, 0]) =
if n ≤ 2 then n else if n ≤ 4 then 4 else 0
public def twoPatternAvoiderCount (n : ℕ) (τ ρ : Equiv.Perm (Fin 3)) : ℕ :=
(Finset.univ.filter fun σ : Equiv.Perm (Fin n) =>
¬ HasPattern σ τ ∧ ¬ HasPattern σ ρ).card
WantedExt/Combinatorics/Enumerative/TwoPatternAvoidanceCountsWanted.lean:70
public def pattern3 (v : Fin 3 → Fin 3) (hv : Function.Bijective v := by decide) :
Equiv.Perm (Fin 3) where
toFun := v
invFun := Fintype.bijInv hv
left_inv := Fintype.leftInverse_bijInv hv
right_inv := Fintype.rightInverse_bijInv hv
WantedExt/Combinatorics/Enumerative/TwoPatternAvoidanceCountsWanted.lean:48
Sources
- Han, Joint Distributions of 10 Classical Statistics over Permutations Avoiding Two Patterns of Length 3, INTEGERS 26 (2026), Article A18, Theorem 1, citing Simion and Schmidt.
DefinitionAscent number of a permutation#✓fully proved
For a permutation \(\sigma\) of \(\{0, 1, \dots, n - 1\}\), \(\operatorname{asc}(\sigma)\) is the number of positions \(i\) with \(i + 1 < n\) and \(\sigma(i) < \sigma(i + 1)\).
public def permAscents {n : ℕ} (σ : Equiv.Perm (Fin n)) : ℕ :=
(Finset.univ.filter fun i : Fin n => ∃ h : i.val + 1 < n, σ i < σ ⟨i.val + 1, h⟩).card
Sources
- Han, Joint Distributions of 10 Classical Statistics over Permutations Avoiding Two Patterns of Length 3, INTEGERS 26 (2026), Article A18, Section 1 (
asc,des).
DefinitionDescent number of a permutation#✓fully proved
For a permutation \(\sigma\) of \(\{0, 1, \dots, n - 1\}\), \(\operatorname{des}(\sigma)\) is the number of positions \(i\) with \(i + 1 < n\) and \(\sigma(i + 1) < \sigma(i)\).
public def permDescents {n : ℕ} (σ : Equiv.Perm (Fin n)) : ℕ :=
(Finset.univ.filter fun i : Fin n => ∃ h : i.val + 1 < n, σ ⟨i.val + 1, h⟩ < σ i).card
Sources
- Han, Joint Distributions of 10 Classical Statistics over Permutations Avoiding Two Patterns of Length 3, INTEGERS 26 (2026), Article A18, Section 1 (
asc,des).
TheoremAscents and descents of \(123\) and \(132\)#✓fully proved
Writing permutations of \(\{0, 1, 2\}\) in one-based one-line notation, the identity \(123\) has two ascents and no descents, \(\operatorname{asc}(123) = 2\) and \(\operatorname{des}(123) = 0\), and \(132\) has one of each, \(\operatorname{asc}(132) = \operatorname{des}(132) = 1\).
public theorem permAscents_permDescents_small :
permAscents (1 : Equiv.Perm (Fin 3)) = 2 ∧ permDescents (1 : Equiv.Perm (Fin 3)) = 0 ∧
permAscents (pattern3 ![0, 2, 1]) = 1 ∧ permDescents (pattern3 ![0, 2, 1]) = 1
public def permAscents {n : ℕ} (σ : Equiv.Perm (Fin n)) : ℕ :=
(Finset.univ.filter fun i : Fin n => ∃ h : i.val + 1 < n, σ i < σ ⟨i.val + 1, h⟩).card
WantedExt/Combinatorics/Enumerative/TwoPatternAvoidanceCountsWanted.lean:124
public def permDescents {n : ℕ} (σ : Equiv.Perm (Fin n)) : ℕ :=
(Finset.univ.filter fun i : Fin n => ∃ h : i.val + 1 < n, σ ⟨i.val + 1, h⟩ < σ i).card
WantedExt/Combinatorics/Enumerative/TwoPatternAvoidanceCountsWanted.lean:132
public def pattern3 (v : Fin 3 → Fin 3) (hv : Function.Bijective v := by decide) :
Equiv.Perm (Fin 3) where
toFun := v
invFun := Fintype.bijInv hv
left_inv := Fintype.leftInverse_bijInv hv
right_inv := Fintype.rightInverse_bijInv hv
WantedExt/Combinatorics/Enumerative/TwoPatternAvoidanceCountsWanted.lean:48
Sources
- Han, Joint Distributions of 10 Classical Statistics over Permutations Avoiding Two Patterns of Length 3, INTEGERS 26 (2026), Article A18, Section 1 (
asc,des).
Uses 3
DefinitionAscent–descent generating function of a pair of patterns#✓fully proved
For permutations \(\tau\) and \(\rho\) of \(\{0, 1, 2\}\), let \(S_n(\tau, \rho)\) be the set of permutations of \(\{0, 1, \dots, n-1\}\) that contain neither \(\tau\) nor \(\rho\) as a classical pattern. The ascent–descent generating function of \((\tau, \rho)\) is the formal power series
in \(x\) with coefficients in the polynomial ring \(\mathbb{Q}[p, q]\), where \(\mathrm{asc}(\sigma)\) and \(\mathrm{des}(\sigma)\) are the numbers of ascents and descents of \(\sigma\). The empty permutation (\(n = 0\)) contributes the constant term \(1\).
public noncomputable def ascDesGF (τ ρ : Equiv.Perm (Fin 3)) :
PowerSeries (MvPolynomial (Fin 2) ℚ) :=
PowerSeries.mk fun n => ∑ σ ∈ (Finset.univ.filter fun σ : Equiv.Perm (Fin n) =>
¬ HasPattern σ τ ∧ ¬ HasPattern σ ρ),
MvPolynomial.X 0 ^ permAscents σ * MvPolynomial.X 1 ^ permDescents σ
def HasPattern {n k : ℕ} (σ : Equiv.Perm (Fin n))
(π : Fin k → Fin k) : Prop :=
∃ e : Fin k → Fin n, (∀ i j : Fin k, i < j → e i < e j) ∧
∀ i j : Fin k, σ (e i) < σ (e j) ↔ π i < π j
WantedExt/Combinatorics/Enumerative/OddFibonacciWanted.lean:62
public def permAscents {n : ℕ} (σ : Equiv.Perm (Fin n)) : ℕ :=
(Finset.univ.filter fun i : Fin n => ∃ h : i.val + 1 < n, σ i < σ ⟨i.val + 1, h⟩).card
WantedExt/Combinatorics/Enumerative/TwoPatternAvoidanceCountsWanted.lean:124
public def permDescents {n : ℕ} (σ : Equiv.Perm (Fin n)) : ℕ :=
(Finset.univ.filter fun i : Fin n => ∃ h : i.val + 1 < n, σ ⟨i.val + 1, h⟩ < σ i).card
WantedExt/Combinatorics/Enumerative/TwoPatternAvoidanceCountsWanted.lean:132
Sources
- Han, Joint Distributions of 10 Classical Statistics over Permutations Avoiding Two Patterns of Length 3, INTEGERS 26 (2026), Article A18, Section 1 (
asc,des).
Uses 3 · Used by 3
TheoremAscents and descents over permutations avoiding \(123\) and \(132\)#●ready to prove
Let
where \(\sigma\) runs over the permutations of \(\{0, 1, \dots, n-1\}\) that avoid both patterns \(123\) and \(132\), and \(\mathrm{asc}(\sigma)\) and \(\mathrm{des}(\sigma)\) are the numbers of ascents and descents of \(\sigma\); \(G\) is a formal power series in \(x\) with coefficients in \(\mathbb{Q}[p, q]\). Then
public theorem_wanted ascDesGF_123_132 :
let p : PowerSeries (MvPolynomial (Fin 2) ℚ) := PowerSeries.C (MvPolynomial.X 0)
let q : PowerSeries (MvPolynomial (Fin 2) ℚ) := PowerSeries.C (MvPolynomial.X 1)
(1 - 2 * q * PowerSeries.X - p * q * PowerSeries.X ^ 2 + q ^ 2 * PowerSeries.X ^ 2) *
ascDesGF (pattern3 ![0, 1, 2]) (pattern3 ![0, 2, 1]) =
1 + PowerSeries.X - 2 * q * PowerSeries.X + p * PowerSeries.X ^ 2 -
q * PowerSeries.X ^ 2 - p * q * PowerSeries.X ^ 2 + q ^ 2 * PowerSeries.X ^ 2
public noncomputable def ascDesGF (τ ρ : Equiv.Perm (Fin 3)) :
PowerSeries (MvPolynomial (Fin 2) ℚ) :=
PowerSeries.mk fun n => ∑ σ ∈ (Finset.univ.filter fun σ : Equiv.Perm (Fin n) =>
¬ HasPattern σ τ ∧ ¬ HasPattern σ ρ),
MvPolynomial.X 0 ^ permAscents σ * MvPolynomial.X 1 ^ permDescents σ
WantedExt/Combinatorics/Enumerative/TwoPatternAvoidanceCountsWanted.lean:149
public def pattern3 (v : Fin 3 → Fin 3) (hv : Function.Bijective v := by decide) :
Equiv.Perm (Fin 3) where
toFun := v
invFun := Fintype.bijInv hv
left_inv := Fintype.leftInverse_bijInv hv
right_inv := Fintype.rightInverse_bijInv hv
WantedExt/Combinatorics/Enumerative/TwoPatternAvoidanceCountsWanted.lean:48
Sources
- Han, Joint Distributions of 10 Classical Statistics over Permutations Avoiding Two Patterns of Length 3, INTEGERS 26 (2026), Article A18, Corollary 1.
TheoremAscents and descents over permutations avoiding \(132\) and \(321\)#●ready to prove
Let
where \(\sigma\) runs over the permutations of \(\{0, 1, \dots, n-1\}\) that avoid both patterns \(132\) and \(321\), and \(\mathrm{asc}(\sigma)\) and \(\mathrm{des}(\sigma)\) are the numbers of ascents and descents of \(\sigma\); \(G\) is a formal power series in \(x\) with coefficients in \(\mathbb{Q}[p, q]\). Then
public theorem_wanted ascDesGF_132_321 :
let p : PowerSeries (MvPolynomial (Fin 2) ℚ) := PowerSeries.C (MvPolynomial.X 0)
let q : PowerSeries (MvPolynomial (Fin 2) ℚ) := PowerSeries.C (MvPolynomial.X 1)
(1 - p * PowerSeries.X) ^ 3 * ascDesGF (pattern3 ![0, 2, 1]) (pattern3 ![2, 1, 0]) =
1 + PowerSeries.X - 3 * p * PowerSeries.X - 2 * p * PowerSeries.X ^ 2 +
3 * p ^ 2 * PowerSeries.X ^ 2 + q * PowerSeries.X ^ 2 + p ^ 2 * PowerSeries.X ^ 3 -
p ^ 3 * PowerSeries.X ^ 3
public noncomputable def ascDesGF (τ ρ : Equiv.Perm (Fin 3)) :
PowerSeries (MvPolynomial (Fin 2) ℚ) :=
PowerSeries.mk fun n => ∑ σ ∈ (Finset.univ.filter fun σ : Equiv.Perm (Fin n) =>
¬ HasPattern σ τ ∧ ¬ HasPattern σ ρ),
MvPolynomial.X 0 ^ permAscents σ * MvPolynomial.X 1 ^ permDescents σ
WantedExt/Combinatorics/Enumerative/TwoPatternAvoidanceCountsWanted.lean:149
public def pattern3 (v : Fin 3 → Fin 3) (hv : Function.Bijective v := by decide) :
Equiv.Perm (Fin 3) where
toFun := v
invFun := Fintype.bijInv hv
left_inv := Fintype.leftInverse_bijInv hv
right_inv := Fintype.rightInverse_bijInv hv
WantedExt/Combinatorics/Enumerative/TwoPatternAvoidanceCountsWanted.lean:48
Sources
- Han, Joint Distributions of 10 Classical Statistics over Permutations Avoiding Two Patterns of Length 3, INTEGERS 26 (2026), Article A18, Corollary 2.
TheoremAscents and descents over permutations avoiding \(213\) and \(231\)#●ready to prove
Let
where \(\sigma\) runs over the permutations of \(\{0, 1, \dots, n-1\}\) that avoid both patterns \(213\) and \(231\), and \(\mathrm{asc}(\sigma)\) and \(\mathrm{des}(\sigma)\) are the numbers of ascents and descents of \(\sigma\); \(G\) is a formal power series in \(x\) with coefficients in \(\mathbb{Q}[p, q]\). Then
The lead-in of the source's Corollary 4 names the permutations avoiding \(213\) and \(312\) instead; both classes have this distribution of ascents and descents.
public theorem_wanted ascDesGF_213_231 :
let p : PowerSeries (MvPolynomial (Fin 2) ℚ) := PowerSeries.C (MvPolynomial.X 0)
let q : PowerSeries (MvPolynomial (Fin 2) ℚ) := PowerSeries.C (MvPolynomial.X 1)
(1 - p * PowerSeries.X - q * PowerSeries.X) *
ascDesGF (pattern3 ![1, 0, 2]) (pattern3 ![1, 2, 0]) =
1 + PowerSeries.X - p * PowerSeries.X - q * PowerSeries.X
public noncomputable def ascDesGF (τ ρ : Equiv.Perm (Fin 3)) :
PowerSeries (MvPolynomial (Fin 2) ℚ) :=
PowerSeries.mk fun n => ∑ σ ∈ (Finset.univ.filter fun σ : Equiv.Perm (Fin n) =>
¬ HasPattern σ τ ∧ ¬ HasPattern σ ρ),
MvPolynomial.X 0 ^ permAscents σ * MvPolynomial.X 1 ^ permDescents σ
WantedExt/Combinatorics/Enumerative/TwoPatternAvoidanceCountsWanted.lean:149
public def pattern3 (v : Fin 3 → Fin 3) (hv : Function.Bijective v := by decide) :
Equiv.Perm (Fin 3) where
toFun := v
invFun := Fintype.bijInv hv
left_inv := Fintype.leftInverse_bijInv hv
right_inv := Fintype.rightInverse_bijInv hv
WantedExt/Combinatorics/Enumerative/TwoPatternAvoidanceCountsWanted.lean:48
Sources
- Han, Joint Distributions of 10 Classical Statistics over Permutations Avoiding Two Patterns of Length 3, INTEGERS 26 (2026), Article A18, Corollary 4.
TheoremLeft-to-right and right-to-left extrema of \(132\) and \(213\)#✓fully proved
Writing permutations of \(\{0, 1, 2\}\) in one-based one-line notation, \(132\) has \(2\) left-to-right maxima, \(2\) right-to-left maxima, \(1\) left-to-right minimum and \(2\) right-to-left minima, and \(213\) has \(2\) left-to-right maxima, \(1\) right-to-left maximum, \(2\) left-to-right minima and \(2\) right-to-left minima.
public theorem permExtrema_small :
permLeftToRightMaxCount (pattern3 ![0, 2, 1]) = 2 ∧
permRightToLeftMaxCount (pattern3 ![0, 2, 1]) = 2 ∧
permLeftToRightMinCount (pattern3 ![0, 2, 1]) = 1 ∧
permRightToLeftMinCount (pattern3 ![0, 2, 1]) = 2 ∧
permLeftToRightMaxCount (pattern3 ![1, 0, 2]) = 2 ∧
permRightToLeftMaxCount (pattern3 ![1, 0, 2]) = 1 ∧
permLeftToRightMinCount (pattern3 ![1, 0, 2]) = 2 ∧
permRightToLeftMinCount (pattern3 ![1, 0, 2]) = 2
def permLeftToRightMaxCount (σ : Equiv.Perm (Fin n)) : ℕ :=
(Finset.univ.filter fun i : Fin n => ∀ j : Fin n, j < i → σ j < σ i).card
MathlibExt/Combinatorics/Enumerative/PermutationStatistics.lean:44
public def pattern3 (v : Fin 3 → Fin 3) (hv : Function.Bijective v := by decide) :
Equiv.Perm (Fin 3) where
toFun := v
invFun := Fintype.bijInv hv
left_inv := Fintype.leftInverse_bijInv hv
right_inv := Fintype.rightInverse_bijInv hv
WantedExt/Combinatorics/Enumerative/TwoPatternAvoidanceCountsWanted.lean:48
def permRightToLeftMaxCount (σ : Equiv.Perm (Fin n)) : ℕ :=
(Finset.univ.filter fun i : Fin n => ∀ j : Fin n, i < j → σ j < σ i).card
MathlibExt/Combinatorics/Enumerative/PermutationStatistics.lean:51
def permLeftToRightMinCount (σ : Equiv.Perm (Fin n)) : ℕ :=
(Finset.univ.filter fun i : Fin n => ∀ j : Fin n, j < i → σ i < σ j).card
MathlibExt/Combinatorics/Enumerative/PermutationStatistics.lean:59
def permRightToLeftMinCount (σ : Equiv.Perm (Fin n)) : ℕ :=
(Finset.univ.filter fun i : Fin n => ∀ j : Fin n, i < j → σ i < σ j).card
MathlibExt/Combinatorics/Enumerative/PermutationStatistics.lean:67
Sources
- Han, Joint Distributions of 10 Classical Statistics over Permutations Avoiding Two Patterns of Length 3, INTEGERS 26 (2026), Article A18, Section 1 (
lrmax,rlmax,lrmin,rlmin).
TheoremDouble ascents, double descents, peaks and valleys in length three#✓fully proved
Writing permutations of \(\{0, 1, 2\}\) in one-based one-line notation, and \(\operatorname{dasc}\), \(\operatorname{ddes}\), \(\operatorname{pk}\) and \(\operatorname{vl}\) for the numbers of double ascents, double descents, peaks and valleys, \(\operatorname{dasc}(123) = 1\), \(\operatorname{ddes}(321) = 1\), \(\operatorname{dasc}(132) = \operatorname{ddes}(132) = 0\), \(\operatorname{pk}(132) = 1\), \(\operatorname{vl}(132) = 0\), \(\operatorname{pk}(213) = 0\) and \(\operatorname{vl}(213) = 1\).
public theorem permDoubleAscents_peaks_small :
permDoubleAscents (pattern3 ![0, 1, 2]) = 1 ∧
permDoubleDescents (pattern3 ![2, 1, 0]) = 1 ∧
permDoubleAscents (pattern3 ![0, 2, 1]) = 0 ∧
permDoubleDescents (pattern3 ![0, 2, 1]) = 0 ∧
permPeaks (pattern3 ![0, 2, 1]) = 1 ∧ permValleys (pattern3 ![0, 2, 1]) = 0 ∧
permPeaks (pattern3 ![1, 0, 2]) = 0 ∧ permValleys (pattern3 ![1, 0, 2]) = 1
def permDoubleAscents (σ : Equiv.Perm (Fin n)) : ℕ :=
(Finset.univ.filter (IsDoubleAscentAt σ)).card
MathlibExt/Combinatorics/Enumerative/PermutationStatistics.lean:116
public def pattern3 (v : Fin 3 → Fin 3) (hv : Function.Bijective v := by decide) :
Equiv.Perm (Fin 3) where
toFun := v
invFun := Fintype.bijInv hv
left_inv := Fintype.leftInverse_bijInv hv
right_inv := Fintype.rightInverse_bijInv hv
WantedExt/Combinatorics/Enumerative/TwoPatternAvoidanceCountsWanted.lean:48
def permDoubleDescents (σ : Equiv.Perm (Fin n)) : ℕ :=
(Finset.univ.filter (IsDoubleDescentAt σ)).card
MathlibExt/Combinatorics/Enumerative/PermutationStatistics.lean:123
def permPeaks (σ : Equiv.Perm (Fin n)) : ℕ :=
(Finset.univ.filter (IsPeakAt σ)).card
MathlibExt/Combinatorics/Enumerative/PermutationStatistics.lean:130
def permValleys (σ : Equiv.Perm (Fin n)) : ℕ :=
(Finset.univ.filter (IsValleyAt σ)).card
MathlibExt/Combinatorics/Enumerative/PermutationStatistics.lean:137
Sources
- Han, Joint Distributions of 10 Classical Statistics over Permutations Avoiding Two Patterns of Length 3, INTEGERS 26 (2026), Article A18, Section 1 (
dasc,ddes,pk,vl).
DefinitionGenerating function of ten classical statistics over a pair of patterns#✓fully proved
For permutations \(\tau\) and \(\rho\) of \(\{0, 1, 2\}\), let \(S_n(\tau, \rho)\) be the set of permutations of \(\{0, 1, \dots, n-1\}\) that contain neither \(\tau\) nor \(\rho\) as a classical pattern. The generating function \(F_{(\tau, \rho)}\) is the formal power series
in \(x\) with coefficients in the polynomial ring \(\mathbb{Q}[p, q, u, v, s, t, y, z, \ell, m]\). Here \(\mathrm{asc}\) and \(\mathrm{des}\) count ascents and descents, \(\mathrm{lrmax}\) and \(\mathrm{rlmax}\) left-to-right and right-to-left maxima, \(\mathrm{lrmin}\) and \(\mathrm{rlmin}\) left-to-right and right-to-left minima, \(\mathrm{dasc}\) and \(\mathrm{ddes}\) double ascents and double descents, and \(\mathrm{pk}\) and \(\mathrm{vl}\) peaks and valleys. The empty permutation (\(n = 0\)) contributes the constant term \(1\).
public noncomputable def classicalStatGF (τ ρ : Equiv.Perm (Fin 3)) :
PowerSeries (MvPolynomial (Fin 10) ℚ) :=
PowerSeries.mk fun n => ∑ σ ∈ (Finset.univ.filter fun σ : Equiv.Perm (Fin n) =>
¬ HasPattern σ τ ∧ ¬ HasPattern σ ρ),
MvPolynomial.X 0 ^ permAscents σ * MvPolynomial.X 1 ^ permDescents σ *
MvPolynomial.X 2 ^ permLeftToRightMaxCount σ *
MvPolynomial.X 3 ^ permRightToLeftMaxCount σ *
MvPolynomial.X 4 ^ permLeftToRightMinCount σ *
MvPolynomial.X 5 ^ permRightToLeftMinCount σ *
MvPolynomial.X 6 ^ permDoubleAscents σ * MvPolynomial.X 7 ^ permDoubleDescents σ *
MvPolynomial.X 8 ^ permPeaks σ * MvPolynomial.X 9 ^ permValleys σ
def HasPattern {n k : ℕ} (σ : Equiv.Perm (Fin n))
(π : Fin k → Fin k) : Prop :=
∃ e : Fin k → Fin n, (∀ i j : Fin k, i < j → e i < e j) ∧
∀ i j : Fin k, σ (e i) < σ (e j) ↔ π i < π j
WantedExt/Combinatorics/Enumerative/OddFibonacciWanted.lean:62
public def permAscents {n : ℕ} (σ : Equiv.Perm (Fin n)) : ℕ :=
(Finset.univ.filter fun i : Fin n => ∃ h : i.val + 1 < n, σ i < σ ⟨i.val + 1, h⟩).card
WantedExt/Combinatorics/Enumerative/TwoPatternAvoidanceCountsWanted.lean:124
public def permDescents {n : ℕ} (σ : Equiv.Perm (Fin n)) : ℕ :=
(Finset.univ.filter fun i : Fin n => ∃ h : i.val + 1 < n, σ ⟨i.val + 1, h⟩ < σ i).card
WantedExt/Combinatorics/Enumerative/TwoPatternAvoidanceCountsWanted.lean:132
def permLeftToRightMaxCount (σ : Equiv.Perm (Fin n)) : ℕ :=
(Finset.univ.filter fun i : Fin n => ∀ j : Fin n, j < i → σ j < σ i).card
MathlibExt/Combinatorics/Enumerative/PermutationStatistics.lean:44
def permRightToLeftMaxCount (σ : Equiv.Perm (Fin n)) : ℕ :=
(Finset.univ.filter fun i : Fin n => ∀ j : Fin n, i < j → σ j < σ i).card
MathlibExt/Combinatorics/Enumerative/PermutationStatistics.lean:51
def permLeftToRightMinCount (σ : Equiv.Perm (Fin n)) : ℕ :=
(Finset.univ.filter fun i : Fin n => ∀ j : Fin n, j < i → σ i < σ j).card
MathlibExt/Combinatorics/Enumerative/PermutationStatistics.lean:59
def permRightToLeftMinCount (σ : Equiv.Perm (Fin n)) : ℕ :=
(Finset.univ.filter fun i : Fin n => ∀ j : Fin n, i < j → σ i < σ j).card
MathlibExt/Combinatorics/Enumerative/PermutationStatistics.lean:67
def permDoubleAscents (σ : Equiv.Perm (Fin n)) : ℕ :=
(Finset.univ.filter (IsDoubleAscentAt σ)).card
MathlibExt/Combinatorics/Enumerative/PermutationStatistics.lean:116
def permDoubleDescents (σ : Equiv.Perm (Fin n)) : ℕ :=
(Finset.univ.filter (IsDoubleDescentAt σ)).card
MathlibExt/Combinatorics/Enumerative/PermutationStatistics.lean:123
def permPeaks (σ : Equiv.Perm (Fin n)) : ℕ :=
(Finset.univ.filter (IsPeakAt σ)).card
MathlibExt/Combinatorics/Enumerative/PermutationStatistics.lean:130
def permValleys (σ : Equiv.Perm (Fin n)) : ℕ :=
(Finset.univ.filter (IsValleyAt σ)).card
MathlibExt/Combinatorics/Enumerative/PermutationStatistics.lean:137
Sources
- Han, Joint Distributions of 10 Classical Statistics over Permutations Avoiding Two Patterns of Length 3, INTEGERS 26 (2026), Article A18, Section 1 (the g.f.
F_(τ,ρ)).
Uses 11 · Used by 3
DefinitionDouble ascent–double descent generating function of a pair of patterns#✓fully proved
For permutations \(\tau\) and \(\rho\) of \(\{0, 1, 2\}\), let \(S_n(\tau, \rho)\) be the set of permutations of \(\{0, 1, \dots, n-1\}\) that contain neither \(\tau\) nor \(\rho\) as a classical pattern. The double ascent–double descent generating function of \((\tau, \rho)\) is the formal power series
in \(x\) with coefficients in the polynomial ring \(\mathbb{Q}[y, z]\), where \(\mathrm{dasc}(\sigma)\) and \(\mathrm{ddes}(\sigma)\) are the numbers of double ascents and double descents of \(\sigma\). The empty permutation (\(n = 0\)) contributes the constant term \(1\).
public noncomputable def dascDdesGF (τ ρ : Equiv.Perm (Fin 3)) :
PowerSeries (MvPolynomial (Fin 2) ℚ) :=
PowerSeries.mk fun n => ∑ σ ∈ (Finset.univ.filter fun σ : Equiv.Perm (Fin n) =>
¬ HasPattern σ τ ∧ ¬ HasPattern σ ρ),
MvPolynomial.X 0 ^ permDoubleAscents σ * MvPolynomial.X 1 ^ permDoubleDescents σ
def HasPattern {n k : ℕ} (σ : Equiv.Perm (Fin n))
(π : Fin k → Fin k) : Prop :=
∃ e : Fin k → Fin n, (∀ i j : Fin k, i < j → e i < e j) ∧
∀ i j : Fin k, σ (e i) < σ (e j) ↔ π i < π j
WantedExt/Combinatorics/Enumerative/OddFibonacciWanted.lean:62
def permDoubleAscents (σ : Equiv.Perm (Fin n)) : ℕ :=
(Finset.univ.filter (IsDoubleAscentAt σ)).card
MathlibExt/Combinatorics/Enumerative/PermutationStatistics.lean:116
def permDoubleDescents (σ : Equiv.Perm (Fin n)) : ℕ :=
(Finset.univ.filter (IsDoubleDescentAt σ)).card
MathlibExt/Combinatorics/Enumerative/PermutationStatistics.lean:123
Sources
- Han, Joint Distributions of 10 Classical Statistics over Permutations Avoiding Two Patterns of Length 3, INTEGERS 26 (2026), Article A18, Section 1 (
dasc,ddes).
Uses 3 · Used by 1
TheoremTen classical statistics over permutations avoiding \(123\) and \(132\)#●ready to prove
Let \(F\) be the joint generating function of the ten classical statistics over the permutations avoiding both patterns \(123\) and \(132\): a formal power series in \(x\) over \(\mathbb{Q}[p, q, u, v, s, t, y, z, \ell, m]\) in which \(x\) marks the length and \(p, q, u, v, s, t, y, z, \ell, m\) mark the numbers of ascents, descents, left-to-right maxima, right-to-left maxima, left-to-right minima, right-to-left minima, double ascents, double descents, peaks and valleys, respectively. Then
MetaMathlibExt.classicalStatGF_123_132 · 19 lines
public theorem_wanted classicalStatGF_123_132 :
let x : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.X
let p : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.C (MvPolynomial.X 0)
let q : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.C (MvPolynomial.X 1)
let u : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.C (MvPolynomial.X 2)
let v : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.C (MvPolynomial.X 3)
let s : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.C (MvPolynomial.X 4)
let t : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.C (MvPolynomial.X 5)
let y : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.C (MvPolynomial.X 6)
let z : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.C (MvPolynomial.X 7)
let ℓ : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.C (MvPolynomial.X 8)
let m : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.C (MvPolynomial.X 9)
(1 - ℓ * m * p * q * s * v * x ^ 2 - q * s * x * z - q * s * v * x * z + q ^ 2 * s ^ 2 * v *
x ^ 2 * z ^ 2) *
classicalStatGF (pattern3 ![0, 1, 2]) (pattern3 ![0, 2, 1]) =
1 + s * x * (t * u * v + p * t ^ 2 * u ^ 2 * v * x - q * (ℓ * m * p * v * x + z + v * z))
+ q ^ 2 * s ^ 3 * t * u * v ^ 2 * x ^ 3 * (ℓ * p * u * x * (m - z) + z * (-1 - m * p * t * u
* x + z + p * t * u * x * z)) + q * s ^ 2 * v * x ^ 2 * (q * z ^ 2 + p * t ^ 2 * u * x * (m
* (u + v) - u * (1 + v) * z) + t * u * (-z - v * (-1 + ℓ * p * (m - u) * x + z)))
public noncomputable def classicalStatGF (τ ρ : Equiv.Perm (Fin 3)) :
PowerSeries (MvPolynomial (Fin 10) ℚ) :=
PowerSeries.mk fun n => ∑ σ ∈ (Finset.univ.filter fun σ : Equiv.Perm (Fin n) =>
¬ HasPattern σ τ ∧ ¬ HasPattern σ ρ),
MvPolynomial.X 0 ^ permAscents σ * MvPolynomial.X 1 ^ permDescents σ *
MvPolynomial.X 2 ^ permLeftToRightMaxCount σ *
MvPolynomial.X 3 ^ permRightToLeftMaxCount σ *
MvPolynomial.X 4 ^ permLeftToRightMinCount σ *
MvPolynomial.X 5 ^ permRightToLeftMinCount σ *
MvPolynomial.X 6 ^ permDoubleAscents σ * MvPolynomial.X 7 ^ permDoubleDescents σ *
MvPolynomial.X 8 ^ permPeaks σ * MvPolynomial.X 9 ^ permValleys σ
WantedExt/Combinatorics/Enumerative/TwoPatternAvoidanceCountsWanted.lean:242
public def pattern3 (v : Fin 3 → Fin 3) (hv : Function.Bijective v := by decide) :
Equiv.Perm (Fin 3) where
toFun := v
invFun := Fintype.bijInv hv
left_inv := Fintype.leftInverse_bijInv hv
right_inv := Fintype.rightInverse_bijInv hv
WantedExt/Combinatorics/Enumerative/TwoPatternAvoidanceCountsWanted.lean:48
Sources
- Han, Joint Distributions of 10 Classical Statistics over Permutations Avoiding Two Patterns of Length 3, INTEGERS 26 (2026), Article A18, Theorem 2.
TheoremTen classical statistics over permutations avoiding \(132\) and \(321\)#●ready to prove
Let \(F\) be the joint generating function of the ten classical statistics over the permutations avoiding both patterns \(132\) and \(321\): a formal power series in \(x\) over \(\mathbb{Q}[p, q, u, v, s, t, y, z, \ell, m]\) in which \(x\) marks the length and \(p, q, u, v, s, t, y, z, \ell, m\) mark the numbers of ascents, descents, left-to-right maxima, right-to-left maxima, left-to-right minima, right-to-left minima, double ascents, double descents, peaks and valleys, respectively. Then \((1 - ptxy)(1 - puxy)(1 - ptuxy)\, F\) equals
MetaMathlibExt.classicalStatGF_132_321 · 35 lines
public theorem_wanted classicalStatGF_132_321 :
let x : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.X
let p : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.C (MvPolynomial.X 0)
let q : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.C (MvPolynomial.X 1)
let u : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.C (MvPolynomial.X 2)
let v : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.C (MvPolynomial.X 3)
let s : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.C (MvPolynomial.X 4)
let t : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.C (MvPolynomial.X 5)
let y : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.C (MvPolynomial.X 6)
let z : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.C (MvPolynomial.X 7)
let ℓ : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.C (MvPolynomial.X 8)
let m : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.C (MvPolynomial.X 9)
((1 - p * t * x * y) * (1 - p * u * x * y) * (1 - p * t * u * x * y)) *
classicalStatGF (pattern3 ![0, 2, 1]) (pattern3 ![2, 1, 0]) =
1 + s * t * u * v * x + p * s * t ^ 2 * u ^ 2 * v * x ^ 2 + q * s ^ 2 * t * u * v ^ 2 * x ^ 2
+ m * p * q * s ^ 2 * t ^ 2 * u ^ 2 * v * x ^ 3 + m * p * q * s ^ 2 * t ^ 2 * u * v ^ 2 *
x ^ 3 + ℓ * p * q * s ^ 2 * t * u ^ 2 * v ^ 2 * x ^ 3 + ℓ * m * p ^ 2 * q * s ^ 2 * t ^ 2 *
u ^ 3 * v * x ^ 4 + ℓ * m * p ^ 2 * q * s ^ 2 * t ^ 2 * u ^ 2 * v ^ 2 * x ^ 4 - p * t * x *
y - p * u * x * y - p * q * s ^ 2 * t * u ^ 2 * v ^ 2 * x ^ 3 * y - p * s * t ^ 2 * u * v *
x ^ 2 * y - p * s * t * u ^ 2 * v * x ^ 2 * y - p * s * t ^ 2 * u ^ 2 * v * x ^ 2 * y
- p ^ 2 * s * t ^ 3 * u ^ 2 * v * x ^ 3 * y - p ^ 2 * s * t ^ 2 * u ^ 3 * v * x ^ 3 * y - p
* q * s ^ 2 * t ^ 2 * u * v ^ 2 * x ^ 3 * y - p * t * u * x * y - p * q * s ^ 2 * t ^ 2 *
u ^ 2 * v ^ 2 * x ^ 3 * y - m * p ^ 2 * q * s ^ 2 * t ^ 2 * u ^ 3 * v * x ^ 4 * y - ℓ *
p ^ 2 * q * s ^ 2 * t ^ 2 * u ^ 2 * v ^ 2 * x ^ 4 * y - m * p ^ 2 * q * s ^ 2 * t ^ 2 *
u ^ 2 * v ^ 2 * x ^ 4 * y - m * p ^ 2 * q * s ^ 2 * t ^ 3 * u ^ 2 * v ^ 2 * x ^ 4 * y - ℓ *
p ^ 2 * q * s ^ 2 * t ^ 2 * u ^ 3 * v ^ 2 * x ^ 4 * y - ℓ * m * p ^ 3 * q * s ^ 2 * t ^ 3 *
u ^ 3 * v ^ 2 * x ^ 5 * y + p ^ 2 * t * u * x ^ 2 * y ^ 2 + p ^ 2 * t ^ 2 * u * x ^ 2 *
y ^ 2 + p ^ 2 * t * u ^ 2 * x ^ 2 * y ^ 2 + p ^ 2 * s * t ^ 2 * u ^ 2 * v * x ^ 3 * y ^ 2
+ p ^ 2 * s * t ^ 3 * u ^ 2 * v * x ^ 3 * y ^ 2 + p ^ 2 * s * t ^ 2 * u ^ 3 * v * x ^ 3 *
y ^ 2 + p ^ 3 * s * t ^ 3 * u ^ 3 * v * x ^ 4 * y ^ 2 + p ^ 2 * q * s ^ 2 * t ^ 2 * u ^ 2 *
v ^ 2 * x ^ 4 * y ^ 2 + p ^ 2 * q * s ^ 2 * t ^ 3 * u ^ 2 * v ^ 2 * x ^ 4 * y ^ 2 + p ^ 2 *
q * s ^ 2 * t ^ 2 * u ^ 3 * v ^ 2 * x ^ 4 * y ^ 2 + ℓ * p ^ 3 * q * s ^ 2 * t ^ 3 * u ^ 3 *
v ^ 2 * x ^ 5 * y ^ 2 + m * p ^ 3 * q * s ^ 2 * t ^ 3 * u ^ 3 * v ^ 2 * x ^ 5 * y ^ 2
- p ^ 3 * t ^ 2 * u ^ 2 * x ^ 3 * y ^ 3 - p ^ 3 * s * t ^ 3 * u ^ 3 * v * x ^ 4 * y ^ 3
- p ^ 3 * q * s ^ 2 * t ^ 3 * u ^ 3 * v ^ 2 * x ^ 5 * y ^ 3
public noncomputable def classicalStatGF (τ ρ : Equiv.Perm (Fin 3)) :
PowerSeries (MvPolynomial (Fin 10) ℚ) :=
PowerSeries.mk fun n => ∑ σ ∈ (Finset.univ.filter fun σ : Equiv.Perm (Fin n) =>
¬ HasPattern σ τ ∧ ¬ HasPattern σ ρ),
MvPolynomial.X 0 ^ permAscents σ * MvPolynomial.X 1 ^ permDescents σ *
MvPolynomial.X 2 ^ permLeftToRightMaxCount σ *
MvPolynomial.X 3 ^ permRightToLeftMaxCount σ *
MvPolynomial.X 4 ^ permLeftToRightMinCount σ *
MvPolynomial.X 5 ^ permRightToLeftMinCount σ *
MvPolynomial.X 6 ^ permDoubleAscents σ * MvPolynomial.X 7 ^ permDoubleDescents σ *
MvPolynomial.X 8 ^ permPeaks σ * MvPolynomial.X 9 ^ permValleys σ
WantedExt/Combinatorics/Enumerative/TwoPatternAvoidanceCountsWanted.lean:242
public def pattern3 (v : Fin 3 → Fin 3) (hv : Function.Bijective v := by decide) :
Equiv.Perm (Fin 3) where
toFun := v
invFun := Fintype.bijInv hv
left_inv := Fintype.leftInverse_bijInv hv
right_inv := Fintype.rightInverse_bijInv hv
WantedExt/Combinatorics/Enumerative/TwoPatternAvoidanceCountsWanted.lean:48
Sources
- Han, Joint Distributions of 10 Classical Statistics over Permutations Avoiding Two Patterns of Length 3, INTEGERS 26 (2026), Article A18, Theorem 3.
TheoremTen classical statistics over permutations avoiding \(213\) and \(231\)#●ready to prove
Let \(F\) be the joint generating function of the ten classical statistics over the permutations avoiding both patterns \(213\) and \(231\): a formal power series in \(x\) over \(\mathbb{Q}[p, q, u, v, s, t, y, z, \ell, m]\) in which \(x\) marks the length and \(p, q, u, v, s, t, y, z, \ell, m\) mark the numbers of ascents, descents, left-to-right maxima, right-to-left maxima, left-to-right minima, right-to-left minima, double ascents, double descents, peaks and valleys, respectively. Then \((1 - ptuxy)(1 - qsvxz)\bigl((1 - ptxy)(1 - qvxz) - \ell mpqtvx^2\bigr)\, F\) equals
MetaMathlibExt.classicalStatGF_213_231 · 24 lines
public theorem_wanted classicalStatGF_213_231 :
let x : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.X
let p : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.C (MvPolynomial.X 0)
let q : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.C (MvPolynomial.X 1)
let u : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.C (MvPolynomial.X 2)
let v : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.C (MvPolynomial.X 3)
let s : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.C (MvPolynomial.X 4)
let t : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.C (MvPolynomial.X 5)
let y : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.C (MvPolynomial.X 6)
let z : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.C (MvPolynomial.X 7)
let ℓ : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.C (MvPolynomial.X 8)
let m : PowerSeries (MvPolynomial (Fin 10) ℚ) := PowerSeries.C (MvPolynomial.X 9)
((1 - p * t * u * x * y) * (1 - q * s * v * x * z) * ((1 - p * t * x * y) * (1 - q * v * x * z)
- ℓ * m * p * q * t * v * x ^ 2)) *
classicalStatGF (pattern3 ![1, 0, 2]) (pattern3 ![1, 2, 0]) =
s * v * x * (q * z * (q * v * x * z - 1) + p ^ 2 * t ^ 3 * u ^ 2 * x ^ 2 * y * (ℓ * (m - 1) *
q * v * x - (y - 1) * (q * v * x * z - 1)) + t * (u * (1 - q * v * x * z) * (1 + p * q * x *
y * z) + p * q * x * z * (ℓ * m * q * v * x + y - q * v * x * y * z)) - p * t ^ 2 * u * x *
(-ℓ * q * u * v * x - u * (y - 1) * (q * v * x * z - 1) + (1 + p * q * x * y * z) * (ℓ * m *
q * v * x + y - q * v * x * y * z))) - q * s ^ 2 * t * u * v ^ 2 * x ^ 2 * (m * p * t * x *
(p * t * u * x * y - 1) * (1 + (ℓ - 1) * q * v * x * z) - (p * t * x * y - 1) * ((1 - z) *
(q * v * x * z - 1) + p * t * u * x * (z * (1 + ℓ * q * v * x - q * v * x * z) + y * (z - 1)
* (q * v * x * z - 1)))) + (p * t * u * x * y - 1) * (ℓ * m * p * q * t * v * x ^ 2 - (1 - p
* t * x * y) * (1 - q * v * x * z))
public noncomputable def classicalStatGF (τ ρ : Equiv.Perm (Fin 3)) :
PowerSeries (MvPolynomial (Fin 10) ℚ) :=
PowerSeries.mk fun n => ∑ σ ∈ (Finset.univ.filter fun σ : Equiv.Perm (Fin n) =>
¬ HasPattern σ τ ∧ ¬ HasPattern σ ρ),
MvPolynomial.X 0 ^ permAscents σ * MvPolynomial.X 1 ^ permDescents σ *
MvPolynomial.X 2 ^ permLeftToRightMaxCount σ *
MvPolynomial.X 3 ^ permRightToLeftMaxCount σ *
MvPolynomial.X 4 ^ permLeftToRightMinCount σ *
MvPolynomial.X 5 ^ permRightToLeftMinCount σ *
MvPolynomial.X 6 ^ permDoubleAscents σ * MvPolynomial.X 7 ^ permDoubleDescents σ *
MvPolynomial.X 8 ^ permPeaks σ * MvPolynomial.X 9 ^ permValleys σ
WantedExt/Combinatorics/Enumerative/TwoPatternAvoidanceCountsWanted.lean:242
public def pattern3 (v : Fin 3 → Fin 3) (hv : Function.Bijective v := by decide) :
Equiv.Perm (Fin 3) where
toFun := v
invFun := Fintype.bijInv hv
left_inv := Fintype.leftInverse_bijInv hv
right_inv := Fintype.rightInverse_bijInv hv
WantedExt/Combinatorics/Enumerative/TwoPatternAvoidanceCountsWanted.lean:48
Sources
- Han, Joint Distributions of 10 Classical Statistics over Permutations Avoiding Two Patterns of Length 3, INTEGERS 26 (2026), Article A18, Theorem 5.
TheoremDouble ascents and double descents over permutations avoiding \(231\) and \(312\)#●ready to prove
Let
where \(\sigma\) runs over the permutations of \(\{0, 1, \dots, n-1\}\) that avoid both patterns \(231\) and \(312\), and \(\mathrm{dasc}(\sigma)\) and \(\mathrm{ddes}(\sigma)\) are the numbers of double ascents and double descents of \(\sigma\); \(H\) is a formal power series in \(x\) with coefficients in \(\mathbb{Q}[y, z]\). Then
The source's Corollary 3 also gives an identity (22) for ascents and descents, marked by \(p\) and \(q\), and an identity (24) for peaks and valleys, marked by \(\ell\) and \(m\), over this class; both are false as printed (at \(p = 2\), \(q = 1\) the coefficient of \(x^5\) in (22) is \(75\), the true value \(81\); at \(\ell = 2\), \(m = 1\) the coefficient of \(x^5\) in (24) is \(28\), the true value \(29\)).
public theorem_wanted dascDdesGF_231_312 :
let x : PowerSeries (MvPolynomial (Fin 2) ℚ) := PowerSeries.X
let y : PowerSeries (MvPolynomial (Fin 2) ℚ) := PowerSeries.C (MvPolynomial.X 0)
let z : PowerSeries (MvPolynomial (Fin 2) ℚ) := PowerSeries.C (MvPolynomial.X 1)
(1 - x * (y + z) - x ^ 2 * (1 - y * z)) *
dascDdesGF (pattern3 ![1, 2, 0]) (pattern3 ![2, 0, 1]) =
1 + x ^ 2 * (1 + x) * (1 - y) * (1 - z) + x * (1 - y - z)
public noncomputable def dascDdesGF (τ ρ : Equiv.Perm (Fin 3)) :
PowerSeries (MvPolynomial (Fin 2) ℚ) :=
PowerSeries.mk fun n => ∑ σ ∈ (Finset.univ.filter fun σ : Equiv.Perm (Fin n) =>
¬ HasPattern σ τ ∧ ¬ HasPattern σ ρ),
MvPolynomial.X 0 ^ permDoubleAscents σ * MvPolynomial.X 1 ^ permDoubleDescents σ
WantedExt/Combinatorics/Enumerative/TwoPatternAvoidanceCountsWanted.lean:259
public def pattern3 (v : Fin 3 → Fin 3) (hv : Function.Bijective v := by decide) :
Equiv.Perm (Fin 3) where
toFun := v
invFun := Fintype.bijInv hv
left_inv := Fintype.leftInverse_bijInv hv
right_inv := Fintype.rightInverse_bijInv hv
WantedExt/Combinatorics/Enumerative/TwoPatternAvoidanceCountsWanted.lean:48
Sources
- Han, Joint Distributions of 10 Classical Statistics over Permutations Avoiding Two Patterns of Length 3, INTEGERS 26 (2026), Article A18, Corollary 3.
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.