Some thougts on cartesian products

  • Thread starter Christoph Zwerschke
  • Start date
C

Christoph Zwerschke

Bryan said:
> The claim "everything is a set" falls into the category of
> 'not even wrong'.

No, it falls into the category of the most fundamental Mathematical
concepts. You actually *define* tuples as sets, or functions as sets or
relations as sets, or even all kinds of numbers and other things, which
exist only in the heads of Mathematicians, as sets.
> Watch things not be sets:
>
> x = [1, 1, 2]
> y = [1, 2]
> print x == y
> print set(x) == set(y)

Python tuples and lists are of course not the same as Python sets. But
mathematically, you can understand them as sets anyway and associate
every Python tuple with a Python set. The naive approach to understand a
list as the set of its values which is done by casting with set() does
not work, as you rightly noticed. The associated set to a Python tuple
or list x would be set(enumerate(x)), not set(x).

Generally, two approaches are common for constructing tuples as sets:

(A) Think of an n-tuple as a function on the index set, range(n). Then
remember a function is a special relation is a set.

(1, 2, 2) would correspond to the set {(0, 1), (1, 2), (2, 2)}
(1, 2) would correspond to the set {(0, 1), (1, 2)}

In Python, the tuple or list x would correspond to set(enumerate(x)).

As a sidemark, another common approach is this:

(B) Define the set corresponding to (1, 2) as {{1}, 2}. Define the set
corresponding to (1, 2, 2) as {{{1}, 2}, 2}, the set corresponding to
(1, 2, 2, 4) as {{{{1}, 2}, 2}, 4} and so on.
> I really did try to raise the real issues. I cannot make you answer,
> but the question remains: are duplicate and order significant in
> what you call "Cartesian product" or they not? Can you show that
> your proposed language extensions are useful and consistent in
> some reasonable sense?

I already tried to answer. It is not what "I call" Cartesian product. If
there is a canonical set representation of something like a function or
a tuple you immediately have a well-defined Cartesian product on these
things, and this would be also called Cartesian product. A Cartesian
product of functions and tuples is a well-defined mathematical concept.
The Cartesian product of functions is even a function again, and (via
lexicographical order of the index set) you can also interpret the
Cartesian product of tuples as a tuple again (this was probably the
point where you had doubts, but I already tried to explain).

The only ambiguity is whether the result should be a generator or a
tuple, and in the case of strings whether the elements in the result
should be returned as tuples,
"ab"*"cd" = ("a", c"), ("a", "d"), ("b", "c"), ("b", "d")
or concatenated as strings:
"ab"*"cd" = "ac", "ad", "bc", "bd"

In any way, there is no dispute about duplicates or ordering. This is
all canonical and well-defined.

Concerning the use, I admit there is no really frequent use, but in some
occasions it may be useful and I already gave some examples.

-- Christoph
 
B

Bryan Olson

Christoph said:
No, it falls into the category of the most fundamental Mathematical
concepts. You actually *define* tuples as sets, or functions as sets or
relations as sets, or even all kinds of numbers and other things which
exist in the heads of Mathematicians as sets.

No, wrong ... or well, obviously ... or uh ... sorry.
I've lost track of what we're arguing. If you want to
stand behind "everything is a set," I can certainly present
a case to the contrary.

Is there anything I actually claimed that you are prepared to
argue against? Cite me, and I'll defend or retract, or at least
re-phrase.

I definitely did make specific claims. I'll list them if you want,
and I'll listen to evidence against them, should you choose to
present any. I expect that neither of us wants to devote our
energy to flaming on in violent agreement.
 
C

Christoph Zwerschke

I think this has been discussed thoroughgoing enough. All I wanted to
say is that this proposal of building "Cartesian products" of strings is
well-defined, in line with the mathematical concept of Cartesian
products, and can be *sometimes* useful. I hope we agree on this, but if
not we don't need to go through this again...

Peace,
Christoph
 
T

Terry Reedy

Christoph Zwerschke said:
No, it falls into the category of the most fundamental Mathematical
concepts. You actually *define* tuples as sets, or functions as sets or
relations as sets, or even all kinds of numbers and other things which
exist in the heads of Mathematicians as sets.

You might so define, but Bryan and others might not. The
philosophical/methodological idea that 'everything is a set' has been very
fruitful but it is not a fact. Alternative ideas are 'everything is a
function' and 'everything is defined by axioms'. As for set theory itself,
there are multiple nonequivalent consistent theories for uncountable sets
and therefore multiple definitions of what a set it. And to me, Russel's
'paradox' is a proof by negation that there is at least one collection that
is *not* a set.

Back to the thread topic: The cross-catenation operator (a generalization
of 'cartesian product' to sequences) is sometimes very useful. Recursive
definitions of combinatorial functions provide several examples. Whether
it should be built into the language or left to subclassers is a different
issue.

Terry J. Reedy
 
F

Fredrik Lundh

Terry said:
You might so define, but Bryan and others might not. The
philosophical/methodological idea that 'everything is a set' has been very
fruitful but it is not a fact. Alternative ideas are 'everything is a
function' and 'everything is defined by axioms'.

according to google, ideas such as

everything is illuminated
everything is a miracle
everything is an object

and even

everything is a fscking dns problem

seems to be a bit more common.

</F>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,282
Messages
2,571,404
Members
48,096
Latest member
Kenkian2628

Latest Threads

Top