Datasets:
Tasks:
Text Generation
Modalities:
Text
Sub-tasks:
language-modeling
Languages:
English
Size:
100K - 1M
License:
File size: 16,925 Bytes
4365a98 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 |
/-
Copyright (c) 2020 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
import linear_algebra.quotient
import linear_algebra.prod
/-!
# Projection to a subspace
In this file we define
* `linear_proj_of_is_compl (p q : submodule R E) (h : is_compl p q)`: the projection of a module `E`
to a submodule `p` along its complement `q`; it is the unique linear map `f : E β p` such that
`f x = x` for `x β p` and `f x = 0` for `x β q`.
* `is_compl_equiv_proj p`: equivalence between submodules `q` such that `is_compl p q` and
projections `f : E β p`, `β x β p, f x = x`.
We also provide some lemmas justifying correctness of our definitions.
## Tags
projection, complement subspace
-/
section ring
variables {R : Type*} [ring R] {E : Type*} [add_comm_group E] [module R E]
{F : Type*} [add_comm_group F] [module R F]
{G : Type*} [add_comm_group G] [module R G] (p q : submodule R E)
variables {S : Type*} [semiring S] {M : Type*} [add_comm_monoid M] [module S M] (m : submodule S M)
noncomputable theory
namespace linear_map
variable {p}
open submodule
lemma ker_id_sub_eq_of_proj {f : E ββ[R] p} (hf : β x : p, f x = x) :
ker (id - p.subtype.comp f) = p :=
begin
ext x,
simp only [comp_apply, mem_ker, subtype_apply, sub_apply, id_apply, sub_eq_zero],
exact β¨Ξ» h, h.symm βΈ submodule.coe_mem _, Ξ» hx, by erw [hf β¨x, hxβ©, subtype.coe_mk]β©
end
lemma range_eq_of_proj {f : E ββ[R] p} (hf : β x : p, f x = x) :
range f = β€ :=
range_eq_top.2 $ Ξ» x, β¨x, hf xβ©
lemma is_compl_of_proj {f : E ββ[R] p} (hf : β x : p, f x = x) :
is_compl p f.ker :=
begin
split,
{ rintros x β¨hpx, hfxβ©,
erw [set_like.mem_coe, mem_ker, hf β¨x, hpxβ©, mk_eq_zero] at hfx,
simp only [hfx, set_like.mem_coe, zero_mem] },
{ intros x hx,
rw [mem_sup'],
refine β¨f x, β¨x - f x, _β©, add_sub_cancel'_right _ _β©,
rw [mem_ker, linear_map.map_sub, hf, sub_self] }
end
end linear_map
namespace submodule
open linear_map
/-- If `q` is a complement of `p`, then `M/p β q`. -/
def quotient_equiv_of_is_compl (h : is_compl p q) : (E β§Έ p) ββ[R] q :=
linear_equiv.symm $ linear_equiv.of_bijective (p.mkq.comp q.subtype)
(by simp only [β ker_eq_bot, ker_comp, ker_mkq, disjoint_iff_comap_eq_bot.1 h.symm.disjoint])
(by simp only [β range_eq_top, range_comp, range_subtype, map_mkq_eq_top, h.sup_eq_top])
@[simp] lemma quotient_equiv_of_is_compl_symm_apply (h : is_compl p q) (x : q) :
(quotient_equiv_of_is_compl p q h).symm x = quotient.mk x := rfl
@[simp] lemma quotient_equiv_of_is_compl_apply_mk_coe (h : is_compl p q) (x : q) :
quotient_equiv_of_is_compl p q h (quotient.mk x) = x :=
(quotient_equiv_of_is_compl p q h).apply_symm_apply x
@[simp] lemma mk_quotient_equiv_of_is_compl_apply (h : is_compl p q) (x : E β§Έ p) :
(quotient.mk (quotient_equiv_of_is_compl p q h x) : E β§Έ p) = x :=
(quotient_equiv_of_is_compl p q h).symm_apply_apply x
/-- If `q` is a complement of `p`, then `p Γ q` is isomorphic to `E`. It is the unique
linear map `f : E β p` such that `f x = x` for `x β p` and `f x = 0` for `x β q`. -/
def prod_equiv_of_is_compl (h : is_compl p q) : (p Γ q) ββ[R] E :=
begin
apply linear_equiv.of_bijective (p.subtype.coprod q.subtype),
{ simp only [βker_eq_bot, ker_eq_bot', prod.forall, subtype_apply, prod.mk_eq_zero, coprod_apply],
-- TODO: if I add `submodule.forall`, it unfolds the outer `β` but not the inner one.
rintros β¨x, hxβ© β¨y, hyβ©,
simp only [coe_mk, mk_eq_zero, β eq_neg_iff_add_eq_zero],
rintro rfl,
rw [neg_mem_iff] at hx,
simp [disjoint_def.1 h.disjoint y hx hy] },
{ rw [β range_eq_top, β sup_eq_range, h.sup_eq_top] }
end
@[simp] lemma coe_prod_equiv_of_is_compl (h : is_compl p q) :
(prod_equiv_of_is_compl p q h : (p Γ q) ββ[R] E) = p.subtype.coprod q.subtype := rfl
@[simp] lemma coe_prod_equiv_of_is_compl' (h : is_compl p q) (x : p Γ q) :
prod_equiv_of_is_compl p q h x = x.1 + x.2 := rfl
@[simp] lemma prod_equiv_of_is_compl_symm_apply_left (h : is_compl p q) (x : p) :
(prod_equiv_of_is_compl p q h).symm x = (x, 0) :=
(prod_equiv_of_is_compl p q h).symm_apply_eq.2 $ by simp
@[simp] lemma prod_equiv_of_is_compl_symm_apply_right (h : is_compl p q) (x : q) :
(prod_equiv_of_is_compl p q h).symm x = (0, x) :=
(prod_equiv_of_is_compl p q h).symm_apply_eq.2 $ by simp
@[simp] lemma prod_equiv_of_is_compl_symm_apply_fst_eq_zero (h : is_compl p q) {x : E} :
((prod_equiv_of_is_compl p q h).symm x).1 = 0 β x β q :=
begin
conv_rhs { rw [β (prod_equiv_of_is_compl p q h).apply_symm_apply x] },
rw [coe_prod_equiv_of_is_compl', submodule.add_mem_iff_left _ (submodule.coe_mem _),
mem_right_iff_eq_zero_of_disjoint h.disjoint]
end
@[simp] lemma prod_equiv_of_is_compl_symm_apply_snd_eq_zero (h : is_compl p q) {x : E} :
((prod_equiv_of_is_compl p q h).symm x).2 = 0 β x β p :=
begin
conv_rhs { rw [β (prod_equiv_of_is_compl p q h).apply_symm_apply x] },
rw [coe_prod_equiv_of_is_compl', submodule.add_mem_iff_right _ (submodule.coe_mem _),
mem_left_iff_eq_zero_of_disjoint h.disjoint]
end
@[simp]
lemma prod_comm_trans_prod_equiv_of_is_compl (h : is_compl p q) :
linear_equiv.prod_comm R q p βͺβ«β prod_equiv_of_is_compl p q h =
prod_equiv_of_is_compl q p h.symm :=
linear_equiv.ext $ Ξ» _, add_comm _ _
/-- Projection to a submodule along its complement. -/
def linear_proj_of_is_compl (h : is_compl p q) :
E ββ[R] p :=
(linear_map.fst R p q) ββ β(prod_equiv_of_is_compl p q h).symm
variables {p q}
@[simp] lemma linear_proj_of_is_compl_apply_left (h : is_compl p q) (x : p) :
linear_proj_of_is_compl p q h x = x :=
by simp [linear_proj_of_is_compl]
@[simp] lemma linear_proj_of_is_compl_range (h : is_compl p q) :
(linear_proj_of_is_compl p q h).range = β€ :=
range_eq_of_proj (linear_proj_of_is_compl_apply_left h)
@[simp] lemma linear_proj_of_is_compl_apply_eq_zero_iff (h : is_compl p q) {x : E} :
linear_proj_of_is_compl p q h x = 0 β x β q:=
by simp [linear_proj_of_is_compl]
lemma linear_proj_of_is_compl_apply_right' (h : is_compl p q) (x : E) (hx : x β q) :
linear_proj_of_is_compl p q h x = 0 :=
(linear_proj_of_is_compl_apply_eq_zero_iff h).2 hx
@[simp] lemma linear_proj_of_is_compl_apply_right (h : is_compl p q) (x : q) :
linear_proj_of_is_compl p q h x = 0 :=
linear_proj_of_is_compl_apply_right' h x x.2
@[simp] lemma linear_proj_of_is_compl_ker (h : is_compl p q) :
(linear_proj_of_is_compl p q h).ker = q :=
ext $ Ξ» x, mem_ker.trans (linear_proj_of_is_compl_apply_eq_zero_iff h)
lemma linear_proj_of_is_compl_comp_subtype (h : is_compl p q) :
(linear_proj_of_is_compl p q h).comp p.subtype = id :=
linear_map.ext $ linear_proj_of_is_compl_apply_left h
lemma linear_proj_of_is_compl_idempotent (h : is_compl p q) (x : E) :
linear_proj_of_is_compl p q h (linear_proj_of_is_compl p q h x) =
linear_proj_of_is_compl p q h x :=
linear_proj_of_is_compl_apply_left h _
lemma exists_unique_add_of_is_compl_prod (hc : is_compl p q) (x : E) :
β! (u : p Γ q), (u.fst : E) + u.snd = x :=
(prod_equiv_of_is_compl _ _ hc).to_equiv.bijective.exists_unique _
lemma exists_unique_add_of_is_compl (hc : is_compl p q) (x : E) :
β (u : p) (v : q), ((u : E) + v = x β§ β (r : p) (s : q),
(r : E) + s = x β r = u β§ s = v) :=
let β¨u, huβ, huββ© := exists_unique_add_of_is_compl_prod hc x in
β¨u.1, u.2, huβ, Ξ» r s hrs, prod.eq_iff_fst_eq_snd_eq.1 (huβ β¨r, sβ© hrs)β©
lemma linear_proj_add_linear_proj_of_is_compl_eq_self (hpq : is_compl p q) (x : E) :
(p.linear_proj_of_is_compl q hpq x + q.linear_proj_of_is_compl p hpq.symm x : E) = x :=
begin
dunfold linear_proj_of_is_compl,
rw βprod_comm_trans_prod_equiv_of_is_compl _ _ hpq,
exact (prod_equiv_of_is_compl _ _ hpq).apply_symm_apply x,
end
end submodule
namespace linear_map
open submodule
/-- Given linear maps `Ο` and `Ο` from complement submodules, `of_is_compl` is
the induced linear map over the entire module. -/
def of_is_compl {p q : submodule R E} (h : is_compl p q)
(Ο : p ββ[R] F) (Ο : q ββ[R] F) : E ββ[R] F :=
(linear_map.coprod Ο Ο) ββ β(submodule.prod_equiv_of_is_compl _ _ h).symm
variables {p q}
@[simp] lemma of_is_compl_left_apply
(h : is_compl p q) {Ο : p ββ[R] F} {Ο : q ββ[R] F} (u : p) :
of_is_compl h Ο Ο (u : E) = Ο u := by simp [of_is_compl]
@[simp] lemma of_is_compl_right_apply
(h : is_compl p q) {Ο : p ββ[R] F} {Ο : q ββ[R] F} (v : q) :
of_is_compl h Ο Ο (v : E) = Ο v := by simp [of_is_compl]
lemma of_is_compl_eq (h : is_compl p q)
{Ο : p ββ[R] F} {Ο : q ββ[R] F} {Ο : E ββ[R] F}
(hΟ : β u, Ο u = Ο u) (hΟ : β u, Ο u = Ο u) :
of_is_compl h Ο Ο = Ο :=
begin
ext x,
obtain β¨_, _, rfl, _β© := exists_unique_add_of_is_compl h x,
simp [of_is_compl, hΟ, hΟ]
end
lemma of_is_compl_eq' (h : is_compl p q)
{Ο : p ββ[R] F} {Ο : q ββ[R] F} {Ο : E ββ[R] F}
(hΟ : Ο = Ο.comp p.subtype) (hΟ : Ο = Ο.comp q.subtype) :
of_is_compl h Ο Ο = Ο :=
of_is_compl_eq h (Ξ» _, hΟ.symm βΈ rfl) (Ξ» _, hΟ.symm βΈ rfl)
@[simp] lemma of_is_compl_zero (h : is_compl p q) :
(of_is_compl h 0 0 : E ββ[R] F) = 0 :=
of_is_compl_eq _ (Ξ» _, rfl) (Ξ» _, rfl)
@[simp] lemma of_is_compl_add (h : is_compl p q)
{Οβ Οβ : p ββ[R] F} {Οβ Οβ : q ββ[R] F} :
of_is_compl h (Οβ + Οβ) (Οβ + Οβ) = of_is_compl h Οβ Οβ + of_is_compl h Οβ Οβ :=
of_is_compl_eq _ (by simp) (by simp)
@[simp] lemma of_is_compl_smul
{R : Type*} [comm_ring R] {E : Type*} [add_comm_group E] [module R E]
{F : Type*} [add_comm_group F] [module R F] {p q : submodule R E}
(h : is_compl p q) {Ο : p ββ[R] F} {Ο : q ββ[R] F} (c : R) :
of_is_compl h (c β’ Ο) (c β’ Ο) = c β’ of_is_compl h Ο Ο :=
of_is_compl_eq _ (by simp) (by simp)
section
variables {Rβ : Type*} [comm_ring Rβ] [module Rβ E] [module Rβ F]
/-- The linear map from `(p ββ[Rβ] F) Γ (q ββ[Rβ] F)` to `E ββ[Rβ] F`. -/
def of_is_compl_prod {p q : submodule Rβ E} (h : is_compl p q) :
((p ββ[Rβ] F) Γ (q ββ[Rβ] F)) ββ[Rβ] (E ββ[Rβ] F) :=
{ to_fun := Ξ» Ο, of_is_compl h Ο.1 Ο.2,
map_add' := by { intros Ο Ο, rw [prod.snd_add, prod.fst_add, of_is_compl_add] },
map_smul' := by { intros c Ο, simp [prod.smul_snd, prod.smul_fst, of_is_compl_smul] } }
@[simp] lemma of_is_compl_prod_apply {p q : submodule Rβ E} (h : is_compl p q)
(Ο : (p ββ[Rβ] F) Γ (q ββ[Rβ] F)) : of_is_compl_prod h Ο = of_is_compl h Ο.1 Ο.2 := rfl
/-- The natural linear equivalence between `(p ββ[Rβ] F) Γ (q ββ[Rβ] F)` and `E ββ[Rβ] F`. -/
def of_is_compl_prod_equiv {p q : submodule Rβ E} (h : is_compl p q) :
((p ββ[Rβ] F) Γ (q ββ[Rβ] F)) ββ[Rβ] (E ββ[Rβ] F) :=
{ inv_fun := Ξ» Ο, β¨Ο.dom_restrict p, Ο.dom_restrict qβ©,
left_inv :=
begin
intros Ο, ext,
{ exact of_is_compl_left_apply h x },
{ exact of_is_compl_right_apply h x }
end,
right_inv :=
begin
intro Ο, ext,
obtain β¨a, b, hab, _β© := exists_unique_add_of_is_compl h x,
rw [β hab], simp,
end, .. of_is_compl_prod h }
end
@[simp] lemma linear_proj_of_is_compl_of_proj (f : E ββ[R] p) (hf : β x : p, f x = x) :
p.linear_proj_of_is_compl f.ker (is_compl_of_proj hf) = f :=
begin
ext x,
have : x β p β f.ker,
{ simp only [(is_compl_of_proj hf).sup_eq_top, mem_top] },
rcases mem_sup'.1 this with β¨x, y, rflβ©,
simp [hf]
end
/-- If `f : E ββ[R] F` and `g : E ββ[R] G` are two surjective linear maps and
their kernels are complement of each other, then `x β¦ (f x, g x)` defines
a linear equivalence `E ββ[R] F Γ G`. -/
def equiv_prod_of_surjective_of_is_compl (f : E ββ[R] F) (g : E ββ[R] G) (hf : f.range = β€)
(hg : g.range = β€) (hfg : is_compl f.ker g.ker) :
E ββ[R] F Γ G :=
linear_equiv.of_bijective (f.prod g) (by simp [β ker_eq_bot, hfg.inf_eq_bot])
(by simp [β range_eq_top, range_prod_eq hfg.sup_eq_top, *])
@[simp] lemma coe_equiv_prod_of_surjective_of_is_compl {f : E ββ[R] F} {g : E ββ[R] G}
(hf : f.range = β€) (hg : g.range = β€) (hfg : is_compl f.ker g.ker) :
(equiv_prod_of_surjective_of_is_compl f g hf hg hfg : E ββ[R] F Γ G) = f.prod g :=
rfl
@[simp] lemma equiv_prod_of_surjective_of_is_compl_apply {f : E ββ[R] F} {g : E ββ[R] G}
(hf : f.range = β€) (hg : g.range = β€) (hfg : is_compl f.ker g.ker) (x : E):
equiv_prod_of_surjective_of_is_compl f g hf hg hfg x = (f x, g x) :=
rfl
end linear_map
namespace submodule
open linear_map
/-- Equivalence between submodules `q` such that `is_compl p q` and linear maps `f : E ββ[R] p`
such that `β x : p, f x = x`. -/
def is_compl_equiv_proj :
{q // is_compl p q} β {f : E ββ[R] p // β x : p, f x = x} :=
{ to_fun := Ξ» q, β¨linear_proj_of_is_compl p q q.2, linear_proj_of_is_compl_apply_left q.2β©,
inv_fun := Ξ» f, β¨(f : E ββ[R] p).ker, is_compl_of_proj f.2β©,
left_inv := Ξ» β¨q, hqβ©, by simp only [linear_proj_of_is_compl_ker, subtype.coe_mk],
right_inv := Ξ» β¨f, hfβ©, subtype.eq $ f.linear_proj_of_is_compl_of_proj hf }
@[simp] lemma coe_is_compl_equiv_proj_apply (q : {q // is_compl p q}) :
(p.is_compl_equiv_proj q : E ββ[R] p) = linear_proj_of_is_compl p q q.2 := rfl
@[simp] lemma coe_is_compl_equiv_proj_symm_apply (f : {f : E ββ[R] p // β x : p, f x = x}) :
(p.is_compl_equiv_proj.symm f : submodule R E) = (f : E ββ[R] p).ker := rfl
end submodule
namespace linear_map
open submodule
/--
A linear endomorphism of a module `E` is a projection onto a submodule `p` if it sends every element
of `E` to `p` and fixes every element of `p`.
The definition allow more generally any `fun_like` type and not just linear maps, so that it can be
used for example with `continuous_linear_map` or `matrix`.
-/
structure is_proj {F : Type*} [fun_like F M (Ξ» _, M)] (f : F) : Prop :=
(map_mem : β x, f x β m)
(map_id : β x β m, f x = x)
lemma is_proj_iff_idempotent (f : M ββ[S] M) : (β p : submodule S M, is_proj p f) β f ββ f = f :=
begin
split,
{ intro h, obtain β¨p, hpβ© := h, ext, rw comp_apply, exact hp.map_id (f x) (hp.map_mem x), },
{ intro h, use f.range, split,
{ intro x, exact mem_range_self f x, },
{ intros x hx, obtain β¨y, hyβ© := mem_range.1 hx, rw [βhy, βcomp_apply, h], }, },
end
namespace is_proj
variables {p m}
/--
Restriction of the codomain of a projection of onto a subspace `p` to `p` instead of the whole
space.
-/
def cod_restrict {f : M ββ[S] M} (h : is_proj m f) : M ββ[S] m :=
f.cod_restrict m h.map_mem
@[simp]
lemma cod_restrict_apply {f : M ββ[S] M} (h : is_proj m f) (x : M) :
β(h.cod_restrict x) = f x := f.cod_restrict_apply m x
@[simp]
lemma cod_restrict_apply_cod {f : M ββ[S] M} (h : is_proj m f) (x : m) :
h.cod_restrict x = x :=
by {ext, rw [cod_restrict_apply], exact h.map_id x x.2}
lemma cod_restrict_ker {f : M ββ[S] M} (h : is_proj m f) :
h.cod_restrict.ker = f.ker := f.ker_cod_restrict m _
lemma is_compl {f : E ββ[R] E} (h : is_proj p f) : is_compl p f.ker :=
by { rw βcod_restrict_ker, exact is_compl_of_proj h.cod_restrict_apply_cod, }
lemma eq_conj_prod_map' {f : E ββ[R] E} (h : is_proj p f) :
f = (p.prod_equiv_of_is_compl f.ker h.is_compl).to_linear_map ββ prod_map id 0 ββ
(p.prod_equiv_of_is_compl f.ker h.is_compl).symm.to_linear_map :=
begin
refine (linear_map.cancel_right
(p.prod_equiv_of_is_compl f.ker h.is_compl).surjective).1 _,
ext,
{ simp only [coe_comp, linear_equiv.coe_to_linear_map, coe_inl, function.comp_app,
linear_equiv.of_top_apply, linear_equiv.of_injective_apply, coprod_apply, submodule.coe_subtype,
coe_zero, add_zero, prod_equiv_of_is_compl_symm_apply_left, prod_map_apply, id_coe, id.def,
zero_apply, coe_prod_equiv_of_is_compl', h.map_id x x.2], },
{simp only [coe_comp, linear_equiv.coe_to_linear_map, coe_inr, function.comp_app,
linear_equiv.of_top_apply, linear_equiv.of_injective_apply, coprod_apply, submodule.coe_subtype,
coe_zero, zero_add, map_coe_ker, prod_equiv_of_is_compl_symm_apply_right, prod_map_apply, id_coe,
id.def, zero_apply, coe_prod_equiv_of_is_compl'], }
end
end is_proj
end linear_map
end ring
section comm_ring
namespace linear_map
variables {R : Type*} [comm_ring R] {E : Type*} [add_comm_group E] [module R E] {p : submodule R E}
lemma is_proj.eq_conj_prod_map {f : E ββ[R] E} (h : is_proj p f) :
f = (p.prod_equiv_of_is_compl f.ker h.is_compl).conj (prod_map id 0) :=
by {rw linear_equiv.conj_apply, exact h.eq_conj_prod_map'}
end linear_map
end comm_ring
|