aya-dev icon indicating copy to clipboard operation
aya-dev copied to clipboard

Record inheritance

Open re-xyr opened this issue 4 years ago • 6 comments
trafficstars

How to do this? In Lean, if structure a extends b, then we can build a by either { to_b := some_b_instance, <fields of a> } or { <fields of b>, <fields of a> }. When accessing some b field in an a instance, we can either use a.field or a.to_b.field.

re-xyr avatar Jun 14 '21 02:06 re-xyr

We need to implement aya-prover/aya-prover-proto#150 (which, I guess, is related to aya-prover/aya-prover-proto#128) first

ice1000 avatar Jun 14 '21 02:06 ice1000

So we should implement in this order:

  • typeclass w/o inheritance
  • coercion as typeclass
  • record inheritance through coercion
  • typeclass inheritance through record inheritance

re-xyr avatar Jun 14 '21 02:06 re-xyr

... and built-in definitions.

ice1000 avatar Jun 14 '21 03:06 ice1000

I mean pragmas that make definitions interact with built-in features

ice1000 avatar Jun 14 '21 03:06 ice1000

So we should implement in this order:

  • typeclass w/o inheritance
  • coercion as typeclass
  • record inheritance through coercion
  • typeclass inheritance through record inheritance

No, in this order:

  • aya-prover/aya-prover-proto#503
  • as listed above

ice1000 avatar Jun 14 '21 03:06 ice1000

In Arend, they have this:

class Functor F
 | bleh

class Monad F extends Functor
 | blah

instance ok : Functor Bla
 | bleh

instance ko : Monad Bla
 | Functor => ok
 | bleh => *&^%$#$%^&

ice1000 avatar Jun 14 '21 03:06 ice1000