Skip to content

[Bug] [kompile] - Compilation fails for simplifications with #Exists on right-hand side #2709

@PetarMax

Description

@PetarMax

K Version

$ kompile --version
K version:    v5.3.98-5-g993674655
Build date:   Thu Jul 07 14:35:59 BST 2022

Description

Compilation fails for either of the following two simplification, which have the Matching-Logic #Exists on right-hand side:

rule { C #Equals { C }:>Int } => #Exists I1. { C #Equals I1:Int } [simplification]
rule { C #Equals { C }:>Int } => #Exists ?I1. { C #Equals ?I1:Int } [simplification]

Input Files

File exists-simpl.k, version 1:

module EXISTS-SIMPL-SYNTAX 
endmodule

module EXISTS-SIMPL

  rule { C #Equals { C }:>Int } => #Exists I1. { C #Equals I1:Int } [simplification, anywhere]

endmodule

File exists-simpl.k, version 2:

module EXISTS-SIMPL-SYNTAX 
endmodule

module EXISTS-SIMPL

  rule { C #Equals { C }:>Int } => #Exists ?I1. { C #Equals ?I1:Int } [simplification, anywhere]

endmodule

Reproduction Steps

Run: kompile exists-simpl.k --backend haskell

For version 1:

[Error] Compiler: Cannot encode equations with existential variables to KORE.
 If this is desired, please use #Exists with regular variables.
 Offending variables: [?I1]

For version 2:

[Error] Compiler: Found variable I1 on right hand side of rule, not bound on
left hand side. Did you mean "?I1"?
        Source(/Users/petarmax/Projects/RV/exists-simpl.k)
        Location(6,44,6,46)
        6 |       rule { C #Equals { C }:>Int } => #Exists I1. { C #Equals I1:Int }
[simplification]
```          .                                

Expected Behavior
-----------------

At least one of the two simplifications being allowed by the compiler.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions