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

Quelle  OfNorm.lean   Sprache: Lean

 

/-
Copyright (c) 2020 Heather Macbeth. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Heather Macbeth
-/

module

public import Mathlib.Analysis.InnerProductSpace.Convex

import Mathlib.Algebra.Module.LinearMap.Rat

/-!
# Inner product space derived from a norm

This file defines an `InnerProductSpace` instance from a norm that respects the
parallelogram identity. The parallelogram identity is a way to express the inner product of `x` and
`y` in terms of the norms of `x`, `y`, `x + y`, `x - y`.

## Main results

- `InnerProductSpace.ofNorm`: a normed space whose norm respects the parallelogram identity,
  can be seen as an inner product space.

## Implementation notes

We define `inner_`

$$\langle x, y \rangle := \frac{1}{4} (‖x + y‖^2 - ‖x - y‖^2 + i ‖ix + y‖ ^ 2 - i ‖ix - y‖^2)$$

and use the parallelogram identity

$$‖x + y‖^2 + ‖x - y‖^2 = 2 (‖x‖^2 + ‖y‖^2)$$

to prove it is an inner product, i.e., that it is conjugate-symmetric (`inner_.conj_symm`) and
linear in the first argument. `add_left` is proved by judicious application of the parallelogram
identity followed by tedious arithmetic. `smul_left` is proved step by step, first noting that
$\langle λ x, y \rangle = λ \langle x, y \rangle$ for $λ ∈ ℕ$, $λ = -1$, hence $λ ∈ ℤ$ and $λ ∈ ℚ$
by arithmetic. Then by continuity and the fact that ℚ is dense in ℝ, the same is true for ℝ.
The case of ℂ then follows by applying the result for ℝ and more arithmetic.

## TODO

Move upstream to `Analysis.InnerProductSpace.Basic`.

## References

- [Jordan, P. and von Neumann, J., *On inner products in linear, metric spaces*][Jordan1935]
- https://math.stackexchange.com/questions/21792/norms-induced-by-inner-products-and-the-parallelogram-law
- https://math.dartmouth.edu/archive/m113w10/public_html/jordan-vneumann-thm.pdf

## Tags

inner product space, Hilbert space, norm
-/


@[expose] public section


open RCLike

open scoped ComplexConjugate

variable {�� : Type*} [RCLike ��] (E : Type*) [NormedAddCommGroup E]

/-- Predicate for the parallelogram identity to hold in a normed group. This is a scalar-less
version of `InnerProductSpace`. If you have an `InnerProductSpaceable` assumption, you can
locally upgrade that to `InnerProductSpace �� E` using `casesI nonempty_innerProductSpace �� E`.
-/

class InnerProductSpaceable : Prop where
  parallelogram_identity :
    ∀ x y : E, ‖x + y‖ * ‖x + y‖ + ‖x - y‖ * ‖x - y‖ = 2 * (‖x‖ * ‖x‖ + ‖y‖ * ‖y‖)

variable (��) {E}

theorem InnerProductSpace.toInnerProductSpaceable [InnerProductSpace �� E] :
    InnerProductSpaceable E :=
  ⟨parallelogram_law_with_norm_mul ��⟩

-- See note [lower instance priority]
instance (priority := 100) InnerProductSpace.toInnerProductSpaceable_ofReal
    [InnerProductSpace ℝ E] : InnerProductSpaceable E :=
  ⟨parallelogram_law_with_norm_mul ℝ⟩

variable [NormedSpace �� E]

local notation "��" => algebraMap ℝ ��

set_option backward.privateInPublic true in
/-- Auxiliary definition of the inner product derived from the norm. -/
private noncomputable def inner_ (x y : E) : �� :=
  4⁻¹ * (�� ‖x + y‖ * �� ‖x + y‖ - �� ‖x - y‖ * �� ‖x - y‖ +
    (I : ��) * �� ‖(I : ��) • x + y‖ * �� ‖(I : ��) • x + y‖ -
    (I : ��) * �� ‖(I : ��) • x - y‖ * �� ‖(I : ��) • x - y‖)

namespace InnerProductSpaceable

variable {��} (E)

set_option backward.privateInPublic true in
-- This has a prime added to avoid clashing with public `innerProp`
/-- Auxiliary definition for the `add_left` property. -/
private def innerProp' (r : ��) : Prop :=
  ∀ x y : E, inner_ �� (r • x) y = conj r * inner_ �� x y

variable {E}

set_option backward.privateInPublic true in
set_option backward.privateInPublic.warn false in
theorem _root_.Continuous.inner_ {f g : ℝ → E} (hf : Continuous f) (hg : Continuous g) :
    Continuous fun x => inner_ �� (f x) (g x) := by
  unfold _root_.inner_
  fun_prop

set_option backward.privateInPublic true in
set_option backward.privateInPublic.warn false in
theorem inner_.norm_sq (x : E) : ‖x‖ ^ 2 = re (inner_ �� x x) := by
  simp only [inner_, normSq_apply, ofNat_re, ofNat_im, map_sub, map_add,
    ofReal_re, ofReal_im, mul_re, inv_re, mul_im, I_re, inv_im]
  have h₁ : ‖x - x‖ = 0 := by simp
  have h₂ : ‖x + x‖ = 2 • ‖x‖ := by convert norm_nsmul �� 2 x; module
  rw [h₁, h₂]
  ring

set_option backward.privateInPublic true in
set_option backward.privateInPublic.warn false in
theorem inner_.conj_symm (x y : E) : conj (inner_ �� y x) = inner_ �� x y := by
  simp only [inner_, map_sub, map_add, map_mul, map_inv₀, map_ofNat, conj_ofReal, conj_I]
  rw [add_comm y x, norm_sub_rev]
  by_cases hI : (I : ��) = 0
  · simp only [hI, neg_zero, zero_mul]
  have hI' := I_mul_I_of_ne_zero hI
  have I_smul (v : E) : ‖(I : ��) • v‖ = ‖v‖ := by rw [norm_smul, norm_I_of_ne_zero hI, one_mul]
  have h₁ : ‖(I : ��) • y - x‖ = ‖(I : ��) • x + y‖ := by
    convert I_smul ((I : ��) • x + y)
    linear_combination (norm := module) -hI' • x
  have h₂ : ‖(I : ��) • y + x‖ = ‖(I : ��) • x - y‖ := by
    convert (I_smul ((I : ��) • y + x)).symm
    linear_combination (norm := module) -hI' • y
  rw [h₁, h₂]
  ring

variable [InnerProductSpaceable E]

set_option backward.privateInPublic true in
set_option backward.privateInPublic.warn false in
theorem add_left (x y z : E) : inner_ �� (x + y) z = inner_ �� x z + inner_ �� y z := by
  unfold inner_
  have h1 := parallelogram_identity (x + y + z) (x - z)
  have h2 := parallelogram_identity (x + y - z) (x + z)
  have h3 := parallelogram_identity (y + z) z
  have h4 := parallelogram_identity (y - z) z
  have h5 := parallelogram_identity ((I : ��) • (x + y) + z) ((I : ��) • x - z)
  have h6 := parallelogram_identity ((I : ��) • (x + y) - z) ((I : ��) • x + z)
  have h7 := parallelogram_identity ((I : ��) • y + z) z
  have h8 := parallelogram_identity ((I : ��) • y - z) z
  apply_fun �� at h1 h2 h3 h4 h5 h6 h7 h8
  simp only [map_add, map_mul, map_ofNat] at *
  module_nf with �� at *
  linear_combination (- h1 + h2 + h3 - h4 + I * (- h5 + h6 + h7 - h8)) / 8

private theorem rat_prop (r : ℚ) : innerProp' E (r : ��) := by
  intro x y
  let hom : �� →ₗ[ℚ] �� := AddMonoidHom.toRatLinearMap <|
    AddMonoidHom.mk' (fun r ↦ inner_ �� (r • x) y) <| fun a b ↦ by
      simpa [add_smul] using add_left (a • x) (b • x) y
  simpa [hom, Rat.smul_def] using map_smul hom r 1

private theorem real_prop (r : ℝ) : innerProp' E (r : ��) := by
  intro x y
  revert r
  rw [← funext_iff]
  refine Rat.isDenseEmbedding_coe_real.dense.equalizer ?_ ?_ (funext fun X => ?_)
  · exact (continuous_ofReal.smul continuous_const).inner_ continuous_const
  · exact (continuous_conj.comp continuous_ofReal).mul continuous_const
  · simp only [Function.comp_apply, RCLike.ofReal_ratCast, rat_prop _ _]

private theorem I_prop : innerProp' E (I : ��) := by
  by_cases hI : (I : ��) = 0
  · rw [hI]
    simpa using real_prop (�� := ��) 0
  intro x y
  have hI' := I_mul_I_of_ne_zero hI
  rw [conj_I, inner_, inner_, mul_left_comm, smul_smul, hI', neg_one_smul]
  have h₁ : ‖-x - y‖ = ‖x + y‖ := by rw [← neg_add', norm_neg]
  have h₂ : ‖-x + y‖ = ‖x - y‖ := by rw [← neg_sub, norm_neg, sub_eq_neg_add]
  rw [h₁, h₂]
  linear_combination (- �� ‖(I : ��) • x - y‖ ^ 2 + �� ‖(I : ��) • x + y‖ ^ 2) * hI' / 4

set_option backward.privateInPublic true in
set_option backward.privateInPublic.warn false in
theorem innerProp (r : ��) : innerProp' E r := by
  intro x y
  rw [← re_add_im r, add_smul, add_left, real_prop _ x, ← smul_smul, real_prop _ _ y, I_prop,
    map_add, map_mul, conj_ofReal, conj_ofReal, conj_I]
  ring

end InnerProductSpaceable

open InnerProductSpaceable

set_option backward.privateInPublic true in
set_option backward.privateInPublic.warn false in
/-- **Fréchet–von Neumann–Jordan Theorem**. A normed space `E` whose norm satisfies the
parallelogram identity can be given a compatible inner product. -/

@[instance_reducible]
noncomputable def InnerProductSpace.ofNorm
    (h : ∀ x y : E, ‖x + y‖ * ‖x + y‖ + ‖x - y‖ * ‖x - y‖ = 2 * (‖x‖ * ‖x‖ + ‖y‖ * ‖y‖)) :
    InnerProductSpace �� E :=
  haveI : InnerProductSpaceable E := ⟨h⟩
  { inner := inner_ ��
    norm_sq_eq_re_inner := inner_.norm_sq
    conj_inner_symm := inner_.conj_symm
    add_left := InnerProductSpaceable.add_left
    smul_left := fun _ _ _ => innerProp _ _ _ }

variable (E)
variable [InnerProductSpaceable E]

/-- **Fréchet–von Neumann–Jordan Theorem**. A normed space `E` whose norm satisfies the
parallelogram identity can be given a compatible inner product. Do
`casesI nonempty_innerProductSpace �� E` to locally upgrade `InnerProductSpaceable E` to
`InnerProductSpace �� E`. -/

theorem nonempty_innerProductSpace : Nonempty (InnerProductSpace �� E) :=
  ⟨{  inner := inner_ ��
      norm_sq_eq_re_inner := inner_.norm_sq
      conj_inner_symm := inner_.conj_symm
      add_left := add_left
      smul_left := fun _ _ _ => innerProp _ _ _ }⟩

variable {�� E}
variable [NormedSpace ℝ E]

-- TODO: Replace `InnerProductSpace.toUniformConvexSpace`
-- See note [lower instance priority]
instance (priority := 100) InnerProductSpaceable.to_uniformConvexSpace : UniformConvexSpace E := by
  cases nonempty_innerProductSpace ℝ E; infer_instance

Messung
CHZG
9310010097

¤ Dauer der Verarbeitung: 0.15 Sekunden  ¤

*© Formatika GbR, Deutschland