Abstract 1 Introduction 2 Basic Notions 3 Consistent Relations and Consistency Witness Functions 4 Acyclic Hypergraphs 5 Beta Acyclic Hypergraphs 6 Gamma-Acyclic Hypergraphs 7 Concluding Remarks References

Gamma Acyclicity, Annotated Relations, and Consistency Witness Functions

Albert Atserias ORCID Universitat Politècnica de Catalunya, Barcelona, Spain
Centre de Recerca Matemàtica, Bellaterra, Spain
Phokion G. Kolaitis ORCID University of California Santa Cruz, CA, USA
IBM Research, San Jose, CA, USA
Abstract

During the early days of relational database theory it was realized that “acyclic” database schemas possess a number of desirable properties. In fact, three different notions of “acyclicity” were identified and investigated during the 1980s, namely, α-acyclicity, β-acyclicity, and γ-acyclicity. Much more recently, the study of α-acyclicity was extended to annotated relations, where the annotations are values from some positive commutative monoid. The recent results about α-acyclic schemas and annotated relations give rise to results about β-acyclic schemas and annotated relations, since a schema is β-acyclic if and only if every sub-schema of it is α-acyclic. Here, we study γ-acyclic schemas and annotated relations. Our main finding is that the characterization of γ-acyclic schemas in terms of monotone sequential join expression extends to annotated relations, provided the annotations come from a positive commutative monoid that has the inner consistency property. Furthermore, the results reported here shed light on the role of the join of two standard relations. Specifically, our results reveal that the only relevant property of the join of two standard relations is that it is a witness to the consistency of the two relations, provided that these two relations are consistent. For the more abstract setting of annotated relations, this property of the standard join is captured by the notion of a consistency witness function, a notion which we systematically utilize in this work.

Keywords and phrases:
annotated relations, gamma-acyclicity, consistency witness functions
Funding:
Albert Atserias: Atserias was partially supported by grant PID2022-138506NB-C22 (PROOFS BEYOND) and the Severo Ochoa and María de Maeztu Program for Centers and Units of Excellence in R&D (CEX2020-001084-M) of the AEI, and the CERCA and ICREA Academia Programmes of the Generalitat de Catalunya.
Copyright and License:
[Uncaptioned image] © Albert Atserias and Phokion G. Kolaitis; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Information systems Relational database model
; Theory of computation Database theory
Editors:
Balder ten Cate and Maurice Funk

1 Introduction

Annotated databases are databases in which each fact in a relation is annotated with a value from some algebraic structure. Starting with the influential work on database provenance [12, 13], there has been an extensive investigation of several different aspects of annotated databases, including the study of conjunctive query containment for annotated databases [11, 15] and the evaluation of Datalog programs on annotated databases [14]. In these investigations, the annotations are values from some fixed semiring 𝕂=(K,+,×,0,1). Thus, standard relational databases are annotated databases in which the annotations are 1 (true) and 0 (false), while bag databases are annotated databases in which the annotations are non-negative integers denoting the multiplicities. This framework, which is often referred to as semiring semantics, has spanned first-order logic [9] and least fixed-point logic [6].

During the early days of relational database theory it was realized that “acyclic” database schemas possess a number of desirable semantic properties. In fact, three different notions of “acyclicity” were identified and extensively investigated during the 1980s, namely, acyclicity (also known as α-acyclicity), β-acyclicity, and γ-acyclicity. On undirected graphs (equivalently, on database schemas consisting of binary relation symbols only) these notions coincide with the notion of an acyclic graph, but they form a strict hierarchy on hypergraphs (equivalently, on arbitrary database schemas) with β-acyclicity being a stricter notion than acyclicity, and γ-acyclicity being a stricter notion than β-acyclicity.

The study of acyclic schemas was initiated by Yannakakis, who focused on the evaluation of acyclic joins [16]. After this, Fagin, Beeri, Maier, and Yannakakis [4] showed that acyclic schemas are precisely the ones possessing the local-to-global consistency property, that is, every collection of pairwise consistent relations R1,,Rm over such schemas is globally consistent (i.e., there is a relation T whose projection on the attributes of Ri is equal to Ri, for 1im). Fagin et al. [4] also characterized acyclicity in terms of the existence of monotone sequential join expressions, i.e., expressions of the form ((((R1R2))Rm1)Rm) with the property that if the relations R1,,Rm are pairwise consistent, then every intermediate sequential join expression (((R1R2))Ri1) produces a relation that is consistent with the relation Ri. Results about acyclicity yield results about β-acyclicity, since a schema is β-acyclic if and only if every sub-schema of it is acyclic. Fagin [8] studied γ-acyclicity and showed that a schema is γ-acyclic if and only if every connected sequential join expression is monotone. Intuitively, this means that every sequential join expression is monotone, provided no join between relations with disjoint sets of attributes is allowed.

Atserias and Kolaitis [2] studied the interplay between local consistency and global consistency for annotated relations. Since the definition of consistency of annotated relations uses only the projection operation on relations and since projection is defined using only addition +, they considered 𝕂-relations where the annotations come from a monoid 𝕂=(K,+,0). They identified a condition on monoids, called the inner consistency property, and showed that a positive monoid 𝕂=(K,+,0) has the inner consistency property if and only if every acyclic schema H has the local-to-global consistency property for 𝕂-relations (i.e., every pairwise consistent collection of 𝕂-relations over H is globally consistent). It was not clear, however, whether the results about acyclic schemas and sequential join expressions in [4] can be extended to annotated relations, since, as shown in [1], the analog of the standard join for bags need not be a witness to the consistency of two consistent bags. In a subsequent paper, Atserias and Kolaitis [3] introduced the notion of a consistency witness function on a positive monoid 𝕂, which is a function W that, given two 𝕂-relations R and S, returns a 𝕂-relation W(R,S) that is a consistency witness for R and S, provided that R and S are consistent 𝕂-relations. They also introduced the notion of a monotone sequential c-join expression, which is analogous to that of a monotone sequential join expression with some arbitrary consistency witness function in place of the standard join. Using these notions, it was shown in [3] that the characterization of acyclicity in terms of monotone sequential join expressions in [4] extends to characterizations of acyclicity in terms of monotone sequential c-join expressions on monoids having the inner consistency property; furthermore, the inner consistency property itself can be characterized in such terms.

Here, we investigate γ-acyclic schemas and establish that the desirable semantic properties of γ-acyclic schemas extend to annotated relations. The two main results are as follows:

  1. 1.

    If 𝕂 is a positive commutative monoid and H is a schema such that every connected sequential c-join-expression over H is monotone on 𝕂 w.r.t. some consistency witness function on 𝕂, then H is γ-acyclic.

  2. 2.

    If 𝕂 is a positive commutative monoid that has the inner consistency property and H is a schema which is γ-acyclic, then every connected sequential c-join-expression over H is monotone on 𝕂 w.r.t. every consistency witness function on 𝕂.

As a byproduct of these two main results, we obtain a characterization of the inner consistency property in terms of γ-acyclicity and connected sequential c-join expressions. Furthermore, our work sheds light on the role of the join of two standard relations. Specifically, our results reveal that, in the study of the various notions of acyclicity in [8], the only relevant property of the join of two standard relations is that it is a witness to the consistency of the two relations, provided these two relations are consistent. In the setting of annotated relations, this property of the standard join is captured by the notion of a consistency witness function.

The rest of the paper is organized as follows. Section 2 contains the definitions of the basic notions, while Section 3 contains the definition of a consistency witness function and related notions. To make the paper as self-contained as possible, the earlier results about acyclic schemas are summarized in Section 4. Section 5 discusses β-acyclic schemas. Section 6 contains the main results about γ-acyclic schemas and annotated relations.

2 Basic Notions

Monoids.

A commutative monoid is a structure 𝕂=(K,+,0), where + is a binary operation on the universe K of 𝕂 that is associative, commutative, and has 0 as its neutral element, i.e., p+0=p=0+p holds for all pK. A commutative monoid 𝕂=(K,+,0) is positive if for all elements p,qK with p+q=0, we have that p=0 and q=0. From now on, we assume that all commutative monoids considered have at least two elements in their universe.

The following are examples of positive commutative monoids.

  • The Boolean monoid 𝔹=({0,1},,0) with disjunction as its operation and 0 (false) as its neutral element.

  • The bag monoid =(Z0,+,0), where Z0 is the set of non-negative integers and + is the standard addition operation. Note that the structure =(Z,+,0), where Z is the set of integers, is a commutative monoid, but not a positive one.

  • A numerical semigroup is a submonoid 𝕂=(K,+,0) of the bag monoid =(Z0,+,0), such that K is a cofinite set, i.e., the complement Z0K is finite. A concrete example of a numerical semigroup is 𝕂=(3,5,+,0), where 3,5 is the set of all non-negative integers of the form 3m+5n with m0 and n0, i.e., 3,5={0,3,5,6,8,9,10,}.

  • The power set monoid (A)=(𝒫(A),,), where if A is a set, then 𝒫(A) is its powerset, and is the union operation on sets.

  • The structure 𝕍=([0,1],max,0), where [0,1] is the interval of all real numbers between 0 and 1, and max is the standard maximum operation.

  • The structure 0=([0,),+,0), where [0,) is the set of all non-negative real numbers and + is the standard addition operation.

  • The structure 𝕋=((,],min,), where (,] is the set of all real numbers together with , and min is the standard minimum operation.

𝕂-relations and marginals of 𝕂-relations.

An attribute A is a symbol with an associated set Dom(A) as its domain. If X is a finite set of attributes, then Tup(X) is the set of X-tuples, i.e., the set of functions that take each attribute AX to an element of its domain Dom(A). Tup() is non-empty as it contains the empty tuple, i.e., the function with empty domain. If YX and t is an X-tuple, then the projection of t on Y, denoted by t[Y], is the unique Y-tuple that agrees with t on Y. In particular, t[] is the empty tuple.

Let 𝕂=(K,+,0) be a positive commutative monoid and let X be a finite set of attributes.

  • A 𝕂-relation over X is a function R:Tup(X)K that assigns a value R(t) in K to every X-tuple t in Tup(X). We will often write R(X) to indicate that R is a 𝕂-relation over X, and we will refer to X as the set of attributes of R. If X is the empty set of attributes, then a 𝕂-relation over X is simply a function that assigns a single value from K to the empty tuple. Note that the 𝔹-relations are the standard relations, while the -relations are the bags or multisets, i.e., each tuple has a non-negative integer associated with it that denotes the multiplicity of the tuple.

  • The support Supp(R) of a 𝕂-relation R(X) is the set of X-tuples t that are assigned non-zero value, i.e., Supp(R):={tTup(X):R(t)0}. We will often write R to denote Supp(R). Note that R is a standard relation over X. A 𝕂-relation is finitely supported if its support is a finite set. In this paper, all 𝕂-relations considered will be finitely supported, and we omit the term; thus, from now on, a 𝕂-relation is a finitely supported 𝕂-relation. When R is empty, we say that R is the empty 𝕂-relation over X.

  • If YX, then the marginal R[Y] of R on Y is the 𝕂-relation over Y such that for every Y-tuple t, we have that

    R[Y](t):=rR:r[Y]=tR(r). (1)

    The value R[Y](t) is the marginal of R over t. For notational simplicity, we will often write R(t) for the marginal of R over t, instead of R[Y](t). It will be clear from the context (e.g., from the arity of the tuple t) if R(t) is indeed the marginal of R over t (in which case t must be a Y-tuple) or R(t) is the actual value of R on t as a mapping from Tup(X) to K (in which case t must be an X-tuple). Note that if R is a standard relation (i.e., R is a 𝔹-relation), then the marginal R[Y] is the projection of R on Y.

The proof of the next useful proposition follows easily from the definitions.

Proposition 1.

Let 𝕂 be a positive commutative monoid and let R(X) be a 𝕂-relation. Then the following hold:

  1. 1.

    For all YX, we have R[Y]=R[Y].

  2. 2.

    For all ZYX, we have R[Y][Z]=R[Z].

If X and Y are sets of attributes, then we write XY as shorthand for the union XY.

Schemas and hypergraphs.

  • A schema is a sequence X1,,Xm of non-empty sets of attributes.

  • A hypergraph is a pair H=(V,F), where V is a finite non-empty set and F is a set of non-empty subsets of V. We call V the set of the nodes of H and we call F the set of the hyperedges of H.

A schema X1,,Xm can be identified with the hypergraph H=(i=1mXi,{X1,,Xm}), i.e., the nodes of H are the attributes and the hyperedges of H are the members X1,,Xm of the schema. We will use the terms schema and hypergraph interchangeably.

  • A collection of 𝕂-relations over a schema X1,,Xm is a sequence R1(X1),,Rm(Xm) such that each Ri(Xi) is a 𝕂-relation over Xi.

3 Consistent Relations and Consistency Witness Functions

Let 𝕂=(K,+,0) be a positive commutative monoid.

  • Two 𝕂-relations R(X) and S(Y) are consistent if there is a 𝕂-relation T(XY) such that T[X]=R and T[Y]=S. Such a 𝕂-relation T is a consistency witness for R and S.

  • A collection R1(X1),,Rm(Xm) of 𝕂-relations over a schema X1,,Xm is globally consistent if there is a 𝕂-relation T(X1Xm) such that T[Xi]=Ri, for i with 1im. Such a 𝕂-relation T is a consistency witness for R1,,Rm.

Note that if R1(X1),,Rm(Xm) is a globally consistent collection of 𝕂-relations, then the relations R1(X1),,Rm(Xm) are pairwise consistent. Indeed, if T is a consistency witness for R1(X1),,Rm(Xm), then for all i and j with 1i,jm, we have that the 𝕂-relation T[XiXj] is a consistency witness for Ri and Rj, because

Ri=T[Xi]=T[XiXj][Xi]andRj=T[Xj]=T[XiXj][Xj],

where, in each case, the first equality follows from the definition of global consistency and the second equality follows from Proposition 1.

It is well known that the converse fails even for standard relations, i.e., there are standard relations that are pairwise consistent but not globally consistent. The main result by Beeri et al. [4] characterizes the schemas for which the pairwise consistency of a collection of standard relations implies that they are globally consistent. Quite recently, this result was extended to 𝕂-relations over positive monoids that satisfy a condition called the inner consistency property [2]. We will discuss this extension in the next section. For now, we consider the following notion, which was introduced and studied in [3].

  • A consistency witness function on 𝕂 is a function W that takes as arguments two 𝕂-relations R(X) and S(Y), and returns as value a 𝕂-relation W(R,S) over XY such that if R and S are consistent 𝕂-relations, then W(R,S) is a consistency witness for R and S.

Example 2.

We now give examples of consistency witness functions for several different positive monoids.

  1. 1.

    If 𝔹=({0,1},,0) is the Boolean monoid, then an example of a consistency witness function on 𝔹 is the standard join operation on standard relations.

  2. 2.

    If (A)=(𝒫(A),,) is a powerset monoid, then an example of a consistency witness function on (A) is the function W such that for every XY-tuple t, we have that

    W(R,S)(t)=R(t[X])S(t[Y]).
  3. 3.

    If 𝕍=([0,1],max,0), then an example of a consistency witness function on 𝕍 is the function W such that for every XY-tuple t, we have that

    W(R,S)(t)=min{R(t[X]),S(t[Y])}.
  4. 4.

    If 0=([0,),+,0), then an example of a consistency witness function on 0 is the function W such that for every XY-tuple t, we have that

    W(R,S)(t)={(R(t[X])×S(t[Y]))/R(t[XY]),if R(t[XY])00,if R(t[XY])=0.
  5. 5.

    If 𝕋=((,],min,), then an example of a consistency witness function on 𝕋 is the function W such that for every XY-tuple t, we have that

    W(R,S)(t)={R(t[X])+S(t[Y])R(t[XY]),if R(t[XY]),if R(t[XY])=.

    (in the previous two expressions, ×, /, +, and are the standard multiplication, division, addition, and subtraction operations on the real numbers).

As shown in [2], the witness functions in the first three preceding examples are instances of the standard join 𝕂,S on a monoid 𝕂 that can be expanded to a bounded distributive lattice. For instance, the powerset monoid (A)=(𝒫(A),,) can be expanded to the bounded distributive lattice (𝒫(A),,,,A). Furthermore, the witness functions in the last two preceding examples are instances of the Vorob’ev join 𝕂,V on a monoid 𝕂 that can be expanded to a semifield. For instance, the monoid 𝕋=((,],min,) can be expanded to the tropical semifield ((,],min,+,,,0).

Note that the bag monoid (N,+,0) was not included in the preceding examples. As pointed out in [1], the bag-join operation of bags (the analog of the standard join for bags) is not a consistency witness function on the bag monoid . Furthermore, the analog of the Vorob’ev join is not well-defined on . A consistency witness function for can be obtained via an iterative algorithm, called the northwest corner method (see [2] for details).

A join expression is an expression involving standard relations and applications of the join operation on standard relations [4, 8]. In [3], the notion of a c-join expression and its variants were introduced as a generalization of the notion of join expression to arbitrary consistency witness functions and 𝕂-relations. The precise definitions are as follows.

Let X1,,Xm be a schema and let c be a binary function symbol, which will be interpreted by some consistency witness function.

  • The collection of c-join expressions over X1,,Xm is the smallest collection of strings that contains each Xi and has the property that if E1 and E2 are in the collection, then also the string (E1cE2) is in the collection.

  • The collection of sequential c-join expressions over X1,,Xm is the smallest collection of strings that contains each Xi and has the property that if E is in the collection and X is one of the Xi’s, then also the string (EcX) is in the collection.

Note that a (sequential) c-join expression over X1,,Xm need not contain every set Xi.

Clearly, the string ((X1cX2)cX3) is a sequential c-join-expression, while the string ((X1cX2)c(X3cX4)) is a c-join expression, but not a sequential one.

Semantics to c-join expressions are assigned in a straightforward way as follows.

Let X1,,Xm be a schema and let E be a c-join-expression over X1,,Xm. If W is a consistency witness function on 𝕂 and R1(X1),,Rm(Xm) is a collection of 𝕂-relations, we write E(W,R1,,Rm) to denote the 𝕂-relation over X1Xm obtained by evaluating E when c is interpreted by W and each Xi is interpreted by Ri for i=1,,m.

The next notion yields a sufficient condition for a c-join expression to give rise to global consistency witnesses.

  • Let E be a c-join expression over a schema X1,,Xm, let W be a consistency witness function on 𝕂, and let R1(X1),,Rm(Xm) be a collection of 𝕂-relations. We say that E is monotone with respect to W and R1(X1),,Rm(Xm) if for every sub-expression E1cE2 of E, we have that the 𝕂-relations E1(W,R1,,Rm) and E2(W,R1,,Rm) are consistent.

Example 3.

Let H be the schema {A,B},{A,C},{A,B,C} and consider the sequential c-join-expressions E1 and E2 over H, where

E1=(({A,B}c{A,B,C})c{A,C})andE2=(({A,B}c{A,C})c{A,B,C}).

Consider also the monoid 𝕍=([0,1],max,0) and the consistency witness function W on 𝕍 such that W(R,S)(t)=min{R(t[X]),S(t[Y])}, for every XY-tuple t (see Example 2). Let f,t be two values in some domain with ft, let c,d be two real numbers such that 0<c<d<1, and let R1(A,B),R2(A,C),R3(A,B,C) be the following 𝕍-relations:

  • R1(f,f)=c, R1(f,t)=d, and R1(x,y)=0, for all other pairs.

  • R2(f,f)=c, R2(f,t)=d, and R2(x,y)=0, for all other pairs.

  • R3(f,f,f)=c, R3(f,t,t)=d, and R3(x,y,z)=0, for all other triples.

Let us evaluate E1 and E2 on R1,R2,R3 using the consistency witness function W. It is easy to check that E1(W,R1,R2,R3)=W(W(R1,R3),R2)=W(R3,R2)=R3 and that E2(W,R1,R2,R3)=W(W(R1,R2),R3)=W(R4,R3)=R3, where R4(A,B,C) is the 𝕍-relation with R4(f,f,f)=c, R4(f,f,t)=c, R4(f,t,f)=c, R4(f,t,t)=d, and R4(x,y,z)=0, for all other triples.

While both E1 and E2 evaluate to the same 𝕍-relation, there is an important difference in the intermediate steps of their evaluations. Specifically, in the case of E1, the intermediate relation W(R1,R2)=R3 is consistent with the last relation R2; in contrast, in the case of E2, the intermediate relation W(R1,R2)=R4 is not consistent with the last relation R3 (since R3 and R4 are different 𝕍-relations on the same set of attributes). In particular, this example shows that the sequential c-join-expression E2 is not monotone with respect to W.

The next proposition from [3] is proved in a straightforward way by induction on the construction of c-join expressions and by using Proposition 1.

Proposition 4.

Let E be a c-join expression over X1,,Xm, let W be a consistency witness function on 𝕂, and let R1(X1),,Rm(Xm) be 𝕂-relations. If E is monotone with respect to W and R1,,Rm, and every Xi occurs in E, then E(W,R1,,Rm) is a global consistency witness for the 𝕂-relations R1,,Rm.

4 Acyclic Hypergraphs

As mentioned in Section 2, if R1,,Rm are standard relations that are globally consistent, then they are pairwise consistent, but the converse does not always hold. For example, consider the triangle schema {A,B},{B,C},{C,A} and the standard relations R1(A,B)={(0,0),(1,1)}, R2(B,C)={(0,1),(1,0)}, R3(C,A)={(0,0),(1,1)}. It is easy to check that these standard relations are pairwise consistent; however, they are not globally consistent since ((R1R2)R3)=. Beeri et al. [4] characterized the schemas for which every collection of pairwise consistent standard relations is globally consistent by showing that these are precisely the acyclic (also known as α-acyclic) schemas. To give the precise definition of an acyclic schema, we need to first introduce some basic notions about hypergraphs.

Let H=(V,F) be a hypergraph in which each vertex belong to at least one hyperedge.

  • A path in H is a sequence X1,,Xk of hyperedges of H such that XiXi+1, for every i with 1i<k. In this case, we say that there is a path from X1 to Xk.

  • We say that a set G of hyperedges of H is connected if for every two distinct hyperedges X and X of G, there is a path from X to X.

  • A connected component of H is a maximal connected set of hyperedges of H

  • We say that H is connected if the set F of the hyperedges of H is connected (in other words, H has a single connected component); otherwise, we say that H is disconnected.

  • H is reduced if no hyperedge of H is properly contained in some other hyperedge of H.

  • The reduction of H is the hypergraph (V,F), where F consists of the hyperedges in F that are not properly contained in some other hyperedge in F.

  • If UV, then the induced hypergraph H[U] is the hypergraph (U,{XU:XF}{}). Also, the restriction of H on U, denoted HU, is the reduction of the hypergraph H[U].

  • Let H be a reduced hypergraph and let X,X be two distinct hyperedges. We say that Y=XX is an articulation set of H if the number of connected components of H(VY) is bigger than the number of connected components of H.

  • Let H be a reduced hypergraph. We say that H is acyclic if the following condition holds: for every set UV, if HU is connected and has at least two hyperedges, then it has an articulation set; otherwise, we say that H is cyclic.

  • We say that H is acyclic if its reduction is acyclic; otherwise, it is cyclic. Acyclic hypergraphs are also known as α-acyclic hypergraphs, while cyclic hypergraphs are also known as α-cyclic hypergraphs.

Admittedly, the notion of an acyclic hypergraph appears to be difficult to grasp when encountered for the first time. Intuitively, it generalizes to hypergraphs the property that a graph is acyclic if and only if every connected component of it with at least two edges has an articulation point. It is well known that there is a polynomial-time algorithm for testing if a hypergraph is acyclic; this algorithm is due to Graham [10] and, independently, to Yu and Ozsoyoglu [17], and it is known as the GYO algorithm (see also [8]).

There are several different structural conditions that are equivalent to acyclicity. We discuss two of these notions next.

Let H=(V,F) be a hypergraph.

  • The Gaifman graph G(H) of H is the undirected graph with nodes the attributes of H and such that there is an edge between two attributes of H if and only if both these attributes belong to one of the hyperedges of H.

  • H is conformal if every clique of G(H) is contained in one of the hyperedges of H.

  • H is chordal if every cycle of G(H) of length at least 4 has a chord, i.e., there is an edge of G(H) that is not an edge of the cycle.

  • H has the running intersection property if there is an ordering Y1,,Ym of the hyperedges of H such that for every im, there is a j<i such that (Y1Yi1)YiYj.

The proof of the next result can be found in [4].

Proposition 5.

For every hypergraph H, the following statements are equivalent:

  1. 1.

    H is acyclic.

  2. 2.

    H is conformal and chordal.

  3. 3.

    H has the running intersection property.

The triangle schema {A,B},{B,C},{C,A} is cyclic because it is not conformal (but it is chordal); the 4-cycle schema {A,B},{B,C},{C,D},{D,A} is cyclic because it is not chordal (but it is conformal). For every n2, the n-path schema Pn with hyperedges {A1,A2},{A2,A3},,{An,An+1} is acyclic because it is both conformal and chordal. One can also reason about these schemas using the running intersection property. Finally, consider the schema {A,B,C},{C,D,E},{E,F,A},{A,C,E}. It has the running intersection property via the ordering {A,B,C},{A,C,E},{C,D,E},{E,F,A}, hence it is acyclic.

Beeri et al. [4] showed that acyclicity can be characterized in terms of useful semantic properties, where by “semantic” we mean a property of the hypergraph whose definition involves also standard relations. Specifically, consider the following two properties.

Let H be a hypergraph with X1,,Xm as its hyperedges.

  • H has the local-to-global consistency property for standard relations if for every collection R1(X1),,Rm(Xm) of pairwise consistent standard relations over H, we have that this collection is globally consistent.

  • H admits a monotone join expression if there is a c-join expression E such that

    1. i

      E is monotone with respect to the standard join operation and every collection of pairwise consistent relations R1(X1),,Rm(Xm);

    2. ii

      Every hyperedge Xi of H occurs in E.

As mentioned in Section 2, if a collection of relations is globally consistent, then it is pairwise consistent. Thus, if a schema has the local-to-global consistency property for standard relations, then global consistency coincides with pairwise consistency for relations over that schema. Furthermore, if a schema admits a monotone join expression, then, in view of Proposition 4, this join expression can be used to construct witnesses to global consistency of collections of pairwise consistent relations.

With the notions of local-to-global consistency property and monotone join expression at hand, the main result in Beeri et al. [4] can be stated as follows.

Theorem 6 ([4]).

For every hypergraph H, the following statements are equivalent:

  1. 1.

    H is acyclic.

  2. 2.

    H has the local-to-global consistency property for standard relations.

  3. 3.

    H admits a monotone sequential join expression.

Thus, the triangle schema and the 4-cycle schema do not have the local-to-global consistency property for standard relations and do not admit a monotone join expression, but each n-path schema does, and so does the schema {A,B,C},{C,D,E},{E,F,A},{A,C,E}.

In [2], the following question was investigated: does Theorem 6 extend from standard relations to 𝕂-relations, where 𝕂 is an arbitrary positive commutative monoid?

The first realization in [2] was that acyclicity is a necessary, but not always sufficient, condition for the local-to-global consistency property to hold for 𝕂-relations. More formally, we say that a hypergraph H={X1,,Xm} has the local-to-global consistency property for 𝕂-relations if every collection R1(X1),,Rm(Xm) of pairwise consistent 𝕂-relations is also globally consistent.

We can now state the precise result about the necessity of acyclicity.

Theorem 7 ([2]).

The following statements are true:

  1. 1.

    For all positive commutative monoids 𝕂 and hypergraphs H, if H has the local-to-global consistency property for 𝕂-relations, then H is acyclic.

  2. 2.

    There are positive commutative monoids 𝕂 and hypergraphs H such that H is acyclic and does not have the local-to-global consistency property for 𝕂-relations. In particular, this holds true for every numerical semigroup 𝕂 other than the bag monoid =(N,+,0) and for the 3-path hypergraph P3.

Furthermore, in [2], a class of positive commutative monoids 𝕂 was identified for which the acyclicity of a hypergraph H is a sufficient condition for H to have the local-to-global consistency property for 𝕂-relations.

  • Two 𝕂-relations R(X) and S(Y) are inner consistent if R[XY]=S[XY].

  • We say that 𝕂 has the inner consistency property if whenever two 𝕂-relations are inner consistent, they are also consistent.

Note that, using Proposition 1, it is easy to verify that if R and S are consistent 𝕂-relations, then they are also inner consistent. Consequently, for monoids with the inner consistency property, the notions of consistency and inner consistency coincide. In particular, this holds true for the the Boolean monoid 𝔹=({0,1},,0).

In [1], it was shown that the bag monoid =(N,+,0) has the inner consistency property. In [2], several other monoids were shown to have the inner consistency property, including the monoids 𝕍=([0,1],max,0), 0=([0,),+,0), 𝕋=((,],min,), and the power set monoids (A)=(𝒫(A),,), for every set A. In contrast, no numerical semigroup other than the bag monoid has the inner consistency property.

To state the extension of Theorem 6 to 𝕂-relations, we need some additional notions, which were introduced in [3].

Let 𝕂 be a positive commutative monoid, let X1,,Xm be a schema, and let E be a c-join expression over X1,,Xm.

  • First, recall from Section 3, that E is monotone with respect to a consistency witness function W on 𝕂 and a collection R1(X1),,Rm(Xm) of 𝕂-relations if for every sub-expression E1cE2 of E, we have that the 𝕂-relations E1(W,R1,,Rm) and E2(W,R1,,Rm) are consistent.

  • We say that E is monotone on 𝕂 if there is a consistency witness function W on 𝕂 such that E is monotone with respect to W and every collection R1(X1),,Rm(Xm) of pairwise consistent 𝕂-relations.

  • We say that E is strongly monotone on 𝕂 if for every consistency witness function W on 𝕂, we have that E is monotone with respect to W and every collection R1(X1),,Rm(Xm) of pairwise consistent 𝕂-relations.

Finally, we define what it means for a schema to admit a monotone and a strongly monotone c-join expression.

  • A schema X1,,Xm admits a monotone c-join expression on 𝕂 if there is a c-join-expression E over X1,,Xm such that E is monotone on 𝕂 and every hyperedge Xi occurs in E.

  • A schema X1,,Xm admits a strongly monotone c-join expression on 𝕂 if there is a c-join-expression E over X1,,Xm such that E is strongly monotone on 𝕂 and every hyperedge Xi occurs in E.

We can now state one of the main results from [2, 3].

Theorem 8 ([2, 3]).

Let 𝕂 be a positive commutative monoid that has the inner consistency property. For every hypergraph H, the following statements are equivalent:

  1. 1.

    H is acyclic.

  2. 2.

    H has the local-to-global consistency property for 𝕂-relations.

  3. 3.

    H admits a monotone sequential c-join-expression on 𝕂.

  4. 4.

    H admits a strongly monotone sequential c-join expression on 𝕂.

Theorem 8 yields Theorem 6 of Beeri et al. [4] by taking 𝕂 to be the Boolean monoid 𝔹. In fact, Theorem 8 yields something stronger: the standard join can be replaced in Theorem 6 by an arbitrary consistency witness function for standard relations. In effect, this means that the only property of the standard join needed in Theorem 6 is that the standard join is a consistency witness function for standard relations.

As shown in [2], the inner consistency property actually characterizes the positive commutative monoids 𝕂 for which every acyclic hypergraph has the local-to-global consistency property for 𝕂-relations.

Theorem 9 ([2, 3]).

Let 𝕂 be a positive commutative monoid. Then the following statements are equivalent:

  1. 1.

    𝕂 has the inner consistency property.

  2. 2.

    Every acyclic hypergraph has the local-to-global consistency property for 𝕂-relations.

  3. 3.

    The 3-path hypergraph P3 has the local-to-global consistency property for 𝕂-relations.

  4. 4.

    Every acyclic hypergraph admits a monotone sequential c-join-expression on 𝕂

  5. 5.

    Every acyclic hypergraph admits a strongly monotone sequential c-join-expression on 𝕂.

5 Beta Acyclic Hypergraphs

Their good structural and semantic properties notwithstanding, acyclic hypergraphs suffer from the drawback that acyclicity is not a hereditary property, that is to say, a sub-hypergraph of an acyclic hypergraph need not be acyclic. For example, the hypergraph {A,B,C},{A,B},{B,C},{C,A} is acyclic but it contains as a sub-hypergraph the triangle hypergraph {A,B}, {B,C}, {C,A}, which is cyclic.

Motivated by the preceding considerations, Fagin [8] introduced the following notion.

  • A hypergraph H is β-acyclic if every sub-hypergraph of H is acyclic; otherwise, H is β-cyclic.

For example, the hypergraph H with hyperedges {A,B,C},{A,B},{A,C} is β-acyclic. There is a polynomial-time algorithm for testing if a hypergraph is β-acyclic (see [8]).

Fagin [8] found several different characterizations of β-acyclicity, including some involving the absence of cycles of certain types. In the sequel, we will use the following one.

  • A weak β-cycle in a hypergraph H is a sequence Y1,A1,Y2,A2,,Yk,Ak,Yk+1 such that k3 and the following properties hold:

    1. 1.

      Y1,,Yk are distinct hyperedges of H and Yk+1=Y1;

    2. 2.

      A1,,Ak are distinct nodes of H;

    3. 3.

      For 1ik, the node Ai is in YiYi+1.

    4. 4.

      For 1ik, the node Ai is not in any hyperedge Yj other than Yi and Yi+1.

Theorem 10 ([8]).

For every hypergraph H, the following statements are equivalent:

  1. 1.

    H is β-acyclic.

  2. 2.

    H has no weak β-cycles.

For example, consider the schema {A,B,C},{C,D,E},{E,F,A},{A,C,E}, which was shown earlier to be acyclic. The sequence {A,B,C},C,{C,D,E},E,{E,F,A},A,{A,B,C} is a weak β-cycle, hence this schema is β-cyclic.

Because of the hereditary nature of β-acyclicity, the characterizations of acyclicity in Section 4 give rise to characterizations of β-acyclicity. Thus, the following result holds.

Corollary 11.

Let 𝕂 be a positive commutative monoid that has the inner consistency property. For every hypergraph H, the following statements are equivalent:

  1. 1.

    H is β-acyclic.

  2. 2.

    Every sub-hypergraph of H has the local-to-global consistency property for 𝕂-relations.

  3. 3.

    Every sub-hypergraph of H admits a monotone sequential c-join-expression on 𝕂.

  4. 4.

    Every sub-hypergraph of H admits a strongly monotone sequential c-join expression on 𝕂.

6 Gamma-Acyclic Hypergraphs

Fagin [8] introduced and studied γ-acyclic hypergraphs, which form a proper subclass of the class of β-acyclic hypergraphs. As with β-acyclic hypergraphs, there are several equivalent formulations of the notion of a γ-acyclic hypergraph in terms of absence of cycles of certain types, including the following one.

  • A weak γ-cycle in a hypergraph H is a sequence Y1,A1,Y2,A2,,Yk,Ak,Yk+1 such that k3 and the following properties hold:

    1. 1.

      Y1,,Yk are distinct hyperedges of H and Yk+1=Y1;

    2. 2.

      A1,,Ak are distinct nodes of H;

    3. 3.

      For 1ik, the node Ai is in YiYi+1;

    4. 4.

      For i=1,2, the node Ai is not in any hyperedge Yj other than Yi and Yi+1.

  • A hypergraph H is γ-acyclic if H has no weak γ-cycle; otherwise, H is γ-cyclic.

Clearly, every sub-hypergraph of a γ-acyclic hypergraph is γ-acyclic as well. Observe that the only difference between a weak β-cycle and a weak γ-cycle is in the fourth condition of the definitions of these notions: the requirement that the node Ai belongs only to the hyperedges Yi and Yi+1 holds for every ik in the case of a weak β-cycle, while it holds for i=1,2 in the case of a weak γ-cycle. In particular, every weak β-cycle is also a weak γ-cycle; consequently, every γ-acyclic hypergraph is also β-acyclic. The converse, however, is not true. To see this, consider the hypergraph H with hyperedges {A,B,C},{A,B},{A,C}, which, as pointed out in Section 5, is β-acyclic. Clearly, the sequence {A,B},B,{A,B,C},C,{A,C},A,{A,B} is a weak γ-cycle, hence this hypergraph is γ-cyclic. It is also easy to see that for every n2, the n-path hypergraph Pn with hyperedges {A1,A2},,{An,An+1} is γ-acyclic. Note that there is a polynomial-time algorithm, due to D’ Atri and Moscarini [7], for testing whether or not a hypergraph is γ-acyclic (see also [8, Section 9.4]).

There are several different structural characterizations of γ-acyclic hypergraphs, including one which is due to Brault-Baron [5] and which involves the hypergraph H above. To describe this characterization, let us recall the following basic notion from Section 4.

  • Let H=(V,F) be a hypergraph and let U be a subset of the set V of the nodes of H. The induced hypergraph H[U] is the hypergraph with hyperedges {XU:XE}{}.

Proposition 12 ([5]).

For every hypergraph H, the following statements are equivalent:

  1. 1.

    H is γ-acyclic.

  2. 2.

    H is β-acyclic and there do not exist three nodes A,B,C of H such that the hypergraph H with hyperedges {A,B,C},{A,B},{A,C} is a sub-hypergraph of H[{A,B,C}].

In fact, Brault-Baron [5] defines a γ-acyclic hypergraph to be a hypergraph that satisfies the second condition in Proposition 12; he then shows that this condition is equivalent to the D’ Atri and Moscarini algorithm [7] producing the empty hypergraph, hence this condition is equivalent to Fagin’s [8] definition of γ-acyclicity.

Fagin [8] established that γ-acyclic hypergraphs have certain desirable semantic properties; the main such property involves the notion of a connected join expression.

  • A join expression E is connected if for each of its sub-expressions (E1E2), there is an attribute that appears in both E1 and E2.

In particular, if E is a sequential join expression ((((Y1Y2))Yk1)Yk), then E is connected if and only if for every with 1ik, we have that (Y1Yi1)Yi. For example, the sequential join expression (({A1,A2}{A2,A3}){A3,A4}) is connected, while the sequential join expression ({A1,A2}{A3,A4}) is not connected.

We can now state the main semantic characterization of γ-acyclicity, obtained in [8].

Theorem 13 ([8]).

For every hypergraph H, the following statements are equivalent:

  1. 1.

    H is γ-acyclic.

  2. 2.

    Every connected sequential join expression over H is monotone.

The notion of a connected join expression extends to the notion of a connected c-join expression in a straightforward way.

  • A c-join expression E is connected if for each of its sub-expressions (E1cE2), there is an attribute that appears in both E1 and E2.

In particular, if E is a sequential c-join expression ((((Y1cY2)c)cYk1)cYk), then E is connected if for every with 1ik, we have that (Y1Yi1)Yi.

It is now natural to ask: does Theorem 13 extend and how does it extend to γ-acyclic hypergraphs, c-join expressions, and 𝕂-relations, where 𝕂 is a positive commutative monoid?

Let 𝕂 be a positive commutative monoid and let E be a c-join expression. Recall that E is monotone on 𝕂 if there is a consistency witness function W on 𝕂 such that E is monotone with respect to W and every collection R1(X1),,Rm(Xm) of pairwise consistent 𝕂-relations. Recall further that E is strongly monotone on 𝕂 if E is monotone with respect to every consistency witness function W on 𝕂 and every collection R1(X1),,Rm(Xm) of pairwise consistent 𝕂-relations.

In what follows in this section, we will establish the following results:

  1. 1.

    If H is a hypergraph such that every connected sequential c-join-expression over H is monotone on 𝕂, then H is γ-acyclic.

  2. 2.

    If 𝕂 has the inner consistency property and H is γ-acyclic, then every connected sequential c-join-expression over H is strongly monotone on 𝕂,

Theorem 14.

For all positive commutative monoids 𝕂 and hypergraphs H, if H is such that every connected sequential c-join-expression over H is monotone on 𝕂, then H is γ-acyclic.

Proof.

We will prove the contrapositive, that is, if the hypergraph H is not γ-acyclic, then there is a connected sequential c-join expression E over H such that E is not monotone on 𝕂. So, assume that H is not γ-acyclic. We distinguish two cases, namely, the case in which H is not β-acyclic and the case in which H is β-acyclic.

Case 1.

Assume that H is not β-acyclic. By the definition of β-acyclicity, there is a sub-hypergraph H of H that is cyclic. Moreover, we may assume that H is connected, since if every connected component of H were acyclic, then it is easy to see that H would be acyclic as well. Let X1,,Xk be a list of the hyperedges of H. Since H is cyclic, the first part of Theorem 7 implies that there are 𝕂-relations R1(X1),,Rk(Xk) that are pairwise consistent, but not globally consistent. Since H is connected, there is a sequence Y1,,Yt of not necessarily distinct sets of attributes such that the following hold: (a) each Yj is one of the hyperedges of H, i.e., Yj=Xij, where ij{1,,k}; (b) each hyperedge Xi of H appears in the sequence Y1,,Yt; and (c) for every j with 1j<t, we have that YjYj+1. Let E be the sequential c-join expression ((((Y1cY2)c)cYt1)cYt). Then E is a connected c-join expression because YjYj+1 holds, for every j with 1j<t1. We now claim that there is no consistency witness function W on 𝕂 such that E is monotone with respect to W. To see this, let W be a consistency witness function on 𝕂 and consider the pairwise consistent 𝕂-relations R1(X1),,Rk(Xk). If E were monotone with respect to W, then, by Proposition 4, the 𝕂-relation E(W,Ri1,,Rit) is a global consistency witness for the relations Ri1,,Rit, hence it is a global consistency witness for the relations R1,,Rk since every hyperedge Xi appears in the sequence Y1,,Yt. This, however, is a contradiction since the relations R1,,Rk are not globally consistent.

Case 2.

Assume that H is β-acyclic. Since H is not γ-acyclic, Proposition 12 implies that there are three attributes A, B, C and three hyperedges Y1,Y2,Y3 of H such that Y1{A,B,C}={A,B}, Y2{A,B,C}={A,C}, and Y3{A,B,C}={A,B,C}. Let D1,D2,D3 be the remaining sets of attributes in Y1,Y2,Y3, respectively; thus, Y1={A,B}D1, Y2={A,C}D2, Y3={A,B,C}D3. Let E be the sequential c-join expression ((Y1cY2)cY3)), which is connected since {A,B,C}(Y1Y2)Y3.

We now claim that there is no consistency witness function W on 𝕂 such that E is monotone with respect to W. We define four 𝕂-relations in pairs R1(A,B,D1),R2(A,C,D2), and S1(A,B,C,D1,D2),S2(A,B,C,D1,D2). To define them, let 𝐟1 and 𝐟2 be the tuples (f,,f) of lengths equal to the cardinalities of D1 and D2, and let 𝐟 be the tuple (f,,f) of length equal to the cardinality of D1D2. Let a be a non-zero element 𝕂 and let

  • R1(f,f,𝐟1)=a, R1(f,t,𝐟1)=a, and R1(x,y,𝐳1)=0, for all other values,

  • R2(f,f,𝐟2)=a, R2(f,t,𝐟2)=a, and R2(x,y,𝐳2)=0, for all other values,

  • S1(f,f,f,𝐟)=a, S1(f,t,t,𝐟)=a, and S1(x,y,z,𝐰)=0, for all other values,

  • S2(f,f,t,𝐟)=a, S2(f,t,f,𝐟)=a, and S2(x,y,z,𝐰)=0, for all other values.

It is easy to verify that S1(A,B,C,D1,D2) and S2(A,B,C,D1,D2) are two different consistency witnesses for the relations R1(A,B,D1) and R2(A,C,D2). It is easy to verify that S1(A,B,C,D1,D2) and S2(A,B,C,D1,D2) are two different consistency witnesses for the relations R1(A,B,D1) and R2(A,C,D2).

Now, let W be an arbitrary witness function on 𝕂. Since the relations R1 and R2 are consistent, we have that the 𝕂-relation W(R1,R2) is a consistency witness function for R1 and R2. We distinguish the following two sub-cases.

Sub-case 1.

W(R1,R2)[ABC]=S1[ABC]. In this case, let R3(A,B,C,D3) be the 𝕂-relation such that R3(f,f,t,𝐟3)=a, R3(f,t,f,𝐟3)=a, and R3(x,y,z,𝐰)=0, for all other values, where 𝐟3 is a tuple of f’s of length equal to the cardinality of the set D3. Observe that R3[ABC]=S2[ABC]. Since S2 is a consistency witness for R1 and R2, we have that the relations R1,R2,R3 are pairwise consistent. However, the 𝕂-relations W(R1,R2)=S1 and R3 are not consistent, since S1[ABC]S2[ABC] and S2[ABC]=R3[ABC].

Sub-case 2.

W(R1,R2)[ABC]S1[ABC]. In this case, let R3(A,B,C,D3) be the 𝕂-relation such that R3(f,f,f,𝐟3)=a, R3(f,t,t,𝐟3)=a, and R3(x,y,z,𝐰)=0, for all other values, where 𝐟3 is a tuple of f’s of length equal to the cardinality of the set D3. Observe that R3[ABC]=S1[ABC]. Since S1 is a consistency witness for R1 and R2, we have that the relations R1,R2,R3 are pairwise consistent. However, the 𝕂-relations W(R1,R2) and R3 are not consistent, since W(R1,R2)[ABC]S1[ABC]=R3[ABC]. Since the hypergraph H with hyperedges {A,B,C},{A,B},{A,C} is γ-cyclic, Theorem 14 implies that there is a connected sequential c-join expression over H that is not monotone on 𝕂. Actually, the proof of Theorem 14 implies that (({A,B}c{A,C})c{A,B,C}) is such an expression, and Example 3 is an illustration of this fact.

The preceding Theorem 14 asserts that γ-acyclicity is a necessary condition for a hypergraph H to have the property that every connected sequential c-join expression over H is monotone on 𝕂, where 𝕂 is an arbitrary positive commutative monoid. The second main result in this section asserts that if 𝕂 has the inner consistency property, then γ-acyclicity is a sufficient condition for a hypergraph to have the property that every connected sequential c-join expression over 𝕂 is strongly monotone on 𝕂.

Theorem 15.

Let 𝕂 be a positive commutative monoid that has the inner consistency property. If H is a γ-acyclic hypergraph, then every connected sequential c-join expression over H is strongly monotone on 𝕂.

Proof.

We will establish the contrapositive, i.e., if H does not have the property that every connected sequential c-join expression over H is strongly monotone on 𝕂, then H is γ-cyclic.

Assume that H lacks the above property. Then there exist a connected sequential c-join expression E=((((X1cX2)c)cXm1)cXm) over H, a consistency witness function W on 𝕂, and a collection R1(X1),,Rm(Xm) of pairwise consistent 𝕂-relations such that E is not monotone w.r.t. to W and R1(X1),,Rm(Xm). In turn, this means that there is some index j<m such that the 𝕂-relation Ej(W,R1,,Rj) is not consistent with the 𝕂-relation Rj+1, where Ej is the sequential c-join expression ((((X1cX2)c)cXj1)cXj). Let j be the smallest index with this property; thus, if i<j, then the 𝕂-relation Ei(W,R1,,Ri) is consistent with the 𝕂-relation Ri+1.

Let Y=(X1Xj)Xj+1. Note that Y, since E is a connected sequential c-join expression. Note also that X1Xj is the set of attributes of Ej(W,R1,,Rj), while Xj+1 is the set of attributes of Rj+1. By hypothesis, 𝕂 has the inner consistency property, which means that if two 𝕂-relations Q1(X1) and Q2(X2) are inner consistent (i.e., Q1[X1X2]=Q2[X1X2]), then they are consistent. Thus, since the 𝕂-relations Ej(W,R1,,Rj) and Rj+1 are not consistent, it follows that Ej(W,R1,,Rj) and Rj+1 are not inner consistent, hence Ej(W,R1,,Rj)[Y]Rj+1[Y].

Claim 1.

For every kj, we have that YXk.

To establish the claim, assume that YXk, for some kj. By the pairwise consistency of R1,,Rm, we have that Rk and Rj+1 are consistent 𝕂-relations, hence

Rk[XkXj+1]=Rj+1[XkXj+1].

Since YXkXj+1, we have that Rk[Y]=Rj+1[Y]. Proposition 4 and the minimality assumption about j imply that the 𝕂-relation Ej(W,R1,,Rj) is a global consistency witness for R1,,Rj. Since kj, we have that Ej(W,R1,,Rj)[Xk]=Rk. Furthermore, since YXk, we have that Ej(W,R1,,Rj)[Y]=Rk[Y], hence Ej(W,R1,,Rj)[Y]=Rj+1[Y]; this contradicts the earlier finding that Ej(W,R1,,Rj)[Y]Rj+1[Y], hence Claim 1 has been established.

So, we now know that for every kj, we have that YXk. Choose an index kj so that the cardinality |XkY| of the set XkY is the largest of the cardinalities |XiY| of the sets XiY, 1ij. Pick a node A1 such that A1YXk. Since YX1Xj, there is some ij such that A1Xi. Furthermore, since E=((((X1cX2)c)cXm1)cXm) is a connected sequential c-join expression over H, it is easy to see that {X1,,Xj} is a connected set of hyperedges of H. Let p be the length of the shortest path within {X1,,Xj} from Xk to a hyperedge containing A1. This means that there is a sequence S1,,Sp of sets with the following properties:

  1. 1.

    Each set Si is one of the hyperedges X1,,Xj.

  2. 2.

    S1=Xk; A1Sp; SiSi+1, 1ip.

  3. 3.

    p is the smallest number for which a sequence S1,,Sp with properties (1), (2) exists.

The minimality of p implies that S1,,Sp are distinct hyperedges of H. By the maximality of k, we have that |SpY||XkY|. Since A1SpY and A1XkY, there must exist a node A2(XkY)(SpY). Let n be the largest number such that A2Sn and 1n<p. This number n exists because S1=Xk. By property (4) of the sequence S1,Sp, there are nodes Bi, ni<j such that BiSiSi+1. Consider now the sequence

(Sp,A1,Xj+1,A2,Sn,Bn,Sn+1,Bn+1,,Bp1,Sp).
Claim 2.

(Sp,A1,Xj+1,A2,Sn,Bn,Sn+1,Bn+1,,Bp1,Sp) is a weak γ-cycle in H.

We have to verify that this sequence satisfies the conditions defining a weak γ-cycle, which were spelled out in the beginning of this section.

  1. 1.

    The hyperedges Sp,Xj+1,Sn,Sn+1,,Sp1 are distinct, since the hyperedges S1,,Sp are distinct and also are among the hyperedges X1,,Xj.

  2. 2.

    The nodes A1,A2,Bn,Bn+1,,Bp1 are distinct for the following reasons: first, A1A2 because A1XkY and A2XkY; second, A1 is different from Bn,Bn+1,,Bp1, since A1Si for ni<p; A2 is different from Bn,Bn+1,,Bp1 by the choice of n as the largest number such that A2Sn and the fact that BiSiSi+1; third, the Bi’s are distinct, else the path would have been shorter.

  3. 3.

    First, A1SpXj+1 by the choice of Sp and the fact that A1YXj+1; second, A2Xj+1Sn by the choice of A2; third, BiSiSi+1 by the choice of the Bi’s.

  4. 4.

    A1 is not in any of the hyperedges Sn,Sn+1,,Sp1 by the properties of the path S1,,Sp; finally, A2 is not in any of the hyperedges Sn+1,,Sp by the choice of A2.

This completes the proof of Claim 2, hence the hypergraph H is γ-cyclic.

The reader familiar with Fagin’s paper [8] will undoubtedly notice that the proof of Theorem 15 has a very similar structure to the proof of the result that if a hypergraph H is γ-acyclic, then every connected sequential join expression is monotone (see [8, pages 539-540]). The main difference is that here, instead of the standard join, we use an arbitrary consistency witness function and, thus, obtain a stronger result about annotated relations and arbitrary consistency witness functions. Furthermore, it is of the essence that the annotations come from a monoid 𝕂 that has the inner consistency property because, in the first part of the proof before Claim 1, we used in a crucial way that 𝕂 has the inner consistency property.

Corollary 16.

Let 𝕂 be a positive commutative monoid that has the inner consistency property. For every hypergraph H, the following statements are equivalent:

  1. 1.

    H is γ-acyclic.

  2. 2.

    Every connected sequential c-join expression over H is strongly monotone on 𝕂.

  3. 3.

    Every connected sequential c-join-expression over H is monotone on 𝕂.

Proof.

The implication (1)(2) follows from Theorem 15; the implication (2)(3) follows from the definitions; the implication (3)(1) follows from Theorem 14.

Finally, we characterize the inner consistency property in terms of γ-acyclicity.

Theorem 17.

Let 𝕂 be a positive commutative monoid. Then the following statements are equivalent:

  1. 1.

    𝕂 has the inner consistency property.

  2. 2.

    Every γ-acyclic hypergraph H has the property that every connected sequential c-join expression over H is strongly monotone on 𝕂.

  3. 3.

    Every γ-acyclic hypergraph H has the property that every connected sequential c-join-expression over H is monotone on 𝕂.

  4. 4.

    The 3-path hypergraph P3 has the property that every connected sequential c-join-expression over P3 is monotone on 𝕂.

Proof.

The implication (1)(2) follows from Theorem 15. The implication (2)(3) follows from the definitions. The implication (3)(4) holds because the 3-path hypergraph P3 is γ-acyclic. Towards (4)(1), let P3 be the 3-path hypergraph with hyperedges {A1,A2},{A2,A3},{A3,A4}. Assume that P3 has the property that every connected sequential c-join expression over P3 is monotone on 𝕂. Let E be the connected sequential c-join expression (({A1,A2}c{A2,A3})c{A3,A4}) over H and let W be a consistency witness function on 𝕂 such that P3 is monotone with respect to W and every three pairwise consistent 𝕂-relations R1(A1,A2),R2(A2,A3),R2(A3,A4). Then P3 has the local-to-global consistency property property for 𝕂-relations, because if R1(A1,A2),R2(A2,A3),R2(A3,A4) are three pairwise consistent 𝕂-relations, then, by Proposition 4, the 𝕂-relation E(W,R1,R2,R3) is a global consistency witness for the 𝕂-relations R1(A1,A2),R2(A2,A3),R2(A3,A4). Thus, by Theorem 9, the monoid 𝕂 has the inner consistency property.

7 Concluding Remarks

In this paper, we showed that the main desirable semantic properties of γ-acyclic hypergraphs and standard relations extend to desirable semantic properties of γ-acyclic hypergraphs and annotated relations, as long as the annotations come from a positive commutative monoid with the inner consistency property. It can also be shown that other desirable semantic properties of γ-acyclicity, such as join dependencies and lossless joins (see Fagin [8]), have suitable extensions to γ-acyclic hypergraphs and annotated relations; the notions of a consistency witness function and a c-join expression are used in these results.

Going back to acyclic hypergraphs, Beeri et al. [4] characterized acyclic hypergraphs in terms of semijoin programs and full reducers, which make it possible to evaluate queries efficiently in a distributed setting. It remains an open problem to determine whether or not there is an abstract notion of a semijoin program that can be used to extend these characterizations to acyclic schemas and annotated relations.

References

  • [1] Albert Atserias and Phokion G. Kolaitis. Structure and complexity of bag consistency. In Leonid Libkin, Reinhard Pichler, and Paolo Guagliardo, editors, PODS’21: Proceedings of the 40th ACM SIGMOD-SIGACT-SIGAI Symposium on Principles of Database Systems, Virtual Event, China, June 20-25, 2021, pages 247–259. ACM, 2021. doi:10.1145/3452021.3458329.
  • [2] Albert Atserias and Phokion G. Kolaitis. Consistency of relations over monoids. Journal of the ACM, 72(3, Article 18):47 pages, 2025. Earlier version in Proc. ACM Manag. Data, 2(2):107, 2024. doi:10.1145/3721855.
  • [3] Albert Atserias and Phokion G. Kolaitis. Consistency witnesses for annotated relations. SIGMOD Rec., 54(2):7–17, 2025. doi:10.1145/3749116.3749118.
  • [4] Catriel Beeri, Ronald Fagin, David Maier, and Mihalis Yannakakis. On the desirability of acyclic database schemes. J. ACM, 30(3):479–513, July 1983. doi:10.1145/2402.322389.
  • [5] Johann Brault-Baron. Hypergraph acyclicity revisited. ACM Comput. Surv., 49(3):54:1–54:26, 2016. doi:10.1145/2983573.
  • [6] Katrin M. Dannert, Erich Grädel, Matthias Naaf, and Val Tannen. Semiring provenance for fixed-point logic. In Christel Baier and Jean Goubault-Larrecq, editors, 29th EACSL Annual Conference on Computer Science Logic, CSL 2021, January 25-28, 2021, Ljubljana, Slovenia (Virtual Conference), volume 183 of LIPIcs, pages 17:1–17:22. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2021. doi:10.4230/LIPIcs.CSL.2021.17.
  • [7] Alessandro D’Atri and Marina Moscarini. On the recognition and design of acyclic databases. In Daniel J. Rosenkrantz and Ronald Fagin, editors, Proceedings of the Third ACM SIGACT-SIGMOD Symposium on Principles of Database Systems, April 2-4, 1984, Waterloo, Ontario, Canada, pages 1–8. ACM, 1984. doi:10.1145/588011.588013.
  • [8] Ronald Fagin. Degrees of acyclicity for hypergraphs and relational database schemes. J. ACM, 30(3):514–550, 1983. doi:10.1145/2402.322390.
  • [9] Erich Grädel and Val Tannen. Semiring provenance for first-order model checking. CoRR, abs/1712.01980, 2017. arXiv:1712.01980.
  • [10] Marc H. Graham. On the universal relation. Technical Report, Computer Systems Research Group, University of Toronto, 1980.
  • [11] Todd J. Green. Containment of conjunctive queries on annotated relations. Theory Comput. Syst., 49(2):429–459, 2011. doi:10.1007/s00224-011-9327-6.
  • [12] Todd J. Green, Gregory Karvounarakis, and Val Tannen. Provenance semirings. In Leonid Libkin, editor, Proceedings of the Twenty-Sixth ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems, June 11-13, 2007, Beijing, China, pages 31–40. ACM, 2007. doi:10.1145/1265530.1265535.
  • [13] Grigoris Karvounarakis and Todd J. Green. Semiring-annotated data: queries and provenance? SIGMOD Rec., 41(3):5–14, 2012. doi:10.1145/2380776.2380778.
  • [14] Mahmoud Abo Khamis, Hung Q. Ngo, Reinhard Pichler, Dan Suciu, and Yisu Remy Wang. Convergence of datalog over (pre-) semirings. J. ACM, 71(2):8:1–8:55, 2024. doi:10.1145/3643027.
  • [15] Egor V. Kostylev, Juan L. Reutter, and András Z. Salamon. Classification of annotation semirings over containment of conjunctive queries. ACM Trans. Database Syst., 39(1):1:1–1:39, 2014. doi:10.1145/2556524.
  • [16] Mihalis Yannakakis. Algorithms for acyclic database schemes. In Very Large Data Bases, 7th International Conference, September 9-11, 1981, Cannes, France, Proceedings, pages 82–94. IEEE Computer Society, 1981.
  • [17] Clement Tak Yu and Meral Z Ozsoyoglu. An algorithm for tree-query membership of a distributed query. In COMPSAC 79. Proceedings. Computer Software and The IEEE Computer Society’s Third International Applications Conference, 1979., pages 306–312. IEEE, 1979.