Eine aufbereitete Darstellung der Quelle

 
     
 
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung


Quelle  Inner.lean   Sprache: Lean

 

/-
Copyright (c) 2023 Yaël Dilies. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yaël Dilies
-/

module

public import Mathlib.Analysis.InnerProductSpace.PiL2

/-!
# L2 inner product of finite sequences

This file defines the weighted L2 inner product of functions `f g : ι → R` where `ι` is a fintype as
`∑ i, conj (f i) * g i`. This convention (conjugation on the left) matches the inner product coming
from `RCLike.innerProductSpace`.

## TODO

* Build a non-instance `InnerProductSpace` from `wInner`.
* `cWeight` is a poor name. Can we find better? It doesn't hugely matter for typing, since it's
  hidden behind the `⟪f, g⟫ₙ_[��]` notation, but it does show up in lemma names
  `⟪f, g⟫_[��, cWeight]` is called `wInner_cWeight`. Maybe we should introduce some naming
  convention, similarly to `MeasureTheory.average`?
-/


public section

open Finset Function WithLp
open scoped BigOperators ComplexConjugate ComplexOrder InnerProductSpace

variable {ι κ �� : Type*} {E : ι → Type*} [Fintype ι]

namespace RCLike
variable [RCLike ��]

section Pi
variable [∀ i, SeminormedAddCommGroup (E i)] [∀ i, InnerProductSpace �� (E i)] {w : ι → ℝ}

/-- Weighted inner product giving rise to the L2 norm, denoted as `⟪g, f⟫_[��, w]`. -/
def wInner (w : ι → ℝ) (f g : ∀ i, E i) : �� := ∑ i, w i • ⟪f i, g i⟫_��

/-- The weight function making `wInner` into the compact inner product. -/
noncomputable abbrev cWeight : ι → ℝ := Function.const _ (Fintype.card ι)⁻¹

@[inherit_doc wInner] notation3 "⟪" f ", " g "⟫_[" �� ", " w "]" => wInner (�� := ��) w f g

/-- Discrete inner product giving rise to the discrete L2 norm. -/
notation3 "⟪" f ", " g "⟫_[" �� "]" => ⟪f, g⟫_[��, 1]

/-- Compact inner product giving rise to the compact L2 norm. -/
notation3 "⟪" f ", " g "⟫ₙ_[" �� "]" => ⟪f, g⟫_[��, cWeight]

lemma wInner_cWeight_eq_smul_wInner_one (f g : ∀ i, E i) :
    ⟪f, g⟫ₙ_[��] = (Fintype.card ι : ℚ≥0)⁻¹ • ⟪f, g⟫_[��] := by
  simp [wInner, smul_sum, ← NNRat.cast_smul_eq_nnqsmul ℝ]

@[simp] lemma conj_wInner_symm (w : ι → ℝ) (f g : ∀ i, E i) :
    conj ⟪f, g⟫_[��, w] = ⟪g, f⟫_[��, w] := by
  simp [wInner, map_sum, inner_conj_symm, rclike_simps]

@[simp] lemma wInner_zero_left (w : ι → ℝ) (g : ∀ i, E i) : ⟪0, g⟫_[��, w] = 0 := by simp [wInner]
@[simp] lemma wInner_zero_right (w : ι → ℝ) (f : ∀ i, E i) : ⟪f, 0⟫_[��, w] = 0 := by simp [wInner]

lemma wInner_add_left (w : ι → ℝ) (f₁ f₂ g : ∀ i, E i) :
    ⟪f₁ + f₂, g⟫_[��, w] = ⟪f₁, g⟫_[��, w] + ⟪f₂, g⟫_[��, w] := by
  simp [wInner, inner_add_left, smul_add, sum_add_distrib]

lemma wInner_add_right (w : ι → ℝ) (f g₁ g₂ : ∀ i, E i) :
    ⟪f, g₁ + g₂⟫_[��, w] = ⟪f, g₁⟫_[��, w] + ⟪f, g₂⟫_[��, w] := by
  simp [wInner, inner_add_right, smul_add, sum_add_distrib]

@[simp] lemma wInner_neg_left (w : ι → ℝ) (f g : ∀ i, E i) : ⟪-f, g⟫_[��, w] = -⟪f, g⟫_[��, w] := by
  simp [wInner]

@[simp] lemma wInner_neg_right (w : ι → ℝ) (f g : ∀ i, E i) : ⟪f, -g⟫_[��, w] = -⟪f, g⟫_[��, w] := by
  simp [wInner]

lemma wInner_sub_left (w : ι → ℝ) (f₁ f₂ g : ∀ i, E i) :
    ⟪f₁ - f₂, g⟫_[��, w] = ⟪f₁, g⟫_[��, w] - ⟪f₂, g⟫_[��, w] := by
  simp_rw [sub_eq_add_neg, wInner_add_left, wInner_neg_left]

lemma wInner_sub_right (w : ι → ℝ) (f g₁ g₂ : ∀ i, E i) :
    ⟪f, g₁ - g₂⟫_[��, w] = ⟪f, g₁⟫_[��, w] - ⟪f, g₂⟫_[��, w] := by
  simp_rw [sub_eq_add_neg, wInner_add_right, wInner_neg_right]

@[simp] lemma wInner_of_isEmpty [IsEmpty ι] (w : ι → ℝ) (f g : ∀ i, E i) : ⟪f, g⟫_[��, w] = 0 := by
  simp [Subsingleton.elim f 0]

lemma wInner_smul_left {�� : Type*} [CommSemiring ��] [StarRing ��] [Algebra �� ��] [StarModule �� ��]
    [∀ i, Module �� (E i)] [∀ i, IsScalarTower �� �� (E i)] (c : ��)
    (w : ι → ℝ) (f g : ∀ i, E i) : ⟪c • f, g⟫_[��, w] = star c • ⟪f, g⟫_[��, w] := by
  simp_rw [wInner, Pi.smul_apply, inner_smul_left_eq_star_smul, starRingEnd_apply, smul_sum,
    smul_comm (w _)]

lemma wInner_smul_right {�� : Type*} [CommSemiring ��] [StarRing ��] [Algebra �� ��] [StarModule �� ��]
    [∀ i, Module �� (E i)] [∀ i, IsScalarTower �� �� (E i)] (c : ��)
    (w : ι → ℝ) (f g : ∀ i, E i) : ⟪f, c • g⟫_[��, w] = c • ⟪f, g⟫_[��, w] := by
  simp_rw [wInner, Pi.smul_apply, inner_smul_right_eq_smul, smul_sum, smul_comm c]

lemma mul_wInner_left (c : ��) (w : ι → ℝ) (f g : ∀ i, E i) :
    c * ⟪f, g⟫_[��, w] = ⟪star c • f, g⟫_[��, w] := by rw [wInner_smul_left, star_star, smul_eq_mul]

lemma wInner_one_eq_sum (f g : ∀ i, E i) : ⟪f, g⟫_[��] = ∑ i, ⟪f i, g i⟫_�� := by simp [wInner]
lemma wInner_cWeight_eq_expect (f g : ∀ i, E i) : ⟪f, g⟫ₙ_[��] = �� i, ⟪f i, g i⟫_�� := by
  simp [wInner, expect, smul_sum, ← NNRat.cast_smul_eq_nnqsmul ℝ]

end Pi

section Function
variable {w : ι → ℝ} {f g : ι → ��}

lemma wInner_const_left (a : ��) (f : ι → ��) :
    ⟪const _ a, f⟫_[��, w] = (∑ i, w i • f i) * conj a := by simp [wInner, const_apply, sum_mul]

lemma wInner_const_right (f : ι → ��) (a : ��) :
    ⟪f, const _ a⟫_[��, w] = a * (∑ i, w i • conj (f i)) := by simp [wInner, const_apply, mul_sum]

@[simp] lemma wInner_one_const_left (a : ��) (f : ι → ��) :
    ⟪const _ a, f⟫_[��] = (∑ i, f i) * conj a := by simp [wInner_one_eq_sum, sum_mul]

@[simp] lemma wInner_one_const_right (f : ι → ��) (a : ��) :
    ⟪f, const _ a⟫_[��] = a * (∑ i, conj (f i)) := by simp [wInner_one_eq_sum, mul_sum]

@[simp] lemma wInner_cWeight_const_left (a : ��) (f : ι → ��) :
    ⟪const _ a, f⟫ₙ_[��] = �� i, f i * conj a := by simp [wInner_cWeight_eq_expect]

@[simp] lemma wInner_cWeight_const_right (f : ι → ��) (a : ��) :
    ⟪f, const _ a⟫ₙ_[��] = a * (�� i, conj (f i)) := by simp [wInner_cWeight_eq_expect, mul_expect]

lemma wInner_one_eq_inner (f g : ι → ��) :
    ⟪f, g⟫_[��, 1] = ⟪toLp 2 f, toLp 2 g⟫_�� := by
  simp [PiLp.inner_apply, wInner]

lemma inner_eq_wInner_one (f g : PiLp 2 fun _i : ι ↦ ��) :
    ⟪f, g⟫_�� = ⟪ofLp f, ofLp g⟫_[��, 1] := by
  simp [PiLp.inner_apply, wInner]

lemma linearIndependent_of_ne_zero_of_wInner_one_eq_zero {f : κ → ι → ��} (hf : ∀ k, f k ≠ 0)
    (hinner : Pairwise fun k₁ k₂ ↦ ⟪f k₁, f k₂⟫_[��] = 0) : LinearIndependent �� f := by
  simp_rw [wInner_one_eq_inner] at hinner
  have := linearIndependent_of_ne_zero_of_inner_eq_zero ?_ hinner
  exacts [(WithLp.linearEquiv 2 �� (ι → ��)).symm.toLinearMap.linearIndependent_iff_of_injOn
    (toLp_injective 2).injOn |>.1 this, fun i ↦ (toLp_eq_zero 2).ne.2 (hf i)]

lemma linearIndependent_of_ne_zero_of_wInner_cWeight_eq_zero {f : κ → ι → ��} (hf : ∀ k, f k ≠ 0)
    (hinner : Pairwise fun k₁ k₂ ↦ ⟪f k₁, f k₂⟫ₙ_[��] = 0) : LinearIndependent �� f := by
  cases isEmpty_or_nonempty ι
  · have : IsEmpty κ := ⟨fun k ↦ hf k <| Subsingleton.elim ..⟩
    exact linearIndependent_empty_type
  · exact linearIndependent_of_ne_zero_of_wInner_one_eq_zero hf <| by
      simpa [wInner_cWeight_eq_smul_wInner_one, ← NNRat.cast_smul_eq_nnqsmul ��] using hinner

lemma wInner_nonneg (hw : 0 ≤ w) (hf : 0 ≤ f) (hg : 0 ≤ g) : 0 ≤ ⟪f, g⟫_[��, w] :=
  sum_nonneg fun _ _ ↦ smul_nonneg (hw _) <| mul_nonneg (hg _) (star_nonneg_iff.2 (hf _))

lemma norm_wInner_le (hw : 0 ≤ w) : ‖⟪f, g⟫_[��, w]‖ ≤ ⟪fun i ↦ ‖f i‖, fun i ↦ ‖g i‖⟫_[ℝ, w] :=
  (norm_sum_le ..).trans_eq <| sum_congr rfl fun i _ ↦ by
    simp [Algebra.smul_def, norm_mul, abs_of_nonneg (hw i)]

end Function

section Real
variable {w f g : ι → ℝ}

lemma abs_wInner_le (hw : 0 ≤ w) : |⟪f, g⟫_[ℝ, w]| ≤ ⟪|f|, |g|⟫_[ℝ, w] := by
  simpa using! norm_wInner_le (�� := ℝ) hw

end Real
end RCLike

Messung
CHZG
9110010096

¤ Dauer der Verarbeitung: 0.1 Sekunden  (vorverarbeitet am  2026-11-24) ¤

*© Formatika GbR, Deutschland







                                                                                                                                                                                                                                                                                                                                                                                                     

 

Neuigkeiten

Aktuelles
Motto des Tages

Open Source Software


Gedichte
Musik
Bilder

Jenseits des Üblichen

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1,188,137
#Domains=863,959