Uninterpreted function signature #1457
Replies: 5 comments
-
How about |
Beta Was this translation helpful? Give feedback.
-
Though this use-case is somewhat niche, the current situation means it is not possible to declare a trait function with a 'default body' that is uninterpreted. |
Beta Was this translation helpful? Give feedback.
-
My vote is to require a specific keyword (i.e., the My two main concerns are:
I am not particularly about the extra typing necessary (at least imho, uninterpreted functions are not the "common case" for most verified code, thus we don't need to make it be the absolute minimum length needed and can actually afford to keep it longer, to obtain the above benefits). No strong opinions on the specific keyword used (imho, Tangent (click to open)I experimented with ChatGPT for an alternative keyword, and it suggested "mysterious" 😆 Prompting it further gave "vague" and "incomprehensible" 🤣 |
Beta Was this translation helpful? Give feedback.
-
Would everyone be onboard with cc @Chris-Hawblitzel @tjhance @jaybosamiya-ms @jonhnet @jaylorch ? React 👍 for yes, and 👎 for no: if you vote no, please provide an argument. |
Beta Was this translation helpful? Give feedback.
-
"Uninterpreted" is the word Z3 uses for it, but I'm not sure that adjective is sufficiently evocative to be understandable to a lay user. I'm not sure what would work, better, though; perhaps "unspecified" or "undefined"? |
Beta Was this translation helpful? Give feedback.
-
At the moment, we allow uninterpreted functions to be written as:
open spec fn name(a: int) -> (b: int)
closed spec fn name(a: int) -> (b: int)
spec fn name(a: int) -> (b: int)
The first doesn't really make sense (the function does not have a body). The last two could be considered equivalent. Relatedly, we plan to disallow the
open
/closed
modifier on trait function declarations, but these will "get a body" given by the trait implementation, while free or associated (i.e. in animpl
) uninterpreted functions never have a body.We are currently considering two options:
spec fn name(a: int) -> (b: int);
uninterpreted spec fn name(a: int) -> (b: int);
or some other similar marker, to highlight that the function is, in fact, uninterpreted.The former is shorter (and is currently valid) but might be considered to be confusing because a similar declaration in a trait has a different meaning, the latter requires more typing, and would require a deprecation cycle.
I recommend we stick to either of these two options, so we can resolve this quickly. You're welcome to suggest alternatives, but they need to be well-motivated. Additionally, if you prefer the second option (adding a marker), we are looking for suggestions on what the marker should be.
Beta Was this translation helpful? Give feedback.
All reactions