# Embrace Multisets: Prime Factorization, GCD, and LCM

$\newcommand\mult{\mathrm{mult}}\newcommand\factor{\mathrm{fact}}\newcommand\multisetLattice{M_X}\newcommand\multisetLatticePos{M_{X^{+}}}\newcommand\gcd{\mathrm{gcd}}\newcommand\lcm{\mathrm{lcm}}\newcommand\multisetPrimeLattice{M_{ā}}\newcommand\multisetPrimeLatticePos{M_{ā^{+}}}\newcommand\divLattice{L_ā}\newcommand\divLatticeQ{L_{āāŗ}}\newcommand\NwithZero{ā_{ā„ 0}}$

**Target Audience:** Students of mathematics, or computer science in their second semester or higher; or more senior students who want to see applications of multisets. Only surface knowledge of algebra required.

## Abstract

This article is the first of a series devoted to highlighting multisets and their occurrences throughout undergraduate mathematics.

For natural numbers, the concepts of prime factorization, divisibility, greatest common divisor ($\gcd$), and least common multiple ($\lcm$) are widespread in many branches of mathematics. Students learn about them in their first semesters; if not even earlier at school. However, usually lesser known are the multiset-theoretic interpretations of these concepts. Here, we define a variant of multisets from the ground up, and show the usefulness of identifying natural number with their multiset of prime factors. That way, multiplication and division become multiset union and difference, respectively, and $\gcd$ and $\lcm$ become multiset intersection and symmetric difference.

We focus on expressing these correspondences algebraically. We recap the theory of lattices and obtain a lattice-isomorphism $\divLattice ā \multisetPrimeLatticePos$ between the division lattice on natural numbers and the lattice of finite multisets over prime numbers with multiplicities in $\NwithZero$. By generalizing the right-hand side to the superlattice $\multisetPrimeLattice$, now with multiplicities in ā¤, we recover a useful generalization of the left-hand side: a division lattice on $āāŗ$. In particular, we prove multiset intersection and symmetric difference on $\multisetPrimeLattice$ to correspond on $āāŗ$ to generalized variants of $\gcd$ and $\lcm$ fulfilling $$ \begin{align*} \gcd\left(\frac{a}{b}, \frac{c}{d}\right) &= \frac{\gcd(a,c)}{\lcm(b,d)}\\[0.75em] \lcm\left(\frac{a}{b}, \frac{c}{d}\right) &= \frac{\lcm(a,c)}{\gcd(b,d)} \end{align*} $$ for reduced fraction representations $\frac{a}{b}$ and $\frac{c}{d}$.

## Table of Contents

## 1 Introduction

The central idea is the following.
Every natural number $n ā„ 2$ can be factored into its prime factors.
Since multiplicity of prime factors is crucial, but order is not, the prime factorization of a natural number forms a multiset.
For example, we have $18 = 2 ā
3^2$ and can thus identify $18$ with the multiset $\{2^{(1)}, 3^{(2)}\}$,
where the exponents denote multiplicities, i.e., $2$ occurs once and $3$ occurs twice.
By extending the identification to $n = 1$ with the empty multiset,
we obtain the bijections below between the natural numbers $ā = \{1, 2, ā¦\}$ and the set $\multisetPrimeLatticePos$ of finite multisets with multiplicities in $\NwithZero$.
$$
\begin{align*}
\factor&\colon ā ā \multisetPrimeLatticePos\\

\mult&\colon \multisetPrimeLatticePos ā ā
\end{align*}
$$
Here, $\factor$ maps every natural number to its prime factorization,
and $\mult$ maps every multiset of primes to a natural number by multiplying, counting multplicities.

This article is driven by the following questions: Can we say more than $ā ā \multisetPrimeLatticePos$ as sets? That is, is this an isomorphism of more than just sets? For example, how do common operations on natural numbers like multiplication, division, greatest common divisor ($\gcd$), and least common multiple ($\lcm$) look like on the side of $\multisetPrimeLatticePos$? Does $\factor$ preserve and reflect them?

Indeed, we will see that $\gcd$, $\lcm$ of natural numbers correspond to multiset intersection and symmetric difference; both counting multiplicities in a suitable manner. Algebraically, these operation pairs make each side of $ā ā \multisetPrimeLatticePos$ into a lattice. On the left-hand side, we have the division lattice $(ā, \gcd, \lcm)$, and on the right-hand side, we obtain the lattice $(\multisetPrimeLatticePos, ā©, Ī)$ of finite multisets with non-negative multiplicities equipped with multiset intersection and symmetric difference. In our main theorem, we prove that the properties of $\factor$ and $\mult$ extend accordingly, i.e., the functions defined above are in fact lattice isomorphisms.

**Overview.** We rigorously define multisets and their operations in Section 2.1.
In Section 2.2 we recap the theory of lattices and detail the lattices involved above.
Then, in Section 3 we prove our main theorem showing $ā ā
\multisetPrimeLatticePos$ as lattices.
In Section 4, we extend the lattices on both sides and obtain a generalized theorem.
We conclude in Section 5.

## 2 Preliminaries

We work in the usual metamathematical layer and remain vague about our foundation.
We, however, do presuppose some kind of set theory, e.g. ZF.
To avoid confusion with multisets later, let us refer to sets from the designated set theory as *classical sets*, and to multisets always as *multisets*.

### 2.1 Multisets

#### 2.1.1 Definitions

Classical sets are “collections of objects” without order and without duplicates.
That is, an object is either element of a classical or is it not.
Multisets, which have been folklore for long time, lift the latter requirement and instead attach
to every element a *multiplicity*.
For our purposes, we define multiplicities to be integers.
Other domains may call for different choices,
e.g. fuzzy sets, where elementhood is interpreted probabilistically, can be seen as multisets with multiplicities in $[0,1] ā ā$.

Definition 2.1 [A^{1}]:multisetis a pair $(U, Īŗ_U)$, where $U$ is a classical set and $Īŗ_U\colon U ā \mathbb{Z}$ a function.For $x ā U$, we say $x$ has multiplicity $Īŗ_U(x)$, or equivalently, $x$ occurs $\kappa_U(x)$ times in $(U, \kappa_U)$.

If it is clear from context, we write $U$ instead of $(U, Īŗ_U)$.

Every classical set $S$ can be identified with the multiset $(S, s ā¦ 1)$. For instance, consider the multiset on $U = \{a,b,c\}$ in which $a$ occurs once, $b$ twice, and $c$ -4 times. Formally, we have $\kappa_U = \{a ā¦ 1, b ā¦ 2, c ā¦ -4\}$. In the following we adopt an easier notation for concrete multisets and write $\{a^{(1)}, b^{(2)}, c^{(-4)}\}$.

We would like to treat two multisets as equal even if their associated functions
do not have a common domain, e.g. it should hold $\{a^{(1)}\} = \{a^{(1)}, b^{(0)}\}$.
Therefore, we identify multisets $U_1$ and $U_2$ if $\kappa_1$ and $\kappa_2$ agree on all urelements of our set theory where at least one of them is non-zero.
This allows us to speak of *the* empty multiset, which we denote by $\varnothing$.

Definition 2.2:Given two multisets $U_1, U_2$, we define

- the union $$U_1 āŖ U_2 := (U_1 āŖ U_2, x ā¦ \kappa_1(x) + \kappa_2(x))$$
- the intersection $$U_1 ā© U_2 := (U_1 āŖ U_2, x ā¦ \min\{\kappa_1(x), \kappa_2(x)\})$$
- the symmetric difference $$U_1 Ī U_2 := (U_1 āŖ U_2, x ā¦ \max\{\kappa_1(x), \kappa_2(x)\})$$
- the negative $$- U_1 := (U_1, x ā¦ -\kappa_1(x))$$
- the difference $$U_1 - U_2 := (U_1 āŖ U_2, x ā¦ \kappa_1(x) - \kappa_2(x))$$
where we take $\kappa_1(x)$ and $\kappa_2(x)$ to be $0$ if $x$ lies outside their domain, respectively.

For example, we have:

- $\{a^{(2)}, b^{(4)} \} āŖ \{a^{(-5)}\} = \{a^{(-3)}, b^{(4)}\}$
- $\{a^{(2)}, b^{(3)} \} ā© \{a^{(10)}, b^{(-5)}\} = \{a^{(2)}, b^{(-5)}\}$
- $\{a^{(2)}, b^{(3)} \} Ī \{a^{(10)}\} = \{a^{(10)}, b^{(3)}\}$

Definition 2.3:We say $U$ is finite if $\kappa_U(x) ā 0$ only for finitely many $x$.

In the sequel, we will be working with multisets that may only contain prime numbers.
In general, almost always we only work with multisets *over* a designated classical set, as defined below.

Definition 2.4 (Multisets over a Classical Set):Let $X$ be a classical set. Then, define

- $\multisetLattice$ to be the classical set of all finite multisets with elements only in $X$.
- $\multisetLatticePos$ to be subset of $\multisetLattice$ where we only allow non-negative multiplicities.

#### 2.1.2 Prime Factorization as a Multiset

For the rest of this article, let $ā = \{1, 2, ā¦\}$ denote the natural numbers *without* zero and $ā = \{2, 3, 5, \ldots\}$ the prime numbers.
Prime factorization allows us to factor every natural number $n ā„ 2$ into its prime factors, which form a multiset.
For example, we can identify $18 = 2 ā
3^2$ with the multiset $\{2^{(1)}, 3^{(2)}\}$.

Overall, this gives rise to the bijections
$$
\begin{align*}
\factor&\colon ā ā \multisetPrimeLatticePos\\

\mult&\colon \multisetPrimeLatticePos ā ā
\end{align*}
$$
where $\factor$ maps every natural number to its prime factorization,
and $\mult$ maps every multiset of primes to a natural number by multiplying, counting multplicities.
By convention, we set $\factor(1) = \varnothing$ and $\mult(\varnothing) = 1$.

We have the following exemplary correspondences:

concept on ā | example on ā | example on $\multisetPrimeLatticePos$ | concept on $\multisetPrimeLatticePos$ |
---|---|---|---|

number | $a := 6$ | $A := \{2^{(1)}, 3^{(1)}\}$ | multiset of primes |

number | $b := 14$ | $B := \{2^{(1)}, 7^{(1)}\}$ | multiset of primes |

multiplication | $6 ā 14 = 84$ | $A āŖ B = \{2^{(2)}, 3^{(1)}, 7^{(1)}\}$ | union |

greatest common divisor | $\gcd(6, 14) = 2$ | $A ā© B = \{2^{(1)}\}$ | intersection |

least common multiple | $\lcm(6, 14) = 42$ | $A Ī B = \{2^{(1)}, 3^{(1)}, 7^{(1)}\}$ | symmetric difference |

These correspondences hold in general: $\factor$ is a homomorphism wrt. the operations multiplication, $\gcd$, and $\lcm$, and translates these operations into multiset union, intersection, and symmetric difference. Analogously for $\mult$, which preserves unions, intersections, and symmetric differences, and translates everything into the other direction. The list below formally summarizes these properties, quantified over all $a, b ā ā$ and $A, B ā \multisetPrimeLatticePos$. We defer proving these identities until Section 3, at which point we will have introduced enough multiset and algebra machinery to allow for a concise proof.

$$
\begin{align*}
\factor(a ā
b) &= \factor(a) āŖ \factor(b)\\

\factor(\gcd(a,b)) &= \factor(a) ā© \factor(b)\\

\factor(\lcm(a,b)) &= \factor(a) Ī \factor(b)\\[1em]
%
\mult(A āŖ B) &= \mult(A) ā
\mult(B)\\

\mult(A ā© B) &= \gcd(\mult(A), \mult(B))\\

\mult(A Ī B) &= \lcm(\mult(A), \mult(B))
\end{align*}
$$

Remark 2.5:The division $\frac{a}{b}_ā$ of two natural numbersover ācorresponds to multiset difference only if its result is a natural number again. For example,$$\factor\left(\frac{14}{2}\right) = \factor(14) - \factor(2)$$

but, depending on your definition, $\frac{14}{6}_ā = 2$, whereas $\factor(14) - \factor(6)$ corresponds to not a single natural number as it contains elements with negative multiplicities.

#### 2.1.3 Technical Lemmas

In the following, we collect some technical lemmas concerning multisets. Of central interest for the proofs of our main theorems will be Lemmas 2.7 — 2.9.

Lemma 2.6:

- Union, intersection, symmetric difference are commutative and associative operations.
- The negative is an involution.
- $U_1 - U_2 = U_1 āŖ (- U_2)$
- $U_1 ā© U_2 = (U_1 āŖ U_2) - (U_1 Ī U_2) = -(-U_1 Ī -U_2)$
- $U_1 Ī U_2 = (U_1 āŖ U_2) - (U_1 ā© U_2) = -(-U_1 ā© -U_2)$

## Click for proof

Immediate by definition.

Immediate by definition.

Immediate by definition.

The equalities amount to showing

$$ \begin{align*} \min\{\kappa_1(x), \kappa_2(x)\} &= (\kappa_1(x) + \kappa_2(x)) - \max\{\kappa_1(x), \kappa_2(x)\}\\\

\min\{\kappa_1(x), \kappa_2(x)\} &= -\max\{-\kappa_1(x), -\kappa_2(x)\} \end{align*} $$Both identities are general properties of $\min/\max$ following by case analysis with cases $\kappa_1(x) < \kappa_2(x)$ and $\kappa_1(x) ā„ \kappa_2(x)$.

By dualization of point 4. ā

Lemma 2.7:Intersection and symmetric difference are related as follows:

- $U_1 ā© (U_2 Ī U_3) = (U_1 ā© U_2) Ī (U_1 ā© U_3)$
- $U_1 Ī (U_2 ā© U_3) = (U_1 Ī U_2) ā© (U_1 Ī U_3)$

## Click for proof

We have to show $$ \begin{align*} &\min\{\kappa_1(x), \max\{\kappa_2(x), \kappa_3(x)\}\}\\\

=&\max\{\min\{\kappa_1(x), \kappa_2(x)\}, \min\{\kappa_1(x), \kappa_3(x)\}\}. \end{align*} $$This follows by a rather tedious, but straightforward case analysis on the 6 cases of all total orders possible on $\{\kappa_1(x), \kappa_2(x), \kappa_3(x)\}$.

By dualization of point 1.

ā

The theory of multisets also admits the decomposition theorem below, splitting a multiset into elements of positive and of negative multiplicity. We note that this theorem comes at no surprise given that we proved the negative to be an involution — since generally in mathematics, involutions often go hand-in-hand with decomposition theorems.

Lemma 2.8 (Sign Decomposition):Let $U$ be a multiset, then $U = Uāŗ - Uā»$ with

- positive part $Uāŗ := \{x ā U ā£ \kappa_U(x) > 0\} = U Ī \varnothing$ and
- negative part $Uā» := \{x ā U ā£ \kappa_U(x) < 0\} = U ā© \varnothing$

We can express intersection and symmetric difference using sign decompositions as follows.

Lemma 2.9:Let $U$ and $V$ be multisets, then

- $$U ā© V = (Uāŗ ā© Vāŗ) - (Uā» Ī Vā»)$$
- $$U Ī V = (Uāŗ Ī Vāŗ) - (Uā» ā© Vā»)$$

The proofs of the latter two lemmas are left to the reader. Note that the second point of Lemma 2.9 follows by duality from the first point.

### 2.2 Lattices

Recall we equipped the natural numbers with $\gcd$ and $\lcm$ to arrive at the triple $(ā, \gcd, \lcm)$; and the multisets over primes $\multisetPrimeLatticePos$ with intersection and symmetric difference to arrive at $(\multisetPrimeLatticePos, ā©, Ī)$. Moreover, we had functions $\factor$ and $\mult$ bijecting the underlying sets. In this section, our goal is to see these things from an algebraic perspective. Concretely, we motivate the theory of lattices: a suitable theory that makes these triples into lattices and the bijections into lattice isomorphisms.

Let us begin with some motivation. Roughly, we can think of (mathematical) lattices as modeling real-world lattices such as the one in Figure 1.

Intuitively, a real-world lattice has two characteristics: its collection of nodal points and its mesh structure.
How we encode this in mathematics?
Straightforwardly, we encode the former as a classical set $L$, e.g., for the lattice in Figure 1 we have $L = āā Ć āā$.
Representing the mesh structure requires more care
since naively choosing graphs on $L$ for it
would disregard the additional structure real-world (*and* mathematical lattices) often have.
For example, any two nodal points have common ancestors and descendants,
and moreover there is a unique ancestor (descendant) that is nearest, in some distance sense, to two given nodal points.
These things do not hold in arbitrary graphs; hence graphs are too generous to model lattices.
Instead, we model lattices by two functions $āØ,ā§\colon L Ć L ā L$ called *meet* and *join*, of which we think as picking those unique ancestors and descendants for any two nodal points.

Let us better understand those unique points and operations by means of the lattice in Figure 1. Imagine you are standing on $(0, 1)$ and your friend on $(5, 0)$. You would like to gather at some common point, but both of you can only walk downwards for some reason. Which point can you gather at such that both of you only travel the minimum distance necessary? At $(5, 0)$, and even uniquely so. This is the “unique ancestor” we referred to above. We encode this using the meet operation as $(0, 1) āØ (5, 0) = (5, 0)$. Now on the contrary, imagine you both could only walk upwards starting from $(0, 1)$ and $(5, 0)$, respectively. We again ask the question: Which point can you gather at such that both of you only travel the minimum distance necessary? At $(5, 1)$, again uniquely so. We encode this “unique descendant” as the join $(0, 1) ā§ (5, 0) = (5, 1)$. Can you derive general formulae for meets and joins for the lattice on $L = āā Ć āā$ represented in Figure 1?

## Spoiler

$$
\begin{align*}
(a, b) āØ_{āā} (c,d) &:= (\min\{a,c\}, \min\{b,d\})\\\

(a, b) ā§_{āā} (c,d) &:= (\max\{a,c\}, \max\{b,d\})
\end{align*}
$$

With the imaginery above, it is also clear meet and join ought to be commutative and associative operations. Here, associativity says that when three people $p_1, p_2, p_3$ would like to gather, e.g., by only walking upwards, then there is a unique gathering point independent of whether they gather up “in parallel” ($p_1 ā§ p_2 ā§ p_3$), by the first two people gathering first ($(p_1 ā§ p_2) ā§ p_3$), or by the latter two people gathering first ($p_1 ā§ (p_2 ā§ p_3)$).

Definition 2.10:A lattice is a structure $(L, āØ, ā§)$ consisting of a classical set $L$ and two commutative and associative operations $āØ,ā§\colon L Ć L ā L$ fulfilling the absorption laws $$ \begin{align*} a āØ (a ā§ b) &= a\\

a ā§ (a āØ b) &= a \end{align*} $$

We leave it to the reader to motivate and prove the absorption laws in context of Figure 1. Thus, $(āā Ć āā, \min, \max)$ is a lattice.

Remark 2.11:Lattices can be equivalently described from an order-theoretical perspective: lattices are partially ordered classical sets where each the classical set possseses agreatest lower bound(also: meet) andleast upper bound(join) for every two-element subset $\{a, b\}$. We refer to Wikipedia for a definition of these bounds.It often helps to think of lattices in terms of both the algebraic and order-theoretical perspective. The example lattice from above corresponds to $āā Ć āā$ partially ordered by $$(a, b) ā (c, d) ā (a ā c) \text{ and } (b ā d).$$ In particular, lattices are usually drawn as Hasse diagrams, as was done in Figure 1: every upwards edge $x\, –\, y$ stands for $x ā y$.

Remark 2.12:Lattice in which additionally meet and join distribute over each other, as below, are called distributive lattices. $$ \begin{align*} a āØ (b ā§ c) &= (a āØ b) ā§ (a āØ c)\\

a ā§ (b āØ c) &= (a ā§ b) āØ (a ā§ c) \end{align*} $$

#### 2.2.1 Divison Lattice on ā

Given two natural numbers $n$ and $m$, we define the well-known divisibility relation $$n ā£ m ā āq ā ā. n ā q = m$$ This is a partial order, and moreover for every two-element subset, the greatest common divisor and the least common multiple serve as meets and joins, respectively.

Lemma 2.13 (Division Lattice on ā):$\divLattice := (ā, \gcd, \lcm)$ is a lattice.

See Figure 2 for a partial visualization of $\divLattice$ as a Hasse diagram. For example, the meet of 18 and 12 is $6 = \lcm(18, 12)$, and 6 is precisely the nearest point you can reach from both 18 and 12 by only walking downards. Also, the join of 2 and 5 is $10 = \gcd(2,5)$, and 10 is precisely the nearest point you can reach from both 2 and 5 by only walking the edges upwards.

Remark 2.14:In the division lattice on ā, the element 1 has the property that it divides every other number, i.e., order-theoretically $1 ā n$ for all $n$. Lattices that possess such abottom elementare calledlower-bounded lattices.

#### 2.2.2 Multiset Lattices

Let $X$ be a classical set. Then we can put a lattice structure on the multisets over $X$ by ordering them by $$U_1 ā U_2 ā āx ā U_1.\ Īŗ_1(x) ā¤ Īŗ_2(x).$$ See Figure 3 for a partial visualization of the corresponding Hasse diagram. From an algebraic point of view, the meet and join of two multisets are precisely the intersection and symmetric difference, respectively. For example, we have the joins

- $\{a^{(1)}\} Ī \{b^{(2)}\} = \{a^{(1)}, b^{(2)}\}$
- $\{a^{(1)}, b^{(1)}\} Ī \{b^{(2)}\} = \{a^{(1)}, b^{(2)}\}$

Theorem 2.15 (Multiset Lattices):Let $X$ be a classical set.

$(\multisetLattice, ā©, Ī)$ is a distributive lattice.

$(\multisetLatticePos, ā©, Ī) ā \multisetLattice$ is a distributive sublattice with bottom $\varnothing$

We leave the proof to the reader.

Remark 2.16:On first sight, the reader might wonder why the join operation for the multiset lattice is symmetric difference and not union. After all, in contrast, with classical sets all subsets of $X$ form a lattice wrt. classical intersection and classical union. This lattice is known as thepowerset lattice.When generalizing to multisets, however, the classical union must

notbecome multiset, but instead symmetric difference. This can be seen in the example from above: the join of $\{a^{(1)}, b^{(1)}\}$ and $\{b^{(2)}\}$ is $\{a^{(1)}, b^{(2)}\}$. It is clear that the latter is the order-theoretical join (wrt. $ā$ given above). A multiset union of both operands would result in $\{a^{(1)}, b^{3}\}$, counting $b$threetimes. The symmetric difference avoids such overcounting.

Remark 2.17:Ignoring size issues of the chosen set theory, the class of all multisets would form a lattice, too.

## 3 Divison Lattice on ā ā Positive Finite Multisets over ā

With the preliminaries done, we can finally state and prove our main theorem: the division lattice on ā can be identified with the lattice of positive finite multisets over primes.

Theorem 3.1:$\divLattice ā \multisetPrimeLatticePos$ as lower-bounded lattices, where

- $\factor\colon \divLattice ā \multisetPrimeLatticePos$ maps natural numbers to their prime factorization
- $\mult\colon \multisetPrimeLatticePos ā \divLattice$ maps multisets of primes to their multiplication
Moreover, multiplication is preserved and reflected as multiset union:

$$ \begin{align*} \factor(a ā b) &= \factor(a) āŖ \factor(b)\\

\mult(A āŖ B) &= \mult(A) ā \mult(B) \end{align*} $$

## Click for proof

We noted above that $\factor$ and $\mult$ are bijections and inverses of each other. Hence, it suffices to show that $\factor$ is a homomorphism of lower-bounded lattices and preserves multiplication.

Let us first recall some helper lemmas from elementary number theory.
For $a ā ā$, we write $\Pi_{p ā ā}\ p^{p_a}$ to refer to its prime factorization.
We have the identities below.
$$
\begin{align*}
\gcd(a, b) &= \Pi_{p ā ā}\ p^{\min\{p_a, p_b\}}\\\

\lcm(a, b) &= \Pi_{p ā ā}\ p^{\max\{p_a, p_b\}}\\\

a ā
b &= \Pi_{p ā ā}\ p^{p_a + p_b}
\end{align*}
$$

It immediately follows that $\factor$ preserves multiplication,
$$
\begin{align*}
\factor(a ā
b) &= \factor(\Pi_{p ā ā}\ p^{p_a + p_b})\\\

&= (p\colon ā) ā¦ p_a + p_b\\\

&= \factor(A) āŖ \factor(B)
\end{align*}
$$

meets,

$$
\begin{align*}
\factor(\gcd(a, b)) &= \factor\left(\Pi_{p ā ā}\ p^{\min\{p_a, p_b\}}\right)\\\

&= (p\colon ā) ā¦ \min\{p_a, p_b\}\\\

&= \factor(A) ā© \factor(B)
\end{align*}
$$

and joins:

$$
\begin{align*}
\factor(\lcm(a, b)) &= \factor\left(\Pi_{p ā ā}\ p^{\max\{p_a, p_b\}}\right)\\\

&= (p\colon ā) ā¦ \max\{p_a, p_b\}\\\

&= \factor(A) Ī \factor(B)
\end{align*}
$$

Finally $\factor$ also preserves the bottom element: $\factor(1) = \varnothing$. ā

## 4 Division lattice on āāŗ ā Finite Multisets over ā

We have seen $\divLattice ā
\multisetPrimeLatticePos$, i.e., how the division lattice on ā is isomorphic to the lattice of positive finite multisets over primes.
What happens if we now relax (extend) the RHS to the superlattice $\multisetPrimeLattice$ with negative multiplicities allowed, too?
Is there also a corresponding superlattice of $\divLattice$ that is isomorphic to $\multisetPrimeLattice$?
Indeed there is, and a natural generalization of $\divLattice$ to a division lattice $L_{āāŗ}$ on āāŗ fits the bill,
where $āāŗ = \{q ā ā ā£ q > 0\}$ are the positive rational numbers.
In particular, this yields *meaningful* extensions of $\gcd$ and $\lcm$ to āāŗ.

Before defining $\divLatticeQ$ and proving $\divLatticeQ ā \multisetPrimeLattice$, let us begin with building some intuition as to why that should be the case. Recall how we bijected positive finite multisets over ā with natural numbers: we mapped a multiset $A$ to the multiplication $\Pi_{p ā ā}\ p^{\kappa_A(p)}$. What happens if we allowed negative multiplicities, i.e., $\kappa_A(p) < 0$? Nothing, really; multiplying prime factors raised to possibly negative exponents still makes sense. For example, we would map $\{5^{(1)}, 2^{(-1)}, 3^{(-2)}\}$ to $5^1 ā 2^{-1} ā 3^{-2} = \frac{5}{18}$. Hence, we represent fractions as multisets with prime factors of their numerator becoming positive elements and prime factors of their denominator becoming negative elements. To ensure uniqueness, we always choose the reduced fraction representation.

Definition 4.1 (Prime Factorization of Rational Numbers):Let $r ā āāŗ$ be a rational number with reduced fraction representation $\frac{a}{b}$ with $a,b ā ā$. Let $a = p_1^{a_1} ā ā¦ ā p_n^{a_n}$ and $b = q_1^{b_1} ā ā¦ ā q_m^{b_m}$ be the prime factorizations of $a$ and $b$ with $n, m ā„ 0$. Then, we call $$r = p_1^{a_1} ā ā¦ ā p_n^{a_n} ā q_1^{-b_1} ā ā¦ ā q_m^{-b_m}.$$ theprime factorizationof $r$.By convention, we set $1 = \langle\text{empty product}\rangle$.

This allows identifying rational numbers with multisets of their prime factors. In contrast to earlier discussions, we must now allow multiplicities in ā¤.

Definition 4.2 (Lattice on āāŗ):Define the lattice $\divLatticeQ = (āāŗ, \gcd, \lcm)$ with

- $$\gcd\left(\frac{a}{b}, \frac{c}{d}\right) = \frac{\gcd(a,c)}{\lcm(b,d)}$$
- $$\lcm\left(\frac{a}{b}, \frac{c}{d}\right) = \frac{\lcm(a,c)}{\gcd(b,d)}$$

Here, we overload the names of $\gcd$ and $\lcm$ as the functions defined here agree with the previously defined functions when restricted to ā. We leave proving the lattice properties to the reader.

For example, we have $\gcd(ā , ā ) = \frac{\gcd(3, 2)}{\lcm(8, 5)} = \frac{1}{40}$. Moreover, $\lcm(ā , ā ) = \frac{\lcm(3, 2)}{\gcd(8, 5)} = \frac{6}{1}$, and indeed, $6$ is the first common multiple of both $ā $ and $ā $.

Theorem 4.3:$\divLatticeQ ā \multisetLattice$ as lattices, where

- $\factor\colon \divLatticeQ ā \multisetPrimeLattice$ maps rational numbers to their prime factorization
- $\mult\colon \multisetPrimeLattice ā \divLatticeQ$ maps multisets of primes to their multiplication
Moreover, multiplication and division are preserved and reflected as follows: $$ \begin{align*} \factor(a ā b)& = \factor(a) āŖ \factor(b)\\

\factor\left(\frac{a}{b}\right) &= \factor(a) - \factor(b)\\[1em] \mult(A āŖ B) &= \mult(A) ā \mult(B)\\[0.45em] \mult(A - B) &= \frac{\mult(A)}{\mult(B)} \end{align*} $$

Again, we overload the names of $\mult$ and $\factor$.

## Click for proof

We noted above that $\factor$ and $\mult$ are bijections and inverses of each other. Hence, it suffices to show that $\factor$ is a homomorphism of lower-bounded lattices and preserves multiplication as well as division.

Similar to the proof of Theorem 3.1, let us first recall some (generalized) helper lemmas from elementary number theory.
For $u ā āāŗ$, writing $\Pi_{p ā ā}\ p^{p_u}$ to refer to its prime factorization,
we have the identities below for $u, v ā āāŗ$.
$$
\begin{align*}
u ā
v &= \Pi_{p ā ā}\ p^{p_u + p_v}\\\

\frac{u}{v} &= \Pi_{p ā ā}\ p^{p_u - p_v}
\end{align*}
$$

From these identities, it immediately follows that $\factor$ preserves multiplication and division. Moreover, it preserves meets: let $u, v ā ā$ with reduced fraction representations $u = \frac{uāŗ}{uā»}$ and $v = \frac{vāŗ}{vā»}$. Then we have:

$$
\begin{align}
& \factor(\gcd(u, v))\\\

=\ & \factor\left(\frac{\gcd(uāŗ, vāŗ)}{\lcm(uā», vā»)}\right)\\\

=\ & \factor(\gcd(uāŗ, vāŗ)) - \factor(\lcm(uā», vā»))\\\

=\ & \left(\factor(uāŗ) ā© \factor(vāŗ)\right) - \left(\factor(uā») Ī \factor(vā»)\right)\tag{iv}\\\

=\ & \left(\factor(u)āŗ ā© \factor(v)āŗ\right) - \left(\factor(u)ā» Ī \factor(v)ā»\right)\tag{v}\\\

=\ & \factor(u) ā© \factor(v)\tag{vi}
\end{align}
$$

To arrive at line $(\mathrm{iv})$, we used that Theorem 3.1 already established $\factor$ being a lattice homomorphism on the sublattice $\divLattice$. For line $(\mathrm{v})$, we used the sign decomposition of multisets from Lemma 2.7, and for line $(\mathrm{vi})$ we used Lemma 2.9.

Preservation of joins is proved analogously. ā

## 5 Future Work

Both of our main theorems 3.1 and 4.3 state a lattice isomorphism to capture
the correspondence between $\gcd$, $\lcm$ and multiset intersection and symmetric difference.
Moreover, both theorems guarantee that the respective lattice isomorphism preserves *more* structure.
In case of Theorem 3.1, the lattice isomorphism also preserves multiplication on natural numbers as multiset union.
And in case of Theorem 4.3, the isomorphism additionally preserves division on rational numbers as multiset difference.
Algebraically, what do these additional preservation properties mean?
Is there a known concept in algebra subsuming lattices that would allow us to concisely express them?

We will answer this affirmatively in a future post, namely with *lattice-ordered monoids* and *lattice-ordered groups*.

**TODO for Author**

- Delta has wrong spacing because it’s not a binary operator for tex
- Answer here: https://math.stackexchange.com/questions/151081/gcd-of-rationals

- D Loeb, “Sets with a negative number of elements” https://www.sciencedirect.com/science/article/pii/0001870892900119?via%3Dihub
^{^}