let multq q s = 
  if Q.is_zero q then Zero
  else if Q.is_one q then s 
  else match s with
    | Zero -> Zero
    | T -> T
    | F -> F
    | Pos -> if Q.is_pos q then Pos else Neg
    | Neg -> if Q.is_pos q then Neg else Pos
    | Nonneg -> if Q.is_pos q then Nonneg else Nonpos
    | Nonpos -> if Q.is_pos q then Nonpos else Nonneg