-
Notifications
You must be signed in to change notification settings - Fork 44
Remove Defined markers in simplifyConjunctionByAssumption #2372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
6b8bf8b
c199733
c0af21c
951a183
3636947
265f276
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,13 +76,18 @@ test_simplify_local_functions = | |
, test "contradiction: \"one\" = f(x) ∧ f(x) = \"two\"" fString (Left strOne) (Right strTwo) | ||
, test "contradiction: \"one\" = f(x) ∧ \"two\" = f(x)" fString (Left strOne) (Left strTwo) | ||
, test "contradiction: f(x) = \"one\" ∧ \"two\" = f(x)" fString (Right strOne) (Left strTwo) | ||
-- Ignore Defined marker | ||
, testDefined "contradiction: f(g(x)) = a ∧ f(g(x)) = b" (Right fg) (Right a) (Right b) | ||
, testDefined "contradiction: f(g(x)) = a ∧ f(g(x)) = b" (Left fg) (Right a) (Right b) | ||
] | ||
where | ||
f = Mock.f (mkElemVar Mock.x) | ||
fg = Mock.f (Mock.g (mkElemVar Mock.x)) | ||
fInt = Mock.fInt (mkElemVar Mock.xInt) | ||
fBool = Mock.fBool (mkElemVar Mock.xBool) | ||
fString = Mock.fString (mkElemVar Mock.xString) | ||
defined = makeCeilPredicate f & Condition.fromPredicate | ||
definedFg = makeCeilPredicate fg & Condition.fromPredicate | ||
|
||
a = Mock.a | ||
b = Mock.b | ||
|
@@ -102,6 +107,11 @@ test_simplify_local_functions = | |
mkLocalDefn func (Left t) = makeEqualsPredicate t func | ||
mkLocalDefn func (Right t) = makeEqualsPredicate func t | ||
|
||
applyDefined1 (Left func) = mkDefined func | ||
applyDefined1 (Right func) = func | ||
applyDefined2 (Left func) = func | ||
applyDefined2 (Right func) = mkDefined func | ||
|
||
test name func eitherC1 eitherC2 = | ||
testCase name $ do | ||
let equals1 = mkLocalDefn func eitherC1 & Condition.fromPredicate | ||
|
@@ -110,6 +120,18 @@ test_simplify_local_functions = | |
actual <- simplify condition | ||
assertBool "Expected \\bottom" $ isBottom actual | ||
|
||
testDefined name eitherFunc eitherC1 eitherC2 = | ||
testCase name $ do | ||
let equals1 = | ||
mkLocalDefn (applyDefined1 eitherFunc) eitherC1 | ||
& Condition.fromPredicate | ||
equals2 = | ||
mkLocalDefn (applyDefined2 eitherFunc) eitherC2 | ||
& Condition.fromPredicate | ||
condition = definedFg <> equals1 <> definedFg <> equals2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mean we should remove |
||
actual <- simplify condition | ||
assertBool "Expected \\bottom" $ isBottom actual | ||
|
||
test_predicateSimplification :: [TestTree] | ||
test_predicateSimplification = | ||
[ testCase "Identity for top and bottom" $ do | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the difference between
Right fg
andLeft fg
?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right fg
will applymkDefined
to thef(g(x)
in the second equals, andLeft fg
to the one in the first. This makes sure we test that theDefined
markers are removed when both assuming and looking up terms.