Next Article in Journal
The Yang-Baxter Equation, (Quantum) Computers and Unifying Theories
Previous Article in Journal
The Gromov–Wasserstein Distance: A Brief Overview

Open AccessArticle

# Weak n-Ary Relational Products in Allegories

by
Department of Computer Science, Faculty of Physics and Applied Informatics, University of Łodź, Pomorska nr 149/153, 90-236 Łódź, Poland
*
Author to whom correspondence should be addressed.
Axioms 2014, 3(4), 342-359; https://doi.org/10.3390/axioms3040342
Received: 16 August 2014 / Revised: 15 October 2014 / Accepted: 17 October 2014 / Published: 30 October 2014

## Abstract

Allegories are enriched categories generalizing a category of sets and binary relations. Accordingly, relational products in an allegory can be viewed as a generalization of Cartesian products. There are several definitions of relational products currently in the literature. Interestingly, definitions for binary products do not generalize easily to n-ary ones. In this paper, we provide a new definition of an n-ary relational product, and we examine its properties.
Keywords:

## 1. Introduction

Relation algebra ([1,2]) allows one to formulate first order logic (and set theory) in a quantifier-free, purely algebraic (equational) way. It has found numerous applications in mathematics and computer science (see, e.g., [3,4,5,6,7,8])., Inin particular, it is a foundation for relational databases [9]. A relation algebra without some additional structures is equivalent in expressivity to three variable fragment of first order logic [1]. A crucial ingredient that allows one to express with relation algebra all of the first order logic is the existence of Cartesian products. These can be defined equationally, as so-called relational products, within the relation algebra. In fact, the existence of relational products is strongly related to the representability of abstract relation algebras, i.e., the possibility of their realization as subalgebras of the algebra of actual binary relations.
Allegories are enriched categories generalizing a category of sets and binary relations. Accordingly, relational products in an allegory can be viewed as a more abstract version of Cartesian products. Recently allegories were used as a mathematical framework to model databases in [10,11]. There, the authors had to assume the existence of appropriate relational products in order to make the formalism applicable in other than most trivial cases, in particular, relational products allow one to define n-ary relations using binary ones.
There is a well-established definition of a binary relational product valid both for abstract relation algebras (see e.g., [3,7,12,13]) and allegories (see e.g., [14] or Definition 9 in Section 2 of this paper). In the case of the allegory of sets and binary relations, this definition characterizes, up to an isomorphism, the usual Cartesian products. For general allegories, one proves easily [14] that the relational product is a categorical product for the subcategory of maps of the given allegory, that is a subcategory consisting of those arrows (generalized relations) that behave like total functions. It should be noted that, unlike the categorical definition of the product, which involves both universal and existential quantification (for all maps, such that …there exists a unique map, such that …), the definition of a relational product involves no quantification—it is just equations, in terms of constant arrows and projection arrows, which projection arrows must satisfy. Moreover, the unique factorization, the existence of which the categorical definition asserts, is given explicitly by a simple algebraic formula in terms of projection arrows and the maps to be factorized through the product. Unfortunately, this definition of a relational product is too strong to be considered an algebraic characterization of categorical product; there are examples (see e.g., [15]) of allegories in which a categorical product in the subcategory of maps does not satisfy all of the standard axioms of a relational product. In [15] and [16], a weakening (see also Definition 10 in this paper) of the standard relational product was investigated, which still provides a categorical product in the subcategory of maps.
It is surprisingly difficult to generalize the definition of a binary relational product to an n-ary one for an arbitrary n. The most obvious one does not yield a categorical product in the subcategory of maps. A non-inductive definition (i.e., one that did not rely on the iteration of binary products) of the n-ary relational product was given in [17]. the paper (concerned with abstract relational algebra rather than with allegories) does not contain the proof that the n-ary relational product yields the n-ary categorical product for functions, though the author proves that the n-ary relational products of the same objects must be isomorphic.
In this paper, we define and investigate the weakening of an n-ary relational product from [17], which for $n = 2$ is equivalent to the binary relational product defined in [15]. We prove that a weak n-ary relational product yields an n-ary categorical product in the subcategory of maps. Furthermore, we generalize to the case of weak n-ary relational products some of the results proven in [15] for weak binary relational products. Finally, we show that by composing the weak n-ary products, we again get weak n-ary products.

## 2. Preliminaries

We assume that the reader is familiar with basic category theory, and an excellent introduction can be found in [18]. We recall some basic categorical definitions in order to fix the clean, but somewhat idiosyncratic, notation we use. The bulk of the preliminaries is taken by introductory material on allegories, which are not widely known and for which [14] is the basic textbook.
Note that we consciously utilize the term “set” where “class” might be more appropriate in order not to clutter the presentation with the set-theoretical considerations.

#### 2.1. Categories and Graphs

A graph $G$ consists of a set of vertices $Obj [ G ]$, a set of arrows $Arr [ G ]$ and a pair of maps $( · ) ← , ( · ) → : Arr [ G ] ⟶ Obj [ G ]$, called the source and target, respectively. We denote by $Arr G ( A , B )$ the set of arrows with source A and target B, where $A , B ∈ Obj [ G ]$.
A category $C$ is a graph with associative arrow composition $f ; g ∈ Arr C ( f ← , g → )$ defined whenever $f → = g ←$ (note the diagrammatic order) and identity map $id : Obj [ C ] → Arr [ C ]$, such that $id ( f ← ) ; f = f ; id ( f → ) = f$ for all $f ∈ Arr [ C ]$. We write $id A : = id ( A )$. When using single letter arrow names, we will often omit the semicolon composition operator abbreviating $f g : = f ; g$.
We will often declare the composability of arrows using diagrams, e.g.,
$• → f • ⇉ h g • : ≡ ( f → = g ← ) ∧ ( f → = h ← ) ∧ ( g → = h → )$
Note that unlike in [14], the diagrams are not considered commutative by default.
A categorical n-ary product is a family of arrows ${ π i } i ∈ { 1 , … , n }$ with a common source, such that for any other family of arrows ${ f i } i ∈ { 1 , … , n }$ with a common source and such that $f i → = π i →$ for all $i ∈ { 1 , … , n }$, there exists a unique arrow h, such that $f i = h π i$ for all $i ∈ { 1 , … , n }$.

#### 2.2. Allegories

An allegory [14] $A$ is a category enriched with intersection and reciprocation operators, respectively, for all $A , B ∈ Obj [ A ]$:
$· ⊓ · : Arr A ( A , B ) × Arr A ( A , B ) → Arr A ( A , B ) , ( · ) ∘ : Arr A ( A , B ) → Arr A ( B , A )$
We require these operators to satisfy the following conditions: Intersections make each hom-set a meet-semilattice (see, e.g., [19]), where we denote the associated partial order by ⊑, i.e., $R ⊑ S : ≡ R ⊓ S = R$, for all $R , S ∈ Arr A ( R ← , R → )$. In addition, $· ⊓ ·$ and $( · ) ∘$ are to satisfy:
 $R ∘ ∘ = R ,$ (1a) $R ( S ⊓ T ) ⊑ R S ⊓ R T$ (1d) $( R S ) ∘ = S ∘ R ∘ ,$ (1b) $R S ⊓ T ⊑ ( R ⊓ T S ∘ ) S$ (1e) $( R ⊓ S ) ∘ = R ∘ ⊓ S ∘ ,$ (1c)
For all $R , S , T ∈ Arr [ A ]$, such that the above formulas are well defined. Applying the reciprocation to both sides of the Equation (1d) (right semi-distributivity) and (1e) (right modular identity), using the Equations (1a)–(1c) and redefining symbols yields easily the following right versions:
$( S ⊓ T ) R ⊑ S R ⊓ T R ( 1 f ) R S ⊓ T ⊑ R ( S ⊓ R ∘ T )$
Allegories generalize the allegory $R$ of sets (objects) and binary relations (arrows). Because of this, we may refer to arrows in any allegory as “relations”. In $R$, we write $a R b$ iff $( a , b ) ∈ R$. The identity in $R$ is $id : A ↦ { ( a , a ) | a ∈ A }$, and the intersection is the set intersection, i.e., $R ⊓ S : = R ∩ S$, reciprocation is defined by $a R ∘ b : ≡ b R a$ and composition of relations $R , S ∈ Arr [ R ]$ such that $R → = S ←$ is defined by:
$a ( R S ) c : ≡ ∃ b ∈ R → . a R b ∧ b S c$
We distinguish the following classes of arrows in allegory:
• If $id R ← ⊑ R R ∘$, then R is called total;
• If $R ∘ R ⊑ id R →$, then R is called functional;
• If R is functional and total, it is called a map. A set of all maps in an allegory $A$ is denoted by $Map [ A ]$;
• If $R R ∘ ⊑ id R ←$, then R is called injective;
• If $id R → ⊑ R ∘ R$, then R is called surjective;
• If $R ← = R → = C$ and $R ⊑ id C$, then R is called coreflexive.
If $R ∈ Arr [ A ]$ is an isomorphism in an allegory $A$, then both R and $R ∘$ are maps, and $R − 1 = R ∘$. Note that $id A$ for all $A ∈ Obj [ A ]$ is a map, and the composition of maps is a map. For any $A , B ∈ Obj [ A ]$, we denote by $⊤ A , B$ the top element of $Arr A ( A , B )$, if it exists. In $R$, we have $⊤ A B : = A × B$.
An arrow T is called symmetric if $T ∘ = T$. Some symmetric arrows might admit splittings:
Definition 1. An arrow R is called a splitting of a symmetric arrow T if and only if $R R ∘ = id R ←$, $R ∘ R = T$.
We will make frequent use of the following results (cf. [14]):
Lemma 2. $R ( S ⊓ T ) = R S ⊓ R T$ for all $• → R • ⇉ T S •$, such that R is functional. Similarly, $( S ⊓ T ) R = S R ⊓ T R$ for all $• ⇉ T S • → R •$, such that $R ∘$ is functional.
Lemma 3. Define $Dom ( R ) : = id R ← ⊓ R R ∘$. Then, $Dom ( R ⊓ S ) = id R ← ⊓ R S ∘$ for all $• ⇉ S R •$.
Lemma 4. Suppose that A is coreflexive. Then, $A = A ∘$ (A is symmetric). Moreover, if B is another coreflexive arrow, such that $A ← = B ←$ and $A → = B →$, then $A B = A ⊓ B$. In particular, this implies that $A B = B A$, $A B$ is again coreflexive (as $A ⊓ B$ obviously is) and that A is idempotent (i.e., $A A = A$). Finally, A (and, hence, $A ∘$) is functional, as $A ∘ A = A A = A ⊑ id A ←$.
Lemma 5. Maps are incomparable The ordering restricted to maps is discrete, that is $f ⊑ g ≡ f = g$ for all $f , g ∈ Map [ A ]$.
Lemma 6. ([15]) Suppose that and that S is functional. Then, $R S ⊓ T = ( R ⊓ T S ∘ ) S$.

#### 2.3. Distributive and Division Allegories

A distributive allegory is an allegory $A$ in which for all hom-sets $Arr A ( A , B )$, there exists a bottom element $⊥ A B ∈ Arr A ( A , B )$ and a binary operation $· ⊔ · : Arr A ( A , B ) × Arr A ( A , B ) → Arr A ( A , B )$, which together with $· ⊓ ·$ makes $Arr A ( A , B )$ a distributive lattice with $· ⊓ ·$ as the infimum and $· ⊔ ·$ as the supremum. In addition, we require that $· ⊔ ·$ and $⊥ A B$ satisfy:
$R ⊥ R → B = ⊥ R ← B , R ( S ⊔ T ) = R S ⊔ R T$
for all $R , S , T ∈ Arr [ A ]$, such that the above formulae are type-correct.
A division allegory is a distributive allegory with a partial binary operation $· \ ·$ (called a left division), defined if and only if both arguments have the same sources, and satisfying for all
$R \ T ← = R → , R \ T → = T → , S ⊑ R \ T ≡ R S ⊑ T$
Note that $R$ is a division allegory with the union defined as set union, i.e., $R ⊔ S : = R ∪ S$, bottom $⊥ A B = ∅$ and a left division defined by:
$R \ T : = { ( x , y ) ∈ R → × T → | ∀ z ∈ R ← . ( z , x ) ∈ R ⇒ ( z , y ) ∈ T }$

#### 2.4. A Functional Part of a Relation

The notion of a functional part $unp ( R )$ of a relation R was introduced in [3] and was later generalized to division allegories in [15]. Let $A$ be a division allegory, and let $R ∈ Arr [ A ]$. Then, the functional part of R [3,15] is defined by:
$unp ( R ) : = R ⊓ ( R ∘ \ id R ← )$
Note that in $R$, we have, for any $R ∈ Arr [ R ]$:
$unp ( R ) = { ( x , y ) ∈ R | ∀ z ∈ R → . ( x , z ) ∈ R ⇒ z = y }$
which, together with the following lemma, justifies interpreting $unp ( R )$ as the functional part of R.
Lemma 7. ([3,15]) For any $R ∈ Arr [ A ]$, where $A$ is a division allegory, we have that $unp ( R )$ is functional, and moreover, R is functional if and only if $R = unp ( R )$.
The following result, which (slightly differently phrased) was proven in [15], shows that, given relevant splittings, we can associate a map to any relation.
Lemma 8. Let $A$ be a division allegory, and let $R ∈ Arr [ A ]$. Let also A be a coreflexive arrow, such that $A ⊑ unp ( R ) unp ( R ) ∘$. Suppose that A has a splitting s, i.e., $s ∘ s = A$, $s s ∘ = id s ←$. Then $s ; unp ( R ) ∈ Map [ A ]$.
Proof. We provide the proof for completeness. Note first that s is functional as $s ∘ s = A ⊑ id s →$. Furthermore, $unp ( R )$ is functional by Lemma 7. Hence, $s ; unp ( R )$ must be functional, as well, being a composition of functional arrows. The arrow $s ; unp ( R )$ is also total as:
$s ; unp ( R ) ; unp ( R ) ∘ ; s ∘ ⊒ s A s ∘ { as unp ( R ) ; unp ( R ) ∘ ⊒ A } = s s ∘ s s ∘ { as A = s ∘ s } = id s ← { as s s ∘ = id s ← }$

#### 2.5. Relational Products

Here is a standard definition of a relational binary product in an allegory. Note that it is necessary to assume the existence of the top relation between objects that are supposed to be the components of the relational product.
Definition 9. ([14]) Let $A$ be an allegory. A pair of arrows $• ← π 1 C → π 2 •$ is called a relational product if and only if it satisfies the following conditions:
$π 1 ∘ π 1 = id π 1 → , π 2 ∘ π 2 = id π 2 → ,$
$π 1 π 1 ∘ ⊓ π 2 π 2 ∘ = id C ,$
$π 1 ∘ π 2 = ⊤ π 1 → π 2 →$
The following is the weakening of the above definition formulated in [15]:
Definition 10. ([15]) Let $A$ be an allegory. A pair of arrows $• ← π 1 C → π 2 •$ is called a weak relational product if and only if it satisfies the following conditions:
$π 1 ∘ π 1 ⊑ id π 1 → , π 2 ∘ π 2 ⊑ id π 2 → ,$
$π 1 π 1 ∘ ⊓ π 2 π 2 ∘ = id C ,$
In [15], it was proven that a weak relational product is a categorical product in the subcategory of maps. Additionally, it is immediate.

## 3. Weak n-Ary Relational Products

The following is a generalization of the characterization of binary relational products to the characterization of n-ary products.
Definition 11. ([17]) Let $I = { 1 , … , n }$. A finite family of arrows ${ π i } i ∈ I ⊆ Arr [ A ]$ with a common source C, that is, such that $π i ← = C$ for all $i ∈ I$, is called an n-ary relational product if and only if it satisfies the following conditions:
$∀ i . π i ∘ π i = id π i → ,$
$⊓ i π i π i ∘ = id C ,$
$∀ k ∈ I . ⊓ i ∈ I \ { k } π i π i ∘ π k = ⊤ π k ← π k →$
Before we present the weakening of the above definition, we need the following piece of notation. Let $π : = { π i } i ∈ I$ be a finite family of arrows in an allegory $A$ with a common source. We denote:
$F π : = { f i } i ∈ I | ∀ i ∈ I . f i ∈ Map [ A ] ∧ f i → = π i → ∧ ∀ i , j ∈ I . f i ← = f j ←$
The following is the weakening of Definition 11:
Definition 12. Let $I = { 1 , … , n }$. A finite family of arrows ${ π i } i ∈ I ⊆ Arr [ A ]$ with a common source C, that is, such that $π i ← = C$ for all $i ∈ I$, is called a weak n-ary relational product if and only if it satisfies the following conditions:
$∀ i . π i ∘ π i ⊑ id π i → ,$
$∀ { f i } i ∈ I ∈ F π , i ∈ I . f i ∘ f i ⊑ π i ∘ π i ,$
$⊓ i ∈ I π i π i ∘ = id C ,$
$∀ J ⊊ I , k ∈ I \ J , { f i } i ∈ I ∈ F π . ⊓ i ∈ J π i π i ∘ π k ⊒ ⊓ i ∈ J π i f i ∘ f k$
An immediate corollary of Equations (8a) and (8c) is that arrows $π i$ for all i are maps. Another immediate corollary is that an n-ary relational product is also a weak n-ary relational product. The following result shows that any categorical product in $Map [ A ]$ satisfies most of the Conditions (8):
Lemma 13. (cf. [15]). Let ${ π i } i ∈ I$ be an n-ary categorical product in $Map [ A ]$. Then, ${ π i } i ∈ I$ satisfies Conditions (8a), (8b), (8d) and the “⊒” part of (8c).
Proof. Condition (8a) and the “⊒” part of Condition (8c) are satisfied, because all $π i$’s are maps, hence, respectively, functional and total. Let now ${ f i } i ∈ I ∈ F π$. Because ${ π i } i ∈ I$ is a categorical n-ary product, it follows that there exists a (unique) map $h ∈ Map [ A ]$, such that $f i = h π i$ for all $i ∈ I$. Hence, for all $i ∈ I$:
$f i ∘ f i = π i ∘ h ∘ h π i ⊑ π i ∘ π i { h is functional }$
which proves Condition (8b). Similarly, we prove Condition (8d). Let $J ⊊ I$, and let $k ∈ I \ J$. Tthen:
$⊓ i ∈ J π i f i ∘ f k = ⊓ i ∈ J π i π i ∘ h ∘ h π k = ⊓ i ∈ J π i π i ∘ h ∘ h π k { by Lemma 2 } ⊑ ⊓ i ∈ J π i π i ∘ π k { h is functional }$
Both the binary weak relational product and n-ary relational product are axiomatized using three axioms, two of which correspond to the properties (8a) and (8c) of a weak n-ary relational product. It is therefore interesting to check if the remaining properties (8b) and (8d) are really independent or if one of them implies the other in the presence of other axioms. The following two examples prove that neither implication holds:
Example 14. Consider the allegory $R$ of binary relations, and let $A ∈ Obj [ R ]$ be any set that is neither empty nor a singleton. It is immediate that the three maps $π 1 , π 2 , π 3 : = id A$ satisfy the Conditions (8a), (8b) and (8c) (for $I : = { 1 , 2 , 3 }$). They fail, however, to satisfy Condition (8d). Indeed, let $f 1 , f 2 , f 3 : A × A → A$, where $f 1$ and $f 2$ are both projections on the first component of a Cartesian product $A × A$ and $f 3$ is the projection on the second component. Then, we have that $⊓ i ∈ { 1 , 2 } π i π i ∘ π 3 = id A$, and $⊓ i ∈ { 1 , 2 } π i f i ∘ f 3 = f 2 ∘ f 3 = ⊤ A$. However, as A is neither empty nor singleton, we must have $id A ⊏ ⊤ A$, contradicting Condition (8d).
Example 15. Consider the allegory $A$, with two distinct objects, A and B, and with:
$Arr A ( A , A ) : = { id A } , Arr A ( A , B ) : = { π } , Arr A ( B , A ) : = { π ∘ } , Arr ( B , B ) : = { id B , π ∘ π } ,$
where π satisfies:
$π π ∘ = id A , π ∘ π ⊏ id B$
This allegory can be realized in $R$ by setting, e.g.,
$A : = { 0 } , B : = { 0 , 1 } , π : = { ( 0 , 0 ) }$
Let now $I : = { 1 , 2 , 3 }$, and let $π 1 , π 2 , π 3 : = π$. It is immediate that both Equations (8a) and (8c) are satisfied by the $π i$’s. To check the remaining two axioms of n-ary weak relational product, first note that $F π$ contains only two families of maps ${ f i } i ∈ { 1 , 2 , 3 }$: one obtained by setting $f 1 , f 2 , f 3 : = id B$; the other one by setting $f 1 , f 2 , f 3 : = π$. Both families satisfy property (8d); however, setting $f 1 , f 2 , f 3 : = id B$ provides a counterexample to Equation (8b).
The following two lemmas are crucial for proving the main result of this paper:
Lemma 16. Let $I : = { 1 , … , n }$, and let ${ π i } i ∈ I ⊆ Arr [ A ]$ be a weak n-ary relational product. Let ${ f i } i ∈ I ∈ F π$. Define $h J : = ⊓ i ∈ J f i π i ∘$, for all $∅ ≠ J ⊆ I$. Then, for all $∅ ≠ J ⊊ I$ and $k ∈ I \ J$, the totality of $h J$ implies that $h J π k f k ∘ ⊒ id h J ←$.
Proof. Let $∅ ≠ J ⊊ I$ and $k ∈ J \ I$. Assume that $h J$ is total. Then:
$h J π k f k ∘ = ⊓ i ∈ J f i π i ∘ π k f k ∘ { definition of h k } ⊒ ⊓ i ∈ J f i π i ∘ π i π i ∘ π k f k ∘ { by Equation ( 8 a ) } ⊒ ⊓ i ∈ J h J π i π i ∘ π k f k ∘ { As h J ⊑ f i π i ∘ for all i ∈ J } ⊒ h J ⊓ i ∈ J π i π i ∘ π k f k ∘ { by Equation ( 1 d ) } ⊒ h J h J ∘ f k f k ∘ { by Equation ( 8 d ) as h J ∘ f k = ⊓ i ∈ J π i f i ∘ f k } ⊒ id f k ← { because h J and f k are total }$
Lemma 17. Let $I : = { 1 , … , n }$, and let ${ π i } i ∈ I ⊆ Arr [ A ]$ be a weak n-ary relational product. Let ${ f i } i ∈ I ∈ F π$. Then, $h J : = ⊓ i ∈ J f i π i ∘$ is total for all $∅ ≠ J ⊆ I$.
Proof. We prove the lemma using induction on J. For the base case, note that for all $i ∈ I$:
$h { i } h { i } ∘ = f i π i ∘ π i f i ∘ { definition of h { i } } ⊒ f i f i ∘ f i f i ∘ { by Condition ( 8b ) } ⊒ id f 1 ← { as f i is total }$
Suppose now that we have proven for some $∅ ≠ J ⊊ I$ that $h J$ is total. Note that $Dom ( R ) = id R ←$ is equivalent with R being total. We have:
$Dom ( h J ∪ { k } ) = Dom ⊓ i ∈ J ∪ { k } f i π i ∘ { definition of h J ∪ { k } } = Dom ( h J ⊓ f k π k ∘ ) { definition of h J } = id f k ← ⊓ h J π k f k ∘ { by Lemma 3 } = id f k ← { By Lemma 16 and inductive assumption that h J is total. }$
The following result, which is the main result of this paper, shows that an n-ary weak relational product is in fact a categorical product for maps.
Theorem 18. Suppose that ${ π i } i ∈ I ⊆ Arr [ A ]$ is a weak n-ary relational product. Let an arrow $h ∈ Arr [ A ]$ and family of maps ${ f i } i ∈ I ⊆ Map [ A ]$ be such that for all $i ∈ I$, we have .
Then:
$h = ⊓ i f i π i ∘ ≡ h ∈ Map [ A ] ∧ ∀ i . h π i = f i$
Note that the diagram in the assumptions of the above theorem above implicitly implies that all of the maps $f i$ have a common source.
Proof. (Theorem 18) First, assume that $h ∈ Map [ A ]$ and $h π i = f i$ for all $i ∈ I$. Then:
$h = h ⊓ i π i π i ∘ { by Equation ( 8c ) } = ⊓ i h π i π i ∘ { by Lemma 2 as h ∈ Map [ A ] } = ⊓ i f i π i ∘ { as ∀ i . h π i = f i }$
Assume now that $h = ⊓ i f i π i ∘$. Then:
The arrow h is functional, that is $h ∘ h ⊑ id h →$. Indeed, for all $k ∈ I$:
$h ∘ h = ⊓ i f i π i ∘ ∘ ⊓ j f j π j ∘ { definition of h } ⊑ π k f k ∘ f k π k ∘ { monotonicity of composition and ( · ) ∘ } ⊑ π k π k ∘ { f k is functional }$
Hence:
$h ∘ h ⊑ ⊓ i π i π i ∘ { as ∀ i . h ∘ h ⊑ π i π i ∘ } = id h → { by Equation ( 8c ) }$
The arrow h is total, that is $h h ∘ ⊒ id h ←$. Indeed, this is stated in Lemma 17.
Equality $h π i = f i$ holds for all i. Indeed,
$h π i = ⊓ k f k π k ∘ π i { substitute definition of h } ⊑ f i π i ∘ π i { meet property } ⊑ f i { by Equation ( 8a ) }$
On the other hand, we have already proven that h is a map, and so, both $h π i$ and $f i$ are maps; hence, by Lemma 5, $h π i ⊑ f i$ implies $h π i = f i$. ☐
Let us also note that our definition of a weak n-ary relational product is a generalization of a weak binary relational product, i.e., a pair of arrows $π i$, $i = 1 , 2$ with a common source in an allegory $A$ is a weak binary relational product (Definition 10) if and only if it is a weak two-ary relational product (Definition 12). Indeed, by Theorem 18 and ([15], Theorem 2), a pair of arrows satisfying conditions of either of these two definitions is a categorical product for maps. Then, by Lemma 13 and ([15], Lemma 5) a categorical product satisfies all of the conditions of Definitions 10 and 12 apart from the “⊑” part of Equations (5b) and (8c), which in this case, are identical anyway.
An example given in [15] shows that there are indeed allegories $A$ for which a categorical product in $Map [ A ]$ does not satisfy the “⊑” part of Equation (8c); hence, one needs to assume something more about $A$ to ensure that n-ary categorical products in $Map [ A ]$ satisfy all Conditions (8). The following result is a generalization of ([15], Lemma 6) to the case of weak n-ary relational products.
Lemma 19. Suppose that ${ π i } i ∈ I$, $I = { 1 , … , n }$ is an n-ary categorical product in $Map [ A ]$. If there exists a splitting $R ∈ Arr [ A ]$ of $⊓ i ∈ I π i π i ∘$, then ${ π i } i ∈ I$ is an n-ary weak relational product.
Proof. The basic idea of the proof is the same as of the proof of ([15], Lemma 6): we first prove that ${ R π i } i ∈ I$ is a weak n-ary relational product, and then, we use this result to prove that ${ π i } i ∈ I$ must be a weak n-ary relational product, too. Let us denote $π ˜ i : = R π i$ for all $i ∈ I$. The family ${ π ˜ i } i ∈ I$ satisfies Condition (8a). Indeed, we have (cf. the proof of ([15], Lemma 6)) that for all $i ∈ I$:
$π ˜ i ∘ π ˜ i = π i ∘ R ∘ R π i = π i ∘ π i π i ∘ ⊓ ⊓ j ∈ I \ { i } π j π j ∘ π i { as R ∘ R = ⊓ i ∈ I π i π i ∘ } = id π i → ⊓ π i ∘ ⊓ j ∈ I \ { i } π j π j ∘ π i { by Lemma 6 as π i is functional } ⊑ id π ˜ i → { as π ˜ i → = π i → }$
Note that $R R ∘ = id R ←$ implies that $R ∘$ is functional. Observe that for all $i ∈ I$:
$⊓ j ∈ I π j π j ∘ π i ⊑ π i$
Indeed,
$⊓ j ∈ I π j π j ∘ π i = π i π i ∘ ⊓ ⊓ j ∈ I \ { i } π j π j ∘ π i = π i ⊓ ⊓ j ∈ I \ { i } π j π j ∘ π i { by Lemma 6 as π i is functional } ⊑ π i$
It follows that ${ π ˜ i } i ∈ I$ satisfies (cf. the proof of ([15], Lemma 6)):
$⊓ i ∈ I π ˜ i π ˜ i ∘ = ⊓ i ∈ I R π i π i ∘ R ∘ = R π 1 π 1 ∘ R ∘ ⊓ ⊓ i ∈ I \ { 1 } R π i π i ∘ R ∘ = R π 1 π 1 ∘ ⊓ R ∘ ( ⊓ i ∈ I \ { 1 } R π i π i ∘ R ∘ ) R R ∘ { by Lemma 6 as R ∘ is functional } ⊑ R π 1 π 1 ∘ ⊓ ⊓ i ∈ I \ { 1 } R ∘ R π i π i ∘ R ∘ R R ∘ { by Equations ( 1g ) and ( 1d ) } = R π 1 π 1 ∘ ⊓ ⊓ i ∈ I \ { 1 } ( ⊓ j ∈ I π j π j ∘ ) π i π i ∘ ( ⊓ k ∈ I π k π k ∘ ) R ∘ { as R ∘ R = ⊓ i ∈ I π i π i ∘ } ⊑ R π 1 π 1 ∘ ⊓ ⊓ i ∈ I \ { 1 } π i π i ∘ R ∘ { by Equation ( 9 ) } = R ⊓ i ∈ I π i π i ∘ R ∘ = R R ∘ R R ∘ { as R ∘ R = ⊓ i ∈ I π i π i ∘ } = id R ←$
On the other hand, for all $i ∈ I$, we have that [15] $π ˜ i π ˜ i ∘ = R π i π i ∘ R ∘ ⊒ R R ∘ = id R ←$, as $π i$ is total, for all $i ∈ I$; hence, also, $⊓ i ∈ I π ˜ i π ˜ i ∘ ⊒ id R ←$. Thus, the family ${ π ˜ i } i ∈ I$ satisfies Condition (8c).
In order to see that the family ${ π ˜ i } i ∈ I$ satisfies Condition (8b), note first that $F π ˜ = F π$ and that ${ π i } i ∈ I$ is by assumption a categorical product in $Map [ A ]$ and, thus, by Lemma 13, satisfies all of Condition (8) but the “⊑” part of Condition (8c). Hence, for all families ${ f i } i ∈ I ∈ F π ˜$, we have:
$f i ∘ f i ⊑ π i ∘ π i { by Equation ( 8b ) as { f i } i ∈ I ∈ F π } ⊑ π i ∘ ⊓ j ∈ I π j π j ∘ π i { by the “ ⊒ ” part of Equation ( 8c ) } = π i ∘ R ∘ R π i { as R is a splitting of ⊓ j ∈ I π j π j ∘ } = π ˜ i ∘ π ˜ i$
In order to see that the family ${ π ˜ i } i ∈ I$ satisfies Condition (8d), note first that, for any ${ f i } i ∈ I ∈ F π ˜ = F π$, as ${ π i } i ∈ I$ is, by assumption, a categorical product in $Map [ A ]$, there exists a map h, such that $f i = h π i$ for all $i ∈ I$. Furthermore, note that, as, by Lemma 13, ${ π i } i ∈ I$ satisfies “⊒” part of Condition (8c) and R is a splitting of $⊓ i ∈ I π i π i ∘$, we must have $R ∘ R = ⊓ i ∈ I π i π i ∘ ⊒ id R →$. Then, it follows that, for all $∅ ≠ J ⊆ I$ and $k ∈ I \ J$, we have:
$⊓ j ∈ J π ˜ j f j ∘ f k = ⊓ j ∈ J R π j f j ∘ f k = ⊓ j ∈ J R π j π j ∘ h ∘ h π k = ⊓ j ∈ J R π j π j ∘ h ∘ h π k { by Lemma 2 as h is functional } ⊑ ⊓ j ∈ J R π j π j ∘ π k { h is functional } ⊑ ⊓ j ∈ J R π j π j ∘ R ∘ R π k { R ∘ R ⊒ id R → } = ⊓ j ∈ J R π j π j ∘ R ∘ R π k { by Lemma 2 as R ∘ is functional } = ⊓ j ∈ J π ˜ j π ˜ j ∘ π ˜ k$
By Theorem 18, we know now that ${ π ˜ i } i ∈ I$ is a categorical product in $Map [ A ]$ and that the arrow $g : = ⊓ i ∈ I π i π ˜ i ∘$ is a map satisfying $π i = g π ˜ i$ for all $i ∈ I$. On the other hand, as ${ π i } i ∈ I$ is a categorical product in $Map [ A ]$ by assumption, the standard argument shows that g must be an isomorphism. In any allegory, the inverse of an isomorphism equals the reciprocation of this isomorphism and both the isomorphism and its inverse are maps; hence, in particular $g − 1 = g ∘$. Denote by C the common source of $π i$’s. Putting it together, the argument being almost identical to the proof of ([15], Lemma 6) shows that the family ${ π i } i ∈ I$ satisfies the “⊑” part of Condition (8c):
$id C = g g − 1 = ⊓ i ∈ I π i π ˜ i ∘ g − 1 = ⊓ i ∈ I π i π i ∘ ( g − 1 ) ∘ g − 1 { as π ˜ i = g − 1 π i for all i ∈ I } = ⊓ i ∈ I π i π i ∘ g g − 1 { as ( g − 1 ) ∘ = ( g ∘ ) ∘ = g } = ⊓ i ∈ I π i π i ∘ g g − 1 { by Lemma 2 as g ∘ = g − 1 is functional } = ⊓ i ∈ I π i π i ∘$
This ends the proof, as, by Lemma 13, the family ${ π i } i ∈ I$ satisfies all of the other conditions of Definition 12 by virtue of being the categorical product in $Map [ A ]$. ☐
In Conditions (8b) and (8d) the range of universal quantification was restricted to maps. The following result, which is the adaptation to n-ary weak relational products of ([15], Lemma 7), shows that we can modify those conditions, so that the range of quantification is restricted only by source-target considerations from the whole set of arrows in the allegory under consideration.
Lemma 20. (cf. ([15], Lemma 7)) Let $A$ be a division allegory in which all partial identities split. A family ${ π i } i ∈ I$, where $I = { 1 , … , n }$, of arrows in $A$ with a common source is an n-ary weak relational product if and only if it satisfies Conditions (8a) and (8c), as well as:
$∀ i ∈ I . unp ( R i ) ∘ ⊓ i ∈ I Dom ( unp ( R i ) ) unp ( R i ) ⊑ π i ∘ π i ,$
$∀ J ⊊ I , k ∈ I \ J . ⊓ i ∈ J π i unp ( R i ) ∘ ⊓ i ∈ I Dom ( unp ( R i ) ) unp ( R k ) ⊑ ⊓ i ∈ J π i π i ∘ π k$
for all families ${ R i } i ∈ I$ of arrows in $A$ with a common source and such that $R i → = π i →$ for all $i ∈ I$.
Proof. The basic idea of the proof is adapted from the proof of ([15], Lemma 7). It is immediate that if a family ${ π i } i ∈ I$ satisfies Conditions (8a) and (8c), as well as Conditions (10), then it is a weak n-ary relational product, because for any ${ f i } i ∈ I ∈ F π$, we have $unp ( f i ) = f i$ by Lemma 7 and $Dom ( unp ( f i ) ) = Dom ( f i ) = id f i ←$ for all $i ∈ I$, and thus, Conditions 10 subsume trivially Conditions (8b) and (8d). Hence, it remains to prove that Conditions (8b) and (8d) imply Conditions (10).
Assume that ${ π i } i ∈ I$ is an n-ary weak relational product, and let ${ R i } i ∈ I$ be a family $A$ with a common source C and such that $R i → = π i →$ for all $i ∈ I$. Denote for brevity:
$ı : = ⊓ i ∈ I Dom ( unp ( R i ) )$
and let s be a splitting of ı, i.e., $s s ∘ = id s ←$ and $s ∘ s = ı$. By Lemma 8, $s ; unp ( R i )$ is a map for all $i ∈ I$. Now, the families ${ π i } i ∈ I$ and ${ R i } i ∈ I$ satisfy Condition (10a) as, for all $i ∈ I$:
$unp ( R i ) ∘ ; ı ; unp ( R i ) = unp ( R i ) ∘ ; s ∘ ; s ; unp ( R i ) { as ı = s ∘ s } ⊑ π i ∘ ; π i { by Condition ( 8b ) as s ; unp ( R i ) ∈ Map [ A ] }$
We prove Condition (10b) similarly. Let $∅ ≠ J ⊊ I$ and $k ∈ I \ J$. Then:
$⊓ i ∈ J π i ; unp ( R i ) ∘ ; ı ; unp ( R k ) = ⊓ i ∈ J π i ; unp ( R i ) ∘ ; s ∘ ; s ; unp ( R k ) { as ı = s ∘ s } = ⊓ i ∈ J π i ; unp ( R i ) ∘ ; s ∘ ; s ; unp ( R k ) { by Lemma 2 as s is functional } ⊑ ⊓ i ∈ J π i π i ∘ π k { by Condition ( 8d ) as s ; unp ( R j ) ’s are maps. }$

## 4. Iterated Relational Products

Relational products can be iterated (see, e.g., Diagram 11). We will prove that any iterated product still satisfies the assumptions of Definition 12. It is immediate that in order to enable the trivial induction, it is enough to show that the iteration of the form depicted in the Diagram 11 is a weak $( n + m − 1 )$-ary relational product ( $π i$’s are attached to $ρ 1 →$ for notational convenience, and the proof would work the same for any other position of attachment):
Lemma 21. Let ${ ρ k } 1 ≤ k ≤ n$ and ${ π k } 1 ≤ k ≤ m$ be weak n and m-ary relational products, respectively, such that $π k ← = ρ 1 →$ for all $1 ≤ k ≤ m$ (see Figure 1). Then, ${ δ k } 1 ≤ k ≤ m + n − 1$ defined below is also a relational product:
$δ k : = ρ 1 π k if 1 ≤ k ≤ m ρ k − m + 1 if m < k < m + n .$
Figure 1. Construction of universal arrows.
Figure 1. Construction of universal arrows.
Proof. In order to simplify the notation, we assume here that index variables i and j run through the values ${ 1 , … m }$ and ${ 2 , … n }$ by default. Furthermore, denote the common source of $ρ i$’s by A. We will now check the satisfaction of the consecutive Conditions (8):
Identity (8a) is satisfied because $ρ j ∘ ρ j ⊑ id ρ j →$ and $π i ∘ ρ 1 ∘ ρ 1 π i ⊑ π i ∘ π i ⊑ id π i →$ for all i, j as π’s and ρ’s satisfy Equation (8a). Identity (8c) is satisfied as:
$⊓ k δ k δ k ∘ = ⊓ i ρ 1 π i π i ∘ ρ 1 ∘ ⊓ ⊓ j ρ j ρ j ∘ { definition of δ k } = ρ 1 ⊓ i π i π i ∘ ρ 1 ∘ ⊓ ⊓ j ρ j ρ j ∘ { by Lemma 2 } = ρ 1 ρ 1 ∘ ⊓ ⊓ j ρ j ρ j ∘ { π ’s satisfy Equation ( 8c ) } = id A { ρ ’s satisfy Equation ( 8c ) }$
Suppose that ${ f i } 1 ≤ i ≤ m + n − 1 ∈ F δ$. In particular, this implies that ${ f i } 1 ≤ i ≤ m ∈ F π$, and hence, by Theorem 18, the arrow $h ′ : = ⊓ 1 ≤ i ≤ m f i π i ∘$ (see Figure 1) is a map that satisfies $f i = h ′ π i$ for all $1 ≤ i ≤ m$. Then, ${ h ′ } ∪ { f k } m + 1 ≤ k ≤ m + n ∈ F ρ$, and thus, by Theorem 18 it follows that $h : = h ′ ρ 1 ∘ ⊓ ⊓ 2 ≤ j ≤ n f m + j − 1 ρ j ∘$ is a map that satisfies $h ′ = h ρ 1$, $f m + j − 1 = h ρ j$ for all $2 ≤ j ≤ n$. It follows immediately that $f i = h δ i$ for all $1 ≤ i ≤ m + n − 1$. Then, we can use the same methods as in the proof of Lemma 13 to verify Conditions (8b) and (8d). ☐

## 5. Conclusions

In the paper, we defined and investigated the weakening of an n-ary relational product from [17], which for $n = 2$ is equivalent to the binary relational product defined in [15]. Our most important result is the proof that a weak n-ary relational product yields an n-ary categorical product in the subcategory of maps (Theorem 18). This result shows also that an n-ary product presented in [17] is also a categorical product for maps. Lemmas 19 and 20 generalize to the case of weak n-ary relational products the similar results proven in [15] for weak binary relational products. We also prove that by composing the weak n-ary products, we again get weak n-ary products (Lemma 21). This last result shows that the weak n-ary relational products can be constructed iteratively from the binary ones.
It should be noted that our definition of n-ary weak relational product, unlike that of usual relational product, whether binary or n-ary, does involve universal quantification. If one considers using allegories as a means of avoiding quantification when dealing with products, this is still better than a combination of universal and existential quantification (and one gets an explicit formula for a factorizing map, too). Note that the definition of a weak binary relational product in [15] involved universal quantification, as well, but this quantification could have been hidden in the definition of certain constant arrows. This is not possible with our definition.
The results presented in this paper were motivated by our work on the allegorical data model [10,11]. This model is abstract enough to model both the sharp and fuzzy relations in a uniform way, but only binary relations are modeled directly. If I is a finite set of size n and if R is an n-ary relation (in the sense of standard relational database model) with attributes $A i$ of type $T i$ for all $i ∈ I$, then, for any sets $J 1$, $J 2$ partitioning I (i.e., $I = J 1 ∪ J 2$, $J 1 ∩ J 2 = ∅$), R can be viewed in an obvious way as a binary relation between ×$i ∈ J 1 T i$ and ×$i ∈ J 2 T i$. This simple observation shows how generalizations of n-ary relations can be represented (non-canonically) as arrows in an allegory, provided that the appropriate relational products exist.

## Acknowledgments

We would like to thank the reviewers for their helpful suggestions.

## Author Contributions

Bartosz Zieliński provided the main idea. Paweł Maślanka helped to develop it. All contributed to writing and editing.

## Conflicts of Interest

The authors declare no conflict of interest.

## References

1. Tarski, A.; Givant, S.R. A Formalization of Set Theory without Variables; American Mathematical Society: Providence, RI, USA, 1987; Volume 41. [Google Scholar]
2. Givant, S. The Calculus of Relations as a Foundation for Mathematics. J. Autom. Reason. 2006, 37, 277–322. [Google Scholar]
3. Schmidt, G.; Ströhlein, T. Relations and Graphs; Springer Heidelberg: Berlin, Germany, 1993. [Google Scholar]
4. Berghammer, R.; von Karger, B. Relational Semantics of Functional Programs. In Relational Methods in Computer Science; Brink, C., Kahl, W., Schmidt, G., Eds.; Advances in Computing Sciences, Springer Vienna: Vienna, Austria, 1997; pp. 115–130. [Google Scholar]
5. Aboul-Hosn, K.; Kozen, D. Relational Semantics for Higher-Order Programs. In Mathematics of Program Construction; Springer: Berlin, Germany, 2006; pp. 29–48. [Google Scholar]
6. Backhouse, R.; Hoogendijk, P. Elements of a relational theory of datatypes. In Formal Program Development; Springer: Berlin, Germany, 1993; pp. 7–42. [Google Scholar]
7. Berghammer, R.; Zierer, H. Relational algebraic semantics of deterministic and nondeterministic programs. Theor. Comput. Sci. 1986, 43, 123–147. [Google Scholar]
8. Backhouse, R.C.; Hoogendijk, P.; Voermans, E.; van der Woude, J. A Relational Theory of Datatypes; Department of Mathematics and Computer Science, Eindhoven University of Technology: Eindhoven, The Netherlands, 1992. [Google Scholar]
9. Codd, E.F. A Relational Model of Data for Large Shared Data Banks. Commun. ACM 1970, 13, 377–387. [Google Scholar]
10. Zieliński, B.; Maślanka, P.; Sobieski, Ś. Allegories for Database Modeling. In Model and Data Engineering; Lecture Notes in Computer Science; Cuzzocrea, A., Maabout, S., Eds.; Springer-Verlag: Berlin, Germany, 2013; Volume 8216, pp. 278–289. [Google Scholar]
11. Zieliński, B.; Maślanka, P.; Sobieski, Ś. Modalities for an Allegorical Conceptual Data Model. Axioms 2014, 3, 260–279. [Google Scholar]
12. Berghammer, R.; Haeberer, A.; Schmidt, G.; Veloso, P. Comparing two different approaches to products in abstract relation algebra. In Algebraic Methodology and Software Technology (AMAST’93); Springer: Berlin, Germany, 1994; pp. 167–176. [Google Scholar]
13. Zierer, H. Relation algebraic domain constructions. Theor. Comput. Sci. 1991, 87, 163–188. [Google Scholar]
14. Freyd, P.; Scedrov, A. Categories, Allegories; North-Holland Mathematical Library, Elsevier Science: Amsterdam, The Netherlands, 1990. [Google Scholar]
15. Winter, M. Products in categories of relations. J. Log. Algebr. Program. 2008, 76, 145–159. [Google Scholar]
16. Winter, M. Weak relational products. In Relations and Kleene Algebra in Computer Science; Springer: Berlin, Germany, 2006; pp. 417–431. [Google Scholar]
17. Desharnais, J. Monomorphic Characterization of N-ary Direct Products. Inf. Sci. 1999, 119, 275–288. [Google Scholar]
18. Barr, M.; Wells, C. Category Theory for Computing Science; Prentice-Hall international series in computer science, Prentice Hall: Hertfordshire, UK, 1995. [Google Scholar]
19. Davey, B.; Priestley, H. Introduction to Lattices and Order; Cambridge mathematical text books, Cambridge University Press: Cambridge, UK, 2002. [Google Scholar]