Fixed-point logic

From HandWiki

In mathematical logic, fixed-point logics are extensions of classical predicate logic that have been introduced to express recursion. Their development has been motivated by descriptive complexity theory and their relationship to database query languages, in particular to Datalog. Least fixed-point logic was first studied systematically by Yiannis N. Moschovakis in 1974,[1] and it was introduced to computer scientists in 1979, when Alfred Aho and Jeffrey Ullman suggested fixed-point logic as an expressive database query language.[2]

Partial fixed-point logic

For a relational signature X, FO[PFP](X) is the set of formulas formed from X using first-order connectives and predicates, second-order variables as well as a partial fixed point operator [math]\displaystyle{ \operatorname{PFP} }[/math] used to form formulas of the form [math]\displaystyle{ [\operatorname{PFP}_{\vec{x},P} \varphi]\vec{t} }[/math], where [math]\displaystyle{ P }[/math] is a second-order variable, [math]\displaystyle{ \vec{x} }[/math] a tuple of first-order variables, [math]\displaystyle{ \vec{t} }[/math] a tuple of terms and the lengths of [math]\displaystyle{ \vec{x} }[/math] and [math]\displaystyle{ \vec{t} }[/math] coincide with the arity of [math]\displaystyle{ P }[/math].

Let k be an integer, [math]\displaystyle{ x, y }[/math] be vectors of k variables, P be a second-order variable of arity k, and let φ be an FO(PFP,X) function using x and P as variables. We can iteratively define [math]\displaystyle{ (P_i)_{i\in N} }[/math] such that [math]\displaystyle{ P_0(x)=false }[/math] and [math]\displaystyle{ P_i(x)=\varphi(P_{i-1},x) }[/math] (meaning φ with [math]\displaystyle{ P_{i-1} }[/math] substituted for the second-order variable P). Then, either there is a fixed point, or the list of [math]\displaystyle{ (P_i) }[/math]s is cyclic.[3]

[math]\displaystyle{ [\operatorname{PFP}_{P,x} \varphi (y)] }[/math] is defined as the value of the fixed point of [math]\displaystyle{ (P_i) }[/math] on y if there is a fixed point, else as false.[4] Since Ps are properties of arity k, there are at most [math]\displaystyle{ 2^{n^k} }[/math] values for the [math]\displaystyle{ P_i }[/math]s, so with a polynomial-space counter we can check if there is a loop or not.[5]

It has been proven that on ordered finite structures, a property is expressible in FO(PFP,X) if and only if it lies in PSPACE.[6]

Least fixed-point logic

Since the iterated predicates involved in calculating the partial fixed point are not in general monotone, the fixed-point may not always exist. FO(LFP,X), least fixed-point logic, is the set of formulas in FO(PFP,X) where the partial fixed point is taken only over such formulas φ that only contain positive occurrences of P (that is, occurrences preceded by an even number of negations). This guarantees monotonicity of the fixed-point construction (That is, if the second order variable is P, then [math]\displaystyle{ P_i(x) }[/math] always implies [math]\displaystyle{ P_{i+1}(x) }[/math]).

Due to monotonicity, we only add vectors to the truth table of P, and since there are only [math]\displaystyle{ n^k }[/math] possible vectors we will always find a fixed point before [math]\displaystyle{ n^k }[/math] iterations. The Immerman-Vardi theorem, shown independently by Immerman[7] and Vardi,[8] shows that FO(LFP,X) characterises P on all ordered structures.

The expressivity of least-fixed point logic coincides exactly with the expressivity of the database querying language Datalog, showing that, on ordered structures, Datalog can express exactly those queries executable in polynomial time.[9]

Inflationary fixed-point logic

Another way to ensure the monotonicity of the fixed-point construction is by only adding new tuples to [math]\displaystyle{ P }[/math] at every stage of iteration, without removing tuples for which [math]\displaystyle{ P }[/math] no longer holds. Formally, we define [math]\displaystyle{ \operatorname{IFP}(\phi_{P,x}) }[/math] as [math]\displaystyle{ \operatorname{PFP}(\psi_{P,x}) }[/math] where [math]\displaystyle{ \psi(P,x)=\phi(P,x)\vee P(x) }[/math].

This inflationary fixed-point agrees with the least-fixed point where the latter is defined. Although at first glance it seems as if inflationary fixed-point logic should be more expressive than least fixed-point logic since it supports a wider range of fixed-point arguments, in fact, every FO[IFP](X)-formula is equivalent to an FO[LFP](X)-formula.[10]

Simultaneous induction

While all the fixed-point operators introduced so far iterated only on the definition of a single predicate, many computer programs are more naturally thought of as iterating over several predicates simultaneously. By either increasing the arity of the fixed-point operators or by nesting them, every simultaneous least, inflationary or partial fixed-point can in fact be expressed using the corresponding single-iteration constructions discussed above.[11]

Transitive closure logic

Rather than allow induction over arbitrary predicates, transitive closure logic allows only transitive closures to be expressed directly.

FO[TC](X) is the set of formulas formed from X using first-order connectives and predicates, second-order variables as well as a transitive closure operator [math]\displaystyle{ \operatorname{TC} }[/math] used to form formulas of the form [math]\displaystyle{ [\operatorname{TC}_{\vec{x},\vec{y}} \varphi]\vec{s}\vec{t} }[/math], where [math]\displaystyle{ \vec{x} }[/math] and [math]\displaystyle{ \vec{y} }[/math] are tuples of pairwise distinct first-order variables, [math]\displaystyle{ \vec{t} }[/math] and [math]\displaystyle{ \vec{s} }[/math] tuples of terms and the lengths of [math]\displaystyle{ \vec{x} }[/math], [math]\displaystyle{ \vec{y} }[/math], [math]\displaystyle{ \vec{s} }[/math] and [math]\displaystyle{ \vec{t} }[/math] coincide.

TC is defined as follows: Let k be a positive integer and [math]\displaystyle{ u,v,x,y }[/math] be vectors of k variables. Then [math]\displaystyle{ \mathsf{TC}(\phi_{u,v})(x,y) }[/math] is true if there exist n vectors of variables [math]\displaystyle{ (z_i) }[/math] such that [math]\displaystyle{ z_1=x, z_n=y }[/math], and for all [math]\displaystyle{ i\lt n }[/math], [math]\displaystyle{ \phi(z_i,z_{i+1}) }[/math] is true. Here, φ is a formula written in FO(TC) and [math]\displaystyle{ \phi(x,y) }[/math] means that the variables u and v are replaced by x and y.

Over ordered structures, FO[TC] characterises the complexity class NL.[12] This characterisation is a crucial part of Immerman's proof that NL is closed under complement (NL = co-NL).[13]

Deterministic transitive closure logic

FO[DTC](X) is defined as FO(TC,X) where the transitive closure operator is deterministic. This means that when we apply [math]\displaystyle{ \operatorname{DTC}(\phi_{u,v}) }[/math], we know that for all u, there exists at most one v such that [math]\displaystyle{ \phi(u,v) }[/math].

We can suppose that [math]\displaystyle{ \operatorname{DTC}(\phi_{u,v}) }[/math] is syntactic sugar for [math]\displaystyle{ \operatorname{TC}(\psi_{u,v}) }[/math] where [math]\displaystyle{ \psi(u,v)=\phi(u,v)\wedge \forall x (x=v \vee \neg \phi(u,x)) }[/math].

Over ordered structures, FO[DTC] characterises the complexity class L.[12]

Iterations

The fixed-point operations that we defined so far iterate the inductive definitions of the predicates mentioned in the formula indefinitely, until a fixed point is reached. In implementations, it may be necessary to bound the number of iterations to limit the computation time. The resulting operators are also of interest from a theoretical point of view since they can also be used to characterise complexity classes.

We will define first-order with iteration, [math]\displaystyle{ \mathsf{FO}[t(n)] }[/math]; here [math]\displaystyle{ t(n) }[/math] is a (class of) functions from integers to integers, and for different classes of functions [math]\displaystyle{ t(n) }[/math] we will obtain different complexity classes [math]\displaystyle{ \mathsf{FO}[t(n)] }[/math].

In this section we will write [math]\displaystyle{ (\forall x P) Q }[/math] to mean [math]\displaystyle{ (\forall x (P\Rightarrow Q)) }[/math] and [math]\displaystyle{ (\exists x P) Q }[/math] to mean [math]\displaystyle{ (\exists x (P \wedge Q)) }[/math]. We first need to define quantifier blocks (QB), a quantifier block is a list [math]\displaystyle{ (Q_1 x_1, \phi_1)...(Q_k x_k, \phi_k) }[/math] where the [math]\displaystyle{ \phi_i }[/math]s are quantifier-free FO-formulae and [math]\displaystyle{ Q_i }[/math]s are either [math]\displaystyle{ \forall }[/math] or [math]\displaystyle{ \exists }[/math]. If Q is a quantifiers block then we will call [math]\displaystyle{ [Q]^{t(n)} }[/math] the iteration operator, which is defined as Q written [math]\displaystyle{ t(n) }[/math] time. One should pay attention that here there are [math]\displaystyle{ k*t(n) }[/math] quantifiers in the list, but only k variables and each of those variable are used [math]\displaystyle{ t(n) }[/math] times.[14]

We can now define [math]\displaystyle{ \mathsf{FO}[t(n)] }[/math] to be the FO-formulae with an iteration operator whose exponent is in the class [math]\displaystyle{ t(n) }[/math], and we obtain the following equalities:

  • [math]\displaystyle{ \mathsf{FO}[(\log n)^i] }[/math] is equal to FO-uniform ACi, and in fact [math]\displaystyle{ \mathsf{FO}[t(n)] }[/math] is FO-uniform AC of depth [math]\displaystyle{ t(n) }[/math].[15]
  • [math]\displaystyle{ \mathsf{FO}[(\log n)^{O(1)}] }[/math] is equal to NC.[16]
  • [math]\displaystyle{ \mathsf{FO}[n^{O(1)}] }[/math] is equal to PTIME. It is also another way to write FO(IFP).[17]
  • [math]\displaystyle{ \mathsf{FO}[2^{n^{O(1)}}] }[/math] is equal to PSPACE. It is also another way to write FO(PFP). [18]

Notes

  1. Moschovakis, Yiannis N. (1974). "Elementary Induction on Abstract Structures". Studies in Logic and the Foundations of Mathematics 77. doi:10.1016/s0049-237x(08)x7092-2. ISBN 9780444105370. ISSN 0049-237X. http://dx.doi.org/10.1016/s0049-237x(08)x7092-2. 
  2. Aho, Alfred V.; Ullman, Jeffrey D. (1979). "Universality of data retrieval languages". Proceedings of the 6th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages - POPL '79 (New York, New York, USA: ACM Press): 110–119. doi:10.1145/567752.567763. 
  3. Ebbinghaus and Flum, p. 121
  4. Ebbinghaus and Flum, p. 121
  5. Immerman 1999, p. 161
  6. Abiteboul, S.; Vianu, V. (1989). "Fixpoint extensions of first-order logic and datalog-like languages". [1989] Proceedings. Fourth Annual Symposium on Logic in Computer Science. IEEE Comput. Soc. Press. pp. 71–79. doi:10.1109/lics.1989.39160. ISBN 0-8186-1954-6. http://dx.doi.org/10.1109/lics.1989.39160. 
  7. Immerman, Neil (1986). "Relational queries computable in polynomial time" (in en). Information and Control 68 (1–3): 86–104. doi:10.1016/s0019-9958(86)80029-8. 
  8. Vardi, Moshe Y. (1982). "The complexity of relational query languages (Extended Abstract)". Proceedings of the fourteenth annual ACM symposium on Theory of computing - STOC '82. New York, NY, USA: ACM. pp. 137–146. doi:10.1145/800070.802186. ISBN 978-0897910705. 
  9. Ebbinghaus and Flum, p. 242
  10. Ebbinghaus and Flum, p. 173
  11. Ebbinghaus and Flum, pp. 179, 193
  12. 12.0 12.1 Immerman, Neil (1983). "Languages which capture complexity classes". Proceedings of the fifteenth annual ACM symposium on Theory of computing - STOC '83. New York, New York, USA: ACM Press. pp. 347–354. doi:10.1145/800061.808765. ISBN 0897910990. http://dx.doi.org/10.1145/800061.808765. 
  13. Immerman, Neil (1988). "Nondeterministic Space is Closed under Complementation". SIAM Journal on Computing 17 (5): 935–938. doi:10.1137/0217058. ISSN 0097-5397. http://dx.doi.org/10.1137/0217058. 
  14. Immerman 1999, p. 63
  15. Immerman 1999, p. 82
  16. Immerman 1999, p. 84
  17. Immerman 1999, p. 58
  18. Immerman 1999, p. 161

References