expandAnti :: Signature -> Term -> Term
expandAnti sig t = expandAnti' t
  where expandAnti' (Appl f ts) = Appl f (map expandAnti' ts)
        expandAnti' (Plus t1 t2) = Plus (expandAnti' t1) (expandAnti' t2)
        expandAnti' (Compl t1 t2) = complement sig (expandAnti' t1) (expandAnti' t2)
        expandAnti' (Anti t) = complement sig (Var "_") (expandAnti' t)
        expandAnti' (Var x) = Var x
        expandAnti' Bottom = Bottom
expandAnti :: Signature -> Term -> Term
expandAnti sig t = expandAnti' t
  where expandAnti' (Appl f ts) = Appl f (map expandAnti' ts)
        expandAnti' (Plus t1 t2) = Plus (expandAnti' t1) (expandAnti' t2)
        expandAnti' (Compl t1 t2) = complement sig (expandAnti' t1) (expandAnti' t2)
        expandAnti' (Anti t) = complement sig (Var "_") (expandAnti' t)
        expandAnti' (Var x) = Var x
        expandAnti' Bottom = Bottom
expandAnti sig t = expandAnti' t
  where expandAnti' (Appl f ts) = Appl f (map expandAnti' ts)
        expandAnti' (Plus t1 t2) = Plus (expandAnti' t1) (expandAnti' t2)
        expandAnti' (Compl t1 t2) = complement sig (expandAnti' t1) (expandAnti' t2)
        expandAnti' (Anti t) = complement sig (Var "_") (expandAnti' t)
        expandAnti' (Var x) = Var x
        expandAnti' Bottom = Bottom