Skip to content

Attempt no. 2 at fixing rule-substitution #3939

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

Merged
merged 4 commits into from
Jun 17, 2024

Conversation

goodlyrottenapple
Copy link
Contributor

@goodlyrottenapple goodlyrottenapple commented Jun 14, 2024

Fixes #3912?

There were three further issues that I identified:

  • When we have a VarX in both the rule and configuration, internally they are distinguished by a different constructor. However, when externalising, this tag was lost. This PR prepends "Rule" to any rule variables and "Eq" to any Equation vars, leaving the original name for all config vars.
  • After match/unification, there is some further processing before the substitution is applied. We are now capturing the simplified/normalised substitution just before it's applied and emitted in a debug message (via debugCreatedSubstitution). This should ensure that the substitution is the correct one.
  • The substitution being returned contained both the mappings from rule variables to subterms of the configuration, as well as learned predicates about equalities between configuration variables and values. The latter are emitted in the rule-predicate field and should not be present in rule-substitution.

@ehildenb
Copy link
Member

Can we add a test this time?

Copy link
Contributor

@geo2a geo2a left a comment

Choose a reason for hiding this comment

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

The change looks good to me!

One question: did we run any of the downsteam projects' test suites? I'd expect the tests that use golden KoreJson files may fails as we are changing the variable names. Perhaps it's worth noting in the update deps PRs that this change needs a golden file update.

@@ -65,7 +65,7 @@
"args": [
{
"tag": "EVar",
"name": "X",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Modified this test to have a VarX both in the rule and the configuration. With this change, we get the correct rule-substitution term in the response:

{
  "tag": "Equals",
  "argSort": {
    "tag": "SortApp",
    "name": "SortInt",
    "args": []
  },
  "sort": {
    "tag": "SortApp",
    "name": "SortGeneratedTopCell",
    "args": []
  },
  "first": {
    "tag": "EVar",
    "name": "RuleVarX",
    "sort": {
      "tag": "SortApp",
      "name": "SortInt",
      "args": []
    }
  },
  "second": {
    "tag": "EVar",
    "name": "VarX",
    "sort": {
      "tag": "SortApp",
      "name": "SortInt",
      "args": []
    }
  }
}

@goodlyrottenapple
Copy link
Contributor Author

The change looks good to me!

One question: did we run any of the downsteam projects' test suites? I'd expect the tests that use golden KoreJson files may fails as we are changing the variable names. Perhaps it's worth noting in the update deps PRs that this change needs a golden file update.

I ran the KEVM test suite and only saw one failure, however the same test failed on master, so seems unrelated

@rv-jenkins rv-jenkins merged commit 4b24eba into master Jun 17, 2024
6 checks passed
@rv-jenkins rv-jenkins deleted the sam/remove-dup-json-rpc-substitution-2 branch June 17, 2024 12:02
goodlyrottenapple added a commit that referenced this pull request Jun 17, 2024
The previously merged PR (#3939) broke booster integration tests,
however, the CI didn't run those and the PR was merged without this
being discovered. This PR fixes the tests and modifies the CI run to
always run booster integration whenever any kore files change.
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.

Haskell backend booster returning a doubled substitution
4 participants