Re: Set Theory (Was: Do junctions support determining interesections of lists)

2006-04-04 Thread Larry Wall
On Tue, Apr 04, 2006 at 11:02:55AM -0700, Jonathan Lang wrote:
: Will perl6 Sets include set negation and/or a universal set?  In
: effect, an internal flag that says, this set contains every possible
: element _except_ the ones listed?

Arguably, that's what none() is.  And all() is the only junction that
is also a normal enumerated set.  The any() junction is the set of
sets that would intersect with the corresponding all() set without
producing the null set.  And the one() junction is the set of sets
corresponding to the enumeration of all().

But this is all based on enumerated sets.  Oddly missing are any
Sets that are defined by rule.  That would presumably take closures,
though I suppose one can attempt to enumerate the closures that have
to hold true and autothread through the calls to those closures...

Can Russel be far behind?  :-)

Larry


Re: Set Theory (Was: Do junctions support determining interesections of lists)

2006-04-04 Thread Jonathan Lang
Larry Wall wrote:
 On Tue, Apr 04, 2006 at 11:02:55AM -0700, Jonathan Lang wrote:
 : Will perl6 Sets include set negation and/or a universal set?  In
 : effect, an internal flag that says, this set contains every possible
 : element _except_ the ones listed?

 Arguably, that's what none() is.

...except that none() is a Junction, not a Set.  As such, the same
arguments that say that any() and all() aren't suitable for use as
Sets apply to none(), don't they?

--
Jonathan Dataweaver Lang


Re: Set Theory (Was: Do junctions support determining interesections of lists)

2006-04-04 Thread Larry Wall
On Tue, Apr 04, 2006 at 11:23:14AM -0700, Jonathan Lang wrote:
: Larry Wall wrote:
:  On Tue, Apr 04, 2006 at 11:02:55AM -0700, Jonathan Lang wrote:
:  : Will perl6 Sets include set negation and/or a universal set?  In
:  : effect, an internal flag that says, this set contains every possible
:  : element _except_ the ones listed?
: 
:  Arguably, that's what none() is.
: 
: ...except that none() is a Junction, not a Set.  As such, the same
: arguments that say that any() and all() aren't suitable for use as
: Sets apply to none(), don't they?

You're confusing the map with the territory.  We're trying to decide
*how* Junctions are like Sets, not defining them into two different
universes.  I'm saying that all() is the Junction tha is most like
a Set.  A none() Junction can be viewed as the specification for an
infinite set of sets that do not intersect with the corresponding all()
junction. Infinite sets are a bit hard to compute with directly.

A one() junction is the spec for a number of sets corresponding to the
values of the corresponding all() junction, each of which contains only
one element from that set.  An any() Junction is all possible subsets
not counting the null set.

So junctional logic could be defined in terms of set theory, but not
in a necessarily computable way.

Larry


Re: Set Theory (Was: Do junctions support determining interesections of lists)

2006-04-04 Thread Flavio S. Glock
2006/4/4, Larry Wall [EMAIL PROTECTED]:
 But this is all based on enumerated sets.  Oddly missing are any
 Sets that are defined by rule.  That would presumably take closures,
 though I suppose one can attempt to enumerate the closures that have
 to hold true and autothread through the calls to those closures...

 Can Russel be far behind?  :-)

This is in ext/Recurrence:

use Recurrence;

# all integer numbers
$universe = Recurrence.new(
closure_next = sub { $_ + 1 },
closure_previous = sub { $_ - 1 },
:is_universe(1) );

# all even integers
$even_numbers = Recurrence.new(
closure_next = sub { 2 * int( $_ / 2 ) + 2 },
closure_previous = sub { 2 * int( ( $_ - 1 ) / 2 ) },
universe = $universe );

# all odd integers
$odd_numbers = $even_numbers.complement;

# all non-zero integers
$non_zero = Recurrence.new(
closure_next =sub ($x) { $x == -1 ??  1 !! $x + 1 },
closure_previous =sub ($x) { $x ==  1 ?? -1 !! $x - 1 },
complement_next = sub ($x) { $x  0   ??  0 !!Inf },
complement_previous = sub ($x) { $x  0   ??  0 !!   -Inf },
universe = $universe );

- Flavio S. Glock


Re: Set Theory (Was: Do junctions support determining interesections of lists)

2006-04-04 Thread Jonathan Lang
Larry Wall wrote:
 You're confusing the map with the territory.  We're trying to decide
 *how* Junctions are like Sets, not defining them into two different
 universes.  I'm saying that all() is the Junction tha is most like
 a Set.  A none() Junction can be viewed as the specification for an
 infinite set of sets that do not intersect with the corresponding all()
 junction. Infinite sets are a bit hard to compute with directly.

OK, then; what would be the specification for a _single_ set that
contains everything that doesn't intersect with a corresponding all()
Junction (the sort of thing that I'd use if I wanted to find the
largest subset of A that doesn't intersect with B)?

 A one() junction is the spec for a number of sets corresponding to the
 values of the corresponding all() junction, each of which contains only
 one element from that set.  An any() Junction is all possible subsets
 not counting the null set.

Yeah; I got that.

--
Jonathan Dataweaver Lang


Fwd: Set Theory (Was: Do junctions support determining interesections of lists)

2006-04-04 Thread Luke Palmer
On 4/4/06, Jonathan Lang [EMAIL PROTECTED] wrote:
 OK, then; what would be the specification for a _single_ set that
 contains everything that doesn't intersect with a corresponding all()
 Junction (the sort of thing that I'd use if I wanted to find the
 largest subset of A that doesn't intersect with B)?

Can't do it.  Here's a proof.

Suppose you could find a _single_ set that contains everything that
doesn't intersect some other set (the complement).  Let S be the
complement of the empty set.  S is not an element of the empty set, so
it must be a member of S, which is impossible.

Finding the complement of a set assuming some other set is not hard
though, simply by using the set difference operator.

Luke