Comments (15)
from bbv.
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.
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.
@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.
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.
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.
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.
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.
from bbv.
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.
I am fine with this. I believe it is similar to the notations in List.v.
from bbv.
@JasonGross would you mind submitting a PR for this?
from bbv.
Bump. Can we get this done? I don't mind submitting a pull request for this.
from bbv.
Yes, please submit a PR @vmurali!
I just merged #9, so you can have the "edit lock" for some time 😉
from bbv.
Note also that putting #
at level 0 breaks the infix #
notation from the QArith
stdlib module.
from bbv.
Related Issues (11)
- bbv/theories checkin breaks all projects using bbv HOT 2
- Extracting [hexDigitToN] in Haskell creates Data.Bits.testBit and Data.Char.ord HOT 1
- Make an opam package HOT 7
- Building theories/Word.vo is slow HOT 9
- bulky representation of concrete words HOT 2
- Update opam package HOT 8
- Make new 8.14 compatible release HOT 2
- Incompatibility with coq.8.17.1 HOT 1
- need coq 8.18 compatible release HOT 4
- New release for Coq 8.19? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bbv.