Skip to content

Commit

Permalink
chore(analysis/inner_product_space/basic): adjust decidability assump…
Browse files Browse the repository at this point in the history
…tions (#11212)

Eliminate the `open_locale classical` in `inner_product_space.basic` and replace by specific decidability assumptions.
  • Loading branch information
hrmacbeth committed Jan 4, 2022
1 parent 49cbce2 commit 692b6b7
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions src/analysis/inner_product_space/basic.lean
Expand Up @@ -14,7 +14,7 @@ import linear_algebra.sesquilinear_form
This file defines inner product spaces and proves the basic properties. We do not formally
define Hilbert spaces, but they can be obtained using the pair of assumptions
`[inner_product_space E] [complete_space E]`.
`[inner_product_space 𝕜 E] [complete_space E]`.
An inner product space is a vector space endowed with an inner product. It generalizes the notion of
dot product in `ℝ^n` and provides the means of defining the length of a vector and the angle between
Expand Down Expand Up @@ -69,7 +69,7 @@ The Coq code is available at the following address: <http://www.lri.fr/~sboldo/e
noncomputable theory

open is_R_or_C real filter
open_locale big_operators classical topological_space complex_conjugate
open_locale big_operators topological_space complex_conjugate

variables {𝕜 E F : Type*} [is_R_or_C 𝕜]

Expand Down Expand Up @@ -381,6 +381,7 @@ end
/-! ### Properties of inner product spaces -/

variables [inner_product_space 𝕜 E] [inner_product_space ℝ F]
variables [dec_E : decidable_eq E]
local notation `⟪`x`, `y`⟫` := @inner 𝕜 _ _ x y
local notation `IK` := @is_R_or_C.I 𝕜 _
local notation `absR` := has_abs.abs
Expand Down Expand Up @@ -667,7 +668,7 @@ end
end basic_properties

section orthonormal_sets
variables {ι : Type*} (𝕜)
variables {ι : Type*} [dec_ι : decidable_eq ι] (𝕜)

include 𝕜

Expand All @@ -679,6 +680,7 @@ omit 𝕜

variables {𝕜}

include dec_ι
/-- `if ... then ... else` characterization of an indexed set of vectors being orthonormal. (Inner
product equals Kronecker delta.) -/
lemma orthonormal_iff_ite {v : ι → E} :
Expand All @@ -699,7 +701,9 @@ begin
{ intros i j hij,
simpa [hij] using h i j } }
end
omit dec_ι

include dec_E
/-- `if ... then ... else` characterization of a set of vectors being orthonormal. (Inner product
equals Kronecker delta.) -/
theorem orthonormal_subtype_iff_ite {s : set E} :
Expand All @@ -715,19 +719,20 @@ begin
convert h v hv w hw using 1,
simp }
end
omit dec_E

/-- The inner product of a linear combination of a set of orthonormal vectors with one of those
vectors picks out the coefficient of that vector. -/
lemma orthonormal.inner_right_finsupp {v : ι → E} (hv : orthonormal 𝕜 v) (l : ι →₀ 𝕜) (i : ι) :
⟪v i, finsupp.total ι E 𝕜 v l⟫ = l i :=
by simp [finsupp.total_apply, finsupp.inner_sum, orthonormal_iff_ite.mp hv]
by classical; simp [finsupp.total_apply, finsupp.inner_sum, orthonormal_iff_ite.mp hv]

/-- The inner product of a linear combination of a set of orthonormal vectors with one of those
vectors picks out the coefficient of that vector. -/
lemma orthonormal.inner_right_fintype [fintype ι]
{v : ι → E} (hv : orthonormal 𝕜 v) (l : ι → 𝕜) (i : ι) :
⟪v i, ∑ i : ι, (l i) • (v i)⟫ = l i :=
by simp [inner_sum, inner_smul_right, orthonormal_iff_ite.mp hv]
by classical; simp [inner_sum, inner_smul_right, orthonormal_iff_ite.mp hv]

/-- The inner product of a linear combination of a set of orthonormal vectors with one of those
vectors picks out the coefficient of that vector. -/
Expand All @@ -740,15 +745,15 @@ vectors picks out the coefficient of that vector. -/
lemma orthonormal.inner_left_fintype [fintype ι]
{v : ι → E} (hv : orthonormal 𝕜 v) (l : ι → 𝕜) (i : ι) :
⟪∑ i : ι, (l i) • (v i), v i⟫ = conj (l i) :=
by simp [sum_inner, inner_smul_left, orthonormal_iff_ite.mp hv]
by classical; simp [sum_inner, inner_smul_left, orthonormal_iff_ite.mp hv]

/--
The double sum of weighted inner products of pairs of vectors from an orthonormal sequence is the
sum of the weights.
-/
lemma orthonormal.inner_left_right_finset {s : finset ι} {v : ι → E} (hv : orthonormal 𝕜 v)
{a : ι → ι → 𝕜} : ∑ i in s, ∑ j in s, (a i j) • ⟪v j, v i⟫ = ∑ k in s, a k k :=
by simp [orthonormal_iff_ite.mp hv, finset.sum_ite_of_true]
by classical; simp [orthonormal_iff_ite.mp hv, finset.sum_ite_of_true]

/-- An orthonormal set is linearly independent. -/
lemma orthonormal.linear_independent {v : ι → E} (hv : orthonormal 𝕜 v) :
Expand All @@ -767,6 +772,7 @@ lemma orthonormal.comp
{ι' : Type*} {v : ι → E} (hv : orthonormal 𝕜 v) (f : ι' → ι) (hf : function.injective f) :
orthonormal 𝕜 (v ∘ f) :=
begin
classical,
rw orthonormal_iff_ite at ⊢ hv,
intros i j,
convert hv (f i) (f j) using 1,
Expand All @@ -789,6 +795,7 @@ the corresponding vector in the original family or its negation. -/
lemma orthonormal.orthonormal_of_forall_eq_or_eq_neg {v w : ι → E} (hv : orthonormal 𝕜 v)
(hw : ∀ i, w i = v i ∨ w i = -(v i)) : orthonormal 𝕜 w :=
begin
classical,
rw orthonormal_iff_ite at *,
intros i j,
cases hw i with hi hi; cases hw j with hj hj; split_ifs with h;
Expand All @@ -801,13 +808,14 @@ adapted from the corresponding development of the theory of linearly independent

variables (𝕜 E)
lemma orthonormal_empty : orthonormal 𝕜 (λ x, x : (∅ : set E) → E) :=
by simp [orthonormal_subtype_iff_ite]
by classical; simp [orthonormal_subtype_iff_ite]
variables {𝕜 E}

lemma orthonormal_Union_of_directed
{η : Type*} {s : η → set E} (hs : directed (⊆) s) (h : ∀ i, orthonormal 𝕜 (λ x, x : s i → E)) :
orthonormal 𝕜 (λ x, x : (⋃ i, s i) → E) :=
begin
classical,
rw orthonormal_subtype_iff_ite,
rintros x ⟨_, ⟨i, rfl⟩, hxi⟩ y ⟨_, ⟨j, rfl⟩, hyj⟩,
obtain ⟨k, hik, hjk⟩ := hs i j,
Expand Down Expand Up @@ -1569,7 +1577,7 @@ open_locale direct_sum
def orthogonal_family (V : ι → submodule 𝕜 E) : Prop :=
∀ ⦃i j⦄, i ≠ j → ∀ {v : E} (hv : v ∈ V i) {w : E} (hw : w ∈ V j), ⟪v, w⟫ = 0

variables {𝕜} {V : ι → submodule 𝕜 E}
variables {𝕜} {V : ι → submodule 𝕜 E} [dec_V : Π i (x : V i), decidable (x ≠ 0)]

include dec_ι
lemma orthogonal_family.eq_ite (hV : orthogonal_family 𝕜 V) {i j : ι} (v : V i) (w : V j) :
Expand All @@ -1580,6 +1588,7 @@ begin
{ exact hV h v.prop w.prop }
end

include dec_V
lemma orthogonal_family.inner_right_dfinsupp (hV : orthogonal_family 𝕜 V)
(l : Π₀ i, V i) (i : ι) (v : V i) :
⟪(v : E), dfinsupp.lsum ℕ (λ i, (V i).subtype) l⟫ = ⟪v, l i⟫ :=
Expand All @@ -1604,11 +1613,12 @@ begin
intros h,
simp [h]
end
omit dec_ι
omit dec_ι dec_V

lemma orthogonal_family.inner_right_fintype
[fintype ι] (hV : orthogonal_family 𝕜 V) (l : Π i, V i) (i : ι) (v : V i) :
⟪(v : E), ∑ j : ι, l j⟫ = ⟪v, l i⟫ :=
by classical;
calc ⟪(v : E), ∑ j : ι, l j⟫
= ∑ j : ι, ⟪(v : E), l j⟫: by rw inner_sum
... = ∑ j, ite (i = j) ⟪(v : E), l j⟫ 0 :
Expand All @@ -1621,6 +1631,7 @@ pairwise intersections of elements of the family are 0. -/
lemma orthogonal_family.independent (hV : orthogonal_family 𝕜 V) :
complete_lattice.independent V :=
begin
classical,
apply complete_lattice.independent_of_dfinsupp_lsum_injective,
rw [← @linear_map.ker_eq_bot _ _ _ _ _ _ (direct_sum.add_comm_group (λ i, V i)),
submodule.eq_bot_iff],
Expand Down

0 comments on commit 692b6b7

Please sign in to comment.