Proposal: s1.intersects(s2)
Steven D'Aprano
steve at REMOVE.THIS.cybersource.com.au
Thu Jul 5 19:06:39 CEST 2007
On Thu, 05 Jul 2007 01:48:58 +0000, richyjsm wrote:
> On Jul 4, 8:14 pm, Steven D'Aprano
> <s... at REMOVE.THIS.cybersource.com.au> wrote:
>> However, there's a very subtle flaw in the idea. While "the intersection"
>> of two sets is well-defined, "these two sets intersect" is (surprisingly!)
>> _not_ well-defined.
>
> Poppycock! It's perfectly well defined: two sets intersect if and
> only if their intersection is nonempty.
That's certainly _a_ definition.
I'm not a professional set theorist, but in 15-odd years of studying and
teaching maths I've never come across mathematicians using intersect as a
verb except as informal short-hand. I often say "North Street and South
Street don't intersect", but "the intersection of sets A and B is empty".
Just because I've never come across it doesn't mean it exists, so I'd be
grateful for any reference to a technical definition, or even references
to any mathematician using intersect as a verb in a vigorous,
non-hand-waving way. Here's a link to get you started:
http://www.google.com.au/search?q=define%3Aintersect
> There's absolutely no reason
> to single out the empty set for special treatment in this definition.
But you can't avoid treating the empty set as special, because it _is_
special. You can only choose where to do so. For instance, do sets
intersect with themselves?
By my rule, every set intersects with itself, no exceptions.
By your rule, every set intersects with itself, except for the empty set.
>> The problem comes if we (perhaps naively) try to say that if a set A is a
>> subset of set B, set A must intersect with B.
>
> Well of course false statements are going to cause problems.
My statement is only false if we treat the empty set as special, which
you've said we shouldn't do.
By my rule: if A <= B, then A and B intersect, no exceptions.
By your rule: if A <= B and A is not the empty set, then A and B intersect.
>> (Not all intersecting sets are subsets, but all subsets are
>> intersecting sets.)
>
> Not true.
Can you give a counter-example, without treating the empty set as special?
Of course if you exclude the empty set by definition, my statement is no
longer true -- but that's begging the question of whether we should
exclude the empty set or not.
>> As a result, any proposed function or method that returns a True/False
>> value for whether set A intersects with set B needs to define (and
>> justify) what it means to say that two sets intersect when one or both
>> are the empty set.
>
> Nope. There's one, obvious, correct definition, as given above. No
> need to mention the empty set at all.
It is obvious, but whether it is correct or not depends on how you decide
whether two things intersect or not.
--
Steven.
More information about the Python-list
mailing list