On synthesizing Skolem functions for first order logic formulae
aa r X i v : . [ c s . L O ] F e b On synthesizing Skolem functions for first orderlogic formulae
S. Akshay
Indian Institute of Technology Bombay, India
Supratik Chakraborty
Indian Institute of Technology Bombay, India
Abstract
Skolem functions play a central role in logic, from eliminating quantifiers in first order logic formu-las to providing functional implementations of relational specifications. While classical results inlogic are only interested in their existence, the question of how to effectively compute them is alsointeresting, important and useful for several applications. In the restricted case of Boolean propos-itional logic formula, this problem of synthesizing Boolean Skolem functions has been addressed indepth, with various recent work focussing on both theoretical and practical aspects of the problem.However, there are few existing results for the general case, and the focus has been on heuristicalalgorithms.In this note, we undertake an investigation into the computational hardness of the problem ofsynthesizing Skolem functions for first order logic formula. We show that even under reasonableassumptions on the signature of the formula, it is impossible to compute or synthesize Skolemfunctions. Then we determine conditions on theories of first order logic which would render theproblem computable. Finally, we show that several natural theories satisfy these conditions andhence do admit effective synthesis of Skolem functions.
Theory of computation → Logic and verification
Keywords and phrases
Skolem functions, computability, first-order logic
The history of Skolem functions can be traced back to 1920, when the Norwegian mathem-atician, Thoralf Albert Skolem, gave a simplified proof of a landmark result in logic, nowknown as the
Löwenheim-Skolem theorem. Leopold Löwenheim had already proved thistheorem in 1915. However, Skolem’s 1920 proof was significantly simpler and made use ofa key observation:
For every first order logic formula ∃ y ϕ ( x, y ) , the choice of y that makes ϕ ( x, y ) true (if at all) depends on x in general. This dependence can be thought of as impli-citly defining a function that gives the “right” value of y for every value of x . If F denotesa fresh function symbol, the second order sentence ∃ F ϕ ( x, F ( x )) formalizes this dependenceexplicitly. Thus, the second order sentence ∃ F ∀ x (cid:0) ∃ y ϕ ( x, y ) ⇒ ϕ ( x, F ( x )) (cid:1) always holds. Since the implication trivially holds in the other direction too, we have ∃ F ∀ x (cid:0) ∃ y ϕ ( x, y ) ⇔ ϕ ( x, F ( x )) (cid:1) (1)is valid. Note the relation between the first order formulas ξ = ∃ y ϕ ( x, y ) and ξ = ϕ ( x, F ( x )):While ξ has one less existential quantifier than ξ , the signature of ξ has one morefunction symbol than the signature of ξ . Thus, an existential quantifier has been tradedoff, so to say, for a function symbol.Though ξ and ξ are not semantically equivalent, for every assignment of the free variable x , the formula ξ is satisfiable iff ξ is. On synthesizing Skolem functions for first order logic formulae
Every model M of ∀ x ξ can be augmented with an interpretation of F to yield a model M ′ of ∀ x ξ . Similarly, for every model M ′ of ∀ x ξ , restricting M ′ to the signature of ξ yields a model M of ∀ x ξ .The process of transforming ξ to ξ by eliminating ∃ y and substituting F ( x ) for y is aninstance of Skolemization. The fresh function symbol F introduced in the process is called aSkolem function. Skolem functions play a very important role in logic – both in theoreticalinvestigations and in practical applications. While it suffices in some (especially theoretical)studies to simply know that a Skolem function F exists, in other (especially practicallysignificant) cases, we require an algorithm that effectively computes F ( x ) for every x .This question of synthesizing Skolem functions has been studied in depth for the Booleansetting, i.e., quantified propositional logic, with an impressive array of recent results [10, 12,11, 7, 14, 17, 4, 15, 3, 1, 13, 2, 8]. Called the Boolean functional synthesis problem inthis setting, the problem is posed as given a Boolean relational specification, to synthes-ize Boolean Skolem functions that implement it. This problem has a wide-ranging set ofapplications [16] already from certified QBF to factorization to disjunctive decompositionof circuits. All known algorithms for the problem are exponential in the worst-case andin [3], it was also shown that the problem cannot have a sub-exponential algorithm unlesssome complexity-theoretic conjectures are falsified. Despite this, the practical performanceof algorithms on real benchmarks has led to questions about the structure of the input thatleads to this performance. This has resulted in investigations into knowledge representa-tions that give polytime synthesis algorithms [1] and still remains an active line of research.Thus the theoretical investigations have gone hand-in-hand with improved algorithms andunderstanding of the problem.Surprisingly, a similar theoretical treatment beyond this restricted Boolean setting seemslacking, despite the existence of several potential applications. In this paper, we movetowards closing this gap. We go beyond the Boolean setting and address the Skolem functionsynthesis problem in the full generality of first order logic. That is, does there always analgorithm to synthesize Skolem functions of quantified first order formulae? Unfortunately,our first result is to show that Skolem functions cannot be computed in general. We showthis by giving a reduction from the classical Post’s correspondance problem known to beundecidable. However, this impossibility result requires having an uninterpretted predicate.We then strengthen this result by showing that even if all predicates and function symbolsare interpretted, the problem continues to be intractable, by showing a novel reductionusing Diophantine sets. Given these impossibility results, we turn our attention to differentsubclasses of the first order logic (still beyond or incomparable to the propositional case)that are of interest. We establish sufficient conditions that classes must have for Skolemfunctions to be computable. We then exhibit several natural theories of first-order logic thatsatisfy these conditions and hence show that Skolem functions can be effectively synthesizedfor them. All this results in a nuanced picture of the computability landscape for the Skolemfunction synthesis problem. We hope that this work will be a starting point towards furtherresearch into the design of practical algorithms (when possible, i.e., within these subclasses)to synthesize Skolem functions for first order logic and its applications. We start by fixing some notations. We will use lower case English letters, e.g, x , y , z ,possibly with subscripts, to denote first order variables, and bold-faced upper case Englishletters, viz. X , Y , Z , to denote sequences of first order variables. Lower case Greek letters, . Akshay and S. Chakraborty 3 e.g., ϕ , ξ , α , possibly with subscripts, will be used to denote formulas. For a sequence X ,we use | X | to denote the count of variables in X , and x , . . . x | X | to denote the individualvariables in the sequence. With a slight abuse of notation, we also use | ϕ | to denote the sizeof the formula ϕ , represented using a suitable format (viz. as a string, syntax tree, directedacyclic graph etc.), when there is no confusion.For a quantifier Q ∈ {∃ , ∀} be a quantifier, we use Q X to denote the block of quantifiers Qx . . . Qx | X | . It is a standard exercise in logic to show that every well-formed first orderlogic formula can be transformed to a semantically equivalent prenex normal form , in whichall quantifiers appear to the left of the quantifier-free part of the formula. Without lossof generality, let ξ ( X ) ≡ ∃ Y ∀ Z ∃ U . . . ∀ V ∃ W ϕ ( X , Y , Z , U , . . . V , W ) be such a formulain prenex normal form, where X is a sequence of free variables and ϕ is a quantifier-freeformula. In case the leading (resp. trailing) quantifier in ξ is universal, we consider Y (resp. W ) to be the empty sequence. Given such a formula ξ , Skolemization refers to the processof transforming ξ to a new (albeit related) formula ξ ⋆ without any existential quantifiersvia the following steps: (i) for every existentially quantified variable, say a , in ξ , substitute F a ( X , S a ) for a in the quantifier-free formula ϕ , where F a is a new function symbol and S a is a sequence of universally quantified variables that appear to the left of a in the quantifierprefix of ξ , and (ii) remove all existential quantifiers from ξ . The functions F a introducedabove are called Skolem functions . In case ξ has no free variables, i.e. X is empty, theSkolem functions for variables y i in the leftmost existential quantifier block of ξ have noarguments (i.e. are nullary functions), and are also called Skolem constants . The sentence ξ ⋆ is said to be in Skolem normal form if the quantifier-free part of ξ ⋆ is in conjunctivenormal form. For notational convenience, let ∃ F denote the second order quantifier block ∃ F y . . . ∃ F y | Y | · · · ∃ F w . . . ∃ F w | W | that existentially quantifies over all Skolem functions in-troduced above. The key guarantee of Skolemization is that the second order sentence ∃ F ∀ X (cid:0) ξ ⇔ ξ ⋆ (cid:1) always holds. Note that substituting Skolem functions for existentiallyquantified variables need not always make the quantifier-free part of ξ , i.e. ϕ , evaluate totrue. This can happen, for example, if there are valuations of universally quantified variablesfor which no assignment of existentially qualified variables renders ϕ true. For every othervaluation of universally quantified variables, the Skolem functions indeed provide the “right”values of existentially quantified variables so that ϕ evaluates to true. ◮ Example 1.
Consider ξ ≡ ∃ y ∀ x ∃ z ∀ u ∃ v ϕ ( x, y, z, u, v ). On Skolemizing, we get ξ ⋆ ≡∀ x ∀ u ϕ ( x, C y , F z ( x ) , u, F v ( x, u )), where C y is a Skolem constant for y , and F z ( x ) and F v ( x, u )are Skolem functions for z and v respectively. As mentioned earlier, the focus of this article is on effective computation of Skolem functions.In other words, given a first order formula ξ , does there always exist a halting Turing machinethat computes each Skolem function appearing in a Skolemized version of ξ ? In general, sucha Turing machine (or algorithm) may need to evaluate predicate and function symbols thatappear in the signature of ξ as part of its computation. Therefore, the most appropriatenotion of computation in our context is that of relative computation or computation by oraclemachines . Formally, we define our problem of interest as follows: ◮ Definition 2.
Let P ξ and F ξ denote the set of predicate and function symbols respectively See [5] for a detailed exposition on relative computability.
On synthesizing Skolem functions for first order logic formulae in the signature of a first order logic formula ξ . Given oracles for interpretations of predicatesymbols in P ξ and of function symbols in F ξ , the Skolem function synthesis problem asks ifevery Skolem function F in a Skolemized version of ξ can be computed by a halting Turingmachine, say M Fξ , with access to these oracles. Note that we require M Fξ to depend only on ξ and F . However, the oracles that M Fξ accessescan depend on specific interpretations of predicate and function symbols. Our first result is that M Fξ does not always exist for every ξ and F . In other words, Skolemfunctions cannot be effectively computed in general, even in the relative sense mentionedabove. ◮ Theorem 3.
The Skolem function synthesis problem for first order logic is uncomputable,even if the signature has only a single unary uninterpreted predicate.
Proof.
We show a reduction from
Post’s Correspondence Problem ( PCP , in short) [9] – awell-known undecidable problem to solvability of the Skolem function synthesis problem. Aninstance π of PCP consists of a finite set Γ = { ( α , β ) , . . . ( α k , β k ) } , where α i and β i arefinite (possibly empty) strings over { , } . Solving the PCP instance π requires determiningif there exists a finite sequence of indices i i . . . i r with 1 ≤ i j ≤ k for all i j , such that α i · · · · · α i r = β i · · · · · β i r , where ’ · ’ denotes string concatenation. To reduce PCP to relativecomputation of Skolem functions, we consider the first-order sentence ξ ≡ ∃ y P ( y ), where P is a unary predicate symbol. Skolemizing ξ , we obtain P ( c ), where c is a Skolem constant.Now suppose, if possible, there exists a Turing machine M cξ with access to an oracle for P ,that always computes the value of c correctly. Given an instance π of PCP , we consider aninterpretation of P over the set of all finite strings over { , } . The corresponding oracle,denoted P π , returns “Yes” (or true) on input string u iff there exists a sequence of indices i , . . . i r with 1 ≤ i j ≤ i k for each i j , such that α i · · · · · α i r = β i · · · · · β i r = u .Since the length of u is finite, it is an easy exercise to show that the oracle P π can besimulated by a halting Turing machine, say M Pπ , without access to any oracle. Therefore, M cξ with access to oracle P π can be simulated by a halting Turing machine, denoted M cξ,π ,that needs no access to any oracle. We now design a Turing machine M PCP that takes asinput an instance π of PCP and works as follows: M PCP first writes the encoding of M cξ,π ona working tape and then runs a universal Turing machine to simulate M cξ,π . Since M cξ,π isa halting machine, the universal Turing machine must stop after computing a binary string,say c π , that serves as the value of the Skolem constant c . Subsequently, M PCP writes theencoding of M Pπ on a working tape and runs a universal Turing machine to simulate a run of M Pπ on the string c π . If the universal machine halts with output “Yes”, we know that thereexists a sequence of indices i , . . . i r such that α i · · · · · α i r = β i · · · · · β i r = c π . Otherwise,i.e. if the universal machine halts with output “No”, then since c π is the correct value of theSkolem constant c when the interpretation of P corresponds to the oracle P π , we know thatthere does not exist any sequence of indices i , . . . i r such that α i · · · · · α i r = β i · · · · · β i r .Therefore, the Turing machine M PCP decides
PCP – a mathematical impossibility! Thisimplies that our assumption was wrong, i.e. the machine M cξ cannot exist. ◭ The above argument shows that Skolem functions cannot be computed in general, evenif the signature has only a single unary uninterpreted predicate in the signature. But onemay then ask, what would happen if all predicates and functions are interpretted, viz. in . Akshay and S. Chakraborty 5 the theory of natural numbers with multiplication and addition. This seems a significantlysimpler and a natural question to consider. Our second result is that even in this case,Skolem functions cannot be computed. ◮ Theorem 4.
The Skolem function synthesis problem is uncomputable, even for first-orderlogic formulae with all predicates and functions being interpretted.
Proof.
The proof in this case appeals to the Matiyasevich-Robinson-Davis-Putnam (MRDP)theorem [6] that equates Diophantine sets with recursively enumerable sets. Formally, itstates:
A set of natural numbers is Diophantine if and only if it is recursively enumerable . Re-call that a set S of natural numbers is Diophantine if there exists a polynomial P ( x, y , . . . y k )with integer coefficients such that the Diophantine equation P ( x, y , . . . y k ) = 0 has a solu-tion in the unknowns y , . . . y k iff x ∈ S . Recall also that a set S is recursively enumerableif there exists a (potentially non-halting) Turing machine that outputs every element of S in some order, and only those elements. Now consider the set S halt of natural numberencodings of all Turing machines that halt on the empty tape. It is a well-known result incomputability theory [9] that S halt is recursively enumerable, although there is no Turingmachine that takes a natural number x as input and halts and correctly reports whether x ∈ S halt . By the MRDP theorem, recursive enumerability of S halt implies the existence ofa polynomial P halt ( x, y , . . . y k ) such that x ∈ S halt iff ∃ y , . . . y k ∈ N k P halt ( x, y , . . . y k ) = 0.We now consider the first order sentence ξ halt = ∀ x ∃ y . . . ∃ y k P halt ( x, y , . . . y k ) = 0. Notethat since P halt ( x, y , . . . y k ) is a polynomial, it can be written as a term in the first ordertheory of natural numbers with signature {× , + , , } . Furthermore, on Skolemizing, we get ξ ⋆ halt = ∀ x P halt ( x, f ( x ) , . . . f k ( x )), where f , . . . f k are unary Skolem functions. Suppose, ifpossible, there exist Turing machines M halt through M k halt that take x ∈ N as input, andalways halt and compute the values of f ( x ) through f k ( x ) respectively. Given x ∈ N , wecan then use M halt through M k halt to compute the values of f ( x ) , . . . f k ( x ), and determine if P halt ( x, f ( x ) , . . . f k ( x )) = 0. If so, we know that x ∈ S halt ; otherwise x S halt . This givesan algorithm (or halting Turing machine) to determine if any natural number x ∈ S halt – animpossibility! Hence, there cannot exist Turing machines M halt through M k halt that computethe Skolem functions f ( x ) through f k ( x ), even when the domain and interpretation of allpredicates and symbols is pre-determined. ◭ In light of the above results, we cannot hope to have generic algorithms that synthesizeSkolem functions for first order logic formula unlike for propositional formula. However, itturns out that Skolem functions can indeed be computed for formulas in several interestingfirst order theories. To do this, we identify the properties that a theory must have in orderto allow for algorithms that synthesize Skolem functions effectively. ◮ Theorem 5.
Every first order theory that is (i) decidable, (ii) has a recursively enumerabledomain, and (iii) has computable interpretations of predicates and functions, admits effectivecomputation of Skolem functions.
Proof.
Fix a first order theory T satisfying the above premises and consider a well-formedformula of the form ξ ≡ ∀ Z ∃ y ξ ( X, Z, y ) in this theory, where X is a sequence of freevariables, and Z is a sequence of universally quantified variables. On Skolemizing, we get ξ ⋆ ≡ ∀ Z ξ ( X, Z, f ( X, Z )), where f is a Skolem function of arity | X | + | Z | . We can nowdesign a Turing machine (or algorithm) M that takes any | X | + | Z | -tuple of elements from D , say σ , as input and halts after computing f ( σ ). The Turing machine M works as follows: On synthesizing Skolem functions for first order logic formulae (a) It first determines if ∃ y ξ ( σ, y ) holds. Since the theory T is decidable, this is indeedpossible.(b) If the answer to the above question is “Yes”, the machine M recursively enumerates theelements of D , and for each element n thus enumerated, it checks if ξ ( σ, n ) evaluates totrue. Once again, decidability of T ensures that the latter check can be effectively done.The machine M outputs the first (in recursive enumeration order) element n of D forwhich ξ ( σ, n ) is true, and halts.(c) If the answer to the question in (a) is “No”, i.e. there is no n ∈ D such that ξ ( σ, n ) istrue, the Turing machine outputs the first (in recursive enumeration order) element of D and halts.It is easy to verify that the function f computed by M satisfies ∀ Z (cid:0) ∃ y ξ ( X, Z, y ) ⇔ ξ ( X, Z, f ( X, Z )) (cid:1) for every valuation of the free variables X in D | X | . As we will seeshortly, the ability to compute Skolem functions arising from first order sentences of theform ∀ Z ∃ y ξ ( X, Z, y ) suffices to compute Skolem functions arising from arbitrary first ordersentences. Therefore, the above argument shows that Skolem functions can be effectivelycomputed for all sentences in decidable first order theories with recursively enumerable do-mains. ◭ And from this we can derive the following corollary. ◮ Corollary 6.
The Skolem function synthesis problem is effectively computable for followingtheories: the theory of dense linear order without endpoints, Presburger arithmetic, linear rational arithmetic, first order theories with bounded domain (of which the Boolean case is a special case). Proof.
We only show 1. here. The others follow easily from known results. For this, westart by observing that every countable dense linear order without endpoints is isomorphic to( Q , < ). The domain is clearly countable and the interpretations of predicates is computable.To show decidability, we note that the theory of dense linear order without endpoints ischaracterized by the following axioms:Linear order: ∀ x ∀ y (cid:0) ( x < y ) ∨ ( y < x ) ∨ ( x = y ) (cid:1) Non reflexive: ∀ x ¬ ( x < x )Transitivity: ∀ x ∀ y ∀ z (cid:0) ( x < y ) ∧ ( y < z ) ⇒ ( x < z ) (cid:1) No high end point: ∀ x ∃ y ( x < y )No low end point: ∀ x ∃ y ( y < x )Dense: ∀ x ∀ y (cid:0) ( x < y ) ⇒ ∃ z (( x < z ) ∧ ( z < y )) (cid:1) This theory is ℵ -categorical and therefore by Lós-Vaught test, it is complete. Therefore,for every sentence ξ in the theory, either ξ or ¬ ξ (but not both) is a logical consequence of theaxioms. Given a sentence ξ , we can therefore decide if the axioms entail ξ or ¬ ξ (interleavetwo proofs, one for entailment of ξ and the other for entailment of ¬ ξ – one of them musthalt and provide a proof). Also, ( Q , < ) is the only countable model of the theory. ◭ Whenever Skolem functions are computable, e.g., in all the above theories, one canfurther ask:
Can Skolem functions be represented as terms in the underlying logical theory?
It is easy to see that a positive answer to this question implies an effective procedure forquantifier elimination. We also know that some theories, viz. (countable) dense linear orderwithout endpoints, do not admit quantifier elimination. Therefore, we obtain: . Akshay and S. Chakraborty 7 ◮ Proposition 7.
There exist first order theories for which Skolem functions can be effectivelycomputed, but are not expressible as terms in the underlying logical theory.
The study of algorithmic computation of Skolem functions is highly nuanced. In this note,we observed that for first-order logic it is in fact uncomputable even when all predicatesand functions are interpretted. However, our sufficient conditions of computability meanthat there are large subclasses, i.e., first order theories where computability itself is not anissue. However, this does not necessarily translate to expressibility of Skolem functions inthe underlying logic. Neither does it automatically imply existence of efficient algorithms.indeed, even in the Boolean setting several computational hardness results are known eventhough the problem is easily computable. We leave the characterization of these issues anddevelopment of efficient algorithms for Skolem function synthesis for these theories of firstorder logic as intriguing directions for future research.
References S. Akshay, J. Arora, S. Chakraborty, S. Krishna, D. Raghunathan, and S. Shah. Knowledgecompilation for boolean functional synthesis. In
Formal Methods in Computer Aided Design,FMCAD 2019, San Jose, CA, USA , 2019. S. Akshay, S. Chakraborty, S. Goel, S. Kulal, and S. Shah. Boolean functional synthesis:hardness and practical algorithms.
Form Methods Syst Des. , 2020. S. Akshay, Supratik Chakraborty, Shubham Goel, Sumith Kulal, and Shetal Shah. How hardis boolean functional synthesis. In
In CAV 2018 Proceedings , 2018. S. Akshay, Supratik Chakraborty, Ajith K. John, and Shetal Shah. Towards parallel booleanfunctional synthesis. In
TACAS 2017 Proceedings, Part I , pages 337–353, 2017. Sanjeev Arora and Boaz Barak.
Computational Complexity: A Modern Approach . CambridgeUniversity Press, USA, 1st edition, 2009. Martin Davis, Yuri Matijasevic, and Julia Robinson. Hilbert’s tenth problem. diophantineequations: positive aspects of a negative solution. In
Proceedings of symposia in pure math-ematics , volume 28, pages 323–378, 1976. Dror Fried, Lucas M. Tabajara, and Moshe Y. Vardi. BDD-based boolean functional synthesis.In
Computer Aided Verification - 28th International Conference, CAV 2016, Toronto, ON,Canada, July 17-23, 2016, Proceedings, Part II , pages 402–421, 2016. Priyanka Golia, Subhajit Roy, and Kuldeep S. Meel. Manthan: A data-driven approach forboolean function synthesis. In
Proceedings of International Conference on Computer-AidedVerification (CAV) , 7 2020. John E. Hopcroft, Rajeev Motwani, and Jeffrey D. Ullman.
Introduction to Automata Theory,Languages, and Computation (3rd Edition) . Addison-Wesley Longman Publishing Co., Inc.,USA, 2006. J.-H. R. Jiang. Quantifier elimination via functional composition. In
Proc. of CAV , pages383–397. Springer, 2009. A. John, S. Shah, S. Chakraborty, A. Trivedi, and S. Akshay. Skolem functions for factoredformulas. In
FMCAD , pages 73–80, 2015. Martina Seidl Marijn Heule and Armin Biere. Efficient Extraction of Skolem Functions fromQRAT Proofs. In
Formal Methods in Computer-Aided Design, FMCAD 2014, Lausanne,Switzerland, October 21-24, 2014 , pages 107–114, 2014. Markus N. Rabe. Incremental determinization for quantifier elimination and functional syn-thesis. In
Computer Aided Verification - 31st International Conference, CAV 2019, New YorkCity, NY, USA, July 15-18, 2019, Proceedings, Part II , pages 84–94, 2019.
On synthesizing Skolem functions for first order logic formulae Markus N. Rabe and Sanjit A. Seshia. Incremental determinization. In
Theory and Applica-tions of Satisfiability Testing - SAT 2016 - 19th International Conference, Bordeaux, France,July 5-8, 2016, Proceedings , pages 375–392, 2016. Markus N. Rabe, Leander Tentrup, Cameron Rasmussen, and Sanjit A. Seshia. Understandingand extending incremental determinization for 2QBF. In
Computer Aided Verification - 30thInternational Conference, CAV 2018, Held as Part of the Federated Logic Conference, FloC2018, Oxford, UK, July 14-17, 2018, Proceedings, Part II , pages 256–274, 2018. A. Shukla, A. Bierre, M. Siedl, and L. Pulina. A survey on applications of quantified booleanformula. In
Proceedings of the Thirty-First International Conference on Tools with ArtificialIntelligence (ICTAI) , pages 78–84, 2019. Lucas M. Tabajara and Moshe Y. Vardi. Factored boolean functional synthesis. In2017Formal Methods in Computer Aided Design, FMCAD 2017, Vienna, Austria, October 2-6,2017