Terry Reedy tjreedy at udel.edu
Mon Jun 15 22:00:42 CEST 2009

```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)
>
>
>
> 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]):
>
> if all([startswith(w, "bcdfghjklmnpqrstvwxyz") for w in words]):
> 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'