[Haskell-cafe] and [] = True; or [] = False
Bjorn Buckwalter
bjorn at buckwalter.se
Mon Apr 26 08:15:40 EDT 2010
Dear all,
Does it make good sense that 'and []' returns 'True' and 'or []'
returns 'False'? The Haskell Road to Logic, Maths and Programming says
so:
"The function or takes a list of truth values and returns True if at
least one member of the list equals True, while and takes a list of
truth values and returns True if all members of the list equal True."
"Should the conjunction of all elements of [] count as true or false?
As true, for it is indeed (trivially) the case that all elements of []
are true. So the identity element for conjunction is True. Should the
disjunction of all elements of [] count as true or false? As false,
for it is false that [] contains an element which is true. Therefore,
the identity element for disjunction is False."
While the above reasoning is fine, and allows straight-forward
implementations, it isn't extremely convincing. In particular, it
isn't clear that, while simple, the definitions of the first paragraph
are the most sensible. Perhaps one of the more mathematically versed
readers on the Cafe could enlighten me?
What got me thinking about this was the apparently incorrect intuition
that 'and xs' would imply 'or xs'.
Thanks,
Bjorn
More information about the Haskell-Cafe
mailing list