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

Translate coe constants #116

Open
gebner opened this issue Feb 21, 2022 · 5 comments
Open

Translate coe constants #116

gebner opened this issue Feb 21, 2022 · 5 comments

Comments

@gebner
Copy link
Member

gebner commented Feb 21, 2022

That is, translate coe to (↑ ⬝). And coeFn to (· ·).

@digama0
Copy link
Member

digama0 commented Feb 21, 2022

I've actually been using (·) for coe

@gebner
Copy link
Member Author

gebner commented Feb 21, 2022

They are not equivalent, since (·) propagates the expected type:

variable (n : Nat)
#check ( (·) (n + n) : Int)     -- (fun a => a) (Int.ofNat n + Int.ofNat n) : Int
#check ((↑·) (n + n) : Int)     -- (fun a => Int.ofNat a) (n + n) : Int

@digama0
Copy link
Member

digama0 commented Feb 21, 2022

Oh yeah, if it's applied then it's a different story. In that case we probably don't want to use either one and instead should use , because the goal is to get Int.ofNat (n + n), not a beta redex

bors bot pushed a commit to leanprover-community/mathlib4 that referenced this issue Feb 21, 2022
See leanprover-community/mathport#116 (comment)

The notation is a bit problematic for the pretty-printer, as it doesn't automatically insert parentheses to disambiguate it from the built-in coercion notation.  Alternatives:
 1. Use a different token.
 2. Magically define `(↑ ∙)` to be the eta-reduction of `fun x => ↑x`.

PS: the old macro for `↑ x` was redundant since it's been moved to core some time ago.
@gebner
Copy link
Member Author

gebner commented Feb 21, 2022

We also need to translate the and notations (in addition to the constants).

@gebner
Copy link
Member Author

gebner commented Aug 25, 2022

I tried to do this using mathport_rules | `(coe) => `((↑)), but this is trickier than I'd thought at first.

The issue is that the coe constant is represented in Syntax as an identifier. And there's no way to distinguish an identifier in the term category from an identifier used in other syntax (e.g. in { coe := .. }).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants