any() and all() on empty list?

Tim Peters tim.peters at gmail.com
Wed Mar 29 09:09:19 EST 2006


[Steven D'Aprano]
> ...
> While the implemented behaviour might be more practical than the
> alternatives, it is still worrying paradoxical. If "All sheep are woolly",
> then obviously it must also be true that "Any sheep is woolly". More
> formally, if all(X), then any(X) -- except for the case of empty X. Hmmm.

Right, and this is a very old conundrum in philosophy and logic.  You
shouldn't expect Python to be the first to solve it to everyone's
satisfaction :-)

The particular point catching your fancy is formula 17 in:

    http://www.ditext.com/lejewski/existence.html
    "LOGIC AND EXISTENCE"
    Czeslaw Lejewski

    ...

    The unrestricted interpretation of the quantifiers seems to remove
    yet another difficulty from quantification theory. It has been argued by
    several authors that

    (16) (∃x)(Fx ∨ ∼Fx)

    and

    (17) (x)(Fx) ⊃ (∃x)(Fx),
    [i.e., given that some predicate F is true for all x, it follows that
     there exists an x for which F is true -- or, all(F) implies any(F) - tim]

    which are valid if the universe is not empty, fail for the empty universe as
    their truth depends on there being something.  When discussing these laws
    Quine tries to dismiss the case of the empty universe as
relatively pointless
    and reminds us that in arguments worthy of quantification theory
the universe
    is known or confidently believed to be nonempty. This contention, however,
    does not quite remove our uneasiness particularly as (16) and (17), not
    unlike (7) and (10), are demonstrable in quantification theory.

    On considering (16) and (17) we readily admit that these two formulae fail
    for the empty universe if we understand the quantifiers in accordance with
    the restricted interpretation. ... Under the unrestricted
interpretation, however,
    (16) and (17) come out to be true irrespective of whether the
universe is empty
    or non-empty.

You can read the rest to find out what "the unrestricted
interpretation" is, and then decide whether you really want to live in
a world that endures that much convolution to make (17) true in an
empty universe.  It's possible that we live in such a world, but, if
so, I'd still like my programming languages to be saner ;-)


More information about the Python-list mailing list