### Fuzzy Logic and Enriching Over the Category [0,1]

#### Posted by Simon Willerton

Standard logic involving the truth values ‘true’ and ‘false’ can make it difficult to model some of the fuzziness we use in everyday speech. If you’d bought a bike yesterday then today it would be truthful to say “This bike is new”, but it wouldn’t be truthful so say it in 20 years’ time. However, between now and then there won’t be a specific day on which the statement “This bike is new” suddenly switches from being true to being false. How can you model this situation?

One approach to modelling this situation is with fuzzy logic where you allow your truth values to be things other than just true and false. For instance, you can take the interval $[0,1]$ as the set of truth values with $0$ representing false and $1$ representing true. So the truth degree of the statement “This bike is new” would vary, being $1$ today and decreasing to something very close to $0$ in 20 years’ time.

This post is an attempt by me to understand this fuzzy logic in the context of enriched category theory, in particular, using $[0,1]$ as a monoidal category to enrich over. We will see that categories enriched over $[0,1]$ can be interpreted as fuzzy posets or fuzzy preorders.

This was going to be a comment on Tom Avery’s Kan Extension Seminar post on Metric Spaces, Generalized Logic, and Closed Categories but grew too big!

I have been trying to understand a bit of fuzzy logic because it feeds into fuzzy concept analysis which I’m also trying to understand. As ever, I understand the category theory better than the logic. In terms of references, I’ve picked up bits and pieces from Belohlavek’s Concept lattices and order in fuzzy logic and Hájek’s Metamathematics of fuzzy logic.

### Truth degrees in $[0,1]$: fuzzy logic

As mentioned above you can replace your set of truth values $\{ \mathrm{false},\mathrm{true}\}$ by the interval $[0,1]$, with $0$ representing completely false and $1$ representing completely true. Thus an element of $[0,1]$ represents a ‘degree’ of truth. The idea is that this represents the degree of truthfulness of statements like “George is old” or “The film is good”: it is *not* supposed to represent than the probabitlity of the truth of a statement like “I will receive an email from a student tomorrow”. We are modelling vagueness and not probabilty. Also, we are supposed to be modeling ojectivity so the truth degree of the statement “George is old” will depend on the age of George and not on anyone’s opinion of how old he seems to be.

Being category theorists, we might try to fit this into Lawvere’s framework of generalized logic, where we think of our truth values as forming a closed monoidal category. We can make $[0,1]$ it into a poset — and hence a category — by using the order $\le$, this will be our notion of entailment. So if $P$ and $Q$ are statements then $P\vdash Q$ precisely when the truth degree of $P$ is less than or equal to the truth degree of $Q$. However, I’m not entirely sure how to interpret that.

The observant amongst you will have noticed that this poset $[0,1]$ is isomorphic to the poset we use for metric spaces $([0,\infty ],\ge )$, via the maps $x\mapsto \exp (-x)$ and $a\mapsto -\ln (a)$. So an alternative interpretation of these truth values will be as ‘proximities’ — proximity approximately $0$ meaning not at all close, and proximity approximately $1$ meaning really, really close. [Switching from distances in $[0,\infty ]$ to proximities in $[0,1]$ is an important step in calculating magnitudes of metric spaces, but I won’t say any more about that.]

Next we want some notion of ‘conjunction’ $\otimes$ and ‘implication’ $\Rightarrow$. In category theory terms we want a closed monoidal structure on the category $[0,1]$. There are at least three such structures that are well studied.

**The product structure**: Here $a\otimes b \coloneqq a\cdot b$ and $a\Rightarrow b \coloneqq 1$ if $a\le b$ and $b/a$ otherwise. Via the exponential and logarithm maps this corresponds to the usual closed monoidal structure on $[0,\infty ]$ of addition and truncated subtraction.

**The Gödel structure**: Here $a\otimes b \coloneqq \min (a,b)$ and $a\Rightarrow b \coloneqq 1$ if $a\le b$ and $b$ otherwise. Via the exponential and logarithm maps this corresponds to the closed monoidal structure on $[0,\infty ]$ which gives rise to ultrametric spaces.

**The Łukasiewicz structure**: Here $a\otimes b \coloneqq \max (a+b-1,0)$ and $a\Rightarrow b\coloneqq \min (1-a+b,1)$. Via the exponential and logarithm maps this corresponds to the monoidal structure $x\otimes y\coloneqq -\ln (\max (e^{-x}+e^{-y}-1,0))$ and that doesn’t look at all familiar!

If the truth degrees of two statements are $P$ and $Q$ then the truth degree of both statements together should be given by the conjunction $P\otimes Q$, but I don’t know examples of real world models with these three different logics. Anybody? I would be very interested in hearing thoughts and ideas on this.

In all of the above three cases the closed monoidal category $\{ \mathrm{false},\mathrm{true}\}$ of classical truth values embeds closed monoidally.

### Enriching over $[0,1]$: fuzzy preorders

We can now think about what categories enriched in $([0,1],\le )$ are, as generalizations of preorders. Such an enriched category consists of a set $C$ and to each pair of elements $c,c'\in C$ we associate a truth degree $C(c,c')\in [0,1]$, we want to think of this as the degree to which $c$ is ordered before $c'$. This is what we will call a fuzzy preorder. It will satisfy fuzzy transitivity: $C(c',c'')\otimes C(c,c')\le C(c,c'')$. How this is actually interpreted will depend on which product $\otimes$ we took.

Here’s an example of a fuzzy preorder. Suppose that Bart is aged 9, Marge is aged 39 and Homer is aged 40. Is it true that Homer is (at least) as old as Marge? Yes. Is it true that Marge is (at least) as old as Homer? Well, nearly. Is it true that Bart is (at least) as old as Marge? Well, not really at all. We can formalise this into a fuzzy preorder $\succeq$ “is at least as old as” where
$\begin{aligned}
(\text {Homer}\succeq \text {Marge})&=1 \\ (\text {Marge}\succeq \text {Homer})&=\text {a tiny bit less than}\, \, 1\\ (\text {Bart}\succeq \text {Marge})&=\text {much less than}\, \, 1.
\end{aligned}$
Algebraically we could define
$A\succeq B\coloneqq \begin{cases} 1 &\text {if}\, \, \mathrm{age}(A)\ge \mathrm{age}(B)\\ \mathrm{age}(A)/\mathrm{age}(B)&\text {if}\, \, \mathrm{age}(A)\lt \mathrm{age}(B) . \end{cases}$
This gives a fuzzy preorder on the set $(\text {Bart}, \text {Marge}, \text {Homer})$ with respect the *product* monoidal structure $\cdot$ on $[0,1]$, or in other words, it gives a category enriched over the monoidal category $([0,1],\cdot ,1)$.

There should be some more convincing examples, but I haven’t found any yet.

An exercise at this point is to look at the dictionary in my post on Galois correspondences and enriched categories and extend it by another column for categories enriched over $[0,1]$.

## Re: Fuzzy logic and enriching over the category [0,1]

I don’t claim to understand fuzzy logic, but there is a renewed interest in such issues in effect algebra of predicates.

Steve Vickers has work on fuzzy sets and geometric logic.

Both are at least in a categorical framework.