Descriptive complexity for minimal time of cellular automata
Étienne Grandjean
Normandie Univ, UNICAEN, ENSICAEN, CNRS,
GREYC, 14000 CAEN, France
Email: [email protected]
Théo Grente
Normandie Univ, UNICAEN, ENSICAEN, CNRS,
GREYC, 14000 CAEN, France
Email: [email protected]
Abstract
Descriptive complexity may be useful to design programs in a natural declarative way. This is important for parallel computation models such as cellular automata, because designing parallel programs is considered difficult.
Our paper establishes logical characterizations of the three classical complexity classes that model minimal time, called real-time, of one-dimensional cellular automata according to their canonical variants.
Our logics are natural restrictions of the existential second-order Horn logic. They correspond to the three ways of deciding a language on a square grid circuit of side n according to the three canonical placements of an input word of length n on the grid.
Our key tool is a normalization method that transforms a formula into an equivalent formula that literally mimics a grid circuit.
1 Introduction
1.1 Descriptive complexity and programming
There are two criteria of interest of a complexity class: it contains a number of “natural” problems that are complete in the class; it has machine-independent “natural” characterizations, usually in logic, i.e., in so-called descriptive complexity. The most famous example is Fagin’s Theorem [1, 2], which characterizes NP as the class of problems definable in existential second-order logic (ESO). Similarly, Immerman-Vardi’s Theorem [2, 3] and Grädel’s Theorem [4, 5] characterize the class P by first-order logic plus least fixed-point, and second-order logic restricted to Horn formulas, respectively.
Another interest of descriptive complexity is that it allows to automatically derive from a logical description of a problem a program that solves it. This is particularly interesting for the design of parallel programs that is considered a difficult task. Typically, a number of algorithmic problems (product of integers, product of matrices, sorting, etc.) are computable in linear time on cellular automata (CA), a local and massively parallel model. For each such problem, the literature presents an “ad hoc” parallel and local algorithmic strategy and gives the program of the final CA in an informal way [6, 7]. However, the problems in concern can be defined inductively in a natural way. For instance, the product of two integers in binary notation is simply defined by the classical Horner’s method and one may hope to directly derive a parallel program from such an inductive process.
1.2 Descriptive complexity and linear time on cellular automata
The present paper is in some sense the sequel of a recent paper [8]
(see also [9]). First, [8] observes that the inductive processes defining the problems in concern (product of integers, product of matrices, sorting, etc.) are “local” and are naturally formalized by Horn formulas, that is by conjunctions of first-order Horn clauses. Therefore, the computation is nothing else than the classical resolution method on Horn clauses, as in Prolog and Datalog [2, 5], [10]. Moreover, on every concrete problem defined by a Horn formula with d+1 first-order variables, this inductive computation by Horn rules can be geometrically modeled as the displacement of a d-dimensional hyperplan along some fixed line in a space of dimension d+1.
To capture these inductive behaviors, [8] defines a logic denoted monot-ESO-HORNd(∀d+1,arityd+1) obtained from the logic ESO-HORN tailored by Grädel [5] to characterize P, by restricting both the number of first-order variables and the arity of second-order predicate symbols.
Besides, it includes an additional restriction – the “monotonicity condition” – that reflects the geometrical consideration above-mentioned. [8] proves that this logic exactly characterizes the linear time complexity class of cellular automata: more precisely, for each integer d≥1, a set L of d-dimensional pictures can be decided in linear time on a d-dimensional CA – written L∈DLINCAd – if and only if it can be expressed in monot-ESO-HORNd(∀d+1,arityd+1). For short:
DLINCAd=monot-ESO-HORNd(∀d+1,arityd+1).
To summarize, expressing a concrete problem in this logic – which seems an easy task in practice and also is a necessary and sufficient condition according to the above equality – guarantees that this problem can be solved in linear time on a CA; moreover, the Horn formula that defines the problem can be automatically translated into a program of CA that computes it in linear time.
1.3 Logics for minimal time of cellular automata?
At this point, two natural questions arise:
-
Besides linear time, a robust and very expressive complexity class, what are the other significant and robust complexity classes of CA?
2. 2.
Can we exhibit characterizations of those complexity classes in some naturally (syntactically) defined logics so that any definition of a problem in such a logic can be automatically translated into a program of the complexity in concern?
Besides linear time, the main complexity notion well-studied for a long time in the literature of CA is real-time, i.e., minimal time [11, 12, 13]. A cellular automaton is said to run in real-time if it stops, i.e., gives the answer yes or no, at the minimal instant when the elapsed time is sufficient for the output cell (the cell that gives the answer) to have received each letter of the input. Real-time complexity appears as a sensitive/fragile notion and one generally thinks it is so for CA of dimension 2 or more [14], [15]. However, maybe surprisingly, one knows that real-time complexity is a robust notion for one-dimensional CA in the following sense: according to the many natural variants of the definition of a one-dimensional CA, which essentially rest on the choice of the neighborhood of the CA and the parallel or sequential presentation of its input word, exactly three real-time classes of one-dimensional CA111By default, a CA has a two-way communication and a parallel input mode. Any CA (resp. one-way CA or OCA) with sequential input mode is also called an iterative array or IA (resp. OIA). have been proved to be distinct [11, 16, 17, 18]:
-
RealTimeCA=RealTimeOIA;
2. 2.
Trellis=RealTimeOCA;
3. 3.
RealTimeIA.
The final and decisive step to establish this classification is a nice dichotomy of [18] on admissible neighborhoods222The neighborhood of a CA is the finite set of integers N such that the state of any cell x at any non-initial instant t is determined by the states of the cells x+d, for d∈N, at instant t−1. A neighborhood is admissible with respect to a fixed output cell (in general the first or the last cell) if it allows to communicate each bit of the input to the output cell.
of CA, which can be rephrased as follows: for each neighborhood N admissible with respect to the first cell as output cell, the real-time complexity class of one-dimensional CA with parallel input mode and neighborhood N,
either is equal to the real-time class for the neighborhood {−1,0,1},
i.e., RealTimeCA (class 1 above),
or is equal to the real-time class for the neighborhood {−1,0}, i.e., Trellis (class 2 above).
Further, it is surprising to notice that
the mutual relations between those three real-time classes are wholly elucidated: classes Trellis and RealTimeIA are mutually incomparable for inclusion whereas we have the strict inclusion
Trellis∪RealTimeIA⫋RealTimeCA [11, 19, 20],
while it is unknown whether the trivial inclusion
RealTimeCA⊆DLINCA1 is strict;
worse, even whether the inclusion
RealTimeCA⊆LinSpace is strict is an open problem!
1.4 Logics and grid circuits for real-time classes
Each of the three real-time classes 1-3 is robust, i.e, is not modified for many variants of CA (change of neighborhoods, etc.) and has two or three quite different equivalent definitions. For example, RealTimeCA is equal to the linear time class of one-way CA with parallel input mode.
Similarly, [21] has proved the surprising result that Trellis is the class of languages generated by linear conjunctive grammars (see also [22]) and [23] has established that a language L is in RealTimeIA if and only if its reverse language LR is recognized in real time by an alternating automaton with one counter.
Logics have two nice and complementary properties:
they are flexible, hence expressive; they have normal forms, hence can be tailored for efficient programming.
The main idea that led us to conceive the different logics for real-time classes can be summarized by the following simple question: what are the different ways to decide a language on a square grid circuit? For any integer n≥1, let Cn be the grid circuit n×n where the state q∈Q (for finite Q) of any site (i,j), 1≤i,j≤n, is determined by the states of its “predecessors” (i−1,j), if it exists (i>1), and (i,j−1), if it exists (j>1), so that the output cell is the site (n,n). Up to symmetries, there are three canonical ways333To be complete, one should say that there is a fourth arrangement: place the input word on a side containing the output cell. In this case, the grid circuit behaves like a finite automaton (CA of dimension zero)… to arrange an input word w=w1…wn of length n on the grid Cn, see Figure 1:
-
GRID1: place the input on any side (or, equivalently, on both sides) that does (do) not contain the output cell;
2. 2.
GRID2: place the input on the diagonal opposite to the output cell;
3. 3.
GRID3: place the input on the diagonal that contains the output cell.
A simple (reversible) deformation transforms a grid circuit of GRIDi, i=1,2,3, into a time-space diagram of a CA of the real-time class i in concern (recall: 1: RealTimeCA; 2: Trellis; 3: RealTimeIA), and conversely.
More precisely, to characterize the three real-time classes, we define three sub-logics of the Horn logic that characterizes linear time of one-dimensional CA (DLINCA1=monot-ESO-HORN1(∀2,arity2)), called respectively pred-ESO-HORN, incl-ESO-HORN
and pred-dio-ESO-HORN (defined in the next section), and we prove the following equalities:
-
pred-ESO-HORN=GRID1=RealTimeCA
2. 2.
incl-ESO-HORN=GRID2=Trellis
3. 3.
pred-dio-ESO-HORN=GRID3=RealTimeIA
To establish the double nature of our three logics and deduce the previous equalities 1-3, we present each logic in two forms:
we define it the largest possible, showing the extent of its expressiveness;
we prove for it the most restricted normal form.
In each case, a formula in normal form can be translated literally into a grid program, which is essentially a CA of the real-time complexity class in concern.
Structure of the paper: In preliminaries, we recall the classical definitions of one-dimensional cellular automata and of their real-time classes and define our three logics with an example of a problem naturally expressed in such a logic. Section 3 establishes how each of our logics can be normalized. Using these normal forms we show in Section 4 that our three logics exactly characterize the three real-time complexity classes and also – for inclusive logic – the class of linear conjunctive languages of Okhotin [21]. Section 5 gives conclusive remarks.
2 Preliminaries
2.1 Cellular automata and real-time complexity
A cellular automaton in one dimension is a tape of cells (each cell is a finite automaton) indexed by Z. Each cell takes a value from a finite set of states and the cells evolve synchronously along a discrete time scale. The evolution of the cell c is done according to a transition function which takes as input the state of the cell itself and the states of its neighbors at the previous time step and outputs a new state for the cell.
Definition 1** (cellular automaton).**
A cellular automaton is defined by a 5-tuple (Q,Σ,Qaccept,N,δ) where Q is a finite set of states, Σ⊂Q is the input alphabet, Qaccept⊂Q is the set of accepting states, the neighborhood N is a finite ordered subset of Z and δ is the transition function from Q∣N∣ to Q. The state of the cell c at time t is denoted by ⟨c,t⟩. The state of the cell c at time t>1 is defined by the transition function: ⟨c,t⟩=δ(⟨c+v,t−1⟩:v∈N).
Definition 2** (real time language acceptance).**
Cellular automata can act as language acceptors. In this case cellular automata work on a finite set of cells indexed by [1,n] where n is the size of the input word w=w1…wn, one of this cells is also chosen as the output cell (usually one of the border cells). A word w is said to be accepted by an automaton in real-time if its output cell enters an accepting state immediately after getting all the information from w. The language accepted by a cellular automaton A in real-time (denoted by L(A)) is the set of all its accepted words in real-time.
**Convention **(permanent state, quiescent state).
All the cells of index outside [1,n] are in the permanent state ♯. Without information from the input a cell of index [1,n] is in the quiescent state λ.
The real-time computation power of a CA only depends on its communication scheme. That is fully determined by the following three specifications: the way the input is fed to the automaton, the way the cells communicate (depending on the neighborhood) and the output cell. The input is usually fed to the automaton in a parallel way: the ith bit of the input is given to the ith cell at the start of the computation. The input can also be fed in a sequential way: the ith bit of the input is given to the first cell at time i for which we add a specific transition function δinput. Usually the output cell is the first cell for two-way communications and the last one for one-way communication.
CA have their input fed in a parallel way and the cells communicate in two-way mode (N={−1,0,1}). One-way cellular automata (OCA) and iterative arrays (IA) are two natural variants of CA. OCA are narrowed on the way the cells communicate: the information is only transmitted from left to right (N={−1,0}). The input mode of IA is no more parallel but sequential.
Definition 3** (RealTimeCA).**
The class RealTimeCA is the set of languages accepted by real-time CA with a parallel input, the neighborhood N={−1,0,1} and the first cell as the output cell.
The class RealTimeCA is equivalent to RealTimeOIA, the set of languages accepted by one-way IA with sequential input running in real-time with neighborhood N={−1,0} and the last cell as the output cell.
Definition 4** (Trellis).**
The class Trellis is the set of languages accepted by trellis automata or equivalently by OCA running in real-time with a parallel input, the neighborhood N={−1,0} and the last cell as the output cell.
Definition 5** (RealTimeIA).**
The class RealTimeIA is the set of languages accepted by IA running in real-time with a sequential input, the neighborhood N={−1,0,1} and the first cell as the output cell.
The space-time diagrams of these real-time classes are depicted in Figure 2.
2.2 Our logics
The “local” nature of our logics requires that the underlying structure encoding an input word w=w1…wn on its index interval [1,n]={1,…,n} only uses the successor and predecessor functions and the monadic predicates min and max as its only arithmetic functions/predicates:
Definition 6** (structure encoding a word).**
Each nonempty word w=w1…wn∈Σn on a fixed finite alphabet Σ is represented by the first-order structure
[TABLE]
of domain [1,n], monadic predicates Qs, s∈Σ, min and max
such that
Qs(i)⟺wi=s,
min(i)⟺i=1, and max(i)⟺i=n,
and unary functions suc and pred such that
suc(i)=i+1 for i<n and suc(n)=n,
pred(i)=i−1 for i>1 and pred(1)=1.
Let SΣ denote the signature
{(Qs)s∈Σ,min,max,suc,pred}
of structure ⟨w⟩.
The monadic predicates Qs, s∈Σ, min, and max
of SΣ
are called input predicates.
Let x+k and x−k abbreviate the terms suck(x) and predk(x), for a fixed integer k≥0.
Let us now define two of our logics:
Definition 7** (predecessor logics).**
*A predecessor Horn formula (resp. predecessor Horn formula with diagonal input-output) is a formula of the form Φ=∃R∀x∀yψ(x,y) where ψ is a conjunction of Horn clauses on the variables x,y,
– of signature SΣ∪R (resp. SΣ∪R∪{=}) where R is a set of binary predicates called computation predicates,
– of the form δ1∧…∧δr→δ0 where the conclusion δ0 is either a computation atom R(x,y) with R∈R, or ⊥ (False) and each hypothesis δi is either an input literal/conjunction of one of the forms:*
Qs(x−a), Qs(y−a) (resp. Qs(x−a)∧x=y), for s∈Σ and an integer a≥0,
U(x−a), ¬U(x−a), U(y−a) or ¬U(y−a), for U∈{min,max} and an integer a≥0,
or a computation atom of the form S(x−a,y−b) or S(y−b,x−a), for S∈R and some integers a,b≥0.
Let pred-ESO-HORN
(resp. pred-dio-ESO-HORN)
denote the class of predecessor Horn formulas (resp. predecessor Horn formulas with diagonal input-output) and, by abuse of notation, the class of languages they define.
The formulas of the “predecessor” logics defined above use the predecessor function but not the successor function: both logics inductively define problems in increasing both coordinates x and y. The inductive principle of our last logic is seemingly different: it lies on inclusions of intervals [x,y].
Definition 8** (inclusion logic).**
An inclusion Horn formula is a formula of the form Φ=∃R∀x∀yψ(x,y) where ψ is a conjunction of Horn clauses of signature SΣ∪R∪{=,≤,<} where R is a set of binary predicates called computation predicates,
of the form x≤y∧δ1∧…∧δr→δ0 where the conclusion δ0 is
either a computation atom R(x,y) with R∈R, or the atom ⊥ (False), and each hypothesis δi is
-
either an input literal of the form 444Without loss of generality, assume that there is no negation over a predicate Qs.
U(x+a), ¬U(x+a), U(y+a) or ¬U(y+a), for U∈{(Qs)s∈Σ,min,max} and an integer a∈Z,
2. 2.
or the (in)equality x=y or x<y 555Then, the hypothesis x≤y is redundant.,
3. 3.
or a conjunction of the form
S(x+a,y−b)∧x+a≤y−b**
for a computation atom S(x+a,y−b), with S∈R and some integers a,b≥0.
Let incl-ESO-HORN
denote the class of inclusion Horn formulas and, also, the class of languages they define.
Note that the “inclusion” meaning of logic incl-ESO-HORN is given by hypotheses x≤y and x+a≤y−b.
It means that the inductive computation of each value R(x,y), for x≤y and R∈R, only use values of the form S(x+a,y−b), for S∈R and an included interval [x+a,y−b]⊆[x,y].
Notation: We will freely use the intuitive abbreviations x\leavevmode >\leavevmode a, x=a, for a constant integer a≥1, and x≤n−a, x<n−a, x=n−a, for a constant integer a≥0, and similarly for y.
For example, x>3 is written in place of ¬min(x−2)
and y≤n−2 is written in place of ¬max(y+1).
Technical remarks about our logics: Without loss of generality, we can suppose that each clause having a hypothesis atom of the form S(x−a,y−b) or S(y−b,x−a), for a,b≥0, has also the hypotheses x>a (if a>0) and y>b (if b>0). The same for each hypothesis atom of the form Qs(x−a) or Qs(y−b), for a,b>0. Similarly, we assume that each clause with a hypothesis of the form Qs(x+a) (resp. Qs(y+a)), with a>0, also contains the hypothesis x≤n−a (resp. y≤n−a). Similarly, for each atom S(x+a,y−b), for a,b≥0.
Comparing the input presentation in our logics:
The presentation of the input is more restrictive in Definition 7 of predecessor logics than in that of inclusion logic (Definition 8) because we have forbidden the use of the successor function for uniformity/aesthetics.
However, allowing the same largest set of input literals (¬)U(x+a), (¬)U(y+a),
for U∈{(Qs)s∈Σ,min,max} and a∈Z,
does not modify the expressive power of predecessor logics: steps 5 and 6 of the normalization of inclusive logic in Section 3 can be easily adapted to predecessor logics.
Using our logics for programming: an example
We now give an example of a natural problem expressed in one of our logics. The language notBordered is the set of all words w∈Σ+ with no proper prefix equal to a proper suffix:
notBordered={w∣∀w′ such that w=w′u=vw′, w′=ϵ or w′=w}.
This language can be defined by ΦnotBordered:=∃Border∀x∀yψ of pred-ESO-HORN where ψ is the conjunction of the following clauses where Border(x,y) means w1…wx=wy−x+1…wy (see Figure 3):
-
min(x)∧¬min(y)∧Qs(x)∧Qs(y)→Border(x,y)
2. 2.
¬min(x)∧¬min(y)∧Border(x−1,y−1)∧Qs(x)∧Qs(y)→Border(x,y), for all s∈Σ;
3. 3.
max(y)∧Border(x,y)→⊥.
If Border(x,y) is true when y is maximal, then w1…wx=wn−x+1…wn and therefore w∈/notBordered.
So, as a consequence of this paper,
notBordered belongs to RealTimeCA.
In fact, more is known [20]:
[TABLE]
3 Normalizing our logics
The most difficult and main parts of the proofs of our descriptive complexity results, i.e., equalities 1-3 of Subsection 1.4, are the following normalization lemmas.
They are key ingredients because our normalized formulas can be literally simulated by grids and finally by CA of the corresponding real-time classes.
Lemma 1** (normalization of predecessor logics).**
Each formula Φ∈pred-ESO-HORN
(resp. Φ∈pred-dio-ESO-HORN)
is equivalent to a formula Φ′∈pred-ESO-HORN
(resp. Φ′∈pred-dio-ESO-HORN)
normalized as follows: each clause of Φ′ is of one of the following forms:
input clause* of the form, for s∈Σ and R∈R:*
min(x)∧min(y)∧Qs(y)→R(x,y), or
min(x)∧¬min(y)∧Qs(y)→R(x,y)
(resp. x=y∧min(x)∧Qs(x)→R(x,y), or
x=y∧¬min(x)∧Qs(x)→R(x,y)).
the contradiction clause, for a fixed R⊥∈R:
max(x)∧max(y)∧R⊥(x,y)→⊥;
computation clause* of the form δ1∧…∧δr→R(x,y), for R∈R, where each hypothesis δi
is a conjunction of the form
S(x−1,y)∧¬min(x) or S(x,y−1)∧¬min(y), for S∈R.*
Let normal-pred-ESO-HORN
(resp. normal-pred-dio-ESO-HORN)
denote the class of formulas (languages) so defined.
Lemma 2** (normalization of inclusion logic).**
Each formula Φ∈incl-ESO-HORN is equivalent to a formula
Φ′∈incl-ESO-HORN normalized as follows: each clause of Φ′ is of one of the following forms:
input clause* of the form x=y∧Qs(x)→R(x,y),
for s∈Σ and R∈R;*
the contradiction clause, for a fixed R⊥∈R,
min(x)∧max(y)∧R⊥(x,y)→⊥;
computation clause* of the form666Note that the hypothesis x<y is equivalent to the expected inequality x+1≤y or x≤y−1.
x<y∧δ1∧…∧δr→R(x,y),
where R∈R and where each hypothesis δi
is a computation atom of either form
S(x+1,y) or S(x,y−1), for S∈R.*
Let normal-incl-ESO-HORN denote the class of formulas (resp. languages) so defined.
Proof of the normalization lemmas 1 and 2
The normalization processes of our three logics are quite similar each other; further, some steps are exactly the same. Therefore, we choose to present here below the successive normalization steps for one logic:
pred-ESO-HORN.
Afterwards, we will succinctly describe how those steps should be adapted for the two other logics.
Proof of Lemma 1: Normalization of predecessor Horn formulas
Let a formula Φ∈pred-ESO-HORN.
For simplicity of notation, we first assume that the only computation atoms of Φ are of the form
R(x−a,y−b), a,b≥0 (no atom of the form R(y−b,x−a)). We will show at the end of the proof how to manage the general case. Φ will be transformed into an equivalent normalized form Φ′ by a sequence of 10 steps:
-
Processing the contradiction clauses;
2. 2.
Processing the input;
3. 3.
Restriction of computation atoms to R(x−1,y), R(x,y−1), and R(x,y);
4. 4.
Elimination of atoms x>a, x=a, y>a, y=a;
5. 5.
Processing of min and max;
6. 6.
Defining equality and inequalities;
7. 7.
Folding of the domain;
8. 8.
Deleting max in the initialization clauses;
9. 9.
From initialization clauses to input clauses;
10. 10.
Elimination of atoms R(x,y) as hypotheses.
In each of these 10 steps, we will introduce new (binary) computation predicates, to be added to the set R of existentially quantified predicates, and new clauses to define them.
1) Processing the contradiction clauses: Without loss of generality, one can assume there is the only contradiction clause max(x)∧max(y)∧R⊥(x,y)→⊥. Indeed, each contradiction clause ℓ1∧…∧ℓk→⊥ can be equivalently replaced by the conjunction of computation clauses ℓ1∧…∧ℓk→R⊥(x,y) with the clause R⊥(x,y)→⊥ where R⊥ is a new computation predicate (intuitively, always false). However, in place of the previous clause, we “delay” the contradiction, by propagating predicate R⊥ till point (n,n), thanks to the conjunction of the “transport” clauses R⊥(x−1,y)∧¬min(x)→R⊥(x,y) and R⊥(x,y−1)∧¬min(y)→R⊥(x,y) and of the unique contradiction clause max(x)∧max(y)∧R⊥(x,y)→⊥ required by the normal form.
2) Processing the input: The idea is to make available the letters of the input word only on the sides x=1 and y=1 of the square {(x,y)∈[1,n]2}, this by carrying out their transport thanks to new “transport” predicates Wsx and Wsy, for s∈Σ, inductively defined by the following clauses:
∙ initialization clauses Qs(x)∧min(y)→Wsx(x,y) and Qs(y)∧min(x)→Wsy(x,y);
∙ transport clauses Wsx(x,y−1)∧¬min(y)→Wsx(x,y) and Wsy(x−1,y)∧¬min(x)→Wsy(x,y).
By transitivity, these clauses imply clauses Qs(x)\leavevmode →\leavevmode Wsx(x,y)
and Qs(y)\leavevmode →\leavevmode Wsy(x,y).In other words, the minimal model of the conjunction of those clauses that expands structure ⟨w⟩ satisfies equivalences
∀x∀y(Wsx(x,y)⟺Qs(x)) and ∀x∀y(Wsy(x,y)⟺Qs(y)).
This justifies the replacement of the input atoms of form Qs(x−a) and Qs(y−b) by the respective atoms Wsx(x−a,y) and Wsy(x,y−b) in all the clauses, except in the initialization clauses.
3) Restriction of computation atoms to R(x−1,y), R(x,y−1), R(x,y):
The idea is to introduce new “shift” predicates Rx−a, Ry−b and Rx−a,y−b, for fixed integers a,b>0 and R∈R: typically, we define the predicate Rx−a,y−b that intuitively satisfies the equivalence Rx−a,y−b(x,y)⟺R(x−a,y−b).
Let us suggest the method by an example. Assume we have initially the Horn clause
x>3∧y>2∧R(x−2,y−1)∧S(x−3,y−2)→T(x,y).
This clause is replaced by the clause
x>3∧y>2∧Rx−2(x,y−1)∧Sx−2,y−2(x−1,y))→T(x,y),
for which the predicates Rx−1 and Rx−2 are defined by the clauses
x>1∧R(x−1,y)→Rx−1(x,y) and x>2∧Rx−1(x−1,y)→Rx−2(x,y)
which imply x>2∧R(x−2,y)→Rx−2(x,y) and then x>2∧y>1\linebreak∧R(x−2,y−1)→Rx−2(x,y−1),
and the predicates Sx−1, Sx−2, Sx−2,y−1 and Sx−2,y−2 defined by the respective clauses:
x>1∧S(x−1,y)→Sx−1(x,y),x>2∧Sx−1(x−1,y)→Sx−2(x,y),x>2∧y>1∧Sx−2(x,y−1)→Sx−2,y−1(x,y), and x>2∧y>2∧Sx−2,y−1(x,y−1)→Sx−2,y−2(x,y),which imply together the clause
x>2∧y>2∧S(x−2,y−2)→Sx−2,y−2(x,y)
and then also
x>3∧y>2∧S(x−3,y−2)→Sx−2,y−2(x−1,y).
Remark 1**.**
Atoms on min and x are of the forms min(x−a) or ¬min(x−a) for a≥0, or, equivalently, x=a+1 or x>a+1. Besides, for each integer a≥1, the atom max(x−a) is false.
Therefore, one may consider that the only literals on x involving min or max are of the form
min(x), ¬min(x), max(x), ¬max(x), x=a, x>a, for an integer a>1, and similarly, for y.
4) Elimination of atoms x>a, x=a, y>a, y=a:
By recurrence on integer a≥1, let us define the binary predicates Rx>a (and, similarly, Rx=a, Ry>a, Ry=a)
whose intuitive meaning is x>a (resp. x=a, y>a, y=a).
The predicate Rx>1 is defined by the clause ¬min(x)→Rx>1(x,y).
For a>1, let us define Rx>a from Rx>a−1 by the clause
Rx>a−1(x−1,y)∧¬min(x)→Rx>a(x,y).
By recurrence on integer a≥1, these clauses imply
x>a→Rx>a(x,y).
This justifies the replacement of the atoms x>a and
x=a, for a>1, by Rx>a(x,y) and Rx=a(x,y), respectively, and similarly for y in place of x.
After step 4, the only literals involving min or max are
(¬)min(x), (¬)max(x), (¬)min(y), (¬)max(y).
5) Processing of min and max:
To each literal η(x) of the form
min(x), ¬min(x), max(x) or ¬max(x), associate the new binary predicate Rη(x) defined by the conjunction of the initialization clause
η(x)∧min(y)→Rη(x)(x,y)
and of the transport clause Rη(x)(x,y−1)∧¬min(y)→Rη(x)(x,y).
Do similarly for the literals η(y)∈{(¬)min(y),(¬)max(y)}.
This justifies we replace each such literal η(x) (resp. η(y)) by the “equivalent” atom Rη(x)(x,y)
(resp. Rη(y)(x,y)) in all the clauses, except in the above initialization clauses and in the contradiction clause or in case η(x) (resp. η(y)) is ¬min(x) (resp. ¬min(y)) and is joined to a hypothesis of the form R(x−1,y) (resp. R(x,y−1)).
Recapitulation: After step 5 each clause is of one of the following forms:
-
an initialization clause of one of the two forms:
∙ initialization for x=1: min(x)∧η(y)→R(x,y)
with η(y)∈{(Qs(y))s∈Σ,(¬)min(y),(¬)max(y)};
∙ initialization for y=1: min(y)∧η(x)→R(x,y)
with η(x)∈{(Qs(x))s∈Σ,(¬)min(x),(¬)max(x)};
2. 2.
“the” contradiction clause
max(x)∧max(y)∧R⊥(x,y)→⊥;
3. 3.
a computation clause of the form
δ1(x,y)∧…∧δr(x,y)→R(x,y),
where each hypothesis δi is of one of the three forms
R(x,y), R(x−1,y)∧¬min(x), R(x,y−1)∧¬min(y).
In fact, without loss of generality, we can assume
that each computation clause is of one of the following forms:
- (a)
S(x−1,y)∧¬min(x)→R(x,y);
2. (b)
S(x,y−1)∧¬min(y)→R(x,y);
3. (c)
S(x,y)∧T(x,y)→R(x,y).
Justification of the assumption: “Decompose” each computation clause into clauses of forms (a,b,c) by introducing new intermediate predicates. For example, the computation clause
R1(x−1,y)∧¬min(x)∧R2(x,y−1)∧¬min(y)∧R3(x,y)→R4(x,y)
is “equivalent” to the conjunction of the following clauses using new predicates R5,R6,R7:
R1(x−1,y)∧¬min(x)→R5(x,y);
R2(x,y−1)∧¬min(y)→R6(x,y);
R5(x,y)∧R6(x,y)→R7(x,y);
R7(x,y)∧R3(x,y)→R4(x,y).
We now plan to fold the square domain {(x,y)∈[1,n]2} along the diagonal x=y on the over-diagonal triangle Tn={(x,y)∈[1,n]2∣ x≤y}. This requires to first define equality and inequalities.
6) Defining equality and inequalities: Let us jointly define the predicates R= and Rpred of intuitive meaning R=(x,y)⟺x=y and Rpred(x,y)⟺x−1=yby the following clauses:
min(x)∧min(y)→R=(x,y); ¬min(x)∧R=(x−1,y)→Rpred(x,y); ¬min(y)∧Rpred(x,y−1)→R=(x,y).
Then define the predicate R< such that R<(x,y)⟺x<y with the two clauses
¬min(y)∧R=(x,y−1)→R<(x,y) and ¬min(y)∧R<(x,y−1)→R<(x,y).
Define similarly the predicate R≤ such that R≤(x,y)⟺x≤ywith the two clauses
min(x)∧min(y)→R≤(x,y) and ¬min(x)∧R<(x−1,y)→R≤(x,y).
For easy reading, we will freely write x=y, x<y and x≤y in place of the atoms R=(x,y), R<(x,y) and R≤(x,y), respectively.
7) Folding of the domain: Let us fold the square domain {(x,y)∈[1,n]2}
along the diagonal x=y on the over-diagonal triangle Tn={(x,y)∈[1,n]2∣ x≤y}
so that each point (y,x) such that x≤y is sent to its symmetrical point (x,y)∈Tn.
For that purpose, let us associate to each predicate R∈R a new (inverse) predicate Rinv
whose intuitive meaning is the following: for each x≤y, we have Rinv(x,y)⟺R(y,x). So, each clause C will be replaced by two clauses: the first one is the restriction of C to the triangle Tn; the second one is the folding on Tn of the restriction of C to the under-diagonal triangle using predicates Rinv. Finally, we will express that each R∈R coincides with its inverse Rinv on the fold x=y.
Folding the initialization clauses:
Each initialization clause of the form min(x)∧η(y)→R(x,y)
(with η(y)∈{Qs(y)∣s∈Σ}∪{(¬)min(y),(¬)max(y)}) applies to the line x=1 which is included in the triangle Tn and consequently it should be unchanged in the folding; in contrast, each initialization clause of the form min(y)∧η(x)→R(x,y) (with η(x)∈{Qs(x)∣s\leavevmode ∈\leavevmode Σ}∪{(¬)min(x),(¬)max(x)}) is replaced by its folded version min(x)∧η(y)→Rinv(x,y).
Folding the computation clauses:
Let us describe how to fold the clauses (a) or (b) (folding clauses (c) is easy):
∙ Folding of clauses (a): A clause of the form S(x−1,y)∧¬min(x)→R(x,y) is equivalent to the conjunction of clauses
i) x≤y∧S(x−1,y)∧¬min(x)→R(x,y) and
ii) x>y∧S(x−1,y)∧¬min(x)→R(x,y).
Notice that clause (i) applies to the triangle Tn since x≤y implies x−1<y: therefore, clause (i) should be left unchanged. Clause (ii) is equivalent (by exchanging variables x and y) to the clause
y>x∧S(y−1,x)∧¬min(y)→R(y,x)
whose folded (equivalent) form on Tn is x<y∧Sinv(x,y−1)∧¬min(y)→Rinv(x,y) since x<y implies x≤y−1.
∙ Folding of clauses (b): Similarly, a clause of the form S(x,y−1)∧¬min(y)→R(x,y) is equivalent to the conjunction of clauses x<y∧S(x,y−1)∧¬min(y)→R(x,y)
and x≤y∧Sinv(x−1,y)∧¬min(x)→Rinv(x,y).
Folding the contradiction clause: Clearly, it is harmless to confuse the (contradiction) predicate
R⊥ and its inverse (R⊥)inv; consequently, the contradiction clause itself
max(x)∧max(y)∧R⊥(x,y)→⊥ is its own folded version.
The diagonal fold: Finally, for each R∈R, the following two clauses mean that R coincides with its inverse Rinv on the diagonal:
x=y∧R(x,y)→Rinv(x,y); x=y∧Rinv(x,y)→R(x,y).
Recapitulation: By a careful examination of the set of clauses obtained after steps 1-7, we can check that each of them is of one of the following forms:
-
an initialization clause of the form:
min(x)∧η(y)→R(x,y)
with η(y)∈{Qs(y)∣s∈Σ}∪{(¬)min(y),(¬)max(y)};
2. 2.
“the” contradiction clause max(x)∧max(y)∧R⊥(x,y)→⊥;
3. 3.
a computation clause of one of the following forms:
(a) x≤y∧S(x−1,y)∧¬min(x)→R(x,y);
(b) x<y∧S(x,y−1)∧¬min(y)→R(x,y);
(c) x≤y∧S(x,y)∧T(x,y)→R(x,y);
(d) x=y∧S(x,y)→R(x,y).
8) Deleting max in the initialization clauses:
The idea is to consider in parallel for each point (x,y) the case where the hypothesis max(y) holds and the contrary case where the negation ¬max(y) holds. For that purpose, we duplicate each computation predicate
R in two new predicates denoted R←maxy and R←¬maxy. Intuitively, the atom R←maxy(x,y)
(resp. R←¬maxy(x,y))
expresses the implication max(y)→R(x,y) (resp. ¬max(y)→R(x,y)).
Transforming the initialization clauses:
According to the desired semantics of R←maxy
and R←¬maxy, each initialization clause of the form min(x)∧max(y)→R(x,y) (resp. min(x)∧¬max(y)→R(x,y)) should be rewritten as
min(x)→R←maxy(x,y)
(resp. min(x)→R←¬maxy(x,y)).
Similarly, each initialization clause of the form min(x)∧η(y)→R(x,y),
for η(y)∈{Qs(y)∣s∈Σ}∪{(¬)min(y)}
should be replaced by the conjunction of the following two clauses:
min(x)∧η(y)→R←maxy(x,y)
and min(x)∧η(y)→R←¬maxy(x,y).
Transforming the computation clauses:
We describe it for each above form (a-d).
∙ Each clause (a) x≤y∧S(x−1,y)∧¬min(x)→R(x,y) is replaced by the “equivalent” conjunction of the following two clauses
x≤y∧S←maxy(x−1,y)∧¬min(x)→R←maxy(x,y) and
x≤y∧S←¬maxy(x−1,y)∧¬min(x)→R←¬maxy(x,y).
∙ Each clause (b) x<y∧S(x,y−1)∧¬min(y)→R(x,y) is “equivalent” to x<y∧S←¬maxy(x,y−1)∧¬min(y)→R(x,y) since the hypothesis ¬max(y−1) always holds. Consequently, clause (b) should be replaced by the “equivalent” conjunction of the following two clauses:
x<y∧S←¬maxy(x,y−1)∧¬min(y)→R←maxy(x,y) and
x<y∧S←¬maxy(x,y−1)∧¬min(y)→R←¬maxy(x,y).
∙ Each clause (c) x≤y∧S(x,y)∧T(x,y)→R(x,y)
is replaced by the “equivalent” conjunction of the following two clauses:
x≤y∧S←maxy(x,y)∧T←maxy(x,y)→R←maxy(x,y)
and x≤y∧S←¬maxy(x,y)∧T←¬maxy(x,y)→R←¬maxy(x,y).
∙ Make a similar substitution for each above clause (d).
Processing the contradiction clause: Obviously, the contradiction clause
max(x)∧max(y)∧R⊥(x,y)→⊥
is equivalent to the formula
max(x)∧max(y)∧(max(y)→R⊥(x,y))→⊥
and should be rewritten as
max(x)∧max(y)∧(R⊥)←maxy(x,y)→⊥,
which is of the required form if the predicate (R⊥)←maxy is renamed R⊥.
9) From initialization clauses to input clauses:
The initialization clauses are now of the form min(x)→R(x,y) or
min(x)∧η(y)→R(x,y),
for η(y)∈{Qs(y)∣s∈Σ}\linebreak∪{(¬)min(y)}.
By a separation in cases, it is easy to transform each of these clauses into an equivalent conjunction of input clauses of the required (normalized) forms:
min(x)∧min(y)∧Qs(y)→R(x,y);
min(x)∧¬min(y)∧Qs(y)→R(x,y).
After step 9, the formula obtained is of the claimed normal form, except that some computation clauses may have atoms R(x,y) as hypotheses. Our last step is to eliminate such hypotheses.
10) Elimination of atoms R(x,y) as hypotheses:
The first idea is to group together in each computation clause the hypothesis atoms of the form R(x,y) and the conclusion of the clause. Accordingly, the formula can be rewritten in the form
Φ:=∃R∀x∀y[⋀iCi(x,y)∧⋀i∈[1,k](αi(x,y)→θi(x,y))]
where the Ci’s are the input clauses and the contradiction clause, and each computation clause is written in the form αi(x,y)→θi(x,y) where αi(x,y) is a conjunction of formulas of the only forms R(x−1,y)∧¬min(x), R(x,y−1)∧¬min(y), but not R(x,y), and θi(x,y) is a Horn clause whose all the atoms are of the form R(x,y).
The second idea is to “solve” the Horn clauses θi (containing only atoms of the form R(x,y)) according to the input clauses and all the possible conjunctions of hypotheses αi that may be true. Notice the two following facts: the hypotheses of the input clauses are input literals and the conjuncts of the αi’s are of the only forms R(x−1,y)∧¬min(x), R(x,y−1)∧¬min(y). So, we can prove by induction on the sum x+y that the obtained formula Φ′ which is a conjunction of clauses (whose hypotheses do include no atom of the form R(x,y) anymore) is equivalent to the above formula Φ.
For a detailed proof, see the appendix.
General case: Steps 1-7 are easy to adapt in the general case where the initial formula may contain hypotheses of the form R(y−b,x−a). The new points are the following:
step 3 restricts the computation atoms to four forms: R(x,y), R(y,x), R(x−1,y) and R(x,y−1);
step 7 (folding the domain) is adapted so that it eliminates the atoms of the form R(y,x) by using the following equivalence for x≤y, R(y,x)⟺Rinv(x,y).
See the details in the appendix.
This achieves the proof of the normalization result pred-ESO-HORN=normal-pred-ESO-HORN.
Adaptation of steps 1-10 for normalization of predecessor Horn formulas with diagonal input-output:
Step 1 is not modified. In step 2, the initialization clauses are now
x=y∧Qs(x)→Wsx(x,y) and x=y∧Qs(y)→Wsy(x,y) whereas the transport clauses are not modified.
Steps 3 to 5 and the recapitulation after step 5 are not modified either, except that now each initialization clause is of one of the three forms: 1) x=y∧Qs(x)→R(x,y);
2) min(x)∧η(y)→R(x,y), with η(y)∈{(¬)min(y),(¬)max(y)};
3) min(y)∧η(x)→R(x,y), with η(x)∈{(¬)min(x),(¬)max(x)}.
Steps 6 and 7 (folding of the domain) and the recapitulation after step 7 are not modified either, except that now each initialization clause has one of the only forms 1 and 2 above.
Step 8 (deleting max in the initialization clauses) can be easily adapted according to those initialization clauses whose forms after step 8 are now restricted to 1) x=y∧Qs(x)→R(x,y);
2) min(x)∧min(y)→R(x,y);
3) min(x)∧¬min(y)→R(x,y).
Clause 2 can be replaced by the equivalent clause 2’) x=y∧min(x)→R(x,y).
Step 9 (from initialization clauses to input clauses) is modified as follows.
Define the predicates Rmin(x), Rmin(y) and R¬min(y) by the initialization clauses4) x=y∧min(x)→Rmin(x)(x,y) and 5) x=y∧min(x)→Rmin(y)(x,y),
and the computation clauses
¬min(y)∧Rmin(x)(x,y−1)→Rmin(x)(x,y),
¬min(y)∧Rmin(y)(x,y−1)→R¬min(y)(x,y),
and ¬min(y)∧R¬min(y)(x,y−1)→R¬min(y)(x,y).
This allows to replace the initialization clause 3 by the computation clause
Rmin(x)(x,y)∧R¬min(y)(x,y)→R(x,y).
After those transformations all the initialization clauses are of the form x=y∧Qs(x)→R(x,y) (clause 1 above)
or x=y∧min(x)→R(x,y) (clauses 2’, 4 and 5 above).
By a separation in cases, it is easy to transform each of these clauses into an equivalent conjunction of input clauses of the required (normalized) forms:
x=y∧min(x)∧Qs(x)→R(x,y), or
x=y∧¬min(x)∧Qs(x)→R(x,y).
Step 10 (Elimination of atoms R(x,y) as hypotheses) and the end of the proof are the same as those for
pred-ESO-HORN. This achieves the proof of the equality
pred-dio-ESO-HORN=normal-pred-dio-ESO-HORN.
Lemma 1 is proved.
□
Proof of Lemma 2: Normalization of inclusion Horn formulas
It divides into seven steps.
1) Processing the contradiction clauses: Here again, we delay the contradiction and propagate the predicate R⊥ till the point (1,n) by the conjunction of the computation clauses x<y∧R⊥(x+1,y)→R⊥(x,y) and x<y∧R⊥(x,y−1)→R⊥(x,y) and of the unique contradiction clause
min(x)∧max(y)∧R⊥(x,y)→⊥.
2) Processing the input: We make available the letters of the input word on the only diagonal x=y by introducing new predicates Wsx+a and Wsy+a, for a∈Z, whose intuitive meaning is:
Wsx+a(x,y)⟺Qs(x+a)∧1≤x+a≤n (resp. Wsy+a(x,y)⟺Qs(y+a)∧1≤y+a≤n). They are inductively defined by the following clauses:
∙ Initialization clauses (on the diagonal):
x=y∧Qs(x)→Wsx(x,y); (x=y)∧Qs(x)→Wsy(x,y);
x=y∧Qs(x−a)∧x>a→Wsx−a(x,y), and
x=y∧Qs(x−a)∧x>a→Wsy−a(x,y), for a>0;
x=y∧Qs(y+a)∧y≤n−a→Wsx+a(x,y), and
x=y∧Qs(y+a)∧y≤n−a→Wsy+a(x,y), for a>0.
∙ Transport clauses, for a∈Z:
x<y∧Wsx+a(x,y−1)→Wsx+a(x,y), and
x<y∧Wsy+a(x+1,y)→Wsy+a(x,y).
This allows to replace each input atom Qs(x+a) (resp. Qs(y+a)), a∈Z, by the computation atom
Wsx+a(x,y) (resp. Wsy+a(x,y)), in all the clauses, except in the initialization clauses.
Note that after step 2 the atoms on input predicates Qs occur (see the initialization clauses above) always jointly with x=y and in the only three forms Qs(x), Qs(x−a) (jointly with x>a), or Q(y+a) (jointly with y≤n−a), for a>0.
3) Processing the min/max literals:
One may consider that the only literals on x involving min or max are of the forms
x=a, x>a, for an integer a≥1, or x=n−a, x<n−a, for a≥0, and similarly for y.
As we have done for the Qs, we want to make available the information about min and max, i.e., about extrema, on the only diagonal x=y. We introduce for that new computation predicates defined inductively:
Rx=a, Rx>a, for a≥1, and Rx=n−a, Rx<n−a, for a≥0, and similarly for y, with obvious intuitive meaning: for instance, Ry>a(x,y)⟺y>a.
For example, define the predicate Rx=a
(resp. Ry=a) by the two clauses x=y∧x=a→Rx=a(x,y) and x<y∧Rx=a(x,y−1)→Rx=a(x,y) (resp. x=y∧x=a→Ry=a(x,y) and x<y∧Ry=a(x+1,y)→Ry=a(x,y)). As another example, define Rx<n−a by the clauses x=y∧y<n−a→Rx<n−a(x,y) and x<y∧Rx<n−a(x,y−1)→Rx<n−a(x,y).
This allows to replace the “extremum” atoms x=a, x>a, x=n−a, x<n−a by the respective computation atoms Rx=a(x,y), Rx>a(x,y), Rx=n−a(x,y), Rx<n−a(x,y), in all the clauses, except in the initialization clauses and in the contradiction clause. And similarly for y.
The important fact is that after step 3, the predicate min (resp. max) only occurs in the form x=a or x>a (resp. in the form y=n−a or y<n−a) and always occurs jointly with x=y, i.e., is only used on the diagonal.
4) Restriction of computation atoms to R(x+1,y), R(x,y−1), and R(x,y): This is a variant of the similar step in the normalization of predecessor logics (step 3). We introduce now new “shift” predicates Rx+a, Ry−b and Rx+a,y−b, for fixed integers a,b>0 and R\leavevmode ∈\leavevmode R, with easy interpretation and definitions.
In particular, the intuitive interpretation of the predicate Rx+a,y−b is:
Rx+a,y−b(x,y)⟺x+a≤y−b∧R(x+a,y−b). As an example, the “normalized” clause x<y∧Sx+2,y−2(x+1,y)→Sx+3,y−2(x,y) defines the predicate
Sx+3,y−2 from the predicate Sx+2,y−2.
Recapitulation: After step 4, one may consider that each clause is of one of the following forms (1-3):
-
an initialization clause x=y∧δ→R(x,y), where δ is
either an input atom Qs(x),
or an equality x=a, for a fixed a≥1, or y=n−b, for a fixed b≥0,
or a conjunction Qs(x−a)∧x>a, or
Qs(y+b)∧y≤n−b, for a,b≥1;
2. 2.
a computation clause of one of the forms (a,b,c):
- (a)
x<y∧S(x+1,y)→R(x,y);
2. (b)
x<y∧S(x,y−1)→R(x,y);
3. (c)
x⪯y∧S(x,y)∧T(x,y)→R(x,y), where ⪯∈{<,=};
3. 3.
“the” contradiction clause
min(x)∧max(y)∧R⊥(x,y)→⊥,
which can be rephrased x=1∧y=n∧R⊥(x,y)→⊥.
Justification for initialization clauses: By separation in cases, one easily obtains the above three forms of initialization clauses.
Justification for computation clauses: Here again, “decompose” each computation clause in clauses of above forms (a,b,c) by introducing new intermediate predicates. For example, the computation clause
x<y∧R1(x+1,y)∧R2(x,y−1)→R3(x,y)
is “equivalent” to the conjunction of the following clauses using new predicates R4,R5:
x<y∧R1(x+1,y)→R4(x,y);
x<y∧R2(x,y−1)→R5(x,y);
x<y∧R4(x,y)∧R5(x,y)→R3(x,y).
Steps 5 and 6 that follow lie on a generalization of the method used in step 8 of the normalization of predecessor logics above (eliminating max in the initialization clauses). Roughly expressed, for any computation predicate
R∈R and a hypothesis η, we introduce a new predicate R←η whose intuitive meaning is:
R←η(x,y)⟺(η→R(x,y)).
**5) Elimination of equalities x=a (a≥1) and y=n−b (b≥0), except in the contradiction clause:**Let A (resp. B) be the maximum of the integers a (resp. b) that occur in the equalities x=a (resp. y=n−b) of the clauses.
For each R∈R, we introduce the new predicates R←x=a, R←y=n−b and
R←x=a,y=n−b, for all a∈[1,A] and b∈[0,B], whose intuitive meaning has been announced. For example, we should have R←x=a,y=n−b(x,y)⟺(x\leavevmode =\leavevmode a∧y=n−b→R(x,y)).
Transforming the initialization clauses: Each initialization clause x=y∧x=a→R(x,y)
(resp. x=y∧y=n−b→R(x,y)) is transformed into the clause x=y→R←x=a(x,y)
(resp. x=y→R←y=n−b(x,y)).
Transforming the computation clauses: To each clause (a) x<y∧S(x+1,y)→R(x,y) add the clauses
x<y∧S←x=a,y=n−b(x+1,y)→R←x=a−1,y=n−b(x,y), for all a∈[2,A] and b∈[0,B] (justification: the hypothesis x+1=a is equivalent to x=a−1).
Similarly, for each clause (b) x<y∧S(x,y−1)→R(x,y) add the clausesx<y∧S←x=a,y=n−b(x,y−1)→R←x=a,y=n−(b−1)(x,y), for all a∈[1,A] and b∈[1,B].
Also add for clauses (a,b) the similar (simplified) clauses with only one (instead of two) equality hypothesis.
For example, for clause (a) we add the clauses
x<y∧S←x=a(x+1,y)→R←x=a−1(x,y), for all a∈[2,A],
and x<y∧S←y=n−b(x+1,y)→R←y=n−b(x,y), for all b∈[0,B].
For each clause (c) x⪯y∧S(x,y)∧T(x,y)→R(x,y), where ⪯∈{<,=}, add clauses that cumulate the hypotheses provided they are compatible. More precisely, for all a∈[1,A] and b∈[0,B] and any two compatible (possibly empty) subsets η,θ of the set of two hypotheses {x=a,y=n−b}, we have the clause
x⪯y∧S←η(x,y)∧T←θ(x,y)→R←η∪θ(x,y).
For example,
x⪯y∧S←x=a(x,y)∧T←y=n−b(x,y)→R←x=a,y=n−b(x,y)
and x⪯y∧S←y=n−b(x,y)∧T←x=a,y=n−b(x,y)→R←x=a,y=n−b(x,y).
Processing the contradiction clause: The contradiction clause
is equivalent to
x=1∧y=n∧(x=1∧y\leavevmode =\leavevmode n→R⊥(x,y))→⊥. Consequently, it should be replaced by the clause
x=1∧y=n∧(R⊥)←x=1,y=n(x,y)→⊥, which is the contradiction clause required if the predicate (R⊥)←x=1,y=n is renamed R⊥.
6) Elimination of atoms Qs(x−a), Qs(y+b) (a,b>0):
This step is quite similar to previous step 5: it is described in the appendix.
Recapitulation: After step 6, all the initialization clauses are of the form x=y∧Qs(x)→R(x,y) as required777Note that an initialization clause of the form x=y→R(x,y) can be rewritten
⋀s∈Σ(x=y∧Qs(x)→R(x,y)) (separation in cases)..
7) Elimination of atoms R(x,y) as hypotheses: This step is exactly similar to the corresponding step 10 of normalizing predecessor logics.
This completes the proof of the equality
incl-ESO-HORN=normal-incl-ESO-HORN,
i.e., Lemma 2.
□
4 Equivalence between our logics and CA complexity classes
The communication scheme of real-time classes finds a natural expression in our normalized logics. The input clauses, the only clauses using unary predicates Qs, express the way the input is fed to the automaton. The computation clauses with a computation atom R(x,y), R∈R, as their conclusion simulate the computation of the CA. Deducing or not deducing the “false” by contradiction clauses means rejection or acceptance. Each of our normalized logics can be described graphically on a grid, indexed by [1,n]2 (see Figure 1).
Encoding automata states by predicates
The set R of predicates that will be used in formulas expressing the computation of an automaton A, with Q the set of its states, is R={Rq∣q∈Q}. The intuitive meaning of this predicates is the following: Rq(c,t) is true ⟺ the cell c is in the state q at time t.
Encoding predicates by automata states
Let Φ be a formula defining a language L, in one of our logics, of the form Φ=∃R∀x∀yψ(x,y) with R=(R1,…,Rm) and R1=R⊥. The set of states that will be used by an automaton A accepting L is Q={♯,λ}∪{0,1}m with ♯ the permanent state and λ the quiescent state. We denote by (q)i (i∈[1,m]), the ith bit of a state q∈{0,1}m. Intuitively, (q)i refers to the predicate Ri. Since the predicate R1=R⊥ represents the “false”, the set of accepting states is the set of states q∈{0,1}m with the first bit (q)1 equal to 0, that is Qaccept={0}×{0,1}m−1.
4.1 Logical characterization of RealTimeCA
In this section, we will show that the languages accepted in real-time by two-way CA with input fed in a parallel way and output read on the first cell are exactly the languages defined by a formula of pred-ESO-HORN.
Theorem 1**.**
RealTimeCA=pred-ESO-HORN
The proof will use the following inclusion scheme:
pred-ESO-HORN=normal-pred-ESO-HORN⊆RealTimeOIA
=RealTimeCA⊆pred-ESO-HORN
The equality pred-ESO-HORN=normal-pred-ESO-HORN has already been proved in Section 3 and the other equality RealTimeOIA=RealTimeCA is folklore in automata theory. Two inclusions are left to be proved.
Lemma 3**.**
RealTimeCA⊆pred-ESO-HORN
Proof.
We will show that for each automaton A∈RealTimeCA we can build a formula Φ∈pred-ESO-HORN such that:
w∈L(A)⟺⟨w⟩ satisfies the formula Φ.
First of all, one can be easily convinced that the computation power of a CA A∈RealTimeCA with neighborhood NA={−1,0,1} is equal to the computation power of a OCA A′ with neighborhood NA′={−2,−1,0} running within the same computation time n where n is the size of the input (see Figure 4). This transformation can be seen on the space-time diagram of A with the variable change: c↦c+t−1, where c is the index of the cell and t the time step of the computation. This geometrical transformation does not change the computation power so that: L(A)=L(A′).
Input: The parallel input of A′ is expressed by the conjunction ψinput=⋀s∈Σ(min(t)∧Qs(c)→Rs(c,t)) for Σ the input alphabet: each cell c is in the state wc∈Σ at the start of the computation.
Computation: The state evolution of a cell of A′ is given by the transition function:
⟨c,t⟩=δA′(⟨c−2,t−1⟩,⟨c−1,t−1⟩,⟨c,t−1⟩).
A transition rule δA′(q2,q1,q0)=q for q2=♯ is expressed by the computation clause:
c>t∧¬min(t)∧Rq2(c−2,t−1)∧Rq1(c−1,t−1)\linebreak∧Rq0(c,t−1)→Rq(c,t).
The specific case where q2 is the permanent state ♯ (δA′(♯,q1,q0)=q) is handled by the clause:
c=t∧¬min(t)∧Rq1(c−1,t−1)∧Rq0(c,t−1)→Rq(c,t).
We denote ψcompute the conjunction of the above two sets of clauses.
Remark: By construction of ψinput and ψcompute, we have the following equivalence for ψ′:=ψinput∧ψcompute.
The computation atom Rq(c,t) is true in the minimal model (⟨w⟩,R) of ∀c∀tψ′(c,t)
⟺ the cell c is in the state q at time t.
Output: The contradiction clauses express the output on the last cell:
ψoutput:=⋀q∈Q∖Qaccept(max(c)∧max(t)∧Rq(c,t)→⊥)
The formula ψ expressing the computation of A′ is the conjunction ψ:=ψ′∧ψoutput.
For each word w=w1…wn∈Σ+ we have the following equivalences:
The cell 1 of A is in an accepting state q at time n
⟺
The cell n of A′ is in an accepting state q at time n
⟺
The conjunction ⋀q∈Q∖QacceptRq(n,n) is false
in the minimal model (⟨w⟩,R) of ∀c∀tψ′(c,t)
⟺
⟨w⟩ satisfies the formula ∃R∀c∀tψ(c,t).
This proves L(A)∈pred-ESO-HORN.
∎
Lemma 4**.**
normal-pred-ESO-HORN⊆RealTimeOIA
Proof.
We will show that for every language L⊆Σ+ defined by a formula Φ∈normal-pred-ESO-HORN, a one-way iterative array A∈RealTimeOIA can be constructed such that L=L(A).
Let Φ∈normal-pred-ESO-HORN be a formula of the form Φ=∃R∀x∀yψ(x,y) where R=(R1,…,Rm) with R1=R⊥ and ψ is a conjunction of Horn clauses of the three following forms:
input clause of either form:
min(x)∧min(y)∧Qs(y)→R(x,y) or
min(x)∧¬min(y)∧Qs(y)→R(x,y),
the contradiction clause
max(x)∧max(y)∧R⊥(x,y)→⊥;
computation clause of one of the following forms for some sets H,H′⊆[1,m] and i∈[1,m]:
¬min(x)∧⋀h∈HRh(x−1,y)∧¬min(y)∧⋀h∈H′Rh(x,y−1)→Ri(x,y);
¬min(x)∧⋀h∈HRh(x−1,y)→Ri(x,y);
¬min(y)∧⋀h∈HRh(x,y−1)→Ri(x,y).
We will denote ψ′ the formula ψ without the contradiction clause.
We first translate the formula Φ into a dependency graph of type GRID1 (see Figure 1, with input exclusively on the left side). It will then be turned into a real-time OIA A.
The transition function is composed by an input transition function δinput only applied on the first cell and the general transition function δ applied on the other cells c.
For all i∈[1,m] ; s∈Σ ; q,l,r∈Q∖{♯,λ}:
Input transition function: δinput:Σ×Q→Q. The bit (δinput(s,♯))i is 1 if and only if there is an input clause min(x)∧min(y)∧Qs(y)→Ri(x,y) in ψ.
(δinput(s,q))i is 1 if and only if there exists in ψ an input clause min(x)∧¬min(y)∧Qs(y)→Ri(x,y) or a computation clause ¬min(y)∧⋀h∈HRh(x,y−1)→Ri(x,y)
with (q)h=1, for all h∈H.
Transition function: δ:Q×Q→Q applied on all cells c∈[2,n]. The bit (δ(l,r))i is 1
if and only if there exists in ψ a computation clause ⋀h∈HRh(x−1,y)∧¬min(x)∧⋀h∈H′Rh(x,y−1)∧¬min(y)→Ri(x,y) such that (l)h=1 for all h∈H and (r)h=1 for all h∈H′.
The bit (δ(l,λ))i is 1 if and only if there is in ψ a computation clause ¬min(x)∧⋀h∈HRh(x−1,y)→Ri(x,y) such that (l)h=1, for all h∈H.
Let A=(Q,Σ,Qaccept,N,δinput,δ) be the OIA defined above after making the change of variables of Figure 5:c=x; t=x+y−1.
By construction of A, we have the following equivalences concluding the proof.
∀w∈Σn:
-
∀(a,b)∈[1,n]2,∀i∈[1,m], the atom Ri(a,b) is true in the minimal model
(⟨w⟩,R) of ∀x∀yψ′(x,y) ⟺ The cell c=a is at time t=a+b−1 in a state q with (q)i=1.
2. 2.
A accepts w in real-time ⟺ ⟨w⟩ satisfies Φ.
∎
4.2 Logical characterization of RealTimeIA
In this section, we will show that the languages accepted in real-time by IA are exactly the languages defined by formulas of pred-dio-ESO-HORN.
Theorem 2**.**
RealTimeIA=pred-dio-ESO-HORN.
The proof of Theorem 2 is close to the one of Theorem 1 and is obtained by the following inclusion scheme:
pred-dio-ESO-HORN=normal-pred-dio-ESO-HORN
⊆RealTimeIA⊆pred-dio-ESO-HORN.
The equality pred-dio-ESO-HORN=normal-pred-dio-ESO-HORN has been already proved in Section 3. We will now prove the two remaining inclusions.
Lemma 5**.**
RealTimeIA⊆pred-dio-ESO-HORN.
Proof.
Let A be an automaton in RealTimeIA, we apply the transformation c↦c+t−1 on its time-space diagram. This transformation gives us a new automaton A′ with the neighborhood N′={−2,−1,0} and the input still fed sequentially but in the following way: the ith bit of the input is given to the cell i at time i.
Since the input presentation is the only change between the computation of an automaton in RealTimeIA and an automaton in RealTimeCA, the computation clauses and the contradiction clauses will stay the same.
Input: The diagonal input of A′ is expressed by the conjunction of the input clauses:
ψinput:=⋀s∈Σ(t=c∧Qs(c)→Rs(c,t)) for Σ⊂Q.
Computation: The conjunction ψcompute is defined from the transition rules of A′ as in the previous section.
Let ψ′ be the conjunction ψinput∧ψcompute.
Output: The output reading is done on the same cell as in the previous section.
ψoutput:=⋀q∈Q∖Qaccept(max(c)∧max(t)∧Rq(c,t)→⊥)
The formula ψ of pred-dio-ESO-HORN expressing the computation of A′ is: ψ:=ψ′∧ψoutput.
For each word w=w1…wn∈Σ+ we have the following equivalences:
The cell 1 of A is in an accepting state q at time n
⟺
The cell n of A′ is in an accepting state q at time n
⟺
The conjunction ⋀q∈Q∖QacceptRq(n,n) is false
in the minimal model (⟨w⟩,R) of ∀c∀tψ′(c,t)
⟺
⟨w⟩ satisfies the formula ∃R∀c∀tψ(c,t).
This proves L(A)∈pred-dio-ESO-HORN.
∎
Lemma 6**.**
normal-pred-dio-ESO-HORN⊆RealTimeIA
Proof sketch.
Since the proof is similar to that of Lemma 4, we will here just give an hint on how to associate to each site (x,y)∈[1,n]2 such that x≤y a site (c,t) of the space-time diagram of an iterative array A running in real-time (see Figure 6). The sites (x,y)∈[1,n]2 such that x≥y are similarly handled.
First, we apply to the set of sites (x,y) of the dependency graph of Φ the variable change c′=y−x+1;t′=x+y−1. This variable change turns respectively the dependencies (x−1,y)→(x,y) and (x,y−1)→(x,y) into (c′+1,t′−1)→(c′,t′) and (c′−1,t′−1)→(c′,t′) expressing the two-way communication of an iterative array A′. The sites (c′,t′) of the space-time diagram of A′ takes their values in [1,n]×[1,2n−1] and the ith bit of the input is fed on the site (1,2i−1) (see Figure 6).
In order to obtain the space-time diagram of an IA A running in real time, each site (c,t)=(⌈c′/2⌉,⌈t′/2⌉) of this diagram will record the set of sites {(c′−1,t′−1),(c′,t′),(c′+1,t′−1)} of the space-time diagram of A′, with c′ and t′ odd and greater than 1 (see Figure 6).
∎
4.3 Logical characterization of Trellis and linear conjunctive grammars
Conjunctive grammars, introduced by Okhotin [21], are an extension of context-free grammars. This class of formal grammars is obtained by allowing the use of a conjunction operator (denoted &) in the right side of the context-free rules, meaning an intersection between derived languages. It has been shown in [21] that languages obtained by the linear restriction of conjunctive grammars are the same as the ones recognized by trellis automata. The class of languages generated by linear conjunctive grammars is denoted LinConj.
Each rule of a linear conjunctive grammar G=(Σ,N,P,S) in normal form is a rule of the form:
A→sB1&…&sBℓ&C1t&…&Cpt or A→s
with ℓ+p≥1, A,Bi,Cj∈N and s,t∈Σ;
As a context-free language, a conjunctive language has an algebraic representation by least solution of a system of language equations with concatenation, union and intersection.
For example, the rule
A→sB1&…&sBℓ&C1t&…&Cpt
gives us the language equation:
L(A)=sL(B1)∩⋯∩sL(Bℓ)∩L(C1)t∩⋯∩L(Cp)t
where L(A) is the set of all words having the syntactic property A.
Our inclusive logic characterizes the class of (complements of) linear conjunctive languages:
Theorem 3**.**
*For any L∈Σ+ we have:
L∈incl-ESO-HORN ⟺ (Σ+∖L)∈LinConj .*
The theorem is proved in two steps.
Lemma 7**.**
L∈incl-ESO-HORN⇒(Σ+∖L)∈LinConj
Proof.
Let us show that for each language L∈incl-ESO-HORN defined by a formula Φ∈normal-incl-ESO-HORN, Φ=∃R∀x∀yψ(x,y), we can build a grammar GΦ=(Σ,N,P,S) such that: w∈L⟺w∈/L(GΦ)
The grammar GΦ is defined as follows.
The set of non-terminal symbols of GΦ is N=R and S=R⊥ is the start symbol. The rules of GΦ are the following:
To each input clause x=y∧Qs(x)→R(x,y) of Φ we associate the rule R→s.
To each computation clause of Φ
x<y∧S1(x+1,y)∧…∧Sℓ(x+1,y)∧T1(x,y−1)∧…∧Tp(x,y−1)→R(x,y)
we associate the rules
R→sS1&…&sSℓ&T1t&…&Tpt, for all s,t∈Σ.
Let ψ′ be the conjunction ψ without the contradiction clause.
By an easy induction, the following equivalence can be proved, for all R∈R, all words w=w1…wn∈Σ+, and all intervals [a,b]⊆[1,n]:
wa…wb∈L(R)⟺
(∀x∀yψ′∧⋀i∈[a,b]Qwi(i))→R(a,b) is a tautology.
Taking R=R⊥ and [a,b]=[1,n] we obtain:
w∈L(GΦ)⟺⟨w⟩⊭Φ as claimed.
∎
Lemma 8**.**
(Σ+∖L)∈LinConj⇒L∈incl-ESO-HORN
Proof.
Let L be a language, subset of Σ+, such that (Σ+∖L)∈LinConj.
We associate to the linear grammar G=(Σ,N,P,S) defining (Σ+∖L) with N={A1,…,Ak} in normal form, as presented above, the formula ΦG:=∃R∀x∀yψ(x,y) with R={A1,…,Ak} and ψ the conjunction of the following Horn clauses:
the computation clause
x<y∧Qs(x)∧⋀i=1ℓBi(x+1,y)∧\linebreak⋀i=1pCi(x,y−1)∧Qt(y)→A(x,y)
for each rule A→sB1&…&sBℓ&C1t&…&Cpt;
the clause x=y∧Qs(x)→A(x,y) for each rule A→s ;
and the contradiction clause min(x)∧max(y)∧S(x,y)→⊥.
The proof of the equivalence w∈L(G)⟺⟨w⟩⊨ΦG is the same as for the previous Lemma 7.
∎
Logical characterization of Trellis
Clearly, the final state (result) q of a trellis automaton A=(Q,Σ,Qaccept,δ) acting on a word wx…wy of length greater than 1 (x<y) is completely determined by the final state ql of A acting on the prefix wx…wy−1 and the final state qr of A acting on the suffix wx+1…wy: q=δ(ql,qr). This functional dependence ((x,y−1),(x+1,y))→(x,y) is exactly expressed by the computation clauses of the normalized inclusive logic. This suggests the following equality.
Theorem 4**.**
incl-ESO-HORN=Trellis
The theorem is proved in two steps.
Lemma 9**.**
Trellis⊆incl-ESO-HORN
Proof.
Let A be a trellis automaton that accepts a language L⊆Σ+ and let be a word w=w1…wn∈Σ+. Let us introduce the set of binary predicates R={Rq∣q∈Q} with intuitive meaning: Rq(x,y) is true ⟺ the final state of A acting on the subword wx…wy is q. The following clauses describe the computation of A.
Input clauses:
ψinput:=⋀s∈Σ(x=y∧Qs(x)→Rs(x,y)), for s∈Σ.
Computation clauses:
ψcompute:=⋀(ql,qr)∈Q2(x<y∧Rql(x,y−1)∧\linebreakRqr(x+1,y)→Rq(x,y)) where q=δ(ql,qr).
Contradiction clauses:
ψoutput:=⋀q∈Q∖Qaccept(min(x)∧max(y)∧Rq(x,y)→⊥)
Let ψ′:=ψinput∧ψcompute and ψ:=ψ′∧ψoutput.
For each word w=w1…wn∈Σ+ we have the following equivalences:
A accepts w in time n
⟺
The conjunction ⋀q∈Q∖QacceptRq(1,n) is false
in the minimal model (⟨w⟩,R) of ∀x∀yψ′(x,y)
⟺
⟨w⟩ satisfies the formula ∃R∀x∀yψ(x,y).
This proves L(A)∈incl-ESO-HORN.
∎
Lemma 10**.**
incl-ESO-HORN⊆Trellis
Proof sketch.
Let Φ be a formula of normal-incl-ESO-HORN, we establish a natural bijection between the sites (x,y) of the domain of the formula and the sites (c,t) of the space-time diagram of a OCA running in real-time (see Figure 7). The transition function of this automaton is then deduced from the computation clauses of Φ as in sections 4.1 and 4.2.
∎
5 Concluding remarks
It was known that the three complexity classes studied in this paper are the only distinct and natural complexity classes for minimal time, so-called real-time, of one-dimensional cellular automata. In various articles from the 1960s to 2000s, it has been established that each of those classes is robust, in particular with respect to the chosen neighborhood [18], and has several equivalent characterizations in other frameworks: e.g, Trellis is the class of linear conjunctive languages [21].
In this paper, we have presented a unified view of these three real-time classes as part of descriptive complexity. We hope to have convinced the reader that the logics we have defined are useful tools to express problems in a natural way and to deduce automatically from any formula in such a logic an equivalent cellular automaton running in real-time. This is exemplified by languages notBordered and Palindrome, which can be succinctly defined in pred-ESO-HORN and incl-ESO-HORN, respectively, and hence, belong to RealTimeCA and Trellis, respectively. Conversely, the problem Prime:={w∈Σ∗∣∣w∣ is a prime integer} belongs to RealTimeCA (and to RealTimeIA) by Fischer’s algorithm [6, 7]; therefore, it belongs to pred-ESO-HORN.
Further, we believe that the normalized versions of our three logics, identified to square grid circuits – a natural concept – offer a fresh view of the real-time complexity classes and an additional argument for their robustness.
In addition, we are thinking about broadening our logics by allowing a limited use of negation on computation atoms like in Stratified Datalog [10], for easier programming inside these logics and without changing their real-time complexity.
Acknowledgments:
This paper would not exist without the inspiration and guidance of Véronique Terrier. Her teaching, her deep insights into cellular automata, the references and advice she generously gave us, as well as her careful reading, were essential in designing and finalizing our concepts and results.
Appendix A: Expressing natural problems in our logics
Expressing problems Palindrome and notPalindrome in inclusion logic
The problem Palindrome is expressed by the conjunction of the following clauses:
x<y∧Qs(x)∧Qt(y)→notPal(x,y), for all s,t∈Σ with s=t;
x<y∧notPal(x+1,y−1)→notPal(x,y);
x≤y∧min(x)∧max(y)∧notPal(x,y)→⊥.
The problem notPalindrome is expressed by the conjunction of the following clauses:
x=y→Pal(x,y),
x≤y∧Successor(x,y)∧Qs(x)∧Qs(y)→Pal(x,y),
x<y∧Pal(x+1,y−1)∧Qs(x)∧Qs(y)→Pal(x,y), for all s∈Σ,
and x≤y∧Pal(x,y)→⊥.
Here, Successor(x,y) intuitively means x+1=y and is defined by the following clauses:
x=y→Equal(x,y)
and x<y∧Equal(x+1,y)→Successor(x,y).
Appendix B: Complements of the proofs of Lemmas 1 and 2
Step 10 of Lemma 1: Elimination of atoms R(x,y) as hypotheses:
The first idea is to group together in each computation clause the hypothesis atoms of the form R(x,y) and the conclusion of the clause. Accordingly, the formula obtained Φ can be rewritten in the form
Φ:=∃R∀x∀y[⋀iCi(x,y)∧⋀i∈[1,k](αi(x,y)→θi(x,y))],
where the Ci’s are the input clauses and the contradiction clause and each computation clause is written in the form αi(x,y)→θi(x,y) where
αi(x,y) is a conjunction of formulas of the only forms R(x−1,y)∧¬min(x), R(x,y−1)∧¬min(y), but not R(x,y),
and θi(x,y) is a Horn clause all the atoms of which are of the form R(x,y).
We number R1,…,Rm the computation predicates of R.
To each subset J⊆[1,k] of the family of implications
(αi(x,y)→θi(x,y))i∈[1,k] let us associate the set
KJ:={h∈[1,m]∣⋀i∈Jθi(x,y)→Rh(x,y) is a tautology}.
Note that the notion of tautology used in the definition of KJ is purely “propositional” because all the atoms involved are of the form Ri(x,y), i.e., refer to the same pair of variables (x,y). Also, note that the function J↦KJ is monotonous: for J′⊆J, we have KJ′⊆KJ because ⋀i∈J′θi(x,y)→Rh(x,y) implies ⋀i∈Jθi(x,y)→Rh(x,y).
Clearly, it is enough to prove the following claim:
Claim 1**.**
The formula Φ is equivalent to the normalized formula
[TABLE]
Proof of the implication Φ⇒Φ′: It is enough to prove the implication
[TABLE]
for all set J⊆[1,k]. The implication to be proved can be equivalently written:
[TABLE]
This implication is a straightforward consequence of the two following facts:
The sub-formula between brackets above implies the conjunction ⋀i∈Jθi(x,y). As the implication ⋀i∈Jθi(x,y)→⋀h∈KJRh(x,y) is a tautology (by definition of KJ), the implication to be proved is a tautology too.
The converse implication Φ′⇒Φ is more difficult to prove. It uses a folklore property of propositional Horn formulas easy to be proved:
Lemma 11** (Horn property: folklore).**
Let F be a strict Horn formula of propositional calculus, that is a conjunction of clauses of the form p1∧…∧pk→p0 where k≥0 and the pi’s are propositional variables. Let F′ be the conjunction of propositional variables q such that the implication F→q is a tautology. F has the same minimal model888For example,
for F:=p1∧p3∧(p1∧p3→p5)∧(p1∧p2→p4), we have F′:=p1∧p3∧p5 which has the same minimal model I as F; this model is given by I(p1)=I(p3)=I(p5)=1 and I(p2)=I(p4)=0. as F′.
Proof of the implication Φ′⇒Φ:
Let ⟨w⟩ be a model of Φ′ and let (⟨w⟩,R) be the minimal model of the Horn formula
[TABLE]
It is enough to show that (⟨w⟩,R) also satisfies the formula
[TABLE]
As each αi is a conjunction of formulas of the formR(x−1,y)∧¬min(x), or R(x,y−1)∧¬min(y),
we make an induction on the domain {(a,b)∈[1,n]2∣a+b≤t}, for t∈[1,2n].
More precisely, we are going to prove, by recurrence on the integer t∈[1,2n], that the minimal model (⟨w⟩,R) of φ′ satisfies the “relativized” formula φt of the formula φ defined by
[TABLE]
As the hypothesis x+y≤2n holds for all x,y in the domain [1,n], φ2n is equivalent to φ on the structure (⟨w⟩,R).
Basis case:
For t=1 the set {(a,b)∈[1,n]2∣a+b≤t} is empty so that the “relativized” formula φ1 is trivially true in the minimal model (⟨w⟩,R) of φ′.
Recurrence step: Suppose (⟨w⟩,R)⊨φt−1, for an integer t∈[2,2n].
It is enough to show that, for each couple (a,b)∈[1,n]2 such that a+b=t, we have
(⟨w⟩,R)⊨⋀i∈[1,k](αi(a,b)→θi(a,b)). Let Ja,b be the set of indices i∈[1,k] such that the couple (a,b) satisfies αi:
[TABLE]
Recall that each αi(a,b) is a (possibly empty) conjunction of atoms R(a′,b′) with (a′,b′)=(a−1,b) or (a′,b′)=(a,b−1), therefore such that a′+b′=t−1.
Let any set J⊆[1,k]. Let us examine the two possible cases:
-
J⊆Ja,b: then the conjunction ⋀i∈Jαi(a,b) holds in (⟨w⟩,R); hence, in (⟨w⟩,R), the conjunction
⋀h∈KJ(⋀i∈Jαi(a,b)→Rh(a,b)) is equivalent to
⋀h∈KJRh(a,b);
-
J∖Ja,b=∅: then the conjunction ⋀i∈Jαi(a,b) is false in (⟨w⟩,R);
hence, the conjunction ⋀h∈KJ(⋀i∈Jαi(a,b)→Rh(a,b)) holds in (⟨w⟩,R).
From (1) and (2), we deduce that in (⟨w⟩,R) the conjunction
⋀J⊆[1,k]⋀h∈KJ(⋀i∈Jαi(a,b)→Rh(a,b))
is equivalent to the conjunction
⋀J⊆Ja,b⋀h∈KJRh(a,b), which can be simplified as
⋀h∈KJa,bRh(a,b)
because J⊆Ja,b implies KJ⊆KJa,b.
Consequently, for all h∈[1,m], the minimal model (⟨w⟩,R) of the Horn formula
φ′ satisfies the atom Rh(a,b) iff h belongs to KJa,b.
By definition,
KJa,b:={h∈[1,m]∣⋀i∈Ja,bθi(x,y)→Rh(x,y) is a tautology}
or, equivalently,
KJa,b:={h∈[1,m]∣⋀i∈Ja,bθi(a,b)→Rh(a,b) is a tautology}.
As a consequence of Lemma 11, the two conjunctions ⋀i∈Ja,bθi(a,b)
and ⋀h∈KJa,bRh(a,b) have the same minimal model, which is also the restriction of the minimal model (⟨w⟩,R) of φ′ to the set of atoms Rh(a,b), for h∈[1,m].
Therefore, if i∈Ja,b, then (⟨w⟩,R)⊨θi(a,b).
If i∈[1,k]∖Ja,b, then we have
(⟨w⟩,R)⊨¬αi(a,b), by definition of Ja,b.
Therefore, for all i∈[1,k], we get
(⟨w⟩,R)⊨¬αi(a,b)∨θi(a,b).
In other words, for all (a,b) such that a+b=t:
[TABLE]
and then (⟨w⟩,R)⊨φt.
This concludes the inductive proof that (⟨w⟩,R)⊨φt, for all t∈[1,2n], and then ⟨w⟩⊨Φ. This proves the converse implication Φ′⇒Φ. Claim 1 is demonstrated.
□
General case of Lemma 1: Steps 1-6 are easy to adapt in the general case where the initial formula may contain hypotheses of the form R(y−b,x−a). The new points are the following:
Step 3 restricts the computation atoms to four forms: R(x,y), R(y,x), R(x−1,y) and R(x,y−1); the key point is the adaptation of step 7 (folding the domain) so that it eliminates the atoms of the form R(y,x). Without loss of generality, assume that each computation clause is of one of the following forms:
(a) S(x−1,y)∧¬min(x)→R(x,y);
(b) S(x,y−1)∧¬min(y)→R(x,y);
(c) S(x,y)∧T(x,y)→R(x,y);
(d) S(y,x)→R(x,y).
Here again, this is obtained by “decomposing” each computation clause into an “equivalent” conjunction of clauses using new intermediate predicates. For instance, the computation clause
R1(x−1,y)∧¬min(x)∧R2(x,y−1)\linebreak∧¬min(y)∧R3(y,x)
→R4(x,y)
is “equivalent” to the conjunction of the following clauses using the new predicates R5,R6,R7,R8:
R1(x−1,y)∧¬min(x)→R5(x,y);
R2(x,y−1)∧¬min(y)→R6(x,y);
R5(x,y)∧R6(x,y)→R7(x,y);
R3(y,x)→R8(x,y);
R7(x,y)∧R8(x,y)→R4(x,y).
The folding of clauses (a-c) is not modified.
Let us describe how to fold the (new) clauses (d): S(y,x)→R(x,y).
Obviously, such a clause is equivalent to the conjunction of the two clauses
(i) x≤y∧S(y,x)→R(x,y) and (ii) y≤x∧S(y,x)→R(x,y).
The equivalent “folded” form of clause (i) is x≤y∧Sinv(x,y)→R(x,y).
The clause (ii) is equivalent to the clause
x≤y∧S(x,y)→R(y,x)
the equivalent “folded” form of which is
x≤y∧S(x,y)→Rinv(x,y).
Finally, steps 8-10 are not modified.
Step 6 of Lemma 2: Elimination of atoms Qs(x−a), Qs(y+b), for a,b>0:
This step is quite similar to step 5. For each R∈R, we introduce new predicates:
R←s1,…,sl,t1,…,tmx−a1,…,x−al,y+b1,…,y+bm with l,m≥0, the si,tj∈Σ,
0≤a1<a2…<al≤A and 0≤b1<b2…<bm≤\leavevmode B,
where A (resp. B) is the maximal a in atoms Qs(x−a)
(resp. maximal b in atoms Qs(y+b)).
Their intuitive meaning is as follows:
R←s1,…,sl,t1,…,tmx−a1,…,x−al,y+b1,…,y+bm(x,y)⟺
[[⋀i=1,…,l(Qsi(x−ai)∧x>ai)
∧⋀j=1,…,m(Qtj(y+bj)∧y≤n−bj)]→R(x,y)].
Transforming the initialization clauses: Each initialization clause
x=y∧Qs(x−a)∧x>a→R(x,y), a≥1,
(resp. x=y∧Qs(y+b)∧y≤n−b→R(x,y), b≥1)
is transformed into the clause x=y∧R←,sx−a→R(x,y)
(resp. x=y∧R←,sy+b→R(x,y)).
Transforming the computation clauses: To each clause (a) x<y∧S(x+1,y)→R(x,y) add the following clauses justified by the identity x+1−ai=x−(ai−1):
x<y∧S←s1,…,sl,t1,…,tmx−a1,…,x−al,y+b1,…,y+bm(x+1,y)
→R←s1,…,sl,t1,…,tmx−(a1−1),…,x−(al−1),y+b1,…,y+bm(x,y).
Similarly, to each clause (b) x<y∧S(x,y−1)→R(x,y) add the clauses
x<y∧S←s1,…,sl,t1,…,tmx−a1,…,x−al,y+b1,…,y+bm(x,y−1)
→R←s1,…,sl,t1,…,tmx−a1,…,x−al,y+(b1−1),…,y+(bm−1)(x,y).
Moreover, add for a1=0 and each s1∈Σ, the following “verification” clauses, which intuitively delete the hypothesis
Qs1(x) after verifying that it is satisfied because of the equivalence Ws1x(x,y)⟺Qs1(x):
x<y∧S←s1,s2,…,sl,t1,…,tmx,x−a2,…,x−al,y+b1,…,y+bm(x,y)∧Ws1x(x,y)
→R←s2,…,sl,t1,…,tmx−a2,…,x−al,y+b1,…,y+bm(x,y).
Similarly, add for b1=0 and each t1∈Σ, the “verification” clauses (justified by Wt1y(x,y)⟺Qt1(y)) :
x<y∧S←s1,…,sl,t1,t2,…,tmx−a1,…,x−al,y,y+b2,…,y+bm(x,y)∧Wt1y(x,y)
→R←s1,…,sl,t2…,tmx−a1,…,x−al,y+b2,…,y+bm(x,y).
For each clause (c) x⪯y∧S(x,y)∧T(x,y)→R(x,y), where ⪯∈{<,=}, add similar clauses that cumulate the hypotheses provided they are compatible: for example, the clause
x⪯y∧Ss1,s2,t1x−1,x−3,y+2(x,y)∧Ts1,t1,t2x−1,y+2,y+4(x,y)
→Rs1,s2,t1,t2x−1,x−3,y+2,y+4(x,y).