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

Add class KoreDefn #4712

Merged
merged 7 commits into from
Dec 19, 2024
Merged

Conversation

tothtamas28
Copy link
Contributor

@tothtamas28 tothtamas28 commented Dec 13, 2024

  • Encapsulates semantic information about a Definition: sorts, symbols, the sort ordering, rewrite and function rules.
  • Method project_to_rewrites removes all sorts, symbols and function rules that are not relevant for rewriting.

@tothtamas28 tothtamas28 self-assigned this Dec 13, 2024
@tothtamas28
Copy link
Contributor Author

Based on an ad-hoc experiment, for imp-semantics, about 40% of sorts, 60% of symbols, and more than 90% of function symbols present in definition.kore are irrelevant for rewriting.

For evm-semantics, the numbers are about 40%, 60% and 75%, respectively.

@tothtamas28 tothtamas28 marked this pull request as ready for review December 16, 2024 12:42
@tothtamas28 tothtamas28 requested a review from JuanCoRo December 16, 2024 15:46
@jberthold
Copy link
Member

Based on an ad-hoc experiment, for imp-semantics, about 40% of sorts, 60% of symbols, and more than 90% of function symbols present in definition.kore are irrelevant for rewriting.

For evm-semantics, the numbers are about 40%, 60% and 75%, respectively.

I agree we are carrying around some (typically auto-generated) payload that we won't usually need (those project_ functions, for one).
However, symbols being "not relevant for rewriting" (i.e. not occurring on rewrite rules) can still not be simply stripped off from the definition. They can be in the input, and need to be known to the rewrite engine to accept them in input.

BTW does the "rewriting" include function equations? Because obviously function symbols don't appear in rewrite rules on the LHS, they can only be on the RHS.

@tothtamas28
Copy link
Contributor Author

tothtamas28 commented Dec 17, 2024

However, symbols being "not relevant for rewriting" (i.e. not occurring on rewrite rules) can still not be simply stripped off from the definition. They can be in the input, and need to be known to the rewrite engine to accept them in input.

That's fair. In this particular case though, we need this transformation for the Lean 4 backend, where only rewrite rules are relevant (or just some of them, which will be a generalization of this transformation).

Edit: #4712 (comment)

BTW does the "rewriting" include function equations?

Yes, for those function symbols that appear in rewrite rules (transitively).

@tothtamas28
Copy link
Contributor Author

However, symbols being "not relevant for rewriting" (i.e. not occurring on rewrite rules) can still not be simply stripped off from the definition. They can be in the input, and need to be known to the rewrite engine to accept them in input.

I ran into a corner case for this actually: the GeneratedCounterCell constructor is stripped as the cell is abstract in all rewrite rules. Moving the PR back to draft to fix this.

@tothtamas28 tothtamas28 marked this pull request as draft December 17, 2024 16:30
@tothtamas28 tothtamas28 marked this pull request as ready for review December 18, 2024 15:03
Copy link
Member

@jberthold jberthold left a comment

Choose a reason for hiding this comment

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

LGTM

@automergerpr-permission-manager automergerpr-permission-manager bot merged commit 638559f into develop Dec 19, 2024
18 checks passed
@automergerpr-permission-manager automergerpr-permission-manager bot deleted the minimize-definition branch December 19, 2024 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants