Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Understanding products and powers #19

Closed
RaphaelS1 opened this issue Nov 18, 2019 · 5 comments
Closed

Understanding products and powers #19

RaphaelS1 opened this issue Nov 18, 2019 · 5 comments

Comments

@RaphaelS1
Copy link
Collaborator

Copied from email to Franz


Quick follow up question about product sets, it seems to me that if you take the product of a product then you result in a set containing tuples of tuples and sets, so by example:

{1, 2} * {1,2} = {(1,1), (1,2), (2,1), (2,2)}
{(1,1), (1,2), (2,1), (2,2)} * {1,2} = {((1,1),1), ((1,1),2), ((1,2),1), ((1,2),2),….,}

However this seems counterintuitive to me as this then means that (1, 1, 1) is not in {1, 2}^3 but ((1, 1), 1) is, which are not the same!

Have I missed a property of sets/tuples? Or just overlooking something in the Cartesian product?

@fkiraly
Copy link

fkiraly commented Nov 18, 2019

also copying reply, so it's in one place.

"What you say in the pre-amble, i.e.,
{1, 2} * {1,2} = {(1,1), (1,2), (2,1), (2,2)}
{(1,1), (1,2), (2,1), (2,2)} * {1,2} = {((1,1),1), ((1,1),2), ((1,2),1), ((1,2),2),….,}

is entirely correct.

Formally, there is a difference between the Cartesian product between three sets, i.e.,
\bigtimes_{n=1}^3 \NN = \NN^3
which contains elements such as (1,2,3) and (3,5,42), and iterating this twice, i.e.,
(\NN \times \NN) \ times \NN,
which contains elements such as ((1,2),3) and ((3,5),42).

The reason why this is usually brushed over is that there is a so-called “canonical isomorphism” between the two, i.e., a bijection which maps (1,2,3) to ((1,2),3) and vice versa, and (3,5,42) to ((3,5),42) and vice versa.

However, you are correct in spotting: unlike in schoolbook multiplication (which is associative and commutative, and where only the result matters), the bracketing matters in symbolic expressions. Furthermore, the bracketing in the Cartesian product is replicated by the bracketing of tuples.

For the interface, I think it means we should make the distinction, too – by allowing the “shallow” product of n sets, which replicates the behaviour of the \bigtimes operator (no inner bracketing), and by allowing to nest them.

@fkiraly
Copy link

fkiraly commented Nov 18, 2019

PS: I don't think any of the content is a "power", as the title alludes?

@RaphaelS1
Copy link
Collaborator Author

Well {1, 2} * {1,2} == {1.2}^2

@fkiraly
Copy link

fkiraly commented Nov 19, 2019

ah, those powers, i.e., "n-ary Cartesian power".
Funny clash of terminology, compare "power set" which is not closely related.

@RaphaelS1
Copy link
Collaborator Author

  • Add nest argument to product
  • Default is !nest
  • If nest then don't unwrap wrappedSets
  • If !nest then unwrap all the sets and call product on a list of (c(x,y))

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants