Skip to content

outParam on instances #1852

Closed
Closed

Description

@riccardobrasca

Prerequisites

  • Put an X between the brackets on this line if you have done all of the following:
    • Checked that your issue isn't already filed.
    • Reduced the issue to a self-contained, reproducible test case.

Description

The following

class foo (F : Type) where
  foo : F

class foobar (F : outParam Type) [foo F] where
  bar : F

gives the error

invalid class, parameter #2 depends on `outParam`, but it is not an `outParam`

It can be fixed writing

class foo (F : Type) where
  foo : F

class foobar (F : outParam Type) [outParam (foo F)] where
  bar : F

but in Lean3 this was not necessary.

I don't know if this is the expected behavior, but it looks worse than in Lean3.

Activity

  1. leodemoura commented on Nov 18, 2022

    @leodemoura
    Member

    I don't know if this is the expected behavior, but it looks worse than in Lean3.

    My interpretation is: you prefer Lean 4 to silently treat implicit arguments that depend on other outParam as outParams, correct?
    If yes, could you please confirm with other users whether they are happy with this change?

  2. digama0 commented on Nov 18, 2022

    @digama0
    Collaborator

    My 2c on this issue is that, for the case of instance implicit args specifically, it is already assumed that they are searched only after all of their (non-outParam) arguments are ready. Since F is not an outParam of foo in this example, that means that we would normally expect instance search of [foo F] to happen only after F is available, which means that it is already logically an outparam.

    So I think we should silently / automatically upgrade these instance arguments to outparams without requiring an annotation. For regular variables I think the error message makes sense and should stay.

  3. added a commit that references this issue on Nov 30, 2022
    bb7fdbf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions