Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 0b09858

Browse files
committed
feat(linear_algebra/basic): add a unique instance for linear_equiv (#7816)
1 parent 65e3b04 commit 0b09858

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/linear_algebra/basic.lean

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1995,6 +1995,30 @@ section add_comm_monoid
19951995
variables [semiring R] [add_comm_monoid M] [add_comm_monoid M₂]
19961996
[add_comm_monoid M₃] [add_comm_monoid M₄]
19971997

1998+
section subsingleton
1999+
variables [module R M] [module R M₂] [subsingleton M] [subsingleton M₂]
2000+
2001+
/-- Between two zero modules, the zero map is an equivalence. -/
2002+
instance : has_zero (M ≃ₗ[R] M₂) :=
2003+
⟨{ to_fun := 0,
2004+
inv_fun := 0,
2005+
right_inv := λ x, subsingleton.elim _ _,
2006+
left_inv := λ x, subsingleton.elim _ _,
2007+
..(0 : M →ₗ[R] M₂)}⟩
2008+
2009+
-- Even though these are implied by `subsingleton.elim` via the `unique` instance below, they're
2010+
-- nice to have as `rfl`-lemmas for `dsimp`.
2011+
@[simp] lemma zero_symm : (0 : M ≃ₗ[R] M₂).symm = 0 := rfl
2012+
@[simp] lemma coe_zero : ⇑(0 : M ≃ₗ[R] M₂) = 0 := rfl
2013+
lemma zero_apply (x : M) : (0 : M ≃ₗ[R] M₂) x = 0 := rfl
2014+
2015+
/-- Between two zero modules, the zero map is the only equivalence. -/
2016+
instance : unique (M ≃ₗ[R] M₂) :=
2017+
{ uniq := λ f, to_linear_map_injective (subsingleton.elim _ _),
2018+
default := 0 }
2019+
2020+
end subsingleton
2021+
19982022
section
19992023
variables {module_M : module R M} {module_M₂ : module R M₂}
20002024
variables (e e' : M ≃ₗ[R] M₂)

0 commit comments

Comments
 (0)