Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binder can't update to typeclass argument #6078

Open
3 tasks done
YaelDillies opened this issue Nov 14, 2024 · 0 comments · May be fixed by #6634
Open
3 tasks done

Binder can't update to typeclass argument #6078

YaelDillies opened this issue Nov 14, 2024 · 0 comments · May be fixed by #6634
Labels
bug Something isn't working P-medium We may work on this issue if we find the time

Comments

@YaelDillies
Copy link

YaelDillies commented Nov 14, 2024

Prerequisites

Please put an X between the brackets as you perform the following steps:

Description

One can only update the implicitness of binders from () to {} and back. [] cannot be switched to nor from, and ⦃⦄ cannot be switched to (but can be switched from).

Context

In mathlib's measure theory library, we strive to make all MeasurableSpace arguments implicit, unless they are required to be instance arguments for unification purposes. The reason is that mathematically one often wants to consider non-canonical sigma-algebras on a given type (they usually are sigma-subalgebras of a fixed canonical sigma-algebra).

If binder updates towards instance arguments worked, we could do

variable {A : Type} {mA : MeasurableSpace A} -- possibly more instances on `A` here

theorem foo := sorry

theorem bar := sorry

variable (mA) in
def baz := sorry

instead of

-- same thing up to here

def baz {A : Type} [MeasurableSpace A] -- possibly more instances on `A` here
  := sorry

Steps to Reproduce

Consider the following code:

class Foo


variable {foo : Foo}

variable (foo) -- works

variable [foo]
/-
type expected, got
  (foo : Foo)
-/

variable ⦃foo⦄
/-
unexpected syntax
  variable ⦃foo⦄
-/


variable [foo2 : Foo]

variable {foo2}
/-
cannot change the binder annotation of the previously declared local instance `foo2`
-/

variable (foo2)
/-
cannot change the binder annotation of the previously declared local instance `foo2`
-/


variable ⦃foo3 : Foo⦄

variable {foo3} -- works
variable (foo3) -- works

Expected behavior: All binder updates succeed.

Actual behavior: Only some do. Other error in various ways.

Versions

Lean 4.14.0-rc2
Target: x86_64-unknown-linux-gnu

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

@YaelDillies YaelDillies added the bug Something isn't working label Nov 14, 2024
@leanprover-bot leanprover-bot added the P-medium We may work on this issue if we find the time label Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P-medium We may work on this issue if we find the time
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants