Zulip Chat Archive

Stream: general

Topic: Dot notation on abbreviation


Yaël Dillies (Oct 11 2021 at 16:52):

Consider the following:

import data.fintype.basic

structure foo_on {α : Type*} (s : finset α) :=
(n : )

abbreviation foo (α : Type*) [fintype α] := foo_on (finset.univ : finset α)

example {α : Type*} [fintype α] (bar : foo α) : bar.n = bar.n :=
begin
  -- bar.n = bar.n
end

def foo_on.m {α : Type*} {s : finset α} (bar : foo_on s) :  := bar.n

example {α : Type*} [fintype α] (bar : foo α) : bar.m = bar.m :=
begin
  -- foo_on.m bar = foo_on.m bar
end

Dot notation sees through abbreviation, but gets pretty-printed correctly only for fields of the original structure. Is there any way around that? by manipulating the transparency of foo_on.m, maybe?

Eric Wieser (Oct 11 2021 at 17:26):

In general the pretty printer is much more conservative about what it shows with dot notation than the elaborator is in what it accepts.

Eric Wieser (Oct 11 2021 at 17:27):

Although I think that would be easy to change


Last updated: Dec 20 2023 at 11:08 UTC