-
Notifications
You must be signed in to change notification settings - Fork 235
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
Towards a naming convention for the standard library? #687
Comments
Regarding 1: This sounds quite reasonable, at first. However, Lemma in F* is just an abbreviation for Pure unit. As such, it isn't particularly special. I see it really as quite similar to a Prop in Coq. Generalizing this convention, should the effect of a function be reflected in that function's name? Ideally, a naming convention like the one you're hinting at below, if done correctly, should suffice without the |
Regarding 5: Good idea. We should add the private qualifier there. It's not used enough currently. |
I concur with @nikswamy regarding 1., I'd prefer to avoid the Add to 3. other various prefixes and suffixes I've seen: 6. If we're adopting the naming conventions of Coq, I'd say that we name similar lemmas the same way as in Coq's standard library. For instance 7. Compound names: camelCase vs snake_case. Which to use? Should we use a different style for differentiating constructions: e.g. use camelCase for values but snake_case for lemmas (much more compact than using a |
@s-zanella
While we are not necessarily going to follow all of Ssreflect's guidelines (although I just figured out that my proposal about naming |
It was a bit of stretch to say that If we had to chose a system to be compatible with, LEAN is probably our best choice given that at some point we would like to use it to certify our proofs. |
TR: Currently experimenting on
FStar.Seq
(proposed changes coming soon.)I propose the following guidelines:
lemma_
This convention seems to be in progress of being adopted. It totally makes sense in F* to clearly separate operators from their properties (compared to Coq, where a lemma is really an ordinary term which can very well appear in the definition of something that is more than just a proof term).
foo(bar(…))
should be named
lemma_foo_bar
, with a suffix if there are several of them.Examples in
FStar.Seq
:lemma_of_list_length
->lemma_length_of_list
;lemma_of_list
->lemma_index_of_list
_1
,_2
, etc.should be avoided in favor of more expressive names, for instance:
foo_intro
,foo_elim
for “general principles” of foo in conclusion vs. foo in hypotheses (convention seems to be already adopted)foobin_bar_left
,foobin_bar_right
for lemmas about interactions between a binary operator and another operator, i.e. pertaining tofoobin(bar(…), …)
,foobin(…, bar(…))
respectively.Example in
FStar.Seq
:lemma_index_app1
->lemma_index_append_left
;lemma_index_app2
->lemma_index_append_right
Question: should we use shorter suffixes such as
_l
,_r
(cf. Coq:plus_0_r
)get_set_same
,get_set_other
for interactions between getter and setter (cf. CompCert maps:gss
,gso
)Example in
FStar.Seq
:lemma_index_upd1
->lemma_index_upd_same
;lemma_index_upd2
->lemma_index_upd_other
length
should be based onlength
rather thanlen
Example in
FStar.Seq
:lemma_len_slice
->lemma_length_slice
mem
instead ofmember
(see Coq/OCaml:List.mem
).upd
vs.update
? Source?_aux
should be privateI claim, to reduce the base of lemmas when translating to Z3/Lean.
The text was updated successfully, but these errors were encountered: