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

Func claims translation to KORE #2733

Merged
merged 3 commits into from
Jul 27, 2022
Merged

Func claims translation to KORE #2733

merged 3 commits into from
Jul 27, 2022

Conversation

radumereuta
Copy link
Contributor

Translate functional claims into kore in a similar way we do for simplification rules

@radumereuta radumereuta linked an issue Jul 18, 2022 that may be closed by this pull request
2 tasks
@radumereuta radumereuta requested a review from JKTKops July 18, 2022 17:47
@radumereuta
Copy link
Contributor Author

module TEST
    imports INT
    syntax Int ::= f ( Int ) [function, functional]
    rule f(1) => 2
endmodule
module SPEC
  imports TEST
  claim f(1) => 2
  rule  f(1) => 2 [simplification]
endmodule
[org'Stop'kframework'Stop'attributes'Stop'Source{}("Source(/home/radu/work/test/spec.k)")]
module SPEC

// imports
import TEST []


// claims
// claim `f(_)_TEST_Int_Int`(#token("1","Int"))=>#token("2","Int") requires #token("true","Bool") ensures #token("true","Bool") [org.kframework.attributes.Location(Location(3,9,3,18)), org.kframework.attributes.Source(Source(/home/radu/work/test/spec.k)), org.kframework.definition.Production(syntax #RuleContent ::= #RuleBody [klabel(#ruleNoConditions), symbol])]
  claim{R} \implies{R} (
    \top{R}(),
    \equals{SortInt{},R} (
      Lblf'LParUndsRParUnds'TEST'Unds'Int'Unds'Int{}(\dv{SortInt{}}("1")),
     \and{SortInt{}} (
       \dv{SortInt{}}("2"),
        \top{SortInt{}}())))
  [org'Stop'kframework'Stop'attributes'Stop'Location{}("Location(3,9,3,18)"), org'Stop'kframework'Stop'attributes'Stop'Source{}("Source(/home/radu/work/test/spec.k)"), org'Stop'kframework'Stop'definition'Stop'Production{}()]

// rule `f(_)_TEST_Int_Int`(#token("1","Int"))=>#token("2","Int") requires #token("true","Bool") ensures #token("true","Bool") [org.kframework.attributes.Location(Location(4,9,4,18)), org.kframework.attributes.Source(Source(/home/radu/work/test/spec.k)), org.kframework.definition.Production(syntax #RuleContent ::= #RuleBody [klabel(#ruleNoConditions), symbol]), simplification]
  axiom{R} \implies{R} (
    \top{R}(),
    \equals{SortInt{},R} (
      Lblf'LParUndsRParUnds'TEST'Unds'Int'Unds'Int{}(\dv{SortInt{}}("1")),
     \and{SortInt{}} (
       \dv{SortInt{}}("2"),
        \top{SortInt{}}())))
  [org'Stop'kframework'Stop'attributes'Stop'Location{}("Location(4,9,4,18)"), org'Stop'kframework'Stop'attributes'Stop'Source{}("Source(/home/radu/work/test/spec.k)"), org'Stop'kframework'Stop'definition'Stop'Production{}(), simplification{}()]

endmodule [org'Stop'kframework'Stop'attributes'Stop'Location{}("Location(1,1,5,10)"), org'Stop'kframework'Stop'attributes'Stop'Source{}("Source(/home/radu/work/test/spec.k)")]

Calling kprove though crashes the haskell backend:

Executing [kore-exec, /home/radu/work/test/./test-kompiled/definition.kore, --module, TEST, --prove, /home/radu/work/test/./.kprove-2022-07-18-20-46-05-227-6ebedd82-dc71-4e0c-a35c-84fdfa7bd0f6/spec.kore, --spec-module, SPEC, --output, /home/radu/work/test/./.kprove-2022-07-18-20-46-05-227-6ebedd82-dc71-4e0c-a35c-84fdfa7bd0f6/result.kore]
Executing command: kore-exec /home/radu/work/test/./test-kompiled/definition.kore --module TEST --prove /home/radu/work/test/./.kprove-2022-07-18-20-46-05-227-6ebedd82-dc71-4e0c-a35c-84fdfa7bd0f6/spec.kore --spec-module SPEC --output /home/radu/work/test/./.kprove-2022-07-18-20-46-05-227-6ebedd82-dc71-4e0c-a35c-84fdfa7bd0f6/result.kore
kore-exec: [83394] Error (ErrorException):
    Prelude.undefined
    CallStack (from HasCallStack):
      error, called at libraries/base/GHC/Err.hs:79:14 in base:GHC.Err
      undefined, called at src/Kore/Claim/SomeClaim.hs:184:17 in kore-0.60.0.0-AfDbhwdKwsp4a4wsGSYVve:Kore.Claim.SomeClaim
Created bug report: kore-exec.tar.gz

@ana-pantilie
Copy link
Contributor

Please add a warning for these kinds of claims that they're currently unsupported in the backend.

TODO: remove when backend implements it.
@radumereuta radumereuta requested review from ana-pantilie and removed request for JKTKops July 26, 2022 14:33
@radumereuta
Copy link
Contributor Author

Warning message looks something like this. The haskell backend still fails though.
You should be able to test it more easily now.

kore-exec: [164228] Error (ErrorException):
    Unexpected empty set of claims.
    Possible explanation: the frontend and the backend don't agree on the representation of claims.
    CallStack (from HasCallStack):
      error, called at src/Kore/Exec.hs:800:26 in kore-0.60.0.0-32qEnrm4hFr1HXNMYza0uf:Kore.Exec
Created bug report: kore-exec.tar.gz
[Warning] Compiler: Functional claims not yet supported.
https://github.com/runtimeverification/haskell-backend/issues/3010
	Source(/home/radu/work/test/spec.k)
	Location(3,9,3,18)
	3 |	  claim f(1) => 2
	  .	        ^~~~~~~~~

Copy link
Contributor

@ana-pantilie ana-pantilie left a comment

Choose a reason for hiding this comment

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

Great, thank you!

@rv-jenkins rv-jenkins merged commit e988a7d into master Jul 27, 2022
@rv-jenkins rv-jenkins deleted the funcClaim branch July 27, 2022 12:17
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.

3 participants