Giter Club home page Giter Club logo

Comments (15)

vmurali avatar vmurali commented on July 25, 2024

from bbv.

andres-erbsen avatar andres-erbsen commented on July 25, 2024

Is there actually a good reason why $ should be at the extreme level of 0, as opposed to something like 10 (same as function application)? Since both of these are breaking changes, it may make sense to do them together.

from bbv.

samuelgruetter avatar samuelgruetter commented on July 25, 2024

Also, some notations are in word_scope, while others don't have an explicit scope, is there any reason for this other than historical?
Not opening word_scope provides some protection from unwanted notations, but probably not what @JasonGross needs, because even if you don't open word_scope, the notations still define the level and associativity in an irreversible way, so they should really be in a separate module.

from bbv.

samuelgruetter avatar samuelgruetter commented on July 25, 2024

@andres-erbsen if you put $ at level 10, you have to write f ($4) ($5) instead of f $4 $5, which I think is undesirable. Level 9 is the highest level where f $4 $5 still works. Do you have a particular other notation in mind which would benefit from changing the level of $?

from bbv.

andres-erbsen avatar andres-erbsen commented on July 25, 2024

f $4 $5 sounds like an use case that I don't want to argue against, so feel free to pick any level below 10 or keep it at 0 as you wish. Overall, I think avoiding bringing in notations is a better approach than trying to make them compatible -- after all, Haskell people would probably want to put $ at level 100 or something like that to act as ( ... ) $ ( ... )...

from bbv.

JasonGross avatar JasonGross commented on July 25, 2024

I would like to put it at level 9, x at level 10 for usage in fiat-crypto, so that it displays without the parentheses, which is incompatible both with at level 9 and with at level 10 (and with at level 0). This is why I want it to not be exported by default anywhere.

from bbv.

samuelgruetter avatar samuelgruetter commented on July 25, 2024

What exactly do you mean by "displays without parentheses"? I can do the following, is this what you meant?

Definition word(sz: nat): Set. Admitted.
Definition natToWord (sz n : nat) : word sz. Admitted.


Notation "$ n" := (natToWord _ n) (at level 0, n at level 0, format "$ n") .

Definition f{sz}(a b c: word sz): word sz. Admitted.

Definition a: nat := 7.
Definition t: word 8 := f $a $5 $(3 + 4).

Print t. (* prints "f $a $5 $(3 + 4)" *)

Whereas currently, this would print as f $ (a) $ (5) $ (3 + 4). I think it would be nice to have $ without parentheses in Word.v too.

from bbv.

JasonGross avatar JasonGross commented on July 25, 2024

Yes, that is what I meant. But, even with this change, I think that both # and $ should be in their own module and not exported by default.

from bbv.

vmurali avatar vmurali commented on July 25, 2024

from bbv.

samuelgruetter avatar samuelgruetter commented on July 25, 2024

Yes of course we should put the notations inside a module, I was just wondering whether we can get parenthesis-less $ in bbv too because I think that would be nice.

Moreover, it would also be nice if the lemmas in Word.v could still use $, to avoid big refactoring effort. Do you think it would be ok to have the following code inside Word.v? (As in, is $ isolated enough to not spoil what you or anyone else in the future wants to do?)

Module WordNotations.

Notation "$ n" := (natToWord _ n) (at level 0, n at level 0, format "$ n") .

(* more notations... *)

End WordNotations.

Import WordNotations. (* but not exported *)

(* lemmas happily using $ ... *)

from bbv.

vmurali avatar vmurali commented on July 25, 2024

I am fine with this. I believe it is similar to the notations in List.v.

from bbv.

samuelgruetter avatar samuelgruetter commented on July 25, 2024

@JasonGross would you mind submitting a PR for this?

from bbv.

vmurali avatar vmurali commented on July 25, 2024

Bump. Can we get this done? I don't mind submitting a pull request for this.

from bbv.

samuelgruetter avatar samuelgruetter commented on July 25, 2024

Yes, please submit a PR @vmurali!
I just merged #9, so you can have the "edit lock" for some time 😉

from bbv.

JasonGross avatar JasonGross commented on July 25, 2024

Note also that putting # at level 0 breaks the infix # notation from the QArith stdlib module.

from bbv.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.