Skip to content

Commit

Permalink
feat(algebra/category/Module): allow writing (0 : Module R) (#6249)
Browse files Browse the repository at this point in the history


Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
  • Loading branch information
semorrison and semorrison committed Feb 16, 2021
1 parent 2961e79 commit d7003c1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/algebra/category/Module/basic.lean
Expand Up @@ -55,7 +55,8 @@ instance has_forget_to_AddCommGroup : has_forget₂ (Module R) AddCommGroup :=
/-- The object in the category of R-modules associated to an R-module -/
def of (X : Type v) [add_comm_group X] [module R X] : Module R := ⟨X⟩

instance : inhabited (Module R) := ⟨of R punit⟩
instance : has_zero (Module R) := ⟨of R punit⟩
instance : inhabited (Module R) := ⟨0

@[simp]
lemma coe_of (X : Type u) [add_comm_group X] [module R X] : (of R X : Type u) = X := rfl
Expand All @@ -72,7 +73,7 @@ instance : subsingleton (of R punit) :=
by { rw coe_of R punit, apply_instance }

instance : has_zero_object (Module.{v} R) :=
{ zero := of R punit,
{ zero := 0,
unique_to := λ X,
{ default := (0 : punit →ₗ[R] X),
uniq := λ _, linear_map.ext $ λ x,
Expand Down

0 comments on commit d7003c1

Please sign in to comment.