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

Opaque function annotation #767

Merged
merged 8 commits into from
Nov 24, 2023
Merged

Conversation

marcoeilers
Copy link
Contributor

Adds the ability to annotate functions as @opaque(), which will result in the function body not being known by default. The precondition of the function will still aways be checked, and the postcondition of the function is always known.
Individual function applications can then be annotated with @reveal() to reveal the function definition for that specific usage.

Example:

@opaque()
function isGreaterOne(i: Int): Bool
{ i > 1 }

method mDef(j: Int)
    requires j > -50
{
    assume isGreaterOne(j)
    assert j > 1 // fails
}

method mDef2(j: Int)
    requires j > -50
{
    assume @reveal() isGreaterOne(j)
    assert j > 1 // succeeds
}

Internally, applications of opaque functions are encoded using the existing limited version of the function. @reveal() forces the use of the normal version of the function that triggers the definitional axiom.

@marcoeilers marcoeilers merged commit 8fa723a into master Nov 24, 2023
4 checks passed
@marcoeilers marcoeilers deleted the meilers_opaque_function_experiment branch November 24, 2023 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants