1 Introduction
In this paper, we present a novel approach meant to take into account the needs of many current applications, specifically in the domain of data integration. Our purpose is to extend the concept of deductive databases CeriGT90 ; Ullman to the context of Fourvalued logic Belnap , a formalism known to be suitable for data integration, as it allows to deal with unknown, inconsistent, true or false information. We begin by illustrating our approach through an example used as our running example throughout the paper.
Running Example. Our example concerns the storage of bags of rice grains, considering two important factors that (among others) influence the design and development of optimum storage, namely color and humidity of the rice grains Batay .
We assume that each bag is tested for the color and humidity of its rice grains in two different sites, first just before leaving the rice farm and then just before entering the warehouse. The outcomes of these tests can be: humid or not humid (with respect to a humidity threshold); and white or not white (with respect to a color threshold). Based on these outputs, the following actions are taken:

If the grains are not humid and white then store the bags in the warehouse.

If the grains are humid then do not store the bags but cure the grains.

If the grains are not white then do not store the bags but analyze further.
We assume that the tests are conducted by sensors: two sensors at the rice farm, one for humidity, denoted , and one for color denoted ; and two sensors at the warehouse denoted and . We also assume that, during a test, if the sensor is functioning then it returns a Boolean value (true or false), otherwise it returns no value. Under these assumptions, one of the following cases can appear for the sensors testing humidity (and similarly for the sensors testing color):

The two sensors return the same value.

The two sensors return different values.

Only one of the two sensors returns a value.

Neither of the two sensors returns a value.
In this setting, let , denote the humidity state or ‘value’ of a bag with identifier . Then the question is: what value should we assign to in each of the four cases above? In our formalism, we answer this question by ‘integrating’ the outputs of and as follows (and similarly for the outputs of and ):

is set to the common value returned by the sensors.

is set to inconsistent, to mean that the sensors returned different values.

is set to the value returned by the sensor which returned a value.

is set to unknown, to mean that neither of the two sensors returned a value.
As our example shows, we clearly need more than the standard truth values True and False, to express the cases 2 and 4 above. It will be seen that the Fourvalued logic introduced in Belnap provides the right formalism as it provides the additional truth values needed and also appropriate connectors to work with these additional truth values. For instance, using a connector denoted by we can express all four cases above in a single expression: .
The database is a pair where collects the sensor outputs and where is a set of rules describing how to integrate these outputs and how to treat the bags based on the integrated values. Formally, the elements of are pairs of the form to represent the output of one sensor about a bag recognized by its identifier. In such pair is a fact regarding the humidity or the color of a bag and is its associated truth value. The rules expressing the integration of the sensor outputs and the conditions regarding the storage of the bags are as follows:
Although the rules above roughly look like standard Datalog rules with negation, the following basic differences have to be noticed:

The body of a rule is not restricted to be a conjunction of literals; in fact we allow all available connectors to occur in the body of a rule.

The head of a rule is not restricted to be an atom: negative literals are allowed, at the cost of generating contradictory facts.

Contradictions are allowed in database semantics and treated as such, in the context of the Fourvalued semantics introduced in Belnap .
To illustrate how our approach deals with such rules, we first give a rough overview of the basic notions used in our approach. First, in Fourvalued logic, four truth values are considered, namely t, b, n and f, standing respectively for true, inconsistent, unknown^{1}^{1}1The intuition explaining the notation b and n will be clarified later in this paper. and false.
In this context the pieces of information to be stored in the database extension are pairs of the form where is a fact (i.e. an atom with no variable) and is one of the four truth values just mentioned. By such a pair, which we call valuated pair or vpair for short, we mean that ‘ has truth value ’. Moreover, we make the intuitively appealing convention that unknown facts are not stored, meaning that the database extension can not contain a vpair of the form . We emphasize that, contrary to most database approaches in which only true pieces of information are stored, our approach allows to store true, false or even inconsistent pieces of information.
Continuing with our example, assume there are three rice bags with identifiers , and for which the following sensor outputs and corresponding vpairs are stored in the database:
 •

Regarding bag : and both return False; this results in storing the two vpairs and in the database extension. returns True but returns no value; this results in storing the pair in the database extension.
 •

Regarding bag : returns True and returns no value; this results in storing the vpair in the database extension. returns False while returns true; this results in storing the two pairs and in the database extension.
 •

Regarding bag : and both return no value, returns False and returns no value; this results in storing the pair in the database extension.
Roughly speaking, given a set of vpairs, applying a rule is achieved as follows: for every instantiation of denoted , the truth value of the body of is computed against , and if this truth value is t or b then this truth value is assigned to the head of the . Moreover, as more than one rule head may involve the same fact, in case of conflicting assignment, we apply the integration statements as done for the sensors. We illustrate this processing below.

At the first step, the only rules that apply are and .

Based on the vpairs and , generates the vpair stating that the grains in bag are not humid.
As for identifier , since the output of is missing, we consider the (nonstored) vpair , which combined by with the stored vpair generates stating that the grains in bag are humid.
As for identifier , since both and no value, generates no vpair involving , meaning that the humidity of the grains in the bag is unknown. 
As for , since returns no value, generates the vpair stating that the grains in bag are white.
As for , we notice that and disagree. In this case, generates the vpair , meaning that the fact is inconsistent, thus that the color of the grains in bag cannot be decided.
As for , since returns no value, generates the vpair , meaning that the grains in bag cannot be considered white.


The next step is based on the vpairs earlier generated, namely: , , , and . The rules apply as follows:

Based on and , generates the vpair . Considering and , since the conjunction of the body is false, does not apply. Since is unknown and is false, the conjunction of the body is false, entailing that does not apply.

Since is not true, does not apply. Since is true, generates . Since is unknown, does not apply.

As above, since is not true, does not apply, but generates because is true.

Similarly, since is not false, and do not apply. Since is inconsistent, and generate respectively and . Moreover, since is false, and generate respectively and .
After applying the rules, conflicting vpairs involving appear, because has been found false by and inconsistent by . In this case, we integrate these different truth values in much the same way as we did for the sensor outputs, stating that should be inconsistent. Therefore, the vpair is removed from the result of this step.


As no further vpair can be generated by the rules based on the vpairs generated in the previous steps, the processing stops and returns the set of all these vpairs, which added to the database extension constitutes what we call the database semantics.
The obtained database semantics is therefore the set of the following vpairs:
, , ,
, , , ,
, ,
, , ,
, , ,
, , .
It is shown in this paper that the computation just described in an informal way is sound and its relationship with other related approaches is investigated. Moreover, some basic properties of the underlying Fourvalued logic are stated, and among them this example raises the following question: could the rules and be replaced by the single rule ? Whereas this question is answered positively in standard approaches to Datalog databases (CeriGT90 ; Ullman ) and in the Fourvalued approach of Fitting91 , we argue that this replacement raises some issues.
This work is an extension of that in Lau2019 where rule bodies are restricted to be conjunctions. The main contributions of this paper are as follows:

We show that FDE (First Degree Entailment) implication, one of the standard implications in Fourvalued logic, can be expressed in terms of the usual connectors.

We exhibit a functionally complete set of basic connectors not involving FDE implication, contrary to the results in Arieli1998 .

We generalize the rules by allowing negative literals in their heads and connectors other than negation, conjunction and disjunction in their bodies.

We define a new immediate consequence operator for handling such rules, and we show that this operator is monotonic and continuous, thus providing an effective way for defining and computing database semantics.

We argue that our context allows for the definition of a new type of updates that can be used in data integration applications. Notice that to the best of our knowledge, the problem of database updating in a Fourvalued logic framework has never been addressed in the literature.
The paper is organized as follows: In Section 2 we review the formalism related to Fourvalued logic and we address the first two issues mentioned above. Section 3 is devoted to the definitions of the syntax and the semantics of databases in the context of Fourvalued logic. In Section 4, we define two types of updates, one standard and another one related to data integration. Then, in Section 5 we review some of the approaches related to our work that can be found in the literature. Section 6 provides an overview of our approach and suggests research issues that we are currently investigating or that we intend to investigate in the next future.
2 Background: FourValued Logic
2.1 Basics of FourValued Logic
Fourvalued logic was introduced by Belnap in Belnap , who argued that this formalism could be of interest when integrating data from various data sources. To this end, denoting by t, b, n and f the four truth values, the usual connectives , and have been defined as shown in Figure 1. An important feature of this Fourvalued logic is that it allows to compare truth values according to two partial orderings, known as truth ordering and knowledge ordering, respectively denoted by and and defined by:
; and ; .
To explain the choice of b and n as notation for inconsistent and unknown, let be the set of the usual truth values. The four truth values in Fourvalued logic can then be thought of as corresponding to the elements in the power set of , by associating respectively , , , with , , , . Then the notation and can be read respectively as none and both. Notice also that, under this association, the ordering , the connectors and are respectively nothing but the restriction to the power set of of set theoretic inclusion, union and intersection.
As in standard twovalued logic, conjunction (respectively disjunction) corresponds to minimum (respectively maximum) truth value, when considering the truth ordering. It has also been shown in Belnap ; Fitting91 that the set equipped with these two orderings has a distributive bilattice structure, where the minimum and maximum with respect to are denoted by and , respectively.
Not surprisingly, it should be emphasized that in this Fourvalued logic some basic properties holding in standard logic do not hold. For example, Figure 1 shows that formulas of the form are not always true, independently from the truth value of . More importantly, it has been argued in Arieli1998 ; Hazen17 ; Tsoukias that defining the implication by , is problematic.
To see this, we consider as in Belnap ; Arieli1998 ; Hazen17 ; Tsoukias , that t and b are the two designated truth values, because as mentioned above, these truth values are the only ones corresponding to sets containing True. As a consequence, a formula is said to be valid if its truth value is designated, i.e., either t or b.
As argued in Arieli1998 ; Hazen17 ; Tsoukias , does not satisfy the deduction theorem, because the formula defined by is not valid for every truth value assignment. Indeed based on Figure 2, for every assignment such that and , we have and thus, . As a consequence, we discard as the implication providing semantics to our rules.
Among the various implications introduced in the literature, First Degree Entailment implication, or FDE implication, denoted hereafter by (Arieli1998 ; Hazen17 ) is the most popular. We also mention another implication introduced in Tsoukias and denoted hereafter by . Each of these implications is associated with another implication, denoted by and whose role is explained next. The truth tables of all these implications are shown in Figure 2.
Recall from Arieli1998 (Corollary 9) that , is defined ‘from scratch’ in the sense that it cannot be expressed using the other standard connectives , and . As we shall see shortly we can provide an expression of involving standard connectors in the formalism of Tsoukias . It is also important to notice that as shown in Tsoukias , is defined by , where is a complement operator whose truth table is shown in Figure 1.
Moreover, since and are not equivalent, the implication is introduced in Arieli1998 ; Hazen17 as a shorthand for . As a similar situation holds regarding , is defined in Tsoukias as .
In an attempt to compare these implications, we notice that, contrary to , the formula defined by is valid when replacing with one of the implications , , or . It is also interesting to see that when merging the truth values t and b (respectively f and n) into a single value, say TRUE (respectively FALSE), the corresponding truth tables of and are that of the standard implication, while this is not the case for , and . This explains why we discard these three implications. However, the choice between and is not easy for the following reasons:

In Arieli1998 ; Hazen17 , it is argued that, similarly to twovalued implication, satisfies the property that whenever is designated. However, does not satisfy the properties of given below.

Although does not satisfy the above property, it is argued in Tsoukias that, similarly to twovalued implication, satisfies the property that if and only if .
We draw attention on that none of these two implications satisfies all intuitively appealing properties that standard twovalued implication satisfies, among which contraposition is an example.
t  b 
b  t 
n  f 
f  n 
t  f 
b  n 
n  b 
f  t 
t  b  n  f  

t  t  t  t  t 
b  t  b  t  b 
n  t  t  n  n 
f  t  b  n  f 
t  b  n  f  

t  t  b  n  f 
b  b  b  f  f 
n  n  f  n  f 
f  f  f  f  f 
t  b  n  f  

t  t  b  t  b 
b  b  b  b  b 
n  t  b  n  f 
f  b  b  f  f 
t  b  n  f  

t  t  t  n  n 
b  t  b  n  f 
n  n  n  n  n 
f  n  f  n  f 
t  b  n  f  

t  t  b  n  f 
b  t  b  t  b 
n  t  t  n  n 
f  t  t  t  t 
t  b  n  f  

t  t  b  n  f 
b  t  b  n  f 
n  t  t  t  t 
f  t  t  t  t 
t  b  n  f  

t  t  b  n  f 
b  t  t  n  n 
n  t  b  t  b 
f  t  t  t  t 
t  b  n  f  

t  t  f  n  f 
b  t  b  n  f 
n  t  n  t  n 
f  t  t  t  t 
t  b  n  f  

t  t  f  f  f 
b  t  t  f  f 
n  t  f  t  f 
f  t  t  t  t 
Looking at the truth tables of the two implications and , when the left hand side is valid in , it is necessary that the right hand side be also valid in order to make the implication valid. More precisely, if is valid, the implications and are valid in for any truth assignment such that:
and or ,
and or .
As a consequence, if it happens that is valid while is not, the implication can be made valid by changing the truth value of in two ways: making it either true or inconsistent. As will be seen later, we choose to set as equal to . This choice is motivated by the fact that it is the only one satisfying and .
t  t 
b  f 
n  f 
f  f 
t  f 
b  t 
n  f 
f  f 
t  f 
b  f 
n  t 
f  f 
t  f 
b  f 
n  f 
f  t 
t  f 
b  f 
n  t 
f  t 
To see how to express FDE implication in terms of the basic connectors , , , , and of Tsoukias , we recall that is defined for every formula by:
.
Moreover, the additional connectors , , and , whose truth tables are shown in Figure 3, allow to ‘characterize’ each truth value in terms of only the standard ones, namely and . Roughly speaking, given a truth value , the corresponding connector which we denote by , is defined for every formula by the fact that is true if has the truth value and false otherwise.
In what follows, equivalent formulas and are defined as formulas having the same truth tables, which is denoted by . Using this notation, it is shown in Tsoukias that for each of these connectors, the following equivalences hold:
; ; ; .
We now consider an additional connector denoted by , and defined as follows:
.
This new connector ‘characterizes’ the non validity of a formula in terms of the truth values and . In other words, as shown in Figure 3, is true if is not valid and false otherwise.
An important point is that this new connector allows for an intuitively appealing expression of the FDE implication (Arieli1998 ; Hazen17 ) . It is indeed easy to show based on the truth tables of Figure 2 and Figure 3, that for all formulas and , the following equivalence holds:
.
Since can be read as true if is not valid and false otherwise, the equivalence above suggests that can be read as either is not valid or is valid. We emphasize that this is pretty much like implication in standard FOL that is read as either not is true or is true.
Based on these remarks and on truth tables in Figures 1–3, the following proposition holds. The first item in this proposition is the subject of some comments in the next section.
Proposition 1
Given formulas , and , the following equivalences hold:
.
2.2 About Functional Completeness
Functional completeness in our context can be stated as follows: Given a function from to where is a positive integer, can be ‘expressed’ as a formula involving propositional variables ? More formally, given , the problem is to prove that there exists a formula such that for in , if is a valuation such that for , , then .
This question has been answered positively in Arieli1998 where the proposed formula involves the connectors , and and the constants and . The authors give also some other variants of this result by proposing various sets of connectors, all of which containing the implication .
Given that can be expressed as , functional completeness can also be shown based on the connectors introduced in Tsoukias , that is , , , , and , but not . We prove this result in two ways: one based on Arieli1998 , and one more direct, using the connectors defined in Tsoukias .
Proof based on Arieli1998 . In Arieli1998 , it is shown that the language is functionally complete, meaning that for every and every function from to there exists a formula in involving propositional variables such that, for in , if is a valuation such that for , , then
Thus, given from to , by replacing in every occurrence of by we obtain a formula that, using the definitions of and of the connectors N and F, can be expressed by using the basic connectors and the four truth values.
Direct proof based on Tsoukias . Based on the connectors , , and introduced in Tsoukias , every in is associated with a formula defined as follows:
where, for , if , if , if and if .
It is thus easy to see that if for , and otherwise.
Now, given a function from to , we consider the partition induced by on , defined by . For every truth value in , the corresponding element of this partition, which is a subset of , is associated with a formula defined by:
.
It can be seen that for every in , if is in , and otherwise. The targetted formula is defined by:
.
The proof that is indeed the expected formula is done by successively considering the four possible truth values. For , consider the following cases:

In this case, we have that . On the other hand, if is such that for , , , , and , evaluates as . Thus, .

In this case, we have that . On the other hand, if is such that for , , , , and , evaluates as . Thus, .

In this case, we have that . On the other hand, if is such that for , , , , and , evaluates as . Thus, .

In this case, we have that . On the other hand, if is such that for , , , , and , evaluates as . Thus, .
As a consequence, we obtain that thus that the formula has the same truth values as the truth values defined by the function .
3 FourValued Logic and Databases
3.1 Database Syntax
As usual when dealing with deductive databases, the considered alphabet is made of constants, variables and predicate symbols with a fixed arity. We thus assume a fixed set of contants, called universe and denoted by . It should be noticed that may be infinite.
As in traditional approaches, a term is either a constant from or a variable, an atomic formula or an atom is a formula of the form where is a ary predicate and for every , is a term. A formula is said to be ground if it contains no variables. A fact is a ground atom, that is an atom in which all terms are constants. Moreover, a literal is either an atom or the negation of an atom. In the former case the literal is said to be positive and in the latter case it is said to be negative. The Herbrand Base associated with is the set of all facts that can be built up using the constants in and the predicates. Clearly, if is infinite, then so is .
In the traditional twovalued setting under the CWA (Closed World Assumption Reiter77 ), the database extension and the database semantics are sets of facts, meant to be true, and the facts not in the database semantics are set to be false. In our context of Fourvalued logic under the OWA (Open World Assumption), the database extension and the database semantics may contain facts that are either true, inconsistent or false, assuming that non stored facts are unknown. To account for this situation, we consider sets of pairs of the form where is a fact in and where v is one of the values t, b or f, while facts whose truth value is n are not stored. Moreover, such a set is said to be consistent if for all distinct pairs and in , . Consequently a consistent set is seen as a valuation defined for every in by:
, if contains a pair ; , otherwise.
Consistent sets of pairs are called vsets, standing for valuated sets.
Given a vset and a ground formula , is said to be valid in if is designated. For example, is valid in , because , but is not valid in because .
The two orderings and are extended to vsets over the same base in a pointwise manner as follows.
Definition 1
For all vsets and over , , respectively , holds if for every in , , respectively , holds.
For example for , and , we have . Thus:

, and , implying that holds.

, and , implying that holds.

, because for every , , the least value with respect to .

and are not comparable with respect to , because and are not comparable with respect to .
The extension of generalizes set inclusion in the sense that if , then we have . Notice that, as the last item above shows, the truth ordering does not satisfy this property, because holds while does not.
In our context, as in approaches to Datalog databases (CeriGT90 ; Bidoit91 ), a database consists of an extension and a set of rules, formally defined as follows.
Definition 2
A database is a pair where and are respectively called the extension and the rule set of . If , then:

is a vset.

is a set of rules of the form where the variables in are free in and and the variables in are free in , and

is a well formed formula involving the connectors , , , and . is called the body of , denoted by .

is a positive or negative literal, called the head of , denoted by .

It should be clear that the rules as defined above generalize standard Datalog rules (Bidoit91 ). On the other hand, the definition above also generalizes rules as defined in Lau2019 where the bodies of the rules are restricted to be conjunctions only. Moreover, in our approach and contrary to Fitting91 ; Bidoit91 , rules may generate contradictory facts. It is important to notice that our approach is closely related to the generalized rules as introduced in Fitting91 , with the following notable differences:

In our approach, negative literals are allowed in the rule heads, which is not the case in Fitting91 .

In our approach, several rules may have the same predicate involved in their head, which is not the case in Fitting91 . This important point will be discussed later.

In our approach, quantifiers are not allowed, whereas in Fitting91 four quantifiers are allowed ( and associated with and and associated with ).
3.2 Database Semantics
As usual, rules are seen as implications, either or that must be valid in the database semantics. Notice in this respect that Figure 2 shows that for all formulas and , is valid if and only if so is . This explains why in Lau2019 , our approach has been shown to be ‘compatible’ with either implication. Here, we focus on FDE implication , thus forgetting the implication of Tsoukias .
Similarly to the standard Datalog approach, a model of a database could be defined as a vset containing and in which all rules in are valid. However, such a definition would raise important problems:

A database might have no model. To see this, consider where and where , . Then in any model , because must contain the two pairs of . Notice that this cannot happen in standard Datalog since the storage of false facts is not allowed.

A database might have more than one minimal model, with respect to set inclusion. This case is illustrated above where , are , two minimal vsets containing in which is valid. This situation does not happen in standard Datalog because the minimal model is known to be unique.
Whereas the second issue raised above will be further investigated later, the first issue is solved in our approach by giving the priority to the database extension over the rules. To do so, we prevent from applying a rule in when it leads to some conflict with a vpair in .
In order to implement this policy, given a database over universe , we denote by the set of all instantiations of rules in such that does not occur in . Moreover, given a rule we denote by the formula . The definition of a model of then follows.
Definition 3
Let be a database. A vset is a model of if the following holds:
, i.e., must contain the database extension, and
every of is valid in , that is, is designated.
To illustrate Definition 3, consider the following simple examples:

with , and . is a model of as . It is easy to see that is the only minimal model with respect to set inclusion.

with and , and , are two models of . Moreover, it can be seen that these two models are minimal with respect to set inclusion.
Given a database , an immediate consequence operator is defined below. It will then be seen that this allows for computing a particular model of , which we call the semantics of .
Definition 4
Let be a database. The semantic immediate consequence operator associated with , denoted by , is defined for every vset by the following steps:
Define first as follows:
Comments
There are no comments yet.