Implement ordering function and ordinal predicate