substitute v' t (TEVar v) | v == v' = t
                        | otherwise = TEVar v
substitute v' t (TEVar v) | v == v' = t
                        | otherwise = TEVar v
substitute v' t (TEVar v) | v == v' = t
                        | otherwise = TEVar v