T h e Semi-Uni f ica t ion P r o b l e m ( S U P ) is a na tu ral gene ra l i za t ion of b o t h f i rs t -order uni f ica t ion and m a t c h i n g . T h e p rob lem arises in var ious b r anches of c o m p u t e r science and logic. Alt h o u g h several special cases of SU P are known to be decidable , t he p rob lem in general has been open for several years. We show t h a t SUP in general is undecidable, by reducing what we call the "boundedness problem" of Turing machines to SUP. The undecidability of this boundedness problem is established by a technique developed in the mid-1960's to prove related results about Turing machines, 1 I n t r o d u c t i o n Let E be a first-order signature, X a countably infinite set of variables, and 7" the set of all terms over E and X. An instance F of Semi-Unification is a finite set of *This work is part ly supported by NSF grant CCR-8901647 and by a grant of the Polish Ministry of National Education, No. RP.I.09. inequalities: r = {tl < u l , . . . , ~ < u~} where tl, u/ E 7". A substitution is a function S : X ---* 7". Every substitution extends in a natural way to a P.-homomorphism S : 7" ---, 7". A substitution S is a solution of the instance F iff there are substitutions $1, . . . , S,~ such that: sl(s(~l)) = s ( ~ l ) , . . . , & ( s ( ~ , ) ) = s ( ~ ) The Semi-Unification Problem (henceforth abbreviated SUP) is the problem of deciding, for any instance P, whether £ has a solution. Permission to copy without fee all or part of this material is granted provided that the copies are not made or distributed for direct commercial advantage, the ACM copyright notice and the title of the publication and its date appear, and notice is given that copying is by permission of the Association for Computing Machinery. To copy otherwise, or to republish, requires a fee and/or specific permission. © 1990 ACM 089791-361-2/90/0005/0468 $1.50 468 Problems in several branches of computer science and logic give rise to SUP, or to special cases of SUP, or to generalizations of SUP. For example: (1) A sufficient condition for a rewrite rule to be nonterminating can be formulated as an instance of SUP with exactly one inequality (see [8, 18]). (2) The typability problem for the polymorphic functional language M L can be shown to be log-space equivalent to a special case of SUP where every instance satisfies a certain acyclicity condition (see [11]). (3) The typabitity problem for extensions of M L that allow polymorphic recursion (see [5, 10, 12, 15]), as well as the typability problem for certain fragments of the polymorphic k-calculus augmented with constants (see [9]), can be shown to be logspace equivalent to SUP in general. (4) In proof theory, a strengthened version of a conjecture due to Kreisel, stated as: "There exists a computable function f such that if Peano Arithmetic proves A(0('*)) in k steps for all n <_ f(k , A), where 0('*) is the n-th natural number, then it also proves VzA(z)," can be reduced to SUP in general (see [17]). Very similar is a study (unpublished) undertaken some ten years ago, about the relative speed of proofs in Frege systems with substitution, where the question "Can you decide whether a wff is provable within a certain number of steps?" is also reduced to SUP in general ([19]). 1 (5) In computational linguistics, researchers have considered a form of SUP where terms can be regular (generally infinite) both in instances and in substitutions, i.e., for this form of SUP, 5 r is the set of regular (rather than finite) first-order terms over 5; and X (e.g., see [3]). (6) The metatheory of functional and inclusion dependencies in database theory (developed in [14, 1, 2]) is strikingly similar to the metatheory of selni-unification (developed in Section 2 below), and both lead to an undecidable general case and decidable special cases (the latter with identical lower bounds). The special case of SUP arising in relation to problena (1) is solvable in polynomial time (e.g., see [8]). The special case of SUP arising in relation to problem (2) was recently shown to be DEXPTIME-complete ([11, 7]). Other special cases not mentioned here were also studied, and proved solvable or equivalent to the general case, with a view to understand SUP in general (e.g., see [10, 13, 17]). Finally, the form of SUP considered in (5) was very recently shown to be undecidable ([3]), but note that the undecidability of this form does not imply the undecidability of SUP in general, when T is the set of finite first-order terms. We show that, if the signature E contains at least Olle function symbol of arity > 2, SUP in general is ,Indecidable. 2 One of the practical consequences of this result is that type-checking of functional programs I Other connections between length of proofs and unification have been investigated for a long time (e.g., see [16] and the article by Parikh in [4]). ~The case when ~ contains only function symbols of arity _< 1, besides being decidable, is not encountered in the problems mentioned above. in type disciplines that include polymorphic recursion, is not generally possible (see [1O]). a The present report is organized as follows. Section 2 is background material, where we develop some metatheory of semi-unification, namely, the formal system of what we call path equations. In Section 3, we sketch the proof of the undecidability of the boundedness problem for a special formulation of Turing machines, which we agree to call Intercell Turing Machines (abbreviated ITM) for lack of a better name. In Section 4, we show that the boundedness problem for ITM's is effectively reducible to SUP, thus showing the undecidability of SUP. Our proof for the undecidability of the boundedness problem for ITM's (Section 3) is an adaption of Philip K. Hooper's proof for the undecidability of the mortality problem for Turing machines (PhD Thesis, Harvard Univ, 1965). Because Hooper's thesis is unpublished, we will include his proof in the final draft of this report. A c k n o w l e d g e m e n t . We were referred to Hooper's work by Albert Meyer. His help is greatly appreciated. 2 Semi -Uni f i ca t ion Let E be a first-order signature consisting of exactly one binary function symbol. Let X be a countably infinite set of variables, and T the set of all terms over E and X. For reasons of convenience, the single binary function symbol in E is -~, used in infix notation, with the usual convention that a ---, a ~ ~ a " stands for (~ --4 (~' ~ W')). We reserve early lower-case Greek letters, appropriately superscripted, to denote members of X (subscripts will be later used for the naming of "auxiliary variables"). A substitution is a function S : X ---, T. Every substitution extends in a natural way to a Ehornomorphism S : T --T. We write an instance F of the Semi-Unification Problem (SUP) as a finite set of inequalities, F = {t 1 < u l , . . . , t '~ < u'~}, where t l ,u i E T. A substitution S is a solution of instance F iff there are 3This is t h e p r o b l e m t h a t led us to seml-unification in the first place. We take "type-checking" in the s e n s e o f "typereconstruction", i.e., t h e a b i l i t y to e f f e c t i v e l y determine whether an untyped program phrase is typable and, if it is, to c o n s t r u c t a t y p e for it and this is generally n o t p o s s i b l e in the p r e s e n c e o f polymorphic recursion.
[1]
Rohit Parikh.
Some results on the length of proofs
,
1973
.
[2]
Jerzy Tiuryn,et al.
Computational consequences and partial solutions of a generalized unification problem
,
1989,
[1989] Proceedings. Fourth Annual Symposium on Logic in Computer Science.
[3]
Harry G. Mairson.
Deciding ML typability is complete for deterministic exponential time
,
1989,
POPL '90.
[4]
Philip K. Hooper.
The undecidability of the Turing machine immortality problem
,
1966,
Journal of Symbolic Logic.
[5]
Paul Walton Purdom,et al.
Detecting Looping Simplifications
,
1987,
RTA.
[6]
Hans Leiß,et al.
On Type Inference for Object-Oriented Programming Languages
,
1987,
CSL.
[7]
Jerzy Tiuryn,et al.
Type Reconstruction in Finite Rank Fragments of the Second-Order lambda-Calculus
,
1992,
Inf. Comput..
[8]
Paliath Narendran,et al.
Semi-Unification
,
1991,
Theor. Comput. Sci..
[9]
N. S. Barnett,et al.
Private communication
,
1969
.
[10]
Fritz Henglein,et al.
Type inference and semi-unification
,
1988,
LISP and Functional Programming.
[11]
Stavros S. Cosmadakis,et al.
Equational theories and database constraints
,
1985,
STOC '85.
[12]
John C. Mitchell,et al.
Polymorphic unification and ML typing
,
1989,
POPL '89.
[13]
Jochen Dörre,et al.
On subsumption and semiunification in feature algebras
,
1990,
[1990] Proceedings. Fifth Annual IEEE Symposium on Logic in Computer Science.
[14]
Pavel Pudlák,et al.
On a unification problem related to Kreisel's conjecture
,
1988
.
[15]
John C. Mitchell.
The Implication Problem for Functional and Inclusion Dependencies
,
1984,
Inf. Control..
[16]
Stavros S. Cosmadakis,et al.
Functional and inclusion dependencies a graph theoretic approach
,
1984,
PODS '84.
[17]
Alan Mycroft,et al.
Polymorphic Type Schemes and Recursive Definitions
,
1984,
Symposium on Programming.