Zulip Chat Archive

Stream: general

Topic: Typeclass inference cannot find is_scalar_tower.left


Eric Wieser (Dec 16 2020 at 12:39):

mwe:

import algebra.module.basic

variables {R M : Type*} [semiring R] [add_comm_monoid M] [semimodule R M]

instance test1 : is_scalar_tower R R M := mul_action.is_scalar_tower.left _ -- ok
instance test2 : is_scalar_tower R R M := infer_instance  -- fails

docs#mul_action.is_scalar_tower.left is an instance, so why can't lean find it for me?

Eric Wieser (Dec 16 2020 at 13:02):

Maybe this is because is_scalar_tower.left depends on docs#mul_action.regular which isn't registered as an instance by default

Kenny Lau (Dec 16 2020 at 13:36):

What is the error?

Kenny Lau (Dec 16 2020 at 13:37):

Is it because infer_instance doesn't work for Prop

Kevin Buzzard (Dec 16 2020 at 13:40):

by apply_instance works

Kevin Buzzard (Dec 16 2020 at 13:40):

infer_instance : Π {α : Type u} [i : α], α

indeed Type u not Sort u, for some reason.

Eric Wieser (Dec 16 2020 at 13:48):

Is docs#infer_instance part of core?

Eric Wieser (Dec 16 2020 at 13:49):

Added in https://github.com/leanprover-community/lean/commit/f487989470d9e0c116a213a11c0f2ccc102c66fc

Eric Wieser (Dec 16 2020 at 13:51):

let's find out if there is a reason: leanprover-community/lean#506


Last updated: Dec 20 2023 at 11:08 UTC