Write a dyadic-predicate list test

Write a dyadic-predicate list test

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

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

As an example && is a dyadic-predicate:

(&&);;
- : bool -> bool -> bool = <fun>

a) Implement exists_symmetric that tests if list contains two items that satisfy pred:

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

b) Now suppose pred is asymmetric, that is, generally:

pred(a,b) != pred(b,a)

Implement the corresponding exists_asymmetric test:

  
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 = ... ;;

And let unifiable be the following function that tests if two patterns are compatible:

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

A choice is a list of patterns. A choice is determinist if and only if no expression is compatible with more than one of its patterns. Using exists_symmetric, implement determinist_choice that tests if a choice is determinist:

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