Skip to content

Commit

Permalink
Merge pull request #628 from ethereum/more-prop-simp2
Browse files Browse the repository at this point in the history
More Prop simplification rules
  • Loading branch information
msooseth authored Jan 7, 2025
2 parents 4339670 + 765762f commit b44f4b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
This should improve issues when "Unexpected Symbolic Arguments to Opcode" was
unnecessarily output

## Added
- More simplification rules for Props

## [0.54.2] - 2024-12-12

## Fixed
Expand Down
5 changes: 5 additions & 0 deletions src/EVM/Expr.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,9 @@ simplifyProp prop =
go (PLEq _ (Lit x)) | x == maxLit = PBool True
go (PLT (Lit val) (Var _)) | val == maxLit = PBool False
go (PLEq (Var _) (Lit val)) | val == maxLit = PBool True
go (PLT a b) | a == b = PBool False
go (PLT (Lit l) (Lit r)) = PBool (l < r)
go (PLEq a b) | a == b = PBool True
go (PLEq (Lit l) (Lit r)) = PBool (l <= r)
go (PLEq a (Max b _)) | a == b = PBool True
go (PLEq a (Max _ b)) | a == b = PBool True
Expand All @@ -1232,6 +1234,9 @@ simplifyProp prop =
go (PNeg (PBool b)) = PBool (Prelude.not b)
go (PNeg (PNeg a)) = a

-- Empty buf
go (PEq (Lit 0) (BufLength k)) = peq k (ConcreteBuf "")

-- solc specific stuff
go (PEq (Lit 0) (IsZero (IsZero (Eq a b)))) = PNeg (peq a b)

Expand Down

0 comments on commit b44f4b9

Please sign in to comment.