Backend fails to simplify complex shift expressions with bitwise AND operations
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Inizia dal caso che fallisce in src/tests/integration/test-data/specs/xx.k e confrontalo con le due espressioni funzionanti mostrate nell’issue. Analizza come il backend combina lo shift, AND bit a bit e il ragionamento aritmetico, incluse le annotazioni smt-lemma tentate. Il lavoro è completato quando l’espressione complessa si semplifica in true e il caso di integrazione passa.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem Description
We've encountered an issue where the K backend fails to simplify certain complex expressions involving bit shifts and logical operations, even when simpler variants of the same expressions work correctly.
Failing Case
The following simplification rule fails:
0 <=Int (Bytes2Int(substrBytes(W3, 8, 12), LE, Unsigned) +Int Y +Int Z &Int 4294967295) >>Int 8 => true
Working Cases
However, these similar expressions work correctly:
// This works when X is a simple variable
0 <=Int X >>Int 8 => true
requires 0 <=Int X
// This works for the complex term without the shift
0 <=Int Bytes2Int(substrBytes(W3, 8, 12), LE, Unsigned) +Int Y +Int Z &Int 4294967295 => true
Root Cause Analysis
The backend cannot infer the complex case from the combination of the two working cases. This suggests a limitation in the theorem prover's ability to compose logical reasoning across multiple steps.
Attempted Solutions
- SMT Lemmas: Adding
smt-lemmaannotations to the<=Intrules didn't resolve the issue.
Questions
- Is there a recommended workaround for cases where the backend cannot perform multi-step logical inference?
- What's the best way to utilize theory reasoning for complex expressions like this?
Environment
- Related to PR #137: Fix unsimplified
bytes2int o int2bytespatterns - File:
src/tests/integration/test-data/specs/xx.k
Expected Behavior
The complex shift expression should simplify to true just like its simpler components do.
Additional Context
This issue is blocking the completion of PR #137, which aims to fix unsimplified bytes2int o int2bytes patterns in the RISC-V semantics. But we have another way to solve this issue.
- Lingua principale
- Haskell
- Stelle
- 228
- Fork
- 46
- Merge medio
- 21h 48m
- PR unite (30g)
- 1
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di runtimeverification/haskell-backend
-
Booster: Optimize KMap internal data structure to improve Map operation performanceForse di nuovo libera @Stevengre l’ha presa 252 giorni fa e non c’è nessuna pull request aperta. Aperta
runtimeverification/haskell-backend#4138 · 9 commenti · 1 assegnatario ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
-
Evaluate `sat.smt=true` option for z3Forse di nuovo libera @jberthold l’ha presa 643 giorni fa e non c’è nessuna pull request aperta. Aperta
runtimeverification/haskell-backend#4089 · 1 assegnatario ·
Tutte le issue di runtimeverification/haskell-backend
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
yesodweb/wai#1163 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Web.Scotty.Trans.Lazy.setHeader calls addHeader instead of setHeaderForse già presa @tusharad l’ha presa 1 giorno fa. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
scotty-web/scotty#436 ·
-
Broken links in the docsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
input-output-hk/haskell.nix#2617 ·
-
easy first-contributor first-contributors good first issue haskell help wanted up-for-grabs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
fork-commit-merge/fork-commit-merge#8455 ·
I maintainer di solito rispondono entro 1 giorno
-
Add cabal-gild as fixerApertanew tool
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
dense-analysis/ale#5176 ·