**5. A fuzzy context logic**

The key to the proposed fuzzy context logic is to additionally provide a fuzzy interpretation for the atomic formulae, via the symbol ⊑. To do that, we need a residual that takes two elements from the context lattice and produces a fuzzy value in 0, 1 ½ �. Then we can apply one of the well-known standard fuzzy semantics to the formula level.

The fuzzy semantics is defined by two lattices: a bounded lattice ð Þ *LT*, ≼*T*, *tT*, *sT*, 1*<sup>T</sup>* for the term level, and another bounded lattice ð Þ *LF*, ≼*F*, *sF*, *tF*,*rF*, 1*<sup>F</sup>* , where *LF* ¼ ½ � 0, 1 for the formula level together with the interpretation functions *a* : **V** *<sup>C</sup>* ! *LT* for context variables, *i* : T *<sup>C</sup>* ! *LT* for terms, and *I* : L*<sup>C</sup>* ! *LF* for formulae. We interpret the terms as before based on *LT*:

$$i(v) = a(v), \text{ for } v \in V\_C,$$

$$i(\sim c) = \mathbf{1}\_T - i(c),$$

with the 1*<sup>T</sup>* � *i c*ð Þterm-level pseudo-complement

$$\begin{aligned} i(c \sqcap d) &= t\_T(i(c), i(d)), \\ i(c \sqcup d) &= s\_T(i(c), i(d)). \end{aligned}$$

We will need to characterize a fuzzified variant of ≼*<sup>T</sup>* to obtain atomic formulae that can have a value outside of {0, 1}:

$$I(c \boxplus d) = \prec\_{TF}(i(c), i(d).$$

On this basis, the interpretation of formulae can then follow one of the standard models of fuzzy logic in *LF*:

$$\begin{aligned} I(\neg \phi) &= \mathbf{1}\_F - I(\phi) \\ I(\phi \land \psi) &= \mathbf{t}\_F(I(\phi), I(\psi)) \\ I(\phi \lor \psi) &= \mathbf{s}\_F(I(\phi), I(\psi)) \end{aligned}$$

The key is to provide a function ≼*TF* : *LT* � *LT* ! *LF* for connecting the fuzzy term and formula layers. As usual, we want the relation to be conservative with respect to the classical partial order relation on the classical cases:

$$\begin{aligned} \lnot\prec\_{TF}(\mathfrak{x},\mathfrak{y}) &= \mathtt{1}\_{F}\text{iff } \mathfrak{x} \not\preceq\_{T} \mathfrak{y}. \\ \lnot\prec\_{TF}(\mathfrak{x},\mathfrak{x}) &= \mathtt{1}\_{F}\text{holds for all } \mathfrak{x} \in L\_{T}. \end{aligned}$$

$$\begin{aligned} \text{If } \mathfrak{x} \not\preceq\_{TF}(\mathfrak{x},\mathfrak{y}) &= \mathtt{1}\_{F} \text{ and } \mathfrak{s}\_{TF}(\mathfrak{y},\mathfrak{x}) = \mathtt{1}\_{F}\text{for } \mathfrak{x},\mathfrak{y} \in L\_{T} \text{ then } \mathfrak{x} = \mathfrak{y}. \\ \text{If } \mathfrak{s}\_{TF}(\mathfrak{x},\mathfrak{y}) &= \mathtt{1}\_{F} \text{ and } \prec\_{TF}(\mathfrak{y},\mathfrak{z}) = \mathtt{1}\_{F} \text{ then also } \mathfrak{s}\_{TF}(\mathfrak{x},\mathfrak{z}) = \mathtt{1}\_{F}. \end{aligned}$$

What is a good choice depends on both *LT* and *LF*, and given a particular choice, different functions may support this weak restriction. A candidate for spatial applications for *LT* <sup>¼</sup> <sup>2</sup>*<sup>B</sup>* for a base set *<sup>B</sup>* and *LF* <sup>¼</sup> ½ � 0, 1 is a fuzzified variant of the qualitative granular relation systems proposed in [32]. Here, several types of granular relations between regions are distinguished based on an absolute ranking of sizes, such as the largest circle a spatial region is contained in, or its diameter, or the length of an interval. Complementing topological notions, such as *part-of* or *overlap*, granular relations can be defined [32]:


We can generalize this notion using a 0, 1 ½ � perspective instead of a discrete partitioning of the space of possible overlap-relations. For the example of a settheoretical model, we could proceed, e.g., to find a fuzzification of ⊆ into a function ⊆*TF* mapping to 0, 1 ½ � by assessing the largest difference between two arguments *x*, *y* in comparison to the diameter of *x*. The intervals 14, 46 ð � and

½ Þ 14, 46 , for instance differ only in boundary points. The intervals *x* ¼ ð Þ 11, 34 and *y* ¼ ð Þ 12, 36 overlap in *x*∩*y* ¼ ð Þ 12, 34 . With the overlap ∣*x*∩*y*∣ ¼ ∣ð Þ 12, 34 ∣ ¼ 12 and ∣*x*∣ ¼ ∣ð Þ 11, 34 ∣ ¼ 13, this is an overlap of ∣*x*∩*y*∣*=*∣*x*∣ ¼ 12*=*13 ¼ 92%.

Generally, we can employ a granularity function *γ* : *LT* ! <sup>þ</sup> to compute a mapping from entities of *LT* to þ. Based on this, we can use a suitable function *r* : *LT* ! *LF* to make the transition between the term layer and the formula layer in such a way that it also connects appropriately to the basic properties of the residual *rF*, e.g., by employing *rF* itself:

$$\prec\_{TF}(\mathfrak{x}, \mathfrak{y}) = r\_F(\chi(\mathfrak{x}), \chi(\mathfrak{x} \cap \mathfrak{y})) .$$

We obtain a fully specified family of fuzzy context logics. Note that with *rF* ¼ *r*prod, we receive the conditional probability:

$$r\_{\text{prod}}(\chi(\mathfrak{x}), \chi(\mathfrak{x}\cap\mathfrak{y})) = \frac{\chi(\mathfrak{x}\cap\mathfrak{y})}{\chi(\mathfrak{x})} = \begin{cases} 1 & \text{if } \mathfrak{x} \subseteq \mathfrak{y} \\ \frac{\chi(\mathfrak{x}\cap\mathfrak{y})}{\chi(\mathfrak{x})} & \text{otherwise} \end{cases}$$

For *rF* ¼ *r*min we obtain:

$$r\_{\min}(\boldsymbol{\chi}(\boldsymbol{x}), \boldsymbol{\chi}(\boldsymbol{x}\boldsymbol{\gamma}\boldsymbol{\chi})) = \begin{cases} 1 & \text{iff } \boldsymbol{x} \subseteq \boldsymbol{\chi} \\ \boldsymbol{\chi}(\boldsymbol{x}\boldsymbol{\gamma}\boldsymbol{\chi}) & \text{otherwise.} \end{cases}$$

Among the potential applications, a two-layered fuzzy logic can help to reason about fuzzy logic systems. The base logic being decidable for the classical semantics, we can, at least for the classical case, make absolute guarantees for a given system. We can prove whether a given fuzzy system, e.g., the output of a machine learning mechanism, such as an ANFIS, together with a description of possible situations in the domain and desirable properties yields a tautology, thus proving that the system has the desirable properties under all possible circumstances. If we are interested in gaining an understanding of systems that are not tautological in this sense, so as to obtain, e.g., degrees of possibility of failure under certain circumstances, more advanced fuzzy proof methods are required.

#### **6. Conclusions**

This chapter illustrated that the lwo-layered logic context logic and fuzzy logic can be combined in a meaningful way. We first mapped both logics to a predicate logical background language, so as to highllight their commonalities and differences and to obtain a background compatible with both. In both cases, we discussed a common set-theoretical model that can be used to interpret the background language. We formally proved that the lattice-based generalized *t*-norms of fuzzy logic provide a suitable semantics for the term-layer of context logic. To do this, we expressed context logic in terms of a single pre-order relation that additionally supports the weak supplementation principle and showed that, with this translation providing semantics, context logic fulfills the properties of a residuated lattice. We also derived that the language is decidable in EXPSPACE.

The formula-layer of context logic could then additionally be imbued with a ½ � 0, 1 -based fuzzification. Proposals for adding either the product *t*-norm or the minimum *t*-norm for the formula layer on top of the lattice-based generalized *t*-norm of the context term layer were suggested, and a mechanism for combining this with granularity to further expand expressiveness was discussed.
