Proper way to define this multiset operator that does a pseudo-intersection?

163 Views Asked by At

it's been a while since I've done anything with set theory and I'm trying to find a way to describe a certain operator.

Let's say I have two multisets:

$A = \{1,1,2,3,4\}$

$B = \{1,5,6,7\}$

How can I define the operator $\mathbf{O}$ such that

$ A \mathbf{O} B= \{1,1,1\}$

Thanks!

2

There are 2 best solutions below

2
On BEST ANSWER

Let us represent multisets by ordered pairs, $\newcommand{\tup}[1]{\langle #1\rangle}\tup{x,i}$ where $x$ is the element and $i>0$ is the number of times that $x$ is in the set.

Let me write the two two multisets in this notation now: $$A=\{\tup{1,2},\tup{2,1},\tup{3,1},\tup{4,1}\},\quad B=\{\tup{1,1},\tup{5,1},\tup{6,1},\tup{7,1}\}.$$

In this case we take those elements appearing in both sets and sum their counters, then: $$A\mathrel{\mathbf{O}}B=\{\tup{x,i+j}\mid\tup{x,i}\in A\land\tup{x,j}\in B\}=\{\tup{1,3}\}.$$

2
On

If $\mathbf{1}_A$ is the multiplicity function of $A$, it appears that you want the set $C$ whose multiplicity function is

$$\begin{align*} \mathbf{1}_C(x)&=\begin{cases} \mathbf{1}_A(x)+\mathbf{1}_B(x),&\text{if }x\in A\cap B\\ 0,\text{otherwise} \end{cases}\\\\ &=\begin{cases} \mathbf{1}_{A\cup B}(x),&\text{if }x\in A\cap B\\ 0,&\text{otherwise}\;. \end{cases} \end{align*}$$