Chapter 2 Logics and Logic Functors
If an Application Designer has to define a customized logic by the
means of composing primitive components, these components should be of
a “highlevel”, so that the resulting logic subsystem can be
proven to be correct. Indeed, if the primitive components are too
lowlevel, proving the correctness of the result is similar to proving
the correctness of a program. Thus, we decided to define logical
components that are very close to be logics themselves.
So doing, we
abandon computational expressivity, but we will see that proving
correctness is no more than typechecking.
Our idea is to consider that a logic interprets its formulas as
functions of their atoms. By abstracting atomic formulas from the
language of a logic we obtain what we call a logic functor. A
logic functor can be applied to a logic to generate a new logic. For
instance, if propositional logic is abstracted over its atomic
formulas, we obtain a logic functor called Prop, which we
can apply to, say, a logic on integer intervals,
Interval(Int), to form propositional logic on
intervals, Prop(Interval(Int)).
In Section 2.1 we first define the syntax and the semantics
of a logic, which is a classical way of specifying a logic. The
(abstract) syntax tells what kind of formulas can be expressed and
manipulated, and the semantics tells what meaning can be given to
these formulas. Then in Section 2.2 we introduce a set of
operations that apply on formulas. These operations are defined as
functions working only at the syntactical level, which makes them
directly implementable, and constitute the executable version of the
logic. In order for these operations to make sense w.r.t. the
semantics, properties relating the behaviour of operations with
semantics are associated to these operations. The statement of
properties on logics requires proofs, combinations of properties
play the role of types, and theorems on properties play the role
typechecking rules. Finally, in Section 2.3.1, logics are
defined as the combination of syntax, semantics, and operations; and
logic functors are defined as functions from logics to logics.
2.1 Syntax and Semantics
Syntax is often defined from a signature of atoms and connectors.
However, in order to allow for concrete domains and concrete
structures, we choose to have a more general definition of syntax.
Here we do not bother about the concrete syntax as it is just a matter
of prettyprinting and parsing compared to the abstract syntax which
consider formulas as settheoretical structures (e.g., pairs, finite
sets, intervals).
Definition 1
An abstract syntax
AS is an enumerable set of structures, the element of which are called formulas
.
As our logics are mainly designed for information systems, it is useful to distinguish two subsets of syntax:

TELL ⊆ AS is the subset of formulas that can be used in object descriptions,
 ASK ⊆ AS is the subset of formulas that can be used in queries.
No constraint is put on these two subsets, except they should not be
empty: e.g., they can be disjoint or not, they can be equal to AS or not. Wen they are not defined explicitly, they are equal to
the full set of fomulas AS. The distinction between TELLformulas, and ASKformulas is important w.r.t. logic
properties, as shown in Section 2.2, because requirements
from information systems may not be the same on them.
Now, it is important to attach a semantics to a logic in order to give
a meaning to formulas and operations. Like in description logics,
formulas are not interpreted by truthvalues, but by sets of
interpretations (or individuals). Formulas are given a semantics by
linking them to interpretations. These interpretations can be
understood as possible objects, and reciprocally, formulas can be
understood as expressing a constraint/filter/pattern on possible
objects. Moreover, it is possible to define a partial ordering on
interpretations, which is useful for instance to define intervals in a
generic way.
Definition 2
Given a syntax AS,
a semantics
S based on AS is a pair (I,⊨,≤), where

I is a set of interpretations, the interpretation domain,
 ⊨ ⊆ I × AS is a satisfaction relation between interpretations and formulas,
 ≤ is a partial ordering on the set I.
i ⊨ f reads “i is a model
of f”.
For every formula f ∈ AS, M(f) = {i ∈ I ∣ i
⊨ f} denotes the set of all models of formula f. For every
formulas f, g ∈ AS, an entailment relation
is defined as “f entails g” iff M(f) ⊆ M(g).
The entailment relation is never used formally in this report, but we
believe it provides a good intuition for the frequent usage in proofs
of the inclusion of sets of models.
2.2 Operations and Properties
Operations define the interface through which a logic can be used by
programs. Properties are about the adequation of these operations
w.r.t. semantics.
The formulas define the language of the logic, the semantics defines
its interpretation, and an implementation defines how the logic
implements an interface that is common to all logics. This
common interface is made of a set of operations, which are defined
below. The most important operation is the subsumption. It
tests whether a formula is more specific than another. Because of the
similarities between our framework and description logics, we reuse
their names and notations for operations (e.g., ⊑ for
subsumption).
There is no constraint, except for their types, on what operations can
do. So, we define for each operation properties that relate the
semantics and the operations of a logic.
For each operation, we explain its purpose, its type, its default
definition, and we define a set of properties that apply to it.
Properties may receive several definitions corresponding to different
scopes: one point of the operation domain, the entire operation
domain, and intermediate domains based on TELL, and ASK. The properties of default definition are given beside them.
The purpose of the top is to return the most general formula of
the logic. It usually is a ASKformula, and not a TELLformula. It may be undefined. When defined, its expected
meaning is that it has every interpretation as a model.
 type:
 AS ∪ {undef}.
 defined:

def_{⊤}=_{def} ⊤ ≠ undef
 complete:

cp_{⊤}=_{def} def_{⊤}⇒ M(⊤) = I
 default:
 ⊤_{d} =_{def} undef
cp_{⊤d}
The purpose of the bottom is to return the least general formula
of the logic. It usually is neither a TELLformula, nor a
ASKformula. So, when defined, its role is mainly to make
possible the proof of some properties. Its expected meaning is that it
has no model.
 type:
 AS ∪ {undef}.
 defined:

def_{⊥}=_{def} ⊥ ≠ undef
 consistent:

cs_{⊥}=_{def} def_{⊥}⇒ M(⊥) = ∅
 default:
 ⊥_{d} =_{def} undef
cs_{⊥d}
2.2.3 Subsumption ⊑
The purpose of subsumption is to test whether a formula is more
specific than another. This is the most useful operation as it is used
in information systems to compute answers to a query q. An
object o is such an answer if its description d(o) is subsumed by
the query q (d(o) ⊑ q). Its expected meaning is to be
equivalent to the inclusion of sets of models.
 type:
 AS × AS → bool.
 consistent in (f:AS,g:AS):

cs_{⊑}(f,g) =_{def} f ⊑ g ⇒ M(f) ⊆ M(g)
cs_{⊑}=_{def} ∀ f,g ∈ AS: cs_{⊑}(f,g)
 complete in (f:AS,g:AS):

cp_{⊑}(f,g) =_{def} M(f) ⊆ M(g) ⇒ f ⊑ g
cp_{⊑}=_{def} ∀ f,g ∈ AS: cp_{⊑}(f,g)
cp'_{⊑}=_{def} ∀ d ∈ TELL, x ∈ ASK: cp_{⊑}(d,x)
 default:
 f ⊑_{d} g =_{def} false
cs_{⊑d}
In order to avoid false positives (an answer that should not be an
answer), information systems usually require consistency cs_{⊑}. To avoid false negatives (missed answers) it is
sufficient to have the partial completeness cp'_{⊑},
which is true is more logics than full completeness, and allows for
more efficient implementations. This is where the motivation for
distinguishing TELLformulas, and ASKformulas.
2.2.4 Conjunction ⊓
The purpose of conjunction is to sum up the information of 2
formulas in one, i.e. to return the most general formula that is
subsumed by the two argument formulas. It can be partially defined.
When the two argument formulas are incompatible, it should return the
contradiction, if defined. Its expected meaning is to be equivalent to
the intersection of sets of models.
 type:
 AS × AS → AS ∪ {undef}.
 defined in (f:AS,g:AS):

def_{⊓}(f,g) =_{def} f ⊓ g ≠ undef
def_{⊓}=_{def} ∀ f,g ∈ AS: def_{⊓}(f,g)
defst_{⊓}=_{def} ∀ f,g ∈ AS: M(f) ∩ M(g) ≠ ∅ ⇒ def_{⊓}(f,g)
 consistent in (f:AS,g:AS):

cs_{⊓}(f,g) =_{def} def_{⊓}(f,g) ⇒ M(f ⊓ g) ⊆ M(f) ∩ M(g)
cs_{⊓}=_{def} ∀ f,g ∈ AS: cs_{⊓}(f,g)
 complete in (f:AS,g:AS):

cp_{⊓}(f,g) =_{def} def_{⊓}(f,g) ⇒ M(f ⊓ g) ⊇ M(f) ∩ M(g)
cp_{⊓}=_{def} ∀ f,g ∈ AS: cp_{⊓}(f,g)
 default:
 f ⊓_{d} g =_{def} undef
cs_{⊓d} cp_{⊓d}
When the conjunction is totally undefined (default behaviour), it is
both consistent and complete. The need for making conjunction more
defined usually comes from property proofs, especially about
reducedness (Section 2.2.8). Defining conjunction can also be
useful for compacting queries or other combinations of formulas.
2.2.5 Disjunction ⊔
The purpose of disjunction is to generate the most general
formulas whose models are all models of either argument formulas. Its
expected meaning is to be equivalent to the union of models, as shown
by consistency and completeness properties.
 type:
 AS × AS → P(AS).
 consistent in (f:AS,g:AS):

cs_{⊔}(f,g) =_{def} ∪_{h ∈ f ⊔ g}M(h) ⊆ M(f) ∪ M(g)
cs_{⊔}=_{def} ∀ f,g ∈ AS: cs_{⊔}(f,g)
 complete in (f:AS,g:AS):

cp_{⊔}(f,g) =_{def} ∪_{h ∈ f ⊔ g}M(h) ⊇ M(f) ∪ M(g)
cp_{⊔}=_{def} ∀ f,g ∈ AS: cp_{⊔}(f,g)
 default:
 f ⊔_{d} g =_{def} {f, g}
cs_{⊔d} cp_{⊔d}
2.2.6 Lower ordering ≤
The purpose of lower ordering is to test whether a formula
starts before another formula, according to the partial ordering on
interpretations. The simplest example is probably intervals on
integers, where interpretations are integers, and the partial ordering
is the natural one. The interval [1,5] starts before the
interval [3,4] because the lowest model of the latter is smaller
than the lowest model of the former.
 type:
 AS × AS → bool.
 consistent in (f:AS,g:AS):

cs_{≤}(f,g) =_{def} f ≤ g ⇒ ∀ j ∈ M(g): ∃ i ∈ M(f): i ≤ j
cs_{≤}=_{def} ∀ f,g ∈ AS: cs_{≤}(f,g)
 complete in (f:AS,g:AS):

cp_{≤}(f,g) =_{def} (∀ j ∈ M(g): ∃ i ∈ M(f): i ≤ j) ⇒ f ≤ g
cp_{≤}=_{def} ∀ f,g ∈ AS: cp_{≤}(f,g)
 default:
 f ≤_{d} g =_{def} false
cs_{≤d}
2.2.7 Upper ordering ⋜
The purpose of the upper ordering is to test whether a formula
ends before another formula, according to the partial ordering on
interpretations. In the above example, the interval [3,4] ends
before the interval [1,5].
 type:
 AS × AS → bool.
 ⋜ is consistent in (f:AS,g:AS):

cs_{⋜}(f,g) =_{def} f ⋜ g ⇒ ∀ i ∈ M(f): ∃ j ∈ M(g): i ≤ j
cs_{⋜}=_{def} ∀ f,g ∈ AS: cs_{⋜}(f,g)
 ⋜ is complete in (f:AS,g:AS):

cp_{⋜}(f,g) =_{def} (∀ i ∈ M(f): ∃ j ∈ M(g): i ≤ j) ⇒ f ⋜ g
cp_{⋜}=_{def} ∀ f,g ∈ AS: cp_{⋜}(f,g)
 default:
 f ⋜_{d} g =_{def} false
cs_{⋜d}
2.2.8 Syntax vs. Semantics
Some properties are not related to one operation, but to the syntax or
to the set of all operations. Before defining a list of such
properties, we first need to extend the definitions of syntax and
subsumption to sets of formulas.
Definition 3
Given P(X) denotes the powerset of X:

AS^{*} =_{def} P(AS),
 ASK^{*} =_{def} P(ASK),
 TELL^{*} =_{def} {F ∈ P({⊥} ∪ TELL ∪ ASK) ∣ F ∩ {⊥} ∪ TELL ≠ ∅},
 F ⊑^{*} G =_{def} ∨{
∃ f ∈ F, g ∈ G: f ⊑ g 
∃ f ∈ F: f ⊑ ⊥ 
∃ g ∈ G: ⊤ ⊑ g 
.
 closed_{⊓}(F) =_{def} ∀ f ≠ f' ∈ F: f ⊓ f' = undef,
 closed_{⊔}(G) =_{def} ∀ g ≠ g' ∈ G: g ⊔ g' ⊆ G.
 all descriptors are features:

df =_{def} TELL ⊆ ASK
 satisfiable in f:AS:
 f has a model.
st(f) =_{def} M(f) ≠ ∅
st =_{def} ∀ f ∈ AS: st(f)
st' =_{def} ∀ d ∈ TELL: st(d)
 singleton in f:AS:
 f has one and only one model.
sg(f) =_{def} M(f) = 1
sg =_{def} ∀ f ∈ AS: sg(f)
sg' =_{def} ∀ d ∈ ASK: sg(d)
 reduced in (F:AS^{*}, G:AS^{*}):

reduced(F,G) =_{def} closed_{⊓}(F) closed_{⊔}(G) ⇒
(∩_{f ∈ F}M(f) ⊆ ∪_{g ∈ G}M(g) ⇒ F ⊑^{*} G)
reduced =_{def} ∀ F,G ∈ AS^{*}: reduced(F,G)
reduced' =_{def} ∀ F ∈ TELL^{*}, G ∈ ASK^{*}: reduced(F,G)
reduced.left =_{def} ∀ F ∈ AS^{*}, g ∈ AS: reduced(F,{g})
reduced.right =_{def} ∀ f ∈ AS, G ∈ AS^{*}: reduced({f},G)
reduced.top =_{def} ∀ g ∈ AS: reduced(∅,{g})
reduced.bot =_{def} ∀ f ∈ AS: reduced({f},∅)
reduced.bot' =_{def} ∀ d ∈ TELL: reduced({d},∅)
Note that reduced.left entails reduced.top, and that
reduced.right entails reduced.bot, which entails reduced.bot'. Note also that reduced(∅,∅)
is always true (provided the interpretation domain is not empty).
Properties are rather technical, because they have been introduced
progressively in order to prove some properties on logics and logic
functors. This assumes we have a starting point, i.e. some initial
properties we are interested in. Indeed, in the context of information
systems, we need to answer queries. In Section 2.2.3 we
already show that consistency cs_{⊑} and partial
completeness cp'_{⊑} are required on subsumption in
order to answer queries correctly.
As our logics are built by composing sublogics by logic functors, it
is important to understand that the properties required on each
sublogics will not be the same, and will depend on each logic
functor. For instance, a logic functor may enforce a property even if
it is not satisfied by sublogics. The other way round, some
properties may be required on sublogics, even if it is not so in the
built logic. This explains why we introduce much more properties than
needed on the logics used in information systems.
Operations ⊓, ⊔, ⊤, ⊥ are all defined on the
syntax of some logic, but they are not necessarily connectives of the
logic, simply because the connectives of a logic are part of the
syntax, and may be different from these operations. Similarly, the
syntax and the semantics may define negation or quantifiers, though
they are absent from the set of operations.
Note that some operations (conjunction, tautology, and contradiction)
can be only partially defined (by using undef) if it is
convenient, and that their properties apply only on the domain where
they are defined. So it is easy to make them satisfy these properties,
like consistency and completeness, by keeping them undefined.
Reducedness counterbalances this triviality by requiring these
operations to be defined enough. And this property is required
in some logic functors in order to achieve subsumption completeness,
which is crucial as said above.
2.3 Logics and Logic Functors
In this section we formally define the class of logics, and then the
class of logic functors, which are functions from logics to logics.
A logic is the association of an abstract syntax, a semantics,
an implementation, and a type made of a set of properties. The class
of all logics is denoted by L.
Definition 4
A logic L is a tuple (AS_{L},S_{L},P_{L},T_{L}), where AS_{L} is (the
abstract syntax of) a set of formulas, S_{L} is a semantics based on
AS_{L}, P_{L} is an implementation, i.e. a set of operations, based
on AS_{L}, and T_{L} is the type
of the logic, i.e., a set of
properties that are satisfied by operations w.r.t. semantics.
When necessary, the satisfaction relation ⊨ of a logic L
will be written ⊨_{L}, the interpretation domain I will be
written I_{L}, the models M(f) will be written M_{L}(f), and each
operation op will be written op_{L}.
2.3.2 Logic functors
We have just defined logics. Logic functors take logics as
parameters and return a logic. Logic functors also have a syntax, a
semantics, a set of operations, and a type, but they are all
abstracted over one or more logics that are considered as formal
parameters. For instance, the logic functor Prop(X) is the
propositional logic, whose atoms have been abstracted by the formal
parameter X, and can thus be replaced by more complex formulas. Then
the classic propositional logic is reconstructed by applying the
Composer to the expression Prop(Atom); and the composed
logic Prop(Interval(Int)) replaces the classic
atoms by intervals on integers. This process is very similar to the
composition of mathematic expressions from operations
(e.g., +,−,×), or complex programming types from basic types
(e.g., int, bool) and type constructors (e.g., array, list). It is also possible to define a new logic
functor as a parameterized composition of existing functors. We call
such a functor a combinator: e.g., λ X.Prop(Interval(X)).
We formally define the class of logic functors. Given L
the class of logics, the class of logic functors F includes
all functions from tuples of logics to logics. The special case of
logic functors with arity 0 corresponds to the class of
logics L. The notation F/n is used to say that F is a
logic functor with arity n, i.e., expecting n logics in order to
produce a logic.
Let AS be the class of all syntaxes, S be the
class of all semantics, P be the class of all sets of
operations, and T the class of all logic types. The syntax
of a logic functor is simply a function from the syntaxes of the logic
functors which are its arguments, to the syntax of the resulting
logic.
Definition 5
A logic functor
F is a tuple (AS_{F},S_{F},P_{F},T_{F}) where

the abstract syntax AS_{F} is a function of type AS^{n}
→ AS, such that AS_{F(L1,…,Ln)} = AS_{F}(AS_{L1},…,AS_{Ln});

the semantics S_{F} is a function of type S^{n}
→ S, such that S_{F(L1,…,Ln)} = S_{F}(S_{L1},…,S_{Ln});

the implementation P_{F} is a function of type P^{n}
→ P, such that P_{F(L1,…,Ln)} = P_{F}(P_{L1},…,P_{Ln});

the type T_{F} is a function of type T^{n}
→ T, such that T_{F(L1,…,Ln)} = T_{F}(T_{L1},…,T_{Ln}).
In order to illustrate this abstract notion of logic functor, and
prepare examples given in next sections, we shortly describe a few
logic functors (the detailed description of our logic functors are
available in the appendices). We classify them according to their
role in the composition of logics:

Initiators
 are 0ary functors representing various concrete domains

Unit/0: the logic having a single formula, and a single interpretation,
 Atom/0: the classical atoms,
 Int/0: integers,
 Card/0: the decreasing chain of naturals for expressing “at least n” patterns,
 String/0: strings and substring patterns (contains, starts with, ...),
 Constructors
 define the structure of formulas and interpretations

Sum/2: the disjoint union of 2 logics (both syntax and interpretation domain),
 Prod/2: the product of 2 logics (both syntax and interpretation domain),
 Multiset/1: multisets over formulas of the sublogic,
 Abstractors
 extend the abstract syntax without changing the interpretation domain

Top/1: adds a (complete) top to the sublogic,
 Interval/1: intervals over values taken as the formulas of the sublogic,
 Prop/1: closure of the syntax by the 3 boolean connectors (and, or, not), the combinations of these connectors in TELLformulas is constrained,
 Adaptors
 help to ensure some properties are satisfied

Set/1: applies the powerset to the interpretation domain; it reduces the need for the property reduced to the weaker property reduced.right,
 Bottom/1: adds a bottom to the logic, and extends the definition of its conjunction; it replaces the need for the property reduced' by the property sg',
 Single/1: applies on formulas the epistemic modalities
of the logic AIK [Lev90]; it enforces the property sg' (TELLformulas have a single model), and helps to
introduce the Closed World Assumption (see Section 4.2.3).
Given some logics L_{1},...,L_{n}, the type of the composed logic L =
F(L_{1},...,L_{n}) is computed by T_{F} from T_{L1},...,T_{Ln}
(Definition 5). Concretely T_{F} is a set of theorems
relating the properties of the logics L_{1},...,L_{n} to the properties
of the logic L. These theorems have all the form
property of L ⇐ conjunction of properties of L_{1},...,L_{n}.
Similarly, properties on logics are considered as type assignments,
L_{i} : properties, so that proving that L has some
property is simply to typecheck it. This typechecking problem can be
represented by a set of (possibly recursive) equations on types, which
is solved by classical techniques of fixpoint iteration on finite
domains [DP90]. The typechecking is performed
automatically by the Composer. The possible recursivity comes from the
fact that a logic can be defined in a recursive way, as illustrated in
the next Section. More details on this typeckecking are given in
Section 2.4.
2.4 Type Checking
If a logic can be defined in a nonrecursive way, then it can be seen
as a tree. Its nodes and leaves are logic functors, and the arity of
each node is the arity of the logic functor. Each subtree corresponds
to a sublogic. The type of the built logic can then easily be
synthesized starting from the type of the leaves, which are both logic
functors and logics, and going upward, each functor computing the type
of the sublogic it defines from the type of its argument logics. This
means that every logic functor F is equiped with a function mapping
the types of its arguments to the type of the built sublogic. This
function is the concretization or implementation of the type T_{F} of
the logic functor. We will abuse notation by using T_{F} both as the
type and the function. In the case a logic functor expects no
argument, this function reduces to a constant type.
The difficulty comes with recursive definitions as in such a case we
obtain a rooted graph instead of a tree, where the root is the
leftmost logic functor in the definition. This root is the only entry
point of the graph.
Each functor F_{i} used in the definition of a logic defines a
sublogic L_{i} according to the equation
L_{i} = F_{i}(L_{i1},...,L_{in}).
According to Definition 5, this entails an equation on
the type of sublogics:
T_{Li} = T_{Fi}(T_{Li1},...,T_{Lin}).
The types of all sublogics can be gathered in a type T =
(T_{Li})_{i ∈ I}, which is a function from sublogic indices to logic
types (I → T). Then type functions T_{Fi} can
be adapted to apply on the global type T, and gathered in a global
type function T_{F}, such that
T_{F}(T)(i) = T_{Fi}(T_{i1},...,T_{in}),
where n is the arity of F_{i}, and i_{1}, ..., i_{n} are the indices
of the sublogics that are the arguments of the functor F_{i}.
The function T_{F} is a map on the domain defined by the type (I
→ T), which can be ordered in the following way.
Definition 6
Let S,T ∈ (I → T) be global types. We say S
contains T, and we note S ⊑_{T} T, iff for all i ∈ I, we
have S(i) ⊇ T(i). The maximal global type according to
this order is the function that maps every index i to the full set
of logic properties, which is denoted by ⊥_{T}.
Now, as every property on every sublogic is equated to a conjunction
of properties on other sublogics, it follows that the function T_{F}
is orderpreserving w.r.t. the ordering ⊑_{T}. Indeed,
suppose S ⊑_{T} T. This means every property present in T
is also present in S. So, if a property p is present in T_{F}(T),
then this implies all properties p depends on are in T, and so are
also in S. Hence, the property p is also in T_{F}(S). Hence
T_{F}(S) ⊑_{T} T_{F}(T). With the fact that the domain of global
types is finite, we can conclude that the fixpoint of T_{F} is
defined, and can easily be computed by applying iteratively T_{F} on
the maximal global type ⊥_{T} until reaching the
fixpoint μ(T_{F}) [DP90]. The type of the built logic
is then defined by μ(T_{F})(0), where 0 is the index of the root
functor.