File: Mathlib/Algebra/Polynomial/Module/Basic.lean

full_name: PolynomialModule
code: /-- The `R[X]`-module `M[X]` for an `R`-module `M`.
This is isomorphic (as an `R`-module) to `M[X]` when `M` is a ring.

We require all the module instances `Module S (PolynomialModule R M)` to factor through `R` except
`Module R[X] (PolynomialModule R M)`.
In this constraint, we have the following instances for example :
- `R` acts on `PolynomialModule R R[X]`
- `R[X]` acts on `PolynomialModule R R[X]` as `R[Y]` acting on `R[X][Y]`
- `R` acts on `PolynomialModule R[X] R[X]`
- `R[X]` acts on `PolynomialModule R[X] R[X]` as `R[X]` acting on `R[X][Y]`
- `R[X][X]` acts on `PolynomialModule R[X] R[X]` as `R[X][Y]` acting on itself

This is also the reason why `R` is included in the alias, or else there will be two different
instances of `Module R[X] (PolynomialModule R[X])`.

See https://leanprover.zulipchat.com/#narrow/stream/144837-PR-reviews/topic/.2315065.20polynomial.20modules
for the full discussion.
-/
@[nolint unusedArguments]
def PolynomialModule (R M : Type*) [CommRing R] [AddCommGroup M] [Module R M] 
goal: Type u_2

full_name: instInhabitedPolynomialModule
code: noncomputable instance : Inhabited (PolynomialModule R M) 
goal: Inhabited (PolynomialModule R M)

full_name: instAddCommGroupPolynomialModule
code: noncomputable instance : AddCommGroup (PolynomialModule R M) 
goal: AddCommGroup (PolynomialModule R M)

full_name: PolynomialModule.instModule
code: /-- This is required to have the `IsScalarTower S R M` instance to avoid diamonds. -/
@[nolint unusedArguments]
noncomputable instance : Module S (PolynomialModule R M) 
goal: Module S (PolynomialModule R M)

full_name: PolynomialModule.instFunLike
code: instance instFunLike : FunLike (PolynomialModule R M) ℕ M 
goal: FunLike (PolynomialModule R M) ℕ M

full_name: PolynomialModule.instCoeFunForallNat
code: instance : CoeFun (PolynomialModule R M) fun _ => ℕ → M 
goal: CoeFun (PolynomialModule R M) fun x => ℕ → M

full_name: PolynomialModule.zero_apply
code: theorem zero_apply (i : ℕ) : (0 : PolynomialModule R M) i = 0 
goal: 0 i = 0

full_name: PolynomialModule.add_apply
code: theorem add_apply (g₁ g₂ : PolynomialModule R M) (a : ℕ) : (g₁ + g₂) a = g₁ a + g₂ a 
goal: (g₁ + g₂) a = g₁ a + g₂ a

full_name: PolynomialModule.single
code: /-- The monomial `m * x ^ i`. This is defeq to `Finsupp.singleAddHom`, and is redefined here
so that it has the desired type signature.  -/
noncomputable def single (i : ℕ) : M →+ PolynomialModule R M 
goal: M →+ PolynomialModule R M

full_name: PolynomialModule.single_apply
code: theorem single_apply (i : ℕ) (m : M) (n : ℕ) : single R i m n = ite (i = n) m 0 
goal: ((PolynomialModule.single R i) m) n = if i = n then m else 0

full_name: PolynomialModule.lsingle
code: /-- `PolynomialModule.single` as a linear map. -/
noncomputable def lsingle (i : ℕ) : M →ₗ[R] PolynomialModule R M 
goal: M →ₗ[R] PolynomialModule R M

full_name: PolynomialModule.lsingle_apply
code: theorem lsingle_apply (i : ℕ) (m : M) (n : ℕ) : lsingle R i m n = ite (i = n) m 0 
goal: ((PolynomialModule.lsingle R i) m) n = if i = n then m else 0

full_name: PolynomialModule.single_smul
code: theorem single_smul (i : ℕ) (r : R) (m : M) : single R i (r • m) = r • single R i m 
goal: (PolynomialModule.single R i) (r • m) = r • (PolynomialModule.single R i) m

full_name: PolynomialModule.induction_linear
code: theorem induction_linear {P : PolynomialModule R M → Prop} (f : PolynomialModule R M) (h0 : P 0)
    (hadd : ∀ f g, P f → P g → P (f + g)) (hsingle : ∀ a b, P (single R a b)) : P f 
goal: P f

full_name: PolynomialModule.polynomialModule
code: noncomputable instance polynomialModule : Module R[X] (PolynomialModule R M) 
goal: Module R[X] (PolynomialModule R M)

full_name: PolynomialModule.smul_def
code: lemma smul_def (f : R[X]) (m : PolynomialModule R M) :
    f • m = aeval (Finsupp.lmapDomain M R Nat.succ) f m 
goal: f • m = ((Polynomial.aeval (Finsupp.lmapDomain M R Nat.succ)) f) m

full_name: PolynomialModule.instIsScalarTower
code: instance (M : Type u) [AddCommGroup M] [Module R M] [Module S M] [IsScalarTower S R M] :
    IsScalarTower S R (PolynomialModule R M) 
goal: IsScalarTower S R (PolynomialModule R M)

full_name: PolynomialModule.isScalarTower'
code: instance isScalarTower' (M : Type u) [AddCommGroup M] [Module R M] [Module S M]
    [IsScalarTower S R M] : IsScalarTower S R[X] (PolynomialModule R M) 
goal: IsScalarTower S R[X] (PolynomialModule R M)

full_name: PolynomialModule.monomial_smul_single
code: @[simp]
theorem monomial_smul_single (i : ℕ) (r : R) (j : ℕ) (m : M) :
    monomial i r • single R j m = single R (i + j) (r • m) 
goal: (Polynomial.monomial i) r • (PolynomialModule.single R j) m = (PolynomialModule.single R (i + j)) (r • m)

full_name: PolynomialModule.monomial_smul_apply
code: @[simp]
theorem monomial_smul_apply (i : ℕ) (r : R) (g : PolynomialModule R M) (n : ℕ) :
    (monomial i r • g) n = ite (i ≤ n) (r • g (n - i)) 0 
goal: ((Polynomial.monomial i) r • g) n = if i ≤ n then r • g (n - i) else 0

full_name: PolynomialModule.smul_single_apply
code: @[simp]
theorem smul_single_apply (i : ℕ) (f : R[X]) (m : M) (n : ℕ) :
    (f • single R i m) n = ite (i ≤ n) (f.coeff (n - i) • m) 0 
goal: (f • (PolynomialModule.single R i) m) n = if i ≤ n then f.coeff (n - i) • m else 0

full_name: PolynomialModule.smul_apply
code: theorem smul_apply (f : R[X]) (g : PolynomialModule R M) (n : ℕ) :
    (f • g) n = ∑ x ∈ Finset.antidiagonal n, f.coeff x.1 • g x.2 
goal: (f • g) n = ∑ x ∈ Finset.antidiagonal n, f.coeff x.1 • g x.2

full_name: PolynomialModule.equivPolynomialSelf
code: /-- `PolynomialModule R R` is isomorphic to `R[X]` as an `R[X]` module. -/
noncomputable def equivPolynomialSelf : PolynomialModule R R ≃ₗ[R[X]] R[X] 
goal: PolynomialModule R R ≃ₗ[R[X]] R[X]

full_name: PolynomialModule.equivPolynomial
code: /-- `PolynomialModule R S` is isomorphic to `S[X]` as an `R` module. -/
noncomputable def equivPolynomial {S : Type*} [CommRing S] [Algebra R S] :
    PolynomialModule R S ≃ₗ[R] S[X] 
goal: PolynomialModule R S ≃ₗ[R] S[X]

full_name: PolynomialModule.equivPolynomialSelf_apply_eq
code: @[simp]
lemma equivPolynomialSelf_apply_eq (p : PolynomialModule R R) :
    equivPolynomialSelf p = equivPolynomial p 
goal: PolynomialModule.equivPolynomialSelf p = PolynomialModule.equivPolynomial p

full_name: PolynomialModule.equivPolynomial_single
code: @[simp]
lemma equivPolynomial_single {S : Type*} [CommRing S] [Algebra R S] (n : ℕ) (x : S) :
    equivPolynomial (single R n x) = monomial n x 
goal: PolynomialModule.equivPolynomial ((PolynomialModule.single R n) x) = (Polynomial.monomial n) x

full_name: PolynomialModule.map
code: /-- The image of a polynomial under a linear map. -/
noncomputable def map (f : M →ₗ[R] M') : PolynomialModule R M →ₗ[R] PolynomialModule R' M' 
goal: PolynomialModule R M →ₗ[R] PolynomialModule R' M'

full_name: PolynomialModule.map_single
code: @[simp]
theorem map_single (f : M →ₗ[R] M') (i : ℕ) (m : M) : map R' f (single R i m) = single R' i (f m) 
goal: (PolynomialModule.map R' f) ((PolynomialModule.single R i) m) = (PolynomialModule.single R' i) (f m)

full_name: PolynomialModule.map_smul
code: theorem map_smul (f : M →ₗ[R] M') (p : R[X]) (q : PolynomialModule R M) :
    map R' f (p • q) = p.map (algebraMap R R') • map R' f q 
goal: (PolynomialModule.map R' f) (p • q) = Polynomial.map (algebraMap R R') p • (PolynomialModule.map R' f) q

full_name: PolynomialModule.eval
code: /-- Evaluate a polynomial `p : PolynomialModule R M` at `r : R`. -/
@[simps! (config := .lemmasOnly)]
def eval (r : R) : PolynomialModule R M →ₗ[R] M 
goal: PolynomialModule R M →ₗ[R] M

full_name: PolynomialModule.eval_apply
code: /-- Evaluate a polynomial `p : PolynomialModule R M` at `r : R`. -/
@[simps! (config := .lemmasOnly)]
def eval (r : R) : PolynomialModule R M →ₗ[R] M 
goal: (PolynomialModule.eval r) p = Finsupp.sum p fun i m => r ^ i • m

full_name: PolynomialModule.eval_single
code: @[simp]
theorem eval_single (r : R) (i : ℕ) (m : M) : eval r (single R i m) = r ^ i • m 
goal: (PolynomialModule.eval r) ((PolynomialModule.single R i) m) = r ^ i • m

full_name: PolynomialModule.eval_lsingle
code: @[simp]
theorem eval_lsingle (r : R) (i : ℕ) (m : M) : eval r (lsingle R i m) = r ^ i • m 
goal: (PolynomialModule.eval r) ((PolynomialModule.lsingle R i) m) = r ^ i • m

full_name: PolynomialModule.eval_smul
code: theorem eval_smul (p : R[X]) (q : PolynomialModule R M) (r : R) :
    eval r (p • q) = p.eval r • eval r q 
goal: (PolynomialModule.eval r) (p • q) = Polynomial.eval r p • (PolynomialModule.eval r) q

full_name: PolynomialModule.eval_map
code: @[simp]
theorem eval_map (f : M →ₗ[R] M') (q : PolynomialModule R M) (r : R) :
    eval (algebraMap R R' r) (map R' f q) = f (eval r q) 
goal: (PolynomialModule.eval ((algebraMap R R') r)) ((PolynomialModule.map R' f) q) = f ((PolynomialModule.eval r) q)

full_name: PolynomialModule.eval_map'
code: @[simp]
theorem eval_map' (f : M →ₗ[R] M) (q : PolynomialModule R M) (r : R) :
    eval r (map R f q) = f (eval r q) 
goal: (PolynomialModule.eval r) ((PolynomialModule.map R f) q) = f ((PolynomialModule.eval r) q)

full_name: PolynomialModule.aeval_equivPolynomial
code: @[simp]
lemma aeval_equivPolynomial {S : Type*} [CommRing S] [Algebra S R]
    (f : PolynomialModule S S) (x : R) :
    aeval x (equivPolynomial f) = eval x (map R (Algebra.linearMap S R) f) 
goal: (Polynomial.aeval x) (PolynomialModule.equivPolynomial f) =
  (PolynomialModule.eval x) ((PolynomialModule.map R (Algebra.linearMap S R)) f)

full_name: PolynomialModule.comp_apply
code: /-- `comp p q` is the composition of `p : R[X]` and `q : M[X]` as `q(p(x))`.  -/
@[simps!]
noncomputable def comp (p : R[X]) : PolynomialModule R M →ₗ[R] PolynomialModule R M 
goal: ∀ (a : PolynomialModule R M),
  (PolynomialModule.comp p) a = (PolynomialModule.eval p) ((PolynomialModule.map R[X] (PolynomialModule.lsingle R 0)) a)

full_name: PolynomialModule.comp
code: /-- `comp p q` is the composition of `p : R[X]` and `q : M[X]` as `q(p(x))`.  -/
@[simps!]
noncomputable def comp (p : R[X]) : PolynomialModule R M →ₗ[R] PolynomialModule R M 
goal: PolynomialModule R M →ₗ[R] PolynomialModule R M

full_name: PolynomialModule.comp_single
code: theorem comp_single (p : R[X]) (i : ℕ) (m : M) : comp p (single R i m) = p ^ i • single R 0 m 
goal: (PolynomialModule.comp p) ((PolynomialModule.single R i) m) = p ^ i • (PolynomialModule.single R 0) m

full_name: PolynomialModule.comp_eval
code: theorem comp_eval (p : R[X]) (q : PolynomialModule R M) (r : R) :
    eval r (comp p q) = eval (p.eval r) q 
goal: (PolynomialModule.eval r) ((PolynomialModule.comp p) q) = (PolynomialModule.eval (Polynomial.eval r p)) q

full_name: PolynomialModule.comp_smul
code: theorem comp_smul (p p' : R[X]) (q : PolynomialModule R M) :
    comp p (p' • q) = p'.comp p • comp p q 
goal: (PolynomialModule.comp p) (p' • q) = p'.comp p • (PolynomialModule.comp p) q