From: Francis Russell Date: Sun, 14 Apr 2013 10:47:06 +0000 (+0100) Subject: Avoid introducing a sum when negating a product. X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=e1cd8b47d6fae136124780167bbddd4ac8f1e2c1;p=francis%2Flta.git Avoid introducing a sum when negating a product. --- diff --git a/LTA/Symbolic.hs b/LTA/Symbolic.hs index d05f5f6..b52cfc7 100644 --- a/LTA/Symbolic.hs +++ b/LTA/Symbolic.hs @@ -187,6 +187,7 @@ instance Num Expr where (*) a b = simplify . Product $ empty `addPair` (a, 1) `addPair` (b, 1) abs = UnaryFunction Abs fromInteger = Literal . fromInteger + negate (Product pairSeq) = Product $ transformOverall pairSeq (* (-1)) negate a = simplify . Sum $ empty `addPair` (a, -1) signum = UnaryFunction Signum