[K-Bug] kompile - simplification rule involving cell maps not compiled correctly
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Domain
- compilers
Research direction
Run kompile a.k --backend haskell && kprove spec.k using the definitions in a.k and claim in spec.k. Inspect the generated translation for the simplification rule involving Remainder; done means the translation preserves Remainder on both the left- and right-hand sides as described under Expected Results.
Written by the indexing model from the issue text.
Description
What component is the issue in?
Front-End
Which command
- kompile
- kast
- krun
- kprove
- kprovex
- ksearch
What K Version?
K version: v5.5.40-0-g98574f12a2-dirty
Operating System
Linux
K Definitions (If Possible)
module A
imports INT
configuration
<a>
<k>.K</k>
<shards>
<shard multiplicity="*" type="Map">
<shard-id> 0:Int </shard-id>
<shard-value> 0:Int </shard-value>
</shard>
</shards>
</a>
syntax KItem ::= "start"
syntax Int ::= f(ShardsCell) [function, total]
rule <k> start => f(Shards) </k>
Shards:ShardsCell
rule f(<shards>.Bag</shards>) => 0
rule f(<shards>_:ShardCell Remainder</shards>) => 1 +Int f(<shards>Remainder</shards>) [simplification]
endmodule
If needed, here's a spec using this:
module SPEC
imports A
claim <k> start => 2 </k>
<shards>
<shard>
<shard-id> 0:Int </shard-id>
<shard-value> 0:Int </shard-value>
</shard>
<shard>
<shard-id> 1:Int </shard-id>
<shard-value> 1:Int </shard-value>
</shard>
</shards>
endmodule
Steps to Reproduce
kompile a.k --backend haskell && kprove spec.k
kompile will produce this translation for rule f(<shards>_:ShardCell Remainder</shards>) => 1 +Int f(<shards>Remainder</shards>) [simplification] (indented to make it easier to read):
// rule `f(_)_A_Int_ShardsCell`(`<shards>`(inj{ShardCell,ShardCellMap}(_Gen0)))=>`_+Int_`(#token("1","Int"),`f(_)_A_Int_ShardsCell`(`<shards>`(`.ShardCellMap`(.KList)))) requires #token("true","Bool") ensures #token("true","Bool") [UNIQUE_ID(7e4f664e55f0c88c055d9f2d2ef43b63a866fb51f0e3e8b6c51164c672d74f9f), org.kframework.attributes.Location(Location(22,8,22,89)), org.kframework.attributes.Source(Source(/mnt/data/runtime-verification/elrond-esdt/tmp/a.k)), org.kframework.definition.Production(syntax #RuleContent ::= #RuleBody [klabel(#ruleNoConditions), symbol]), simplification]
axiom{R} \implies{R} (
\top{R}(),
\equals{SortInt{},R} (
Lblf'LParUndsRParUnds'A'Unds'Int'Unds'ShardsCell{}(
Lbl'-LT-'shards'-GT-'{}(
inj{SortShardCell{}, SortShardCellMap{}}(Var'Unds'Gen0:SortShardCell{})
)
),
\and{SortInt{}} (
Lbl'UndsPlus'Int'Unds'{}(
\dv{SortInt{}}("1"),
Lblf'LParUndsRParUnds'A'Unds'Int'Unds'ShardsCell{}(
Lbl'-LT-'shards'-GT-'{}(Lbl'Stop'ShardCellMap{}())
)
),
\top{SortInt{}}()
)
)
)
[org'Stop'kframework'Stop'attributes'Stop'Source{}("Source(/mnt/data/runtime-verification/elrond-esdt/tmp/a.k)"), org'Stop'kframework'Stop'definition'Stop'Production{}("syntax #RuleContent ::= #RuleBody [klabel(#ruleNoConditions), symbol]"), org'Stop'kframework'Stop'attributes'Stop'Location{}("Location(22,8,22,89)"), simplification{}(""), UNIQUE'Unds'ID{}("7e4f664e55f0c88c055d9f2d2ef43b63a866fb51f0e3e8b6c51164c672d74f9f")]
Expected Results
The translation for rule f(<shards>_:ShardCell Remainder</shards>) => 1 +Int f(<shards>Remainder</shards>) [simplification] should use the Remainder variable.
To be specific, the LHS of this rule should be translated to f(<shards>_:ShardCell Remainder</shards>), not to f(<shards>_:ShardCell</shards>) and the RHS of this rule should be translated to 1 +Int f(<shards>Remainder</shards>), not to 1 +Int f(<shards>.ShardCellMap</shards>).
- Dominant language
- Python
- Stars
- 591
- Forks
- 163
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from runtimeverification/k
-
runtimeverification/k#4939 · 1 assignee ·
-
Concolic Explorer Open
Difficulty 5/5 Over a week Newbie friendliness 32/100
runtimeverification/k#4937 ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
runtimeverification/k#4936 ·
-
type:epic
runtimeverification/k#4934 · 4 comments · 1 assignee ·
-
runtimeverification/k#4924 · 1 assignee ·
All issues in runtimeverification/k
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100