This has to do with Raul's question,

Raul Miller wrote:
 > . . . how do you distinguish between an element of a
 > set and a set containing only that element?


I will discuss three version of sets.  Bear with me, we will get to "2 is the 
set whose only element is 2" in the second version.


In mathematical set theory,

    2 looks different from {2} -- but how do you know 2 isn't {2}?  The 
question 
isn't as fanciful as it looks, for it is common in set theory to say

0 is defined to be {}, the empty set
1 is defined to be {0}, the set whose only element is 0
2 is defined to be {0,1}, the set whose only elements are 0 and 1
... and so on: the natural numbers are sets, and how do we know set 2 isn't the 
set {2}?

W see 0 is {}, 1 is { {} }, and

  2  is   { {} , { {} } }, whereas
{2} is { { {} , { {} } } }, and we are sure 2 is not {2}.  (For one thing, {2} 
has only one element, and 2 has two elements!)


But in the current J model of sets we have

    <"_1 ] 2   NB. <"_1 boxes items
+-+
|2|
+-+

which means 2 is the only element of set 2 -- we have defined sets to be open 
or 
boxed arrays and the elements of open arrays to be their items.


In my original J model of sets,

    2         NB. looks different from (set ,<2) the set whose only element is 2
2
    set ,<2   NB. argument is required to be a list of boxes containing elements
+-++
|2||
+-++

    count set <2   NB. number of elements
1
    2 iselement set <2
1
    2 -: set <2    NB. not only looks different, is different
0


Reference material:


Current implementor catechism

Question 1: What is a set?
    Answer: A set is an array.

Question 2: What is an element of a set?
    Answer: If the set is open, an element is an item of the set.  If the set is
            boxed, an element is the open of an atom of the set.


Earlier implementor catechism (revised)

Question 0: What is a sequence?
    Answer: A "sequence" is a list of boxes.  A "term" of a sequence is the open
            of one of its boxes.

Question 1: What is a set?
    Answer: A "set" is a sequence whose last term is i.0 0 .

Question 2: What is an element of a set?
    Answer: An "element" of a set is a term of its curtail.

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to