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

Declared operators can indirectly leak into modules #749

Open
oskgo opened this issue Mar 12, 2025 · 1 comment
Open

Declared operators can indirectly leak into modules #749

oskgo opened this issue Mar 12, 2025 · 1 comment

Comments

@oskgo
Copy link
Contributor

oskgo commented Mar 12, 2025

The section mechanism allows defining abstract operators, types and modules (maybe more?) that act as though they were defined inside the section but become parameters of their dependees inside the section when concluding the section. This only works properly when EasyCrypt supports making the dependees parametric, but some things like modules cannot currently be parameterized by operators and types.

Because of these issues with modules in sections EasyCrypt tries to prevent usage of declared operators and types in modules. The current checks do not take into account transitive usages.

Example:

theory Thy.
section.

declare type _T.
type T = _T.
declare op _f: T.
op f: T = _f.

module M = {proc main() = {return f;}}.

end section.
end Thy.
print Thy.

On a side note, it seems to me like sections are a leaky abstraction in a language like EasyCrypt where not everything can be made parametric in terms of everything else.

@oskgo
Copy link
Contributor Author

oskgo commented Mar 14, 2025

A fix should also take into account clones like the following:

theory TO.

type _T.
type T = _T.
op _f: T.
op f: T = _f.

module M = {proc main() = {return f;}}.

end TO.

theory Thy.
section.

declare type _T.
type T = _T.
declare op _f: T.

clone include TO with
type _T <- _T,
type T <- T,
op _f <- _f.

end section.
end Thy.

print Thy.

The current logic handles clones just fine in the non-transitive case, but I could see this needing special care when handling transitive dependencies.

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

No branches or pull requests

1 participant