Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Lean/Mathlib/Mathlib/Analysis/Distribution/     Datei vom 15.10.2026 mit Größe 17 kB image not shown  

SSL TestFunction.lean   Sprache: Lean

 

/-
Copyright (c) 2025 Luigi Massacci. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Luigi Massacci, Anatole Dedecker
-/

module

public import Mathlib.Analysis.Calculus.LineDeriv.Basic
public import Mathlib.Analysis.Distribution.ContDiffMapSupportedIn
public import Mathlib.Analysis.Distribution.DerivNotation

/-!
# Continuously differentiable functions with compact support

This file develops the basic theory of bundled `n`-times continuously differentiable functions
with compact support contained in some open set `Ω`. More explicitly, given normed spaces `E`
and `F`, an open set `Ω : Opens E` and `n : ℕ∞`, we are interested in the space `��^{n}(Ω, F)` of
maps `f : E → F` such that:

- `f` is `n`-times continuously differentiable: `ContDiff ℝ n f`.
- `f` has compact support: `HasCompactSupport f`.
- the support of `f` is inside the open set `Ω`: `tsupport f ⊆ Ω`.

This exists as a bundled type to equip it with the canonical LF topology induced by the inclusions
`��_{K}^{n}(Ω, F) → ��^{n}(Ω, F)` (see `ContDiffMapSupportedIn`). The dual space is then the space of
distributions, or "weak solutions" to PDEs, on `Ω`.

## Main definitions

- `TestFunction Ω F n`: the type of bundled `n`-times continuously differentiable
  functions `E → F` with compact support contained in `Ω`.
- `TestFunction.topologicalSpace`: the canonical LF topology on `��^{n}(Ω, F)`. It is the
  locally convex inductive limit of the topologies on each `��_{K}^{n}(Ω, F)`.

## Main statements

- `TestFunction.continuous_iff_continuous_comp`: a linear map from `��^{n}(E, F)`
  to a locally convex space is continuous iff its restriction to `��^{n}_{K}(E, F)` is
  continuous for each compact set `K`. We will later translate this concretely in terms
  of seminorms.

## Notation

- `��^{n}(Ω, F)`: the space of bundled `n`-times continuously differentiable functions `E → F`
  with compact support contained in `Ω`.
- `��(Ω, F)`: the space of bundled smooth (infinitely differentiable) functions `E → F`
  with compact support contained in `Ω`, i.e. `��^{⊤}(Ω, F)`.

## Tags

distributions, test function
-/


@[expose] public section

open Function Set TopologicalSpace UniformSpace
open scoped BoundedContinuousFunction NNReal Topology ContDiff

variable {�� �� : Type*} [NontriviallyNormedField ��]
  {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {Ω Ω₁ Ω₂ : Opens E}
  {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] [NormedSpace �� F]
  {F' : Type*} [NormedAddCommGroup F'] [NormedSpace ℝ F'] [NormedSpace �� F']
  {n n₁ n₂ k : ℕ∞}

variable (Ω F n) in
/-- The type of bundled `n`-times continuously differentiable maps with compact support -/
structure TestFunction : Type _ where
  /-- The underlying function. Use coercion instead. -/
  protected toFun : E → F
  protected contDiff' : ContDiff ℝ n toFun
  protected hasCompactSupport' : HasCompactSupport toFun
  protected tsupport_subset' : tsupport toFun ⊆ Ω

/-- Notation for the space of bundled `n`-times continuously differentiable maps
with compact support. -/

scoped[Distributions] notation "��^{" n "}(" Ω ", " F ")" => TestFunction Ω F n

/-- Notation for the space of "test functions", i.e. bundled smooth (infinitely differentiable) maps
with compact support. -/

scoped[Distributions] notation "��(" Ω ", " F ")" => TestFunction Ω F ⊤

open scoped Distributions

/-- `TestFunctionClass B Ω F n` states that `B` is a type of `n`-times continuously
differentiable functions `E → F` with compact support contained in `Ω : Opens E`. -/

class TestFunctionClass (B : Type*)
    {E : outParam Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] (Ω : outParam <| Opens E)
    (F : outParam Type*) [NormedAddCommGroup F] [NormedSpace ℝ F]
    (n : outParam ℕ∞) [FunLike B E F] where
  map_contDiff (f : B) : ContDiff ℝ n f
  map_hasCompactSupport (f : B) : HasCompactSupport f
  tsupport_map_subset (f : B) : tsupport f ⊆ Ω

open TestFunctionClass

namespace TestFunctionClass

instance (B : Type*)
    {E : outParam Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] (Ω : outParam <| Opens E)
    (F : outParam Type*) [NormedAddCommGroup F] [NormedSpace ℝ F]
    (n : outParam ℕ∞) [FunLike B E F] [TestFunctionClass B Ω F n] :
    ContinuousMapClass B E F where
  map_continuous f := (map_contDiff f).continuous

instance (B : Type*)
    {E : outParam Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] (Ω : outParam <| Opens E)
    (F : outParam Type*) [NormedAddCommGroup F] [NormedSpace ℝ F]
    (n : outParam ℕ∞) [FunLike B E F] [TestFunctionClass B Ω F n] :
    BoundedContinuousMapClass B E F where
  map_bounded f := by
    obtain ⟨C, hC⟩ := (map_continuous f).bounded_above_of_compact_support (map_hasCompactSupport f)
    exact map_bounded (BoundedContinuousFunction.ofNormedAddCommGroup f (map_continuous f) C hC)

end TestFunctionClass

namespace TestFunction

instance : FunLike ��^{n}(Ω, F) E F where
  coe f := f.toFun
  coe_injective f g h := by cases f; cases g; congr

instance : TestFunctionClass ��^{n}(Ω, F) Ω F n where
  map_contDiff f := f.contDiff'
  map_hasCompactSupport f := f.hasCompactSupport'
  tsupport_map_subset f := f.tsupport_subset'

protected theorem contDiff (f : ��^{n}(Ω, F)) : ContDiff ℝ n f := map_contDiff f
protected theorem hasCompactSupport (f : ��^{n}(Ω, F)) : HasCompactSupport f :=
  map_hasCompactSupport f
protected theorem tsupport_subset (f : ��^{n}(Ω, F)) : tsupport f ⊆ Ω := tsupport_map_subset f
protected theorem zero_on_compl (f : ��^{n}(Ω, F)) : EqOn f 0 Ωᶜ := fun _ hx ↦
  image_eq_zero_of_notMem_tsupport fun h ↦ hx (f.tsupport_subset h)

@[fun_prop]
protected theorem continuous (f : ��^{n}(Ω, F)) : Continuous f :=
  f.contDiff.continuous

@[simp]
theorem toFun_eq_coe {f : ��^{n}(Ω, F)} : f.toFun = (f : E → F) :=
  rfl

/-- See note [custom simps projection]. -/
def Simps.coe (f : ��^{n}(Ω, F)) : E → F := f

initialize_simps_projections TestFunction (toFun → coe, as_prefix coe)

@[ext]
theorem ext {f g : ��^{n}(Ω, F)} (h : ∀ a, f a = g a) : f = g :=
  DFunLike.ext _ _ h

/-- Copy of a `TestFunction` with a new `toFun` equal to the old one. Useful to fix
definitional equalities. -/

protected def copy (f : ��^{n}(Ω, F)) (f' : E → F) (h : f' = f) : ��^{n}(Ω, F) where
  toFun := f'
  contDiff' := h.symm ▸ f.contDiff
  hasCompactSupport' := h.symm ▸ f.hasCompactSupport
  tsupport_subset' := h.symm ▸ f.tsupport_subset

@[simp]
theorem coe_copy (f : ��^{n}(Ω, F)) (f' : E → F) (h : f' = f) : ⇑(f.copy f' h) = f' :=
  rfl

theorem copy_eq (f : ��^{n}(Ω, F)) (f' : E → F) (h : f' = f) : f.copy f' h = f :=
  DFunLike.ext' h

@[simp]
theorem coe_toBoundedContinuousFunction (f : ��^{n}(Ω, F)) :
    (f : BoundedContinuousFunction E F) = (f : E → F) := rfl

@[simp]
theorem coe_mk {f : E → F} {contDiff : ContDiff ℝ n f} {hasCompactSupport : HasCompactSupport f}
    {tsupport_subset : tsupport f ⊆ Ω} :
    TestFunction.mk f contDiff hasCompactSupport tsupport_subset = f :=
  rfl

section AddCommGroup

instance : Zero ��^{n}(Ω, F) where
  zero := ⟨0, contDiff_zero_fun, .zero, by simp only [tsupport_zero, empty_subset]⟩

instance : IsZeroApply ��^{n}(Ω, F) where

@[deprecated (since := "2026-06-15")] alias coe_zero := FunLike.coe_zero

instance : Add ��^{n}(Ω, F) where
  add f g := ⟨f + g, f.contDiff.add g.contDiff, f.hasCompactSupport.add g.hasCompactSupport,
    tsupport_add f g |>.trans <| union_subset f.tsupport_subset g.tsupport_subset⟩

instance : IsAddApply ��^{n}(Ω, F) where

@[deprecated (since := "2026-06-15")] alias coe_add := FunLike.coe_add

instance : Neg ��^{n}(Ω, F) where
  neg f := ⟨-f, f.contDiff.neg, f.hasCompactSupport.neg, tsupport_neg f ▸ f.tsupport_subset⟩

instance : IsNegApply ��^{n}(Ω, F) where

@[deprecated (since := "2026-06-15")] alias coe_neg := FunLike.coe_neg

instance : Sub ��^{n}(Ω, F) where
  sub f g := ⟨f - g, f.contDiff.sub g.contDiff, f.hasCompactSupport.sub g.hasCompactSupport,
    tsupport_sub f g |>.trans <| union_subset f.tsupport_subset g.tsupport_subset⟩

instance : IsSubApply ��^{n}(Ω, F) where

@[deprecated (since := "2026-06-15")] alias coe_sub := FunLike.coe_sub

instance {R} [Semiring R] [Module R F] [SMulCommClass ℝ R F] [ContinuousConstSMul R F] :
    SMul R ��^{n}(Ω, F) where
  smul c f := ⟨c • f, f.contDiff.const_smul c, f.hasCompactSupport.smul_left,
    tsupport_smul_subset_right _ _ |>.trans f.tsupport_subset⟩

instance {R} [Semiring R] [Module R F] [SMulCommClass ℝ R F] [ContinuousConstSMul R F] :
    IsSMulApply R ��^{n}(Ω, F) where
  smul_apply _ _ _ := rfl

@[deprecated (since := "2026-06-15")] alias coe_smul := FunLike.coe_smul

instance : AddCommGroup ��^{n}(Ω, F) := fast_instance% FunLike.addCommGroup

@[deprecated (since := "2026-06-15")] alias coeFnAddMonoidHom := FunLike.coeAddMonoidHom

@[deprecated (since := "2026-06-15")] alias coeFnAddMonoidHom_apply := FunLike.coeAddMonoidHom_apply

end AddCommGroup

section Module

instance {R} [Semiring R] [Module R F] [SMulCommClass ℝ R F] [ContinuousConstSMul R F] :
    Module R ��^{n}(Ω, F) := fast_instance% FunLike.module

instance {R S} [Semiring R] [Semiring S] [Module R F] [Module S F] [SMulCommClass ℝ R F]
    [SMulCommClass ℝ S F] [ContinuousConstSMul R F] [ContinuousConstSMul S F] [SMul R S]
    [IsScalarTower R S F] :
    IsScalarTower R S ��^{n}(Ω, F) := FunLike.isScalarTower

end Module

open ContDiffMapSupportedIn

/-- The natural inclusion `��^{n}_{K}(E, F) → ��^{n}(Ω, F)` when `K ⊆ Ω`. -/
@[simps -fullyApplied]
def ofSupportedIn {K : Compacts E} (K_sub_Ω : (K : Set E) ⊆ Ω) (f : ��^{n}_{K}(E, F)) :
    ��^{n}(Ω, F) :=
  ⟨f, f.contDiff, f.compact_supp, f.tsupport_subset.trans K_sub_Ω⟩

section Topology

variable {V : Type*} [AddCommGroup V] [Module ℝ V] [t : TopologicalSpace V]
  [IsTopologicalAddGroup V] [ContinuousSMul ℝ V] [LocallyConvexSpace ℝ V]

variable (Ω F n) in
/-- The "original topology" on `��^{n}(Ω, F)`, defined as the supremum over all compacts `K ⊆ Ω` of
the topology on `��^{n}_{K}(E, F)`. In other words, this topology makes `��^{n}(Ω, F)` the inductive
limit of the `��^{n}_{K}(E, F)`s **in the category of topological spaces**.

Note that this has no reason to be a locally convex (or even vector space) topology. For this
reason, we actually endow `��^{n}(Ω, F)` with another topology, namely the finest locally convex
topology which is coarser than this original topology. See `TestFunction.topologicalSpace`. -/

@[instance_reducible]
noncomputable def originalTop : TopologicalSpace ��^{n}(Ω, F) :=
  ⨆ (K : Compacts E) (K_sub_Ω : (K : Set E) ⊆ Ω),
    coinduced (ofSupportedIn K_sub_Ω) ContDiffMapSupportedIn.topologicalSpace

variable (Ω F n) in
/-- The canonical LF topology on `��^{n}(Ω, F)`. This makes `��^{n}(Ω, F)` the inductive
limit of the `��^{n}_{K}(E, F)`s **in the category of locally convex topological vector spaces**
(over ℝ). See `TestFunction.continuous_iff_continuous_comp` for the corresponding universal
property.

More concretely, this is defined as the infimum of *all* locally convex topologies which are
coarser than the "original topology" `TestFunction.originalTop`, which corresponds to taking
the inductive limit in the category of topological spaces. -/

noncomputable instance topologicalSpace : TopologicalSpace ��^{n}(Ω, F) :=
  sInf {t : TopologicalSpace ��^{n}(Ω, F) | originalTop Ω F n ≤ t ∧
    @IsTopologicalAddGroup ��^{n}(Ω, F) t _ ∧
    @ContinuousSMul ℝ ��^{n}(Ω, F) _ _ t ∧
    @LocallyConvexSpace ℝ ��^{n}(Ω, F) _ _ _ _ t}

noncomputable instance : IsTopologicalAddGroup ��^{n}(Ω, F) :=
  isTopologicalAddGroup_sInf fun _ ⟨_, ht, _, _⟩ ↦ ht

noncomputable instance uniformSpace : UniformSpace ��^{n}(Ω, F) :=
  IsTopologicalAddGroup.rightUniformSpace ��^{n}(Ω, F)

noncomputable instance : IsUniformAddGroup ��^{n}(Ω, F) :=
  isUniformAddGroup_of_addCommGroup

-- TODO: deduce for `RCLike` field `��`
noncomputable instance : ContinuousSMul ℝ ��^{n}(Ω, F) :=
  continuousSMul_sInf fun _ ⟨_, _, ht, _⟩ ↦ ht

noncomputable instance : LocallyConvexSpace ℝ ��^{n}(Ω, F) :=
  .sInf fun _ ⟨_, _, _, ht⟩ ↦ ht

theorem originalTop_le : originalTop Ω F n ≤ topologicalSpace Ω F n :=
  le_sInf fun _t ⟨ht, _⟩ ↦ ht

/-- Fix a locally convex topology `t` on `��^{n}(Ω, F)`. `t` is coarser than the canonical topology
on `��^{n}(Ω, F)` if and only if it is coarser than the "original topology" given by
`TestFunction.originalTop`. -/

theorem topologicalSpace_le_iff {t : TopologicalSpace ��^{n}(Ω, F)}
    [@IsTopologicalAddGroup _ t _] [@ContinuousSMul ℝ _ _ _ t]
    [@LocallyConvexSpace ℝ _ _ _ _ _ t] :
    topologicalSpace Ω F n ≤ t ↔ originalTop Ω F n ≤ t :=
  ⟨le_trans originalTop_le, fun H ↦ sInf_le ⟨H, inferInstance, inferInstance, inferInstance⟩⟩

/-- For every compact `K ⊆ Ω`, the inclusion map `��^{n}_{K}(E, F) → ��^{n}(Ω, F)` is
continuous. It is in fact a topological embedding, though this fact is not in Mathlib yet. -/

@[fun_prop]
theorem continuous_ofSupportedIn {K : Compacts E} (K_sub_Ω : (K : Set E) ⊆ Ω) :
    Continuous (ofSupportedIn K_sub_Ω : ��^{n}_{K}(E, F) → ��^{n}(Ω, F)) := by
  rw [continuous_iff_coinduced_le]
  exact le_trans (le_iSup₂_of_le K K_sub_Ω le_rfl) originalTop_le

variable (��) in
/-- The natural inclusion `��^{n}_{K}(E, F) → ��^{n}(Ω, F)`, when `K ⊆ Ω`, as a continuous
linear map. -/

noncomputable def ofSupportedInCLM [SMulCommClass ℝ �� F] {K : Compacts E}
    (K_sub_Ω : (K : Set E) ⊆ Ω) :
    ��^{n}_{K}(E, F) →L[��] ��^{n}(Ω, F) where
  toFun f := ofSupportedIn K_sub_Ω f
  map_add' _ _ := rfl
  map_smul' _ _ := rfl

@[simp] theorem coe_ofSupportedInCLM [SMulCommClass ℝ �� F] {K : Compacts E}
    (K_sub_Ω : (K : Set E) ⊆ Ω) :
    (ofSupportedInCLM �� K_sub_Ω : ��^{n}_{K}(E, F) → ��^{n}(Ω, F)) = ofSupportedIn K_sub_Ω :=
  rfl

/-- The **universal property** of the topology on `��^{n}(Ω, F)`: a **linear** map from
`��^{n}(Ω, F)` to a locally convex topological vector space is continuous if and only if its
precomposition with the inclusion `ofSupportedIn K_sub_Ω : ��^{n}_{K}(E, F) → ��^{n}(Ω, F)` is
continuous for every compact `K ⊆ Ω`. -/

protected theorem continuous_iff_continuous_comp [Algebra ℝ ��] [IsScalarTower ℝ �� F]
    [Module �� V] [IsScalarTower ℝ �� V] (f : ��^{n}(Ω, F) →ₗ[��] V) :
    Continuous f ↔ ∀ (K : Compacts E) (K_sub_Ω : (K : Set E) ⊆ Ω),
      Continuous (f ∘ ofSupportedIn K_sub_Ω) := by
  simp_rw [← f.coe_restrictScalars ℝ]
  rw [continuous_iff_le_induced]
  have : @IsTopologicalAddGroup _ (induced (f.restrictScalars ℝ) t) _ :=
    isTopologicalAddGroup_induced _
  have : @ContinuousSMul ℝ _ _ _ (induced (f.restrictScalars ℝ) t) := continuousSMul_induced _
  have : @LocallyConvexSpace ℝ _ _ _ _ _ (induced (f.restrictScalars ℝ) t) := .induced _
  simp_rw [topologicalSpace_le_iff, originalTop, iSup₂_le_iff, ← continuous_iff_le_induced,
    continuous_coinduced_dom]

variable (��) in
/-- Reformulation of the universal property of the topology on `��^{n}(Ω, F)`, in the form of a
custom constructor for continuous linear maps `��^{n}(Ω, F) →L[��] V`, where `V` is an arbitrary
locally convex topological vector space. See also `limitCLM`. -/

@[simps]
protected noncomputable def mkCLM [Algebra ℝ ��] [IsScalarTower ℝ �� F] [Module �� V]
    [IsScalarTower ℝ �� V]
    (toFun : ��^{n}(Ω, F) → V)
    (map_add : ∀ f g, toFun (f + g) = toFun f + toFun g)
    (map_smul : ∀ c : ��, ∀ f, toFun (c • f) = c • toFun f)
    (cont : ∀ (K : Compacts E) (K_sub_Ω : (K : Set E) ⊆ Ω),
      Continuous (toFun ∘ ofSupportedIn K_sub_Ω)) :
    ��^{n}(Ω, F) →L[��] V :=
  letI Φ : ��^{n}(Ω, F) →ₗ[��] V := ⟨⟨toFun, map_add⟩, map_smul⟩
  { toLinearMap := Φ
    cont := show Continuous Φ by rwa [TestFunction.continuous_iff_continuous_comp] }

variable (��) in
/-- Reformulation of the universal property of the topology on `��^{n}(Ω, F)`, in the form of a
custom constructor for continuous linear maps `��^{n}(Ω, F) →L[��] V`, where `V` is an arbitrary
locally convex topological vector space. See also `mkCLM`. -/

@[simps!]
protected noncomputable def limitCLM [Algebra ℝ ��] [IsScalarTower ℝ �� F] [Module �� V]
    [IsScalarTower ℝ �� V]
    (toFun : ��^{n}(Ω, F) → V)
    (T : Π (K : Compacts E), (K : Set E) ⊆ Ω → ��^{n}_{K}(E, F) →L[��] V)
    (toFun_eq_T : ∀ K K_sub_Ω f, toFun (ofSupportedIn K_sub_Ω f) = T K K_sub_Ω f) :
    ��^{n}(Ω, F) →L[��] V :=
  haveI toFun_add (f g : ��^{n}(Ω, F)) : toFun (f + g) = toFun f + toFun g := by
    set K : Compacts E := ⟨tsupport f ∪ tsupport g, .union f.hasCompactSupport g.hasCompactSupport⟩
    have K_sub_Ω : (K : Set E) ⊆ Ω := union_subset f.tsupport_subset g.tsupport_subset
    let f_K : ��^{n}_{K}(E, F) :=
      .of_support_subset f.contDiff (subset_closure.trans subset_union_left)
    let g_K : ��^{n}_{K}(E, F) :=
      .of_support_subset g.contDiff (subset_closure.trans subset_union_right)
    change toFun (ofSupportedIn K_sub_Ω (f_K + g_K)) =
      toFun (ofSupportedIn K_sub_Ω f_K) + toFun (ofSupportedIn K_sub_Ω g_K)
    simp [toFun_eq_T]
  haveI toFun_smul (c : ��) (f : ��^{n}(Ω, F)) : toFun (c • f) = c • toFun f := by
    set K : Compacts E := ⟨tsupport f, f.hasCompactSupport⟩
    have K_sub_Ω : (K : Set E) ⊆ Ω := f.tsupport_subset
    let f_K : ��^{n}_{K}(E, F) := .of_support_subset f.contDiff subset_closure
    change toFun (ofSupportedIn K_sub_Ω (c • f_K)) = c • toFun (ofSupportedIn K_sub_Ω f_K)
    simp [toFun_eq_T]
  TestFunction.mkCLM �� toFun toFun_add toFun_smul
    (fun K K_sub_Ω ↦ .congr (T K K_sub_Ω).continuous (fun f ↦ (toFun_eq_T K K_sub_Ω f).symm))

end Topology

section ToBoundedContinuousFunctionCLM

variable (��) in
/-- The inclusion of the space `��^{n}(Ω, F)` into the space `E →ᵇ F` of bounded continuous
functions as a continuous `��`-linear map. -/

@[simps! apply]
noncomputable def toBoundedContinuousFunctionCLM [Algebra ℝ ��] [IsScalarTower ℝ �� F] :
    ��^{n}(Ω, F) →L[��] E →ᵇ F :=
  TestFunction.mkCLM �� (↑) (fun _ _ ↦ rfl) (fun _ _ ↦ rfl)
    (fun _ _ ↦ (ContDiffMapSupportedIn.toBoundedContinuousFunctionCLM ��).continuous)

lemma toBoundedContinuousFunctionCLM_eq_of_scalars [Algebra ℝ ��] [IsScalarTower ℝ �� F] (��' : Type*)
    [NontriviallyNormedField ��'] [NormedSpace ��' F] [Algebra ℝ ��'] [IsScalarTower ℝ ��' F] :
    (toBoundedContinuousFunctionCLM �� : ��^{n}(Ω, F) → _) = toBoundedContinuousFunctionCLM ��' :=
  rfl

set_option backward.isDefEq.respectTransparency false in
variable (��) in
theorem injective_toBoundedContinuousFunctionCLM [Algebra ℝ ��] [IsScalarTower ℝ �� F] :
    Function.Injective (toBoundedContinuousFunctionCLM �� : ��^{n}(Ω, F) →L[��] E →ᵇ F) :=
  fun f g ↦ by simp [toBoundedContinuousFunctionCLM]

instance : ContinuousEval ��^{n}(Ω, F) E F :=
  ContinuousEval.of_continuous_forget
    (toBoundedContinuousFunctionCLM ℝ).continuous

instance : T3Space ��^{n}(Ω, F) :=
  suffices T2Space ��^{n}(Ω, F) from inferInstance
  .of_injective_continuous (injective_toBoundedContinuousFunctionCLM ℝ)
    (ContinuousLinearMap.continuous _)

end ToBoundedContinuousFunctionCLM

section postcomp

variable [Algebra ℝ ��] [IsScalarTower ℝ �� F] [IsScalarTower ℝ �� F']

-- Note: generalizing this to a semilinear setting would require a typeclass-way of saying that
-- the `RingHom` is `ℝ`-linear.
/-- Given `T : F →L[��] F'`, `postcompCLM T` is the continuous `��`-linear-map sending
`f : ��^{n}(Ω, F)` to `T ∘ f` as an element of `��^{n}(Ω, F')`. -/

noncomputable def postcompCLM (T : F →L[��] F') :
    ��^{n}(Ω, F) →L[��] ��^{n}(Ω, F') :=
  letI Φ (f : ��^{n}(Ω, F)) : ��^{n}(Ω, F') :=
    ⟨T ∘ f, T.restrictScalars ℝ |>.contDiff.comp f.contDiff,
      f.hasCompactSupport.comp_left (map_zero _),
      (tsupport_comp_subset (map_zero _) f).trans f.tsupport_subset⟩
  TestFunction.limitCLM �� Φ
    (fun K K_sub_Ω ↦ ofSupportedInCLM �� K_sub_Ω ∘L ContDiffMapSupportedIn.postcompCLM T)
    (fun _ _ _ ↦ by ext; simp [Φ])

@[simp]
lemma postcompCLM_apply (T : F →L[��] F')
    (f : ��^{n}(Ω, F)) :
    postcompCLM T f = T ∘ f :=
  rfl

end postcomp

section Monotone

variable [Algebra ℝ ��] [IsScalarTower ℝ �� F]

variable (��) in
/-- If `n₁ ≥ n₂` and `Ω₁ ⊆ Ω₂`, `monoCLM ��` is the continuous `��`-linear inclusion of
`��^{n₁}(Ω₁, F)` inside `��^{n₂}(Ω₂, F)`. Otherwise, this is the zero map.

This is in fact a topological embedding when `n₁ = n₂` and `Ω₁ ⊆ Ω₂` (not in Mathlib as of
March 2026).

The parameters `n₁, n₂, Ω₁, Ω₂` are implicit as they can often be inferred from context, or
specified by a type ascription. -/

noncomputable def monoCLM :
    ��^{n₁}(Ω₁, F) →L[��] ��^{n₂}(Ω₂, F) :=
  open scoped Classical in
  letI Φ (f : ��^{n₁}(Ω₁, F)) : ��^{n₂}(Ω₂, F) :=
    if h : n₂ ≤ n₁ ∧ Ω₁ ≤ Ω₂ then
      ⟨f, f.contDiff.of_le (mod_cast h.1), f.hasCompactSupport, f.tsupport_subset.trans h.2⟩
    else 0
  TestFunction.limitCLM �� Φ
    (fun K K_sub_Ω₁ ↦ if h : n₂ ≤ n₁ ∧ Ω₁ ≤ Ω₂
      then ofSupportedInCLM �� (K_sub_Ω₁.trans h.2) ∘L ContDiffMapSupportedIn.monoCLM ��
      else 0)
    (fun _ _ _ ↦ by ext; dsimp [Φ]; split_ifs with h <;> simp [h])

open scoped Classical in
@[simp]
lemma monoCLM_apply (f : ��^{n₁}(Ω₁, F)) :
    ((monoCLM �� f : ��^{n₂}(Ω₂, F)) : E → F) = if n₂ ≤ n₁ ∧ Ω₁ ≤ Ω₂ then f else 0 := by
  rw [monoCLM]
  split_ifs <;> rfl

lemma monoCLM_eq_zero (H : ¬ (n₂ ≤ n₁ ∧ Ω₁ ≤ Ω₂)) :
    (monoCLM �� : ��^{n₁}(Ω₁, F) →L[��] ��^{n₂}(Ω₂, F)) = 0 := by
  ext; simp [H]

lemma monoCLM_eq_of_scalars (��' : Type*)
    [NontriviallyNormedField ��'] [NormedSpace ��' F] [Algebra ℝ ��'] [IsScalarTower ℝ ��' F] :
    (monoCLM �� : ��^{n₁}(Ω₁, F) → ��^{n₂}(Ω₂, F)) = monoCLM ��' :=
  rfl

end Monotone

section FDerivCLM

variable [Algebra ℝ ��] [IsScalarTower ℝ �� F]

variable (�� n k) in
/-- `fderivCLM �� n k` is the continuous `��`-linear-map sending `f : ��^{n}_{K}(E, F)` to
its derivative as an element of `��^{k}_{K}(E, E →L[ℝ] F)`.
This only makes mathematical sense if `k + 1 ≤ n`, otherwise we define it as the zero map. -/

noncomputable def fderivCLM :
    ��^{n}(Ω, F) →L[��] ��^{k}(Ω, E →L[ℝ] F) :=
  letI Φ (f : ��^{n}(Ω, F)) : ��^{k}(Ω, E →L[ℝ] F) :=
    if hk : k + 1 ≤ n then
      ⟨fderiv ℝ f, f.contDiff.fderiv_right (mod_cast hk),
        f.hasCompactSupport.fderiv ℝ, tsupport_fderiv_subset ℝ |>.trans f.tsupport_subset⟩
    else 0
  TestFunction.limitCLM �� Φ
    (fun K K_sub_Ω ↦ ofSupportedInCLM �� K_sub_Ω ∘L ContDiffMapSupportedIn.fderivCLM �� n k)
    (fun _ _ _ ↦ by ext; dsimp [Φ]; split_ifs with h <;> simp [h])

@[simp]
lemma fderivCLM_apply (f : ��^{n}(Ω, F)) :
    fderivCLM �� n k f = if k + 1 ≤ n then fderiv ℝ f else 0 := by
  rw [fderivCLM]
  split_ifs <;> rfl

lemma fderivCLM_apply_of_le (f : ��^{n}(Ω, F)) (hk : k + 1 ≤ n) :
    fderivCLM �� n k f = fderiv ℝ f := by
  simp [hk]

lemma fderivCLM_apply_of_gt (hk : n < k + 1) :
    (fderivCLM �� n k : ��^{n}(Ω, F) →L[��] ��^{k}(Ω, E →L[ℝ] F)) = 0 := by
  ext : 2
  simp [not_le_of_gt hk]

variable (��) in
lemma fderivCLM_ofSupportedIn {K : Compacts E}
    (K_sub_Ω : (K : Set E) ⊆ Ω) (f : ��^{n}_{K}(E, F)) :
    fderivCLM �� n k (ofSupportedIn K_sub_Ω f) =
      ofSupportedIn K_sub_Ω (ContDiffMapSupportedIn.fderivCLM �� n k f) := by
  ext
  simp

variable (��) in
lemma fderivCLM_eq_of_scalars (��' : Type*)
    [NontriviallyNormedField ��'] [NormedSpace ��' F] [Algebra ℝ ��'] [IsScalarTower ℝ ��' F] :
    (fderivCLM �� n k : ��^{n}(Ω, F) → _) = fderivCLM ��' n k :=
  rfl

end FDerivCLM

section LineDerivCLM

variable [Algebra ℝ ��] [IsScalarTower ℝ �� F]

variable (��) in
/-- `lineDerivCLM �� v` is the continuous `��`-linear-map sending `f : ��^{n}_{K}(E, F)` to
its derivative along the vector `v`, which is an element of `��^{k}_{K}(E, F)`.
This only makes mathematical sense if `k + 1 ≤ n`, otherwise we define it as the zero map.

The parameters `n` and `k` are implicit as they can often be inferred from context, or
specified by a type ascription. For `n = k = ⊤`, we also provide instances of the `LineDeriv`
notation typeclass. -/

noncomputable def lineDerivCLM (v : E) :
    ��^{n}(Ω, F) →L[��] ��^{k}(Ω, F) :=
  -- Cannot use `ContinuousLinearMap.apply` here because we are mixing `ℝ` and `��`
  letI ev_v : (E →L[ℝ] F) →L[��] F :=
  { toFun f := f v
    map_add' _ _ := rfl
    map_smul' _ _ := rfl }
  postcompCLM ev_v ∘L fderivCLM �� n k

lemma lineDerivCLM_eq_fderivCLM {f : ��^{n}(Ω, F)} {v : E} {x : E} :
    (lineDerivCLM �� v f : ��^{k}(Ω, F)) x = fderivCLM �� n k f x v :=
  rfl

@[simp]
lemma lineDerivCLM_apply {f : ��^{n}(Ω, F)} {v : E} {x : E} :
    (lineDerivCLM �� v f : ��^{k}(Ω, F)) x = if k + 1 ≤ n then lineDeriv ℝ f x v else 0 := by
  rw [lineDerivCLM_eq_fderivCLM, fderivCLM_apply]
  split_ifs with hk
  · have hk' : 0 < (n : ℕ∞ω) := mod_cast (add_pos_of_right zero_lt_one k).trans_le hk
    rw [(f.contDiff.differentiable hk'.ne').differentiableAt.lineDeriv_eq_fderiv]
  · rfl

lemma lineDerivCLM_apply_of_le {f : ��^{n}(Ω, F)} {v : E} {x : E} (hk : k + 1 ≤ n) :
    (lineDerivCLM �� v f : ��^{k}(Ω, F)) x = lineDeriv ℝ f x v := by
  simp [hk]

lemma lineDerivCLM_apply_of_gt {v : E} (hk : n < k + 1) :
    (lineDerivCLM �� v : ��^{n}(Ω, F) →L[��] ��^{k}(Ω, F)) = 0 := by
  ext
  simp [not_le_of_gt hk]

variable (��) in
lemma lineDerivCLM_eq_of_scalars (��' : Type*)
    [NontriviallyNormedField ��'] [NormedSpace ��' F] [Algebra ℝ ��'] [IsScalarTower ℝ ��' F]
    {v : E} : (lineDerivCLM �� v : ��^{n}(Ω, F) → ��^{k}(Ω, F)) = lineDerivCLM ��' v :=
  rfl

lemma lineDerivCLM_add {v₁ v₂ : E} :
    (lineDerivCLM �� (v₁ + v₂) : ��^{n}(Ω, F) →L[��] ��^{k}(Ω, F)) =
      lineDerivCLM �� v₁ + lineDerivCLM �� v₂ := by
  ext
  simp [-lineDerivCLM_apply, lineDerivCLM_eq_fderivCLM]

lemma lineDerivCLM_smul {c : ℝ} {v : E} :
    (lineDerivCLM �� (c • v) : ��^{n}(Ω, F) →L[��] ��^{k}(Ω, F)) =
      c • lineDerivCLM �� v := by
  ext
  simp [-lineDerivCLM_apply, lineDerivCLM_eq_fderivCLM]

open LineDeriv

/-- Note: we cannot express the full generality of `lineDerivCLM` purely in terms of this typeclass,
because (by design) the target type `��^{k}_{K}(E, F)` is not determined by the input type
`��^{n}_{K}(E, F)`. -/

noncomputable instance : LineDeriv E ��(Ω, F) ��(Ω, F) where
  lineDerivOp v := lineDerivCLM ℝ v

variable (��) in
lemma lineDerivOp_eq_lineDerivCLM {v : E} {f : ��(Ω, F)} :
    ∂_{v} f = lineDerivCLM �� v f :=
  rfl

noncomputable instance : LineDerivAdd E ��(Ω, F) ��(Ω, F) where
  lineDerivOp_add v := map_add (lineDerivCLM ℝ v)
  lineDerivOp_left_add _ _ f := congr($lineDerivCLM_add f)

noncomputable instance : LineDerivSMul �� E ��(Ω, F) ��(Ω, F) where
  lineDerivOp_smul v := map_smul (lineDerivCLM �� v)

noncomputable instance : LineDerivLeftSMul ℝ E ��(Ω, F) ��(Ω, F) where
  lineDerivOp_left_smul _ _ f := congr($lineDerivCLM_smul f)

noncomputable instance : ContinuousLineDeriv E ��(Ω, F) ��(Ω, F) where
  continuous_lineDerivOp v := (lineDerivCLM ℝ v).continuous

lemma lineDerivOpCLM_eq_lineDerivCLM {v : E} :
    lineDerivOpCLM �� ��(Ω, F) v = lineDerivCLM �� v :=
  rfl

end LineDerivCLM

section Integral

open MeasureTheory

variable {m : MeasurableSpace E} [OpensMeasurableSpace E] {F₁ F₂ F₃ : Type*}
  [NormedAddCommGroup F₁] [NormedSpace �� F₁] [NormedSpace ℝ F₁]
  [NormedAddCommGroup F₂] [NormedSpace �� F₂]
  [NormedAddCommGroup F₃] [NormedSpace �� F₃]

@[fun_prop]
protected theorem stronglyMeasurable (f : ��^{n}(Ω, F)) :
    StronglyMeasurable f := by
  exact f.continuous.stronglyMeasurable_of_hasCompactSupport f.hasCompactSupport

@[fun_prop]
protected theorem aestronglyMeasurable {μ : Measure E} (f : ��^{n}(Ω, F)) :
    AEStronglyMeasurable f μ :=
  f.stronglyMeasurable.aestronglyMeasurable

protected theorem memLp_top {μ : Measure E} (f : ��^{n}(Ω, F)) :
    MemLp f ⊤ μ :=
  f.continuous.memLp_top_of_hasCompactSupport f.hasCompactSupport μ

protected theorem integrable_bilin (B : F₁ →L[��] F₂ →L[��] F₃) {μ : Measure E} {φ : E → F₂}
    (hφ : LocallyIntegrableOn φ Ω μ) (f : ��^{n}(Ω, F₁)) :
    Integrable (fun x ↦ B (f x) (φ x)) μ := by
  suffices IntegrableOn (fun x ↦ B (f x) (φ x)) (tsupport f) μ by
    rwa [integrableOn_iff_integrable_of_support_subset] at this
    refine subset_trans ?_ (subset_tsupport f)
    exact fun x hx hfx ↦ hx (by simp [hfx])
  replace hφ := hφ.integrableOn_compact_subset f.tsupport_subset f.hasCompactSupport
  rw [IntegrableOn, ← memLp_one_iff_integrable] at hφ ⊢
  exact B.memLp_of_bilin 1 f.memLp_top hφ

protected theorem integrable_smul {f : E → F} {μ : Measure E}
    (φ : ��^{n}(Ω, ℝ)) (hf : LocallyIntegrableOn f Ω μ) :
    Integrable (fun x ↦ φ x • f x) μ :=
  φ.integrable_bilin (ContinuousLinearMap.lsmul ℝ ℝ) hf

/-- A test function on `Ω` is `μ`-integrable for any measure `μ` on `E` satisfying
`LocallyIntegrableOn 1 Ω μ`. Note that this is a weaker assumption than both
- `IsLocallyFiniteMeasure (μ.restrict Ω)` (because we say nothing about points outside of `Ω`)
- `IsFiniteMeasureOnCompacts (μ.restrict Ω)` (because we say nothing about compacts not
  contained in `Ω`)

For example, if `μ` is the measure with density `fun (x : ℝ) ↦ x⁻¹` with respect to the Lebesgue
measure and `Ω` is the open set `Ioo 0 1`, we have `LocallyIntegrableOn 1 Ω μ` (hence `μ` defines
a distribution on `Ω`) but the other two conditions are not satisfied.
-/

protected theorem integrable {μ : Measure E}
    (H : LocallyIntegrableOn (fun (_ : E) ↦ (1 : ℝ)) Ω μ)
    (f : ��^{n}(Ω, F)) : Integrable f μ := by
  rw [← integrableOn_iff_integrable_of_support_subset (subset_tsupport f)]
  replace H := H.integrableOn_compact_subset f.tsupport_subset f.hasCompactSupport
  suffices IntegrableOn ((1 : ℝ) • f) (tsupport f) μ by simpa
  rw [IntegrableOn, ← memLp_one_iff_integrable] at H ⊢
  exact H.smul f.memLp_top

variable [Algebra ℝ ��] [IsScalarTower ℝ �� F₁] [NormedSpace ℝ F₃] [IsScalarTower ℝ �� F₃]

-- TODO: semilinearize
/-- Given a continuous `��`-bilinear map `B : F₁ →L[��] F₂ →L[��] F₃`, a measure `μ` on `E`,
and a function `φ : E → F₂` which is locally `μ`-integrable, this is the *continuous* `��`-linear map
`f ↦ ∫ x, B (f x) (φ x) ∂μ` from `��^{n}(E, F₁)` to `F₃`. Otherwise, this is the zero map. -/

noncomputable def integralAgainstBilinCLM (B : F₁ →L[��] F₂ →L[��] F₃) (μ : Measure E) (φ : E → F₂) :
    ��^{n}(Ω, F₁) →L[��] F₃ := open scoped Classical in
  TestFunction.limitCLM ��
    (fun f ↦ if LocallyIntegrableOn φ Ω μ then ∫ x, B (f x) (φ x) ∂μ else 0)
    (fun K K_sub_Ω ↦
      if LocallyIntegrableOn φ Ω μ
      then ContDiffMapSupportedIn.integralAgainstBilinCLM B μ φ
      else 0)
    (fun K K_sub_Ω f ↦ by
      split_ifs with h
      · simp [h.integrableOn_compact_subset K_sub_Ω K.2]
      · simp)

open scoped Classical in
@[simp]
lemma integralAgainstBilinCLM_apply {B : F₁ →L[��] F₂ →L[��] F₃} {μ : Measure E} {φ : E → F₂}
    {f : ��^{n}(Ω, F₁)} :
    integralAgainstBilinCLM B μ φ f =
      if LocallyIntegrableOn φ Ω μ then ∫ x, B (f x) (φ x) ∂μ else 0 :=
  rfl

lemma integralAgainstBilinCLM_eq_integral {B : F₁ →L[��] F₂ →L[��] F₃} {μ : Measure E} {φ : E → F₂}
    (hφ : LocallyIntegrableOn φ Ω μ) {f : ��^{n}(Ω, F₁)} :
    integralAgainstBilinCLM B μ φ f = ∫ x, B (f x) (φ x) ∂μ := by
  simp [hφ]

lemma integralAgainstBilinCLM_eq_zero {B : F₁ →L[��] F₂ →L[��] F₃} {μ : Measure E} {φ : E → F₂}
    (hφ : ¬ LocallyIntegrableOn φ Ω μ) :
    (integralAgainstBilinCLM B μ φ : ��^{n}(Ω, F₁) →L[��] F₃) = 0 := by
  ext
  simp [hφ]

lemma integralAgainstBilinCLM_ofSupportedIn {B : F₁ →L[��] F₂ →L[��] F₃} {μ : Measure E} {φ : E → F₂}
    (hφ : LocallyIntegrableOn φ Ω μ) {K : Compacts E} (K_sub_Ω : (K : Set E) ⊆ Ω)
    {f : ��^{n}_{K}(E, F₁)} :
    integralAgainstBilinCLM B μ φ (ofSupportedIn K_sub_Ω f) =
      ContDiffMapSupportedIn.integralAgainstBilinCLM B μ φ f := by
  have hφ' := hφ.integrableOn_compact_subset K_sub_Ω K.isCompact
  simp [hφ, hφ']

end Integral

section Multiplication

section bilin

variable {F₁ F₂ F₃ G : Type*} [NormedAlgebra ℝ ��]
  [NormedAddCommGroup F₁] [NormedSpace �� F₁] [NormedSpace ℝ F₁]
  [NormedAddCommGroup F₂] [NormedSpace �� F₂] [NormedSpace ℝ F₂]
  [NormedAddCommGroup F₃] [NormedSpace �� F₃] [NormedSpace ℝ F₃]

open ContinuousLinearMap Finset

/-- The map `f ↦ (x ↦ B (f x) (g x))` as a continuous `��`-linear map on ��^{n}_(E, F₁),
where `B` is a continuous `��`-linear map and `g` is a C^n function. -/

noncomputable def bilinLeftCLM (B : F₁ →L[��] F₂ →L[��] F₃) {g : E → F₂} (hg : ContDiff ℝ n g) :
    ��^{n}(Ω, F₁) →L[��] ��^{n}(Ω, F₃) :=
  letI T : ��^{n}(Ω, F₁) → ��^{n}(Ω, F₃) :=
    fun φ ↦ ⟨fun x ↦ B (φ x) (g x),
      ((B.bilinearRestrictScalars ℝ).isBoundedBilinearMap.contDiff.comp ((φ.contDiff).prodMk hg)),
      (by exact (φ.hasCompactSupport).mono (by aesop)),
      (by exact le_trans (closure_mono (by aesop)) (tsupport_map_subset φ))⟩
  TestFunction.limitCLM �� T
    (fun K K_sub_Ω ↦ ofSupportedInCLM �� K_sub_Ω ∘L ContDiffMapSupportedIn.bilinLeftCLM B hg)
    (fun K K_sub_Ω f ↦ by congr)

@[simp]
theorem bilinLeftCLM_apply (B : F₁ →L[��] F₂ →L[��] F₃) {g : E → F₂} (hg : ContDiff ℝ n g)
    (φ : ��^{n}(Ω, F₁)) : bilinLeftCLM B hg φ = fun x => B (φ x) (g x) := rfl


end bilin

end Multiplication

end TestFunction

Messung
CHZG
9110010096

¤ Dauer der Verarbeitung: 0.73 Sekunden  ¤

*© Formatika GbR, Deutschland