Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - feat: Complete homogeneous and monomial symmetric polynomials #12572

Closed
wants to merge 118 commits into from
Closed
Show file tree
Hide file tree
Changes from 112 commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
205e212
[RFC] Complete homogeneous symmetric functions
SashaIr Feb 27, 2024
357abb5
Linting
SashaIr Feb 27, 2024
313a3c4
Merge branch 'master' into sashair-symmetric-functions
SashaIr Feb 27, 2024
ff506b7
Implemented suggestions
SashaIr Feb 28, 2024
710e4e0
Minor.
SashaIr Feb 28, 2024
9b15988
Simplifications
SashaIr Feb 28, 2024
d4936f3
Bases
SashaIr Feb 28, 2024
6ddb1ef
Computability of oneEquiv
SashaIr Feb 28, 2024
df119fa
Minor
SashaIr Feb 28, 2024
56c0091
Simp lemmas about products
SashaIr Mar 5, 2024
b247fc2
Linting
SashaIr Mar 5, 2024
48586d8
Linting
SashaIr Mar 5, 2024
fca6614
Linting
SashaIr Mar 5, 2024
4651131
Linting
SashaIr Mar 6, 2024
ac0a48b
Linting
SashaIr Mar 6, 2024
62c37cc
Linting
SashaIr Mar 6, 2024
58ba617
Linting
SashaIr Mar 6, 2024
43f0f2d
Monomial symmetric polynomials
SashaIr Mar 10, 2024
dd46220
Linting
SashaIr Mar 10, 2024
1b6da2e
Update Mathlib/Combinatorics/Partition.lean
SashaIr Mar 10, 2024
7b2fbad
Update Mathlib/Data/Multiset/Dedup.lean
SashaIr Mar 10, 2024
42e5ee4
Update Mathlib/RingTheory/MvPolynomial/Symmetric.lean
SashaIr Mar 10, 2024
5121d1c
Update Mathlib/RingTheory/MvPolynomial/Symmetric.lean
SashaIr Mar 10, 2024
dea7a3d
Linting
SashaIr Mar 10, 2024
e232e2b
Linting
SashaIr Mar 10, 2024
d6a34bc
Docstring
SashaIr Mar 10, 2024
31ad0f7
More linting.
SashaIr Mar 10, 2024
8abd33a
Merge branch 'master' into sashair-symmetric-functions
SashaIr Mar 10, 2024
c947257
Merge branch 'master' into sashair-symmetric-functions
SashaIr Mar 11, 2024
e1b1ae6
fix build
riccardobrasca Mar 13, 2024
c63d2e6
Merge branch 'master' into sashair-symmetric-functions
SashaIr Mar 16, 2024
52f2b8b
Cleanup
SashaIr Mar 16, 2024
a3499f3
Update Mathlib/Combinatorics/Partition.lean
SashaIr Mar 16, 2024
8a97d35
Linting
SashaIr Mar 16, 2024
df592f2
Merge branch 'sashair-symmetric-functions' of https://github.com/lean…
SashaIr Mar 16, 2024
a7d6a94
Merge branch 'master' into sashair-symmetric-functions
SashaIr Mar 28, 2024
937f636
Fix
SashaIr Mar 28, 2024
ec9d093
Update Mathlib/Combinatorics/Enumerative/Partition.lean
SashaIr Mar 30, 2024
f098543
Update Mathlib/Combinatorics/Enumerative/Partition.lean
SashaIr Mar 30, 2024
6b5bbba
Update Mathlib/Combinatorics/Enumerative/Partition.lean
SashaIr Mar 30, 2024
85e93b7
Update Mathlib/Combinatorics/Enumerative/Partition.lean
SashaIr Mar 30, 2024
7b7a95e
Update Mathlib/Data/Multiset/Dedup.lean
SashaIr Mar 30, 2024
3a4e072
Update Mathlib/RingTheory/MvPolynomial/Symmetric.lean
SashaIr Mar 30, 2024
3246566
Update Mathlib/RingTheory/MvPolynomial/Symmetric.lean
SashaIr Mar 30, 2024
c1f7149
Update Mathlib/RingTheory/MvPolynomial/Symmetric.lean
SashaIr Mar 30, 2024
61fe1c7
Update Mathlib/RingTheory/MvPolynomial/Symmetric.lean
SashaIr Mar 30, 2024
3545356
Update Mathlib/RingTheory/MvPolynomial/Symmetric.lean
SashaIr Mar 30, 2024
5632270
Fix
SashaIr Mar 30, 2024
877bcef
Rename
SashaIr Mar 30, 2024
92125f8
Merge branch 'master' into sashair-symmetric-functions
SashaIr Apr 11, 2024
beaaf8b
Update Mathlib/RingTheory/MvPolynomial/Symmetric.lean
SashaIr Apr 12, 2024
ace3fac
Update Mathlib/Combinatorics/Enumerative/Partition.lean
SashaIr May 10, 2024
6c7ba56
Update Mathlib/RingTheory/MvPolynomial/Symmetric.lean
SashaIr May 10, 2024
b487fff
Update Mathlib/RingTheory/MvPolynomial/Symmetric.lean
SashaIr May 10, 2024
a86cefe
Suggestions
SashaIr May 10, 2024
2443cdd
Linting
SashaIr May 10, 2024
5378e04
Remove show
SashaIr May 10, 2024
e18d906
Linting
SashaIr May 10, 2024
4517acb
Linting
SashaIr May 10, 2024
977788b
Linting
SashaIr May 10, 2024
4c78fb9
Update Mathlib/Combinatorics/Enumerative/Partition.lean
SashaIr May 13, 2024
c236dc6
Update Mathlib/RingTheory/MvPolynomial/Symmetric.lean
SashaIr May 13, 2024
98dce0c
Update Mathlib/Combinatorics/Enumerative/Partition.lean
SashaIr May 13, 2024
0871198
Update Mathlib/Combinatorics/Enumerative/Partition.lean
SashaIr May 13, 2024
ef52886
Update Mathlib/Combinatorics/Enumerative/Partition.lean
SashaIr May 13, 2024
d83c121
Update Mathlib/RingTheory/MvPolynomial/Symmetric.lean
SashaIr May 13, 2024
69d7db9
Update Mathlib/RingTheory/MvPolynomial/Symmetric.lean
SashaIr May 13, 2024
21d0e74
Update Mathlib/Data/Multiset/Dedup.lean
SashaIr May 13, 2024
d248eea
Update Mathlib/Combinatorics/Enumerative/Partition.lean
SashaIr May 13, 2024
be785a6
Update Mathlib/Data/Multiset/Dedup.lean
SashaIr May 13, 2024
1dd283f
Update Mathlib/Data/Multiset/Dedup.lean
SashaIr May 13, 2024
f8d7f16
Update Mathlib/Data/Sym/Basic.lean
SashaIr May 13, 2024
e3fa737
Update Mathlib/Data/Multiset/Dedup.lean
SashaIr May 13, 2024
d0cad77
Update Mathlib/Data/Sym/Basic.lean
SashaIr May 13, 2024
0b47a3a
Update Mathlib/Data/Sym/Basic.lean
SashaIr May 13, 2024
686339e
Update Mathlib/RingTheory/MvPolynomial/Symmetric.lean
SashaIr May 13, 2024
a5303ce
Update Mathlib/RingTheory/MvPolynomial/Symmetric.lean
SashaIr May 13, 2024
01bd97b
Update Mathlib/RingTheory/MvPolynomial/Symmetric.lean
SashaIr May 13, 2024
914f69e
Update Mathlib/RingTheory/MvPolynomial/Symmetric.lean
SashaIr May 13, 2024
29de762
Update Mathlib/RingTheory/MvPolynomial/Symmetric.lean
SashaIr May 13, 2024
a78b7ca
Update Mathlib/RingTheory/MvPolynomial/Symmetric.lean
SashaIr May 13, 2024
c62773b
Update Mathlib/RingTheory/MvPolynomial/Symmetric.lean
SashaIr May 13, 2024
9d4664a
Update Mathlib/Combinatorics/Enumerative/Partition.lean
SashaIr May 13, 2024
e1d91a9
Update Mathlib/RingTheory/MvPolynomial/Symmetric.lean
SashaIr May 13, 2024
160272b
Stylistic changes
SashaIr May 13, 2024
d857a1a
Merge remote-tracking branch 'origin/master' into sashair-hm-symmetri…
YaelDillies May 13, 2024
cd3d2f7
use notation
YaelDillies May 13, 2024
9869d79
Fixes
SashaIr May 13, 2024
73dae1d
Add some variables
SashaIr May 13, 2024
40a90fa
Minor
SashaIr May 13, 2024
3d101ea
Update Mathlib/Combinatorics/Enumerative/Partition.lean
SashaIr May 13, 2024
8a6e88c
Merge branch 'master' into sashair-hm-symmetric-polynomials
SashaIr Jun 15, 2024
eac3cf9
Update Mathlib/Data/Sym/Basic.lean
SashaIr Jun 16, 2024
67b1910
Update Mathlib/Data/Multiset/Dedup.lean
SashaIr Jun 17, 2024
cf0f59f
Update Mathlib/RingTheory/MvPolynomial/Symmetric.lean
SashaIr Jun 17, 2024
df57d4a
Update Mathlib/RingTheory/MvPolynomial/Symmetric.lean
SashaIr Jun 17, 2024
2e256aa
Merge branch 'master' into sashair-hm-symmetric-polynomials
SashaIr Jul 11, 2024
81bd560
Fix errors
SashaIr Jul 11, 2024
d4a0a24
Merge branch 'master' into sashair-hm-symmetric-polynomials
SashaIr Jul 11, 2024
262fa8e
Merge
SashaIr Jul 11, 2024
f4c4f30
Updates
SashaIr Jul 11, 2024
bcf74cb
npos
SashaIr Jul 11, 2024
6a04bc8
Got rid of products
SashaIr Jul 11, 2024
d6a9e77
Remove explicit variables
SashaIr Jul 11, 2024
fda6c6d
Fix build fail
SashaIr Jul 11, 2024
1371a3f
More fixes
SashaIr Jul 11, 2024
dcbf7a8
Remove redundant lemmas
SashaIr Jul 11, 2024
7977955
Revert "More fixes"
SashaIr Jul 11, 2024
389f472
Revert "Fix build fail"
SashaIr Jul 11, 2024
881be75
Revert "Remove explicit variables"
SashaIr Jul 11, 2024
6446405
Remove redundancies
SashaIr Jul 11, 2024
b71624d
Yeah right forgot this one
SashaIr Jul 11, 2024
82fa131
`onePart` to `indiscrete`, docstrings
SashaIr Jul 12, 2024
acd703b
Remove extra lemma
SashaIr Jul 15, 2024
0fb7488
Merge branch 'master' into sashair-hm-symmetric-polynomials
SashaIr Aug 4, 2024
dd82e43
Remove duplicate
SashaIr Aug 4, 2024
937f171
Idk why there were duplicates
SashaIr Aug 4, 2024
3070c49
I wish I got all the corrections before splitting the PR
SashaIr Aug 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions Mathlib/Combinatorics/Enumerative/Partition.lean
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,34 @@ def ofSums (n : ℕ) (l : Multiset ℕ) (hl : l.sum = n) : Partition n where
def ofMultiset (l : Multiset ℕ) : Partition l.sum := ofSums _ l rfl
#align nat.partition.of_multiset Nat.Partition.ofMultiset

/-- An element `s` of `Sym σ n` induces a partition given by its multiplicities. -/
def ofSym {n : ℕ} {σ : Type*} (s : Sym σ n) [DecidableEq σ] : n.Partition where
parts := s.1.dedup.map s.1.count
parts_pos := by simp [Multiset.count_pos]
parts_sum := by
show ∑ a ∈ s.1.toFinset, count a s.1 = n
rw [toFinset_sum_count_eq]
exact s.2

variable {n : ℕ} {σ τ : Type*} [DecidableEq σ] [DecidableEq τ]

lemma ofSym_map (e : σ ≃ τ) (s : Sym σ n) :
ofSym (s.map e) = ofSym s := by
simp only [ofSym, Sym.val_eq_coe, Sym.coe_map, toFinset_val, mk.injEq]
rw [Multiset.dedup_map_of_injective e.injective]
simp only [map_map, Function.comp_apply]
congr; funext i
rw [← Multiset.count_map_eq_count' e _ e.injective]

/-- An equivalence between `σ` and `τ` induces an equivalence between the subtypes of `Sym σ n` and
`Sym τ n` corresponding to a given partition. -/
def ofSym_shape_equiv (μ : Partition n) (e : σ ≃ τ) :
{x : Sym σ n // ofSym x = μ} ≃ {x : Sym τ n // ofSym x = μ} where
toFun := fun x => ⟨Sym.equivCongr e x, by simp [ofSym_map, x.2]⟩
invFun := fun x => ⟨Sym.equivCongr e.symm x, by simp [ofSym_map, x.2]⟩
left_inv := by intro x; simp
right_inv := by intro x; simp

/-- The partition of exactly one part. -/
def indiscrete (n : ℕ) : Partition n := ofSums n {n} rfl
#align nat.partition.indiscrete_partition Nat.Partition.indiscrete
Expand All @@ -123,6 +151,21 @@ instance UniquePartitionZero : Unique (Partition 0) where
instance UniquePartitionOne : Unique (Partition 1) where
uniq _ := Partition.ext _ _ <| by simp

lemma ofSym_one (s : Sym σ 1) : ofSym s = indiscrete 1 := by
ext; simp

/-- The equivalence between `σ` and `1`-tuples of elements of σ -/
def ofSym_equiv_onePart (σ : Type*) [DecidableEq σ] : σ ≃
{ a : Sym σ 1 // ofSym a = indiscrete 1 } where
toFun := fun a => ⟨Sym.oneEquiv a, by ext; simp⟩
invFun := fun a => Sym.oneEquiv.symm a.1
left_inv := by intro a; simp only [Sym.oneEquiv_apply]; rfl
right_inv := by intro a; simp only [Equiv.apply_symm_apply, Subtype.coe_eta]

@[simp]
lemma ofSym_equiv_onePart_apply (i : σ) :
((ofSym_equiv_onePart σ) i : Multiset σ) = {i} := rfl

/-- The number of times a positive integer `i` appears in the partition `ofSums n l hl` is the same
as the number of times it appears in the multiset `l`.
(For `i = 0`, `Partition.non_zero` combined with `Multiset.count_eq_zero_of_not_mem` gives that
Expand Down
13 changes: 13 additions & 0 deletions Mathlib/Data/Sym/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,19 @@ theorem mem_append_iff {s' : Sym α m} : a ∈ s.append s' ↔ a ∈ s ∨ a ∈
Multiset.mem_add
#align sym.mem_append_iff Sym.mem_append_iff

/-- Defines an equivalence between `α` and `Sym α 1`. -/
@[simps apply]
def oneEquiv : α ≃ Sym α 1 where
toFun a := ⟨{a}, by simp⟩
invFun s := (Equiv.subtypeQuotientEquivQuotientSubtype
(·.length = 1) _ (fun l ↦ Iff.rfl) (fun l l' ↦ by rfl) s).liftOn
(fun l ↦ l.1.head <| List.length_pos.mp <| by simp)
fun ⟨_, _⟩ ⟨_, h⟩ ↦ fun perm ↦ by
obtain ⟨a, rfl⟩ := List.length_eq_one.mp h
exact List.eq_of_mem_singleton (perm.mem_iff.mp <| List.head_mem _)
left_inv a := by rfl
right_inv := by rintro ⟨⟨l⟩, h⟩; obtain ⟨a, rfl⟩ := List.length_eq_one.mp h; rfl

/-- Fill a term `m : Sym α (n - i)` with `i` copies of `a` to obtain a term of `Sym α n`.
This is a convenience wrapper for `m.append (replicate i a)` that adjusts the term using
`Sym.cast`. -/
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/RingTheory/MvPolynomial/NewtonIdentities.lean
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ private theorem esymm_to_weight (k : ℕ) : k * esymm σ R k =
private theorem esymm_mul_psum_summand_to_weight (k : ℕ) (a : ℕ × ℕ) (ha : a ∈ antidiagonal k) :
∑ A ∈ powersetCard a.fst univ, ∑ j, weight σ R k (A, j) =
(-1) ^ a.fst * esymm σ R a.fst * psum σ R a.snd := by
simp only [esymm, psum_def, weight, ← mul_assoc, mul_sum]
simp only [esymm, psum, weight, ← mul_assoc, mul_sum]
rw [sum_comm]
refine sum_congr rfl fun x _ ↦ ?_
rw [sum_mul]
Expand Down
159 changes: 125 additions & 34 deletions Mathlib/RingTheory/MvPolynomial/Symmetric.lean
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Hanting Zhang, Johan Commelin
-/
import Mathlib.Algebra.Algebra.Subalgebra.Basic
import Mathlib.Algebra.MvPolynomial.Rename
import Mathlib.Algebra.MvPolynomial.CommRing
import Mathlib.Combinatorics.Enumerative.Partition

#align_import ring_theory.mv_polynomial.symmetric from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4"

/-!
# Symmetric Polynomials and Elementary Symmetric Polynomials

This file defines symmetric `MvPolynomial`s and elementary symmetric `MvPolynomial`s.
We also prove some basic facts about them.
This file defines symmetric `MvPolynomial`s and the bases of elementary, complete homogeneous,
power sum, and monomial symmetric `MvPolynomial`s. We also prove some basic facts about them.

## Main declarations

Expand All @@ -23,15 +23,24 @@ We also prove some basic facts about them.

* `MvPolynomial.esymm`

* `MvPolynomial.hsymm`
riccardobrasca marked this conversation as resolved.
Show resolved Hide resolved

* `MvPolynomial.psum`

* `MvPolynomial.msymm`

## Notation

+ `esymm σ R n` is the `n`th elementary symmetric polynomial in `MvPolynomial σ R`.

+ `hsymm σ R n` is the `n`th complete homogeneous symmetric polynomial in `MvPolynomial σ R`.

+ `psum σ R n` is the degree-`n` power sum in `MvPolynomial σ R`, i.e. the sum of monomials
`(X i)^n` over `i ∈ σ`.

+ `msymm σ R μ` is the monomial symmetric polynomial whose exponents set are the parts
of `μ ⊢ n` in `MvPolynomial σ R`.

As in other polynomial files, we typically use the notation:

+ `σ τ : Type*` (indexing the variables)
Expand Down Expand Up @@ -70,27 +79,22 @@ end Multiset

namespace MvPolynomial

variable {σ : Type*} {R : Type*}
variable {τ : Type*} {S : Type*}
variable {σ τ : Type*} {R S : Type*}

/-- A `MvPolynomial φ` is symmetric if it is invariant under
permutations of its variables by the `rename` operation -/
def IsSymmetric [CommSemiring R] (φ : MvPolynomial σ R) : Prop :=
∀ e : Perm σ, rename e φ = φ
#align mv_polynomial.is_symmetric MvPolynomial.IsSymmetric

variable (σ R)

/-- The subalgebra of symmetric `MvPolynomial`s. -/
def symmetricSubalgebra [CommSemiring R] : Subalgebra R (MvPolynomial σ R) where
def symmetricSubalgebra (σ R : Type*) [CommSemiring R] : Subalgebra R (MvPolynomial σ R) where
carrier := setOf IsSymmetric
algebraMap_mem' r e := rename_C e r
mul_mem' ha hb e := by rw [map_mul, ha, hb]
add_mem' ha hb e := by rw [map_add, ha, hb]
#align mv_polynomial.symmetric_subalgebra MvPolynomial.symmetricSubalgebra

variable {σ R}

@[simp]
theorem mem_symmetricSubalgebra [CommSemiring R] (p : MvPolynomial σ R) :
p ∈ symmetricSubalgebra σ R ↔ p.IsSymmetric :=
Expand Down Expand Up @@ -174,24 +178,30 @@ def renameSymmetricSubalgebra [CommSemiring R] (e : σ ≃ τ) :
(AlgHom.ext <| fun p => Subtype.ext <| by simp)
(AlgHom.ext <| fun p => Subtype.ext <| by simp)

variable (σ R : Type*) [CommSemiring R] [CommSemiring S] [Fintype σ] [Fintype τ]

section ElementarySymmetric

open Finset

variable (σ R) [CommSemiring R] [CommSemiring S] [Fintype σ] [Fintype τ]

/-- The `n`th elementary symmetric `MvPolynomial σ R`. -/
def esymm (n : ℕ) : MvPolynomial σ R :=
∑ t ∈ powersetCard n univ, ∏ i ∈ t, X i
#align mv_polynomial.esymm MvPolynomial.esymm

/--
`esymmPart` is the product of the symmetric polynomials `esymm μᵢ`,
where `μ = (μ₁, μ₂, ...)` is a partition.
-/
def esymmPart {n : ℕ} (μ : n.Partition) : MvPolynomial σ R := (μ.parts.map (esymm σ R)).prod

/-- The `n`th elementary symmetric `MvPolynomial σ R` is obtained by evaluating the
`n`th elementary symmetric at the `Multiset` of the monomials -/
theorem esymm_eq_multiset_esymm : esymm σ R = (univ.val.map X).esymm := by
exact funext fun n => (esymm_map_val X _ n).symm
#align mv_polynomial.esymm_eq_multiset_esymm MvPolynomial.esymm_eq_multiset_esymm

theorem aeval_esymm_eq_multiset_esymm [Algebra R S] (f : σ → S) (n : ) :
theorem aeval_esymm_eq_multiset_esymm [Algebra R S] (n : ) (f : σ → S) :
aeval f (esymm σ R n) = (univ.val.map f).esymm n := by
simp_rw [esymm, aeval_sum, aeval_prod, aeval_X, esymm_map_val]
#align mv_polynomial.aeval_esymm_eq_multiset_esymm MvPolynomial.aeval_esymm_eq_multiset_esymm
Expand All @@ -210,10 +220,18 @@ theorem esymm_eq_sum_monomial (n : ℕ) :
#align mv_polynomial.esymm_eq_sum_monomial MvPolynomial.esymm_eq_sum_monomial

@[simp]
theorem esymm_zero : esymm σ R 0 = 1 := by
simp only [esymm, powersetCard_zero, sum_singleton, prod_empty]
theorem esymm_zero : esymm σ R 0 = 1 := by simp [esymm]
#align mv_polynomial.esymm_zero MvPolynomial.esymm_zero

@[simp]
theorem esymm_one : esymm σ R 1 = ∑ i, X i := by simp [esymm, powersetCard_one]

theorem esymmPart_zero : esymmPart σ R (.indiscrete 0) = 1 := by simp [esymmPart]

@[simp]
theorem esymmPart_onePart (n : ℕ) : esymmPart σ R (.indiscrete n) = esymm σ R n := by
SashaIr marked this conversation as resolved.
Show resolved Hide resolved
cases n <;> simp [esymmPart]

theorem map_esymm (n : ℕ) (f : R →+* S) : map f (esymm σ R n) = esymm σ S n := by
simp_rw [esymm, map_sum, map_prod, map_X]
#align mv_polynomial.map_esymm MvPolynomial.map_esymm
Expand All @@ -230,12 +248,10 @@ theorem rename_esymm (n : ℕ) (e : σ ≃ τ) : rename e (esymm σ R n) = esymm
_ = ∑ t ∈ powersetCard n univ, ∏ i ∈ t, X i := by rw [map_univ_equiv]
#align mv_polynomial.rename_esymm MvPolynomial.rename_esymm

theorem esymm_isSymmetric (n : ℕ) : IsSymmetric (esymm σ R n) := by
intro
rw [rename_esymm]
theorem esymm_isSymmetric (n : ℕ) : IsSymmetric (esymm σ R n) := rename_esymm _ _ n
#align mv_polynomial.esymm_is_symmetric MvPolynomial.esymm_isSymmetric

theorem support_esymm'' (n : ℕ) [DecidableEq σ] [Nontrivial R] :
theorem support_esymm'' [DecidableEq σ] [Nontrivial R] (n : ℕ) :
(esymm σ R n).support =
(powersetCard n (univ : Finset σ)).biUnion fun t =>
(Finsupp.single (∑ i ∈ t, Finsupp.single i 1) (1 : R)).support := by
Expand All @@ -260,23 +276,21 @@ theorem support_esymm'' (n : ℕ) [DecidableEq σ] [Nontrivial R] :
all_goals intro x y; simp [Finsupp.support_single_disjoint]
#align mv_polynomial.support_esymm'' MvPolynomial.support_esymm''

theorem support_esymm' (n : ℕ) [DecidableEq σ] [Nontrivial R] :
(esymm σ R n).support =
(powersetCard n (univ : Finset σ)).biUnion fun t => {∑ i ∈ t, Finsupp.single i 1} := by
theorem support_esymm' [DecidableEq σ] [Nontrivial R] (n : ℕ) : (esymm σ R n).support =
(powersetCard n (univ : Finset σ)).biUnion fun t => {∑ i ∈ t, Finsupp.single i 1} := by
rw [support_esymm'']
congr
funext
exact Finsupp.support_single_ne_zero _ one_ne_zero
#align mv_polynomial.support_esymm' MvPolynomial.support_esymm'

theorem support_esymm (n : ℕ) [DecidableEq σ] [Nontrivial R] :
(esymm σ R n).support =
(powersetCard n (univ : Finset σ)).image fun t => ∑ i ∈ t, Finsupp.single i 1 := by
theorem support_esymm [DecidableEq σ] [Nontrivial R] (n : ℕ) : (esymm σ R n).support =
(powersetCard n (univ : Finset σ)).image fun t => ∑ i ∈ t, Finsupp.single i 1 := by
rw [support_esymm']
exact biUnion_singleton
#align mv_polynomial.support_esymm MvPolynomial.support_esymm

theorem degrees_esymm [Nontrivial R] (n : ℕ) (hpos : 0 < n) (hn : n ≤ Fintype.card σ) :
theorem degrees_esymm [Nontrivial R] {n : ℕ} (hpos : 0 < n) (hn : n ≤ Fintype.card σ) :
(esymm σ R n).degrees = (univ : Finset σ).val := by
classical
have :
Expand All @@ -298,25 +312,69 @@ theorem degrees_esymm [Nontrivial R] (n : ℕ) (hpos : 0 < n) (hn : n ≤ Fintyp

end ElementarySymmetric

section CompleteHomogeneousSymmetric

open Finset Multiset Sym

variable [DecidableEq σ] [DecidableEq τ]

/-- The `n`th complete homogeneous symmetric `MvPolynomial σ R`. -/
SashaIr marked this conversation as resolved.
Show resolved Hide resolved
def hsymm (n : ℕ) : MvPolynomial σ R := ∑ s : Sym σ n, (s.1.map X).prod

/-- `hsymmPart` is the product of the symmetric polynomials `hsymm μᵢ`,
where `μ = (μ₁, μ₂, ...)` is a partition. -/
def hsymmPart {n : ℕ} (μ : n.Partition) : MvPolynomial σ R := (μ.parts.map (hsymm σ R)).prod

@[simp]
theorem hsymm_zero : hsymm σ R 0 = 1 := by simp [hsymm, eq_nil_of_card_zero]

@[simp]
theorem hsymm_one : hsymm σ R 1 = ∑ i, X i := by
symm
apply Fintype.sum_equiv oneEquiv
simp only [oneEquiv_apply, Multiset.map_singleton, Multiset.prod_singleton, implies_true]

theorem hsymmPart_zero : hsymmPart σ R (.indiscrete 0) = 1 := by simp [hsymmPart]

@[simp]
theorem hsymmPart_onePart (n : ℕ) : hsymmPart σ R (.indiscrete n) = hsymm σ R n := by
cases n <;> simp [hsymmPart]

theorem map_hsymm (n : ℕ) (f : R →+* S) : map f (hsymm σ R n) = hsymm σ S n := by
SashaIr marked this conversation as resolved.
Show resolved Hide resolved
simp [hsymm, ← Multiset.prod_hom']

theorem rename_hsymm (n : ℕ) (e : σ ≃ τ) : rename e (hsymm σ R n) = hsymm τ R n := by
simp_rw [hsymm, map_sum, ← prod_hom', rename_X]
apply Fintype.sum_equiv (equivCongr e)
simp

theorem hsymm_isSymmetric (n : ℕ) : IsSymmetric (hsymm σ R n) := rename_hsymm _ _ n

end CompleteHomogeneousSymmetric

section PowerSum

open Finset

variable (σ R) [CommSemiring R] [Fintype σ] [Fintype τ]

/-- The degree-`n` power sum -/
def psum (n : ℕ) : MvPolynomial σ R := ∑ i, X i ^ n

lemma psum_def (n : ℕ) : psum σ R n = ∑ i, X i ^ n := rfl
/-- `psumPart` is the product of the symmetric polynomials `psum μᵢ`,
where `μ = (μ₁, μ₂, ...)` is a partition. -/
def psumPart {n : ℕ} (μ : n.Partition) : MvPolynomial σ R := (μ.parts.map (psum σ R)).prod

@[simp]
theorem psum_zero : psum σ R 0 = Fintype.card σ := by simp [psum]

@[simp]
theorem psum_one : psum σ R 1 = ∑ i, X i := by simp [psum]

@[simp]
theorem psum_zero : psum σ R 0 = Fintype.card σ := by
simp only [psum, _root_.pow_zero, ← cast_card]
exact rfl
theorem psumPart_zero : psumPart σ R (.indiscrete 0) = 1 := by simp [psumPart]

@[simp]
theorem psum_one : psum σ R 1 = ∑ i, X i := by
simp only [psum, _root_.pow_one]
theorem psumPart_indiscrete {n : ℕ} (npos : n ≠ 0) :
psumPart σ R (.indiscrete n) = psum σ R n := by simp [psumPart, npos]

@[simp]
theorem rename_psum (n : ℕ) (e : σ ≃ τ) : rename e (psum σ R n) = psum τ R n := by
Expand All @@ -326,4 +384,37 @@ theorem psum_isSymmetric (n : ℕ) : IsSymmetric (psum σ R n) := rename_psum _

end PowerSum

section MonomialSymmetric

variable [DecidableEq σ] [DecidableEq τ] {n : ℕ}

/-- The monomial symmetric `MvPolynomial σ R` with exponent set μ. -/
SashaIr marked this conversation as resolved.
Show resolved Hide resolved
def msymm (μ : n.Partition) : MvPolynomial σ R :=
∑ s : {a : Sym σ n // .ofSym a = μ}, (s.1.1.map X).prod

@[simp]
theorem msymm_zero : msymm σ R (.indiscrete 0) = 1 := by
rw [msymm, Fintype.sum_subsingleton _ ⟨(Sym.nil : Sym σ 0), by rfl⟩]
simp

@[simp]
theorem msymm_one : msymm σ R (.indiscrete 1) = ∑ i, X i := by
symm
apply Fintype.sum_equiv (Nat.Partition.ofSym_equiv_onePart σ)
simp

@[simp]
theorem rename_msymm (μ : n.Partition) (e : σ ≃ τ) :
rename e (msymm σ R μ) = msymm τ R μ := by
rw [msymm, map_sum]
apply Fintype.sum_equiv (Nat.Partition.ofSym_shape_equiv μ e)
intro
rw [← Multiset.prod_hom, Multiset.map_map, Nat.Partition.ofSym_shape_equiv]
simp

theorem msymm_isSymmetric (μ : n.Partition) : IsSymmetric (msymm σ R μ) :=
rename_msymm _ _ μ

end MonomialSymmetric

end MvPolynomial
Loading