This is easier to understand if we talk about all, any :: (a -> Bool) -> [a] -> Bool . Clearly:
all p searches the list to find counterexample for the predicate p . It returns False if and only if such a counterexample is found.any p searches the list to find an example that satisfies the predicate p . It returns True if and only if such an example is found.
Thus:
all p [] true because the empty list does not contain a counterexample for p .any p [] is false because the empty list does not contain examples satisfying p .
Note that:
and == all id or == any id
So, this argument continues to and, or :: [Bool] -> Bool .
Note that mathematical logic often also works as follows:
This sentence is true if unicorns do not exist. Logical beginners are also confused by this ...
source share