Zulip Chat Archive

Stream: mathlib4

Topic: refactoring mathport syntax?


Thomas Murrills (Feb 17 2023 at 00:13):

In tfae_have (!4#2062), I refactor the syntax

syntax (name := tfaeHave) "tfae_have " (ident " : ")? num (" → " <|> " ↔ " <|> " ← ") num : tactic

to

syntax impArrow := " → " <|> " ↔ " <|> " ← "
syntax (name := tfaeHave) "tfae_have " (ident " : ")? num impArrow num : tactic

so that I can easily parse the arrows.

Is this allowed in mathport, or does changing the name of the component syntax node mess things up?

Gabriel Ebner (Feb 17 2023 at 02:02):

Please don't worry too much about changing the syntax, but it will require changes in mathport because right now it's constructing the syntax tree manually. So please ping me or Mario when the change lands.

Thomas Murrills (Feb 21 2023 at 20:47):

@Gabriel Ebner or @Mario Carneiro , tfae_have has just landed, so here's the requested ping :)

Gabriel Ebner (Feb 21 2023 at 21:14):

Looks like the auto-update went without a hitch: https://github.com/leanprover-community/mathport/actions/workflows/update.yml

Mario Carneiro (Feb 22 2023 at 03:28):

actually the new version of the syntax can be written more compactly now rather than splitting into cases for each direction of the arrow, although the old code will still work

Thomas Murrills (Feb 22 2023 at 03:41):

do you mean something like writing syntax " → " : impArrow (plus the rest) instead or am I (likely) misunderstanding?

Mario Carneiro (Feb 22 2023 at 03:48):

I mean the mathport code can be improved


Last updated: Dec 20 2023 at 11:08 UTC