Skip to content

Commit

Permalink
Recognize rewrite rules using intEq and intModEq relations.
Browse files Browse the repository at this point in the history
This is a band-aid pending a proper solution for #1261.
  • Loading branch information
Brian Huffman committed Aug 26, 2021
1 parent 8c37922 commit 033b866
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions saw-core/src/Verifier/SAW/Rewriter.hs
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,12 @@ vecEqIdent = mkIdent (mkModuleName ["Prelude"]) "vecEq"
equalNatIdent :: Ident
equalNatIdent = mkIdent (mkModuleName ["Prelude"]) "equalNat"

intEqIdent :: Ident
intEqIdent = mkIdent (mkModuleName ["Prelude"]) "intEq"

intModEqIdent :: Ident
intModEqIdent = mkIdent (mkModuleName ["Prelude"]) "intModEq"

-- | Converts a universally quantified equality proposition from a
-- Term representation to a RewriteRule.
ruleOfTerm :: Term -> Maybe a -> RewriteRule a
Expand Down Expand Up @@ -345,6 +351,10 @@ ruleOfProp (R.asApplyAll -> (R.isGlobalDef boolEqIdent -> Just (), [x, y])) ann
Just $ mkRewriteRule [] x y ann
ruleOfProp (R.asApplyAll -> (R.isGlobalDef vecEqIdent -> Just (), [_, _, _, x, y])) ann =
Just $ mkRewriteRule [] x y ann
ruleOfProp (R.asApplyAll -> (R.isGlobalDef intEqIdent -> Just (), [x, y])) ann =
Just $ mkRewriteRule [] x y ann
ruleOfProp (R.asApplyAll -> (R.isGlobalDef intModEqIdent -> Just (), [_, x, y])) ann =
Just $ mkRewriteRule [] x y ann
ruleOfProp (unwrapTermF -> Constant _ body) ann = ruleOfProp body ann
ruleOfProp (R.asEq -> Just (_, x, y)) ann =
Just $ mkRewriteRule [] x y ann
Expand Down

0 comments on commit 033b866

Please sign in to comment.