## Abstract

A key step towards trustworthy, reliable and explainable, AI is bridging the gap between the quantitative domain of sensor-actuator systems and the qualitative domain of intelligent systems reasoning. Fuzzy logic is a well-known formalism suitable for aiming at this gap, featuring a quantitative mechanism that at the same time adheres to logical principles. Context logic is a two-layered logical language originally aimed at pervasive computing systems for reasoning about and within context, i.e., changing logical environments. Both logical languages are linguistically motivated. This chapter uncovers the close connection between the two logical languages presenting two new results. First, a proof is presented that context logic with a lattice semantics can be understood as an extension of fuzzy logic. Second, a fuzzification for context logic is proposed. The resulting language, which can be understood as a two-layered fuzzy logic or as a fuzzified context logic, expands both fields in a novel manner.

### Keywords

- intelligent systems
- fuzzy logic
- context logic
- context

## 1. Introduction

Fuzzy logic has been employed successfully in intelligent systems, sensor-actuator systems, expert systems, and machine learning techniques for more than 50 years [1]. Being a tool for inference at both the logical and the sensor-actuator systems level its use for reliable and explainable autonomous systems has become a focus of recent research [2, 3, 4, 5]. One key building block for this has been a growing understanding of fuzzy logic semantics over the past 20 years [6] and the position this family of logics assumes within the field of logics in general. In particular, the connection to residuated lattices plays an important role for novel perspectives [7, 8]. One such new perspective is the connection to context logic, which is developed in this chapter.

Context logic was introduced in [9, 10, 11] as a logic for representing context-dependency and context phenomena in pervasive computing systems. Recent developments in context logic focus on a logical actuator control mechanism [12, 13, 14]. This chapter presents the logic with a fuzzy logic lattice semantics highlighting the close relation between the two formalisms and the close relation between context logic and the sensory and machine learning components of intelligent sensor actuator systems (ISAS), such as robotics and autonomous vehicles. We show that context logic can be understood as a fuzzy logic since it can be given an algebraic semantics like that of fuzzy logic as based upon lattice structures.

## 2. Fuzzy logic and context logic

We briefly review the basics of how fuzzy logic handles quantitative information and contrast this with the approach chosen in context logic. Here, it may appear we go into basic aspects at a greater depth than what may seem necessary. However, to bring the two logics together, establishing the common ground conceptually is a critical first step.

Fuzzy logic [15] was developed as a linguistically motivated logic that was to be more akin to how human beings reason with uncertain information and how experts analyze alternatives and act upon them [16]. Its main cognitive motivation was that human beings are able to relay, for instance, control information without the use of numerical values. In fact, human language outside scientific and technical contexts rarely employs quantities to express relations regarding a scale, amounts, or probabilities. We prefer to say, e.g., *rarely* rather than giving an estimate about a concrete percentage, or give a color term, such as *yellow*, instead of providing RGB values and we reason with such information. We “compute with words” [17]. One reason for this is the inherent uncertainty of perceptual or sensory information and the presence of intersubjective differences. Rules we receive or provide verbally benefit from this vagueness, as they have a wide applicability, allow a concise formulation, and allow for intersubjective differences: two people may disagree whether a certain fruit is yellow or rather a light orange, but they will agree that to at least some degree, something that has a light orange color is yellow. A rule given by an expert to a novice, such as “if a fruit is yellow, then it is ripe,” is easy to understand for a human being, and accordingly fuzzy expert systems, fuzzy sensor-actuator systems, and the output of some fuzzy learning systems, can be understood and verified by human beings better than purely numerical systems that operate with numerical equations.

In natural language, human beings convey information about continuous sensory domains, such as color or height, by use of adjectives. The phenomena of vagueness, uncertainty, and context-dependency are the main challenges for formalization from a linguistic point of view [18]. Adjectives can be used in several different ways. The main categories are:

**Positive:** Anne is tall (for her age).

**Comparative:** Anne is taller than Betty.

**Equative:** Ann is as tall as Betty.

**Superlative:** Ann is the tallest (girl on the team).

While the comparative and equative use are most easily mapped to a corresponding ordering and equivalence relation for the dimension in question (here: height), the positive and superlative can change their applicability depending on context. If we talk about children, 1.50 m (5 ft) may be tall. If we talk about the average European female adult, this is comparatively small. Likewise, the superlative changes with the context: Ann may be the smallest person in the room and still be called the tallest while the current topic is her team. Context logic is interesting from a cognitive science perspective as it enables the modeling of such influence of the context.

From a cognitive science point of view, fuzzy logic is an interesting formalism as it addresses issues of vagueness and uncertainty that appear especially in the semantics of adjectives. But it is also one of only few approaches bridging logical reasoning and machine learning [19].

Fuzzy logic goes beyond multi-valued logics [20] by proposing semantics for approximate reasoning. In particular, [15, p.424] proposes to “[view] the process of inference […] as the solution of a system of relational assignment equations.” This emphasizes the connection to both sensor-actuator systems and classical methods of system modeling and evaluation with recent advances reaching from explainable machine learning [5] to advanced uncertainty mechanisms for ontology design [21]. Combining the two languages promises to make the full expressiveness of natural language adjectives available for modeling, reasoning, and explanation in ISAS design.

## 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

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

We can use the usual semantics for predicate logics to interpret this sentence based on a structure *ripeness* and *color* to elements from

### 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

### 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

### 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

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

The corresponding t-conorms, denoted by the symbol

The corresponding s-norms for the above example t-norms are then

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 *left-residual* [23]:

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

For the above two t-norms

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

The most widely used examples of functions

The intuition behind this is to map elements

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.

## 4. An overview of context logic

We now specify the context logic language and describe a semantics similarly in terms of a predicate logical language, which in turn can be related to lattice structures and thus fuzzy logical semantics.

### 4.1 Contextualization in context logic

Context logic has only one type of basic entity, *context variables*, and a single partial order relation *part of* or *sub-context*): the city of London, for instance, is a sub-context of England, and March 2017 is a sub-context of the year 2017:

The language provides three term operators

Since any pre-order can be expressed as a sub-relation of a partial order relation, and be extended to a partial order relation over its equivalence classes, the single sub-context relation together with the *spatial* sub-context or a sub-region of England, and that March 2017 is a *temporal* sub-context or a sub-interval of the year 2017.

This and the following examples feature one simple spatial sub-context and one temporal sub-context relation. We can in the same manner however express, for instance, directional relations [25], temporal ordering relations (bi-directionally branching), and class hierarchies [9]. Ordering relations between thematic values, such as expressed by the comparative use of adjectives (Section 2) can also be added in the same way. The main purpose of the language is to facilitate expressing the common partial order core of all these theories, including the tractable fragments of these theories in a unified syntax.

A syntactic shorthand reflects – linguistically speaking – a topicalized adverbial position:

Spatially, London is a sub-context of England. Temporally, March 2017 is a sub-context of the year 2017. For entities such as cities or months, this may seem redundant. But contexts, such as a birthday party, which have both temporal and spatial extent can thus be located temporally within one context and spatially within another:

We can also reflect that speakers may choose to topicalize the other way around [26], as the last two sentences are logically equivalent to the following:

or, leveraging the propositional second layer,

where, for any propositional junctor

Regarding John’s birthday party: the location is in London, the time is in March 2017. Moreover, we can allow contexts to be stacked or combined, in order to express more complex contextualization:

Similarly to how we would express conflicting opinions in natural language, we can equivalently state:

Regarding John’s birthday party and the time, Mary says in March 2017 and Tom says in August 2017. Context logic thus allows to reflect colloquial contextualizations well, but also to represent conflicting information.

### 4.2 Context logic as a logical language

Context logic thus employs two syntactic layers: the term layer with the term operators ^{1}

Context formulae

We further define:

Different variant semantics have been proposed [10, 11, 26]. The different approaches slightly differ in the resulting semantics, but all three employ a lattice structure for specifying the meanings of context terms, assigning a partial order to give a semantics to

We note that although we introduce new variables

Consequently, the fragment of predicate logic required in application of *atomic guard*, as *guarded fragment* GF [27] defined as [cited after 28, p.1664f]:

If *x*, *y* are tuples of variables, *α*(*x*, *y*) is an atomic formula, *ψ*(*x*,*y*) is in GF, and free (*ψ* ⊆ free (*α*) = {*x*,*y*}, where free (*ϕ*) is the set of the free variables of *ϕ*, then the formulae

In order to obtain the reasoning capabilities, however, we would need to add pre-order axioms for

and we see that transitivity (13) cannot be axiomatized in the two-variable fragment, as it requires three variables. Fortunately, [28, 29] have shown that for GF^{2} + PG – the guarded fragment limited to two variables and a single binary pre-order that can only appear in the guard – is in 2-EXPTIME. Moreover, this result is a loose upper bound, since the language under inspection here can be expressed using the transitive binary relation

In addition to the pre-order axioms, we can also add a localized guarded variant of the so-called *weak supplementation principle* [30, Ch. 3] for ^{2}

The principle says that, if for any

In order to do this, however, we have to employ

Intuitively, the meaning of

The complement

A crucial consequence of adopting weak supplementation (35) is (2). It says that if all parts

Proof (⫤): this holds immediately with the reflexivity (34) and transitivity (33) of

Proof (

It can be shown (Section 4.4) that the definition of

### 4.3 A fuzzy logic perspective on context logic

This section shows context logic as specified above is a two-layered language with a generalized

To see that the context terms

Proof (3): if every

The generalized De Morgan law connects t-norms with s-norms (7). It follows for the translations of

The residual can then be derived from its characterization:

The operation

has the required property ^{3}

We prove that for any

and the term

Proof: assume the antecedent is true, then because of transitivity of

This result indicates that, at least with respect to the supplementation property expressed through (35),

We are thus justified to say that context logic terms have a generalized

We obtain: a t-norm-based classical semantics for context logic is a structure

With

It only remains to show that the context term operators indeed support the lattice requirements.

### 4.4 Proof: context logic with local, guarded weak supplementation characterizes a bounded lattice

For the purpose of completeness, the proofs are listed here in detail. However, the results are part of basic, fundamental lattice theory and no novelty is claimed.

We prove that

These properties hold, since

We show the translations:

We can see that all translations of properties are tautologies and follow directly from the properties of

The property (47) holds because

We can now prove the semilattice laws for

When we translate idempotency (48):

we see that the translation of

The other laws follow in a similar manner. We show associativity (49):

By proving the following for any

We prove in two steps.

Proof (

Proof (⫤): assume we have for each

Applying this result twice via the associativity and commutativity of

Theorem 14 holds immediately given the definition of the translation for

Proving the neutral element property (51) requires (35).

The proof follows immediately by (2).

In summary, we needed (35) for proving idempotency (48) and the neutral element (51). Associativity (49) and commutativity (50) were proven without using (35).

We have thus shown that

For (52):

we show that for any

Proof (⫤): this holds because of transitivity (33) and reflexivity (34) of

Proof (

We prove (53):

by showing for any

Proof (

The relation between the residual and the t-norm were covered by two additional axioms above: continuity (11) and pre-linearity (12):

We prove continuity (54) by translation using

Proof (

Proof (⫤): assume the antecedent

We prove pre-linearity (55):

by showing for any

Proof: we obtain for the antecedent:

Since this holds for all

We rename the variables to better show the structure:

and by (2):

We now know that

which entails the consequent.

### 4.5 A note on mereological and ontological status

The mereologically interested reader may notice that adding even the weakened variant of the weak supplementation principle is sufficient to collapse context logic term structures to a single level by (2). The reason for this is that the weak supplementation principle considerably strengthens the expressiveness of negation, which given the principle always ensures the existence of a fully negative individual. This is the case, although our system mereologically speaking is an MM system, i.e., supports M1-M4 [30] only, with M4 acting as an axiom schema.

We may note also, that we need not ensure product (M5) or sum (M6) to exists, nor do we need or posit a universal

### 4.6 Example: set-theoretical model

To make the discussion more concrete, we briefly sketch a set-theoretical interpretation. An example of a suitable model is the set-theoretic lattice, assuming the set of all subsets of a base universe as the universe for the interpretation of the translation

We can show that, if the canonical interpretation

The pre-order axioms for

Proof: assume a set

We prove that

The case of (20) is immediately clear. For (21), we look at the definition of *points*:

Proof (

Proof (⫤): assume that for every

For (22), we similarly look at the definition of

Proof (

Proof (⫤): as in the proof for

We have thus seen that the set-thoretical standard model is a concrete example of a structure for interpreting context terms and formulae.

## 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

The fuzzy semantics is defined by two lattices: a bounded lattice

with the

We will need to characterize a fuzzified variant of

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

The key is to provide a function

What is a good choice depends on both *part-of* or *overlap*, granular relations can be defined [32]:

Two regions are

*adjacent*iff they overlap but only in a part smaller than grain-size.Two regions are

*spatially indistinguishable*iff they differ only in a part smaller than grain-size.Two regions

*relevantly overlap*iff they overlap in a part larger than grain-size and differ in a part larger than grain-size.

We can generalize this notion using a

Generally, we can employ a granularity function

We obtain a fully specified family of fuzzy context logics. Note that with

For

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

The formula-layer of context logic could then additionally be imbued with a

## Acknowledgments

This work was financially supported by the Hanse-Wissenschaftskolleg, Delmenhorst, Germany; and received infrastructural support from the University of Bremen, Germany.

## Notes

- We leave out brackets as possible applying the following precedence: ∼,⊓,⊔,⊑,:,¬,∧,∨,→,↔. The scope of quantifiers is to be read as maximal.
- The interested reader may find a brief discussion on mereological and ontological properties in Section 4.5.
- To understand the meaning of a⇒b, we can translateτCLPL⊤⊑∼a⊔bx≡∀m′,Pm′m:∃m″,Pm″m′:¬∃m‴Pm‴m″:Pm‴a∨Pm″b≡∀m′,Pm′m:¬∀m″Pm″m′:∃m‴Pm‴m″:Pm‴a∨∃m″,Pm″m′:Pm″b≡∀m′,Pm′m:∀m″Pm″m′:∃m‴Pm‴m″:Pm‴a→∃m″,Pm″m′:Pm″b≡∀m′,Pm′m:Pm′a→∃m″,Pm″m′:Pm″b≡∀m′,Pm′m:Pm′a→Pm′b,