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 51 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
20 changes: 20 additions & 0 deletions Mathlib/Combinatorics/Enumerative/Partition.lean
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Bhavik Mehta
-/
import Mathlib.Combinatorics.Enumerative.Composition
import Mathlib.Data.Multiset.Dedup
SashaIr marked this conversation as resolved.
Show resolved Hide resolved
import Mathlib.Data.Nat.Parity
import Mathlib.Tactic.ApplyFun

Expand Down Expand Up @@ -102,6 +103,25 @@ 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
have : sum (map (fun a ↦ count a s.1) s.1.dedup) =
Finset.sum (toFinset s.1) fun a ↦ count a s.1 := rfl
YaelDillies marked this conversation as resolved.
Show resolved Hide resolved
rw [this, Multiset.toFinset_sum_count_eq]
exact s.2

lemma ofSym_map {n : ℕ} {σ τ : Type*} [DecidableEq σ] [DecidableEq τ] (e : σ ≃ τ) (s : Sym σ n) :
Nat.Partition.ofSym (s.map e) = Nat.Partition.ofSym s := by
SashaIr marked this conversation as resolved.
Show resolved Hide resolved
simp only [ofSym, Sym.val_eq_coe, Sym.coe_map, toFinset_val, mk.injEq]
rw [Multiset.dedup_map_of_injective]
simp only [map_map, Function.comp_apply]
congr; funext i
rw [← Multiset.count_map_eq_count' e]
all_goals exact e.injective
SashaIr marked this conversation as resolved.
Show resolved Hide resolved

/-- The partition of exactly one part. -/
def indiscrete (n : ℕ) : Partition n := ofSums n {n} rfl
#align nat.partition.indiscrete_partition Nat.Partition.indiscrete
Expand Down
7 changes: 7 additions & 0 deletions Mathlib/Data/Multiset/Dedup.lean
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ theorem dedup_map_dedup_eq [DecidableEq β] (f : α → β) (s : Multiset α) :
simp [dedup_ext]
#align multiset.dedup_map_dedup_eq Multiset.dedup_map_dedup_eq

theorem dedup_map_of_injective [DecidableEq β] {f : α → β} (hinj : Function.Injective f)
SashaIr marked this conversation as resolved.
Show resolved Hide resolved
(s : Multiset α) : dedup (map f s) = map f (dedup s) := by
rw [← dedup_map_dedup_eq]
apply Multiset.dedup_eq_self.mpr
SashaIr marked this conversation as resolved.
Show resolved Hide resolved
rw [Multiset.nodup_map_iff_of_injective hinj]
SashaIr marked this conversation as resolved.
Show resolved Hide resolved
exact Multiset.nodup_dedup s
SashaIr marked this conversation as resolved.
Show resolved Hide resolved

@[simp]
theorem dedup_nsmul {s : Multiset α} {n : ℕ} (h0 : n ≠ 0) : (n • s).dedup = s.dedup := by
ext a
Expand Down
15 changes: 15 additions & 0 deletions Mathlib/Data/Sym/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,21 @@ 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`.
-/
SashaIr marked this conversation as resolved.
Show resolved Hide resolved
@[simps apply]
def oneEquiv : α ≃ Sym α 1 where
toFun a := ⟨{a}, by simp⟩
invFun s := Quotient.liftOn (Equiv.subtypeQuotientEquivQuotientSubtype
(·.length = 1) _ (fun l ↦ Iff.rfl) (fun l l' ↦ by rfl) s)
SashaIr marked this conversation as resolved.
Show resolved Hide resolved
(fun l ↦ l.1.head <| List.length_pos.mp <| by simp)
fun ⟨l, h⟩ ⟨l', h'⟩ _perm ↦ by
obtain ⟨a, rfl⟩ := List.length_eq_one.mp h'
SashaIr marked this conversation as resolved.
Show resolved Hide resolved
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
203 changes: 196 additions & 7 deletions Mathlib/RingTheory/MvPolynomial/Symmetric.lean
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ Copyright (c) 2020 Hanting Zhang. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Hanting Zhang, Johan Commelin
-/

SashaIr marked this conversation as resolved.
Show resolved Hide resolved
import Mathlib.Algebra.Algebra.Subalgebra.Basic
import Mathlib.Algebra.MvPolynomial.Rename
import Mathlib.Algebra.MvPolynomial.CommRing
import Mathlib.Algebra.MvPolynomial.Rename
import Mathlib.Combinatorics.Enumerative.Partition
import Mathlib.Data.Sym.Basic
SashaIr marked this conversation as resolved.
Show resolved Hide resolved

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

Expand All @@ -23,15 +26,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 @@ -176,17 +188,47 @@ 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 τ]

/-! ### Multiplicativity on partitions -/

/-- Given a sequence of `MvPolynomial` functions `f` and a partition `μ` of size `n`,
`muProduct` computes the product of applying each function in `f` to the parts of `μ`. -/
def muProduct {n : ℕ} (f : ℕ → MvPolynomial σ R) (μ : n.Partition) : MvPolynomial σ R :=
SashaIr marked this conversation as resolved.
Show resolved Hide resolved
SashaIr marked this conversation as resolved.
Show resolved Hide resolved
Multiset.prod (μ.parts.map f)
SashaIr marked this conversation as resolved.
Show resolved Hide resolved

lemma muProduct_def {n : ℕ} (f : ℕ → MvPolynomial σ R) (μ : n.Partition) :
muProduct σ R f μ = Multiset.prod (μ.parts.map f) := rfl
SashaIr marked this conversation as resolved.
Show resolved Hide resolved

@[simp]
theorem muProduct_indiscrete_zero (f : ℕ → MvPolynomial σ R) :
muProduct σ R f (Nat.Partition.indiscrete 0) = 1 := by
simp only [muProduct, Nat.Partition.partition_zero_parts, Multiset.map_zero, Multiset.prod_zero]

@[simp]
theorem muProduct_indiscrete_of_pos (n : ℕ) (f : ℕ → MvPolynomial σ R) (npos : n > 0) :
muProduct σ R f (Nat.Partition.indiscrete n) = f n := by
rw [muProduct, Nat.Partition.indiscrete_parts, Multiset.map_singleton, Multiset.prod_singleton]
linarith

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 in powersetCard n univ, ∏ i in t, X i
#align mv_polynomial.esymm MvPolynomial.esymm

lemma esymm_def (n : ℕ) : esymm σ R n = ∑ t in powersetCard n univ, ∏ i in t, X i := rfl

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

/-- 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
Expand Down Expand Up @@ -216,6 +258,19 @@ theorem esymm_zero : esymm σ R 0 = 1 := by
simp only [esymm, powersetCard_zero, sum_singleton, prod_empty]
#align mv_polynomial.esymm_zero MvPolynomial.esymm_zero

@[simp]
theorem esymm_one : esymm σ R 1 = ∑ i, X i := by
simp only [esymm, powersetCard_one, sum_map, Function.Embedding.coeFn_mk, prod_singleton]

theorem esymmMu_zero : esymmMu σ R (Nat.Partition.indiscrete 0) = 1 := by
simp only [esymmMu, esymm_zero, muProduct_indiscrete_zero]

@[simp]
theorem esymmMu_onePart (n : ℕ) : esymmMu σ R (Nat.Partition.indiscrete n) = esymm σ R n := by
cases n
· simp only [esymmMu, esymm_zero, muProduct_indiscrete_zero]
· simp only [esymmMu, gt_iff_lt, Nat.zero_lt_succ, muProduct_indiscrete_of_pos]
SashaIr marked this conversation as resolved.
Show resolved Hide resolved

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 Down Expand Up @@ -300,26 +355,100 @@ 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

lemma hsymm_def (n : ℕ) : hsymm σ R n = ∑ s : Sym σ n, (s.1.map X).prod := rfl

/--
`hsymmMu` is the product of the symmetric polynomials `hsymm μᵢ`,
where `μ = (μ₁, μ₂, ...)` is a partition.
-/
SashaIr marked this conversation as resolved.
Show resolved Hide resolved
def hsymmMu {n : ℕ} (μ : n.Partition) : MvPolynomial σ R :=
muProduct σ R (hsymm σ R) μ

lemma hsymmMu_def {n : ℕ} (μ : n.Partition) : hsymmMu σ R μ =
Multiset.prod (μ.parts.map (hsymm σ R)) := rfl
SashaIr marked this conversation as resolved.
Show resolved Hide resolved

@[simp]
theorem hsymm_zero : hsymm σ R 0 = 1 := by
simp only [hsymm, univ_unique, eq_nil_of_card_zero, val_eq_coe, Sym.coe_nil, Multiset.map_zero,
prod_zero, sum_const, Finset.card_singleton, one_smul]

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

theorem hsymmMu_zero : hsymmMu σ R (Nat.Partition.indiscrete 0) = 1 := by
SashaIr marked this conversation as resolved.
Show resolved Hide resolved
simp only [hsymmMu, hsymm_zero, muProduct_indiscrete_zero]

@[simp]
theorem hsymmMu_onePart (n : ℕ) : hsymmMu σ R (Nat.Partition.indiscrete n) = hsymm σ R n := by
cases n
· simp only [hsymmMu, hsymm_zero, muProduct_indiscrete_zero]
· simp only [hsymmMu, gt_iff_lt, Nat.zero_lt_succ, muProduct_indiscrete_of_pos]

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_rw [hsymm, map_sum, ← Multiset.prod_hom']
simp only [val_eq_coe, map_X]
SashaIr marked this conversation as resolved.
Show resolved Hide resolved

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 only [val_eq_coe, equivCongr_apply, Sym.coe_map, Multiset.map_map, Function.comp_apply,
SashaIr marked this conversation as resolved.
Show resolved Hide resolved
implies_true]

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

/--
`psumMu` is the product of the symmetric polynomials `psum μᵢ`,
where `μ = (μ₁, μ₂, ...)` is a partition.
-/
SashaIr marked this conversation as resolved.
Show resolved Hide resolved
def psumMu {n : ℕ} (μ : n.Partition) : MvPolynomial σ R :=
muProduct σ R (psum σ R) μ

lemma psumMu_def {n : ℕ} (μ : n.Partition) : psumMu σ R μ =
Multiset.prod (μ.parts.map (psum σ R)) := rfl
SashaIr marked this conversation as resolved.
Show resolved Hide resolved

@[simp]
theorem psum_zero : psum σ R 0 = Fintype.card σ := by
simp only [psum, _root_.pow_zero, ← cast_card]
exact rfl
simp [psum, _root_.pow_zero, ← cast_card]
rfl
SashaIr marked this conversation as resolved.
Show resolved Hide resolved

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

@[simp]
theorem psumMu_zero : psumMu σ R (Nat.Partition.indiscrete 0) = 1 := by
simp only [psumMu, muProduct_indiscrete_zero]
SashaIr marked this conversation as resolved.
Show resolved Hide resolved

@[simp]
theorem psumMu_onePart (n : ℕ) (npos : n > 0) :
SashaIr marked this conversation as resolved.
Show resolved Hide resolved
psumMu σ R (Nat.Partition.indiscrete n) = psum σ R n := by
simp only [psumMu, npos, muProduct_indiscrete_of_pos]
SashaIr marked this conversation as resolved.
Show resolved Hide resolved

@[simp]
theorem rename_psum (n : ℕ) (e : σ ≃ τ) : rename e (psum σ R n) = psum τ R n := by
simp_rw [psum, map_sum, map_pow, rename_X, e.sum_comp (X · ^ n)]
Expand All @@ -328,4 +457,64 @@ theorem psum_isSymmetric (n : ℕ) : IsSymmetric (psum σ R n) := rename_psum _

end PowerSum

section MonomialSymmetric
-- open Multiset
SashaIr marked this conversation as resolved.
Show resolved Hide resolved

variable [DecidableEq σ] [DecidableEq τ]

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

lemma msymm_def {n : ℕ} (μ : n.Partition) : msymm σ R μ =
∑ s : {a : Sym σ n // Nat.Partition.ofSym a = μ}, (s.1.1.map X).prod := rfl

@[simp]
theorem msymm_zero : msymm σ R (Nat.Partition.indiscrete 0) = 1 := by
rw [msymm, Fintype.sum_subsingleton]
swap
SashaIr marked this conversation as resolved.
Show resolved Hide resolved
exact ⟨(Sym.nil : Sym σ 0), by rfl⟩
simp only [Sym.val_eq_coe, Sym.coe_nil, Multiset.map_zero, Multiset.prod_zero]

@[simp]
theorem msymm_one : msymm σ R (Nat.Partition.indiscrete 1) = ∑ i, X i := by
symm
let f : σ ≃ { a // Nat.Partition.ofSym a = Nat.Partition.indiscrete 1 } := {
SashaIr marked this conversation as resolved.
Show resolved Hide resolved
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]
}
apply Fintype.sum_equiv f
intro i
have : (X i : MvPolynomial σ R) = Multiset.prod (Multiset.map X {i}) := by
simp only [Multiset.map_singleton, Multiset.prod_singleton]
rw [this]
rfl
riccardobrasca marked this conversation as resolved.
Show resolved Hide resolved

@[simp]
theorem rename_msymm {n : ℕ} (μ : n.Partition) (e : σ ≃ τ) :
rename e (msymm σ R μ) = msymm τ R μ := by
simp only [msymm._eq_1, Sym.val_eq_coe, map_sum]
let f : {a : Sym σ n // Nat.Partition.ofSym a = μ} ≃ {a : Sym τ n // Nat.Partition.ofSym a = μ} :=
SashaIr marked this conversation as resolved.
Show resolved Hide resolved
{
toFun := fun a => ⟨Sym.equivCongr e a, by
simp only [Sym.equivCongr_apply, Nat.Partition.ofSym_map, a.2]⟩
invFun := fun a => ⟨Sym.equivCongr e.symm a, by
simp only [Sym.equivCongr_apply, Nat.Partition.ofSym_map, a.2]⟩
left_inv := by intro a; simp
right_inv := by intro a; simp
}
apply Fintype.sum_equiv f
intro a
SashaIr marked this conversation as resolved.
Show resolved Hide resolved
rw [← Multiset.prod_hom, Multiset.map_map]
congr
simp only [Sym.equivCongr_apply, Equiv.coe_fn_mk, Sym.coe_map, Multiset.map_map,
Function.comp_apply, rename_X, f]

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

end MonomialSymmetric

end MvPolynomial
Loading