@@ -76,9 +76,13 @@ test_simplify_local_functions =
7676 , test " contradiction: \" one\" = f(x) ∧ f(x) = \" two\" " fString (Left strOne) (Right strTwo)
7777 , test " contradiction: \" one\" = f(x) ∧ \" two\" = f(x)" fString (Left strOne) (Left strTwo)
7878 , 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)
7982 ]
8083 where
8184 f = Mock. f (mkElemVar Mock. x)
85+ fg = Mock. f (Mock. g (mkElemVar Mock. x))
8286 fInt = Mock. fInt (mkElemVar Mock. xInt)
8387 fBool = Mock. fBool (mkElemVar Mock. xBool)
8488 fString = Mock. fString (mkElemVar Mock. xString)
@@ -102,6 +106,11 @@ test_simplify_local_functions =
102106 mkLocalDefn func (Left t) = makeEqualsPredicate t func
103107 mkLocalDefn func (Right t) = makeEqualsPredicate func t
104108
109+ applyDefined1 (Left func) = mkDefined func
110+ applyDefined1 (Right func) = func
111+ applyDefined2 (Left func) = func
112+ applyDefined2 (Right func) = mkDefined func
113+
105114 test name func eitherC1 eitherC2 =
106115 testCase name $ do
107116 let equals1 = mkLocalDefn func eitherC1 & Condition. fromPredicate
@@ -110,6 +119,18 @@ test_simplify_local_functions =
110119 actual <- simplify condition
111120 assertBool " Expected \\ bottom" $ isBottom actual
112121
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+
113134test_predicateSimplification :: [TestTree ]
114135test_predicateSimplification =
115136 [ testCase " Identity for top and bottom" $ do
0 commit comments