-
Notifications
You must be signed in to change notification settings - Fork 152
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
Avoid clashes of generated declarations and Lean 4 #4742
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider opening an issue for this instead. We can clear up minor issues like this once we have a semi-automatic end-to-end example worked out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be handled in the generator, and maybe checked in the model.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll leave this as a future item if/when work on this PR resumes.
pyk/src/pyk/k2lean4/model.py
Outdated
@@ -7,6 +7,9 @@ | |||
|
|||
if TYPE_CHECKING: | |||
from collections.abc import Iterable | |||
from typing import Final | |||
|
|||
_LEAN_KEYWORDS: Final = {'ite', 'end', 'where'} # Words that cannot be a the name of a declaration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
end
and where
are keywords, ite
is probably just a predefined function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it to _LEAN_WORDS
. Let me know if this notation is not desired, or if we should separate into two sets depending on keyword or definition.
I'll open an issue then, and leave finishing the rest of the work here for when we decide to tackle it 👌 |
Some generated names might clash with Lean's built in declarations. For instance, generating the function symbols for
evm-semantics
producesaxiom ite
, which clashes with Lean:To avoid the clash error, it is now generated as:
Safeguards are put in place for other types of declarations, such as
inductive
,structure
,abbrev
andinstance
.