Datasets:
Tasks:
Text Generation
Modalities:
Text
Sub-tasks:
language-modeling
Languages:
English
Size:
100K - 1M
License:
File size: 24,635 Bytes
4365a98 fc5e983 4365a98 fc5e983 4365a98 fc5e983 4365a98 fc5e983 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 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 |
/-
Copyright (c) 2020 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Nathaniel Thomas, Jeremy Avigad, Johannes HΓΆlzl, Mario Carneiro, Anne Baanen,
FrΓ©dΓ©ric Dupuis, Heather Macbeth
-/
import algebra.module.linear_map
/-!
# (Semi)linear equivalences
In this file we define
* `linear_equiv Ο M Mβ`, `M βββ[Ο] Mβ`: an invertible semilinear map. Here, `Ο` is a `ring_hom`
from `R` to `Rβ` and an `e : M βββ[Ο] Mβ` satisfies `e (c β’ x) = (Ο c) β’ (e x)`. The plain
linear version, with `Ο` being `ring_hom.id R`, is denoted by `M ββ[R] Mβ`, and the
star-linear version (with `Ο` being `star_ring_end`) is denoted by `M βββ[R] Mβ`.
## Implementation notes
To ensure that composition works smoothly for semilinear equivalences, we use the typeclasses
`ring_hom_comp_triple`, `ring_hom_inv_pair` and `ring_hom_surjective` from
`algebra/ring/comp_typeclasses`.
The group structure on automorphisms, `linear_equiv.automorphism_group`, is provided elsewhere.
## TODO
* Parts of this file have not yet been generalized to semilinear maps
## Tags
linear equiv, linear equivalences, linear isomorphism, linear isomorphic
-/
open function
open_locale big_operators
universes u u' v w x y z
variables {R : Type*} {Rβ : Type*} {Rβ : Type*} {Rβ : Type*}
variables {k : Type*} {S : Type*} {M : Type*} {Mβ : Type*} {Mβ : Type*} {Mβ : Type*}
variables {Nβ : Type*} {Nβ : Type*} {Nβ : Type*} {Nβ : Type*} {ΞΉ : Type*}
section
set_option old_structure_cmd true
/-- A linear equivalence is an invertible linear map. -/
@[nolint has_nonempty_instance]
structure linear_equiv {R : Type*} {S : Type*} [semiring R] [semiring S] (Ο : R β+* S)
{Ο' : S β+* R} [ring_hom_inv_pair Ο Ο'] [ring_hom_inv_pair Ο' Ο]
(M : Type*) (Mβ : Type*)
[add_comm_monoid M] [add_comm_monoid Mβ] [module R M] [module S Mβ]
extends linear_map Ο M Mβ, M β+ Mβ
attribute [nolint doc_blame] linear_equiv.to_linear_map
attribute [nolint doc_blame] linear_equiv.to_add_equiv
notation M ` βββ[`:50 Ο `] ` Mβ := linear_equiv Ο M Mβ
notation M ` ββ[`:50 R `] ` Mβ := linear_equiv (ring_hom.id R) M Mβ
notation M ` βββ[`:50 R `] ` Mβ := linear_equiv (star_ring_end R) M Mβ
/-- `semilinear_equiv_class F Ο M Mβ` asserts `F` is a type of bundled `Ο`-semilinear equivs
`M β Mβ`.
See also `linear_equiv_class F R M Mβ` for the case where `Ο` is the identity map on `R`.
A map `f` between an `R`-module and an `S`-module over a ring homomorphism `Ο : R β+* S`
is semilinear if it satisfies the two properties `f (x + y) = f x + f y` and
`f (c β’ x) = (Ο c) β’ f x`. -/
class semilinear_equiv_class (F : Type*) {R S : out_param Type*} [semiring R] [semiring S]
(Ο : out_param $ R β+* S) {Ο' : out_param $ S β+* R}
[ring_hom_inv_pair Ο Ο'] [ring_hom_inv_pair Ο' Ο] (M Mβ : out_param Type*)
[add_comm_monoid M] [add_comm_monoid Mβ] [module R M] [module S Mβ]
extends add_equiv_class F M Mβ :=
(map_smulββ : β (f : F) (r : R) (x : M), f (r β’ x) = (Ο r) β’ f x)
-- `R, S, Ο, Ο'` become metavars, but it's OK since they are outparams.
attribute [nolint dangerous_instance] semilinear_equiv_class.to_add_equiv_class
/-- `linear_equiv_class F R M Mβ` asserts `F` is a type of bundled `R`-linear equivs `M β Mβ`.
This is an abbreviation for `semilinear_equiv_class F (ring_hom.id R) M Mβ`.
-/
abbreviation linear_equiv_class (F : Type*) (R M Mβ : out_param Type*)
[semiring R] [add_comm_monoid M] [add_comm_monoid Mβ] [module R M] [module R Mβ] :=
semilinear_equiv_class F (ring_hom.id R) M Mβ
end
namespace semilinear_equiv_class
variables (F : Type*) [semiring R] [semiring S]
variables [add_comm_monoid M] [add_comm_monoid Mβ] [add_comm_monoid Mβ]
variables [module R M] [module S Mβ] {Ο : R β+* S} {Ο' : S β+* R}
-- `Ο'` becomes a metavariable, but it's OK since it's an outparam
@[priority 100, nolint dangerous_instance]
instance [ring_hom_inv_pair Ο Ο'] [ring_hom_inv_pair Ο' Ο] [s : semilinear_equiv_class F Ο M Mβ] :
semilinear_map_class F Ο M Mβ :=
{ coe := (coe : F β M β Mβ),
coe_injective' := @fun_like.coe_injective F _ _ _,
..s }
end semilinear_equiv_class
namespace linear_equiv
section add_comm_monoid
variables {Mβ : Type*}
variables [semiring R] [semiring S]
section
variables [add_comm_monoid M] [add_comm_monoid Mβ] [add_comm_monoid Mβ]
variables [module R M] [module S Mβ] {Ο : R β+* S} {Ο' : S β+* R}
variables [ring_hom_inv_pair Ο Ο'] [ring_hom_inv_pair Ο' Ο]
include R
include Ο'
instance : has_coe (M βββ[Ο] Mβ) (M βββ[Ο] Mβ) := β¨to_linear_mapβ©
-- see Note [function coercion]
instance : has_coe_to_fun (M βββ[Ο] Mβ) (Ξ» _, M β Mβ) := β¨to_funβ©
@[simp] lemma coe_mk {to_fun inv_fun map_add map_smul left_inv right_inv } :
β(β¨to_fun, map_add, map_smul, inv_fun, left_inv, right_invβ© : M βββ[Ο] Mβ) = to_fun :=
rfl
-- This exists for compatibility, previously `ββ[R]` extended `β` instead of `β+`.
@[nolint doc_blame]
def to_equiv : (M βββ[Ο] Mβ) β M β Mβ := Ξ» f, f.to_add_equiv.to_equiv
lemma to_equiv_injective : function.injective (to_equiv : (M βββ[Ο] Mβ) β M β Mβ) :=
Ξ» β¨_, _, _, _, _, _β© β¨_, _, _, _, _, _β© h, linear_equiv.mk.inj_eq.mpr (equiv.mk.inj h)
@[simp] lemma to_equiv_inj {eβ eβ : M βββ[Ο] Mβ} : eβ.to_equiv = eβ.to_equiv β eβ = eβ :=
to_equiv_injective.eq_iff
lemma to_linear_map_injective :
injective (coe : (M βββ[Ο] Mβ) β (M βββ[Ο] Mβ)) :=
Ξ» eβ eβ H, to_equiv_injective $ equiv.ext $ linear_map.congr_fun H
@[simp, norm_cast] lemma to_linear_map_inj {eβ eβ : M βββ[Ο] Mβ} :
(eβ : M βββ[Ο] Mβ) = eβ β eβ = eβ :=
to_linear_map_injective.eq_iff
instance : semilinear_equiv_class (M βββ[Ο] Mβ) Ο M Mβ :=
{ coe := linear_equiv.to_fun,
inv := linear_equiv.inv_fun,
coe_injective' := Ξ» f g hβ hβ, by { cases f, cases g, congr' },
left_inv := linear_equiv.left_inv,
right_inv := linear_equiv.right_inv,
map_add := map_add',
map_smulββ := map_smul' }
lemma coe_injective :
@injective (M βββ[Ο] Mβ) (M β Mβ) coe_fn :=
fun_like.coe_injective
end
section
variables [semiring Rβ] [semiring Rβ] [semiring Rβ]
variables [add_comm_monoid M] [add_comm_monoid Mβ] [add_comm_monoid Mβ]
variables [add_comm_monoid Mβ] [add_comm_monoid Mβ]
variables [add_comm_monoid Nβ] [add_comm_monoid Nβ]
variables {module_M : module R M} {module_S_Mβ : module S Mβ} {Ο : R β+* S} {Ο' : S β+* R}
variables {reβ : ring_hom_inv_pair Ο Ο'} {reβ : ring_hom_inv_pair Ο' Ο}
variables (e e' : M βββ[Ο] Mβ)
lemma to_linear_map_eq_coe : e.to_linear_map = (e : M βββ[Ο] Mβ) := rfl
@[simp, norm_cast] theorem coe_coe : β(e : M βββ[Ο] Mβ) = e := rfl
@[simp] lemma coe_to_equiv : βe.to_equiv = e := rfl
@[simp] lemma coe_to_linear_map : βe.to_linear_map = e := rfl
@[simp] lemma to_fun_eq_coe : e.to_fun = e := rfl
section
variables {e e'}
@[ext] lemma ext (h : β x, e x = e' x) : e = e' := fun_like.ext _ _ h
lemma ext_iff : e = e' β β x, e x = e' x := fun_like.ext_iff
protected lemma congr_arg {x x'} : x = x' β e x = e x' := fun_like.congr_arg e
protected lemma congr_fun (h : e = e') (x : M) : e x = e' x := fun_like.congr_fun h x
end
section
variables (M R)
/-- The identity map is a linear equivalence. -/
@[refl]
def refl [module R M] : M ββ[R] M := { .. linear_map.id, .. equiv.refl M }
end
@[simp] lemma refl_apply [module R M] (x : M) : refl R M x = x := rfl
include module_M module_S_Mβ reβ reβ
/-- Linear equivalences are symmetric. -/
@[symm]
def symm (e : M βββ[Ο] Mβ) : Mβ βββ[Ο'] M :=
{ to_fun := e.to_linear_map.inverse e.inv_fun e.left_inv e.right_inv,
inv_fun := e.to_equiv.symm.inv_fun,
map_smul' := Ξ» r x, by rw map_smulββ,
.. e.to_linear_map.inverse e.inv_fun e.left_inv e.right_inv,
.. e.to_equiv.symm }
omit module_M module_S_Mβ reβ reβ
/-- See Note [custom simps projection] -/
def simps.symm_apply {R : Type*} {S : Type*} [semiring R] [semiring S] {Ο : R β+* S}
{Ο' : S β+* R} [ring_hom_inv_pair Ο Ο'] [ring_hom_inv_pair Ο' Ο]
{M : Type*} {Mβ : Type*} [add_comm_monoid M] [add_comm_monoid Mβ] [module R M] [module S Mβ]
(e : M βββ[Ο] Mβ) : Mβ β M := e.symm
initialize_simps_projections linear_equiv (to_fun β apply, inv_fun β symm_apply)
include Ο'
@[simp] lemma inv_fun_eq_symm : e.inv_fun = e.symm := rfl
omit Ο'
@[simp] lemma coe_to_equiv_symm : βe.to_equiv.symm = e.symm := rfl
variables {module_Mβ : module Rβ Mβ} {module_Mβ : module Rβ Mβ} {module_Mβ : module Rβ Mβ}
variables {module_Nβ : module Rβ Nβ} {module_Nβ : module Rβ Nβ}
variables {Οββ : Rβ β+* Rβ} {Οββ : Rβ β+* Rβ} {Οββ : Rβ β+* Rβ}
variables {Οββ : Rβ β+* Rβ} {Οββ : Rβ β+* Rβ} {Οββ : Rβ β+* Rβ}
variables [ring_hom_comp_triple Οββ Οββ Οββ]
variables [ring_hom_comp_triple Οββ Οββ Οββ]
variables {reββ : ring_hom_inv_pair Οββ Οββ} {reββ : ring_hom_inv_pair Οββ Οββ}
variables [ring_hom_inv_pair Οββ Οββ] {reββ : ring_hom_inv_pair Οββ Οββ}
variables {reββ : ring_hom_inv_pair Οββ Οββ} [ring_hom_inv_pair Οββ Οββ]
variables (eββ : Mβ βββ[Οββ] Mβ) (eββ : Mβ βββ[Οββ] Mβ)
include Οββ
/-- Linear equivalences are transitive. -/
-- Note: The linter thinks the `ring_hom_comp_triple` argument is doubled -- it is not.
@[trans, nolint unused_arguments]
def trans : Mβ βββ[Οββ] Mβ :=
{ .. eββ.to_linear_map.comp eββ.to_linear_map,
.. eββ.to_equiv.trans eββ.to_equiv }
omit Οββ
infixl ` βͺβ«β `:80 := @linear_equiv.trans _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
(ring_hom.id _) (ring_hom.id _) (ring_hom.id _)
(ring_hom.id _) (ring_hom.id _) (ring_hom.id _)
ring_hom_comp_triple.ids ring_hom_comp_triple.ids
ring_hom_inv_pair.ids ring_hom_inv_pair.ids ring_hom_inv_pair.ids
ring_hom_inv_pair.ids ring_hom_inv_pair.ids ring_hom_inv_pair.ids
variables {eββ} {eββ}
@[simp] lemma coe_to_add_equiv : β(e.to_add_equiv) = e := rfl
/-- The two paths coercion can take to an `add_monoid_hom` are equivalent -/
lemma to_add_monoid_hom_commutes :
e.to_linear_map.to_add_monoid_hom = e.to_add_equiv.to_add_monoid_hom :=
rfl
include Οββ
@[simp] theorem trans_apply (c : Mβ) :
(eββ.trans eββ : Mβ βββ[Οββ] Mβ) c = eββ (eββ c) := rfl
omit Οββ
include Ο'
@[simp] theorem apply_symm_apply (c : Mβ) : e (e.symm c) = c := e.right_inv c
@[simp] theorem symm_apply_apply (b : M) : e.symm (e b) = b := e.left_inv b
omit Ο'
include Οββ Οββ Οββ
@[simp] lemma trans_symm : (eββ.trans eββ : Mβ βββ[Οββ] Mβ).symm = eββ.symm.trans eββ.symm :=
rfl
lemma symm_trans_apply
(c : Mβ) : (eββ.trans eββ : Mβ βββ[Οββ] Mβ).symm c = eββ.symm (eββ.symm c) := rfl
omit Οββ Οββ Οββ
@[simp] lemma trans_refl : e.trans (refl S Mβ) = e := to_equiv_injective e.to_equiv.trans_refl
@[simp] lemma refl_trans : (refl R M).trans e = e := to_equiv_injective e.to_equiv.refl_trans
include Ο'
lemma symm_apply_eq {x y} : e.symm x = y β x = e y := e.to_equiv.symm_apply_eq
lemma eq_symm_apply {x y} : y = e.symm x β e y = x := e.to_equiv.eq_symm_apply
omit Ο'
lemma eq_comp_symm {Ξ± : Type*} (f : Mβ β Ξ±) (g : Mβ β Ξ±) :
f = g β eββ.symm β f β eββ = g := eββ.to_equiv.eq_comp_symm f g
lemma comp_symm_eq {Ξ± : Type*} (f : Mβ β Ξ±) (g : Mβ β Ξ±) :
g β eββ.symm = f β g = f β eββ := eββ.to_equiv.comp_symm_eq f g
lemma eq_symm_comp {Ξ± : Type*} (f : Ξ± β Mβ) (g : Ξ± β Mβ) :
f = eββ.symm β g β eββ β f = g := eββ.to_equiv.eq_symm_comp f g
lemma symm_comp_eq {Ξ± : Type*} (f : Ξ± β Mβ) (g : Ξ± β Mβ) :
eββ.symm β g = f β g = eββ β f := eββ.to_equiv.symm_comp_eq f g
variables [ring_hom_comp_triple Οββ Οββ Οββ] [ring_hom_comp_triple Οββ Οββ Οββ]
include module_Mβ
lemma eq_comp_to_linear_map_symm (f : Mβ βββ[Οββ] Mβ) (g : Mβ βββ[Οββ] Mβ) :
f = g.comp eββ.symm.to_linear_map β f.comp eββ.to_linear_map = g :=
begin
split; intro H; ext,
{ simp [H, eββ.to_equiv.eq_comp_symm f g] },
{ simp [βH, βeββ.to_equiv.eq_comp_symm f g] }
end
lemma comp_to_linear_map_symm_eq (f : Mβ βββ[Οββ] Mβ) (g : Mβ βββ[Οββ] Mβ) :
g.comp eββ.symm.to_linear_map = f β g = f.comp eββ.to_linear_map :=
begin
split; intro H; ext,
{ simp [βH, βeββ.to_equiv.comp_symm_eq f g] },
{ simp [H, eββ.to_equiv.comp_symm_eq f g] }
end
lemma eq_to_linear_map_symm_comp (f : Mβ βββ[Οββ] Mβ) (g : Mβ βββ[Οββ] Mβ) :
f = eββ.symm.to_linear_map.comp g β eββ.to_linear_map.comp f = g :=
begin
split; intro H; ext,
{ simp [H, eββ.to_equiv.eq_symm_comp f g] },
{ simp [βH, βeββ.to_equiv.eq_symm_comp f g] }
end
lemma to_linear_map_symm_comp_eq (f : Mβ βββ[Οββ] Mβ) (g : Mβ βββ[Οββ] Mβ) :
eββ.symm.to_linear_map.comp g = f β g = eββ.to_linear_map.comp f :=
begin
split; intro H; ext,
{ simp [βH, βeββ.to_equiv.symm_comp_eq f g] },
{ simp [H, eββ.to_equiv.symm_comp_eq f g] }
end
omit module_Mβ
@[simp] lemma refl_symm [module R M] : (refl R M).symm = linear_equiv.refl R M := rfl
@[simp] lemma self_trans_symm [module R M] [module R Mβ] (f : M ββ[R] Mβ) :
f.trans f.symm = linear_equiv.refl R M :=
by { ext x, simp }
@[simp] lemma symm_trans_self [module R M] [module R Mβ] (f : M ββ[R] Mβ) :
f.symm.trans f = linear_equiv.refl R Mβ :=
by { ext x, simp }
@[simp, norm_cast] lemma refl_to_linear_map [module R M] :
(linear_equiv.refl R M : M ββ[R] M) = linear_map.id :=
rfl
@[simp, norm_cast]
lemma comp_coe [module R M] [module R Mβ] [module R Mβ] (f : M ββ[R] Mβ)
(f' : Mβ ββ[R] Mβ) : (f' : Mβ ββ[R] Mβ).comp (f : M ββ[R] Mβ) = (f.trans f' : M ββ[R] Mβ) :=
rfl
@[simp] lemma mk_coe (hβ hβ f hβ hβ) :
(linear_equiv.mk e hβ hβ f hβ hβ : M βββ[Ο] Mβ) = e := ext $ Ξ» _, rfl
protected theorem map_add (a b : M) : e (a + b) = e a + e b := map_add e a b
protected theorem map_zero : e 0 = 0 := map_zero e
-- TODO: `simp` isn't picking up `map_smulββ` for `linear_equiv`s without specifying `map_smulββ f`
@[simp] protected theorem map_smulββ (c : R) (x : M) : e (c β’ x) = (Ο c) β’ e x := e.map_smul' c x
include module_Nβ module_Nβ
theorem map_smul (e : Nβ ββ[Rβ] Nβ) (c : Rβ) (x : Nβ) :
e (c β’ x) = c β’ e x := map_smulββ e c x
omit module_Nβ module_Nβ
@[simp] lemma map_sum {s : finset ΞΉ} (u : ΞΉ β M) : e (β i in s, u i) = β i in s, e (u i) :=
e.to_linear_map.map_sum
@[simp] theorem map_eq_zero_iff {x : M} : e x = 0 β x = 0 :=
e.to_add_equiv.map_eq_zero_iff
theorem map_ne_zero_iff {x : M} : e x β 0 β x β 0 :=
e.to_add_equiv.map_ne_zero_iff
include module_M module_S_Mβ reβ reβ
@[simp] theorem symm_symm (e : M βββ[Ο] Mβ): e.symm.symm = e :=
by { cases e, refl }
omit module_M module_S_Mβ reβ reβ
lemma symm_bijective [module R M] [module S Mβ] [ring_hom_inv_pair Ο' Ο]
[ring_hom_inv_pair Ο Ο'] : function.bijective (symm : (M βββ[Ο] Mβ) β (Mβ βββ[Ο'] M)) :=
equiv.bijective β¨(symm : (M βββ[Ο] Mβ) β
(Mβ βββ[Ο'] M)), (symm : (Mβ βββ[Ο'] M) β (M βββ[Ο] Mβ)), symm_symm, symm_symmβ©
@[simp] lemma mk_coe' (f hβ hβ hβ hβ) : (linear_equiv.mk f hβ hβ βe hβ hβ :
Mβ βββ[Ο'] M) = e.symm :=
symm_bijective.injective $ ext $ Ξ» x, rfl
@[simp] theorem symm_mk (f hβ hβ hβ hβ) :
(β¨e, hβ, hβ, f, hβ, hββ© : M βββ[Ο] Mβ).symm =
{ to_fun := f, inv_fun := e,
..(β¨e, hβ, hβ, f, hβ, hββ© : M βββ[Ο] Mβ).symm } := rfl
@[simp] lemma coe_symm_mk [module R M] [module R Mβ]
{to_fun inv_fun map_add map_smul left_inv right_inv} :
β((β¨to_fun, map_add, map_smul, inv_fun, left_inv, right_invβ© : M ββ[R] Mβ).symm) = inv_fun :=
rfl
protected lemma bijective : function.bijective e := e.to_equiv.bijective
protected lemma injective : function.injective e := e.to_equiv.injective
protected lemma surjective : function.surjective e := e.to_equiv.surjective
protected lemma image_eq_preimage (s : set M) : e '' s = e.symm β»ΒΉ' s :=
e.to_equiv.image_eq_preimage s
protected lemma image_symm_eq_preimage (s : set Mβ) : e.symm '' s = e β»ΒΉ' s :=
e.to_equiv.symm.image_eq_preimage s
end
/-- Interpret a `ring_equiv` `f` as an `f`-semilinear equiv. -/
@[simps]
def _root_.ring_equiv.to_semilinear_equiv (f : R β+* S) :
by haveI := ring_hom_inv_pair.of_ring_equiv f;
haveI := ring_hom_inv_pair.symm (βf : R β+* S) (f.symm : S β+* R);
exact (R βββ[(βf : R β+* S)] S) :=
by exact
{ to_fun := f,
map_smul' := f.map_mul,
.. f}
variables [semiring Rβ] [semiring Rβ] [semiring Rβ]
variables [add_comm_monoid M] [add_comm_monoid Mβ] [add_comm_monoid Mβ]
/-- An involutive linear map is a linear equivalence. -/
def of_involutive {Ο Ο' : R β+* R} [ring_hom_inv_pair Ο Ο'] [ring_hom_inv_pair Ο' Ο]
{module_M : module R M} (f : M βββ[Ο] M) (hf : involutive f) :
M βββ[Ο] M :=
{ .. f, .. hf.to_perm f }
@[simp] lemma coe_of_involutive {Ο Ο' : R β+* R} [ring_hom_inv_pair Ο Ο']
[ring_hom_inv_pair Ο' Ο] {module_M : module R M} (f : M βββ[Ο] M) (hf : involutive f) :
β(of_involutive f hf) = f :=
rfl
section restrict_scalars
variables (R) [module R M] [module R Mβ] [module S M] [module S Mβ]
[linear_map.compatible_smul M Mβ R S]
/-- If `M` and `Mβ` are both `R`-semimodules and `S`-semimodules and `R`-semimodule structures
are defined by an action of `R` on `S` (formally, we have two scalar towers), then any `S`-linear
equivalence from `M` to `Mβ` is also an `R`-linear equivalence.
See also `linear_map.restrict_scalars`. -/
@[simps]
def restrict_scalars (f : M ββ[S] Mβ) : M ββ[R] Mβ :=
{ to_fun := f,
inv_fun := f.symm,
left_inv := f.left_inv,
right_inv := f.right_inv,
.. f.to_linear_map.restrict_scalars R }
lemma restrict_scalars_injective :
function.injective (restrict_scalars R : (M ββ[S] Mβ) β (M ββ[R] Mβ)) :=
Ξ» f g h, ext (linear_equiv.congr_fun h : _)
@[simp]
lemma restrict_scalars_inj (f g : M ββ[S] Mβ) :
f.restrict_scalars R = g.restrict_scalars R β f = g :=
(restrict_scalars_injective R).eq_iff
end restrict_scalars
section automorphisms
variables [module R M]
instance automorphism_group : group (M ββ[R] M) :=
{ mul := Ξ» f g, g.trans f,
one := linear_equiv.refl R M,
inv := Ξ» f, f.symm,
mul_assoc := Ξ» f g h, rfl,
mul_one := Ξ» f, ext $ Ξ» x, rfl,
one_mul := Ξ» f, ext $ Ξ» x, rfl,
mul_left_inv := Ξ» f, ext $ f.left_inv }
/-- Restriction from `R`-linear automorphisms of `M` to `R`-linear endomorphisms of `M`,
promoted to a monoid hom. -/
@[simps]
def automorphism_group.to_linear_map_monoid_hom : (M ββ[R] M) β* (M ββ[R] M) :=
{ to_fun := coe,
map_one' := rfl,
map_mul' := Ξ» _ _, rfl }
/-- The tautological action by `M ββ[R] M` on `M`.
This generalizes `function.End.apply_mul_action`. -/
instance apply_distrib_mul_action : distrib_mul_action (M ββ[R] M) M :=
{ smul := ($),
smul_zero := linear_equiv.map_zero,
smul_add := linear_equiv.map_add,
one_smul := Ξ» _, rfl,
mul_smul := Ξ» _ _ _, rfl }
@[simp] protected lemma smul_def (f : M ββ[R] M) (a : M) :
f β’ a = f a := rfl
/-- `linear_equiv.apply_distrib_mul_action` is faithful. -/
instance apply_has_faithful_smul : has_faithful_smul (M ββ[R] M) M :=
β¨Ξ» _ _, linear_equiv.extβ©
instance apply_smul_comm_class : smul_comm_class R (M ββ[R] M) M :=
{ smul_comm := Ξ» r e m, (e.map_smul r m).symm }
instance apply_smul_comm_class' : smul_comm_class (M ββ[R] M) R M :=
{ smul_comm := linear_equiv.map_smul }
end automorphisms
end add_comm_monoid
end linear_equiv
namespace module
/-- `g : R β+* S` is `R`-linear when the module structure on `S` is `module.comp_hom S g` . -/
@[simps]
def comp_hom.to_linear_equiv {R S : Type*} [semiring R] [semiring S] (g : R β+* S) :
(by haveI := comp_hom S (βg : R β+* S); exact (R ββ[R] S)) :=
by exact
{ to_fun := (g : R β S),
inv_fun := (g.symm : S β R),
map_smul' := g.map_mul,
..g }
end module
namespace distrib_mul_action
variables (R M) [semiring R] [add_comm_monoid M] [module R M]
variables [group S] [distrib_mul_action S M] [smul_comm_class S R M]
/-- Each element of the group defines a linear equivalence.
This is a stronger version of `distrib_mul_action.to_add_equiv`. -/
@[simps]
def to_linear_equiv (s : S) : M ββ[R] M :=
{ ..to_add_equiv M s,
..to_linear_map R M s }
/-- Each element of the group defines a module automorphism.
This is a stronger version of `distrib_mul_action.to_add_aut`. -/
@[simps]
def to_module_aut : S β* M ββ[R] M :=
{ to_fun := to_linear_equiv R M,
map_one' := linear_equiv.ext $ one_smul _,
map_mul' := Ξ» a b, linear_equiv.ext $ mul_smul _ _ }
end distrib_mul_action
namespace add_equiv
section add_comm_monoid
variables [semiring R] [add_comm_monoid M] [add_comm_monoid Mβ] [add_comm_monoid Mβ]
variables [module R M] [module R Mβ]
variable (e : M β+ Mβ)
/-- An additive equivalence whose underlying function preserves `smul` is a linear equivalence. -/
def to_linear_equiv (h : β (c : R) x, e (c β’ x) = c β’ e x) : M ββ[R] Mβ :=
{ map_smul' := h, .. e, }
@[simp] lemma coe_to_linear_equiv (h : β (c : R) x, e (c β’ x) = c β’ e x) :
β(e.to_linear_equiv h) = e :=
rfl
@[simp] lemma coe_to_linear_equiv_symm (h : β (c : R) x, e (c β’ x) = c β’ e x) :
β(e.to_linear_equiv h).symm = e.symm :=
rfl
/-- An additive equivalence between commutative additive monoids is a linear equivalence between
β-modules -/
def to_nat_linear_equiv : M ββ[β] Mβ :=
e.to_linear_equiv $ Ξ» c a, by { erw e.to_add_monoid_hom.map_nsmul, refl }
@[simp] lemma coe_to_nat_linear_equiv :
β(e.to_nat_linear_equiv) = e := rfl
@[simp] lemma to_nat_linear_equiv_to_add_equiv :
e.to_nat_linear_equiv.to_add_equiv = e := by { ext, refl }
@[simp] lemma _root_.linear_equiv.to_add_equiv_to_nat_linear_equiv
(e : M ββ[β] Mβ) : e.to_add_equiv.to_nat_linear_equiv = e := fun_like.coe_injective rfl
@[simp] lemma to_nat_linear_equiv_symm :
(e.to_nat_linear_equiv).symm = e.symm.to_nat_linear_equiv := rfl
@[simp] lemma to_nat_linear_equiv_refl :
((add_equiv.refl M).to_nat_linear_equiv) = linear_equiv.refl β M := rfl
@[simp] lemma to_nat_linear_equiv_trans (eβ : Mβ β+ Mβ) :
(e.to_nat_linear_equiv).trans (eβ.to_nat_linear_equiv) = (e.trans eβ).to_nat_linear_equiv := rfl
end add_comm_monoid
section add_comm_group
variables [add_comm_group M] [add_comm_group Mβ] [add_comm_group Mβ]
variable (e : M β+ Mβ)
/-- An additive equivalence between commutative additive groups is a linear
equivalence between β€-modules -/
def to_int_linear_equiv : M ββ[β€] Mβ :=
e.to_linear_equiv $ Ξ» c a, e.to_add_monoid_hom.map_zsmul a c
@[simp] lemma coe_to_int_linear_equiv :
β(e.to_int_linear_equiv) = e := rfl
@[simp] lemma to_int_linear_equiv_to_add_equiv :
e.to_int_linear_equiv.to_add_equiv = e := by { ext, refl }
@[simp] lemma _root_.linear_equiv.to_add_equiv_to_int_linear_equiv
(e : M ββ[β€] Mβ) : e.to_add_equiv.to_int_linear_equiv = e := fun_like.coe_injective rfl
@[simp] lemma to_int_linear_equiv_symm :
(e.to_int_linear_equiv).symm = e.symm.to_int_linear_equiv := rfl
@[simp] lemma to_int_linear_equiv_refl :
((add_equiv.refl M).to_int_linear_equiv) = linear_equiv.refl β€ M := rfl
@[simp] lemma to_int_linear_equiv_trans (eβ : Mβ β+ Mβ) :
(e.to_int_linear_equiv).trans (eβ.to_int_linear_equiv) = (e.trans eβ).to_int_linear_equiv :=
rfl
end add_comm_group
end add_equiv
|