epfl-lara / stainless

Verification framework and tool for higher-order Scala programs
https://epfl-lara.github.io/stainless/
Apache License 2.0
349 stars 50 forks source link

Revisiting "unfold" and renaming it to unfolding #1552

Open samuelchassot opened 1 month ago

samuelchassot commented 1 month ago

Solves #1550

vkuncak commented 1 month ago

@samuelchassot test fails:

[info] - 219: imperative/valid/UnfoldOpaqueMutate  *** FAILED *** (18 milliseconds)

I am now not sure if we want the argument of unfold to be ghost. Maybe unfold should be opaque. In some cases, we may call an executable function and we may want to direct stainless to unfold it. Perhaps the most confusing aspect of unfold is that it's always returning unit. Perhaps we should have unfolding instead which is an identity function that does nothing but makes stainless unfold the call? How does our internal tree look like for unfold? We should:

samuelchassot commented 1 month ago

I am diving into the code and am documenting what is done. I'll post my documentation here.

samuelchassot commented 1 month ago

Summary

samuelchassot commented 1 month ago

The last point above makes going for a version returning something else than Unit more tricky to handle. I think we can however change it to accept non-ghost argument. And we can make it inline. @vkuncak @mario-bucev WDYT?

samuelchassot commented 1 month ago

(I have some examples of the trees transformation if you want to see)

samuelchassot commented 4 weeks ago

After discussion:

vkuncak commented 4 weeks ago

We should also fix documentation in stainless/core/src/sphinx/library.rst

There is a mention of local inline there in the table. Does this work and how is it different from unfold?