Skip to content

make pow opaque #1714

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

make pow opaque #1714

wants to merge 2 commits into from

Conversation

ahuoguo
Copy link
Collaborator

@ahuoguo ahuoguo commented May 30, 2025

@parno spotted pow function is not marked as opaque even though it's revealed everywhere.

For context, Dafny standard library also did not mark it as opaque now, even though it was marked as opaque before.

Seems like part of the reason I did not mark opaque is because I wanted to reveal(pow) in the spec function of pow2

pub open spec fn pow2(e: nat) -> nat
decreases
e // ensures pow2(e) > 0
// cannot have ensurs clause in spec functions
// a workaround is the lemma_pow2_pos below
,
{
// you cannot reveal in a spec function, which cause more reveals clauses
// for the proof
// reveal(pow);
pow(2, e) as nat
}

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

@ahuoguo ahuoguo requested a review from parno May 30, 2025 20:36
Copy link
Collaborator

@parno parno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like the right, conservative thing to do. Can you check on veritas to see how much it breaks?

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