Steven D'Aprano wrote:
On Sun, 14 Jun 2009 19:14:10 -0400, Terry Reedy wrote:

Steven D'Aprano wrote:
So-called "vacuous truth". It's often useful to have all([]) return
true, but it's not *always* useful -- there are reasonable cases where
the opposite behaviour would be useful:
[...]
It seems to me that the absurd conclusion implied by the theorem
invalidates the theorem rather than supporting your point.

I wouldn't go so far as to say the vacuous truth theorem ("empty statements are true") is invalidated. The Wikipedia article discusses various reasons why it's more correct (or at least more useful) to treat vacuous statements as true:

http://en.wikipedia.org/wiki/Vacuous_truth

But it's not without difficulties -- however those difficulties are smaller than those if you take vacuous statements as false in general.

[...]
Try finding another 'reasonable case'.

Any time you do something like:

if not x and all(x):
    process(x)


instead of just:

if all(x):
    process(x)


I can't think of a real world example off the top of my head, but here's a contrived example demonstrating that vacuous truths imply both a fact and it's opposite:


def startswith(s, chars):
    """Return True if s starts with any of chars."""
    for c in chars:
        if s.startswith(c): return True
    return False


if all([startswith(w, "aeiou") for w in words]):
    print "All the words start with vowels."

if all([startswith(w, "bcdfghjklmnpqrstvwxyz") for w in words]):
    print "All of the words start with consonants."
If words is empty, this code claims that all of the words start with vowels as well as starting with consonants.

So? These are true and non-contradictory. They are NOT 'opposites'. Together they imply that there are are no words in words, which is true. To paraphrase my response to mel, I believe it was:

[(x in words => x.startswith(vowel)) and
(x in words => x.startswith(nonvowel)) and
x.startswith(vowel) <=> not(x.startswith(nonvowel)]
=> not(x in words)
which is the definition of 'words is the empty set'
by the law of contradiction.

The negation of 'all words starts with vowel' is 'there exists a word that starts with a non-vowel', which is different from 'all words start with consonants' since the latter is true when there are no words whereas the former is not.

Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to