public static <T, C extends Collection<T>> C upwardsAntichain(@NotNull C poset, @NotNull BiPredicate<T, T> predicate) {
    for (Iterator<T> iterator = poset.iterator(); iterator.hasNext(); ) {
      T left = iterator.next();
      for (T right : poset) {
        ProgressManager.checkCanceled();
        if (right != left && predicate.test(left, right)) {
          iterator.remove();
          break;
        }
      }
    }
    return poset;
  }
public static <T, C extends Collection<T>> C upwardsAntichain(@NotNull C poset, @NotNull BiPredicate<T, T> predicate)