Skip to content

Opaque function annotation#767

Merged
marcoeilers merged 8 commits into
masterfrom
meilers_opaque_function_experiment
Nov 24, 2023
Merged

Opaque function annotation#767
marcoeilers merged 8 commits into
masterfrom
meilers_opaque_function_experiment

Conversation

@marcoeilers

Copy link
Copy Markdown
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
@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