Zulip Chat Archive
Stream: new members
Topic: module has_scalar
Kalle Kytรถlรค (Aug 07 2021 at 23:50):
I have some trouble inferring has_scalar
from module
.
As far as I can see, docs#module extends docs#distrib_mul_action, which extends docs#mul_action, which extends docs#has_scalar. Nevertheless, assuming module
, I fail to apply_instance
to get a has_scalar
:
import algebra.algebra.basic
variables (E : Type*) [add_comm_group E]
def fooโ : has_add E := by apply_instance -- works
variables (๐ : Type*) [semiring ๐] [module ๐ E]
def fooโ : has_scalar E ๐ := by apply_instance -- fails (error message below)
/-
tactic.mk_instance failed to generate instance for
has_scalar E ๐
state:
E : Type u_1,
_inst_1 : add_comm_group E,
๐ : Type u_2,
_inst_2 : semiring ๐,
_inst_3 : module ๐ E
โข has_scalar E ๐
-/
What am I doing wrong? :speechless: Thanks in advance!
Kalle Kytรถlรค (Aug 07 2021 at 23:54):
Oh no, nevermind... I just got the arguments in the wrong order!
The following is fine:
import algebra.algebra.basic
variables (E : Type*) [add_comm_group E]
def fooโ : has_add E := by apply_instance -- works
variables (๐ : Type*) [semiring ๐] [module ๐ E]
def fooโ : has_scalar ๐ E := by apply_instance -- works
Kalle Kytรถlรค (Aug 07 2021 at 23:57):
(For some reason I thought the M
argument should be the "module", and not the "monoid" of scalars... :face_palm:)
Last updated: Dec 20 2023 at 11:08 UTC