Zulip Chat Archive

Stream: Is there code for X?

Topic: combinatorial sums?


Ralf Stephan (Jul 04 2024 at 09:15):

[xn]P(x)k=∑n1+n2+⋯+nk=nan1an2⋯ank[x^n] P(x)^k = \sum_{n_1 + n_2 + \cdots + n_k = n} a_{n_1} a_{n_2} \cdots a_{n_k}
Is this in Mathlib? How to state the sum term? Is a proof out of reach at the moment?

Yaël Dillies (Jul 04 2024 at 09:39):

This exists, but can you give the LHS as a Lean expression? There are many ways you could formalise your current statement and I'm not sure which one you want

Ralf Stephan (Jul 04 2024 at 10:02):

import Mathlib
set_option autoImplicit false
open PowerSeries

example (k n : ℕ) (φ : ℚ⟦X⟧) (hC : constantCoeff ℚ φ = 1) : coeff ℚ n (φ ^ k) = RHS := by sorry

Ralf Stephan (Jul 04 2024 at 14:43):

(deleted)

Ralf Stephan (Jul 05 2024 at 08:07):

Is this coeff_prod (f := φ) (d := n) (s := range k)?

Ralf Stephan (Jul 05 2024 at 13:58):

lemma coeff_pow (k n : ℕ) (φ : R⟦X⟧) :
    coeff ℚ n (φ ^ k) = ∑ l ∈ finsuppAntidiag (range k) n, ∏ i ∈ range k, coeff R (l i) φ := by
  have h₁ (i : ℕ) : Function.const ℕ φ i = φ := rfl
  have h₂ (i : ℕ) : ∏ j ∈ range i, Function.const ℕ φ j = φ ^ i := by
    apply prod_range_induction (fun _ => φ) (fun i => φ ^ i) rfl (congrFun rfl) i
  rw [← h₂, ← h₁ k]
  apply coeff_prod (f := Function.const ℕ φ) (d := n) (s := range k)

Ralf Stephan (Jul 05 2024 at 14:00):

Any objections against submitting this to Mathlib?

Yaël Dillies (Jul 05 2024 at 14:06):

Looks fine except for the fact that you should generalise away from Rat

Ralf Stephan (Jul 05 2024 at 16:10):

Part of #14452.


Last updated: Feb 28 2026 at 14:05 UTC