# A Novel Categorical Approach to Semantics of Relational First-Order Logic

^{1}

^{2}

^{*}

## Abstract

**:**

## 1. Introduction

- first, by depicting the core property that the value shall satisfy; and
- second, by giving a criterion how to choose a canonical value from all values that satisfy the property.

## 2. A Relational First-Order Logic

**Axiom**

**1**

**.**Let $\mathit{Var}$ denote an arbitrary infinite and enumerable set; we call the elements of this set variables. Furthermore, let $\mathit{Val}$ denote an arbitrary non-empty set; we call the elements of these set values.

**Definition**

**1**

**.**We define $\mathit{Ass}:=\mathit{Var}\to \mathit{Val}$ as the set of all mappings of variables to values (a function space); we call the elements of this set assignments. Thus, for every assignment $a\in \mathit{Ass}$ and every variable $x\in \mathit{Var}$, we have $a\left(x\right)\in \mathit{Val}$.

**Definition**

**2**

**.**Let $a\in \mathit{Ass}$ be an assignment, $x\in \mathit{Var}$ a variable, and $v\in \mathit{Val}$ a value. We define the update assignment $a[x\mapsto v]\in \mathit{Ass}$ as follows:

**Proposition**

**1**

**.**Let $a\in \mathit{Ass}$ be an assignment, $x,y\in \mathit{Var}$ variables, and $v,{v}_{1},{v}_{2}\in \mathit{Val}$ values. Then, we have the following properties:

**Proof.**

**Definition**

**3**

**.**We define $\mathit{Rel}:=\mathcal{P}\left(\mathit{Ass}\right)$ as the set of all sets of assignments; we call the elements of this set “relations”. Consequently, a relation is a set of assignments.

**Definition**

**4**

**.**We state that relation $R\in \mathit{Rel}$ is independent of variable $x\in \mathit{Var}$, written as $R\u2aebx$, if and only if the following holds:

**Definition**

**5**

**.**A relation $R\in \mathit{Rel}$ is a predicate, if it only depends on finitely many variables. We denote by $\mathit{Pred}$ the set of all predicates and by ${\mathit{Pred}}_{x}:=\{P\in \mathit{Pred}\phantom{\rule{4pt}{0ex}}|\phantom{\rule{4pt}{0ex}}P\u2aebx\}$ the subset of all predicates that are independent of x.

**Definition**

**6**

**.**We define $For$ as that smallest set of abstract syntax trees in which every element $F\in \mathit{For}$ is generated by an application of a rule of the following context-free grammar (where $P\in \mathit{Pred}$ denotes an arbitrary predicate and $x\in \mathit{Var}$ denotes an arbitrary variable):

**Definition**

**7**

**.**Let $F\in \mathit{For}$ be a formula. We define the relation $\u301a\phantom{\rule{0.166667em}{0ex}}F\phantom{\rule{0.166667em}{0ex}}\u301b\in \mathit{Rel}$, called the semantics of F, by induction on the structure of F:

**Proposition**

**2**

**.**For every variable $x\in \mathit{Var}$ and formula $F\in \mathit{For}$, we have $\u301a\phantom{\rule{0.166667em}{0ex}}\forall x.\phantom{\rule{4pt}{0ex}}F\phantom{\rule{0.166667em}{0ex}}\u301b\u2aebx$ and $\u301a\phantom{\rule{0.166667em}{0ex}}\exists x.\phantom{\rule{4pt}{0ex}}F\phantom{\rule{0.166667em}{0ex}}\u301b\u2aebx$, i.e., the semantics of quantified formulas do not depend on x.

**Proof.**

**Proposition**

**3**

**.**For every formula $F\in \mathit{For}$, we have $\u301a\phantom{\rule{0.166667em}{0ex}}F\phantom{\rule{0.166667em}{0ex}}\u301b\in \mathit{Pred}$, i.e., the semantics of F is a predicate.

**Proof.**

- If $F=P$, we have $\u301a\phantom{\rule{0.166667em}{0ex}}F\phantom{\rule{0.166667em}{0ex}}\u301b=\{a\in \mathit{Ass}\phantom{\rule{4pt}{0ex}}|\phantom{\rule{4pt}{0ex}}a\in P\}=P\in \mathit{Pred}$.
- If $F\in \{\top ,\perp \}$, there are no $x,a,{v}_{1},{v}_{2}$ such that $a[x\mapsto {v}_{1}]\in \u301a\phantom{\rule{0.166667em}{0ex}}F\phantom{\rule{0.166667em}{0ex}}\u301b$ and $a[x\mapsto {v}_{2}]\notin \u301a\phantom{\rule{0.166667em}{0ex}}F\phantom{\rule{0.166667em}{0ex}}\u301b$ because, for $F=\top $, the second condition must be false and for $F=\perp $ the first one; thus, F does not depend on any variable.
- If $F=\neg {F}_{1}$, by the induction hypothesis, we may assume that $\u301a\phantom{\rule{0.166667em}{0ex}}{F}_{1}\phantom{\rule{0.166667em}{0ex}}\u301b$ depends only on the variables in some finite variable set X. From the definition of $\u301a\phantom{\rule{0.166667em}{0ex}}F\phantom{\rule{0.166667em}{0ex}}\u301b$, it is then easy to show that $\u301a\phantom{\rule{0.166667em}{0ex}}\neg {F}_{1}\phantom{\rule{0.166667em}{0ex}}\u301b$ also depends only on the variables in X.
- If $F\in \{{F}_{1}\wedge {F}_{2},{F}_{1}\vee {F}_{2},{F}_{1}\to {F}_{2},{F}_{1}\leftrightarrow {F}_{2}\}$, we may assume by the induction hypothesis that $\u301a\phantom{\rule{0.166667em}{0ex}}{F}_{1}\phantom{\rule{0.166667em}{0ex}}\u301b$ depends only on the variables in some finite set ${X}_{1}$ while ${P}_{2}$ only depends on the variables in some finite set ${X}_{2}$. From the definition of $\u301a\phantom{\rule{0.166667em}{0ex}}F\phantom{\rule{0.166667em}{0ex}}\u301b$, it is then easy to show that $\u301a\phantom{\rule{0.166667em}{0ex}}F\phantom{\rule{0.166667em}{0ex}}\u301b$ depends only on the variables in the finite set ${X}_{1}\cup {X}_{2}$.
- If $F\in \{\forall x.\phantom{\rule{4pt}{0ex}}{F}_{1},\exists x.\phantom{\rule{4pt}{0ex}}{F}_{1}\}$, we may assume by the induction hypothesis that $\u301a\phantom{\rule{0.166667em}{0ex}}{F}_{1}\phantom{\rule{0.166667em}{0ex}}\u301b$ only depends on the variables in some finite variable set X. We are now going to show that $\u301a\phantom{\rule{0.166667em}{0ex}}F\phantom{\rule{0.166667em}{0ex}}\u301b$ only depends on the variables in the finite set $X\backslash \left\{x\right\}$. Actually, we assume that this is not the case and show a contradiction. From this assumption and Proposition 2, we have a variable $y\ne x\wedge y\notin X$ on which F depends; thus, we have an assignment a and values ${v}_{1},{v}_{2}$ such that $a[y\mapsto {v}_{1}]\in \u301a\phantom{\rule{0.166667em}{0ex}}F\phantom{\rule{0.166667em}{0ex}}\u301b$ and $a[y\mapsto {v}_{2}]\notin \u301a\phantom{\rule{0.166667em}{0ex}}F\phantom{\rule{0.166667em}{0ex}}\u301b$.If $F=\forall x.\phantom{\rule{4pt}{0ex}}{F}_{1}$, from $a[y\mapsto {v}_{2}]\notin \u301a\phantom{\rule{0.166667em}{0ex}}F\phantom{\rule{0.166667em}{0ex}}\u301b$, we have a $v\in \mathit{Val}$ with $a[y\mapsto {v}_{2}][x\mapsto v]\notin \u301a\phantom{\rule{0.166667em}{0ex}}{F}_{1}\phantom{\rule{0.166667em}{0ex}}\u301b$ and thus (since $y\ne x$) $a[x\mapsto v][y\mapsto {v}_{2}]\notin \u301a\phantom{\rule{0.166667em}{0ex}}{F}_{1}\phantom{\rule{0.166667em}{0ex}}\u301b$. From $a[y\mapsto {v}_{1}]\in \u301a\phantom{\rule{0.166667em}{0ex}}F\phantom{\rule{0.166667em}{0ex}}\u301b$, we know $a[y\mapsto {v}_{1}][x\mapsto v]\in \u301a\phantom{\rule{0.166667em}{0ex}}{F}_{1}\phantom{\rule{0.166667em}{0ex}}\u301b$ and thus $a[x\mapsto v][y\mapsto {v}_{1}]\in \u301a\phantom{\rule{0.166667em}{0ex}}{F}_{1}\phantom{\rule{0.166667em}{0ex}}\u301b$. Thus, $\u301a\phantom{\rule{0.166667em}{0ex}}{F}_{1}\phantom{\rule{0.166667em}{0ex}}\u301b$ depends on a variable $y\notin X$ which contradicts the induction assumption.If $F=\exists x.\phantom{\rule{4pt}{0ex}}{F}_{1}$, from $a[y\mapsto {v}_{1}]\in \u301a\phantom{\rule{0.166667em}{0ex}}F\phantom{\rule{0.166667em}{0ex}}\u301b$, we have a $v\in \mathit{Val}$ with $a[y\mapsto {v}_{1}][x\mapsto v]\in \u301a\phantom{\rule{0.166667em}{0ex}}{F}_{1}\phantom{\rule{0.166667em}{0ex}}\u301b$ and thus (since $y\ne x$) $a[x\mapsto v][y\mapsto {v}_{1}]\in \u301a\phantom{\rule{0.166667em}{0ex}}{F}_{1}\phantom{\rule{0.166667em}{0ex}}\u301b$. From $a[y\mapsto {v}_{2}]\notin \u301a\phantom{\rule{0.166667em}{0ex}}F\phantom{\rule{0.166667em}{0ex}}\u301b$ we know $a[y\mapsto {v}_{2}][x\mapsto v]\notin \u301a\phantom{\rule{0.166667em}{0ex}}{F}_{1}\phantom{\rule{0.166667em}{0ex}}\u301b$ and thus $a[x\mapsto v][y\mapsto {v}_{2}]\notin \u301a\phantom{\rule{0.166667em}{0ex}}{F}_{1}\phantom{\rule{0.166667em}{0ex}}\u301b$. Thus, $\u301a\phantom{\rule{0.166667em}{0ex}}{F}_{1}\phantom{\rule{0.166667em}{0ex}}\u301b$ depends on a variable $y\notin X$ which contradicts the induction assumption.

**Definition**

**8**

**.**Let $a\in \mathit{Ass}$ be an assignment and $F\in \mathit{For}$ be a formula. We define $a\vDash F$ (read: a satisfies F) as follows:

**Definition**

**9**

**.**Let $F\in \mathit{For}$ be a formula. We define $\vDash F$ (read: F is valid) as follows:

**Definition**

**10**

**.**Let $F,G\in \mathit{For}$ be formulas. We define $F\vDash G$ (read: G is a logical consequence of F) as follows:

**Definition**

**11**

**.**Let $F,G\in \mathit{For}$ be formulas. We define $F\equiv G$ (read: F and G are logically equivalent) as follows:

**Proposition**

**4**

**.**Let $F,G\in \mathit{For}$ be formulas. Then, we have the following equivalences:

- $(F\vDash G)\iff (\vDash F\to G)$
- $(F\vDash G)\iff (\u301a\phantom{\rule{0.166667em}{0ex}}F\phantom{\rule{0.166667em}{0ex}}\u301b\subseteq \u301a\phantom{\rule{0.166667em}{0ex}}G\phantom{\rule{0.166667em}{0ex}}\u301b)$
- $(F\equiv G)\iff (\vDash F\leftrightarrow G)$
- $(F\equiv G)\iff (\u301a\phantom{\rule{0.166667em}{0ex}}F\phantom{\rule{0.166667em}{0ex}}\u301b=\u301a\phantom{\rule{0.166667em}{0ex}}G\phantom{\rule{0.166667em}{0ex}}\u301b)$

**Proof.**

**Definition**

**12**

**.**We define the complement $\overline{R}\in \mathit{Rel}$ of relation $R\in \mathit{Rel}$ as the relation $\overline{R}:=\mathit{Ass}\backslash R$. Consequently, an assignment is in $\overline{R}$ if and only if it is not in R.

**Proposition**

**5**

**.**Let $F,{F}_{1},{F}_{2}\in \mathit{For}$ be formulas. We then have the following equalities:

**Proof.**

**Proposition**

**6**

**.**Let $F\in \mathit{For}$ be a formula. We then have the following equalities:

**Proof.**

## 3. Category Theory

#### 3.1. Basic Notions

**Definition**

**13**

**.**A category C is a triple $\langle O,A,\circ \rangle $ of the following components:

- A class O of elements called C-objects or just objects.
- A class A of elements called C-arrows or just arrows. Each arrow has a source object and a target object from O; we write $f:a\to b$ to indicate that f is an arrow with source a and target b. We write $C(a,b)$ to denote the class of all arrows of A with source a and target b (called the hom-class of all arrows from a to b). For every object x in O, A contains an arrow ${\mathit{id}}_{x}:x\to x$ called the identity arrow for x.
- A composition—binary operation ∘ defined on arrows. For all arrows $f:a\to b$ and $g:b\to c$, we have $(g\circ f):a\to c$. Furthermore, the composition satisfies the following axioms:
- -
- Associativity: $(h\circ g)\circ f=h\circ (g\circ f)$, for all arrows $f:a\to b$, $g:b\to c$, $h:c\to d$.
- -
- Identity: ${\mathit{id}}_{b}\circ f=f=f\circ {\mathit{id}}_{a}$, for all arrows $f:a\to b$.

**Definition**

**14**

**.**Let C be a category and $a,b$ be C-objects $a,b$. Then, we have $a\simeq b$ (read: a and b are isomorphic) if there are C-arrows $f:a\to b$ and $g:b\to a$, called isomorphisms, such that $g\circ f={\mathit{id}}_{a}$ and $f\circ g={\mathit{id}}_{b}$.

**Definition**

**15**

**.**A category C is a subcategory of category $\mathcal{D}$ if every C-object is also a $\mathcal{D}$-object, every C-arrow is also a $\mathcal{D}$-arrow, every identity arrow in C is also an identity arrow in $\mathcal{D}$, and $g{\circ}_{C}f=g{\circ}_{D}f$ for all C-arrows $f:a\to b$ and $g:b\to c$, where ${\circ}_{C}$ denotes the composition in C and ${\circ}_{D}$ denotes the composition in $\mathcal{D}$.

#### 3.2. Object Constructions

**Definition**

**16**

**.**Let C be a category. A C-object 0 is initial if for every C-object a there exists exactly one arrow ${0}_{a}:0\to a$. A C-object 1 is final if for every C-object a there exists exactly one arrow ${1}_{a}:a\to 1$.

**Definition**

**17**

**.**Let C be a category. Then, the triple $\langle a\times b,{\pi}_{1},{\pi}_{2}\rangle $ is a product of C-objects a and b if $a\times b$ is a C-object, the product object, with arrows ${\pi}_{1}:a\times b\to a$ and ${\pi}_{2}:a\times b\to b$, the projections, such that for every triple $\langle c,f,g\rangle $ with C-object c and arrows $f:c\to a$ and $g:c\to b$ there exists exactly one arrow $\langle f,g\rangle :c\to a\times b$ such that the following diagram commutes:

**Definition**

**18**

**.**Let C be a category with products $\langle {a}_{1}\times {a}_{2},{\pi}_{1},{\pi}_{2}\rangle $ and $\langle {b}_{1}\times {b}_{2},{\pi}_{1}^{\prime},{\pi}_{2}^{\prime}\rangle $ and arrows $f:{a}_{1}\to {b}_{1}$ and $g:{a}_{2}\to {b}_{2}$, respectively. Then, the product arrow $f\times g:{a}_{1}\times {a}_{2}\to {b}_{1}\times {b}_{2}$ is the arrow $\langle f\circ {\pi}_{1},g\circ {\pi}_{2}\rangle $.

**Definition**

**19**

**.**Let C be a category in which, for all C-objects, there exists a product object. Then, the tuple $\langle {b}^{a},{\mathit{eval}}_{a,b}\rangle $ is an exponential of C-objects a and b if ${b}^{a}$ is a C-object, the exponential object, with arrow ${\mathit{eval}}_{a,b}:{b}^{a}\times a\to b$, the evaluation arrow, such that for every C-object c with arrow $f:c\times a\to b$ there exists exactly one arrow ${\mathit{curry}}_{f}:c\to {b}^{a}$, the currying arrow, such that the following diagram commutes:

#### 3.3. Functors and Adjunction

**Definition**

**20**

**.**Let C and $\mathcal{D}$ be categories. A functor $F:C\to \mathcal{D}$ is a map that takes every C-object a to a $\mathcal{D}$-object $F\left(a\right)$ and every C-arrow $f:a\to b$ to a $\mathcal{D}$-arrow $F\left(f\right):F\left(a\right)\to F\left(b\right)$ such that

- $F\left({\mathit{id}}_{a}\right)={\mathit{id}}_{F\left(a\right)}$ for every C-object a, and
- $F\left(g{\circ}_{C}f\right)=F\left(g\right){\circ}_{D}F\left(f\right)$ for all C-arrows $f:a\to b$ and $g:b\to c$.

**Definition**

**21**

**.**Let C and $\mathcal{D}$ be categories with functors $F:C\to \mathcal{D}$ and $G:\mathcal{D}\to C$. Then, we have $F\u22a3G$ (read: $\langle F,G\rangle $ is an adjunction, F is a left adjoint of G, G is a right adjoint of F) if for every C-object a and $\mathcal{D}$-object b the arrow classes $\mathcal{D}\left(F\right(a),b)$ and $C(a,G(b\left)\right)$ are isomorphic, i.e., there exists a bijection between them. This is equivalent to saying that, for every C-object a and $\mathcal{D}$-object b, there exist two surjective mappings ${s}_{1}:\mathcal{D}(F\left(a\right),b)\to C(a,G\left(b\right))$ and ${s}_{2}:C(a,G\left(b\right))\to \mathcal{D}(F\left(a\right),b)$, i.e.,

- for every $\mathcal{D}$-arrow $g:F\left(a\right)\to b$ we have a C-arrow $f:a\to G\left(b\right)$ with ${s}_{2}\left(f\right)=g$ and
- for every C-arrow $f:a\to G\left(b\right)$, we have a $\mathcal{D}$-arrow $g:F\left(a\right)\to b$ with ${s}_{1}\left(g\right)=f$.

**Note.**

**Proposition**

**7**

**.**Let C and $\mathcal{D}$ be categories with functors $F:C\to \mathcal{D}$ and $G:\mathcal{D}\to C$. Then, the condition $F\u22a3G$ is equivalent to each of the following two conditions:

- 1.
- For every C-object a, there is a C-arrow $u:a\to G\left(F\right(a\left)\right)$, the “universal arrow”, such that, for every $\mathcal{D}$-object b and C-arrow $f:a\to G\left(b\right)$, there exists a $\mathcal{D}$-arrow ${g}_{b,f}:F\left(a\right)\to b$:
- 2.
- For every $\mathcal{D}$-object b, there is a C-arrow $v:F\left(G\right(b\left)\right)\to b$, the “couniversal arrow”, such that, for every C-object a and $\mathcal{D}$-arrow $g:F\left(a\right)\to b$, there is a C-arrow ${f}_{a,g}:a\to G\left(b\right)$:

**Proof.**

#### 3.4. Object Constructions by Adjunction

**Proposition**

**8**

**.**Let $\mathbf{1}$ be the “singleton” category with a single object ∗ (and consequently a single arrow ${\mathit{id}}_{\ast}:\ast \to \ast $); this category is uniquely defined up to isomorphism. Let C be a category with the constant functor $C:C\to \mathbf{1}$; in addition, this functor is uniquely defined up to isomorphism. Then, the following holds:

- Let C-object 0 be initial and the “initial object functor” ${I}_{0}:\mathbf{1}\to C$ be defined by ${I}_{0}(\ast ):=0$ and ${I}_{0}\left({\mathit{id}}_{\ast}\right):={\mathit{id}}_{0}$. Then, we have ${I}_{0}\u22a3C$, i.e., the initial object functor is a left adjoint of the constant functor.
- Let C-object 1 be final and the “final object functor” ${F}_{1}:\mathbf{1}\to C$ be defined by ${F}_{1}(\ast ):=1$ and ${F}_{1}\left({\mathit{id}}_{\ast}\right):={\mathit{id}}_{1}$. Then, we have $C\u22a3{F}_{1}$, i.e., the final object functor is a right adjoint of the constant functor.

**Proof.**

**Proposition**

**9**

**.**Let C be a category. Let the “product category” $C\times C$ be the category whose objects $(a,b)$ are pairs of C-objects a and b, whose arrows $(f,g):(a,c)\to (b,d)$ are pairs of C-arrows $f:a\to b$ and $g:c\to d$, where the identity arrows are pairs of identity arrows, and where composition is component-wise composition. Let the “diagonal functor” $\Delta :C\to C\times C$ be defined by $\Delta \left(a\right)=(a,a)$ for every C-object a and $\Delta \left(f\right)=(f,f)$ for every C-arrow $f:a\to b$. Then, the following holds:

- Assume that every pair of C-objects a and b has a product $a\times b$ and let the “product functor” $P:C\times C\to C$ be defined by $P(a,b):=a\times b$. Then, we have $\Delta \u22a3P$, i.e., the product functor is a right adjoint of the diagonal functor.
- Assume that every pair of C-objects a and b has a coproduct $a+b$ and let the “coproduct functor” $C:C\to C\times C$ be defined by $C(a,b):=a+b$. Then, we have $C\u22a3\Delta $, i.e., the coproduct functor is a left adjoint of the diagonal functor.

**Proof.**

**Proposition**

**10**

**.**Let C be a category in which, for every pair of C-objects a and b, there exists a product object $b\times a$ and an exponential object ${b}^{a}$. For every C-object a, let the “(unary) product functor” ${P}_{a}:C\to C$ be defined by ${P}_{a}\left(b\right):=b\times a$ and the “(unary) exponential functor” ${E}_{a}:C\to C$ be defined by ${E}_{a}\left(b\right):={b}^{a}$. Then, we have ${P}_{a}\u22a3{E}_{a}$, i.e., the exponential functor is a right adjoint of the product functor.

**Proof.**

## 4. A Categorical Semantics

#### 4.1. Syntactic Category and Formula Functors

- The objects of this category are the formulas in the set $\mathit{For}$ which was introduced in Definition 6.
- The arrow class A consists of all pairs $\langle {F}_{1},{F}_{2}\rangle $ of formulas ${F}_{1},{F}_{2}$ for which ${F}_{1}\vDash {F}_{2}$ holds, i.e., for which ${F}_{2}$ is a logical consequence of ${F}_{1}$, as described in Definition 8. The source object of such an arrow is ${F}_{1}$, and its target object is ${F}_{2}$. The existence of an arrow $f:{F}_{1}\to {F}_{2}$ thus indicates ${F}_{1}\vDash {F}_{2}$. The identity ${\mathit{id}}_{F}:F\to F$ indicates the fact $F\vDash F$.
- The composition ∘ denotes relational composition: for all arrows $f:{F}_{1}\to {F}_{2}$ and $g:{F}_{2}\to {F}_{3}$, and the existence of the arrow $(g\circ f):{F}_{1}\to {F}_{3}$ indicates the transitivity of the relation ⊧.

#### 4.2. Semantic Category and Predicate Functors

- The objects of this category are the predicates in the set $\mathit{Pred}$ which was introduced in Definition 5 (thus $\mathcal{S}\mathcal{E}\mathcal{M}$-objects are relations, i.e., sets).
- The arrow class B consists of all pairs $\langle {P}_{1},{P}_{2}\rangle $ of predicates ${P}_{1},{P}_{2}$ for which ${P}_{1}\subseteq {P}_{2}$ holds, i.e., for which ${P}_{1}$ is a subset of ${P}_{2}$. The source object of such an arrow is ${P}_{1}$, its target object is ${P}_{2}$. The existence of an arrow $f:{P}_{1}\to {P}_{2}$ thus indicates ${P}_{1}\subseteq {P}_{2}$. The identity ${\mathit{id}}_{P}:P\to P$ indicates the fact $P\subseteq P$.
- The composition ∘ denotes relational composition: for all arrows $f:{P}_{1}\to {P}_{2}$ and $g:{P}_{2}\to {P}_{3}$, the existence of the arrow $(g\circ f):{P}_{1}\to {P}_{3}$ indicates the transitivity of the relation ⊆.

#### 4.3. The Semantic Functor

- For every $\mathcal{S}\mathcal{Y}\mathcal{N}$-object F, i.e., formula F, $\u301a\phantom{\rule{0.166667em}{0ex}}F\phantom{\rule{0.166667em}{0ex}}\u301b$ denotes the semantics of F as defined in Definition 7, which according to Proposition 3 is a predicate, i.e., indeed a $\mathcal{S}\mathcal{E}\mathcal{M}$-object.
- For every $\mathcal{S}\mathcal{Y}\mathcal{N}$-arrow $f:{F}_{1}\to {F}_{2}$, i.e., every pair of formulas ${F}_{1}$ and ${F}_{2}$ with ${F}_{1}\vDash {F}_{2}$, we have the $\mathcal{S}\mathcal{E}\mathcal{M}$-arrow $\u301a\phantom{\rule{0.166667em}{0ex}}f\phantom{\rule{0.166667em}{0ex}}\u301b:\u301a\phantom{\rule{0.166667em}{0ex}}{F}_{1}\phantom{\rule{0.166667em}{0ex}}\u301b\to \u301a\phantom{\rule{0.166667em}{0ex}}{F}_{2}\phantom{\rule{0.166667em}{0ex}}\u301b$, i.e., the fact $\u301a\phantom{\rule{0.166667em}{0ex}}{F}_{1}\phantom{\rule{0.166667em}{0ex}}\u301b\subseteq \u301a\phantom{\rule{0.166667em}{0ex}}{F}_{2}\phantom{\rule{0.166667em}{0ex}}\u301b$, which is a direct consequence of Definition 10 which introduces the ⊧ relation.

#### 4.4. Categorical Semantics of First-Order Relational Logic

#### 4.4.1. Logical Constants

#### 4.4.2. Conjunction and Disjunction

#### 4.4.3. Implication

#### 4.4.4. Universal and Existential Quantification

## 5. An Implementation of the Categorical Semantics

`Pred`of predicates (since the number of variables is finite, by definition all relations are predicates) and predicate functions

`TRUE`,

`FALSE`,

`AND`,

`OR`,

`IMP`,

`FORALL`,

`EXISTS`. Different from the categorical formulation,

`IMP`is a binary function, not a family of unary functions; likewise,

`FORALL`and

`EXISTS`are binary functions whose first argument is a variable. Furthermore, we introduce functions

`NOT`and

`EQUIV`for the semantics of negation and conjunction and show by theorems

`Not`and

`Equiv`that they can be reduced to the other functions.

`RISC Algorithm Language 2.6.4 (10 December 2018)`

`http://www.risc.jku.at/research/formal/software/RISCAL`

`(C) 2016-, Research Institute for Symbolic Computation (RISC)`

`This is free software distributed under the terms of the GNU GPL.`

`Execute "RISCAL -h" to see the available command line options.`

`-----------------------------------------------------------------`

`Reading file /usr2/schreine/papers/CategoricalLogic2019/catlogic.txt`

`Using N=2.`

`Using M=1.`

`Computing the value of Ass...`

`Computing the value of TRUE...`

`Computing the value of FALSE...`

`Type checking and translation completed.`

`Executing True1().`

`Execution completed (3 ms).`

`Executing True2().`

`Execution completed (1 ms).`

`Executing False1().`

`Execution completed (0 ms).`

`Executing False2().`

`Execution completed (1 ms).`

`Executing And1(Set[Array[ℤ]],Set[Array[ℤ]]) with all 65536 inputs.`

`PARALLEL execution with 4 threads (output disabled).`

`...`

`Execution completed for ALL inputs (18,373 ms, 65,536 checked, 0 inadmissible).`

`Executing And2(Set[Array[ℤ]],Set[Array[ℤ]]) with all 65,536 inputs.`

`PARALLEL execution with 4 threads (output disabled).`

`46273 inputs (36446 checked, 0 inadmissible, 0 ignored, 9827 open)...`

`Execution completed for ALL inputs (3576 ms, 65536 checked, 0 inadmissible).`

`Executing Or1(Set[Array[ℤ]],Set[Array[ℤ]]) with all 65536 inputs.`

`PARALLEL execution with 4 threads (output disabled).`

`...`

`Execution completed for ALL inputs (26,889 ms, 65,536 checked, 0 inadmissible).`

`Executing Or2(Set[Array[ℤ]],Set[Array[ℤ]]) with all 65,536 inputs.`

`PARALLEL execution with 4 threads (output disabled).`

`42,676 inputs (32,887 checked, 0 inadmissible, 0 ignored, 9789 open)...`

`Execution completed for ALL inputs (3907 ms, 65,536 checked, 0 inadmissible).`

`Executing Imp1(Set[Array[ℤ]],Set[Array[ℤ]]) with all 65,536 inputs.`

`PARALLEL execution with 4 threads (output disabled).`

`...`

`Execution completed for ALL inputs (48,592 ms, 65,536 checked, 0 inadmissible).`

`Executing Imp2(Set[Array[ℤ]],Set[Array[ℤ]]) with all 65,536 inputs.`

`PARALLEL execution with 4 threads (output disabled).`

`...`

`Execution completed for ALL inputs (9462 ms, 65,536 checked, 0 inadmissible).`

`Executing Not(Set[Array[ℤ]]) with all 256 inputs.`

`PARALLEL execution with 4 threads (output disabled).`

`Execution completed for ALL inputs (28 ms, 256 checked, 0 inadmissible).`

`Executing Equiv(Set[Array[ℤ]],Set[Array[ℤ]]) with all 65,536 inputs.`

`PARALLEL execution with 4 threads (output disabled).`

`Execution completed for ALL inputs (354 ms, 65,536 checked, 0 inadmissible).`

`Executing Forall1(ℤ,Set[Array[ℤ]]) with all 768 inputs.`

`PARALLEL execution with 4 threads (output disabled).`

`Execution completed for ALL inputs (1315 ms, 768 checked, 0 inadmissible).`

`Executing Forall2(ℤ,Set[Array[ℤ]]) with all 768 inputs.`

`PARALLEL execution with 4 threads (output disabled).`

`Execution completed for ALL inputs (512 ms, 768 checked, 0 inadmissible).`

`Executing Exists1(ℤ,Set[Array[ℤ]]) with all 768 inputs.`

`PARALLEL execution with 4 threads (output disabled).`

`Execution completed for ALL inputs (1299 ms, 768 checked, 0 inadmissible).`

`Executing Exists2(ℤ,Set[Array[ℤ]]) with all 768 inputs.`

`PARALLEL execution with 4 threads (output disabled).`

`Execution completed for ALL inputs (461 ms, 768 checked, 0 inadmissible).`

`And1`about $4\times {10}^{9}$ possible inputs whose checking on a single processor core would take RISCAL more than two decades.

## 6. Conclusions

## Author Contributions

## Funding

## Conflicts of Interest

## References

- Tarski, A. The Semantic Conception of Truth: In addition, the Foundations of Semantics. Philos. Phenomenol. Res.
**1944**, 4, 341–376. [Google Scholar] [CrossRef] - Schmidt, D.A. Denotational Semantics—A Methodology for Language Development; Allyn and Bacon: Boston, MA, USA, 1986. [Google Scholar]
- Awodey, S. Category Theory, 2nd ed.; Oxford University Press: Okford, UK, 2010. [Google Scholar]
- Barr, M.; Wells, C. Category Theory for Computing Science; Prentice-Hall, Inc., Division of Simon and Schuster One Lake Street: Upper Saddle River, NJ, USA, 1990. [Google Scholar]
- Brandenburg, M. Einführung in Die Kategorientheorie; Springer Spektrum: Berlin/Heidelberg, Germany, 2017. (In German) [Google Scholar]
- Pierce, B.C. Basic Category for Computer Scientists; MIT Press: Cambridge, MA, USA, 1991. [Google Scholar]
- Spiwak, D.I. Category Theory for the Sciences; MIT Press: Cambridge, MA, USA, 2014. [Google Scholar]
- Lawvere, F.W. Adjointness in Foundations. Dialectica
**1969**, 23, 281–296. Available online: http://www.tac.mta.ca/tac/reprints/articles/16/tr16.pdf (accessed on 9 March 2020). [CrossRef] [Green Version] - Jacobs, B. Categorical Logic and Type Theory; Studies in Logic and the Foundations of Mathematics; Elsevier: Amsterdam, The Netherlands, 1999; Volume 141. [Google Scholar]
- Abramsky, S. Logic and Categories As Tools For Building Theories. J. Indian Counc. Philos. Res. Issue Log. Philos. Today
**2010**, 27, 277–304. [Google Scholar] - Poigné, A. Category Theory and Logic. In Proceedings of the Category Theory and Computer Programming: Tutorial and Workshop, Guildford, UK, 16–20 September 1985; Lecture Notes in Computer Science; Springer: Berlin, Germany; Volume 240, pp. 103–142. [CrossRef]
- Abramsky, S.; Tzevelekos, N. Introduction to Categories and Categorical Logic. In New Structures for Physics; Lecture Notes in Physics; Springer: Berlin, Germany, 2010; Volume 813, pp. 3–94. [Google Scholar] [CrossRef] [Green Version]
- RISCAL. The RISC Algorithm Language (RISCAL). Available online: https://www3.risc.jku.at/research/formal/software/RISCAL/ (accessed on 9 July 2020).
- Schreiner, W.; Reichl, F.X. Mathematical Model Checking Based on Semantics and SMT. Trans. Internet Res.
**2020**, 16, 4–13. [Google Scholar] - Semtech. Semantic Technologies for Computer Science Education. Available online: https://www3.risc.jku.at/projects/SemTech/ (accessed on 15 July 2020).
- Nielson, H.R.; Nielson, F. Semantics with Applications: An Appetizer; Undergraduate Topics in Computer Science; Springer: London, UK, 2007. [Google Scholar]
- Schreiner, W. The RISC Algorithm Language (RISCAL)—Tutorial and Reference Manual (Version 1.0); Technical Report; RISC, Johannes Kepler University: Linz, Austria, 2017. [Google Scholar]
- Schreiner, W. Validating Mathematical Theories and Algorithms with RISCAL. In Proceedings of the 11th Conference on Intelligent Computer Mathematics (CICM 2018), Hagenberg, Austria, 13–17 August 2018; Rabe, F., Farmer, W., Passmore, G., Youssef, A., Eds.; Lecture Notes in Computer Science/Lecture Notes in Artificial Intelligence; Springer: Berlin, Germany, 2018; Volume 11006, pp. 248–254. [Google Scholar] [CrossRef]
- Schreiner, W.; Brunhuemer, A.; Fürst, C. Teaching the Formalization of Mathematical Theories and Algorithms via the Automatic Checking of Finite Models. In Proceedings of the Post-Proceedings ThEdu’17, Theorem Proving Components for Educational Software, Gothenburg, Sweden, 6 August 2017. [Google Scholar]
- Schreiner, W.; Novitzká, V.; Steingartner, W. A Categorical Semantics of Relational First-Order Logic; Technical Report; RISC, Johannes Kepler University: Linz, Austria, 2019. [Google Scholar]
- Schreiner, W.; Steingartner, W. Visualizing Execution Traces in RISCAL; Technical Report; RISC, Johannes Kepler University: Linz, Austria, 2018. [Google Scholar]
- Steingartner, W.; Eldojali, M.A.M.; Radaković, D.; Dostál, J. Software support for course in Semantics of programming languages. In Proceedings of the IEEE 14th International Scientific Conference on Informatics, Poprad, Slovakia, 14–16 November 2017; pp. 359–364. [Google Scholar]
- Steingartner, W.; Novitzká, V. Categorical Semantics of Programming Langages. In Selected Topics in Contemporary Mathematical Modeling; Monographs; Czestochowa University of Technology: Czestochowa, Poland, 2017; Volume 331, Chapter 11; pp. 167–192. [Google Scholar]
- Steingartner, W.; Novitzká, V. Learning tools in course on semantics of programming languages. In Proceedings of the MMFT 2017—Mathematical Modelling in Physics and Engineering, Poraj, Poland, 18–21 September 2017; pp. 137–142. [Google Scholar]
- Schreiner, W.; Steingartner, W. Visualizing Logic Formula Evaluation in RISCAL; Technical Report; RISC, Johannes Kepler University: Linz, Austria, 2018. [Google Scholar]

© 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Schreiner, W.; Steingartner, W.; Novitzká, V.
A Novel Categorical Approach to Semantics of Relational First-Order Logic. *Symmetry* **2020**, *12*, 1584.
https://doi.org/10.3390/sym12101584

**AMA Style**

Schreiner W, Steingartner W, Novitzká V.
A Novel Categorical Approach to Semantics of Relational First-Order Logic. *Symmetry*. 2020; 12(10):1584.
https://doi.org/10.3390/sym12101584

**Chicago/Turabian Style**

Schreiner, Wolfgang, William Steingartner, and Valerie Novitzká.
2020. "A Novel Categorical Approach to Semantics of Relational First-Order Logic" *Symmetry* 12, no. 10: 1584.
https://doi.org/10.3390/sym12101584