multLin (ECoeff e x) = case multLin e of
  (ELit y)      -> ELit (y * x) -- evaluate coefficient multiplied by literal
  (EVar n)      -> ECoeff (EVar n) x -- do nothing
  (ECoeff e' y) -> ECoeff e' (y * x) -- redundant coefficients
  (EAdd e1 e2)  -> EAdd (multLin (ECoeff e1 x)) (multLin (ECoeff e2 x)) -- recurse
multLin (ECoeff e x) = case multLin e of
  (ELit y)      -> ELit (y * x) -- evaluate coefficient multiplied by literal
  (EVar n)      -> ECoeff (EVar n) x -- do nothing
  (ECoeff e' y) -> ECoeff e' (y * x) -- redundant coefficients
  (EAdd e1 e2)  -> EAdd (multLin (ECoeff e1 x)) (multLin (ECoeff e2 x)) -- recurse
multLin (ECoeff e x) = case multLin e of
  (ELit y)      -> ELit (y * x) -- evaluate coefficient multiplied by literal
  (EVar n)      -> ECoeff (EVar n) x -- do nothing
  (ECoeff e' y) -> ECoeff e' (y * x) -- redundant coefficients
  (EAdd e1 e2)  -> EAdd (multLin (ECoeff e1 x)) (multLin (ECoeff e2 x)) -- recurse