The sort function must define a (strict) weak order for a correct sorting. A partial order is not enough.