Commit c3f3c6f4 authored by Philipp Meyer's avatar Philipp Meyer

Small rewrite

parent 2f387156
...@@ -95,10 +95,10 @@ eliminateModulo' n makeVar (Equation lhs (ModEq m) rhs) = ...@@ -95,10 +95,10 @@ eliminateModulo' n makeVar (Equation lhs (ModEq m) rhs) =
let k = makeVar n let k = makeVar n
in (Equation lhs Eq (rhs :+: ((Const m) :*: (Var k))), [k]) in (Equation lhs Eq (rhs :+: ((Const m) :*: (Var k))), [k])
eliminateModulo' n makeVar (Equation lhs (ModNe m) rhs) = eliminateModulo' n makeVar (Equation lhs (ModNe m) rhs) =
let j = makeVar (n + 1) let j = makeVar n
k = makeVar n k = makeVar (n + 1)
in ((Equation lhs Eq (rhs :+: ((Var j) :+: ((Const m) :*: (Var k))))) :&: in ((Equation lhs Eq (rhs :+: ((Var j) :+: ((Const m) :*: (Var k))))) :&:
(Equation (Const 0) Lt (Var j)) :&: (Equation (Var j) Lt (Const m)), [k, j]) (Equation (Const 0) Lt (Var j)) :&: (Equation (Var j) Lt (Const m)), [j, k])
eliminateModulo' n makeVar (g :|: h) = eliminateModulo' n makeVar (g :|: h) =
let (g', ag) = eliminateModulo' n makeVar g let (g', ag) = eliminateModulo' n makeVar g
(h', ah) = eliminateModulo' (n + length ag) makeVar h (h', ah) = eliminateModulo' (n + length ag) makeVar h
......
...@@ -23,6 +23,8 @@ opToFunction Eq = (.==) ...@@ -23,6 +23,8 @@ opToFunction Eq = (.==)
opToFunction Ne = (./=) opToFunction Ne = (./=)
opToFunction Le = (.<=) opToFunction Le = (.<=)
opToFunction Lt = (.<) opToFunction Lt = (.<)
opToFunction (ModEq _) = error "symbolic modulo not supported"
opToFunction (ModNe _) = error "symbolic modulo not supported"
evaluateFormula :: (Ord a, Show a) => Formula a -> SIMap a -> SBool evaluateFormula :: (Ord a, Show a) => Formula a -> SIMap a -> SBool
evaluateFormula FTrue _ = true evaluateFormula FTrue _ = true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment