**3. Fuzzy logic as a logical language**

While the linguistic background facilitates usability of fuzzy logic, it is easier to see logical connections with respect to a more restrictive and conventional logic syntax. We therefore use a simple propositional logical language as a classical background language in this chapter. We adopt the following syntax for the set of all formulae L*<sup>F</sup>* based on a set of variables **V***<sup>F</sup>* and a set of predicate symbols P*F*.

> For P∈P<sup>F</sup> and x∈**V** F,P xð Þ is an ð Þ atomic formula*:* For any formula *ϕ*∈LF, ¬*ϕ* is a formula*:* For any formulae *ϕ*, *ψ* ∈LF, *ϕ* ∧ *ψ*, *ϕ*∨*ψ*, and *ϕ* ! *ψ* are formula*:*

Using this syntax, we can formalize a proposition similar to the above example as:

Yellow color ð Þ! Ripe ripeness ð Þ*:*

We can use the usual semantics for predicate logics to interpret this sentence based on a structure ð Þ *U*,*I*, *iV*, *iP* . Here *U* is the universe of discourse, which needs to contain in this example: the referents for the constants, i.e., concrete colors, e.g., as RGB values, and degrees of ripeness, e.g., as sets of tuples containing percentage of sugar and other substances indicative of degrees of ripeness. The term interpretation function *iV* : **V** *<sup>F</sup>* ! *U* maps the variable symbols *ripeness* and *color* to elements from *U*, distinct measurement values in a measurement value space. Predicate symbols are interpreted by the function *iP* : **<sup>V</sup>***<sup>P</sup>* ! <sup>2</sup>*<sup>U</sup>* mapping out regions in *U*. The classical formula interpretation function *I* : L*<sup>F</sup>* ! f g 0, 1 maps formulae to values in 0, 1 f g.

### **3.1 Interpretation of predicates based on fuzzy sets**

A fundamental point where fuzzy logic differs from classical predicate logic is in the interpretation of the predicates and predication: classical logic considers *I*ð Þ Yellow color ð Þ as true iff *iV*ð Þ color ∈*iP*ð Þ Yellow , realizing predication by set membership (∈). Fuzzy logic, in contrast, interprets predicate symbols such as Yellow with fuzzy sets *μ<sup>P</sup>* : *U* ! ½ � 0, 1 , e.g., *μ*Yellow : *U* ! ½ � 0, 1 , i.e., as functions into ½ � 0, 1 . It then can replace the classical membership function <sup>∈</sup> (of type *<sup>U</sup>* � <sup>2</sup>*<sup>U</sup>* ! f g 0, 1 ), with a fuzzy set membership function *μ* : *U* � ð Þ! *U* ! ½ � 0, 1 ½ � 0, 1 that simply applies the fuzzy set membership function: *μ u*, *μ*<sup>P</sup> ð Þ↦*μ*Pð Þ *u* . Being based on fuzzy sets *μ*P, formulae L*<sup>F</sup>* in fuzzy logic can then be interpreted with a fuzzy semantics using a suitable function *I* : L*<sup>F</sup>* ! ½ � 0, 1 for complex formulae.

#### **3.2 Interpretation of connectives based on** *t***-norms**

To evaluate complex formulae, fuzzy logic requires extended semantics for the propositional connectives that can handle arbitrary values in 0, 1 ½ �, while remaining true to the classical interpretation in the cases 0, 1 f g. A general strategy in fuzzy

logic is to allow different semantics to take the place of the classical semantics for propositional connectives (¬, ∧ , ∨, !), in particular, as t-norms (functions *t* : ½ �� 0, 1 ½ �! 0, 1 ½ � 0, 1 ) with corresponding t-conorms (functions *s* : ½ �� 0, 1 ½ �! 0, 1 ½ � 0, 1 ), and their residuals (*r* : ½ �� 0, 1 ½ �! 0, 1 ½ � 0, 1 ), respectively [6]. These functions are described and discussed in more detail below. A t-norm based semantics interprets the logical language we defined above in the following way:

$$\begin{aligned} \text{For } \mathbf{Q} \in \mathcal{P}\_{\mathbf{F}} \text{ and } \mathbf{x} \in \mathcal{V}\_{\mathbf{F}} \colon I(\mathbf{Q}(\mathbf{x})) &= \mu(i\_{V}(\mathbf{x}), i\_{P}(\mathbf{Q})) = \mu\_{Q}(i\_{V}(\mathbf{x})) \\ \text{For any formula } \phi \in \mathcal{L}\_{\mathbf{F}} \colon I(\neg \phi) &= \mathbf{1} - I(\phi) \\ \text{For any formula } \phi, \psi \in \mathcal{L}\_{\mathbf{F}} \colon I(\phi \land \psi) &= t(I(\phi), I(\psi)) \\ I(\phi \lor \psi) &= s(I(\phi), I(\psi)) \\ I(\phi \to \psi) &= r(I(\phi), I(\psi)) \end{aligned}$$

#### **3.3 Properties of** *t***-norms**

If the semantics for ∧ are based on a t-norm, this guarantees that important semantic properties of the classical conjunction are retained. A t-norm 0, 1 ½ �<sup>2</sup> ! ½ � 0, 1 is a commutative (1), associative (2), and monotone function (3), with a neutral element 1 (4).

$$t(\mathfrak{x}, \mathfrak{y}) = t(\mathfrak{y}, \mathfrak{x}) \tag{1}$$

$$t(t(\mathfrak{x}, \mathfrak{y}), \mathfrak{z}) = t(\mathfrak{x}, t(\mathfrak{y}, \mathfrak{z})) \tag{2}$$

$$\text{If } x \preceq y \text{ then } t(x, z) \preceq t(y, z) \tag{3}$$

$$t(\mathbf{1}, \mathbf{x}) = \mathbf{x} \tag{4}$$

Examples are the minimum t-norm (5), used in Gödel logics, and the product tnorm (6), used in probability theory:

$$t\_{\min}(a,b) = \min\left(a,b\right) \tag{5}$$

$$t\_{\text{prod}}(a,b) = a \ast b \tag{6}$$

The corresponding t-conorms, denoted by the symbol *s* and accordingly also called s-norms, can be obtained by applying De Morgan's laws assuming the semantics of negation of a value *t* to be 1 � *t*. Their neutral element is 0.

$$s(a,b) = \mathbf{1} - t(\mathbf{1} - a, \mathbf{1} - b) \tag{7}$$

The corresponding s-norms for the above example t-norms are then *s*min, the minimum s-norm (8), and the product s-norm *s*prod (9):

$$s\_{\min}(a,b) = \max\left(a,b\right) \tag{8}$$

$$s\_{\text{prod}}(a,b) = a + b - a \ast b \tag{9}$$

There are several ways to interpret the implication and different approaches are suitable for different purposes (cf. [22], for a detailed overlook and comparison). As with other operators, fuzzy implication should be conservative for values in 0, 1 f g. A widely used notion is the *left-residual* [23]:

$$r(a,b) = \sup\{z \in [0,1] | t(a,z) \le b\} \tag{10}$$

The relation between the residual and the t-norm/s-norm are covered by two additional axioms, continuity (11) and pre-linearity (12):

$$t(x, y) \le z \text{ iff } x \le r(y, z) \tag{11}$$

$$s(r(x,y), r(y,s)) = \mathbf{1} \tag{12}$$

For the above two t-norms *t*min, *t*prod the following are corresponding residuals:

$$r\_{\min}(a,b) = \begin{cases} 1 \text{ iff } a \le b \\ b \text{ otherwise.} \end{cases} \tag{13}$$

$$r\_{\text{prod}}(a,b) = \begin{cases} 1 \text{ iff } a \le b \\ b/a \text{ otherwise.} \end{cases} \tag{14}$$

#### **3.4 Generalized** *t***-norms: the set-theoretic lattice**

The most widely used examples of functions *μ<sup>P</sup>* map elements of *U* to values in ½ � 0, 1 , with, e.g., the minimum or product t-norm. However, fuzzy logic can be given a generalized t-norm semantics based on residuated lattices, i.e., other lattice structures ð Þ *L*, ⪯ instead of 0, 1 ð Þ ½ �, ≤ . A particularly interesting residuated lattice for the purposes of comparison with context logic is *<sup>L</sup>* <sup>¼</sup> <sup>2</sup>*<sup>B</sup>*, <sup>⊆</sup> , where *<sup>B</sup>* is a given base set and *U* ¼ *B*. Given this structure, we can define interpretation functions *iV* : **V***<sup>F</sup>* ! *B* for variable symbols as before. But we can now interpret predicates not with classical 0, 1 ½ �-fuzzy sets but with generalized *<sup>L</sup>*-fuzzy sets *<sup>μ</sup><sup>P</sup>* : *<sup>B</sup>* ! <sup>2</sup>*<sup>B</sup>*, so that *<sup>I</sup>* : <sup>L</sup>*<sup>F</sup>* ! <sup>2</sup>*<sup>B</sup>* for formulae:

$$I(P(\mathfrak{x})) = \mu\_P(i\_V(\mathfrak{x})), \text{with } \mu\_P: U \to \mathfrak{2}^B \tag{15}$$

$$I(\neg \phi) = \mathbf{2}^{\mathcal{B}} - I(\phi) \tag{16}$$

$$I(\phi \wedge \psi) = I(\phi) \cap I(\psi) \tag{17}$$

$$I(\phi \lor \psi) = I(\phi) \cup I(\psi) \tag{18}$$

$$I(\phi \to \psi) = I(\psi) \cup \left( 2^B - I(\phi) \right) \tag{19}$$

The intuition behind this is to map elements *x*∈ *U* to, e.g., sets of points, i.e., spatial regions or temporal or sensory values intervals. Instead of saying *x* is *P* to a degree of 0.5, for instance, we could thus distinguish *x* as in a specific area of space, time, or sensor value space. E.g., we can assign a function *μ*Yellow to map measured RGB colors *x* to sets that form a filter around the color #FFFF00. Measuring an orange *x* and a lime *y* we could determine they are yellow to the same degree as *μ*Yellowð Þ *x* and *μ*Yellowð Þ*y* yielding the same large region around the core value #FFFF00. We could say *x* is as yellow as *y* is yellow, since with *I*ð Þ¼ Yellowð Þ *x <sup>I</sup>*ð Þ Yellowð Þ*<sup>y</sup>* holds *<sup>I</sup>*ðYellowð Þ\$ *<sup>x</sup>* Yellowð Þ*<sup>y</sup>* Þ ¼ <sup>2</sup>*<sup>B</sup>*. This would be the same result as with classical fuzzy sets, but we would be able to additionally avoid comparing incompatible contexts, e.g.: while a red apple *z* may be as aubergine as an orange is yellow with classical fuzzy sets, the set theoretic interpretation yields *I*ð Þ Yellowð Þ\$ *x* Aubergineð Þ*z* ⊆*I*ð Þ Yellowð Þ\$ *x* Yellowð Þ*y* , as the regions for *I*ð Þ Yellowð Þ *x* and *I*ð Þ Aubergineð Þ*z* overlap but are distinct. In contrast to the strictly ordered 0, 1 ½ �, the partially ordered 2*<sup>B</sup>* thus allows higher expressiveness.

Partial orders and corresponding lattice structures are at the heart of the semantics for context logic, and the two languages can on this basis be combined in a natural manner.
