Skip to content

Commit

Permalink
refactor(Analysis/Calculus/FormalMultilinearSeries): generalize to ad…
Browse files Browse the repository at this point in the history
…ditive monoids

While many of the lemmas cease to apply,
the definitions of sequences and their sums are still perfectly well-behaved in additive monoids;
no negation is needed.

We could use this to generalize `NormedSpace.exp` such that it works with `NNReal`,
but unless leanprover-community/mathlib#16554 or similar lands and provides a `DivisionSemiring.nnqsmul` field,
that would conflict with #8370.
  • Loading branch information
eric-wieser committed Jan 5, 2024
1 parent b180173 commit b8971a5
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 22 deletions.
4 changes: 2 additions & 2 deletions Mathlib/Analysis/Analytic/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ open Set Filter Asymptotics

namespace FormalMultilinearSeries

variable [Ring 𝕜] [AddCommGroup E] [AddCommGroup F] [Module 𝕜 E] [Module 𝕜 F]
variable [Semiring 𝕜] [AddCommMonoid E] [AddCommMonoid F] [Module 𝕜 E] [Module 𝕜 F]

variable [TopologicalSpace E] [TopologicalSpace F]

variable [TopologicalAddGroup E] [TopologicalAddGroup F]
variable [ContinuousAdd E] [ContinuousAdd F]

variable [ContinuousConstSMul 𝕜 E] [ContinuousConstSMul 𝕜 F]

Expand Down
53 changes: 33 additions & 20 deletions Mathlib/Analysis/Calculus/FormalMultilinearSeries.lean
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,24 @@ variable {𝕜 : Type u} {𝕜' : Type u'} {E : Type v} {F : Type w} {G : Type x

section

variable [CommRing 𝕜] [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [TopologicalAddGroup E]
[ContinuousConstSMul 𝕜 E] [AddCommGroup F] [Module 𝕜 F] [TopologicalSpace F]
[TopologicalAddGroup F] [ContinuousConstSMul 𝕜 F] [AddCommGroup G] [Module 𝕜 G]
[TopologicalSpace G] [TopologicalAddGroup G] [ContinuousConstSMul 𝕜 G]
variable [CommSemiring 𝕜] [AddCommMonoid E] [Module 𝕜 E] [TopologicalSpace E] [ContinuousAdd E]
[ContinuousConstSMul 𝕜 E] [AddCommMonoid F] [Module 𝕜 F] [TopologicalSpace F]
[ContinuousAdd F] [ContinuousConstSMul 𝕜 F] [AddCommMonoid G] [Module 𝕜 G]
[TopologicalSpace G] [ContinuousAdd G] [ContinuousConstSMul 𝕜 G]

/-- A formal multilinear series over a field `𝕜`, from `E` to `F`, is given by a family of
multilinear maps from `E^n` to `F` for all `n`. -/
@[nolint unusedArguments]
def FormalMultilinearSeries (𝕜 : Type*) (E : Type*) (F : Type*) [Ring 𝕜] [AddCommGroup E]
[Module 𝕜 E] [TopologicalSpace E] [TopologicalAddGroup E] [ContinuousConstSMul 𝕜 E]
[AddCommGroup F] [Module 𝕜 F] [TopologicalSpace F] [TopologicalAddGroup F]
def FormalMultilinearSeries (𝕜 : Type*) (E : Type*) (F : Type*) [Semiring 𝕜] [AddCommMonoid E]
[Module 𝕜 E] [TopologicalSpace E] [ContinuousAdd E] [ContinuousConstSMul 𝕜 E]
[AddCommMonoid F] [Module 𝕜 F] [TopologicalSpace F] [ContinuousAdd F]
[ContinuousConstSMul 𝕜 F] :=
∀ n : ℕ, E[×n]→L[𝕜] F
#align formal_multilinear_series FormalMultilinearSeries

-- Porting note: was `deriving`
instance : AddCommGroup (FormalMultilinearSeries 𝕜 E F) :=
inferInstanceAs <| AddCommGroup <| ∀ n : ℕ, E[×n]→L[𝕜] F
instance : AddCommMonoid (FormalMultilinearSeries 𝕜 E F) :=
inferInstanceAs <| AddCommMonoid <| ∀ n : ℕ, E[×n]→L[𝕜] F

instance : Inhabited (FormalMultilinearSeries 𝕜 E F) :=
0
Expand All @@ -72,9 +72,6 @@ namespace FormalMultilinearSeries
@[simp] -- porting note: new; was not needed in Lean 3
theorem zero_apply (n : ℕ) : (0 : FormalMultilinearSeries 𝕜 E F) n = 0 := rfl

@[simp] -- porting note: new; was not needed in Lean 3
theorem neg_apply (f : FormalMultilinearSeries 𝕜 E F) (n : ℕ) : (-f) n = - f n := rfl

@[ext] -- porting note: new theorem
protected theorem ext {p q : FormalMultilinearSeries 𝕜 E F} (h : ∀ n, p n = q n) : p = q :=
funext h
Expand Down Expand Up @@ -138,7 +135,7 @@ theorem compContinuousLinearMap_apply (p : FormalMultilinearSeries 𝕜 F G) (u
rfl
#align formal_multilinear_series.comp_continuous_linear_map_apply FormalMultilinearSeries.compContinuousLinearMap_apply

variable (𝕜) [CommRing 𝕜'] [SMul 𝕜 𝕜']
variable (𝕜) [CommSemiring 𝕜'] [SMul 𝕜 𝕜']

variable [Module 𝕜' E] [ContinuousConstSMul 𝕜' E] [IsScalarTower 𝕜 𝕜' E]

Expand All @@ -154,6 +151,22 @@ end FormalMultilinearSeries

end

namespace FormalMultilinearSeries
variable [CommRing 𝕜] [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [TopologicalAddGroup E]
[ContinuousConstSMul 𝕜 E] [AddCommGroup F] [Module 𝕜 F] [TopologicalSpace F]
[TopologicalAddGroup F] [ContinuousConstSMul 𝕜 F]

instance : AddCommGroup (FormalMultilinearSeries 𝕜 E F) :=
inferInstanceAs <| AddCommGroup <| ∀ n : ℕ, E[×n]→L[𝕜] F

@[simp] -- porting note: new; was not needed in Lean 3
theorem neg_apply (f : FormalMultilinearSeries 𝕜 E F) (n : ℕ) : (-f) n = - f n := rfl

@[simp] -- porting note: new; was not needed in Lean 3
theorem sub_apply (f g : FormalMultilinearSeries 𝕜 E F) (n : ℕ) : (f - g) n = f n - g n := rfl

end FormalMultilinearSeries

namespace FormalMultilinearSeries

variable [NontriviallyNormedField 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E] [NormedAddCommGroup F]
Expand Down Expand Up @@ -183,10 +196,10 @@ end FormalMultilinearSeries

namespace ContinuousLinearMap

variable [CommRing 𝕜] [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E] [TopologicalAddGroup E]
[ContinuousConstSMul 𝕜 E] [AddCommGroup F] [Module 𝕜 F] [TopologicalSpace F]
[TopologicalAddGroup F] [ContinuousConstSMul 𝕜 F] [AddCommGroup G] [Module 𝕜 G]
[TopologicalSpace G] [TopologicalAddGroup G] [ContinuousConstSMul 𝕜 G]
variable [CommSemiring 𝕜] [AddCommMonoid E] [Module 𝕜 E] [TopologicalSpace E] [ContinuousAdd E]
[ContinuousConstSMul 𝕜 E] [AddCommMonoid F] [Module 𝕜 F] [TopologicalSpace F]
[ContinuousAdd F] [ContinuousConstSMul 𝕜 F] [AddCommMonoid G] [Module 𝕜 G]
[TopologicalSpace G] [ContinuousAdd G] [ContinuousConstSMul 𝕜 G]

/-- Composing each term `pₙ` in a formal multilinear series with a continuous linear map `f` on the
left gives a new formal multilinear series `f.compFormalMultilinearSeries p` whose general term
Expand All @@ -212,9 +225,9 @@ namespace FormalMultilinearSeries

section Order

variable [CommRing 𝕜] {n : ℕ} [AddCommGroup E] [Module 𝕜 E] [TopologicalSpace E]
[TopologicalAddGroup E] [ContinuousConstSMul 𝕜 E] [AddCommGroup F] [Module 𝕜 F]
[TopologicalSpace F] [TopologicalAddGroup F] [ContinuousConstSMul 𝕜 F]
variable [CommSemiring 𝕜] {n : ℕ} [AddCommMonoid E] [Module 𝕜 E] [TopologicalSpace E]
[ContinuousAdd E] [ContinuousConstSMul 𝕜 E] [AddCommMonoid F] [Module 𝕜 F]
[TopologicalSpace F] [ContinuousAdd F] [ContinuousConstSMul 𝕜 F]
{p : FormalMultilinearSeries 𝕜 E F}

/-- The index of the first non-zero coefficient in `p` (or `0` if all coefficients are zero). This
Expand Down

0 comments on commit b8971a5

Please sign in to comment.