Skip to content

Commit

Permalink
feat(algebra/module): add module.nontrivial (#12594)
Browse files Browse the repository at this point in the history
  • Loading branch information
urkud committed Mar 11, 2022
1 parent 5856c0c commit e7db193
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/algebra/module/basic.lean
Expand Up @@ -249,12 +249,18 @@ end module

/-- A module over a `subsingleton` semiring is a `subsingleton`. We cannot register this
as an instance because Lean has no way to guess `R`. -/
protected
theorem module.subsingleton (R M : Type*) [semiring R] [subsingleton R] [add_comm_monoid M]
[module R M] :
protected theorem module.subsingleton (R M : Type*) [semiring R] [subsingleton R]
[add_comm_monoid M] [module R M] :
subsingleton M :=
⟨λ x y, by rw [← one_smul R x, ← one_smul R y, subsingleton.elim (1:R) 0, zero_smul, zero_smul]⟩

/-- A semiring is `nontrivial` provided that there exists a nontrivial module over this semiring. -/
protected theorem module.nontrivial (R M : Type*) [semiring R] [nontrivial M] [add_comm_monoid M]
[module R M] :
nontrivial R :=
(subsingleton_or_nontrivial R).resolve_left $ λ hR, not_subsingleton M $
by exactI module.subsingleton R M

@[priority 910] -- see Note [lower instance priority]
instance semiring.to_module [semiring R] : module R R :=
{ smul_add := mul_add,
Expand Down

0 comments on commit e7db193

Please sign in to comment.