Write a binary-predicate list test

Write a binary-predicate list test

A binary-predicate is a function that tests a relation between two arguments. A binary-predicate has the general signature:

- : 'a -> 'a -> bool = <fun>

As examples = and && are both symmetric binary-predicates:

# (=);;
- : 'a -> 'a -> bool = <fun>
# (&&);;
- : bool -> bool -> bool = <fun>

a) Implement exists_symmetric that tests if list contains distinct items x and y such that pred x y = pred y x = true.

let exists_symmetric pred list = ... ;;
val exists_symmetric : ('a -> 'a -> bool) -> 'a list -> bool = <fun>

b) There also exists asymmetric binary-predicates such as < and > :

# (>);;
- : 'a -> 'a -> bool = <fun>

Implement exists_asymmetric that tests if list contains distinct items x and y such that (pred x y) or (pred y x) = true.

let exists_asymmetric pred list = ... ;;
val exists_asymmetric : ('a -> 'a -> bool) -> 'a list -> bool = <fun>

c) Let pattern be the following declared type:

type pattern = ... ;;

A sub-pattern is a less general, more specific pattern.
Two patterns are said to be unifiable iff there exist one pattern object that is a sub-pattern of both of them.

Let unifiable be the unifiability test:

let unifiable pat1 pat2 = ... ;;
val unifiable : pattern -> pattern -> bool = <fun>

A choice is a list of patterns.
A choice is said to be determinist iff there exist no pattern object that is a sub-pattern of more than one pattern within the choice. That is iff there doesn't exist two patterns within the choice that are unifiable. Using exists_symmetric, implement determinist_choice that tests if a pat_list choice is determinist:

let determinist_choice pat_list = ... ;;
val determinist_choice : pattern list -> bool = <fun>