|
| 1 | +/- |
| 2 | +Copyright (c) 2020 Johan Commelin. All rights reserved. |
| 3 | +Released under Apache 2.0 license as described in the file LICENSE. |
| 4 | +Authors: Johan Commelin, Robert Y. Lewis |
| 5 | +
|
| 6 | +! This file was ported from Lean 3 source module data.mv_polynomial.expand |
| 7 | +! leanprover-community/mathlib commit 5da451b4c96b4c2e122c0325a7fce17d62ee46c6 |
| 8 | +! Please do not edit these lines, except to modify the commit id |
| 9 | +! if you have ported upstream changes. |
| 10 | +-/ |
| 11 | +import Mathlib.Data.MvPolynomial.Monad |
| 12 | + |
| 13 | +/-! |
| 14 | +## Expand multivariate polynomials |
| 15 | +
|
| 16 | +Given a multivariate polynomial `φ`, one may replace every occurence of `X i` by `X i ^ n`, |
| 17 | +for some natural number `n`. |
| 18 | +This operation is called `MvPolynomial.expand` and it is an algebra homomorphism. |
| 19 | +
|
| 20 | +### Main declaration |
| 21 | +
|
| 22 | +* `MvPolynomial.expand`: expand a polynomial by a factor of p, so `∑ aₙ xⁿ` becomes `∑ aₙ xⁿᵖ`. |
| 23 | +-/ |
| 24 | + |
| 25 | + |
| 26 | +open BigOperators |
| 27 | + |
| 28 | +namespace MvPolynomial |
| 29 | + |
| 30 | +variable {σ τ R S : Type _} [CommSemiring R] [CommSemiring S] |
| 31 | + |
| 32 | +/-- Expand the polynomial by a factor of p, so `∑ aₙ xⁿ` becomes `∑ aₙ xⁿᵖ`. |
| 33 | +
|
| 34 | +See also `Polynomial.expand`. -/ |
| 35 | +noncomputable def expand (p : ℕ) : MvPolynomial σ R →ₐ[R] MvPolynomial σ R := |
| 36 | + { (eval₂Hom C fun i ↦ X i ^ p : MvPolynomial σ R →+* MvPolynomial σ R) with |
| 37 | + commutes' := fun _ ↦ eval₂Hom_C _ _ _ } |
| 38 | +#align mv_polynomial.expand MvPolynomial.expand |
| 39 | + |
| 40 | +-- @[simp] -- Porting note: simp can prove this |
| 41 | +theorem expand_C (p : ℕ) (r : R) : expand p (C r : MvPolynomial σ R) = C r := |
| 42 | + eval₂Hom_C _ _ _ |
| 43 | +set_option linter.uppercaseLean3 false in |
| 44 | +#align mv_polynomial.expand_C MvPolynomial.expand_C |
| 45 | + |
| 46 | +@[simp] |
| 47 | +theorem expand_X (p : ℕ) (i : σ) : expand p (X i : MvPolynomial σ R) = X i ^ p := |
| 48 | + eval₂Hom_X' _ _ _ |
| 49 | +set_option linter.uppercaseLean3 false in |
| 50 | +#align mv_polynomial.expand_X MvPolynomial.expand_X |
| 51 | + |
| 52 | +@[simp] |
| 53 | +theorem expand_monomial (p : ℕ) (d : σ →₀ ℕ) (r : R) : |
| 54 | + expand p (monomial d r) = C r * ∏ i in d.support, (X i ^ p) ^ d i := |
| 55 | + bind₁_monomial _ _ _ |
| 56 | +#align mv_polynomial.expand_monomial MvPolynomial.expand_monomial |
| 57 | + |
| 58 | +theorem expand_one_apply (f : MvPolynomial σ R) : expand 1 f = f := by |
| 59 | + simp only [expand, pow_one, eval₂Hom_eq_bind₂, bind₂_C_left, RingHom.toMonoidHom_eq_coe, |
| 60 | + RingHom.coe_monoidHom_id, AlgHom.coe_mk, RingHom.coe_mk, MonoidHom.id_apply] |
| 61 | +#align mv_polynomial.expand_one_apply MvPolynomial.expand_one_apply |
| 62 | + |
| 63 | +@[simp] |
| 64 | +theorem expand_one : expand 1 = AlgHom.id R (MvPolynomial σ R) := by |
| 65 | + ext1 f |
| 66 | + rw [expand_one_apply, AlgHom.id_apply] |
| 67 | +#align mv_polynomial.expand_one MvPolynomial.expand_one |
| 68 | + |
| 69 | +theorem expand_comp_bind₁ (p : ℕ) (f : σ → MvPolynomial τ R) : |
| 70 | + (expand p).comp (bind₁ f) = bind₁ fun i ↦ expand p (f i) := by |
| 71 | + apply algHom_ext |
| 72 | + intro i |
| 73 | + simp only [AlgHom.comp_apply, bind₁_X_right] |
| 74 | +#align mv_polynomial.expand_comp_bind₁ MvPolynomial.expand_comp_bind₁ |
| 75 | + |
| 76 | +theorem expand_bind₁ (p : ℕ) (f : σ → MvPolynomial τ R) (φ : MvPolynomial σ R) : |
| 77 | + expand p (bind₁ f φ) = bind₁ (fun i ↦ expand p (f i)) φ := by |
| 78 | + rw [← AlgHom.comp_apply, expand_comp_bind₁] |
| 79 | +#align mv_polynomial.expand_bind₁ MvPolynomial.expand_bind₁ |
| 80 | + |
| 81 | +@[simp] |
| 82 | +theorem map_expand (f : R →+* S) (p : ℕ) (φ : MvPolynomial σ R) : |
| 83 | + map f (expand p φ) = expand p (map f φ) := by simp [expand, map_bind₁] |
| 84 | +#align mv_polynomial.map_expand MvPolynomial.map_expand |
| 85 | + |
| 86 | +@[simp] |
| 87 | +theorem rename_expand (f : σ → τ) (p : ℕ) (φ : MvPolynomial σ R) : |
| 88 | + rename f (expand p φ) = expand p (rename f φ) := by |
| 89 | + simp [expand, bind₁_rename, rename_bind₁, Function.comp] |
| 90 | +#align mv_polynomial.rename_expand MvPolynomial.rename_expand |
| 91 | + |
| 92 | +@[simp] |
| 93 | +theorem rename_comp_expand (f : σ → τ) (p : ℕ) : |
| 94 | + (rename f).comp (expand p) = |
| 95 | + (expand p).comp (rename f : MvPolynomial σ R →ₐ[R] MvPolynomial τ R) := by |
| 96 | + ext1 φ |
| 97 | + simp only [rename_expand, AlgHom.comp_apply] |
| 98 | +#align mv_polynomial.rename_comp_expand MvPolynomial.rename_comp_expand |
| 99 | + |
| 100 | +end MvPolynomial |
0 commit comments