Zulip Chat Archive

Stream: mathlib4

Topic: Scoped attribute


Frédéric Dupuis (Dec 23 2022 at 17:16):

In #1188, there is a scoped attribute being defined:

scoped[Pointwise] attribute [instance] Set.hasOne Set.hasZero

This is apparently not implemented yet, I get the error:

expected 'binder_predicate', 'elab', 'elab_rules', 'infix', 'infixl', 'infixr', 'instance', 'macro', 'macro_rules', 'notation', 'notation3', 'postfix', 'prefix', 'syntax' or 'unif_hint'

Should I just wait for this to get fixed?

Patrick Massot (Jan 03 2023 at 10:02):

The situation definitely improves if you add import Mathlib.Tactic.ScopedNS at top. However Lean still complains about scoped attribute not being implemented despite https://github.com/leanprover-community/mathlib4/blob/master/Mathlib/Tactic/ScopedNS.lean#L53 @Mario Carneiro

Patrick Massot (Jan 03 2023 at 10:03):

The error message is simply

elaboration function for 'Mathlib.Tactic.scopedNS' has not been implemented

Patrick Massot (Jan 03 2023 at 10:03):

on a line such as scoped[Pointwise] attribute [instance] Set.hasInv Set.hasNeg

Mario Carneiro (Jan 03 2023 at 10:07):

I don't see any obvious reason for that. I assume the line has no doc comment or attributes?

Patrick Massot (Jan 03 2023 at 10:17):

MWE:

import Mathlib.Tactic.ScopedNS

theorem foo : 1 + 1 = 2 := rfl

scoped[Nat] attribute [simp] foo

Patrick Massot (Jan 03 2023 at 10:18):

This is using mathlib4 70c3e2a60de1a253fd835104382304384c3b14ad

Patrick Massot (Jan 03 2023 at 10:18):

from four days ago.

Mario Carneiro (Jan 04 2023 at 02:26):

This appears to be a bug in syntax match itself. Reported as lean4#2005

Patrick Massot (Jan 04 2023 at 07:46):

Thanks a lot for investigating this!


Last updated: Dec 20 2023 at 11:08 UTC