/- Copyright 2026 The Formal Conjectures Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -/ module public import Mathlib.Algebra.MvPolynomial.CommRing public import Mathlib.Algebra.MvPolynomial.PDerivpublic section

The canonical Poisson bracket on a polynomial algebra in $2n$ variables

For a commutative ring R and a finite type σ, we equip MvPolynomial (σ ⊕ σ) R with its canonical Poisson bracket $${f, g} = \sum_{i} \left(\frac{\partial f}{\partial x_i}\frac{\partial g}{\partial y_i}

    \frac{\partial f}{\partial y_i}\frac{\partial g}{\partial x_i}\right),$$ where $x_i$ (resp. $y_i$) denotes the variable indexed by Sum.inl i (resp. Sum.inr i). This is the polynomial algebra underlying the n-th canonical Poisson algebra $P_n(R)$ when σ = Fin n.

Classical sources index the same object by $2n$ variables $X_1, \dots, X_{2n}$ with bracket ${f, g} = \sum_{i=1}^n (\partial f/\partial X_i \cdot \partial g/\partial X_{i+n}

    \partial f/\partial X_{i+n} \cdot \partial g/\partial X_i)$; here Sum.inl i plays the role of $X_i$ and Sum.inr i the role of $X_{i+n}$ (see e.g. AvdE07, Notations 1).

namespace MvPolynomialvariable {R σ : Type*} [CommRing R] [Fintype σ]

The canonical Poisson bracket on MvPolynomial (σ ⊕ σ) R, given by ${f, g} = \sum_{i} (\partial_{x_i} f \cdot \partial_{y_i} g

    \partial_{y_i} f \cdot \partial_{x_i} g)$ where $x_i$ (resp. $y_i$) is the variable indexed by Sum.inl i (resp. Sum.inr i).

noncomputable def poissonBracket (f g : MvPolynomial (σ σ) R) : MvPolynomial (σ σ) R := i : σ, (pderiv (Sum.inl i) f * pderiv (Sum.inr i) g - pderiv (Sum.inr i) f * pderiv (Sum.inl i) g)All goals completed! 🐙R:Type u_1σ:Type u_2inst✝¹:CommRing Rinst✝:Fintype σf:MvPolynomial (σ σ) Rg:MvPolynomial (σ σ) R i, ((pderiv (Sum.inl i)) f * (pderiv (Sum.inr i)) g - (pderiv (Sum.inr i)) f * (pderiv (Sum.inl i)) g) = x, -((pderiv (Sum.inl x)) g * (pderiv (Sum.inr x)) f - (pderiv (Sum.inr x)) g * (pderiv (Sum.inl x)) f) exact Finset.sum_congr rfl fun i _ => R:Type u_1σ:Type u_2inst✝¹:CommRing Rinst✝:Fintype σf:MvPolynomial (σ σ) Rg:MvPolynomial (σ σ) Ri:σx✝:i Finset.univ(pderiv (Sum.inl i)) f * (pderiv (Sum.inr i)) g - (pderiv (Sum.inr i)) f * (pderiv (Sum.inl i)) g = -((pderiv (Sum.inl i)) g * (pderiv (Sum.inr i)) f - (pderiv (Sum.inr i)) g * (pderiv (Sum.inl i)) f) All goals completed! 🐙All goals completed! 🐙All goals completed! 🐙R:Type u_1σ:Type u_2inst✝²:CommRing Rinst✝¹:Fintype σinst✝:DecidableEq σi:σj:σk:σa✝:k Finset.univhk:k i0 * (pderiv (Sum.inr k)) (X (Sum.inr j)) - 0 * (pderiv (Sum.inl k)) (X (Sum.inr j)) = 0 All goals completed! 🐙 R:Type u_1σ:Type u_2inst✝²:CommRing Rinst✝¹:Fintype σinst✝:DecidableEq σi:σj:σi Finset.univ (pderiv (Sum.inl i)) (X (Sum.inl i)) * (pderiv (Sum.inr i)) (X (Sum.inr j)) - (pderiv (Sum.inr i)) (X (Sum.inl i)) * (pderiv (Sum.inl i)) (X (Sum.inr j)) = 0 All goals completed! 🐙R:Type u_1σ:Type u_2inst✝²:CommRing Rinst✝¹:Fintype σinst✝:DecidableEq σi:σj:σ(-if j = i then 1 else 0) = if i = j then -1 else 0 R:Type u_1σ:Type u_2inst✝²:CommRing Rinst✝¹:Fintype σinst✝:DecidableEq σi:σj:σh₁:j = ih₂:i = j-1 = -1R:Type u_1σ:Type u_2inst✝²:CommRing Rinst✝¹:Fintype σinst✝:DecidableEq σi:σj:σh₁:j = ih₂:¬i = j-1 = 0R:Type u_1σ:Type u_2inst✝²:CommRing Rinst✝¹:Fintype σinst✝:DecidableEq σi:σj:σh₁:¬j = ih₂:i = j-0 = -1R:Type u_1σ:Type u_2inst✝²:CommRing Rinst✝¹:Fintype σinst✝:DecidableEq σi:σj:σh₁:¬j = ih₂:¬i = j-0 = 0 R:Type u_1σ:Type u_2inst✝²:CommRing Rinst✝¹:Fintype σinst✝:DecidableEq σi:σj:σh₁:j = ih₂:i = j-1 = -1R:Type u_1σ:Type u_2inst✝²:CommRing Rinst✝¹:Fintype σinst✝:DecidableEq σi:σj:σh₁:j = ih₂:¬i = j-1 = 0R:Type u_1σ:Type u_2inst✝²:CommRing Rinst✝¹:Fintype σinst✝:DecidableEq σi:σj:σh₁:¬j = ih₂:i = j-0 = -1R:Type u_1σ:Type u_2inst✝²:CommRing Rinst✝¹:Fintype σinst✝:DecidableEq σi:σj:σh₁:¬j = ih₂:¬i = j-0 = 0 All goals completed! 🐙end MvPolynomial