Distributivity in Incompletely Speciied Type Hierarchies: Theory and Computational Complexity
چکیده
Type hierarchies are a central feature of current systems which employ feature structures for the representation and manipulation of linguistic knowledge, such as TFS, ALE, CUF, and LKB. The system CUF stands out amongst these in its very general language for describing such hierarchies. While the other systems use a description language which allows only the speci cation of meets (greatest lower bounds of types), CUF provides a very general type de nition language which allows a full complement of Boolean operations. This exibility permits much simpler and more natural speci cations of certain types of knowledge representation which occur naturally in paradigms such as HPSG. However, along with this increased power of expressiveness comes an increase in computational complexity. Speci cally, while the simpler type systems are in fact so restrictive that any admitted speci cation is semantically meaningful, the power of the CUF type-speci cation language results in highly nontrivial decision question about well-formedness. These well-formedness questions revolve around the property of distributivity, as any semantically meaningful hierarchy| that is, one in which meet represents intersection of object classes and join represents union | must be distributive. The contribution of this report is twofold. First of all, we provide a very general development of extension problems for partial type hierarchies to full distributive hierarchies, which is exactly the problem one needs to solve to determine wellformedness and other properties of type hierarchies in the CUF spirit. Secondly, we analyze the computational complexity of deciding the existence of various forms of distributive extensions. We show that under relatively weak assumptions concerning the height and fanout of the partial speci cation, all of the various decision problems are NP-complete. However, in the process of developing the formalism necessary for this detailed analysis, we also identify some close connections to certain kinds of satis ability problems in propositional logic, which will hopefully prove useful in identifying useful special cases in which the computational problems are tractable. 1 0. Introduction 0.1 Motivation The use of uni cation-based formalisms in computational linguistics has become commonplace. Systems based upon such formalisms depend fundamentally upon logical inference, in which constraints are collected as the parsing process proceeds, and the nal results are the models (often taken to be feature structures) of the constraints. There are basically two avors of such formalisms. In one school, which is currently represented most visibly by LFG [Kap89], the parsing process has a context-free backbone, and the uni cation-based formalism is used as a constraintenforcement mechanism to \weed out" incorrect parses. Both Johnson's [Joh88] and Shieber's books [Shi92] describe recent theoretical e orts in this direction. In the other school, which is currently represented most visibly by HPSG [PS87], the context-free backbone is eschewed entirely. Rather, the entire parsing process becomes one of constraint satisfaction. This is a rather intriguing idea, but it also presents several new and unique problems which must be addressed if it is to be successful. One aspect is that \ordinary" feature structures, as described, for example in [Shi86], are no longer adequate to describe the inference process. Rather, so-called typed feature structures are used to express certain kinds of constraints. In typed feature structures, there is an extant nite type hierarchy, and each node of the feature structure is assigned a type. These types become an integral part of the inference mechanism. In response to the idea of deductive computation in the context of typed feature structures, a number of specialized programming languages have evolved. Among the most visible are TFS [Zaj91], [Zaj92], ALE [Car92a], and CUF [DD93]. Recently, a similar system, LKB, has arisen from the ACQUILEX project [BdPC93]. In addition, the programming language LIFE [AP93], [Ait93] and its predecessor LOGIN [AN86], although not speci cally designed for linguistic knowledge representation and manipulation, nonetheless shares many ideas with these linguistically motivated languages. No two of these systems handle the notion of typing in exactly the same way. However, they all begin with a simple, parameterless, type hierarchy. That is to say, a hierarchy in which we can say things such \Type a is subtype of type b" (a b), or \An object is of type c if and only if it is of type a and of type b" (c = a ^ b). Despite their individual di erences with respect to the declaration of the type hierarchy, these systems may be partitioned into two broad categories. On the one hand, TFS, ALE, LKB, LOGIN, and LIFE all build the type hierarchy in a particular way from a speci cation which is a partially ordered set. CUF, on the other hand, works with a much more powerful language, and therefore admits the speci cation of more general hierarchies. (See [Man93] for a comparison of CUF to the systems ALE and TFS.) With this generality, however, come some more di cult computational problems as well. Indeed, in other contexts, the tradeo between expressive power and computational complexity in type hierarchies is well-known [LB87]. In this report, we study in detail some of the special algebraic aspects, 2 0. INTRODUCTION and the associated computational complexity problems, of type declarations of the form admitted by CUF. Speci cally, we address the question of when such a set of declarations is semantically well-formed. We shall argue that such hierarchies should be distributive, and we shall then show that the computational complexity of testing whether or not such a hierarchy is indeed distributive is NP-complete, even under relatively constrained circumstances. In so doing, we shall not be concerned with the underlying logical language at all in this report. We take this tact for two reasons. First of all, having the type hierarchy be \satisfactory" from an algebraic point of view, while not a su cient condition for the system to be well-speci ed overall, is certainly a necessary one. In particular, our work relates directly to an important subproblem which the CUF system must solve. Secondly, it is our thesis that a type/sort system which yields full Turing-complete power is not the optimal way to approach HPSG-style parsing, because in so doing we give up any hope of having automatically decidable parsing, such as o -line parsability in LFG provides [Joh88, 3.5]. In future reports, we shall document this idea of decidable parsing in HPSG-style contexts more fully. We will not provide a self-contained introduction to typed feature structures here. In fact, we will not explicitly discuss features structures at all. Rather, we will focus completely upon the algebraic properties of the form of type hierarchies which appear in CUF and ALE, and at least implicitly, in TFS and LIFE as well. For the interested reader, Carpenter's book [Car92b] provides a rather thorough introduction to the ideas of typed feature structures, and how type hierarchies are involved in their de nition1. However, virtually all of this report, with the exception of some details in motivating examples, may be understood without any knowledge of feature structures. Within this introductory section, we assume a minimal acquaintance with the algebraic notions of partial order and lattice. We also present very simple examples of CUF and ALE syntax, although no detailed knowledge of these systems is needed to understand what is written here. 0.2 A Simple Technique for Realizing Distributive Type Hierarchies Before describing the type declaration system employed by CUF, it is helpful to understand the features and limitations of the simpler method employed by the other systems mentioned above. Let us start by considering the type hierarchy depicted in Figure 0.1, which is taken from [AN86]. This particularly hierarchy is a lattice, and as per the usual convention for a pictorial representation of a lattice, one follows the arrows upwards to a common point to get the join of two elements, and downwards to get the meet. An intuitive idea with any such hierarchy is that each type represents a subset of the objects in some universe U . For any type t, let us write V(t) to denote 1Be aware that Carpenter expresses type hierarchies \upside down" from the way that we do. > denotes the empty type and ? the universal type in his formalism. 0.2 A Simple Technique for Realizing Distributive Type Hierarchies 3 > person witch monarch adult child teenager queen wickedqueen ? 3 6 P P P P P P Pi @ @ @I @ @ I S S S S S S So 6 Q Q Q Qk 3 Figure 0.1: A non-distributive type hierarchy. the set of all objects of type t. The symbol > denotes the universal type, and so V(>) = U , and ? denotes the empty type, so that V(?) = ;. Also, as a rst assumption, let us take the lattice operations to represent the natural operations on sets of objects. Thus, join represents union, and meet represents intersection, of these sets of instances. For example, we have that V(adult) [ V(child) = V(person) and V(adult)\V(child) = V(teenager). However, we must then have that V(monarch)\ V(witch) = V(wickedqueen) and V(queen) \ V(witch) = V(wickedqueen). Thus, V(monarch) \ V(witch) = V(queen) \ V(witch). But, arguing similarly with union (qua join), we can show that V(monarch) [ V(witch) = V(queen) [ V(witch). However, V(monarch)\ V(witch) = V(queen)\ V(witch) means that the monarchs that are witches are precisely the queens that are witches, while V(monarch)[V(witch) = V(queen)[V(witch) means that the monarchs that are not witches are precisely the queens that are not witches. In other words, we must have that V(monarch) = V(queen). Thus, if we require that each type be distinct, and if we require that the operations of join and meet correspond to union and intersection of the corresponding sets of objects in the universe, then we cannot admit such a lattice as the de nition of our type hierarchy. What we need is precisely that the lattice be distributive2. The \>-witch-monarch-queen-wickedqueen" component of this lattice is a particular instance of what is known as a pentagon; a generic pentagon is depicted in Figure 0.2. To guarantee that a lattice is distributive, it is both necessary and sufcient to ensure that it contains neither a pentagon nor a diamond [Gra78, Ch. II, 2Remarkably, a necessary and su cient condition that that a lattice be distributive is that join correspond to union and meet to intersection. In other words, the only distributive lattices are those which, up to isomorphism, are lattices of subsets of a universal set, with union and intersection as join and meet, respectively. This is the classical representation theorem of Birkho and Stone, and is discussed in more detail in 1.1.3. 4 0. INTRODUCTION a b c d e H H H HY 6 @ @ @ @I * Figure 0.2: A generic pentagon in a lattice. Sec. 1, Thm. 1]. A generic diamond is depicted in Figure 0.3. a b c d e 6 @ @ @ @I @ @ @ @I 6 Figure 0.3: A generic diamond in a lattice. The reason that nondistributive type hierarchies, such as the example just given, are not a problem in systems such as ALE, LKB, FTS, LOGIN, and LIFE, is that the full lattice operations are not interpreted in the fashion described. The initial hierarchy, such as that given in Figure 0.1, is interpreted not as the nal type hierarchy, but rather as a speci cation for the construction of a more extensive type hierarchy. Indeed, all that is required in these systems is that the speci cation be a meet semilattice | that is, that any pair of elements have a greatest lower bound. Then, greatest lower bound is interpreted as intersection of object classes, but least upper bound is left uninterpreted. The \true" lattice | in which both meet and join have natural interpretations as intersection and union, respectively, of object classes | is constructed from the meets using a construction which builds the joins in a \free" fashion. From our initial type hierarchy, we build a new hierarchy consisting of all of the order ideals of the original hierarchy; that is, the set of all subsets which are closed under the \less than" relation. (In other words, S is an order ideal if x 2 S and y x implies y 2 S.) It is well-known that the set of all order ideals of a nite poset forms a distributive lattice [DP90, 8.20]. Furthermore, 0.3 The Power of CUF-like Speci cations 5 this distributive lattice contains, as an embedded partially ordered set, the original poset S. Speci cally, call an element x of a lattice join-irreducible if it is not the least element of the lattice (if indeed the lattice has a least element), and, whenever x may be written in the form a _ b, then x = a or x = b. The join-irreducible order ideals are in bijective correspondence with the elements of the poset itself [DP90, 8.20]. We illustrate by constructing the ideals of the pentagon of Figure 0.2. Figure 0.4 gives two \views" of this construction. On the left, we show the order ideals, with those which correspond to the original elements of the poset enclosed in a rectangle. On the right, we show the same lattice, but with a more informative labelling relative to the original poset, which shows only the maximal elements of the order ideals. Notice that neither a = b_ c nor a = b_d holds in this new lattice. Rather, explicit new elements representing b _ c and b _ d have been constructed. fa,b,c,d,eg fb; c; d; eg fb; d; eg fc,d,eg fb,eg fd,eg feg ; a b _ c c b _ d b d e ? @ @I @ @I H H H HY 6 * H H H HY * 6 @ @ @I * @ @ @IP P P P P P P P Pi 6 H H H H H H HY * 6 Figure 0.4: Two views of the \actual" distributive type hierarchy corresponding to the pentagon of Figure 0.2. This construction has a further advantage. Even if the original type hierarchy did not have greatest lower bounds, it will create them automatically. This is illustrated in Figure 0.5. On the left is a simple speci cation without a greatest lower bound for b and c, and to its right is the corresponding distributive hierarchy. 0.3 The Power of CUF-like Speci cations Before going on, let us stop and take inventory of the features of the construction just described. 6 0. INTRODUCTION a b c fag fb; cg fbg fcg ; A A A A A A AK @ @ I @ @I 6 Figure 0.5: A type speci cation without a lower bound, and the order-ideal construction of the corresponding distributive hierarchy. (a) Any distributive lattice may be represented in this fashion3. (b) Verifying that a speci cation is \legal" is trivial, since any partial order is legal. (c) The representation of a distributive lattice in this fashion can be quite compact. With respect to the last point, authors such as Carpenter [Car92b, pp. 15-17] argue that, for reasons of sparseness of the concept hierarchy, type hierarchies need not be distributive. However, what is (apparently) meant by such comments is that it is not practical to represent each and every type that would arise in an appropriate distributive hierarchy. Thus, the actual distributive hierarchy is encoded in the nondistributive fashion described above. Furthermore, meets represent actual logical meets. However, in such representations, the join operation does not necessarily correspond to logical disjunction of types. Rather, it simply corresponds to supremum amongst the explicitly speci ed types. Whether or not such a join operation could nonetheless be used in a productive way in such a system is an interesting question which, to our knowledge, has not been addressed. In all of the systems of which we are aware, it is not used explicitly at all. Despite the attractive features of this method of specifying type hierarchies, there is a serious disadvantage. Principally, requiring the use of such speci cations constrains the user completely in how a type hierarchy is speci ed. The construction is very rigid, and very asymmetric, in how it interprets a speci cation of type 3This follows from the duality between nite distributive lattices and nite partially ordered sets. See, for example, [DP90, 8.17 { 8.20]. Any nite partially ordered set may be turned into a lattice by adding a least element ? and a greatest element >, in case these do not already exist. Then, de ne the greatest lower bound of two elements which previously had no lower bound to be ?, and the least upper bound of two elements which previously had not upper bound to be >. It is easy to show that the resulting structure is a lattice, and that it yields the same distributive lattice under this duality as did the originally partially ordered set. 0.3 The Power of CUF-like Speci cations 7 inheritance. With this formalism, in some applications, it may be very di cult to correctly and e ciently express the type constraints which are desired. Hence, it is useful to have other means of speci cation at hand. Perhaps the most natural one is to forego any sort of clever encoding, and just specify the known constraints on the types, be they meet constraints, join constraints, or complement constraints. From there, it becomes the job of the system to check these constraints for consistency and to interpret them as a distributive lattice. This is precisely the tact taken with by the CUF system. Simply put, a CUF type hierarchy speci cation is just a set of constraints on how elements in the hierarchy should be related. CUF then attempts to build the most general hierarchy which satis es those constraints, without making any particular assumptions. For this reason, we call the kind of type speci cations which CUF admits constraint-based speci cations. Some examples will help illustrate the generality and advantages of this approach. Suppose that we are given three types, t1, t2, and t3, and that they are related as shown in Figure 0.6. There are (at least) two possible interpretations to this t1 t2 t3 A A A A A A AK Figure 0.6: A simple upward type speci cation with two possible interpretations. hierarchy. On the one hand, it may simply state that t3 ;?) such that (bp-i) P is a nonempty set (the underlying set). (bp-ii) is a partial order (re exive, transitive, and antisymmetric) on P . (bp-iii) ? 2 P is called the least element and satis es ? p for all p 2 P . (bp-iv) > 2 P is called the greatest element and satis es p > for all p 2 P . (bp-v) ? and > are distinct elements. Even when working with several bounded posets, we will usually use the same symbols for the order relation ( ), the least element (?), and the greatest element (>) in each. When it is absolutely necessary to use distinct symbols, we will use subscripts or other indicators. Also, to avoid the need to write out detailed speci cations at every turn, we shall adopt the convention that when such a poset is named by a boldface letter (e.g., P), then the underlying set is named by the same letter in roman italic font (e.g., P ). We adopt similar conventions for the other types of structures (lattices and the like) which we de ne and use later on in this report. Also, as is customary, we write x ;?), an upper bound of a set S P is any p 2 P such that s p for all s 2 S. Note that > is an upper bound for any S P . The least upper bound (lub) of S, when it exists, is the unique upper bound p 2 P such that p r for all r which are upper bounds of S. Dually, a lower bound of S is any p 2 P such that p s for all s 2 S, and the greatest lower bound (glb) of S, when it exists, is the unique lower bound p 2 P such that r p for all r which are lower bounds of S. Note that ? is a lower bound for any S P . For a given set S, we write lub(S) (resp. glb(S)) to denote the least upper bound (resp. greatest lower bound) of S, when it exists. Let P1 = (P1; ;>;?) and P2 = (P2; ;>;?) be bounded posets. Amorphism f : P1 ! P2 is a function f : P1 ! P2 such that the following conditions are satis ed. (bpmor-i) f(?) = ? and f(>) = >: (bpmor-ii) For all p; q 2 P1 with p q, f(p) f(q). We let BdPos denote the category of bounded posets, with morphisms as de ned above. When we speak of isomorphisms of bounded posets, or of algebraic structures more generally, we shall always use the categorical de nition [HS73, 5.13]. That is, a morphism f : P1 ! P2 is an isomorphism if there is a morphism g : P2 ! P1 such that g f is the identity on P1 and f g is the identity on P2. In the case of bounded posets, it is easy to see that the morphism f : P1 ! P2 is an isomorphism i the underlying f : P1 ! P2 is bijective and satis es f(x) f(y)) x y. 18 1. THE THEORY OF DISTRIBUTIVE PARTIAL STRUCTURES 1.1.2 Bounded Lattices and Related Concepts The simplest de nition of a bounded lattice is that it is a bounded poset P = (P; ;>;?) for which any two elements have a least upper bound and a greatest lower bound. The join operation _ : P P ! P and the meet operation ^ : P P ! P are then de ned by p _ q = lub(fp; qg) and p ^ q = glb(fp; qg) [Gra78, p. 3]. Unfortunately, this de nition will not be compatible with our de nitions of partial operations (unless we were to work with two distinct partial orders). Therefore, we prefer the de nition of a bounded lattice as an algebra. More precisely, we de ne a bounded lattice to be a ve-tuple L = (L;>;?;_;^) in which: (blat-i) L is a nonempty set (the underlying set). (blat-ii) _ : L L ! L and ^ : L L ! L are idempotent, commutative, and associative operations. (blat-iii) For all x; y 2 L, x ^ (x _ y) = x and x _ (x ^ y) = x. (These are the so-called absorption identities.) (blat-iv) ?;> 2 L are such that for all x 2 L, x _ ? = x and x ^ > = x. It is well known that this de nition is equivalent to the characterization in terms of bounded posets, and that we may recover the partial order via x y i x_y = y [Gra78, Ch. I, Sec. 1, Thm. 1]. Let L1 = (L1;>;?;_;^) and L2 = (L2;>;?;_;^) be bounded lattices. A morphism f : L1 ! L2 is a function f : L1 ! L2 such that (blmor-i) f(?) = ? and f(>) = >. (blmor-ii) For all x; y 2 L1, f(x _ y) = f(x) _ f(y) and f(x ^ y) = f(x) ^ f(y). If f : L1 ! L2 is an injective morphism, then it is automatically an embedding. That is to say, the image f(L1), under the operations inherited from L2, is isomorphic to the lattice L1 itself. This is a consequence of a more general theorem from universal algebra [Gra68, Ch. I, Sec. 7, Lem. 3]. In particular, bijective morphisms are always isomorphisms. We remark, however, that this result does not extend to bounded posets, nor to the various forms of partial structures that we discuss in the next section. Let L = (L1;>1;?1;_1;^1) and L = (L2;>2;?2;_2;^2) be bounded lattices. L1 is a bounded sublattice of L2 if L1 L2, ?1 = ?2, >1 = >2, and for every x; y 2 L1, x _1 y = x _2 y and x ^1 y = x ^2 y. Note particularly that the greatest and least elements must be preserved. The bounded lattice L = (L;>;?;_;^) is distributive if it satis es any one of the following equivalent conditions [Gra78, Ch. I, Sec. 4, Lem. 10]. (dist-i) For all x; y; z 2 L, (x ^ y) _ (x ^ z) = x ^ (y _ z). (dist-ii) For all x; y; z 2 L, (x _ y) ^ (x _ z) = x _ (y ^ z). (dist-iii) For all x; y; z 2 L, ((x _ y) ^ z) _ (x _ (y ^ z)) = x _ (y ^ z). A complement of an elementx 2 L is a y 2 L such that x_y = > and x^y = ?. L is complemented if every x 2 L has a complement. A Boolean lattice is a distributive, 1.1 Review of Total Order-Theoretic Structures 19 complemented lattice. It is well-known that, in a distributive lattice, an element can have at most one complement [Gra78, Ch. I, Sec. 6, Lem. 1]. A Boolean algebra is a Boolean lattice augmented by a speci c operation for the complement. More precisely, a Boolean algebra is a six-tuple L = (L;>;?;_;^; 0) in which (ba-i) (L;_;^;?;>) is a Boolean lattice. (ba-ii) 0 : L! L is the complement operation. It is easy to verify that if f : L1 ! L2 is a surjective morphism of lattices and L1 is distributive (resp. Boolean), then so too is L2. Furthermore, complements are preserved under morphisms, so that a morphism of Boolean lattices is also a morphism of Boolean algebras. We let BdLat, BdDiLat, and BoolLat denote the categories of bounded lattices, bounded distributive lattices, and bounded Boolean lattices, respectively. The dual of the bounded lattice L = (L;>;?;_;^) is the structure Dual(L) = (L;?;>;^;_). In other words, join becomes, meet, meet becomes join, and top and bottom are switched. The dual of a lattice is itself a lattice, and is distributive (resp. Boolean) i the original lattice is. Note, however, that we usually do not use these reversed symbol conventions when working with the dual of a lattice. More speci cally, we will use ?, >, _, ^ to denote the least element, greatest element, join operation, and meet operation, respectively, in the dual. When dealing with duals, we will always make it clear from the context exactly of which operations we speak. There is a special Boolean lattice which we will use frequently in this work. We let 2 denote the Boolean lattice whose underlying set is just the two elements f?;>g. We will also have occasion to work with products of bounded lattices in this work. Given an indexed family fLi j i 2 Ig of bounded lattices, their product is the lattice Qi2I Li = (Qi2I Li;>;?;_;^). Elements are just I-indexed tuples, with the ith entry coming from Li. We often write hxiii2I for such an I-tuple. The least element is the tuple with every position ?, and the greatest element is the tuple with every position >. Join and meet are de ned componentwise. Given a subset J I, we de ne the projection J : Qi2I Li ! Qj2J Lj to be the function which preserves the entries indexed by J and discards the others. If J is a singleton fjg, we may write j for fjg. It is easy to see that the product of distributive (resp. Boolean) lattices is distributive (resp. Boolean), as is any projection. Again, these results are consequences of more fundamental results from universal algebra. See [Gra68] for details. A Boolean lattice is called perfect if it is isomorphic to a product of copies of 2. Instead of writing i2I2, we may write 2I . It is not the case that every Boolean lattice is perfect; rather, the perfect ones are those that have the additional properties of being complete and completely distributive [Bir67, Ch. 5, Thm. 17]. However, it is the case that every nite Boolean algebra is perfect [Gra78, Ch. 2, Sec. 1, Cor. 12]. We let PerfBoolLat denote the category of all perfect Boolean lattices. 20 1. THE THEORY OF DISTRIBUTIVE PARTIAL STRUCTURES 1.1.3 Bit-Vector Lattices Let S be a set. A function S ! f0; 1g is called a bit vector over S, and we write BitVec(S) for the set of all such bit vectors. We de ne the full bit-vector lattice over S to be BitVec(S) = (BitVec(S);1;0; _; ^), with 0 the function which maps s 7! 0 for each s 2 S, and 1 the function which maps s 7! 1 for each s 2 S. The operation _ : BitVec(S) BitVec(S) ! BitVec(S) is bitwise logical disjunction; For f; g 2 BitVec(S), s 2 S, (f_g)(s) = max(ff(s); g(s)g). Similarly, ^ : BitVec(S) BitVec(S) ! BitVec(S) is bitwise logical conjunction; (f^g)(s) = min(ff(s); g(s)g). It is easy to see that, for any set S, BitVec(S) is naturally isomorphic to the perfect Boolean lattice 2S, just by replacing 0 by ? and 1 by > in each S-tuple. A bounded bit-vector lattice over S is any bounded sublattice of BitVec(S) which contains both 0 and 1; in particular these elements must be the least and greatest elements, respectively, of the sublattice. The set S is called the index set of the lattice. It is easy to view a bounded bit-vector lattice as a lattice of subsets of S. Indeed, identify the bit vector f with fs 2 S j f(s) = 1g. Then _ translates to set-theoretic union, ^ to set-theoretic intersection, 0 to the empty set, and 1 to S. What we obtain is the lattice associated with a ring of sets, that is a collection of subsets of a set S which is closed under union and intersection. Our boundedness condition yields a bounded ring of sets; that is, a ring which contains both ; and the full set S. A classical result of G. Birkho states that any distributive lattice may be represented by a ring of sets [Gra78, Ch. 2, Sec. 1, Thm. 19]. Similarly, according to a result of M. H. Stone, any Boolean lattice may be represented by a eld of sets, which is a ring of sets which is also closed under relative complementation with the base set S [Gra78, Ch. 2, Sec. 1, Cor. 21]. Adding bounds is a trivial modi cation to these results. We summarize the key results in the following. 1.1.4 Proposition | representation of distributive and Boolean lattices Let L be a bounded lattice. (a) L is distributive i it is isomorphic to a bounded bit-vector lattice. (b) If L is nite, then it is Boolean i it is isomorphic to BitVec(S) for some nite set S. (c) If L is distributive, then it may be embedded into a perfect Boolean lattice. 2 1.1.5 Distributive extension categories This report is concerned with extending partial structures to total distributive ones. The categories of distributive lattices which we shall consider extending to are BdDiLat, BoolLat, and PerfBoolLat. Collectively, we shall call these categories the distributive extension categories. 1.2 Structures with Partial Operations We now turn to the axiomatization of lattice-like structures with partial operations. Since we are interested in modelling n-ary speci cations, for arbitrary nite n, such as CUF speci cations like the example below, 1.2 Structures with Partial Operations 21 t = t1 & t2 & .. & tn. these partial operations are not constrained to be binary. Rather, we allow general partial join and meet operations, which range over nite subsets of the underlying set.We provide two equivalent characterizations. In the rst, we start with a bounded poset and add the partial generalized join and meet operations on top of it. In the second, we eschew an explicit presentation of the underlying partial order entirely, and express everything in terms of partial operations and axioms. This latter characterization, when restricted to binary partial operations, yields precisely the (bounded) weak partial lattices of Gr atzer [Gra78, p. 41]. 1.2.1 Notation There is some notation which we use throughout, and we collect it here. Whenever we write A f B, we mean that A is a nite subset of B. And, we let Pf (P ) denote the set of all nite subsets of P , while P(P ) denotes the full powerset of P , consisting of all subsets, nite or not. Given a partial function f : A ! B we write f(a) # to mean that f is de ned on the argument a. When we speak of a partial function, we do not discount the possibility that the function is in fact de ned on all of its arguments. In other words, total functions are partial in our terminology. 1.2.2 Bounded Posets with Partial Operations A bounded poset with partial operations (BPPO) is a 6-tuple P = (P; ;>;?;W;V) in which (bppo-i) (P; ;>;?) is a bounded poset, called the underlying poset. (bppo-ii) W : Pf(P )! P is partial a operation, called the generalized join. (bppo-iii) V : Pf(P )! P is partial a operation, called the generalized meet. The operations W and V are subject to the following conditions. (bppo-iv) For any S f P , if WS #, then WS = lub(S). Dually, if VS #, then VS = glb(S). (bppo-v) For S f P , if lub(S) # and lub(S) 2 S, then WS #. Dually, if glb(S) # and glb(S) 2 S, then glb(S)#. (bppo-vi) W ; = ? and V ; = >. (bppo-vii) If S1; S2; : : : ; Sn f P are such that WSi # for all i, 1 i n, then W(Sni=1 Si) # i WfWS1;WS2; : : :WSng #, and WfWS1;WS2; : : :WSng = W(Sni=1 Si) in this case. Dually, if VSi # for all i, 1 i n, then V(Sni=1 Si) # i VfVS1;VS2; : : :VSng #, and VfVS1;VS2; : : :VSng = V(Sni=1 Si) in this case. These are called the generalized associativity laws. . Condition (bppo-iv) requires that, if a generalized join (resp. meet) exists, then it must be the lub (resp. glb) in the partial order. Note, however, that we do not demand that subsets which have an lub (resp. glb) in the partial order have a join 22 1. THE THEORY OF DISTRIBUTIVE PARTIAL STRUCTURES (resp. meet). We simply require that, whenever they are de ned, joins and meets agree with these bounds. Condition (bppo-v) says that any nite subset of P which contains its lub (resp. glb) has this lub (resp. glb) as its join (resp. meet). Note well that the lub (resp. glb) must already be in S; it is not enough that it exist in P . Condition (bppo-vi) is a natural rule for the empty set. Condition (bppo-vii), the natural associativity laws, just say that the join and meet are associative in a more general context. For example, given the following CUF speci cations, t1 = t11 & t12 & t13. t2 = t21 & t22 & t23. t3 = t31 & t32 & t33. t4 = t11 & t12 & t13 & t21 & t22 & t23 & t31 & t32 & t33. we maywrite these in our notation as V(ft11; t12; t13g) = t1, V(ft21; t22; t23g) = t2, V(ft31; t32; t33g) = t3, and V(ft11; t12; t13; t21; t22; t23; t31; t32; t33g) = t4. The generalized associativity law for meets then tells us that we must have V(ft1; t2; t3g) = t4, Let P1 = (P1; ;>;?;W;V) and P2 = (P2; ;>;?;W;V) be BPPO's. A morphism f : P1 ! P2 is a poset morphism f : (P1; ;>;?) ! (P2; ;>;?) subject to the following additional constraint. (bppomor-i) For S f P1, if WS #, then W(f(S)) # and f(WS) = W(f(S)). Dually, if VS #, then V(f(S))# and f(V S) = V(f(S))5. Notice that a morphism automatically preserves ? and >. For example, f(?) = f(W ;) = W f(;) = W ; = ?. We let BPPO denote the category of BPPO's. We now turn to an alternate representation of a BPPO which eschews the explicit use of a partial order. 1.2.3 Generalized Bounded Weak Partial Lattices In [Gra78, Ch. I, Sec. 5], Gratzer introduces the notion of a weak partial lattice. We provide a de nition which generalizes his concept to meet and join operations with more than two arguments. A generalized bounded weak partial lattice (GBWPL) is a ve-tuple L = (L;>;?;W;V) in which (gbwpl-i) L is a set (the underlying set). (gbwpl-ii) W : Pf(L)! L is partial operation, called the generalized join. (gbwpl-iii) V : Pf (L)! L is partial operation, called the generalized meet. (gbwpl-iii) ?;> 2 L with ? 6 = >. The operations W and V are subject to the following conditions. (gbwpl-iv) W ; = ?, V ; = >. For all a 2 L, Wfag = a, Vfag = a, Wfa;?g = a, Vfa;>g = a, 5f(S) denotes ff(s) j s 2 Sg. 1.2 Structures with Partial Operations 23 (gbwpl-v) The generalized associativity laws stated in (bppo-vii) (with P replaced by L.) (gbwpl-vi) If S f L with WS #, then for all a 2 S, Vfa;WSg# with Vfa;WSg = a. Dually, for all a 2 S, Wfa;VSg # with Wfa;VSg = a. These are called the generalized absorption identities. In (gbwpl-iv), the condition Wfag = a is just a restatement of the idempotency of the join, which becomes a_a = a in a lattice. The condition Wfa;?g = a just states that ? is the least element. The other two new conditions are dual. In (gbwpl-vi), The condition Vfa;WSg = a for a 2 S and WS # is a generalization of the absorption identity a ^ (a _ b) = a of an ordinary lattice [Gra78, Cond. (L4), p. 4]. The other condition is dual. Let L1 = (L1;>;?;W;V) and L2 = (L2;>;?;W;V) be GBWPL's. A morphism f : L1 ! L2 is a function f : L1 ! L2 subject to the following additional constraints. (gbwplmor-i) For S f L1, if WS #, then W(f(S))# and f(WS) = W(f(S)). Dually, if VS #, then V(f(S))# and f(V S) = V(f(S)). We let GBWPL denote the category of GBWPL's. 1.2.4 Relationship between BPPO's and GBWPL's The concepts of BPPO and GBWPL are equivalent, as we shall prove in the next proposition. First of all, we need to de ne the appropriate transformations. To obtain a GBWPL from a BPPO, we just \forget" the order structure. Given a BPPOB = (B; ;>;?;W;V), the associated GBWPL is just L = (L;>;?;W;V), which we denote by GBWPL(B). The underlying function of a BPPO morphism f : B1 ! B2 is the same as the underlying function of the corresponding GBWPL morphism GBWPL(f) : GBWPL(B1)! GBWPL(B2). Thus, as a simpli cation of notation, we use the same symbol f for the morphism in each case. In the other direction, things are a bit more complicated. We start with a GBWPL L = (L;>;?;W;V). De ne the relation on L by a b i either there is a subset S f L with WS #, a 2 S, and b = WS, or else such an S with VS #, b 2 S, and a = VS. The associated BPPO is then just L = (L; ;>;?;W;V), and is denoted BPPO(L). Again, the underlying function of a GBWPLmorphism f is the same as the underlying function of the associated BPPO morphism BPPO(f), and so we use the same symbol f in each case. We will show that BPPO : GBWPL ! BPPO and GBWPL : BPPO ! GBWPL are functors which are mutual inverses, in the sense that GBWPL BPPO is the identity on GBWPL and BPPO GBWPL is the identity on BPPO. 1.2.5 Proposition Let L = (L;>;?;W;V) be a GBWPL. Then BPPO(L) is a BPPO. Furthermore, if f : L1 ! L2 is the underlying function of a morphism between two GBWPL's L1 and L2, then it is also the underlying function for a morphism f : BPPO(L1)! BPPO(L2). Proof: We begin by establishing that the induced order relation is indeed a partial order. It follows immediately from (gbwpl-iv) that it is re exive. To show 24 1. THE THEORY OF DISTRIBUTIVE PARTIAL STRUCTURES antisymmetry and transitivity, rst observe the following. Suppose that a b. If there is an S f L such that WS #, b = WS, and a 2 S, then Wfa; bg = b by a simple application of the generalized associativity laws. On the other hand, if there is an S f L such that VS #, a = VS, and b 2 S, then Vfa; bg = a, also by a simple application of the generalized associativity laws. But in this latter case Wfa; bg = Wfa;VSg = a, by the generalized absorption identities. Thus, in either case Wfa; bg = b. To show antisymmetry, it su ces to observe that if a b and b a, then both Wfa; bg = a and Wfa; bg = b hold, whence a = b. To show transitivity, assume that a b and b c. Then we must have that Wfa; bg = b and Wfb; cg = c. A simple application of the generalized associativity laws yields that Wfa; b; cg = c, whence a c, by the de nition of . To complete the proof, we must prove that generalized joins are lub's, and generalized meets are glb's. So, suppose that S is a nite subset of L with a = WS, and let b be any upper bound for S. Then s b for all b 2 S. Now, by the generalized associativity laws, we have Wfb; ag = Wfb;WSg = WfWfb; sg j s 2 Sg = WS = a. Hence b = a, and so a = lub(S). The proof for glb's is dual. This establishes condition (bppo-iv). To establish (bppo-v), let S f L, and let a 2 S. Then, by the generalized absorption identities, Vfa;WSg = a. So, in particular, if a = lub(S), then we have (bppo-v), with the condition for glb's dual. The fact that a morphism for GBWPL's is also a morphism for BPPO's is immediate. 2 The other direction is much easier. 1.2.6 Proposition Let L = (L; ;>;?;W;V) be a BPPO. Then GBWPL(L) is a GBWPL. Furthermore, if f : B1 ! B2 is the underlying function of a morphism between two GBWPL's L1 and L2, then it is also the underlying function for a morphism f : GBWPL(L1)! GBWPL(L2). Proof: The only non-obvious conditions to prove are those of (gbwpl-vi), the generalized absorption identities. But if S f B and a 2 S, then Vffag;WSg = Vffag; lub(S)g = a, since a lub(S), and so is the glb of fa;WSg. The other absorption condition is dual. 2 We can now conclude formally that the notions of BPPO and of GBWPL are just two ways of talking about the same thing. 1.2.7 Proposition| equivalence of BPPO's and GBWPL's The functors BPPO and GBWPL are mutually inverse. More speci cally, we have the following. (a) For any BPPO P, BPPO(GBWPL(P)) = P. (b) For any GBWPL L, GBWPL(BPPO(L)) = L. Proof: Most of the proof is clear from the constructions of the previous two propositions. The only question might be whether the transitions BPPO!GBWPL ! BPPO might add pairs to the order relation. The key to observing that this 1.3 Extensions of BPPO's to Lattices 25 cannot be the case is to note that the order relation of a BPPO is in fact already recaptured in the partial operations W and V. Indeed, a b i Wfa; bg = b, as we can readily conclude from (bppo-v). 2 1.2.8 Natural interpretation of a lattice as a BPPO and as a GBWPL Often, in what follows, we will speak of a bounded lattice as being a BPPO or a GBWPL. In this sense, a lattice will simply be a BPPO or GBWPL in which the generalized join and generalized meet functions are total. Thus, for example, if S = fs1; s2; : : : ; sng, then WS = s1 _ s2 _ ::_ sn. That the axioms of a GBWPL are su cient to guarantee that we obtain a bounded lattice whenever W and V are total functions follows from an elementary axiomatization of a lattice. (See, e.g., [Gra78, pp. 4{5].) Thus, whenever both W and V are total functions, we shall speak of the corresponding BPPO or GBWPL as a lattice, with the obvious translation being made. Formally, we think of BdLat, as well as each of the distributive extension categories (1.1.5), as subcategories of BPPO. 1.3 Extensions of BPPO's to Lattices We now turn to the key question of this section | the extension of BPPO's to bounded lattices of varying sorts. For consistency, we work with the problem of extending BPPO's; although, of course, in the light of the results above, we could equally well work with extending GBWPL's. 1.3.1 De nitions of Forms of Extensions Note that BdLat and any of the distributive extension categories may be naturally regarded as a subcategory of BPPO. For each such category C, we have a natural forgetful functor which is the \identity" on objects | it forgets that the structure is more than just a BPPO. It is also the identity on morphisms, in the sense that the underlying functions are the same. The extension problem, simply put, is to nd natural inverses to these functors. That is, to nd natural ways to extend BPPO's to bounded lattices, bounded distributive lattices, and to Boolean lattices. Unfortunately, the situation is somewhat complex. First of all, there is not a unique notion of extension, but rather several distinct notions, each with its advantages and disadvantages. Secondly, in the cases of extensions which are required to be distributive, such extensions need not always exist. Indeed, the main topic of Section 2 of this report is to establish the computational complexity of the decision problem for the existence of such extensions. We must therefore address the problem on a case-by-case basis. Nonetheless, it is conceptually simpler to collect the basic de nitions about extension into a common framework, and that is what we do here. Let P = (P; ;>;?;W;V) be a BPPO, and let C be BdLat or one of the distributive extension categories. All of the types of extension have the form (L; ), in which L is an object of C and : P ! L is a BPPO-morphism. (Recall that C is always a subcategory of BPPO, so such a morphism is well-de ned.) Let us call such a pair an extension pair for P to C. The particulars for the special cases are as follows. 26 1. THE THEORY OF DISTRIBUTIVE PARTIAL STRUCTURES (a) The extension pair (L; ) is an injective extension of P to C if is injective. More generally, for Q a set of pairs of distinct elements of P , (L; ) is called a Q-injective extension if for each pair fx; yg 2 Q, (x) 6= (y). (b) The extension pair (L; ) is an embedding extension if is an embedding. By an embedding, we mean that it has the property that it is injective and whenever S f P is such that W (S) # (resp. V (S) #), then WS # (resp. VS #), and W (S) = (WS) (resp. V (S) = (VS)). (c) The extension pair (L; ) is universal if for every object M of C and every BPPO morphism f : P ! M, there is a unique C morphism g such that the diagram in Figure 1.1 commutes. P L M ZZZZZZ~ f ? g Figure 1.1: Universal extension. In some sense, a universal extension is the most natural kind to seek, because it imposes the least amount of constraints, since any other extension is the homomorphic image of it. This idea arises in many mathematical settings. For a more general discussion of the merits of universal constructions, consult [Wal91, Ch. 5, Sec. 6] or [HS73, Sec. 26]. There are a few general facts about universal extension pairs which are worth recording at this point. 1.3.2 Proposition Let P be a BPPO, and let C be the category BdLat or one of the distributive extension categories. (a) A universal extension pair for P to C, if it exists, is unique up to isomorphism. (b) If P has an injective (resp. embedding) extension to C, then a universal extension pair, if it exists, is also injective (resp. embedding). Proof: Part (a) is a standard result from category theory; see, for example, [HS73, 26.7]. To prove (b), let (M; f) be an injective extension of P, and let (L; ) be a universal extension pair. Then there is a morphism g : L!M which renders the diagram of Figure 1.1 commutative. But then must be injective; again this is a special case of a standard categorical result [HS73, 6.1]. Finally, suppose that (M; f) of Figure 1.1 is an embedding extension, with (L; ) a universal extension. Let S f P and a 2 P with W (S) = (a). Then, since g is a morphism, we have 1.3 Extensions of BPPO's to Lattices 27 that W g( (S)) = g( (a)). But g = f , thus Wh(S) = h(a), and since h is an embedding, WS # with WS = a. The proof for the case of V is similar. Thus is an embedding, as was to be proved. 2 1.3.3 Remark on injectivity of universal extensions In manymathematical domains, universal (or free) constructions have an injective \ ". However, this is not necessarily the case with extensions of BPPO's to distributive extension categories. In 1.4.15, examples of universal extensions (L ) for BPPO's are presented for which is not injective. 1.3.4 Remark on embedding We should emphasize that for lattices, as we noted in 1.1.2, injective morphisms are always embeddings. That is, if f : L1 ! L2 is a morphism of lattices, with S L1 and a 2 L1 such that Wff(s) j s 2 Sg = f(a) (resp. Vff(s) j s 2 Sg = f(a)) holds in L2, then WS = a (resp. (VS = a) holds in L1. However, this is not true for partial structures. For example, if we have that WS = > in a BPPO, then in any extension to a lattice we must also have that WT = > for any nite T with the property that S T . However, the axioms of a BPPO do not force WT = > to hold for every such superset T of S. For a less trivial example, see [Gra78, pp. 41{42]. Thus, for the notions of extension identi ed above, there may be a distinction between injective and embedding extensions. This issue is examined more closely in 1.3.6 and 1.3.7. 1.3.5 Ideals of a BPPO Let P = (P; ;>;?;W;V) be a BPPO. A set I P is called an ideal of P if it satis es the following conditions: (ideal-i) ? 2 I. (ideal-ii) a 2 I and b a implies b 2 I. (ideal-iii) S I and WS # implies WS 2 I. We let Ideals(P) denote the set of all ideals of P. Observe that if P is a bounded lattice, then an ideal in this sense corresponds to a lattice ideal [Gra78, p. 17]. As in the case of lattices ([Gra78, Ch. I, Sec. 3, Cor. 2]), the set of ideals of a BPPO admits a natural structure as a lattice. Speci cally, we de ne the bounded lattice Ideals(P) = (Ideals(P); P; ;;[;\) associated with the BPPO P as follows. It is trivial to verify that the intersection of any number (possibly in nite) of ideals is itself an ideal. Intersection of (two) ideals thus forms the meet operation in Ideals(P). The join of two ideals is the intersection of all of the ideals which contain their union. More precisely, for I; J 2 Ideals(P), de ne I[J = TfK 2 Ideals(P ) j I K and J Kg. Given a set S P , the ideal generated by S is the intersection of all ideals containing S, and is denoted by Ideal(S), or by Ideal(S;P) if we need to make explicit which BPPO we are talking about. Since P itself is such an ideal, this intersection is nontrivial. As in the case of ideals of lattices, for a 2 P we call Ideal(fag) the principal ideal generated by a. 28 1. THE THEORY OF DISTRIBUTIVE PARTIAL STRUCTURES The dual concept is de ned as follows. I S is a dual ideal if it satis es the following conditions. (dideal-i) > 2 I. (dideal-ii) a 2 I and a b implies b 2 I. (dideal-iii) S I and VS # implies VS 2 I. We let DualIdeals(P) denote the set of all ideals of P. The dual ideals form a bounded lattice DualIdeals(P) = (DualIdeals(P); P; ;;[d;\) in a completely analogous fashion, with I[dJ = TfK 2 DualIdeals(P) j I K and J Kg. The dual ideal generated by the set S is denoted by DualIdeal(S), or DualIdeal(S;P). Given the BPPO P = (P; ;>;?;W;V), we have two natural injections. The rst, LowerExt(P) : P ! Ideals(P), called the lower extension of P, is de ned by a 7! Ideal(fag). The second, UpperExt(P) : P ! Dual(DualIdeals(P)), called the upper extension of P, is de ned by a 7! DualIdeal(fag). It is trivial to verify that each of these functions is injective and a BPPO morphism. We clearly have the following. 1.3.6 Theorem| extension of a BPPO to a bounded lattice Any BPPO has an injective extension pair to BdLat. Proof: (Ideals(P); LowerExtP)) and (Dual(DualIdeals(P));UpperExt(P)) are each such extensions. 2 Thus, the extension problem for BPPO's to lattices is, in some sense, trivial. We shall show in the next section, however, that it is far from trivial if we demand that the extension be distributive. First, though, let us take a closer look at the question of when such an extension is an embedding. We start with a generalization of the notion of a generalized bounded partial lattice, which is a direct generalization of the concept of partial lattice identi ed in [Gra78, Ch. I., Sec. 5, Def. 12]. 1.3.7 Generalized Bounded Partial Lattices A GBWPL is a Generalized Bounded Partial Lattice (GBPL) if it has an embedding extension into a bounded lattice. A GBWPL (or, equivalently, a BPPO) P satis es the lower ideal condition if for any S f P and any a 2 S, if Ideal(S;P) = Ideal(fag;P) then WS # and WS = a. Dually, it satis es the upper ideal condition if for any S f P and a 2 P , if DualIdeal(S;P) = DualIdeal(fag;P) then VS # and VS = a. 1.3.8 Theorem | characterization of GBPL's Let P be a GBWPL. Then P is a GBPL i it satis es both the lower and the upper ideal conditions. Proof: The proof is a generalization of that given in [Gra78, Ch. I, Sec. 5, Thm. 20], which is attributed to Funayama. First of all, assume that P is a GBPL, and let (L; ) be an embedding extension of P. Let S f P and a 2 P be such that Ideal(S;P) = Ideal(fag;P). Then (Ideal(fag;P)) = (Ideal(S; P )) 1.4 Extensions of BPPO's to Distributive and Boolean Lattices 29 Ideal( (S);L) \ (P ) = Ideal(W (S);L) \ (P ). Thus, we have that (a) W (S) in L. On the other hand, we also have that (s) (a) for each s 2 S, just by the assumed conditions on the ideals, and so we must have that (a) = W (S). But since is an embedding, this means that WS #, with a = WS. Proving that the upper ideal condition holds is dual. Conversely, assume that P satis es both the lower and upper ideal conditions. Let L = Ideals(P) Dual(DualIdeals(P)), and de ne the function : P ! L by a 7! (Ideal(fag);DualIdeal(fag)). We claim that the pair (L; ) is an embedding extension of P. It follows immediately from 1.3.5 that is an injective morphism. We need to show that it is an embedding. Let S f P and a 2 P be such that (a) = W (S). Then, by the lower ideal condition, we have that WS # and a = WS. Similarly, if we have T f P and b 2 P with (a) = V (T ), then we may use the upper ideal condition to establish that b = VT . Thus is an embedding, as was to be shown. 2 1.3.9 Universal Extensions The question of universal extensions of arbitrary BPPO's is a rather complex one, and we will not address it here. The interested reader may wish to look at [Gra78, Ch. I, Sec. 5] or [Bir67, Ch. 6, Sec. 8] for more information. From a computational point of view, one of the problems is that a free (universal) lattice over a nite BPPO may be in nite. Fortunately, the problem of existence of free distributive lattices is somewhat more accessible, and it is to this important problem that we now turn. 1.4 Extensions of BPPO's to Distributive and Boolean Lattices Extensions of BPPO's to distributive lattices are closely related to forms of binary decompositions of the lattice | that is, to the set of morphisms from the BPPO into the two-element lattice 2. We now turn to a development of these ideas. 1.4.1 Ideal binary decompositions Let P be a BPPO. An ideal binary decomposition of P is a pair (I; J) in which I 2 Ideals(P), J 2 DualIdeals(P), and fI; Jg forms a partition of the underlying set P , i.e., I [ J = P and I \ J = ;. 1.4.2 Lemma | characterization of ideal binary decompositions Let P be a BPPO, and let f : P ! f?;>g. Then f is the underlying function of a BPPO morphism P! 2 i (f 1(f?g); f 1(f>g)) is an ideal binary decomposition of P. Proof: Assume that f : P ! 2 is a BPPO morphism. Suppose that S f P is such that WS #, with S f 1(?). Then, ? = Wf(S) = f(WS), so WS 2 f 1(?). Hence f 1(?) 2 Ideals(P). Similarly, f 1(>) 2 DualIdeals(P). Since ff 1(f?g); f 1(f>g)g is clearly a partition of P , we have an ideal binary decomposition. Conversely, suppose that f : P ! f?;>g is a function with the property that (f 1(f?g); f 1(f>g)) is an ideal binary decomposition of P. Then if S f P is 30 1. THE THEORY OF DISTRIBUTIVE PARTIAL STRUCTURES such that WS # and for each s 2 S, f(s) = ?, then f(WS) = ? as well, since f 1(f?g) 2 Ideals(P). Similarly, if S f P is such that VS # and for each s 2 S, f(s) = >, then f(VS) = > as well, since f 1(f>g) 2 DualIdeals(P). Hence f is a morphism, as required. 2 This correspondence between ideal binary decompositions and morphisms into 2 is so central to our results that we need to make the identi cation explicit. This is done as follows. 1.4.3 Morphisms into the lattice 2 Let P be a BPPO, and let (I; J) be an ideal binary decomposition of P. De ne the morphism Ifn(I;J) : P! 2 by Ifn(I;J) = ( ? if p 2 I; > if p 2 J . Let IdBinDecomp(P) = fIfn(I;J) j (I; J) is an ideal binary decomposition of Pg. For bounded bit-vector lattices, we employ an additional notation. Let L be a bounded bit-vector lattice over the set S, and let s 2 S. De ne the s-projection s : L! f?;>g by s(v) = ( ? if v(s) = 0; > if v(s) = 1. 1.4.4 Nonredundancy and independence Let L be a bounded bit-vector lattice over the set S. We say that the pair s1; s2 2 S is logically identical if for every f 2 L, f(s1) = f(s2). In a situation with s1 and s2 logically identical, one of them may be removed without changing the lattice, up to isomorphism. L is called nonredundant if it does not contain any logically identical pairs. Clearly, we can always render a bounded bit-vector lattice nonredundant, provided the axiom of choice is assumed. For the most part, it will be convenient for us to work with nonredundant representations. Let v 2 L. For any R S, we de ne BitComp(v;R) to be the function de ned by BitComp(v;R) = ( 1 v(x) if x 2 R; v(x) otherwise. Now let M be any bounded lattice, and let f : L ! M be a morphism. For s 2 S, we say that f is independent of s if for any bit vector v 2 L, we have that whenever BitComp(v; fsg) 2 L, then f(v) = f(BitComp(v; fsg)). Otherwise, we say that f is dependent upon s. The following critical observation tells us that the only morphisms from a bounded bit-vector lattice into 2 are the projections of a single \bit." 1.4.5 Proposition | characterization of morphisms into the lattice 2 Let S be a set, let L be a bounded bit-vector lattice over S. Then f : L! f?;>g is the underlying function of a morphism L! 2 i f = s for some s 2 S. 1.4 Extensions of BPPO's to Distributive and Boolean Lattices 31 Proof: It is trivial to verify that each of the s's are morphisms; we need to establish the opposite direction. So, let f : L ! 2 be a morphism. Without loss of generality, assume that S does not contain any distinct logically identical pairs. Suppose that there are two distinct elements s1; s2 2 S which f is dependent upon. Then there are vectors v11; v12; v21; v22 2 L such that v12 = BitComp(v11; fs1g), v22 = BitComp(v21; fs2g), v11(s1) = 1, v21(s2) = 1, f(v11) = f(v21) = 1 and f(v12) = f(v22) = 0. Now, since f is a morphism, we must have that f(v11^v21) = 1 and f(v12_v22) = 0. But it follows from the above de nitions that v11(s1)^v21(s1) = v12(s1)_v22(s1). For if not, then we must have that v11(s1) = v21(s1) = 1 and v12(s1) = v22(s1) = 0. But this cannot happen, since v21(s1) = v22(s1). Similarly, v11(s2)^v21(s2) = v12(s2)_v22(s2). Additionally, v11 and v12 agree on all positions other than s1, and v21 and v22 agree on all positions other than s2. Thus v11(s)^v21(s) v12(s)_v22(s) for all s other than s1 or s2. But we have just shown that v11(s)^v21(s) = v12(s)_v22(s) for s = s1 or s2. Thus v11(s)^v21(s) v12(s)_v22(s) for all s 2 S; i.e., v11^v21 v12_v22. Since a lattice morphism is monotonic, this means that f(v11^v21) f(v12_v22), a contradiction. Hence f can be dependent upon only one of s1 and s2. From this it follows that it must be a projection. 2 The ideal binary decompositions of a bounded bit-vector lattice are then in bijective correspondence with the projections of \bits." 1.4.6 Proposition | decompositions of bounded distributive lattices Let S be a set, and let L be a bounded bit-vector lattice over S. Let I; J L. Then (I; J) is an ideal binary decomposition of L i there is an s 2 S such that I = fx 2 L j s(x) = ?g and J = fx 2 L j s(x) = >g. Proof: Follows from 1.4.2 and 1.4.5. 2 We are now ready to state our rst extension result to distributive extension categories. Namely, the existence of such an extension depends entirely upon the existence of an ideal binary decomposition. 1.4.7 Theorem | existence of extension pairs Let P be a BPPO. Then, for any of the distributive extension categories, P has an extension pair i it has an ideal binary decomposition. Proof: If P has an ideal binary decomposition, then by 1.4.2 it has a morphism f : P ! 2, which renders (2; f) an extension pair. Conversely, let (L; ) be an extension pair. Since L is distributive, by 1.1.4(a) we know that it is isomorphic to a bounded bit-vector lattice M over a set S. Then, by 1.4.6, we know that for any s 2 S there is a projection s : M ! 2. Then, letting : L ! M denote the isomorphism between L and M, we have that s : P! 2. So, nally, applying 1.4.2, we get an ideal binary decomposition. 2 1.4.8 Examples Let us illustrate these ideas with an example. Let P1 be the lattice (qua BPPO) represented by the diamond of Figure 0.3. It is easy to see that it 32 1. THE THEORY OF DISTRIBUTIVE PARTIAL STRUCTURES has no ideal binary decompositions at all. Indeed, let (I; J) be such a decomposition. Then we must have that e 2 I. Now if any pair fx; yg of elements from fb; c; dg is in I, then we must also have that a 2 I as well, since the constraint x_y = a holds. But if both a; e 2 I, then the decomposition is trivial; i.e., J = ;. Dually, if the pair fx; yg is in J , then we must also have that e 2 J as well, since the constraint x ^ y = e holds. Since some pair of elements from fb; c; dg must be in either I or else in J , it follows that no ideal binary decomposition can exist. On the other hand, letP2 be the lattice (qua BPPO) represented by the pentagon of Figure 0.2. Then we have two ideal binary decompositions, (fa; bg; fc; d; eg) and (fa; c; dg; fb; eg). To get injective decompositions, we essentially need to ensure that there are enough ideal binary decompositions, where \enough" means a su cient number to ensure that for any two distinct elements, there is a decompositions which sends those elements to distinct members of f?;>g. 1.4.9 Separating families of decompositions Let P be a BPPO, and let fx; yg P . We say that x and y are separable if there is a morphism f : P ! 2 with f(x) 6= f(y). In this case, we call f a separator for fx; yg. We say that P is somewhere separable if there is a pair fx; yg P which is separable. It is clear that somewhere separability is equivalent to the separability of f?;>g, since any morphism must separate ? from >. Now let be a family of BPPO morphisms, each of the form P ! 2, and let Q be a set of pairs of elements of P . The family is called a separator for Q (or a Q-separator) if it contains a separator for each pair in Q. It is called a (full) separator for P if it contains a separator for every pair fx; yg P with x 6= y. In the case that such a exists, we say that P is fully separable. 1.4.10 Theorem | existence of extensions Let P be a BPPO, and let C be one of the distributive extension categories. (a) P has an extension pair into C i it is somewhere separable. (b) For Q a set of pairs of elements of P , P has a Q-injective extension pair into C i Q has a separator. (c) P has an injective extension into C i it is fully separable. Proof: Part (a) is just a restatement of 1.4.7 in terms of separators. To show part (b), let Q be a set of pairs of elements of P , and (L; ) be a Q-injective extension into C. Without loss of generality, we may take L to be a bounded bit-vector lattice. Let S be the index set over which this lattice is taken. It is clear that f s j s 2 Sg is fully separating for L. But then, since is injective, it must be the case that f s j s 2 Sg is separating for each pair in Q. Conversely, suppose that Q has a separator . Write this set as an indexed set: = ffs : P ! 2 j s 2 Sg. Let L = Qs2S 2, and let : P ! L be given by p 7! hfs(p)is2S . Then (x) 6= (y) for any pair fx; yg 2 Q, since fs(x) 6= fs(y) for some s 2 S. Thus (L; ) is Q-injective, as required. 1.4 Extensions of BPPO's to Distributive and Boolean Lattices 33 Part (c) is a special case of (b), with consisting of all pairs of distinct elements of P . 2 1.4.11 Examples We continue with the examples of 1.4.8. SinceP1 has no ideal binary decompositions, it has no distributive extensions at all. Neither can P2 have an injective distributive extensions, since there is not an ideal binary decomposition which separates the pair fc; dg. In e ect, what this says is that to make a pentagon distributive, we must collapse the two elements on the \long" path from the bottom to the top. In a diamond, we have no choice but to collapse the whole thing to a single element. Finally, we turn to the issue of universal extensions. For the distributive extension category of perfect Boolean lattices, the universal extension uses the product of all extension pairs. For the other categories, it is a matter of restricting this product appropriately. The details follow. 1.4.12 Theorem | existence of universal extensions over PerfBoolLat Let P be a BPPO. Then, P has a universal extension over PerfBoolLat i it has an extension over PerfBoolLat. The universal extension is injective i there is some injective extension over PerfBoolLat. The explicit construction is as follows. Let F = IdBinDecomp(P), and let : P ! 2F be de ned by p 7! hf(p)if2F . Then (2F ; ) is a universal extension of P to a perfect Boolean lattice. Proof: If P has no extension at all, then it certainly has no universal extension. Thus, let us assume that it has at least one extension to PerfBoolLat. In view of 1.4.7, this can happen i F is nonempty. Now, letM be any perfect Boolean lattice, and let g : P!M be a BPPO morphism. Without loss of generality, we may take M to be 2S for some set S. Now, consider the diagram of in Figure 1.2. P 2F 2T 2 @@@@@@R g @@@@@@@R f = ht t ? ĝ Figure 1.2: We need to show that there is a unique morphism ĝ which makes the left triangle commute. First of all, for t 2 T , t g : P ! 2, and so must be a member of F . Hence there is some f 2 F such that f = t g. Name this f as ht. Now, since 2T is a product in PerfBoolLat, there is a unique morphism ĝ : 2F ! 2T making the right triangle commute. But t ĝ = t g for each t 2 T . Thus, using the 34 1. THE THEORY OF DISTRIBUTIVE PARTIAL STRUCTURES fact once again that 2T is a product, we have that ĝ = g. The uniqueness of ĝ follows from the uniqueness of the ll-in for a product [HS73, 18.1]. Hence (2F ; ) is a universal extension of P over PerfBoolLat. Now ifP has an injective extension, then by 1.4.10(b) we know that it has a separating set of ideal binary decompositions. Thus, in particular, the set IdBinDecomp(P) must be separating. From this it follows directly that is injective. 21.4.13 Corollary | existence of universal extensions over distributive extension categories Let P be a BPPO, and let C be a distributive extension category. Then P has a universal extension over one of the categories in C i it has a universal extension over all of them. If one of these extensions is injective, then they all are. The explicit construction is as follows. Let (2F ; ) be the universal extension described in the above theorem. For the distributive extension category PerfBoolLat, we are done. Otherwise. let L be the C-subalgebra of 2F (distributive lattice or Boolean lattice) generated by (P ), and let C : P ! L be the morphism which is identical to , except that its codomain is restricted to be L. Then (L; C) is a universal extension of P to C. Proof: If C is PerfBoolLat, then the result has already been proven in the above theorem. Otherwise, let (2F ; ) be a universal extension of P to PerfBoolLat, let M be a C object, and let g : P!M be a BPPO morphism. Consider the diagram of Figure 1.3. P L 2F M 2T C L ?~ g ?̂g M @@@@@@@R g Figure 1.3: Here L is the C object generated by (P ) and L is the natural inclusion of L into 2F . That is to say, if C is BdDiLat, then L is the smallest distributive sublattice containing (P ). Explicitly, its underlying set is the intersection of the underlying sets of all distributive sublattices of 2F which contain (P ). If C is BoolLat, then it is the smallest Boolean lattice containing (P ). Since M is a distributive lattice, in view of 1.1.4(c), we may embed it into a perfect Boolean lattice 2T . We let M be such an embedding. From the previous theorem, we then have a morphism ĝ such that the pentagon of the diagram commutes. To obtain the ll-in ~ g, we simply use the appropriate restriction of ĝ. Now 1.5 Atoms in BPPO's 35 ĝ( L(L)) is the underlying set of the smallest sublattice of 2T in C which contains ĝ( L( C(P ))) = M(g(P )) = 1 M(g(P )). The image of M under M is also a sublattice of 2T which contains M(g(P )), and so ĝ( L(L)) M(M). Thus, there is a unique well-de ned ll-in ~ g de ned by x 7! 1 M(ĝ( M)(x)). It is easily veri ed that this ll-in is a morphism, thus completing the proof. 2 1.4.14 Remark on the existence of complements The preceding corollary states that, from a fundamentals point of view, once we can get distributivity, a guarantee of the existence of various forms of complements comes for free. This is quite important because negation (qua complementation) is an important operation in many practical speci cations. Once we know that we have a distributive extension of a particular kind, we know that we can extend it to one with complements. Thus, complements need not be studied separately. 1.4.15 Examples | universal extensions need not be injective Let us continue with the example P2 of 1.4.11. Over PerfBoolLat, the universal perfect Boolean lattice is 22. The morphism : P2 ! 22 behaves as follows. a 7! (>;>) b 7! (>;?) c 7! (?;>) d 7! (?;>) e 7! (?;?) Thus, c and d are identi ed in this universal pair; and, indeed, in every universal extension. Since is surjective, the result is the same in the other distributive extension categories. It is instructive to illustrate that we may construct a BPPO P3 with six elements which has only one decomposition, thus implying that a universal extension (L; ) over P3 must have that L is isomorphic to 2. Let P3 be the lattice (qua BPPO) illustrated in Figure 1.4. We know from the discussion of P2 in 1.4.8 that the diamond de ned by the elements fa; b; c; d; eg cannot have any ideal binary decomposition. Therefore, the only ideal binary decomposition of P3 is (ffg; fa; b; c; d; eg). Hence, by 1.4.13, we have that (2; 3) is a universal extension of P3 for any of the distributive extension categories, with 3 de ned by a; b; c; d; e 7! > and f 7! ?. 1.5 Atoms in BPPO's Languages such as CUF allow types to be declared to be constant. A constant type is constrained so that it may not have any proper subtypes other than ?. Within a lattice-like framework, the formalization of a constant type is that of an atom. In this section, we take a look at how such constraints may be viewed within our theoretical framework. 36 1. THE THEORY OF DISTRIBUTIVE PARTIAL STRUCTURES a b c d e f 6 @ @ @I @ @ @I 6 6 Figure 1.4: A bounded lattice whose universal distributive extension is 2. 1.5.1 Basic de nitions In a bounded lattice L, an element a 2 L is an atom if for every x 2 L, if x a then either x = ? or else x = a. Unfortunately, there does not appear to be a meaningful de nition of an atom in a BPPO. We could say that, given a BPPO P, a 2 P is an atom if for every extension (L; ) of P, a is an atom of L. However, it is always possible to nd an extension of P in which a is not an atom, so this de nition is vacuous. Rather, the best that we can do is to restrict attention to those extensions in which a is an atom. We thus make the following de nition regarding atoms in the context of a particular extension. Let P be a BPPO, and let S P . An extension (L; ) of P is atomic for S if for each a 2 S, a is an atom in L. We can then seek to characterize such atomic extensions. Unfortunately, sets of atomic extensions, even distributive ones, do not share all of the nice properties of sets of general distributive extensions. The following examples illustrates some of the principal problems. 1.5.2 Examples Let P be the BPPO with P = f?;>; a; bg, and with no order on the symbols other than the required ones; i.e., ? a, ? b, a >, and b >. The only generalized join and meet operations are the trivial ones implied by this order. Now suppose that we require a to be an atom; that is, suppose that S = fag. Then it is easy to see that there can be no universal extension to BdDiLat which is atomic for S. For suppose that (L; ) is such an extension. Then there are two possibilities: either (b)^ (a) = (a) or else (b)^ (a) = ? in L. Any other value for this meet would invalidate the requirement that a be an atom. Now let (L1; 1) and (L2; 2) be the simple extensions depicted on the left and right, respectively, in Figure 1.5. In these extensions, the associated morphism i is the identity on elements; the target lattice L1 or L2 just has more structure than P. Now it is easy to see that no universal extension (L; ) in which a is an atom has the property that there are g1 and g2 such that the diagram of Figure 1.6 is commutative for both i = 1 and i = 2. Indeed, if (a) ^ (b) = (a) in L, then g1( (a)) ^ g1( (b)) = g1( (a)) in L1, i.e., 1.5 Atoms in BPPO's 37 > a b ? >b a ? J J J J ] J J J J J] 666 Figure 1.5: Two bounded distributive lattices in which a is an atom. P L L1 ZZZZZZ~ i ? gi Figure 1.6: Diagram to support argument of the impossibility of universal extensions which preserve atoms. a^ b = a, which fails. Similarly, if (a)^ (b) = ? in L, then g2( (a))^ gi( (b)) = ? in L2, i.e., a ^ b = ?, which fails. There is a further problem with atoms. Unlike equational properties such as being distributive or Boolean, the property of being an atom is not preserved under morphic image. Given any bounded lattice L1 and any atom a 2 L, we may build a slightly larger lattice L2 in which a is not an atom, and an injective morphism f : L1 ! L2 which is the identity on L1. Just pick a name b 62 L1. Create L2 from L1 by having L2 = L1 [ fbg. We put b \in between" a and ? by de ning, in L2, b _ a = a, b ^ a = b, and, for any other x 2 L1, b _ x = a _ x and b ^ x = a ^ x. It is easy to see that the lattice axioms are satis ed, and that a is no longer an atom. Thus, we can always \embed away" the property of being an atom. From a practical point of view, the previous examples illustrate that, if we wish to specify that certain elements be atoms, then we cannot speak of the (up to isomorphism) natural extension of the BPPO P to a given context, nor can we characterize the property of an extension (L; ) of P by considering morphisms with domain P, as we did in the previous section for other kinds of extensions. Rather, we must be more careful. We proceed as follows. 38 1. THE THEORY OF DISTRIBUTIVE PARTIAL STRUCTURES 1.5.3 Atomic Extensions Let P be a BPPO, and let ff j f : P ! 2g. The full natural extension of P de ned by is de ned to be (2 ; ), with (a) = hf(a)if2 . An extension (L; ) is a natural extension of P with respect to if there is an injective morphism which preserves atoms (i.e., maps atoms to atoms) such that the diagram in Figure 1.7 commutes. Note that this is a generalization of the P L 2 ZZZZZZ~ ? Figure 1.7: Diagram for 1.5.3. constructions used in 1.4.12 and 1.4.13; in those articles we have the special case that = IdBinDecomp(P). Now let S P n f?;>g. We say that renders S atomic if for every a 2 S, there is exactly one f 2 such that f(a) = >. (In other words, f(a) = ? for all f 2 , save for possibly one.) The following lemma is well-known, but it is crucial to our work, and easy to prove, so we repeat it here. 1.5.4 Lemma Let L be a bounded distributive lattice. Then there is a perfect Boolean lattice B and an embedding : L! B which preserves atoms. Proof: Without loss of generality, we may take L to be a bounded bit-vector lattice. Let R be the index set for the bits of the bit vectors. For each atom a 2 L, let Ra be the set of bits which are 1 in the representation of a. For a1, a2 distinct atoms, it is clear that Ra \Rb = ;, since a ^ b = ?. Thus, we can replace, for each atom a, the set Ra with a single element, without changing L, up to isomorphism. Once we do this, we are left with the situation that each atom of L is represented by a bit vector in which exactly one bit is nonzero. Let us call the new index set R0. To complete the proof, we embed this modi ed L into the perfect lattice 2R0. Since the atoms of L were represented by elements with a single nonzero bit, they continue to be atoms in 2R0. 2 Finally, we come to our main characterization of extensions to a BPPO which forces certain elements to be atoms. 1.5.5 Theorem | characterization of atoms Let P be a BPPO, let S P n f?;>g, and let (L; ) be an extension of P. Then 39 (a) If ff j f : P ! 2g renders S atomic and (L; ) is natural with respect to , then (L; ) is atomic for S. (b) If (L; ) is atomic for S, then there is a ff j f : P! 2g which renders S atomic. Proof: Part (a) is immediate; note that the atoms of 2 are precisely the -tuples in which exactly one entry is > and the rest are ?. Thus, since renders S atomic, it follows that each (a) is an atom in 2 for each a 2 S. But of Figure 1.7 is an injection, and it is easy to see that in that case the inverse image of an atom must be an atom. Thus, (a) is an atom of L for each a 2 S, and so (L; ) is atomic for S. To show part (b), we simply invoke 1.5.4, and use the fact that any perfect Boolean lattice is of the form 2A for some set A. Thus, we can construct a morphism h : P! 2A which preserves atoms. Now, we de ne = f x j x 2 Ag. Since an element in 2A is an atom i exactly one of its components is >, it follows that renders S atomic. 2 1.5.6 Theorem | independence of the extension category Let P be a BPPO, and let S P n f?;>g. Then, if P has an extension (resp. injective extension) which is atomic for S to any one of the distributive extension categories, then it has such an extension to all of them. Proof: This follows immediately from 1.5.4, since that result shows that we can extend the extension to one in PerfBoolLat, which is a subcategory of all of the others. 2 In summary, when dealing with speci cations which require that certain types must be atomic, we must look for speci c extensions which yields this result, rather than characterizing a universal extension which subsumes all others. In Section 2.5, we will return to the issue of atoms by addressing some of the computational issues. 2. Computational Complexity of Decision Problems In this section, we turn to the problem of determining the computational complexity of deciding whether or not a BPPO has a distributive extension of one sort or another. For obvious reasons, we now restrict our attention to nite structures. 2.1 Determining Consistency of Prespeci cations A speci cation that a user of a system such as CUF supplies is not likely to be a BPPO. Rather, it will be some sort of \skeleton" that may be extended to a BPPO. To assess the complexity of the whole process of taking a speci cation and deciding whether or not it is extensible to a distributive lattice, we must therefore break the process into two distinct steps. First, we must determine if the speci cation is 40 2. COMPUTATIONAL COMPLEXITY OF DECISION PROBLEMS \well-formed," that is, if it represents a consistent speci cation of a BPPO. Second, if it does specify a BPPO, then we must decide whether or not it has the appropriate form of extension. In this subsection, we address the question of determining whether a prespeci cation is well formed as a de nition of a BPPO, and show that the problem of determining this is solvable in deterministic polynomial time. To begin, we give the de nition of a prespeci cation. 2.1.1 BPPO prespeci cations A nite BPPO prespeci cation is a pair S = (P;C) in which (i) P is a nite set, called the set of inner types. We call P [ f?;>g the set of types of S, and denote it by Aug(P ). (ii) C is a nite set, called the set of constraints. Each constraint in C is an expression of one of the following three forms. (a) (a ;?;W;V) be a BPPO. Informally,B is consistent with S if it can be extended to S in a \natural" way. Formally, we say that B is consistent with S if it satis es the following conditions. 2.1 Determining Consistency of Prespeci cations 41 (cs-i) B = Aug(P ). (cs-ii) (a ;?;W1;V1), we have that a b implies a 1 b, WS = a implies W1 S = a, and VS = a implies V1 S = a, for all a; b 2 B and all nonempty S B. We say that S is consistent if it is consistent with some BPPO. In other words, a consistent prespeci cation is one which can be \extended" to a BPPO. 2.1.3 The consistency decision problem The formal decision problem which we shall address in this subsection is the following. The decision problem PreBPPO-Consis: Input: A BPPO prespeci cation S. Question: Does S have a consistent extension to a BPPO? 2.1.4 Acyclicity and the partial order of prespeci cations A key issue that we need to address in determining whether or not a prespeci cation is consistent is to determine whether or not it de nes a partial order. If the implied order relation is cyclic, then we cannot have a partial order, which is acyclic by de nition. The test is actually accomplished in two steps. In the rst step, which we elaborate here, we check for so-called weak acyclicity, in which the underlying graph is checked for cycles. Let S = (P;C) be a nite BPPO prespeci cation. The graph of S, denoted Graph(S), is a directed graph with vertices consisting of the elements of Aug(P ), and edges de ned as follows6. (i) (?;>) 2 Graph(S). (ii) For each a 2 P , (?; a) 2 Graph(S) and (a;>) 2 Graph(S). (iii) For each constraint of the form (a ;?;W;V), we must have that Graph(S) . Thus, if S is consistent, then it must be weakly acyclic. (b) It is decidable in deterministic time O(Size(S) log(Card(P ))) whether or not S is weakly acyclic. (c) Graph(S) may be constructed from Graph(S) in deterministic time O(Card(P )3). Proof: Part (a) is immediate. For part (b), the rules of 2.1.4 provide a means of enumerating the tuples (which represent the edges) of Graph(S). However, a representation of a graph as a set of ordered pairs is not particularly amenable to the e cient detection of cycles. Therefore, it is advantageous to build a more useful representation of the graph. We employ a data structure, with the following characteristics, for representing sets of items. (i) The entire set of items may be traversed in time linear in the size of the set. (ii) Given its name, any particular item may be reached in time logarithmic in the size of the set. (iii) A new item may be added in time logarithmic in the size of the set. An appropriate data structure is a balanced binary search tree, such as a red-black tree [CLR90, Ch. 14]. This data structure is used in two ways. First of all, the set of all nodes of Graph(S) is represented in this way. Secondly, for each node a, there is a balanced binary search tree, attached to node a, which represents the set of all nodes which may be reached from a by following a single directed edge from tail to head. Given a way to enumerate the edges of the graph in time linear in the number of tuples (which is easily obtained from the de nition of 2.1.4), such a representation may be built in time O(Size(S) log(Card(P ))). Indeed, the tuples of Graph(S) themselves may be enumerated in time O(Size(S)). For each such tuple (a; b), its insertion into the data structure involves two steps. First, a is inserted into the list of all nodes of the graph. Second, b is inserted into the nodes list of a. Each step may be performed in timeO(log(Card(P ))). Thus, to build the graph, O(Size(S)) steps, each of time complexity O(log(Card(P ))), must be performed, yielding the complexity O(Size(S) log(Card(P ))). Now, to determine whether or not Graph(S) is acyclic, we start at ? and traverse the graph depth rst. Nodes are marked as they are encountered in the traversal in a forward direction, and the marks are erased upon backtracking over them. The graph is cyclic if we encounter a marked node while traversing in the forward direction; otherwise it is acyclic. In the data structure which we have described, this traversal can be done in time proportional to the number of edges in the graph, which is clearly O(Size(S)). See, for example [CLR90, Lemma 23.10]. Hence, the 2.1 Determining Consistency of Prespeci cations 43 whole procedure of building the representation of the graph, and then testing it for acyclicity, is bounded in time complexity by O(Size(S) log(Card(P ))). Finally, for part (c), we may employ one of the standard transitive closure algorithms, which run in time (Card(P )3) [CLR90, pp. 562-563]. 2 2.1.6 Examples | weak acyclicity is not su cient There may be order dependencies implied by a prespeci cation S which are not recaptured in Graph(S). We illustrate with a pair of examples. Let S1 = (P1;C1) be the BPPO prespeci cation in which P1 = fa; b; c; d; eg, and C1 = f(Wfa; b; cg = d); (Wfa; bg = e)g. Then clearly we must have that e d, yet this constraint is not recaptured by Graph(D). Let S2 = (P2;C2) be the BPPO prespeci cation in which P2 = fa; b; c; d; eg, and C2 = f(Wfa; b; cg = d); (Wfa; b; cg = e)g. This prespeci cation is inconsistent, because we must have e = d. But this inconsistency does not cause Graph(S) to be cyclic, and so is undetected by this test. Here is a somewhat more complex example. Let S3 = (P3;C3) be the BPPO prespeci cation in which P2 = fa; b; c; d; e; f; gg, and C2 = f(Wfa; bg = f); (Wfb; cg = f); (Wfa; cg = e); (Wff; gg = e)g. This prespeci cation is also inconsistent. Indeed, from (Wfa; bg = f) and (Wfb; cg = f) we can conclude that (Wfa; b; cg = f). Since we have (Wfa; cg = e), it must be the case that e f . However, (Wff; gg = e) implies that f e, whence e = f , and so the prespeci cation is inconsistent. However, Graph(S) is acyclic. To detect these sorts of relationships between elements, we must perform a more detailed analysis of how the rules interact. This is accomplished by examining the behavior of ideals, as we next describe. 2.1.7 Ideals of prespeci cations The notion of an ideal of a BPPO prespeci cation is very similar to that of an ideal for a BPPO (see 1.3.4), and, in a consistent BPPO prespeci cation, the two coincide. The details are as follows. Let S = (P;C) be a nite BPPO prespeci cation. An ideal of S is a subset I P subject to the following conditions. (i) ? 2 I. (ii) x 2 I and (y; x) 2 Graph(S) implies y 2 I. (iii) S I and (WS = a) 2 C implies a 2 I. Dually, a dual ideal of S = (P;C) is a subset I P subject to the following conditions. (i) > 2 I. (ii) x 2 I and (x; y) 2 Graph(S) implies y 2 I. (c) S I and (VS = a) 2 C implies a 2 I. Let be a partial order on Aug(P ), and let a 2 Aug(P ). The principal preideal of a with respect to , denoted PrinIdeal(a; ), is fx 2 Aug(P ) j x ag. Dually, 44 2. COMPUTATIONAL COMPLEXITY OF DECISION PROBLEMS the dual principal preideal of a with respect to , denoted DualPrinIdeal(a; ), is fx 2 Aug(P ) j a xg. We say that is stable with respect to S if Graph(S) and every principal preideal I with respect to is an ideal of S, and every dual principal preideal of S with respect to is a dual ideal of S. Intuitively, stability of means that applying the rules inC to principal preideals and dual principal preideals will not add new elements to the sets. In other words, the rules of C do not imply the necessity of adding new pairs to to make this partial order consistent with them. 2.1.8 Lemma Let S be a nite BPPO prespeci cation which is weakly acyclic. Then, if S admits a stable partial order, it admits a smallest such order S, which is given by a S b i a b for all stable partial orders with respect to S. Proof: Assume that S admits a stable partial order, and let E be the set of all stable partial orders on Aug(P ) with respect to S. Now it is clear that \E is a partial order on P , and that it contains Graph(S). We need to show that it is stable. To see this, rst of all, note that for each a 2 Aug(P ) we have that \ 2EPrinIdeal(a; ) is an ideal of S which contains a. Indeed, this follows immediately from the easily seen fact that any intersection of ideals is itself an ideal. But \ 2EPrinIdeal(a; ) = PrinIdeal(a; S). Dually, we must have for each a 2 Aug(P ) that \ 2EDualPrinIdeal(a; ) is a dual ideal of S which contains a, and that \ 2EDualPrinIdeal(a; ) = DualPrinIdeal(a; S). Hence, (\E) = S is stable, as required. 2 2.1.9 Notation If S is a weakly acyclic nite BPPO prespeci cation which admits a stable partial order, then we call S stable, and we denote the smallest such stable partial order, as identi ed in the above lemma, by S. It is clear that if S does not have a stable partial order, then it cannot be extended to a BPPO. Indeed, a stable partial order is the only kind that respects the ordering requirements imposed by the rules. Let us illustrate this more completely with a pair of examples. 2.1.10 Examples Let S1 = (P1;C1) be as in 2.1.6. Notice that e 62 PrinIdeal(d;Graph(S1)), yet e must be in every ideal which contains a, since every such ideal must also include fa; b; cg. Hence Graph(S1) is not stable with respect to S1. In this case though, if we add the pair (d; e) to this partial order, we do obtain a stable one. Now consider S2 = (P2;C2) of 2.1.6. In this case, we must have that d is in every ideal containing e, and that e is in every ideal containing d. Since the set of ideals of S2 must include principal preideals if an associated order is to be stable, we see that there is no way to extend Graph(S2) to a stable partial order. Thus, not every BPPO prespeci cation with a weakly acyclic partial order may be extended to one with a stable partial order. Similarly, with S3 = (P3;C3) of 2.1.6, we must have that e is in every ideal containing f , and conversely. 2.1 Determining Consistency of Prespeci cations 45 2.1.11 Proposition | complexity of deciding stability Let S = (P;C) be a nite BPPO prespeci cation which is weakly acyclic. Then it is decidable in deterministic time O(Card(P )4 Size(S) log(Size(S))) whether or not S has a stable partial order. If it has one, this order may also be computed in deterministic time O(Card(P )4 Size(S) log(Size(S))). Proof: The high-level algorithm proceeds as in Figure 2.1. 1. For each p 2 P 2. PI(p) := PrinIdeal(p;Graph(S)); 3. DPI(p) := DualPrinIdeal(p;Graph(S)); 4. End for each; 5. := Graph(S); 6. done := false; 7. Repeat 8. temprel := ;; 9. For each p 2 P 10. For each (WS = a) in C 11. If S PI(p) and a 62 PI(p) 12. then 13. temprel := temprel[ (a; p); 14. PI(p) := PI(p) [ PI(a); 15. End if; 16. End for each; 17. For each (VS = a) in C 18. If S DPI(p) and a 62 DPI(p) 19. then 20. temprel := temprel[ (p; a); 21. DPI(p) := DPI(p) [ DPI(a); 22. End if; 23. End for each; 24. End for each; 25. If temprel= ; 26. then done := true; 27. else := [ temprel 28. End if; 29. until done; 30. If acyclic then success; else failure; End if. Figure 2.1: Algorithm for 2.1.10 The idea of the algorithm is as follows. We simply iterate on the principal preideals and dual principal preideals, adding elements which the join and meet rules require to be present, but the partial order has missed. As long as we do not get any cycles, the algorithm succeeds, while a cycle implies that two elements 46 2. COMPUTATIONAL COMPLEXITY OF DECISION PROBLEMS generate identical principal preideals or principal dual preideals, which means that they cannot be distinct elements in any associated BPPO. It is easy to see that this algorithm is correct. Proceeding a bit more formally, we begin by building the principal ideal and dual principal ideal with respect to Graph(S) for each element p 2 P . These are represented by PI(p) and DPI(p), respectively. Then, we iterate over each rule in C and each p 2 P . For a rule of the form (WS = a), it must be the case that a is in every ideal which contains S. Thus, if each element of S is in PI(p), but a is not, then we add PI(a) to PI(p). Note that we add the entire ideal PI(a), and not just a. We also add the pair (p; a) to the relation . A similar rule is applied for dual ideals. We repeat this process until an iteration does not produce any modi cations. Since the underlying set P is nite, this process must terminate. It is clear that the relation must be a subset of any stable partial order for S, since it is a minimal one which is closed under application of the rules of C. Thus, once this computation is completed, we just check to see whether the resulting relation is acyclic. Now let us turn to proving that the complexity is as stated. We assume an ordering on the types, and represent sets as linear linked lists. We start by representing the set S in each rule of the form (WS = a) and (VS = a) as a linearly linked list. This can be done, for all such rules, in time O(Size(S) log(Size(S))). In lines 1-4, for each p 2 P , we build the principal preideal PrinIdeal(p;Graph(S)), represented as PI(p). We can build linear-linked-list representation of the ideal in time O(Size(Graph(S)) log(Size(Graph(S)))). But Size(Graph(S)) Size(S), so this complexity reduces to O(Size(S) log(Size(S))). Similarly, we build the representation for each DualPrinIdeal(p;Graph(S)). This must be done for each element of P , for a total time bounded by O(Card(P ) Size(S) log(Size(S))). Note that Size(S) Card(P )2 + 2 Card(P ) 2Card(P ), with the Card(P )2 term representing the contribution of rules of the form a ;?;W;V) must have Rel_(S) W and Rel^(S) V. Proof: This follows immediately from the characterization of S in terms of preideals and dual preideals, as given in 2.1.8 and 2.1.9. 2 Finally, we are able to formally identify the \natural" BPPO associated with a consistent prespeci cation. 2.1.16 Consistency and the BPPO of a prespeci cation Given a stable BPPO prespeci cation, S, we de ne the canonical BPPO of S to be CanBPPO(S) = (Aug(P ); S;?;>;Rel_(S);Rel^(S)). For the terminology to make sense, we must show that CanBPPO(S) is indeed a BPPO; this and more we do in the following theorem. 2.1.17 Theorem | consistent extensions Let S = (P;C) be a nite BPPO prespeci cation. (a) S is consistent i it is stable. 2.1 Determining Consistency of Prespeci cations 49 (b) If S is consistent, then the canonical BPPO of S is the unique minimal consistent extension of S. (c) PreBPPO-Consis may be decided in deterministic polynomial time (in the size of S). Proof: We start with (a). If S is consistent, then in light of the discussion in 1.3.4, the associated BPPO B must embed into the lattice of all of its ideals. Thus, in particular, the associated partial order must the stable. Conversely, if S is stable, then we may verify that the canonical BPPO identi ed in 2.1.16 is indeed a BPPO. Properties (bppo-i) { (bppo-iii) of 1.2.2 are immediate. Property (bppo-iv) follows from bounds consistency (2.1.13). Finally, properties (bppo-vi) and (bppo-vii) follow from the de nitions (2.1.14) and consistency (2.1.15) of Rel_(S) and Rel^(S). We have argued in the previous paragraph that the canonical BPPO of S is indeed a BPPO. Unique minimality follows from 2.1.8 and 2.1.15(b). Part (c) follows from the complexity results of 2.1.5 and 2.1.11. 2 Thus, the rst critical step in processing a nite BPPO prespeci cation to determine if it is extendible to a distributive lattice, namely that of determining whether or not it de nes a BPPO at all, may be done in deterministic polynomial time. As we noted above, the canonical BPPO associated with a consistent nite prespeci cation may be exponentially larger in size than the prespeci cation (in terms of the number of join and meet rules). Therefore, it is important that we be able to work with the prespeci cation, without being required explicitly to compute the entire canonical BPPO. Fortunately, this is the case. Indeed, we may even determine when a candidate for a morphism into a lattice is indeed a morphism, just by checking against the prespeci cation. The following proposition characterizes this explicitly. The proof is a simple consequence of the de nitions of the full sets of join and meet rules of 2.1.14, as well as the characterization of stability in 2.1.8. Since we do not explicitly use this result in this report, we omit the simple details of the rather direct proof. 2.1.18 Proposition | characterization of morphisms Let S = (P;C) be a consistent nite BPPO prespeci cation, let L be a distributive lattice, and let f : Aug(P )! L be a function. Then f is a morphism f : CanBPPO(P)! L i the following four conditions are satis ed (i) For each p 2 Aug(P ), f(?) f(p) and f(p) f(>). (ii) For each constraint (a g.7 If ' is a formula with Vars(') X, then we also call f an interpretation 7We use ? to represent false and > to represent true. This convention will make translations between logic and and BPPO prespeci cations smoother, and the meaning of the symbols > and 2.2 The Basic NP-Complete Extension Problems 53 (with respect to X) for '. Given a truth assignment f for X and a formula ' with Vars(') X, we de ne the truth value f(') 2 f?;>g of ' for f in the usual fashion. The interpretation f is called a model of ' if f (') = >, and ' is satis able if it has a model. Mod(') denotes the set of all models of '. Two formulas '1 and '2 are logically equivalent with respect to X if Mod('1) = Mod('2). The CNF satis ability problem Sat-CNF takes as input a formula in CNF and answers true if it is satis able, and false otherwise. The nonredundant CNF satisability problem Sat-Nonredundant-CNF is de ned similarly, but for nonredundant CNF formulas only. The k-CNF satis ability problem, Sat-kCNF, (resp. exact k-CNF satis ability problem Sat-Exact-kCNF) is de ned similarly, but for k-CNF (resp. exact k-CNF) clauses. It is well-known that Sat-CNF and Sat-Exact-3CNF are each NP-complete problems [GJ79, Thms. 2.6, 3.1], [AHU74, Thms. 10.3, 10.4]. It follows trivially that Sat-kCNF and Sat-Exact-kCNF are NP-complete for any k > 3, as is Sat-Nonredundant-CNF. The 2-CNF satis ability problem, Sat-2CNF, is de ned similarly, but is known to be solvable in deterministic polynomial time [EAS76, Sec. 2], from which it trivially follows that Sat-Exact-2CNF is also solvable in deterministic polynomial time. In 1.4.9, we introduced the notion of separability for a BPPO, and used it to characterize the existence of distributive extensions. Since our approach to showing that the distributive extension problems are NP-hard is to transform satis ability problems to separability problems, we begin by introducing a corresponding notion of separability for propositional formulas, which we will use in the transformation. 2.2.4 Separability and strong separability Let ' be a formula over the set X = fx1; : : : ; xng of variables. (a) A separator for a pair fxi; xjg X is a two-element set ff=; f 6=g Mod(') with the property that f=(xi) = f=(xj); f6=(xi) 6= f 6=(xj): A separator for fxi;?g, with xi 2 X, is a singleton ffg Mod(') with the property that f(xi) = >. Dually, a separator for fxi;>g, with xi 2 X, is a singleton ffg Mod(') with the property that f(xi) = ?. Any singleton ffg Mod(') is a separator for f?;>g. Given a set Q of pairs of elements from X [ f?;>g, a Q-separator for ' is a set Mod(') which includes as a subset a separator for each pair in Q. A (full) separator for ' (with respect to X) is a set Mod(') which includes as a subset a separator for every pair of distinct elements in X [f?;>g. (Here ? and > are just special symbols; think of them as variables whose values are xed. Their inclusion is a technicality which will be essential in translation of these concepts to BPPO's.) ? will always be clear from context. Also, when z 2 f?;>g, with z representing a truth value, we write :z to denote ? if z = > and to denote > if z = ?. 54 2. COMPUTATIONAL COMPLEXITY OF DECISION PROBLEMS (b) A strong separator for a pair fxi; xjg X is a four-element set ff??; f?>; f>?; f>>g Mod(') such that f??(xi) = ?; f??(xj) = ?; f?>(xi) = ?; f?>(xj) = >; f>?(xi) = >; f>?(xj) = ?; f>>(xi) = >; f>>(xj) = >: A (full) strong separator for ' (with respect to X) is a set Mod(') which includes as a subset a strong separator for every pair of distinct variables in X, and, for each xi 2 X, includes as elements a separator for fxi;?g and a separator for fxi;>g. Under this de nition, every strong separator is a separator. Note that if ' is consistent and X has at least two distinct elements, then the condition that include elements which separate fxi;>g and fxi;?g for each xi 2 X is redundant, since for every variable xi, there must be models f; g 2 Mod(') with f(xi) = ? and g(xi) = >. This latter property will often be used in proofs in which the nontrivial cases involve at least two variables. (c) Given S X, a set Mod(') renders S atomic if for each a 2 S, there is exactly one f 2 with the property that f(a) = >. (This concept will be used in Section 2.5 in connection with prespeci cations involving atoms. Notice the close connection with the de nition of the same name for decompositions of BPPO's in 1.5.3.) Now if Q is a set of pairs of elements of X [ f?;>g, then a set Mod(') is a (Q;S)-separator for ' if it is a Q-separator which also renders S atomic. Based upon these de nitions, we introduce four new decision problems. (Here k denotes any natural number larger than 1.) The decision problems Sep-CNF (resp. Sep-kCNF): Input: A propositional formula ', in CNF (resp. k-CNF) over a set X of variables. Question: Is ' separable with respect to X? The decision problem StrongSep-CNF (resp. StrongSep-kCNF): Input: A propositional formula ', in CNF (resp. k-CNF) over a set X of variables. Question: Is ' strongly separable with respect to X? One of the keys to our reduction proofs is to transform the property of satisability to that of strong separability. The following formula transformations are central to this. 2.2 The Basic NP-Complete Extension Problems 55 2.2.5 Special formulas Let ' be any NNF formula over the set X = fx1; : : : ; xng of variables. Let Y = fy1; : : : ; yng be another set of variables of the same size, with X \ Y = ;. (a) De ne ' 01 to be the formula obtained from ' by replacing each literal by its complement. (b) De ne ' XY to be the formula obtained from ' obtained by replacing each occurrence of xi with yi, for 1 i n. (Note speci cally that all members of X need not occur in ' for this to make sense.) (c) De ne ~ ' = ('_' XY )_('_' XY ) 01 . 2.2.6 Lemma Let ' be any NNF formula over the set X = fx1; : : : ; xng of variables. Then the following conditions are equivalent. (a) ~ ' is strongly separable. (b) ~ ' is separable. (c) ' is satis able. Proof: ((a)) (b)) This follows from the discussion of 2.2.4. ((b)) (c)) ~ ' is satis able i ' is. Thus, if ~ ' is separable, ' must be satis able. ((c) ) (a)) Suppose that ' is satis able. If ' contains fewer than two distinct variables, then the result is immediate. If ' contains at least two distinct variables, then it su ces to show that any two variables in X [ Y are strongly separable. Let f 2 Mod('). Then f is totally independent of the variables in Y (since the variables in Y do not occur in '), and so, regarding f as an interpretation for ~ ', we have that any two variables in Y are strongly separable, since we can choose the truth values of the variables in Y as we please without risking the loss of the property of being a model of '. Similarly, if we pick any f 2 Mod(' XY ), and regard it as a model of ~ ', then we see that any two elements of X are strongly separable. Now, let x 2 X and y 2 Y . Pick any f 2 Mod('). (Thus, f depends only upon variables in X, and is independent of variables in Y .) De ne g : X [ Y ! f?;>g by g(v) = ( f(v) if v 2 X; :f(v) if v 2 Y . Then g 2 Mod('). Now de ne h : X [ Y ! f?;>g by h(v) = ( :f(v) if v 2 X; f(v) if v 2 Y . and k : X [ Y ! f?;>g by k(v) = :f(v). Then h; k 2 Mod(' 01) Mod(('_' XY ) 01). Furthermore, ff; g; h; kg is a strong separator for fx; yg, as required. 2 56 2. COMPUTATIONAL COMPLEXITY OF DECISION PROBLEMS 2.2.7 Proposition Let ' be a CNF formula. Then ~ ' may be translated into CNF in deterministic time polynomial in the size of '. Proof: Since ~ ' has only four disjuncts, the standard transformation of distributing the disjunction over the conjunction yields a formula which is O(s4) in size, with s denoting the size of the original formula. 2 We are now ready to prove that Sep-CNF and StrongSep-CNF are NP-complete. While these are not our ultimate results, the NP-completeness of these intermediate results is critical to showing the NP-completeness of the distributive extension problems. 2.2.8 Theorem| NP-completeness of separability testing The problems Sep-CNF and StrongSep-CNF are NP-complete. Proof: First of all, let us show that these problems are in NP. Let ' be a formula over the set X = fx1; : : : ; xng of variables. If n ); (Vfx;:xg = ?) 2 C'. 2.2 The Basic NP-Complete Extension Problems 57 For each clause 'i = (`i1_ : : :_`i(mi)), (Wf`i1; : : : ; `i(mi)g = >) 2 C'. Note that literals, regarded as members of P', are formal entities, and have no special logical signi cance as members of the set of inner types. Also, not the the property of unit freeness is essential. Otherwise, the de nition of the rules in C' would not be well-de ned, as the set S in a rule of the form (WS = a) or (VS = a) must contain at least two distinct elements. However, this restriction will not prove to be a problem. 2.2.10 Example It is not easy to give exact graphical representations of BPPO's or their prespeci cations, because lub's and glb's are not always joins and meets, respectively. But, with a little care, we can illustrate the general idea, and it is helpful to envision how the above construction works. Figure 2.2 presents the rough idea for the formula (a_b_c)^(:a_b_:c). Think of the nodes labelled (>) as being the > (>) (>) (>) (>) (>) a :a b :b c :c (?) (?) (?) ? @ @ @ @ Q Q Q Q Q Q Q Q 6 A A A A A A AK C C C C C C CO 6 3 A A A A A A AK Q Q Q Q Q Q Q Q Q Q k A A A A A A AK @ @ @ @ @ @ @I A A A A A A AK C C C C C C CO A A Figure 2.2: The BBPO prespeci cation associated with (a_b_c)^(:a_b_:c). same as the top node >, and the nodes labelled (?) as being the same as the bottom node ?. We have drawn them separately to highlight the joins and meets which are present. Lines without arrowheads link nodes which are actually the same, while lines with arrowheads link distinct nodes. Note that we have a join to > and a meet to ? for each pair fa;:ag, fb;:bg, and fc;:cg. We also have a join to > for the literals corresponding to each of the two clauses: fa; b;:cg and f:a; b; cg. In other 58 2. COMPUTATIONAL COMPLEXITY OF DECISION PROBLEMS words, in addition to the obvious rules relating each variable to its complement, we have a join rule of the form (WS = >) for each literal whose set of literals is S. Note that the height of this prespeci cation is only 2, and its fanout is the maximum of 2 and the number of literals in the largest clause, which is 3 in the case of this example. It is clear from this construction that the resulting BPPO prespeci cation will be weakly acyclic; we record this as a formal fact. 2.2.11 Lemma Let ' be a unit-free CNF propositional formula. Then S' is weakly acyclic. 2 What is more interesting is that the BPPO prespeci cation is almost the BPPO, in the sense that only trivial new rules are added, and Graph(S') is the partial order of the BPPO. Thus, the representation is a particularly simple one in this case. 2.2.12 Lemma Let ' be a unit-free CNF propositional formula. Then, if ' is satis able, S' is consistent, and we furthermore have the following. (a) The height of S' is 2. (b) A rule R is in Rel_(S') i there are rules (WS1 = >); : : : (WSk = >) 2 C' such that R = (W(Ski=1 Si) = >). Similarly, a rule is in Rel^(S') i there are rules (VS1 = ?); : : : (VSk = ?) 2 C' such that R = (V(Ski=1 Si) = ?). (c) For a; b 2 S', a S' b i (a; b) 2 Graph(S'). Proof: Claim (a) is immediate, because every join rule is of the form (WS = >), and every meet rule is of the form (VS = ?). From claim (a), it follows that the only way that a generalized associativity law could be used to generate a new join rule would be to have two rules of the form (WS1 = >) and (WS2 = >) combine to yield (W(S1 [ S2) = >). New meet rules may be generated only by the dual construction. Thus, claim (b) is satis ed. Claim (c) is now immediate as well, since the only way that Graph(S') can fail to be S' is to have the join and meet rules contribute new entries, as shown in the proof of 2.1.11. 2 The next lemma is crucial, because it not only provides a strong connection between satis ability of a logical formula and consistency of the corresponding BPPO prespeci cation, but it also shows that the models of the formula correspond to the ideal binary decompositions of the prespeci cation. This provides the key that we need to show that the distributive extension problems are NP-complete. 2.2.13 Lemma Let ' be a unit-free CNF propositional formula. Then ' is satis able i S' is consistent and CanBPPO(S') is somewhere separable. Furthermore, whenever ' is consistent, there is a natural correspondence between Mod(') and the ideal binary decompositions of CanBPPO(S'), given by sending each f 2 Mod(') to the ideal binary decomposition (I; J) with (a) I = fp 2 Aug(P') j f (p) = ?g; 2.2 The Basic NP-Complete Extension Problems 59 (b) J = fp 2 Aug(P') j f (p) = >g. Proof: First of all, assume that ' is satis able. Then, in view of part (c) of the previous lemma, we can conclude that every principal preideal of S' is in fact an ideal. Hence, by de nition, S' is stable, and hence S' is consistent, by 2.1.17(a). Next, let f 2 Mod('). De ne the function g : P' ! f?;>g to be the restriction of f to P'. Then, given the characterization of join and meet rules in part (b) of the previous lemma, we see that g must be the underlying function of a morphism g : CanBPPO(S') ! 2. Hence, by 1.4.2, CanBPPO(S') has an ideal binary decomposition, and so is somewhere separable. Conversely, assume that S' is consistent and CanBPPO(S') has an ideal binary decomposition (I; J). De ne f : X ! f?;>g to be the restriction of Ifn(I;J) to X. It is immediate from the structure of S' that f 2 Mod('). Hence, by 2.2.12(c), f 2 Mod('), and so ' is satis able. The correspondence between Mod(') and the ideal binary decompositions of CanBPPO(S') follows from this construction. 2 We are nally in position to prove our main results. We can actually prove that the problem Dist-BinExt is NP-complete even for join fanout 3 at this point, because only satis ability and not separability is involved. On the other hand, we cannot put a bound on join fanout for Dist-InjExt at this point, because our transformation from a satis able CNF formula to a separable one does not preserve the property of having three literals per clause. 2.2.14 Theorem | NP-completeness of Dist-BinExt The problem Dist-BinExt(2; 3; 2) is NP-complete. Thus, in particular, Dist-BinExt is NP-complete. Proof: We have already shown in 2.2.2 that the problems are in NP. To complete the proof, let ' be an exact 3-CNF propositional formula. Then ' is trivially unit free. Now, from 2.2.13, we know that we can transform the satis ability problem for ' into the question of whether S' is consistent and CanBPPO(S') has an ideal binary decomposition. However, we know that we can perform the test of whether or not S' is consistent in deterministic polynomial time (2.1.17). Thus, since Sat-Exact-3CNF is NP-complete, it must also be the case that deciding whether CanBPPO(S') has an ideal binary decomposition is NP-complete. But this latter question is equivalent to the one of asking whether CanBPPO(S') has a distributive extension, by 1.4.7. Furthermore, we have by 2.2.12 that the height of S' is 2. The join fanout of 3 and meet fanout of two follow directly from the fact that ' is in 3-CNF. Thus, we have that Dist-BinExt(2; 3; 2) is NP-complete. Since Dist-BinExt is more general, but also in NP, it must be NP-complete as well. 2 The nal key to establishing the NP-hardness of the injective distributive extension problem is to show that separability in logical formulas corresponds to separability of BPPO's. 2.2.15 Proposition | separability is separability Let ' be a unit-free CNF propositional formula. Then ' is separable i S' is consistent and its minimal ex60 2. COMPUTATIONAL COMPLEXITY OF DECISION PROBLEMS tension CanBPPO(S') to a BPPO has a separating set of ideal binary decompositions. Proof: First of all, assume that ' is separable. Then, in particular, it is satis able, and so by 2.2.13 we know that S' is consistent and has an ideal binary decomposition. But, consider the structure of CanBPPO(S'). The only elements, other than ? and >, are the elements corresponding to the variables X = fx1; : : : ; xng over which ' is de ned, and the set f:x1; : : : ;:xng of its complements. Now, by 2.2.13, we have a natural correspondence between elements of Mod(') and ideal binary decompositions. For a pair of the form fx;:xg, any ideal binary decomposition will separate them, since they are complements of each other. For pairs of literals f`1; `2g arising from distinct variables, the fact that ' is separable ensures that there is an f 2 Mod(') with f(`1) 6= f(`2). But, under the correspondence described in 2.2.13, the images of these elements must lie in di erent components of the ideal binary decomposition de ned by f . Thus, x and y are separable in CanBPPO(S'). Similarly, the pair f:x;:yg is separable. Finally, the condition of bivaluedness within separability ensures that ? and x, and > and x, will be separable in CanBPPO(S'). Hence, CanBPPO(S') has a separating set of ideal binary decompositions. Conversely, assume that S' is consistent and that CanBPPO(S') has a separating set of ideal binary decompositions. Then, for each such ideal binary decomposition (I; J), if we de ne a function f : X ! f?;>g by f(x) = ( > if x 2 I; ? if x 2 J , it is easy to see that f is a model of '. But since the set of ideal binary decompositions is separating, so too will be the corresponding set of models of '. Thus, ' is separable, as required. 2 2.2.16 Theorem | NP-completeness of Dist-InjExt The problem Dist-InjExt(2;1; 2) is NP-complete. Thus, in particular, Dist-InjExt is NP-complete. Proof: First of all, by 2.2.2, the problem is in NP. We know, from 1.4.10, that a given BPPO has an injective distributive extension i it has a separating set of ideal binary decompositions. But we have shown in the preceding proposition that we can reduce the question of separability of a unit-free propositional formula to one of having a separating set of ideal binary decompositions in the corresponding BPPO. Note further that by 2.2.12, the height of this BPPO is 2, as is its meet fanout. Since Sat-Nonredundant-CNF is NP-complete, and since we can perform the translation from CNF formula to BPPO prespeci cation in polynomial time, we have that Dist-InjExt(2;1; 2) is NP-complete. 2 2.3 Re nement of NP-Complete Extension Results In this subsection, we present a pair of re nements to the results of the previous section. First of all, we show that the problem Dist-InjExt remains NP-complete even if we restrict the join fanout to three. The critical result necessary to show this is 2.3 Re nement of NP-Complete Extension Results 61 to establish that we can preserve strong separability while translating into 3-CNF. Secondly, we show that the problems Dist-BinExt and Dist-InjExt both remain NPcomplete even if we restrict the join fanout to 2, provided that we allow a height of 3. We begin with a careful study of the translation from CNF to 3-CNF. 2.3.1 3-CNF translations Let ' be a CNF formula over the set X = fx1; : : : ; xng of variables. A 3-CNF translation of ', into a CNF formula with at most three literals per clause, is de ned as follows. Suppose that 'may be written as ' = '1^ : : : ^'k, with the 'i's the clauses of ', and with 'i = (`i1_ : : :_`iki) the representation of the ith clause in terms of its literals. We assume that all clauses, and all literals within a given clause, are distinct. We also have an implicit ordering on the clauses and on the literals within each clause, as re ected by the index set, but this choice of ordering is completely arbitrary. Now, to get a 3-CNF translation, replace each clause 'i with the disjunction '(3) i , de ned as follows. (i) If 'i contains three or fewer literals, then let '(3) i = 'i. (ii) If 'i contains more than three literals, proceed as follows. Let Zi = fzi1; : : : ; zi(mi 3)g be a set of mi 3 new variables, where mi is the number of distinct literals in clause 'i. De ne '(3) i = (`i1_`i2_zi1)^ (`i3_:zi1_zi2) .̂.. (`ip_:zi(p 2)_zi(p 1))^ (`i(p+1)_:zi(p 1)_zip)^ ... (`i(mi 2)_:zi(mi 4)_zi(mi 3))^ (`i(mi 1)_`imi_:zi(mi 3)) We always take Zi \ Zj = ; for i 6= j, and X \ Zi = ; for all i. The set of variables for '(3) is thus X [ (Ski=1 Zi), with Zi = ; if 'i has three or fewer literals. This transformation is actually the standard one which is used to show that Sat-Exact-3CNF is NP-complete [AHU74, Thm. 10.4]. We have repeated the full construction here because we need to be very precise about how we label and handle the variables in the process of establishing strong separability. We also de ne the following two useful functions. Before(zip) = f`it j 1 t p + 1g; After(zip) = f`it j p+ 2 t mig: Note that, for any clause 'i which contains more than three literals, for any variable z 2 Zi, both both Before(z) and After(z) contain at least two literals. As a notational convenience, to avoid repeating a massive amount of detail at each step, whenever we work with a CNF formula ' in that which follows, we shall 62 2. COMPUTATIONAL COMPLEXITY OF DECISION PROBLEMS assume that it has k clauses, and that the ith clause contains mi literals, as we have described above. We shall also assume that the decomposition has exactly the form described above, including the variable sets Zi and the implicit (but arbitrary) ordering on the literals within the clauses. Before proceeding, it is very useful to characterize just how models in the new 3-CNF formula relate to models in the original CNF formula. The following two results provide the necessary constraints. In each case, the proof follows easily upon examining the form of the 3-CNF transformation, and so is omitted. 2.3.2 Lemma Let ' be a CNF formula over the set X = fx1; : : : ; xng of variables. Then a function g : X [ (Ski=1) ! f?;>g is in Mod('(3)) i the following conditions are satis ed. (i) There is an f 2 Mod(') such that for all x 2 X, f(x) = g(x). (ii) For each zip 2 Zi: g(zip) = ? implies that there exists a variable q 2 Before(zip) with the property that g(`iq) = >; g(zip) = > implies that there exists a variable q 2 After(zip) with the property that g(`iq) = >. 2 2.3.3 Proposition Let ' be a CNF formula. (a) ' is satis able i '(3) is. (b) If f 2 Mod('), then any g : X [ (Ski=1 Zi)! f?;>g satisfying the following conditions is in Mod('(3)). (i) For all x 2 X, g(x) = f(x). (ii) For each i such that 'i has more than three literals, there is a nonempty subset S f1; : : : ;mig with f(`is) = > for each s 2 S, with g(zip) = ( > if p s1 2 or p + 2 2 S; ? otherwise, and s1 denoting the least element of S. 2 We can now establish that strong separability is preserved under this transformation. 2.3.4 Lemma Let ' be a nonredundant CNF formula. Then, if ' is strongly separable, so too is '(3). Proof: Assume that ' is strongly separable. Let X be the set of variables over which ' is taken. In view of the preceding proposition, it is clear that any two variables which are strongly separable in ' are also strongly separable in '(3). 2.3 Re nement of NP-Complete Extension Results 63 We need to consider the cases involving the variables introduced in the 3-CNF transformation. Generally speaking, to give a complete description would require an incredible amount of tedious detail. Therefore, we show only the \critical" choices, and leave it to the reader to ll in the rest. The results of 2.3.2 and 2.3.3 are useful to keep in mind when doing this. First of all, we consider two \Z" variables associated with the same clause in '; that is, a pair of the from fzip; ziqg. Without loss of generality, assume that p . (This is possible because we are assuming that ' is strongly separable.) We build a model f 2 '(3) which is an extension of g. We may take f(zis) = ? for all s, 1 s mi 3. This assignment to the zis's makes '(3) i true. For the other clauses, we simply choose assignments to the zrs's which make the entire formula true. In view of 2.3.2, this is always possible. Hence such an f exists in Mod('(3)). [f(zip) = >; f(ziq) = >] This is similar to the previous case, except that we now choose f(`i(mi)) = > and f(zis) = > for all s. [f(zip) = ?; f(ziq) = >]: Choose a g 2 Mod(') with g(`i(p+1)) = > and g(`i(q+2)) = >. This is possible since ' is nonredundant, and so `i(p+1) and `i(q+2) are literals of di erent variables. We extend g to an f 2 Mod('(3)) with f(zip) = ? and f(ziq) = > by choosing S = fp+ 1; q + 2g and applying part (b)(ii) of 2.3.3. [f(zip) = >; f(ziq) = ?]: Here we choose an f 2 Mod(') with f(`iq) = >. Then, letting S = fqg, we may apply (b)(ii) of 2.3.3 to get the required model. Next, we consider the case in which two \Z" variables, zip and zjq, are associated with di erent clauses of ', 'i and 'j . [f(zip) = ?; f(zjq) = ?]: Since After(zip) and After(zjq) each contain at least two literals, we may choose `ir 2 After(zip) and `js 2 After(zjq), with Var(`ir) 6= Var(`js). Choose a model g 2 Mod(') with g(`ir) = g(`js) = >. Extend it to f 2 Mod('(3)) with f(zit) = > for t r 2 and f(zit) = ? otherwise. The rest of the extension is arbitrary, as long as it satis es '(3). [f(zip) = >; f(zjq) = >]: Similar, except use Before(zip) and Before(zjq). [f(zip) = ?; f(zjq) = >]: Similar, except use Before(zip) and After(zjq). [f(zip) = >; f(zjq) = ?]: Similar, except use After(zip) and Before(zjq). Finally, we must consider the case of a pair consisting of a variable x from X and a \Z" variable zjq. [f(x) = ?; f(zjq) = ]: Here is either ? or >; we will treat both cases at the same time. Choose `ir 2 Before(zip) with Var(`ir) 6= x. Pick g 2 Mod(') with g(x) = and g(`ir) = >. Extend g to a model of '(3) by choosing f(zis) = > for s r 2 and f(zis) = ?. Then, f(zip) = ?, as required. [f(x) = ?; f(zjq) = ]: Similar, except choose `ir 2 After(zip) with Var(`ir) 6= x. 64 2. COMPUTATIONAL COMPLEXITY OF DECISION PROBLEMS 2 With this result in hand, the NP-completeness of the separability problems for logical formulas in 3-CNF follows easily. 2.3.5 Theorem | NP-completeness of separability testing restricted to 3-CNF The problems Sep-3CNF and StrongSep-3CNF are NP-complete. Proof: That these problems are in NP follows from 2.2.8, since 3-CNF formulas are a special case of CNF formulas. The NP-hardness follows from 2.3.4, proceeding exactly as in the proof of 2.2.8. 2 2.3.6 Proposition Let ' be a unit-free propositional formula. Then '(3) is separable i S'(3) is consistent and its minimal extension CanBPPO(S'(3)) to a BPPO has a separating set of ideal binary decompositions. Proof: The proof is similar to that of 2.2.15. 2 2.3.7 Theorem | NP-completeness of Dist-InjExt(2; 3; 2) The problem Dist-InjExt(2; 3; 2) is NP-complete. Proof: The proof goes as in 2.2.16. The only di erence is that we now rely on the stronger results 2.3.4 and 2.3.6 instead of 2.2.6 and 2.2.8, and transform StrongSep-3CNF to Dist-InjExt(2; 3; 2). The join fanout bound of 3 is an obvious consequence of the fact that we are using 3-CNF formulas. 2 Thus, we have the \(2; 3; 2)" bound for the injective extension problem of a BPPO prespeci cation to a distributive lattice. We now turn to showing that we can maintain NP-completeness in the \(3; 2; 2)" context. That is, we can reduce the join fanout to 2 if we allow a height of 3. 2.3.8 (2,3)-hierarchical representations Let ' be a unit-free CNF formula. The (2,3)-hierarchical representation of ', denoted '(2;3), is de ned as follows. Let '(3) denote a formula equivalent to ', constructed as described in 2.3.1. For each clause 'i of ', let Wi = fwi1; : : : ; wi(mi 2)g be a set of mi 2 new variables. In transforming ' to '(2;3), we replace the clauses obtained from 'i as follows. (a) If 'i contains fewer than three literals, then leave it as is. (b) If 'i = (`1_`i_`3) contains exactly three literals, then replace it with the conjunction (wi1 , (`1_`2))^(wi1_`3). (c) If 'i contains more than three variables, then rst transform it into a conjunction of clauses with at most three variables, as described in 2.3.1. Then, perform the following further replacements. (i) Replace (`i1_`i2_zi1) with (wi1 , (`i2_zi1))^(wi1_`i1). (ii) Replace each clause of the form (`ip_:zi(p 2)_zi(p 1)) with (wi(p 1) , (:zi(p 2)_zi(p 1)))^(wi(p 1)_`ip). 2.3 Re nement of NP-Complete Extension Results 65 (iii) Replace (`i(mi 1)_`imi_:zi(mi 3)) with (wi(mi 2) , (:`imi_:zi(mi 3)))^(wi(mi 2)_`i(mi 1)). (d) If two of the wi1's are equivalent to exactly the same disjunction of literals, say (wi1 , (`1_`2) and (wj1 , (`1_`2), then replace each occurrence of wj1 with wi1. Figure 2.3 shows in pictures how this transformation behaves for a clause of the form (`1_`2_`3). The symbol (>) denotes a \virtual >," as in Figure 2.2. Note that which literals are \combined" to become w depend upon the form of the clause. The rules identi ed above must be followed in the case that literals involving zij's are involved. (>) `1 `2 `3 (>) `1 `2 `3 w ; A A A A A A AK A A AK A A A A A A AK Figure 2.3: The translation from join fanout three to join fanout two. If the original formula ' is strongly separable, then the resulting (2,3)-hierarchical formula is separable. The latter may not be strongly separable, but this is not a hindrance to proving the nal NP-completeness result. Indeed, the reason that we established strong separability of '(3) in 2.3.4, rather than just separability, was so that we could use it in the lemma below. 2.3.9 Lemma Let ' be a nonredundant CNF formula. (a) '(2;3) is satis able i ' is. (b) If ' is strongly separable, then '(2;3) is separable. Proof: Part (a) is immediate, as these transformations clearly do not alter logical satis ability. As for part (b), the result follows readily if we make full use of the fact that if ' is strongly separable, then so too is '(3), as demonstrated in 2.3.4. We only need to ensure that we can separate the new \W" variables from each other, and from the other variables. In an equivalence of the form w , (`1_`2), we know that we can choose the values of `1 and `2 independently of each other, and so we can separate `1 from w by choosing one model in which `1 is false and `2 true, and then another in which both `1 and `2 are both false. Separability of w from the other variables is automatic, since they are strongly separable from the members of Var(`1) and Var(`2). To separate to \W" variables from each other, it su ces to observe that if we have (wi , (`1_`2) and (wj , (`3_`4), then in view of 2.3.8(d), 66 2. COMPUTATIONAL COMPLEXITY OF DECISION PROBLEMS we cannot have that f`1; `2g = f`3; `4g. Since the `i's are strongly separable from one another, it is easy to make a choice of pairs of models in which wi and wj will be separated. 2 In analogy to 2.2.9, we de ne the BPPO corresponding to a (2,3)-hierarchical formula. 2.3.10 The BPPO prespeci cation of (2,3)-hierarchical formula Let ' be a unit-free CNF formula, and let '(2;3) be its (2,3)-hierarchical representation. Assume the notation introduced in 2.3.8. Then the BPPO prespeci cation associated with '(2;3), denoted S'(2;3) = (P'(2;3) ;C'(2;3)), is de ned as follows. De ne V = X [ Y [ (Smi 3 i=1 Zi) [ (Smi 2 i=1 Wi). De ne P'(2;3) and C'(2;3) as follows. (i) P'(2;3) = Literals(V ). (ii) C' consists of the following rules. For each v 2 V , (Wfv;:vg = >), we have (Vfv;:vg = ?) 2 C'(2;3) . For each two-literal clause (`1_`2), we have (Wf`1; `2g = >) 2 C'(2;3) . For each formula of the form (v , (`1_`2)), we have W(f`1; `2g = v) 2 C'(2;3) . Once again, we have a result corresponding to 2.2.15. We omit the details of the proof, since they are entirely similar to those of 2.2.15. 2.3.11 Proposition Let ' be a nonredundant propositional formula. Then '(2;3) is separable i S'(2;3) is consistent and its minimal extension CanBPPO(S'(2;3)) to a BPPO has a separating set of ideal binary decompositions. 2 Finally, we have the NP-completeness of the \(3,2,2)" problems. 2.3.12 Theorem NP-completeness of (3,2,2) problems The problems Dist-BinExt(3; 2; 2) and Dist-InjExt(3; 2; 2) are NP-complete. Proof: We already know that the problems are in NP. It is easy to see that, given a CNF formula ', the height of S'(2;3) = (P'(2;3) ;C'(2;3)) is 3, and both the join and the meet fanouts are 2. The rest of the proof goes as in 2.2.14{2.2.16. The only di erence is that we rely on the stronger results 2.3.9 and 2.3.11 to obtain the required separability. 2 2.4 Cases Solvable in Deterministic Polynomial Time In this section, we turn to the question of asking for which classes of nite BPPO prespeci cations are extension questions to distributive structures solvable in deterministic polynomial time. To attack this problem, we need to \reverse" our perspective a bit. This time, rather than looking to transform satis ability to extensibility, we seek to transform extensibility to satis ability in polynomial time. If 2.4 Cases Solvable in Deterministic Polynomial Time 67 the resulting satis ability problem is solvable in deterministic polynomial time, then so too will be the extensibility problem. To begin, then, we de ne the propositional formula associated with a prespeci cation. 2.4.1 The formula of a prespeci cation Let S = (P;C) be a consistent nite BPPO prespeci cation. The formula of S, denoted 'S, is de ned as follows. (i) Vars('S) = P . (ii) 'S is the conjunction of all formulas of the following form. (a) For each (WS = a) 2 C with a 2 P , the formula ((WS) , a) is a conjunct of 'S. In the logical formula, W denotes logical disjunction. Thus, if S = fs1; : : : ; sng, then the formula is ((s1_ : : :_sn), a). (b) For each (WS = >) 2 C, the formula (WS) is a conjunct of 'S. Thus, if S = fs1; : : : ; sng, then the formula is (s1_ : : :_sn). (c) For each (VS = a) 2 C with a 2 P , the formula ((VS) , a) is a conjunct of 'S. In the logical formula, W denotes logical conjunction. Thus, if S = fs1; : : : ; sng, then the formula is ((s1^ : : :^sn), a). (d) For each (WS = >) 2 C, the formula (VS) is a conjunct of 'S. Thus, if S = fs1; : : : ; sng, then the formula is (s1^ : : :^sn). (e) For each (a ) are not considered because they can never be part of a consistent prespeci cation. Notice that we may e ectively regard 'S as being in CNF. Indeed, the formula ((s1_ : : :_sn) , a) is equivalent to ((:s1_a)^ : : : (:sn_a))^(s1_ : : : _sn_:a), and the formula ((s1^ : : : ^sn), a) is equivalent to ((:a_s1)^ : : : ^(:a_sn))^(a_:s1_ : : :_:sn). We shall often implicitly adopt this convention in our subsequent arguments. 2.4.2 Example The ideas of the above construction are best illustrated by example. Let S = (P;C) be de ned by P = fa; b; c; dg and C = f(Wfa; b; cg = >); (Vfc; dg = ?); (Vfb; dg = a)g. Then 'S = (a_b_c)^(:c_:d)^((b^d), a)) (a_b_c)^(:c_:d)^(:b_:d_a)^(:a_b)^(:a_d) Because the variables of 'S are exactly the inner types of S, it follows immediately that satis ability of 'S corresponds to somewhere separability of S, and that separability, Q-separability, and strong separability of 'S correspond to the concepts of the same name in S. We record these facts in a formal lemma. 2.4.3 Lemma Let S = (P;C) be a consistent nite BPPO prespeci cation. (a) S is somewhere separable i it 'S is satis able. (b) S is separable (resp. strongly separable) i 'S is. 2 68 2. COMPUTATIONAL COMPLEXITY OF DECISION PROBLEMS (c) Given a set Q of pairs of elements from Aug(P ), S is Q-separable i 'S is. 2 Testing for separability of formulas involves testing for satis ability under conditions in which the truth values of certain variables are held xed. We formalize this idea with the idea of binding of variables in propositional formulas. 2.4.4 Binding of propositional formulas (a) Let ' be a propositional formula taken over a set X of variables, and let B = f`1; : : : ; `kg be a set of literals over X. The formula '[B] is de ned to be '^(`1^ : : : ^`k), and is called the binding of ' by B. (b) Let F be a class of propositional formulas. We say that F is tractable for bindings if there is a polynomial of one variable p such that for every formula ' 2 F and every set of bindings B, there is a formula 2 F which is logically equivalent to '[B], and which is computable by a function inO(p(length('))). 2.4.5 Examples Almost any \reasonable" class of formulas is tractable for bindings. Simple examples include the CNF formulas, the k-CNF formulas for any k 1, and the Horn formulas. Indeed, the idea behind a binding is to \ x" the value of one or more variables, and we can typically nd a shorter formula which re ects the binding, so that p(x) may be taken to be the identity polynomial x in the above de nition. For example, if we start with a CNF formula ', and wish to nd an equivalent formula to '[`] for some literal `, we simply delete all clauses in which ` appears (since they will be true under the binding in any case), and remove all instances of the complement of ` from all remaining clauses (since that complementary literal cannot be true). We are particularly interested in classes of formulas which are not only tractable for bindings, but also admit deterministic polynomial-time testing for satis ability. The reason is re ected in the following lemma. 2.4.6 Lemma Let F be a class of propositional formulas which is closed under conjunction and is tractable for bindings. Then, if satis ability is solvable in deterministic polynomial time for formulas in F , so too are the following questions: (a) Given a formula ' over the set X of variables and a set Q of pairs of elements of X [ f?;>g, the question of whether or not ' has a Q-separator. (b) Given a formula ' over the set X of variables and a set S P , the question of whether or not there is a set Mod(') which renders S atomic. (c) The question of whether or not ' has a strong separator. Proof: If ' is not satis able, then the answer to each of the above questions is false. Therefore, in the following, we assume that ' is satis able. (a) Let ' be a formula in F . To test for separability of a pair of the form fx;?g with x 2 Vars('), we simply test '[fxg] for satis ability. To test for separability of a pair of the 2.4 Cases Solvable in Deterministic Polynomial Time 69 form fx;>g, we test '[f:xg] for satis ability. To test a pair of the form fx; yg for separability with x; y 2 Vars('), we need to verify that at least one of the formulas in f'[fx;:yg]; '[f:x; yg]g is satis able, and at least one of the formulas in f'[fx; yg]; '[f:x;:yg]g is satis able. If even one of the variables in fx; yg is not in Vars('), then the pair is automatically separable. Thus, a test for separability of a given pair fx; yg may be performed in polynomial time. Now if ' is taken over the set X of variables, and n = Card(Vars(')), then any set Q of pairs of elements from X [ f?;>g can have at most (n + 2) (n + 1) pairs in which both elements are in Vars(') [ f?;>g, which are the only pairs for which the test is nontrivial. Thus, we need perform at most O(n2) such tests, each of which may be performed in deterministic polynomial time. Hence the whole test may be performed in deterministic polynomial time. (b) Let ' be a formula in F , and let S Vars('). Assume, without loss of generality, that Vars(') = X = fx1; : : : ; xng, let k = Card(S), and introduce k new sets of variables Xj = fx1j; : : : ; xnjg, 1 j k. Let 'j be the formula which is the same as ', except that for each i, 1 i n, xij has been substituted for xi. Let = (Vnj=1'j). In other words, each conjunct has its own set of variables, with those of 'j carrying j as a second subscript. Finally, let f : f1; : : : ; kg ! S be any bijection, which will be used just for naming. Now, for 1 i; j k, let `ij = ( f(i)j if i = j; :f(i)j if i 6= j; and de ne B = f`ij j 1 i k and 1 j ng. Some further clari cation of the notation is in order. For 1 i k, note that f(i) is a variable in S. Thus, f(i)j is a subscripted variable in X, which is e ectively a variable in Xj . For i = j, the literal `ij = f(i)j asserts that, in the jth submodel 'j, the variable f(i) (represented by indexing as f(i)j) is true. For i 6= j, the literal `ij = :f(i)j asserts that the variable f(i) (represented as f(i)j) is false in the jth model. Then, a model for [B] will e ectively be k models for ', with the jth model obtained by looking only at the variables inXj . Furthermore, it will only be the jth model which will have f(j) = >. (That is, f(j)j = >, and f(j)m = ? for allm 6= j.) Hence, is satis able i there is a set of models which renders S atomic. The size of is bounded by Size(') Card(S), which is certainly polynomial in the size of the input. The satis ability check may be performed in deterministic polynomial time, by assumption. (c) To test ' for strong separability, we run four tests for each pair of variables from Vars('). Namely, for each such pair fx; yg, we test '[fx; yg], '[f:x; yg], '[fx;:yg], and '[f:x;:yg] for satis ability. For a pair in which only one of the two variables (say x) is in Vars('), we run only two satis ability tests, one on '[fyg] and one on '[f:yg]. Again, it is easy to see that the whole collection of tests may be performed in deterministic polynomial time. 2 We can now show that if we restrict height, join fanout, and meet fanout each to at most two, then we obtain a class of extension problems which are solvable in deterministic polynomial time. 70 2. COMPUTATIONAL COMPLEXITY OF DECISION PROBLEMS 2.4.7 Theorem { Extension problems solvable in deterministic polynomial time The problems Dist-BinExt(2; 2; 2) and Dist-InjExt(2; 2; 2) are each solvable in deterministic polynomial time. Proof: The key is to observe that if a prespeci cation S = (P;C) is of height 2, then it can only have rules in C of the form identi ed in 2.4.1 parts (ii)(b), (d), and (e). In other words, rules of the form (WS = x) and (VS = x) are not possible unless x is > in the rst case and ? in the second. The fanout bound of 2 implies that S cannot have more than two elements in such a rule. Thus, the conjuncts of 'S are clauses with two literals each; i.e., they are 2-CNF formulas. However, the problem Sat-2CNF is known to be solvable in deterministic polynomial time [EAS76]. From 2.4.6, we conclude that the tests for satis ability and separability each may be performed in deterministic polynomial time. But then 2.4.3 tells us that somewhere separability and full separability of the prespeci cation itself is testable in deterministic polynomial time. Finally, the characterizations of 1.4.10 show us that the problems Dist-BinExt(2; 2; 2) and Dist-InjExt(2; 2; 2) must be solvable in deterministic polynomial time as well. 2 There is another situation in which we can establish that the distributive extension problem is solvable in deterministic polynomial time { namely, when the prespeci cation has only join rules or only meet rules. The decision problem is e ectively \trivial" in this case, once we have decided consistency of the prespeci cation. 2.4.8 One-way prespeci cations Let S = (P;C) be a nite BPPO prespeci cation. We say that S is a join-only prespeci cation if C contains no nontrivial meet rules. Dually, S is a meet-only prespeci cation if C contains no nontrivial join rules. S is said to be one-way if it is either join only or else meet only. 2.4.9 Lemma Let S = (P;C) be a consistent one-way nite BPPO prespeci cation. Then S is fully separable. Proof: We start by assuming that S is join-only. Suppose that S is consistent. Then, with respect to the order S, we have by 2.1.7 and 2.1.8 that every principal preideal with respect to S is an ideal of S. Since S is join-only, it is clear that the function f> : P ! f?;>g de ned by f>(a) = > for all a 2 P is a model of 'S. On the other hand, for each a 2 P , the function fa : P ! f?;>g de ned by fa(x) = ( ? if x 2 PrinIdeal(a; S); > otherwise; is a model of 'S. But if a; b 2 P with a 6= b, then we cannot have PrinIdeal(a; S) = PrinIdeal(b; S), since S is a partial order, and hence antisymmetric. Thus, we must have that either fa(b) = ?, or else that fb(a) = ?. Since we always have fa(a) = fb(b) = >, it follows that either fa or else fb has the property that its truth value on a is di erent than its truth value on b. Thus, at least one of ff>; fag and ff>; fbg must be a separator for the pair fa; bg, so that any two elements of P 2.5 Special Computational Problems 71 are separable. Since f> is a model, ff>g is a separator for fa;?g for any a 2 P . Finally, to show that a pair of the form fa;>g is separable, it su ces to note that > is only in the principal ideal generated by itself. Thus, ffag, as de ned above, is a separator for fa;>g. We can thus invoke 2.4.3(b) to show that S is separable. The proof for a meet-only prespeci cation is entirely dual to the one given above. 2 We thus have that testing for distributive extensions of prespeci cations with only join rules or only meet rules (in addition to partial-order rules), consistency is all that need be veri ed. 2.4.10 Theorem { another extension problem solvable in deterministic polynomial time The problems Dist-BinExt(1;1; 1) and Dist-InjExt(1; 1;1) are each solvable in deterministic polynomial time. Proof: Since PreBPPO-Consis is solvable in deterministic polynomial time (see 2.1.17(c)), this follow immediately from the previous lemma. 2 2.4.11 Comparison to ALE-like systems The situation in which we have no join rules is much closer to that of systems such as ALE. However, our formalism is still somewhat more general, in that we allow order relationships such as a b and a c without requiring that Vfb; cg = a. Nonetheless, the great reduction in computational complexity which is achieved by disallowing join rules is evident. Indeed, it is easy to see that for such a prespeci cation S, the resulting formula 'S is a Horn formula. This essentially means that all inferences may be performed in deterministic time linear in the size of 'S [DG84]. It also means that the algorithms for consistency checking sketched in Section 2.1 may be simpli ed substantially, although we do not develop the details here. The point to be made here is that the major reason that the distributive extension problems that we examined in Sections 2.2 and 2.3 are NP-complete is that both joins and meets of types are allowed. Allow only one, as in ALE, LKB, or LIFE, and the complexity dips tremendously. Roughly, it reduces to a comparison between the complexity of satis ability of arbitrary formulas versus satis ability of Horn formulas. 2.5 Special Computational Problems In this section, we take a look at the computational problems involved in adding some stronger constraints to nite BPPO prespeci cations, particularly statements that certain elements must be atoms. (Section 1.5 contains the basic de nitions and results about atoms within our context.) We also take a look at how Q-separability a ects the computational complexity of various problems. 2.5.1 Computational problems involving atoms We begin by identifying some fundamental decision problems involving atoms. Basically, the problems identi ed in 2.2.1 are expanded to allow declarations of atoms as well. The decision problem Atom-Dist-BinExt(h; j;m): 72 2. COMPUTATIONAL COMPLEXITY OF DECISION PROBLEMS Input: A BPPO prespeci cation S = (P;C), with height bounded by h, W-fanout bounded by j, and V-fanout bounded by m, and a subset S P . Question: Does S have a consistent extension to a BPPO, which is atomic for S, to any of the distributive extension categories? The decision problem Atom-Dist-InjExt(h; j;m: Input: A BPPO prespeci cation S = (P;C), with height bounded by h, W-fanout bounded by j, and V-fanout bounded by m, and a subset S P . Question: Does S have a full separator which also renders S atomic? The problems which were NP-complete without declarations of atoms remain NP-complete even with these declarations. The formalization and proof are as follows. 2.5.2 Theorem|NP-completeness The problems Atom-Dist-BinExt(h; j;m) and Atom-Dist-InjExt(h; j;m) are NP-complete for (h; j;m) = (2; 3; 2) and for (3; 2; 2). Proof: The NP-hardness of these problems is immediate, because Dist-BinExt(i; j;m) is a special case of Atom-Dist-BinExt(i; j;m) and Dist-InjExt(i; j;m) is a special case of Atom-Dist-InjExt(i; j;m). We may thus refer to 2.3.7 and 2.3.12 and be done. To show that the problems are in NP, we proceed essentially as in 2.2.2. The only di erence is that it must be checked whether a candidate solution also renders the proposed atom set S atomic. But this can clearly be done in time linear in the size of . 2 When we take a problem which was previously solvable in deterministic polynomial time and add atomic constraints, things may or may not become more complex, depending upon the problem. In the \(2,2,2)" case, if the previous problem asked only for the existence of a nontrivial extension, without any injectivity constraint, then we continue to have a problem solvable in deterministic polynomial time. 2.5.3 Theorem | polynomial time solvability The problem Atom-Dist-BinExt(2; 2; 2) is solvable in deterministic polynomial time. Proof: Let S = (P;C) be a nite BPPO prespeci cation, and let S P . If S = ;, then the problem reduces to Dist-BinExt(2; 2; 2), which we know is solvable in deterministic polynomial time by 2.4.7. If S is nonempty, then any set which renders S atomic must contain at least one ideal binary decomposition. But this means that P has a distributive extension pair, by 1.4.7. Thus, it su ces to show that we can nd such a in deterministic polynomial time. To see how this is done, let S = fs1; : : : ; sng, and for 1 i n, and let S(i) = fs1; : : : ; si 1;:si; si+1; : : : sng. Then there exists a which renders S atomic i each of the formulas '[S(i)], 1 i n is satis able. In view of 2.4.6, this question may be decided in deterministic polynomial time, whence the result. 2 2.5 Special Computational Problems 73 On the contrary, if we try to combine injectivity with the declaration of atoms, things appear to be much more complex. We do not provide a formal analysis, but the following discussion will provide some idea of why this is the case. 2.5.4 Discussion of the problem Atom-Dist-InjExt(2; 2; 2) One might conjecture at rst that, in view of 2.4.7, that Atom-Dist-InjExt(2; 2; 2) is solvable in deterministic polynomial time as well. However, it does not appear that this is the case. Of course, it is certainly in NP, as it is a special case of the problems shown to be NP-complete in the theorem above. Now, given a formula ' and a set S Vars('), we may use 2.4.6 to show that the individual test of full separability and whether or not there is a set of models which renders S atomic may each separately be solved in deterministic polynomial time. However, they do not appear to combine to yield a polynomial time solution. The di culty arises because requiring a set Mod(') to render S atomic places restrictions on the collection of models, whereas the process of building a full separator simply combines models. Thus, a separator may be constructed sequentially, one pair at a time, so adding models to does not destroy the property of being a separator. However, the property of rendering S atomic is not preserved under adding new models. Therefore, the two algorithms cannot simply be combined. The results found in [GJS76] suggest that the problem is in fact NP-complete, but we do not pursue this question further in this report. If we look at type hierarchies de ned only by meet rules, then adding declarations of atoms is e ectively trivial, as the following result shows. 2.5.5 Theorem | further deterministic polynomial time case The problems Atom-Dist-BinExt(1; 1;1) and Atom-Dist-InjExt(1; 1;1) is solvable in deterministic polynomial time. Proof: This is very easy; we simply apply the construction described in Section 0.2. The atoms in this construction are just the elements in the BPPO prespecication for which ? is the only lesser element. No elements are coalesced, so the extension is injective. 2 On the other hand, type hierarchies involving only join rules do not interact cleanly with declarations of atoms. The following discussion gives some insights into the problems involved. 2.5.6 Discussion of the problems Atom-Dist-BinExt(1;1; 1) and Atom-Dist-InjExt(1;1; 1) We cannot use the \duality" between the (1; 1;1) and (1;1; 1) cases, as we did in 2.4.9 and 2.4.10. This is because in a bounded lattice the dual of an atom is not an atom, but rather a co-atom; that is, an element which has no greater element other than >. In fact, even with a BPPO prespeci cation with a meet fanout of one, the addition of more than one atom guarantees that there is a nontrivial meet constraint. This is because for each pair of distinct atoms fa; bg, we must have V fa; bg = ?. For this reason, we conjecture that the problems 74 3. CONCLUSIONS AND FURTHER DIRECTIONS Atom-Dist-BinExt(1;1; 1) and Atom-Dist-InjExt(1:1; 1) are NP-complete. However, the techniques which we have developed in this report do not appear to be directly applicable to this problem, and so we leave it open. We now turn to a brief examination of the issues surrounding Q-separability. This is an important question because a user of a system may not always want or need all declared types to be separable. Rather, it may be essential to separate only certain identi ed types. We now show that problems of such Q-separability have the same complexity (up to deterministic polynomial equivalence) as problems of full separability. We being by formalizing the decision problems under investigation. 2.5.7 Questions involving Q-separability The decision problem GenDistProb(h; j;m): Input: A BPPO prespeci cation S = (P;C), with height bounded by h, W-fanout bounded by j, and V-fanout bounded by m, and a set Q of pairs of elements, each in P [ f?;>g. Question: Does S have a consistent extension to a BPPO, which in turn has an Q-injective extension, which is atomic for S, to any of the distributive extension categories? 2.5.8 Theorem | complexity results for GenDistProb The problem GenDistProb(h; j;m) is NP-complete for (h; j;m) = (2; 3; 2) or (3; 2; 2), and is solvable in deterministic polynomial time for (h; j;m) = (2; 2; 2), (1; 1;1), and (1;1; 1). Proof: For the (2,3,2) and (3,2,2) cases, this follows immediately from 2.3.7 and 2.3.12, since Q-separability is a generalization of full separability. (The NP membership of these problems is proven in the same way as in 2.2.2). The deterministic polynomial-time cases are handled as follows. For the (2,2,2) case, we proceed exactly as in 2.4.7, save that we use 2.4.6(a) and 2.4.3(c) as the supporting arguments. For the (1; 1;1) and (1;1; 1) cases, the proof of 2.4.10 works as well, since full separability implies Q-separability for any Q. 2 2.5.9 Remarks on combining atoms and Q-separability Since full separability is a special case of Q-separability, in view of the previous result, it should be clear that combining questions of rendering a set S atomic and providing Q separability does not introduce any radically new questions. The results in 2.5.2{ 2.5.6 could have injectivity replaced with Q-separability without any change in the identi ed complexities. 3. Conclusions and Further Directions In this report, we have attempted to complement the practical work of the CUF system by laying the theoretical foundations for the partially speci ed type hierarchies which are central to that system. Speci cally, we have accomplished the following. 75 (a) We have formalized the framework | bounded posets with partial orders (BPPO's) | in which partially speci ed type hierarchies may be systematically studied. (b) We have systematized the various types of extensions, to a complete hierarchy, that a BPPO may have. Any such reasonable extension must be to a bounded distributive lattice, but there are many variations within this theme. (c) We have studied the impact that declarations of constant types| types which cannot have nontrivial subtypes | have upon the nature of distributive extensions. Interestingly, without constant declarations, in all cases which we consider, there is always a \natural" extension, which does not involve any nondeterministic choice in the form of the extension. However, in the presence of constant declarations, this property disappears, and a choice between several alternatives may need to be made. Thus, the addition of constant declarations to a type declaration system has signi cant implications in terms of nondeterminism. (d) We have established a close connection between certain decision problems in propositional logic and the decision problems connected with determining whether or not a speci cation has an extension of a certain kind. We then use this connection to establish results on the computational complexity of deciding whether or not certain kinds of distributive extensions exist. Using the height (length of the longest path in the speci cation) and fanout (the number of elements in a join or meet speci cation), we show that even under extremely tight constraints (one of these parameters equal to three and the other two equal to two), all of the extension decision problems are NPcomplete. It is only when we drop down to relatively trivial cases that we nd problems which are soluble in deterministic polynomial time. As future directions, the following seem the most useful. (1) As is the case with most NP-complete problems, the extension problems studied here need to be examined from angles which will yield e cient algorithms for a useful variety of \practical" cases. Given the close connection between extensibility and satis ability of certain associated formulas, one obvious tact would be to examine the relevance of characterizing formulas which admit e cient tests for satis ability, thus extending the rather basic results of 2.4.7, 2.4.10, and 2.5.3. One possibility is to examine the relevance of classes of so-called generalized Horn formulas [Asp80], [YD83], [CCH*90], [Bun93]. These formulas all admit polynomial-time decision algorithms for satis ability. However, it is not clear that they provide a useful basis for the kind of constraint speci cations the arise in practice; this will need to be studied more closely. Another tactic might be to note that real hierarchies tend to be rather simple in their \intertwining" of the relationships between the types. Perhaps by limiting the interaction of types in some way in accord with typical use, tractable algorithms may be obtained. 76 4. ACKNOWLEDGMENTS (2) The type hierarchies of feature-based systems such as CUF have features attached to the types. CUF is particularly sophisticated in that it admits polymorphic feature assignment | the same feature may be assigned to dif- ferent types, with di erent semantics. It is a critical next step in this research to integrate feature speci cation into our framework. Particularly, it is criti- cal to examine what e ect this integration would have on determining which types must have distinct instantiations, and which may be collapsed to a common type. (3) Often, to obtain a distributive hierarchy, it becomes mandatory to require that two types have identical instantiations (as in the case of a diamond or pentagon in the speci cation). Currently, the CUF system does not require types with distinct names to have distinct instantiations, unless the feature declarations mandate this. CUF will not inform the user that two types must have identical instantiations. It would clearly be a useful addition to the CUF system to provide the user with information on which types must coincide for the hierarchy to be distributive. Furthermore, it would be useful to allow the user to specify, independently of any feature declarations, that two types must be distinct. In short, it would be most useful if the user were to know just how the type hierarchy is realized. Our theory provides the basis for the study of this problem. (4) It is clear from our results that allowing constant declarations complicates matters substantially, in that \natural" extensions no longer exist and arbi- trary choices must be made. In practical terms, this means that there will be several disjunctive alternatives which must be considered. With a more thor- ough understanding of just how such alternatives arise, a substantial saving in the complexity of the algorithms which consider, in turn, the alternatives, may be made. Particularly, in the absence of constant declarations, there need be no nondeterminism in the collapsing of the hierarchy. Therefore, we believe that a more thorough study of how the disjunctive alternatives are identi ed and presented, in the light of our results, could result in a more informative and e cient type management system for CUF-like systems. 4. Acknowledgments This work was completed while the author was a research fellow, funded by the Norwegian Research Council, at the Department of Informatics of the University of Bergen. Tore Langholm, Chris Mellish, and Richard Moe all read parts of this report and made valuable comments, which have (hopefully) led to an improved presentation of the ideas. Naturally, any remaining errors are the responsibility of the author. REFERENCES 77 References [AHU74] Aho, A. V., Hopcroft, J. E., and Ullman, J. D., The Design and Analysis of Computer Algorithms, Addison-Wesley, 1974. [Ait93] A t-Kaci, H., \An introduction to life { programming with logic, inher- itance, functions, and equations," in: Miller, D., ed., Proceedings of the International Symposium on Logic Programming, (Vancouver, Canada), pp. 52{68, 1993. [AN86] A t-Kaci, H. and Nasr, R., \LOGIN: A logic programming language with built-in inheritance," J. Logic Programming, 3(1986), pp. 185{215. [AP93] A t-Kaci, H. and Podelski, A., \Towards a meaning of LIFE," J. Logic Programming, 16(1993), pp. 195{234. [Asp80] Aspvall, B., \Recognizing disguised NR(1) instances of the satis ability problem," J. Algorithms, 1(1980), pp. 97{103. [Bir67] Birkho , G., Lattice Theory, third edition, American Mathematical So- ciety, 1967. [BdPC93] Briscoe, T., de Paiva, V., and Copestake, A., eds., Inheritance, Defaults, and the Lexicon, Cambridge University Press, 1993. [Bun93] B unning, H. K., \On generalized Horn formulas and k-resolution," The- oret. Comput. Sci., 116(1993), pp. 405{413. [Car92a] Carpenter, B., ALE: The Attribute Logic Engine user's guide, Techni- cal Report, Carnegie Mellon University, Laboratory for Computational Linguistics, 1992. [Car92b] Carpenter, B., The Logic of Typed Feature Structures, Cambridge Uni- versity Press, 1992. [CCH*90] Chandru, V., Coullard, C. R., Hammer, P. L., Monta~ nez, M., and Sun, X., \On renamable Horn and generalized Horn functions," Ann. Math. Art. Intell., 1(1990), pp. 33{47. [CLR90] Cormen, T. H., Leiserson, C. E., and Rivest, R., Introduction to Algo- rithms, MIT Press, 1990. [DP90] Davey, B. A. and Priestly, H. A., Introduction to Lattices and Order, Cambridge University Press, 1990. [DD93] Doerre, J. and Dorna, M., \CUF { a formalism for linguistic knowledge representation," in: Dorre, J., ed., Computational Aspects of Constraint- Based Linguistic Description, DYANA-2 Deliverable R.1.2.A, pp. 3{22, ESPRIT, 1993. 78 REFERENCES [Dor94] Dorna, M., The CUF user's manual, Technical Report, Institut f ur maschinelle Sprachverarbeitung, Universit at Stuttgart, 1994. [DG84] Dowling, W. F. and Gallier, J. H., \Linear-time algorithms for testing the satis ability of propositional Horn clauses," J. Logic Programming, 3(1984), pp. 267{284. [EAS76] Even, S., Atai, A., and Shamir, A., \On the complexity of timetable and multicommodity ow problems," SIAM J. Computing, 5(1976), pp. 691{ 703. [GJ79] Garey, M. R. and Johnson, D. S., Computers and Intractability, W. H. Freeman, 1979. [GJS76] Garey, M. R., Johnson, D. S., and Stockmeyer, L., \Some simpli ed NP- complete graph problems," Theoret. Comput. Sci., 1(1976), pp. 237{267. [Gra68] Gratzer, G., Universal Algebra, D. Van Nostrand, 1968. [Gra78] Gratzer, G., General Lattice Theory, Academic Press, 1978. [HS73] Herrlich, H. and Strecker, G. E., Category Theory, Allyn and Bacon, 1973. [Joh88] Johnson, M., Attribute-Value Logic and the Theory of Grammar, CSLI, 1988. [Kap89] Kaplan, R. M., \The formal architecture of Lexical-Functional Gram- mar," in: Proceedings of ROCLING II, pp. 1{18, 1989. [LB87] Levesque, H. J. and Brachman, R. J., \Expressiveness and tractability in knowledge representation," Computational Intelligence, 3(1987), pp. 78{ 93. [Man93] Manandhar, S., \CUF in context," in: Dorre, J., ed., Computational As- pects of Constraint-Based Linguistic Description, DYANA-2 Deliverable R.1.2.A, pp. 45{53, ESPRIT, 1993. [PS87] Pollard, C. and Sag, I. A., Information-Based Syntax and Semantics, Volume 1: Fundamentals of CSLI Lecture Notes No. 13, CSLI, 1987. [Shi86] Shieber, S. M., An Introduction to Uni cation-Based Approaches to Grammar, University of Chicago Press, 1986. [Shi92] Shieber, S. M., Constraint-Based Grammar Formalisms, MIT Press, 1992. [Wal91] Walters, R. F. C., Categories and Computer Science, Cambridge Uni- versity Press, 1991. 79 [YD83] Yamasaki, S. and Doshita, S., \The satis ability problem for a class consisting of Horn clauses and some non-Horn sentences in propositional logic," Inform. and Control, 59(1983), pp. 1{12. [Zaj91] Zajac, R., Notes on the Typed Feature System, Version 4, January 1991, Technical Report, Universit at Stuttgart, Institut f ur Informatik, Project Polygloss, 1991. [Zaj92] Zajac, R., \Inheritance and constraint-based grammar formalisms," Computational Linguistics, 18(1992), pp. 159{182. Appendix. Relationship to the CUF Formalism The purpose of this appendix is to sketch how the formal results which were pre- sented in this report are related to the more practical feature-structure programming language CUF. It is not our aim to describe the entire CUF language, for which we refer the reader to the document [DD93] or [Dor94]. Our attention is focused entirely upon the type language, and we are selective rather than encyclopedic in our presentation of details. As our primary goal is to convey the main idea rather than to provide a complete theory, the style is less formal than in the body of the paper; we often express our ideas with annotated examples rather than with rig- orously presented algorithms. However, the ideas are quite straightforward, and it should be no problem to ll in the details, if so desired. We begin with a description of the fragment of the CUF language with which we work. A.1 The CUF type language We work only with the fragment of CUF that deals with types; we do not address features on types, or the more general recursive sorts. Also, for the moment, we do not deal with constant types. They will be discussed in A.3 below. The starting point is a set of type symbols T . CUF allows \identi er names," in typical programming language style, but for our purposes, we take T to be any set. This set may be in nite, but only a nite number of type names are used in any application. From T , we build Boolean expressions from the binary disjunction operator (denoted ;), the binary conjunction operator (denoted &), and the negation operator (denoted ~). The usual convention of ~ having a higher precedence than either ; or & is followed. To simplify matters, in this discussion, we will assume that ; and & have the same precedence, and that ambiguity must be resolved by the use of parentheses. (CUF actually has rules which disambiguate expressions which use operations which would otherwise have the same precedence.) A typical CUF expression is shown below. t1 & t2 & t3 & (t4 ; ~t5 ; ~(t6 & ~t3) ; t7) & t8 80 APPENDIX. RELATIONSHIP TO THE CUF FORMALISM An assignment is a sentence of the form t = E, in which t is a type and E is an expression. A statement is either an expression or an assignment. A statement is always terminated by a period. Thus, t = t1 & t2 & t3 & (t4 ; ~t5 ; ~(t6 & ~t3) ; t7) & t8. is a typical CUF assignment. Think of a CUF type program as a set of statements. In CUF, an expression is thought of as a constraint which must be satis ed. Thus, the constraint t1 & t2 means that the types t1 and t2 cannot have an empty intersection, while the constraint ~(t1 & t2) means that t1 and t2 are disjoint types. The latter constraint would be expressed by Vft1; t2g = ? in a BPPO prespeci cation; we will discuss the former constraint in A.2 below. An assignment associates an expression with a type. Thus, as expected, t = t1 & t2 means the same thing as Vft1; t2g = t would in a BPPO prespeci cation. CUF admits certain syntactic abbreviations. First of all, an expression of the form E1 t1 t1 | t2 | .. | tn expresses that the n types are disjoint, and is an abbrevia- tion for the expression (t1 ; t2 ; : : : ; tn) & ( & i The assignment t = t1 | t2 | .. | tn expresses that t = t1 ; t2 ; .. ; tn and that the n types are disjoint. Similarly, t n types are disjoint. Although the overall CUF type system has the types bot (corresponding to ?) and top (corresponding to >), these types may not be used explicitly in type speci cations. A.2 Translation of CUF expressions to BPPO prespeci cations. In the process of translating CUF programs to BPPO prespeci cations, it is assumed that there is an unlimited supply of new type symbols, and that such symbols may be generated upon demand. It is further assumed that the CUF program is free of the abbreviation symbols \|" and \ been converted to one involving the more primitive Boolean operators, as described in A.1 above. We will illustrate the translation process as it operates on the example CUF program shown below. t1 & t5 & t9. t = t1 & t2 & t3 & (t4 ; ~t5 ; ~(t6 & ~t3) ; t7) & t8. The process proceeds as follows. First of all, since a BPPO prespeci cation does not allow expressions as statements (except for rules of the form a statement that is an expression E (as opposed to an assignment statement), we introduce a new type symbol s and replace the expression E with s = E. In the program above, we replace the expression t1 & t5 & t9 with an assignment to the new variable s0, yielding the following program s0 = t1 & t5 & t9. t = t1 & t2 & t3 & (t4 ; ~t5 ; ~(t6 & ~t3) ; t7) & t8. Having translated each statement which is an expression to an assignment, we pro- ceed to simplify the assignment statements to the point at which they may be interpreted as BPPO rules. The approach is as follows. First of all, for each occur- rence of negation which occurs in a scope wider than that of a single type symbol, we generate a new type symbol and de ne the negated component separately. Con- tinuing with the example program introduced above, with the new type symbol s1 we gets0 = t1 & t5 & t9. t = t1 & t2 & t3 & (t4 ; ~t5 ; ~s1 ; t7) & t8. s1 = t6 & ~t3. Next, for each negated type we de ne an explicit new type symbol corresponding to its complement. Continuing with this example, we introduce the new type symbols s2, s3, and s4, which represent the complements ~t5, s1, and t3, respectively. We also introduce a new symbol btop, the \bogus top" symbol, and we have the following declarations. s0 = t1 & t5 & t9. t = t1 & t2 & t3 & (t4 ; s2 ; s3 ; t7) & t8. s1 = t6 & s4. s2 | t5. s3 | s1. s4 | t3. btop = s2 ; t5. btop = s3 ; s1. btop = s4 ; t3. Next, we decompose all right-hand sides of assignment statements which contain nestings of conjunction and disjunction, so that each right-hand side has only one form. In our example, we introduce one more new type symbol s5, and have as our nal result the following. s0 = t1 & t5 & t9. t = t1 & t2 & t3 & s5 & t8. s1 = t6 & s4. s2 | t5. s3 | s1. s4 | t3. 82 APPENDIX. RELATIONSHIP TO THE CUF FORMALISM btop = s2 ; t5. btop = s3 ; s1. btop = s4 ; t3. s5 = t4 ; s2 ; s3 ; t7. Finally, we need to ensure that btop is the largest type. To so do, we introduce a statement of the form t or from the set which we added (except for btop itself). Thus, all told, we get the program shown in Figure A.1. We now have a CUF program which corresponds directly to a BPPO prespeci cation. To get the prespeci cation, we simply translate in the obvious fashion; it is S = (P;C) with P = ft; t1; t2; t3; t4; t5; t6; t7; t8; t9; s0; s1; s2; s3; s4; s5g; and with C shown in Figure A.1. Note that we are interpreting btop as the > in S, so there is no need to explicitly translate the statements of the form t since they are automatically implied in any BPPO. This is almost a BPPO prespeci cation which is equivalent to the original CUF program. But there are a few points of di erence. Most importantly, we have intro- duced new variables. If we want the BPPO prespeci cation to be truly equivalent to the CUF program, then we cannot demand that these new variables be separable from each other or from the original variables in the same vein that the original variables might be from each other, since these new variables are not part of the original speci cation. Thus, we have to be more selective about which variables we demand be separable. To address this issue, we maintain two sets of pairs of types, which we call the mandatory pairs and the regular pairs. We denote these pairs by MandPair and RegPair, respectively. The mandatory pairs are those which must be separated in any distributive extension of the BPPO prespeci cation which is considered to faithfully model the CUF program. When we translate an expression statement E to an assignment statement s = E, by introducing the new variable s, we add the pair fs;?g to the collection of mandatory separation pairs. This is because the semantics of the CUF expression statement E is precisely that E must be satis able. Hence s cannot be the empty type. Furthermore, for each type t that was used in the original CUF program, we add the pair ft;?g. This just says that the original types must be distinct from the empty type, which CUF requires in its consistency checks. The regular pairs are those that must be separated to yield an injective distribu- tive extension. For each type t that was used in the original CUF program, we add the pair and ft;>g. This just says that the original types must be distinct from the universe. Furthermore, for each pair of variables ft1; t2g from the original CUF program, we add that pair to the collection of regular pairs. Note speci cally that we do not require that types which we introduced in the translation process be separable from each other, from the original types, or even from ?, except in the case that we translated an expression statement to an assignment statement. Thus, in asking for a \legitimate" extension, we ask for Q-separability, with Q a set 83 s0 = t1 & t5 & t9. t = t1 & t2 & t3 & s5 & t8. s1 = t6 & s4. s2 | t5. s3 | s1. s4 | t3. btop = s2 ; t5. btop = s3 ; s1. btop = s4 ; t3. s5 = t4 ; s2 ; s3 ; t7. s0 s1 s2 s3 s4 s5 t1 t2 t3 t4 t5 t6 t7 t8 t9 C = f (Vft1; t5; t9g = s0) (Vft1; t2; t3; s5; t8g = t) (Vft6; s4g = s1) (Vfs2; s5g = ?) (Vfs3; s1g = ?) (Vfs4; t3g = ?) (Wft6; s4g = s1) (Wfs2; s5g = >) (Wfs3; s1g = >) (Wfs4; t3g = >) (Wft4; s2; s3; t7g = s5)g Figure A.1: The nal transformation of the example CUF program, and the corre- sponding BPPO prespeci cation. which contains all mandatory pairs, and whatever subset of regular pairs is deemed appropriate for the particular application. 84 APPENDIX. RELATIONSHIP TO THE CUF FORMALISM The second issue that we must address is the bogus top btop; we must reconcile how that relates to the \real" top top. This is quite simple. Although btopmay not be the top element in the CUF hierarchy (since CUF allows more complex types, such as list types, which we do not consider here), it will be the top element in the set of constructed types, because we have declared it to be such. Thus, while ~t which we construct may not have the same denotation in a full CUF program as it has here, this will not a ect conditions of separability or extensibility in any way. A.3 Constant types in CUF In addition to ordinary types, the CUF type lan- guage allows constant types. They are indicated syntactically by using set brackets. Thus, for example, the following statement declares type t to consist of the three constant types a, b, and c. r = {a, b, c}. The semantics of this statement is the same as that of r = a ; b ; c. together with a declaration that the three types on the right hand side of the dec- laration are atomic. Declaration of atoms may not occur within more complex statements, so that an expression such as t = t1 & (t2 ; {a, b, c}). is not legal in CUF. Our framework already provides the means to handle constants, as described in Sections 1.5 and 2.5. To handle a CUF statement such as r = {a, b, c}. we simply replace it with r = a ; b ; c. in the CUF program. This means that the constraint Wfa; b; cg = r is added to the set of rules of the corresponding BPPO prespeci cation, and that is added fa; b; cg to the set of elements to be rendered atomic. We have thus shown that CUF programs may be translated to nite BPPO pre- speci cations with essentially the same semantics. We now illustrate the translation in the opposite direction. A.4 Translation from BPPO prespeci cations to CUF For the most part, anything that can be represented in a nite BPPO prespeci cation can be repre- sented in a CUF program. Indeed, a rule of the form a following CUF statement 85 a The rules Wfs1; : : : ; skg = a and Wft1; : : : ; tmg = bmay be realized by the following two rules. a = s1 ; ... ; sn. b = t1 & ... & tn. The only di culty arises when we have rules involving ? or >, as CUF does not allow them to be used explicitly in rules. Now CUF does allow a direct equivalent of a two-element meet rule, as Vfs1; s2g = ? may be realized as s1 | s2. However, s1 | s2 | s3. is not equivalent to Vfs1; s2; s3g = ?, but rather to the three rules Vfs1; s2g = ?, Vfs1; s3g = ?, and Vfs2; s3g = ? taken together. The only apparent way to model e ectively this sort of BPPO prespeci cation constraint in CUF is to create an an \arti cial ?" abot in the prespeci cation. Thus, we replace every rule of the form VS = ? with the rule VS = abot. The corresponding CUF statement becomes abot = s1 & s2 & s3. For each type name t in the domain under consideration, if we want every declared type to have a nonempty instantiation (as CUF requires), we must also add a state- ment of the form t & ~abot to ensure that t and abot do not have the same instantiation. Similarly, to model a constraint of the form Wfs1; : : : ; skg = >, we must in- troduce an \arti cial >," and replace the rule with Wfs1; : : : ; skg = atop. The associated CUF statement becomes atop = s1 ; s2 ; s3. Index W, 21, 22 W-fanout, 51 V, 21, 22 V-fanout, 51 >, 17 ?, 17 #, 21 f , 21 S, 44 2, 19 '[B], 68 ~ ', 55 'S, 67 ' XY , 55 ' 01 , 55 '(3), 61 '(2;3), 64 absorption identities, 18 After( ), 61 atom, 36 Aug( ), 40 BdDiLat, 19 BdLat, 19 Before( ), 61 binding of ' by B, 68 bindings, tractable for, 68 bit vector, 19 BoolLat, 19 Boolean algebra, 18 bounded poset with partial operations, 21 BPPO, see bounded poset with partial operations canonical of a prespeci cation, 48 consistent with a prespeci cation, 40 minimal, 41 BPPO, 22 categories distributive extension, 20 clause, 52 nontrivial, 52 CNF, see formula, conjunctive normal form complement, 18 of a literal, 52 constraints, 40 dependent, 30 distributive, 18 Dist-BinExt, 50 Dist-BinExt(h; j;m), 51 Dist-InjExt, 50 Dist-InjExt(h; j;m), 51 DualIdeals( ), 28 DualIdeals( ), 28 embedding, 18, 26 extension atomic for S, 36 full natural, 38 lower, 28 natural with respect to , 38 upper, 28 extension pair, 26 Q-injective, 26 injective, 26 universal, 26, 29 fanout join, 51 meet, 51 FJRS( ), 47 FMRS( ), 48 formula k-CNF, 52 conjunctive normal form, 52 negation normal form, 52 nonredundant, 52 strict k-CNF, 52 full join rule set, 47 full meet rule set, 48 86 INDEX 87 GBPL, see generalized bounded par- tial lattice GBWPL, see generalized bounded weak partial lattice GBWPL, 23 generalized absorption identities, 23 generalized associativity laws, 21, 23 generalized bounded partial lattice, 28 generalized bounded weak partial lat- tice, 22 generalized join, 21, 22 generalized meet, 21, 22 glb, see lower bound, greatest graph of a prespeci cation, 41 Graph( ), 41 Graph( ), 41 height, 51 IdBinDecomp( ), 30 ideal dual of a prespeci cation, 43 dual, of a BPPO, 28 of a BPPO, 27 of a prespeci cation, 43 principal, 28 ideal binary decomposition, 29 Ideals( ), 27 Ideals( ), 27 independent, 30 inner types, 40 interpretation, 53 isomorphism, 17 lattice Boolean, 18 bounded, 18 distributive, 18 bounded bit-vector, 20 dual, 19 full bit-vector, 20 partial, 28 perfect Boolean, 19 product, 19 literal, 52 literal set, 52 Literals(-), 52 logically equivalent, 53 logically identical, 30 lower bound, 17 greatest, 17 lower ideal condition, 28 LowerExt( ), 28 lub, see upper bound, least Mod( ), 53 model, 53 NNF, see formula, negation normal form nonredundant, 30 P( ), 21 Pf( ), 21 poset bounded, 17 bounded with partial operations, see bounded poset with partial operations PreBPPO-Consis, 41 preideal dual principal, 44 principal, 43 prespeci cation bounds consistent, 47 nite BPPO, 40 formula of a, 67 glb consistent, 47 join only, 70 lub consistent, 47 meet only, 70 of unit-free ', 56 one-way, 70 weak partial order of, 41 weakly acyclic, 41 projection s-, 30 Rel_( ), 48 Rel^( ), 48 renders S atomic, 38, 54 representation 88 INDEX (2,3)-hierarchical, 64 S' = (P';C'), 56 S'(2;3) = (P'(2;3) ;C'(2;3)), 66 satis ability problem 2-CNF, 53 CNF, 53 exact k-CNF, 53 k-CNF, 53 nonredundant CNF, 53 Sat-CNF, 53 Sat-Nonredundant-CNF, 53 Sat-kCNF, 53 Sat-Exact-kCNF, 53 Sat-2CNF, 53 separable, 32 fully, 32 somewhere, 32 Sep-CNF, 54 Sep-kCNF, 54 separator, 32, 53 (Q;S), 54 Q, 53 Q-, 32 full, 32, 53 full strong, 54 strong, 54 sizeof a rule, 40 stable, 44 StrongSep-CNF, 54 StrongSep-kCNF, 54 sublattice bounded, 18 translation 3-CNF, 61 truth assignment, 52 upper bound, 17 least, 17 upper ideal condition, 28 UpperExt( ), 28 Vars( ), 52