Zulip Chat Archive

Stream: general

Topic: What happened for "extends" under the hood?


Erika Su (Oct 23 2022 at 06:38):

suppose

class C (a  : Sort u) extends A a, B a where

Does the lean automatically implement something like

instance (a : Sort u) : Coe (C a) (A a)

underneath?
I wondered because i found that i C.methodsOfA doesn't exist, whereas C.methodsOfC exist.

Kevin Buzzard (Oct 23 2022 at 07:03):

Is this lean 3 or lean 4?

Erika Su (Oct 23 2022 at 07:46):

it's lean4.

Scott Morrison (Oct 24 2022 at 22:35):

Have a look at the output of

import Mathlib.Util.WhatsNew

class A (α : Sort u)
class B (α : Sort u)

whatsnew in
class C (α  : Sort u) extends A α, B α where

variable (i : C α) in
#synth B α

There's no coercion being generated, but instead instances are being provided. You just use the methods from A (i.e. as A.method, or just method after open A).


Last updated: Dec 20 2023 at 11:08 UTC