[Haskell-cafe] Re: Set Operations In Haskell's Type System
wren ng thornton
wren at freegeek.org
Sun May 9 06:46:20 EDT 2010
John Creighton wrote:
> On May 6, 4:30 am, Bartek Ćwikłowski <paczesi... at gmail.com> wrote:
>> 2010/5/6 John Creighton <johns2... at gmail.com>:
>>
>>> "a" isa "d" if their exists a "b" and "c" such that the following
>>> conditions hold:
>>> "a" isa subset of "b",
>>> "b" isa "c"
>>> "c" is a subset of "d"
>> This definition doesn't make sense - it's recursive, but there's no
>> base case, unless this is some kind of co-recursion.
>>
>> Are you sure that "subset" isn't what you really want? With subset you
>> can already ask questions such as "is tabby cat an animal?". If so, my
>> code (from hpaste) already has this (iirc isDescendentOf ).
>
> When I succeed in implementing it I'll show you the result. Anyway,
> some perspective (perhaps), I once asked, "what is the difference
> between a subset and an element of a set:
>
> http://www.n-n-a.com/science/about33342-0-asc-0.html
And it's truly an interesting question. Too bad it didn't get a better
discussion going (from what I read of it). Though the link Peter_Smith
posted looks interesting.
> note 1) Okay I'm aware some will argue my definitions here and if it
> helps I could choose new words, the only question really is, is the
> relationship isa which I described a useful abstraction.
I think the key issue comes down to what you want to do with it. I'm not
entirely sure what the intended reading is for "isa subset of", but I'll
assume you mean the same as "is a subset of"[1]. One apparent side
effect of the definition above is that it collapses the hierarchy.
That is, with traditional predicates for testing element and subset
membership, we really do construct a hierarchy. If A `elem` B and B
`elem` C, it does not follow that A `elem` C (and similar examples). But
with your definition it seems like there isn't that sort of
stratification going on. If the requirements are A `subset` B, B `elem`
C, and C `subset` D--- well we can set C=D, and now: A `elem` D = A
`subset` B && B `elem` D.
Depending on the ontology you're trying to construct, that may be
perfectly fine, but it's certainly a nonstandard definition for elements
and subsets. I don't know if this mathematical object has been worked on
before, but it's not a hierarchy of sets.
[1] My other, equivalent, guess would be you mean "A isa (powerset B)"
but avoided that notation because it looks strange.
--
Live well,
~wren
More information about the Haskell-Cafe
mailing list