Imports
/- Copyright (c) 2025 Tomas Skrivan. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Tomas Skrivan -/ module public import Mathlib.Analysis.InnerProductSpace.Calculus public import Mathlib.Analysis.InnerProductSpace.ProdL2

Inner product space

In this module we define the type class InnerProductSpace' 𝕜 E which is a generalization of InnerProductSpace 𝕜 E, as it does not require the condition ‖x‖^2 = ⟪x,x⟫ but instead the condition ∃ (c > 0) (d > 0), c • ‖x‖^2 ≤ ⟪x,x⟫ ≤ d • ‖x‖^2. Instead E is equipped with a L₂ norm ‖x‖₂ which satisfies ‖x‖₂ = √⟪x,x⟫.

This allows us to define the inner product space structure on product types E × F and pi types ι → E, which would otherwise not be possible due to the use of max norm on these types.

We define the following maps:

    InnerProductSpace 𝕜 E → InnerProductSpace' 𝕜 E which sets ‖x‖₂ = ‖x‖.

    InnerProductSpace' 𝕜 E → InnerProductSpace 𝕜 (WithLp 2 E) which uses the fact that the norm defined on WithLp 2 E is L₂ norm.

@[expose] public section

L₂ norm on E.

In particular, on product types X×Y and pi types ι → X this class provides L₂ norm unlike ‖·‖.

class Norm₂ (E : Type*) where norm₂ : E
export Norm₂ (norm₂)attribute [inherit_doc Norm₂] norm₂@[inherit_doc Norm₂] notation:max "‖" x "‖₂" => norm₂ x

Effectively as InnerProductSpace 𝕜 E but it does not requires that ‖x‖^2 = ⟪x,x⟫. It is only required that they are equivalent ∃ (c > 0) (d > 0), c • ‖x‖^2 ≤ ⟪x,x⟫ ≤ d • ‖x‖^2. The main purpose of this class is to provide inner product space structure on product types ExF and pi types ι → E without using WithLp gadget.

If you want to access L₂ norm use ‖x‖₂ := √⟪x,x⟫.

This class induces InnerProductSpace 𝕜 (WithLp 2 E) which equips ‖·‖ on X with L₂ norm. This is very useful when translating results from InnerProductSpace to InnerProductSpace' together with toL2 : E →L[𝕜] (WithLp 2 E) and fromL2 : (WithL2 2 E) →L[𝕜] E.

In short we have these implications:

  InnerProductSpace 𝕜 E → InnerProductSpace' 𝕜 E
  InnerProductSpace' 𝕜 E → InnerProductSpace 𝕜 (WithLp 2 E)

The reason behind this type class is that with current mathlib design the requirement ‖x‖^2 = ⟪x,x⟫ prevents us to give inner product space structure on product type E×F and pi type ι → E as they are equipped with max norm. One has to work with WithLp 2 (E×F) and WithLp 2 (ι → E). This places quite a bit inconvenience on users in certain scenarios. In particular, the main motivation behind this class is to make computations of adjFDeriv and gradient easy.

Core inner product properties.

The inner product induces the L₂ norm.

Norm induced by inner product is topologically equivalent to the given norm on E.

class InnerProductSpace' (𝕜 : Type*) (E : Type*) [RCLike 𝕜] [NormedAddCommGroup E] [NormedSpace 𝕜 E] extends Norm₂ E where core : InnerProductSpace.Core 𝕜 E norm₂_sq_eq_re_inner : x : E, x‖₂ ^ 2 = re (core.inner x x) inner_top_equiv_norm : c d : , 0 < c 0 < d x : E, (c x^2 re (core.inner x x)) (re (core.inner x x) d x^2)
instance [inst : InnerProductSpace' 𝕜 E] : InnerProductSpace.Core 𝕜 E := inst.coreinstance [inst : InnerProductSpace' 𝕜 E] : Inner 𝕜 E := inst.core.toInnerinstance {𝕜 : Type*} {E : Type*} [RCLike 𝕜] [NormedAddCommGroup E] [inst : InnerProductSpace 𝕜 E] : InnerProductSpace' 𝕜 E where norm₂ x := x core := inst.toCore norm₂_sq_eq_re_inner := norm_sq_eq_re_inner inner_top_equiv_norm := 𝕜✝:Type u_1E✝:Type u_2inst✝⁴:RCLike 𝕜✝inst✝³:NormedAddCommGroup E✝inst✝²:NormedSpace 𝕜✝ E✝𝕜:Type u_3E:Type u_4inst✝¹:RCLike 𝕜inst✝:NormedAddCommGroup Einst:InnerProductSpace 𝕜 E c d, 0 < c 0 < d (x : E), c x ^ 2 re (inner 𝕜 x x) re (inner 𝕜 x x) d x ^ 2 𝕜✝:Type u_1E✝:Type u_2inst✝⁴:RCLike 𝕜✝inst✝³:NormedAddCommGroup E✝inst✝²:NormedSpace 𝕜✝ E✝𝕜:Type u_3E:Type u_4inst✝¹:RCLike 𝕜inst✝:NormedAddCommGroup Einst:InnerProductSpace 𝕜 E d, 0 < 1 0 < d (x : E), 1 x ^ 2 re (inner 𝕜 x x) re (inner 𝕜 x x) d x ^ 2; 𝕜✝:Type u_1E✝:Type u_2inst✝⁴:RCLike 𝕜✝inst✝³:NormedAddCommGroup E✝inst✝²:NormedSpace 𝕜✝ E✝𝕜:Type u_3E:Type u_4inst✝¹:RCLike 𝕜inst✝:NormedAddCommGroup Einst:InnerProductSpace 𝕜 E0 < 1 0 < 1 (x : E), 1 x ^ 2 re (inner 𝕜 x x) re (inner 𝕜 x x) 1 x ^ 2 All goals completed! 🐙local notation "⟪" x ", " y "⟫" => inner 𝕜 x ylocal postfix:90 "†" => starRingEnd _

B. Deriving the inner product structure on WithLp 2 E from InnerProductSpace' 𝕜 E

All goals completed! 🐙lemma fromL2_inner_left (x : WithLp 2 E) (y : E) : fromL2 𝕜 x, y = x, toL2 𝕜 y := rfllemma ofLp_inner_left (x : E) (y : WithLp 2 E) : WithLp.ofLp y, x = y, WithLp.toLp 2 x := fromL2_inner_left y xlemma toL2_inner_left (x : E) (y : WithLp 2 E) : toL2 𝕜 x, y = x, fromL2 𝕜 y := rfllemma toLp_inner_left (x : WithLp 2 E) (y : E) : WithLp.toLp 2 y, x = y, WithLp.ofLp x := toL2_inner_left y x@[simp] lemma toL2_fromL2 (x : WithLp 2 E) : toL2 𝕜 (fromL2 𝕜 x) = x := rfl@[simp] lemma fromL2_toL2 (x : E) : fromL2 𝕜 (toL2 𝕜 x) = x := rflinstance [CompleteSpace E] : CompleteSpace (WithLp 2 E) := 𝕜:Type u_1inst✝⁹:RCLike 𝕜E:Type u_2inst✝⁸:NormedAddCommGroup Einst✝⁷:NormedSpace 𝕜 EhE:InnerProductSpace' 𝕜 EF:Type u_3inst✝⁶:NormedAddCommGroup Finst✝⁵:NormedSpace 𝕜 Finst✝⁴:InnerProductSpace' 𝕜 FG:Type u_4inst✝³:NormedAddCommGroup Ginst✝²:NormedSpace 𝕜 Ginst✝¹:InnerProductSpace' 𝕜 Ginst✝:CompleteSpace ECompleteSpace (WithLp 2 E) 𝕜:Type u_1inst✝⁹:RCLike 𝕜E:Type u_2inst✝⁸:NormedAddCommGroup Einst✝⁷:NormedSpace 𝕜 EhE:InnerProductSpace' 𝕜 EF:Type u_3inst✝⁶:NormedAddCommGroup Finst✝⁵:NormedSpace 𝕜 Finst✝⁴:InnerProductSpace' 𝕜 FG:Type u_4inst✝³:NormedAddCommGroup Ginst✝²:NormedSpace 𝕜 Ginst✝¹:InnerProductSpace' 𝕜 Ginst✝:CompleteSpace Ee:WithLp 2 E ≃L[𝕜] ECompleteSpace (WithLp 2 E) 𝕜:Type u_1inst✝⁹:RCLike 𝕜E:Type u_2inst✝⁸:NormedAddCommGroup Einst✝⁷:NormedSpace 𝕜 EhE:InnerProductSpace' 𝕜 EF:Type u_3inst✝⁶:NormedAddCommGroup Finst✝⁵:NormedSpace 𝕜 Finst✝⁴:InnerProductSpace' 𝕜 FG:Type u_4inst✝³:NormedAddCommGroup Ginst✝²:NormedSpace 𝕜 Ginst✝¹:InnerProductSpace' 𝕜 Ginst✝:CompleteSpace Ee:WithLp 2 E ≃L[𝕜] Ehe:IsUniformEmbedding eCompleteSpace (WithLp 2 E) 𝕜:Type u_1inst✝⁹:RCLike 𝕜E:Type u_2inst✝⁸:NormedAddCommGroup Einst✝⁷:NormedSpace 𝕜 EhE:InnerProductSpace' 𝕜 EF:Type u_3inst✝⁶:NormedAddCommGroup Finst✝⁵:NormedSpace 𝕜 Finst✝⁴:InnerProductSpace' 𝕜 FG:Type u_4inst✝³:NormedAddCommGroup Ginst✝²:NormedSpace 𝕜 Ginst✝¹:InnerProductSpace' 𝕜 Ginst✝:CompleteSpace Ee:WithLp 2 E ≃L[𝕜] Ehe:IsUniformEmbedding eCompleteSpace E All goals completed! 🐙lemma ext_inner_left' {x y : E} (h : v, v, x = v, y) : x = y := (WithLp.equiv 2 E).symm.injective <| ext_inner_left (E := WithLp 2 E) 𝕜 <| 𝕜:Type u_1inst✝²:RCLike 𝕜E:Type u_2inst✝¹:NormedAddCommGroup Einst✝:NormedSpace 𝕜 EhE:InnerProductSpace' 𝕜 Ex:Ey:Eh: (v : E), v, x = v, y (v : WithLp 2 E), v, (WithLp.equiv 2 E).symm x = v, (WithLp.equiv 2 E).symm y All goals completed! 🐙@[simp] lemma inner_conj_symm' (x y : E) : y, x = x, y := inner_conj_symm (E:=WithLp 2 E) _ _lemma inner_smul_left' (x y : E) (r : 𝕜) : r x, y = r * x, y := inner_smul_left (E:=WithLp 2 E) _ _ rlemma inner_smul_right' (x y : E) (r : 𝕜) : x, r y = r * x, y := inner_smul_right (E:=WithLp 2 E) _ _ r@[simp] lemma inner_zero_left' (x : E) : 0, x = 0 := inner_zero_left (E:=WithLp 2 E) _@[simp] lemma inner_zero_right' (x : E) : x, 0 = 0 := inner_zero_right (E:=WithLp 2 E) _lemma inner_add_left' (x y z : E) : x + y, z = x, z + y, z := inner_add_left (E:=WithLp 2 E) _ _ _lemma inner_add_right' (x y z : E) : x, y + z = x, y + x, z := inner_add_right (E:=WithLp 2 E) _ _ _lemma inner_sub_left' (x y z : E) : x - y, z = x, z - y, z := inner_sub_left (E:=WithLp 2 E) _ _ _lemma inner_sub_right' (x y z : E) : x, y - z = x, y - x, z := inner_sub_right (E:=WithLp 2 E) _ _ _@[simp] lemma inner_neg_left' (x y : E) : -x, y = -x, y := inner_neg_left (E:=WithLp 2 E) _ _@[simp] lemma inner_neg_right' (x y : E) : x, -y = -x, y := inner_neg_right (E:=WithLp 2 E) _ _All goals completed! 🐙@[simp] lemma inner_sum'{ι : Type*} [Fintype ι] (x : E) (g : ι E) : x, i, g i = i, x, g i := map_sum (AddMonoidHom.mk' (fun y => x, y) (inner_add_right' x)) g Finset.univ@[fun_prop] lemma Continuous.inner' {α} [TopologicalSpace α] (f g : α E) (hf : Continuous f) (hg : Continuous g) : Continuous (fun a => f a, g a) := Continuous.inner (𝕜 := 𝕜) (E := WithLp 2 E) (f := fun x => toL2 𝕜 (f x)) (g := fun x => toL2 𝕜 (g x)) (𝕜:Type u_1inst✝³:RCLike 𝕜E:Type u_2inst✝²:NormedAddCommGroup Einst✝¹:NormedSpace 𝕜 EhE:InnerProductSpace' 𝕜 Eα:Type u_5inst✝:TopologicalSpace αf:α Eg:α Ehf:Continuous fhg:Continuous gContinuous fun x => (toL2 𝕜) (f x) All goals completed! 🐙) (𝕜:Type u_1inst✝³:RCLike 𝕜E:Type u_2inst✝²:NormedAddCommGroup Einst✝¹:NormedSpace 𝕜 EhE:InnerProductSpace' 𝕜 Eα:Type u_5inst✝:TopologicalSpace αf:α Eg:α Ehf:Continuous fhg:Continuous gContinuous fun x => (toL2 𝕜) (g x) All goals completed! 🐙)local notation "⟪" x ", " y "⟫" => inner x ylemma real_inner_self_nonneg' {x : F} : 0 re (x, x) := real_inner_self_nonneg (F:=WithLp 2 F)lemma real_inner_comm' (x y : F) : y, x = x, y := real_inner_comm (F:=WithLp 2 F) _ _@[fun_prop] lemma ContDiffAt.inner' {f g : E F} {x : E} (hf : ContDiffAt n f x) (hg : ContDiffAt n g x) : ContDiffAt n (fun x => f x, g x) x := ContDiffAt.inner (f := fun x => toL2 (f x)) (g := fun x => toL2 (g x)) (E:Type u_5inst✝⁴:NormedAddCommGroup Einst✝³:NormedSpace EF:Type u_6inst✝²:NormedAddCommGroup Finst✝¹:NormedSpace Finst✝:InnerProductSpace' Fn:WithTop ℕ∞f:E Fg:E Fx:Ehf:ContDiffAt n f xhg:ContDiffAt n g xContDiffAt n (fun x => (toL2 ) (f x)) x All goals completed! 🐙) (E:Type u_5inst✝⁴:NormedAddCommGroup Einst✝³:NormedSpace EF:Type u_6inst✝²:NormedAddCommGroup Finst✝¹:NormedSpace Finst✝:InnerProductSpace' Fn:WithTop ℕ∞f:E Fg:E Fx:Ehf:ContDiffAt n f xhg:ContDiffAt n g xContDiffAt n (fun x => (toL2 ) (g x)) x All goals completed! 🐙)@[fun_prop] lemma ContDiff.inner' {f g : E F} (hf : ContDiff n f) (hg : ContDiff n g) : ContDiff n (fun x => f x, g x) := ContDiff.inner (f := fun x => toL2 (f x)) (g := fun x => toL2 (g x)) (E:Type u_5inst✝⁴:NormedAddCommGroup Einst✝³:NormedSpace EF:Type u_6inst✝²:NormedAddCommGroup Finst✝¹:NormedSpace Finst✝:InnerProductSpace' Fn:ℕ∞ωf:E Fg:E Fhf:ContDiff n fhg:ContDiff n gContDiff n fun x => (toL2 ) (f x) All goals completed! 🐙) (E:Type u_5inst✝⁴:NormedAddCommGroup Einst✝³:NormedSpace EF:Type u_6inst✝²:NormedAddCommGroup Finst✝¹:NormedSpace Finst✝:InnerProductSpace' Fn:ℕ∞ωf:E Fg:E Fhf:ContDiff n fhg:ContDiff n gContDiff n fun x => (toL2 ) (g x) All goals completed! 🐙)local notation "⟪" x ", " y "⟫" => inner 𝕜 x y

Inner product on product types E×F defined as ⟪x,y⟫ = ⟪x.fst,y.fst⟫ + ⟪x.snd,y.snd⟫.

This is just local instance as it is superseded by the following instance for InnerProductSpace'.

local instance : Inner 𝕜 (E×F) := fun (x,y) (x',y') => x,x' + y,y'
@[simp] lemma prod_inner_apply' (x y : (E × F)) : x, y = x.fst, y.fst + x.snd, y.snd := rfllocal notation "⟪" x ", " y "⟫" => inner x yE:Type u_5inst✝¹:NormedAddCommGroup Einst✝:NormedSpace EhE:InnerProductSpace' Ec:d:hc:0 < chd:0 < dh: (x : E), c * x ^ 2 x, x x, x d * x ^ 2x:Ey:Ekey: (z : E), |z‖₂| d * zh1:|x‖₂| d * xh2:|y‖₂| d * yd * (x * y) = d * x * y All goals completed! 🐙