@@ -76,9 +76,13 @@ test_simplify_local_functions =
76
76
, test " contradiction: \" one\" = f(x) ∧ f(x) = \" two\" " fString (Left strOne) (Right strTwo)
77
77
, test " contradiction: \" one\" = f(x) ∧ \" two\" = f(x)" fString (Left strOne) (Left strTwo)
78
78
, test " contradiction: f(x) = \" one\" ∧ \" two\" = f(x)" fString (Right strOne) (Left strTwo)
79
+ -- Ignore Defined marker
80
+ , testDefined " contradiction: f(g(x)) = a ∧ f(g(x)) = b" (Right fg) (Right a) (Right b)
81
+ , testDefined " contradiction: f(g(x)) = a ∧ f(g(x)) = b" (Left fg) (Right a) (Right b)
79
82
]
80
83
where
81
84
f = Mock. f (mkElemVar Mock. x)
85
+ fg = Mock. f (Mock. g (mkElemVar Mock. x))
82
86
fInt = Mock. fInt (mkElemVar Mock. xInt)
83
87
fBool = Mock. fBool (mkElemVar Mock. xBool)
84
88
fString = Mock. fString (mkElemVar Mock. xString)
@@ -102,6 +106,11 @@ test_simplify_local_functions =
102
106
mkLocalDefn func (Left t) = makeEqualsPredicate t func
103
107
mkLocalDefn func (Right t) = makeEqualsPredicate func t
104
108
109
+ applyDefined1 (Left func) = mkDefined func
110
+ applyDefined1 (Right func) = func
111
+ applyDefined2 (Left func) = func
112
+ applyDefined2 (Right func) = mkDefined func
113
+
105
114
test name func eitherC1 eitherC2 =
106
115
testCase name $ do
107
116
let equals1 = mkLocalDefn func eitherC1 & Condition. fromPredicate
@@ -110,6 +119,18 @@ test_simplify_local_functions =
110
119
actual <- simplify condition
111
120
assertBool " Expected \\ bottom" $ isBottom actual
112
121
122
+ testDefined name eitherFunc eitherC1 eitherC2 =
123
+ testCase name $ do
124
+ let equals1 =
125
+ mkLocalDefn (applyDefined1 eitherFunc) eitherC1
126
+ & Condition. fromPredicate
127
+ equals2 =
128
+ mkLocalDefn (applyDefined2 eitherFunc) eitherC2
129
+ & Condition. fromPredicate
130
+ condition = equals1 <> equals2
131
+ actual <- simplify condition
132
+ assertBool " Expected \\ bottom" $ isBottom actual
133
+
113
134
test_predicateSimplification :: [TestTree ]
114
135
test_predicateSimplification =
115
136
[ testCase " Identity for top and bottom" $ do
0 commit comments