Skip to content
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

Modify syntax for properties #331

Open
yav opened this issue May 13, 2016 · 2 comments
Open

Modify syntax for properties #331

yav opened this issue May 13, 2016 · 2 comments
Labels
design needed We need to specify precisely what we want feature request Asking for new or improved functionality language Changes or extensions to the language

Comments

@yav
Copy link
Member

yav commented May 13, 2016

It would be nice if we could write properties like this:

property
   f : [8] -> Bool
   f x = x < 10 || x >= 10

   g x = x == 0x010 || x != 0x10

Basically the syntax is that property starts a block of declarations, and all the declarations in there are properties, and type signatures are allowed. This seems much nicer than having to write:

f : [8] -> Bool
property f x = x < 10 || x >= 10
@acfoltzer
Copy link
Contributor

Alternate idea @robdockins; make property a keyword that takes a list of identifiers that may be defined elsewhere (even in another module) in the usual way. E.g.,

property f, g

f : [8] -> Bool
f x = x < 10 || x >= 10

g x = x == 0x010 || x != 0x10

@acfoltzer acfoltzer added the feature request Asking for new or improved functionality label Jun 29, 2016
@acfoltzer acfoltzer added this to the Cryptol 2.5 milestone Jun 29, 2016
@atomb atomb modified the milestones: Cryptol 2.5, Cryptol 2.6 Feb 5, 2018
@atomb atomb removed this from the Cryptol 2.6 milestone Apr 16, 2018
@brianhuffman brianhuffman added the language Changes or extensions to the language label Oct 18, 2019
@atomb atomb added this to the Someday milestone Oct 25, 2019
@atomb atomb added the low-hanging fruit For issues that should be easy to fix label Oct 25, 2019
@atomb atomb modified the milestones: Someday, 3.0.0 May 4, 2020
@brianhuffman
Copy link
Contributor

One thing we might want to do is allow property to take a list of expressions rather than a list of identifiers.

A common case that I run into is that I have some properties that are size-polymorphic, which means that if I tag them with property, I can't use :prove or :check without arguments to prove/check them all at once. Instead I need to define separate identifiers for each size instance that I want to use:

foo : {n} (fin n) => [n] -> Bit
foo x = ...
property foo_1 = foo`{1}
property foo_2 = foo`{2}
property foo_3 = foo`{3}

So instead of having to invent a bunch of names for each instance, we might like to write

foo : {n} (fin n) => [n] -> Bit
foo x = ...
property foo`{1}
property foo`{2}
property foo`{3}

or even just

foo : {n} (fin n) => [n] -> Bit
foo x = ...
property foo`{1}, foo`{2}, foo`{3}

@atomb atomb removed the low-hanging fruit For issues that should be easy to fix label Sep 22, 2020
@atomb atomb removed this from the 2.10.0 milestone Sep 22, 2020
@brianhuffman brianhuffman added the design needed We need to specify precisely what we want label Sep 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design needed We need to specify precisely what we want feature request Asking for new or improved functionality language Changes or extensions to the language
Projects
None yet
Development

No branches or pull requests

4 participants