Partial functions / changes to recommends checking #685
Replies: 2 comments 2 replies
-
@Chris-Hawblitzel asked @jonhnet to experimentally add These are @jonhnet's results:
High order bits. First, the latency cost:
Next, the usability cost: I set out to try fixing all 84 recommends failures that came up. I only made it a few fns in before realizing it was a fool's errand without ensures on spec fns. So I think I can't really lean into the world of spec(checked)-always (which I want!) until I have spec ensures -- and perhaps also a way to call a proof fn to complete a check in hairier cases. |
Beta Was this translation helpful? Give feedback.
-
This is subsumed by the proposals in #764. |
Beta Was this translation helpful? Give feedback.
-
From a discussion with @jonhnet, and from discussions at the [Verus all-hands] and with @Chris-Hawblitzel.
@jonhnet has reported frustration with the fact that the lack of hard
requires
onspec
functions can hide issues/mistakes when writing them and till later, when one has to investigate a proof failure caused by a malformedspec
function that could have been caught by arequires
a-la Dafny.At the retreat, we discussed a proposal of introducing partial functions (with requires) but only in user code (and not in the standard library). The primary concern here is "function coloring", where each function that calls a partial function must also be partial (modulo more complex designs that allow to total-ize a partial function). The other complication is
FnSpec
s (now likely renamed to something likespec_fn
): should they also be partial? E.g.Seq::new_req(n, |i:int| requires 0<= i < n foo(i))
.At the retreat, we were wondering if the poor experience has been due to
recommends
being unreliable so far, in such a way that incentivizes ignoring the recommends failures.We are considering defaulting to the behavior of
spec(checked)
(which checks recommends for the bodies of the spec functions) and allow users to opt-out for larger functions with e.g.spec(unchecked)
.Beta Was this translation helpful? Give feedback.
All reactions