digama0 / mm0

Metamath Zero specification language
Creative Commons Zero v1.0 Universal
315 stars 40 forks source link

potential set.mm0 issue #22

Closed Lakedaemon closed 4 years ago

Lakedaemon commented 4 years ago

In the current set.mm0, shouldn't def wa (ph ps: wff): wff = $ ~(ph -> ~ps) $; be instead def wa (ph ps: wff): wff = $ ~(ph -> ~ ps) $; because the dynamic parser would not recognize "tilde+ps" as the 2 tokens "tilde" and "ph" ? Or am I wrong ?

digama0 commented 4 years ago

This is controlled by the delimiter command. delimiter $ left delims $ $ right delims $; declares a bunch of left and right delimiter characters (a character can be both, and in the form delimiter $ both delims $; all characters in the list are declared as both). A token is a maximal sequence of non-whitespace tokens, except that tokens are always broken after a left delimiter and before a right delimiter. So for example if ( is a left and ) is a right delimiter, then )x( is one token but (x) is three.

In set.mm0, ~ is declared as a both delimiter (this file was written before there were separate left and right delimiters; today I would declare this as a left delimiter), meaning that it always exists as a token on its own even if there are no whitespaces around it. x~~ph gets tokenized as x ~ ~ ph.

Lakedaemon commented 4 years ago

Ah yes, set.mm0 has ~ as a delimiter, contraty to set.mm.mm0. My bad.

I did not know about left/right/both delimiters though. I thought that all delimiters were "both" delimiters

digama0 commented 4 years ago

I don't think the mm0 spec has been updated yet, but I'm slowly working this two-argument version of delimiter into the tools. It is useful for notations like f(x, y) where we want f( to be a token. In peano.mm1 this comes up a lot because notations all have to start with different tokens and letter prefixes are used for disambiguation, which doesn't work if they come behind a bracketing character like S[x / y] A unless [ is allowed to be a left delimiter but not a both delimiter.

Lakedaemon commented 4 years ago

It's fine by me as long as you update the grammar readme at some point (which I can see in the commits). I'll adapt when it comes. In the meantime, I'm really happy to work with the current available mm0/mmu spec.

Also, could I get your opinion on the last post of https://github.com/digama0/mm0/issues/13 ? It is completely ok, If you deem it unnecessary. But It would help me to know where you stand.