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

Inconsistency between --concrete-rules and [concrete] attribute #3385

Closed
Baltoli opened this issue May 3, 2023 · 4 comments
Closed

Inconsistency between --concrete-rules and [concrete] attribute #3385

Baltoli opened this issue May 3, 2023 · 4 comments
Assignees

Comments

@Baltoli
Copy link
Contributor

Baltoli commented May 3, 2023

@jberthold reports on Slack that a KEVM rule is getting the concrete attribute applied during compilation.

We narrowed this down to the set of concrete rules passed by the kompile Python code: https://github.com/runtimeverification/evm-semantics/blob/d893b31867b1b73941dc7091bfa13e520841a94e/kevm-pyk/src/kevm_pyk/kompile.py#L50

Jost also identifies that the kompile pipeline may complain if you add the concrete attribute by hand to this rule, which suggests we might consider looking at the ordering of passes here.

There is also a question of why the old Haskell backend handles this case OK.

Things to investigate:

  • Haskell backend old behaviour
  • Warning if attribute specified by hand
  • Correct solution - apply to owise branch for same production automatically? Not clear what we want to do here
@jberthold
Copy link
Member

Definitely a discrepancy between manual insertion of concrete and using the flag:

test.k with concrete attribute:

module TEST
  imports K-EQUAL
  syntax Thing ::= "a" [token]
                 | "b" [token]
                 | "c" [token]
  syntax Thing ::= f ( Thing ) [ function, total ]

  rule [f-of-a-is-b] :  f(A) => b requires A ==K a [concrete]
  rule [f-otherwise] : f(_) => c                   [owise]
endmodule
jost@freshcode-1:~/work/RV/code/scratch/concrete-bug$ kompile test.k
[Error] Compiler: Found concrete attribute without simplification attribute on
function with one or more non-concrete rules.
	Source(/home/jost/work/RV/code/scratch/concrete-bug/test.k)
	Location(10,25,10,51)
	10 |	  rule [f-of-a-is-b] :  f(A) => b requires A ==K a [concrete]
	   .	                        ^~~~~~~~~~~~~~~~~~~~~~~~~~
[Error] Compiler: Had 1 structural errors.
[Warning] Compiler: Could not find main syntax module with name TEST-SYNTAX in
definition.  Use --syntax-module to specify one. Using TEST as default.

test.k without concrete attribute, compiled with --concrete-rules flag

module TEST
  imports K-EQUAL
  syntax Thing ::= "a" [token]
                 | "b" [token]
                 | "c" [token]
  syntax Thing ::= f ( Thing ) [ function, total ]

  rule [f-of-a-is-b] :  f(A) => b requires A ==K a // [concrete]
  rule [f-otherwise] : f(_) => c                   [owise]
endmodule
jost@freshcode-1:~/work/RV/code/scratch/concrete-bug$ kompile test.k --concrete-rules TEST.f-of-a-is-b
[Warning] Compiler: Could not find main syntax module with name TEST-SYNTAX in
definition.  Use --syntax-module to specify one. Using TEST as default.
jost@freshcode-1:~/work/RV/code/scratch/concrete-bug$ grep f-of-a-is-b test-kompiled/definition.kore  | grep -o -e " concrete.........................."
 concrete, label(TEST.f-of-a-is-b),
 concrete{}(), org'Stop'kframework'

@jberthold
Copy link
Member

The kore backend does not apply the owise rule (in the example where this was found) because it considers an antiLeft predicate generated from the other rule's requirement. The new backend skips the antiLeft check and therefore erroneously proceeds to applying the owise rule.

@Baltoli
Copy link
Contributor Author

Baltoli commented May 4, 2023

This is a phase-ordering problem in the frontend; either we:

  1. Modify the order / run the concrete attribute check after the concrete-rules check (not preferred)
  2. Extract the --concrete-rules information in the attribute checker (preferred)

@Scott-Guest
Copy link
Contributor

Closed by #3467

Baltoli pushed a commit that referenced this issue Nov 1, 2023
…3059)

* !!! (31415a0b) haskell-backend/src/main/native/haskell-backend: 31415a0b6 - Remove AcceptsMultipleResults (#3366)

* !!! (9a0e2c29) haskell-backend/src/main/native/haskell-backend: 9a0e2c299 - Update dependency: deps/k_release (#3361)

* !!! (ac889cea) haskell-backend/src/main/native/haskell-backend: ac889cea8 - Monomorphization of Simplifier, leg #2 (#3346)

* !!! (e4bf0795) haskell-backend/src/main/native/haskell-backend: e4bf07956 - Clean up some Template Haskell quoting (#3371)

* !!! (40ec7d6f) haskell-backend/src/main/native/haskell-backend: 40ec7d6fa - Minor cleanups in Kore.Unification.NewUnifier (#3367)

* !!! (9b8df510) haskell-backend/src/main/native/haskell-backend: 9b8df510b - Df/caching termlike hashes (#3338)

* !!! (5623b560) haskell-backend/src/main/native/haskell-backend: 5623b5603 - Monomorphization of Simplifier, leg #3 (#3375)

* !!! (4e76bf2c) haskell-backend/src/main/native/haskell-backend: 4e76bf2ce - Remove some redundant instance constraints (#3370)

* !!! (0d66d723) haskell-backend/src/main/native/haskell-backend: 0d66d7239 - Update dependency: deps/k_release (#3368)

* !!! (9491e547) haskell-backend/src/main/native/haskell-backend: 9491e547a - Use source location in rewrite trace (#3382)

* !!! (0bb5f8b3) haskell-backend/src/main/native/haskell-backend: 0bb5f8b31 - Update dependency: deps/k_release (#3385)

* !!! (154ac3f3) haskell-backend/src/main/native/haskell-backend: 154ac3f33 - Kore Server: fix substitution result sort (#3386)

* !!! (bdfc0fa4) haskell-backend/src/main/native/haskell-backend: bdfc0fa4b - Print build logs when building Nix flakes (#3389)

* Sync flake inputs to submodules

* set-symbolic-tests/inset-11-spec: update expected output

* Sync flake inputs to submodules

* Sync flake inputs to submodules

Co-authored-by: Everett Hildenbrandt <everett.hildenbrandt@gmail.com>
Co-authored-by: rv-jenkins <devops@runtimeverification.com>
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

3 participants