(* transitive.ml The function transitive accepts truth values for P, Q, and R. It returns a list of 4 strings, each of which is either "Yes" or "No". The first is "Yes" if P -> Q. " second " " " Q -> R. " third " " " P -> R. and the fourth is "Yes" if ( (P -> Q) ^ (Q -> R) ) -> (P -> R) Note that the fourth is always "Yes". *) fun yesno(true) = "Yes" | yesno(false) = "No"; fun transitive(p, q, r) = let val first = not p orelse q; val second = not q orelse r; val third = not p orelse r in map yesno [first,second,third, (not (first andalso second)) orelse third] end (* Sample call: transitive(true, true, true); *)