Proper way to define this multiset operator that does a pseudo-intersection? 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!

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}\}.$$
