toExpression :: SMTExpression ZThree -> SolverM ZThree Z.AST
toExpression = fromMP . E.fromPolynomial MP.variable MP.constant where -- to exploit simplification
  fromMP (MP.Var (NLit v)) = return v
  fromMP (MP.Const i)      = Z.mkInteger i
  fromMP (MP.Plus a b)     = Z.mkAdd =<< sequence [fromMP a, fromMP b]
  fromMP (MP.Mult a b)     = Z.mkMul =<< sequence [fromMP a, fromMP b]
  fromMP MP.Max{}          = error "max encountered"
toExpression :: SMTExpression ZThree -> SolverM ZThree Z.AST
toExpression = fromMP . E.fromPolynomial MP.variable MP.constant where -- to exploit simplification
  fromMP (MP.Var (NLit v)) = return v
  fromMP (MP.Const i)      = Z.mkInteger i
  fromMP (MP.Plus a b)     = Z.mkAdd =<< sequence [fromMP a, fromMP b]
  fromMP (MP.Mult a b)     = Z.mkMul =<< sequence [fromMP a, fromMP b]
  fromMP MP.Max{}          = error "max encountered"
toExpression = fromMP . E.fromPolynomial MP.variable MP.constant where -- to exploit simplification
  fromMP (MP.Var (NLit v)) = return v
  fromMP (MP.Const i)      = Z.mkInteger i
  fromMP (MP.Plus a b)     = Z.mkAdd =<< sequence [fromMP a, fromMP b]
  fromMP (MP.Mult a b)     = Z.mkMul =<< sequence [fromMP a, fromMP b]
  fromMP MP.Max{}          = error "max encountered"