27
A logic of typed relations and its applications to relational databases Wendy MacCaull †* Department of Mathematics, Statistics and Computer Science, St.Francis Xavier University, PO Box 5000, Antigonish, NS, B2G 2W5, CANADA e-mail: [email protected] Ewa Orlowska ‡* National Institute of Telecommunications, Szachowa 1, 04-894, Warsaw, POLAND e-mail: [email protected] December 22, 2003 Abstract A calculus of typed relations subsuming the classical relational database theory is pre- sented. An associated sound and complete deduction mechanism is developed. The formulation is generalized to deal with nondeterministic databases and information re- lations in the rough set-style. keywords: relational logic, typed relations, relational database, nondeterministic databases, information relations, automated theorem proving, rough set theory 1 Introduction In this paper we develop a calculus of typed relations which is intended to incorporate Codd’s relational algebra. Typed relations are heterogeneous relations, that is, the objects standing in a relation may range over different domains. Typed relations have several other features which distinguish them from the ordinary, Tarski-style, relations. This issue will be discussed in Section 2. Our formulation of the calculus of relations allows us to deal with more general kinds of data structures than those found in classical databases by permitting us to make deductions with nondeterministic information. We present a deductive system in supported by the Natural Sciences and Engineering Research Council of Canada support from St. Francis Xavier University, as James Chair Visiting Professor, is gratefully acknowledged * This work was performed within the framework of the COST Action 271, entitled: ”Theory and Appli- cations of Relational Structures as Knowledge Instruments” (www.tarski.org). Both authors were supported by a NATO Science and Technology Collaborative Linkages Grant 1

pdfs.semanticscholar.orgpdfs.semanticscholar.org/a21d/a84ca3fffe2f309f3bd891b6e...A logic of typed relations and its applications to relational databases Wendy MacCaully⁄ Department

  • Upload
    others

  • View
    16

  • Download
    0

Embed Size (px)

Citation preview

Page 1: pdfs.semanticscholar.orgpdfs.semanticscholar.org/a21d/a84ca3fffe2f309f3bd891b6e...A logic of typed relations and its applications to relational databases Wendy MacCaully⁄ Department

A logic of typed relations and its applications to relational

databases

Wendy MacCaull†∗

Department of Mathematics, Statistics and Computer Science,St.Francis Xavier University,

PO Box 5000, Antigonish, NS, B2G 2W5, CANADAe-mail: [email protected]

Ewa OrÃlowska‡∗

National Institute of Telecommunications,Szachowa 1, 04-894,Warsaw, POLAND

e-mail: [email protected]

December 22, 2003

Abstract

A calculus of typed relations subsuming the classical relational database theory is pre-sented. An associated sound and complete deduction mechanism is developed. Theformulation is generalized to deal with nondeterministic databases and information re-lations in the rough set-style.

keywords: relational logic, typed relations, relational database, nondeterministic databases,information relations, automated theorem proving, rough set theory

1 Introduction

In this paper we develop a calculus of typed relations which is intended to incorporateCodd’s relational algebra. Typed relations are heterogeneous relations, that is, the objectsstanding in a relation may range over different domains. Typed relations have several otherfeatures which distinguish them from the ordinary, Tarski-style, relations. This issue willbe discussed in Section 2. Our formulation of the calculus of relations allows us to deal withmore general kinds of data structures than those found in classical databases by permittingus to make deductions with nondeterministic information. We present a deductive system in

†supported by the Natural Sciences and Engineering Research Council of Canada‡support from St. Francis Xavier University, as James Chair Visiting Professor, is gratefully acknowledged∗This work was performed within the framework of the COST Action 271, entitled: ”Theory and Appli-

cations of Relational Structures as Knowledge Instruments” (www.tarski.org). Both authors were supportedby a NATO Science and Technology Collaborative Linkages Grant

1

Page 2: pdfs.semanticscholar.orgpdfs.semanticscholar.org/a21d/a84ca3fffe2f309f3bd891b6e...A logic of typed relations and its applications to relational databases Wendy MacCaully⁄ Department

the Rasiowa-Sikorski style (Rasiowa and Sikorski (1963)) for the calculus of typed relationsand prove its completeness.

One of the important early results of database theory was Codd’s completeness the-orem (Codd (1970)) which showed that a form of logic called the relational calculus (seeUllman (1988) for a precise description of its formulas) and Codd’s (1970) relational datamodel with its associated operations, referred to in the database literature as relationalalgebra, were equal in expressive power. Therefore, any query expressible in the relationalcalculus is semantically equivalent to a query expressible in Codd’s relational algebra andvice versa. The language of Codd’s relational algebras is procedural: a query expressedusing Codd’s relational algebra explicitly specifies the required sequence of operations to beperformed over the appropriate data tables to answer the query. More theoretical (and non-procedural) investigations into Codd’s relational algebras and database dependencies camelater. Imielinski and Lipski (1984) showed that Codd’s relational algebra can be treatedas a disguised version of cylindric set algebra (see Henkin, Monk and Tarski (1971)); thisallowed them to use known facts about cylindric algebras to show that relational algebrais not finitely axiomatizable and to demonstrate that the equivalence problem for certainrelational expressions is not decidable. Yannakakis and Papadimitriou (1982) introducedalgebraic dependencies which generalize all previously known dependencies and gave a com-plete axiomatization of them in terms of simple algebraic rewrite rules. Cosmadakis (1987)proposed two classes of dependencies, first order dependencies and cylindric dependencieswhich were equivalent in expressive power, and introduced into the field of database the-ory some new techniques borrowed from model theory, proof theory and algebraic logic.Duntsch and Mikulas (2001) explored the precise connection between dependencies in rela-tional databases and variants of cylindric algebras and applied algebraic results to problemsof axiomatizing dependencies.

The question of finding a language that allows us to express queries of a more generalnature and, at the same time, readily implement, is still of interest. Recently, Fitting(2000) introduced a modal logic in which one can quantify over both objects and conceptsand developed a tableaux proof system for it. He applied this logic to relational databases,where records were treated as the possible worlds, record entries as objects and attributesas concepts. Fitting suggested that with the introduction of higher types, the logic couldbe extended to deal with multi-valued attributes and more complex things, though thoseaspects were not treated in the manuscript. In fact, the relational approach presented hereallows us to accomplish these objectives. An implementation of relational deduction alreadyexists (Lee et al.) suitable for many relational deduction systems, which could be altered todeal with the typed case. Alternatively, recent work on the connections between relationaldeduction systems and resolution theorem proving (MacCaull and OrÃlowska (2001), Schmidtet al. (2003)) suggests that this typed calculus may be transformed to allow automatedproofs using a resolution-style theorem prover.

This paper fits into the program of giving a general framework for deduction applicableto both classical and non-classical logics (OrÃlowska (1996), MacCaull and OrÃlowska (2002)).The work described here extends relational reasoning to a case involving typed relationsand relations of various arities and augments relational approaches to dependency theorywhich have already been found to be sound, complete and decidable for a variety of implica-tion problems in classical database theory (see OrÃlowska (1987), Buszkowski and OrÃlowska(1997), MacCaull (2000) and (2001) and Duntsch and Mikulas (2001)). Developments ininformation logics (OrÃlowska (1997) and Demri and OrÃlowska (2002)), useful in rough settheory (Pawlak (1991)), motivated the extension to databases with nondeterministic infor-

2

Page 3: pdfs.semanticscholar.orgpdfs.semanticscholar.org/a21d/a84ca3fffe2f309f3bd891b6e...A logic of typed relations and its applications to relational databases Wendy MacCaully⁄ Department

mation. Some of the results of this investigation first appeared in MacCaull and OrÃlowska(2003).

In Section 2, we establish the notation and conventions to allow us to view databasesas typed relations with implicit renaming. This section serves to motivate the language oftyped relations, as discussed in Section 3, along with the definitions of models and validity.In Sections 4 and 5, we present the deduction rules for the proof system and prove sound-ness and completeness. Extension to logics with specific classes of models are considered inSection 6. In Section 7, we discuss various applications including query checking and entail-ment; in this section we also discuss some heuristics important in automating the theoremproving and model checking. In the final section, we give some hints on how to define typedrelations with explicit renaming, show how to generalize the ideas of the previous sectionsso that we may deal with nondeterministic databases and information relations defined overthem, discuss the transitive closure and close with some directions for future work.

2 Typed relations with implicit renaming

In this section we propose a notion of typed relation and a calculus of typed relationswhich is intended to be a formal tool both for representing relational databases and alsofor reasoning with them. Three features of this calculus distinguish it from the calculus ofordinary relations in the Tarski-style.

• First, with each relation there is associated its type, which is a finite subset of aset whose members are interpreted as attributes. In this way we cope with the fact thatdatabase relations are determined by (finite) subsets of a set of attributes. Therefore, therelations of the calculus are relative in the sense suggested by OrÃlowska (1988); see alsoDemri and OrÃlowska (2002).

• Second, as with ordinary relations, each typed relation has an arity, which is thecardinality of its type. However, for any n ≥ 1, the order of the elements in the n-tuplesbelonging to a relation does not matter. This reflects the well-known property of databaserelations that the order of the attributes in the data table is immaterial. Tuples are treatedas mappings that assign to an attribute an element of its domain.

• Third, the calculus is comprised of relations of various arities and some operationsmay act on relations of not necessarily the same arity.

2.1 Typed relations over Ω

We first establish our notational conventions and terminology.

Let Ω be an infinite set whose elements are referred to as attributes. To each a ∈ Ωthere is associated a nonempty set Da called the domain of attribute a. Types (of relations),usually denoted by capital letters A,B,..., etc., are finite subsets of Ω, including the emptyset; clearly, if A and B are types, then A ∪B, A ∩B and A−B are types. A ]B denotesthe union of disjoint sets, A′ and B′, obtained from A and B, respectively, by renamingtheir elements, if necessary. Consequently, card(A) = card(A′), card(B) = card(B′), andA′ ∩ B′ = ∅. In particular, A ] A is the union of two disjoint sets each of which has thesame cardinality as A. This understanding of ] allows us to assume that ] is commutativeand associative and that A ] ∅ = A. It is a common practise in database systems torename attributes as needed. To enable renaming, we assume that for every attribute

3

Page 4: pdfs.semanticscholar.orgpdfs.semanticscholar.org/a21d/a84ca3fffe2f309f3bd891b6e...A logic of typed relations and its applications to relational databases Wendy MacCaully⁄ Department

a ∈ Ω, there are infinitely many attributes ai such that Dai = Da. When forming A ] B,if a′ ∈ A′ and b′ ∈ B′ correspond to a ∈ A, and b ∈ B, respectively, it is necessary thatDa′ = Da and Db′ = Db. The set of all types will be denoted by TΩ. Our definition ofthe disjoint union involves renaming implicitly; we do not need the explicit treatment oftypes as equivalence classes of an equivalence relation determined by renaming. We referto this notion of typed relations as typed relations with implicit renaming. In Section 8we will consider typed relations with explicit renaming, reflected by a family of relationaloperations. Let DA =

⋃Da : a ∈ A; then in particular, D∅ = ∅. A tuple of type A isa map u : A → DA such that for every a ∈ A, u(a) ∈ Da. The collection of all tuplesof type A is called the relation 1A; for each a ∈ Ω the collection of tuples of type ais denoted by 1a. Let 1∅ = e, where e is the empty tuple. For each a ∈ Ω, Da 6= ∅;therefore 1a 6= ∅. Consequently 1A 6= ∅ for all A ∈ TΩ. The above definitions imply that1A]B = t : ∃u ∈ 1A, ∃v ∈ 1B such that if a ∈ A then t(a) = u(a) and if b ∈ B thent(b) = v(b). Observe that we have defined ] so that 1A]B = 1B]A, 1A](B]C) = 1(A]B)]C

and 1A = 1B](A−B). We often denote tuples t ∈ 1A]B by uv, and say t = uv. Clearly, uvis a mapping, uv : A ] B → DA]B, where DA]B = DA ∪ DB. Thus uv = vu; similarly,(uv)w = u(vw). Our notation uv is analogous to the relational database notation for unionsof sets of attributes: uv is the union of two mappings (where a mapping is a set of pairs).Finally, for any A ∈ TΩ, and for any u ∈ 1A, ue = eu = u.

Definition 2.1 A relation R of type A is a subset of 1A.

2.2 Operations on typed relations

Using the above notation, we can now describe the basic operations on typed relations. LetA,B ∈ TΩ:

(i) Intersection (∩) Let R, S ⊆ 1A; thenR ∩A S = u ∈ 1A : u ∈ R and u ∈ S.

(ii) Projection (Π) Let B ⊆ A and let R ⊆ 1A; thenΠA

BR = u ∈ 1B : ∃v ∈ 1A−B such that uv ∈ R.(iii) Product (×) Let R ⊆ 1A and S ⊆ 1B; then

R×A]B S = uv ∈ 1A]B : u ∈ 1A, v ∈ 1B, u ∈ R and v ∈ S.(iv) Complement (−) Let R ⊆ 1A; then

−AR = (1A −R) = u ∈ 1A : u 6∈ R.

In our definition of product, the information u ∈ 1A, v ∈ 1B is redundant, but this style ofdefinition is useful in later proofs. We define the constant 0A = −A1A; clearly, 0A = ∅ forall A ∈ TΩ. The reader can easily define union, R ∪A S, and complement of S with respectto R, R −A S, in terms of the above operations; we use the notation R →A S to denote−AR ∪A S. Other operations are typically used in databases; we give their set theoreticdefinition and the relational algebra expression in terms of the above four basic operations,which can easily be shown to be equivalent (≡) to it:

Natural join (./) Let R ⊆ 1A and S ⊆ 1B; thenR ./A∪B S = uvw ∈ 1A∪B : u ∈ 1A−(A∩B), v ∈ 1A∩B, w ∈ 1B−(A∩B), uv ∈ R and vw ∈ S

≡ (R×A](B−(A∩B)) 1B−(A∩B)) ∩A](B−(A∩B)) (S ×B](A−(B∩A)) 1A−(B∩A)).Division (÷) Let B ⊆ A, let R ⊆ 1A and S ⊆ 1B, S 6= 0B; then

4

Page 5: pdfs.semanticscholar.orgpdfs.semanticscholar.org/a21d/a84ca3fffe2f309f3bd891b6e...A logic of typed relations and its applications to relational databases Wendy MacCaully⁄ Department

R÷AB S = t ∈ 1A−B : ∀s ∈ S, ts ∈ R

≡ ΠAA−BR−A−B (ΠA

A−B((ΠAA−BR×(A−B)]B S)−A R)).

We introduce a more general notion of selection operation, namely select S in R, whichis defined for any B ⊆ A, S ⊆ 1B and R ⊆ 1A; its application to such S and R yieldsthe tuples ut ∈ R such that u ∈ S. We give its set theoretic definition and an equivalentrelational algebra formulation in terms of the four basic operations:

Selection (σ) Let B ⊆ A, let R ⊆ 1A and let S ⊆ 1B; thenσA

B(S,R) = ut ∈ 1A : u ∈ 1B, t ∈ 1A−B, u ∈ S and ut ∈ R≡ (S ×B](A−B) 1A−B) ∩A R.

We now define a binary operation, ¯a,b, which will be useful in Section 7 to discussentailment. To improve readability, we will suppress the names of the types above the ×operation.

Definition 2.2 Let R,S ⊆ 1A and let a 6= b ∈ A; then R¯a,b S = (1A−a,b×ΠAa R)×ΠA

b S.

The diagonal-free cylindric set algebra of dimension n is the set algebra An = <A,∩,−, ∅, Xn, Ci >, where (A,∩,−, ∅, Xn) is a Boolean algebra of (not necessarily all)the subsets of Xn and for any R ⊆ Xn, Ci = y ∈ Xn : ∃y′ ∈ R ∀j 6= i(y(j) = y′(j)).Imielinski and Lipski (1984) showed that the relational algebra operations may be definedin terms of intersection, complement and cylindrification and conversely. The approach torelational databases via cylindrification has the advantage that all operations are total, sinceall relations are of the same type. The disadvantage of this approach is that all relations areforced to be of the same arity, and in real life databases, query checking is computationallymore efficient if we use relations with varying arities. Moreover, there is no completenesstheorem for the cylindrical version of relational database theory. For this reason we chooseto develop a typed calculus, with the four basic operations defined above. Other operationsdefinable in terms of (i)-(iv) include the update operations (see Nguyen (1991)) and otherjoins. As discussed in Section 8, explicit renaming may be effected by defining appropriateunary operations. A construction of the transitive closure operation, which is not definablein terms of the basic relational algebra operations, but is important in many database querylanguages (see Chandra and Harel (1980)) is given in that section.

We can easily see that with typed relations we can express all of the fundamental notionsof relational database theory: schema - a set of attributes, relation over a schema - a typedrelation, tuple and database - a set of typed relations. To allow the reader a direct verificationof the correctness of the typing for the relational terms, we often write explicitly the typesof both the operations and their argument relations, although some typing information maybe redundant.

2.3 Properties of operations on typed relations

From the set-theoretic definitions of the operations and constants, we can easily prove thatfor each A ∈ TΩ, the sixtuple, 21A

,∪A,∩A,−A, 1A, 0A is a Boolean algebra. The followingalso hold:

5

Page 6: pdfs.semanticscholar.orgpdfs.semanticscholar.org/a21d/a84ca3fffe2f309f3bd891b6e...A logic of typed relations and its applications to relational databases Wendy MacCaully⁄ Department

Lemma 2.1 (Properties of 0A and 1A.) For all A,B, C ∈ TΩ, R ⊆ 1A and S ⊆ 1A−C , ifC ⊆ A:

(i) R×A]B 0B = 0A]B = 0B ×B]A R;

(ii) 1A−C = ΠAA−C1A;

(iii) ΠA∅ R ⊆ 1∅; if R 6= 0A, ΠA

∅ R = 1∅;

(iv) 1∅ ×∅]A R = R;

(v) S = 1A−C iff S ×(A−C)]C 1C = 1A = 1C ×C](A−C) S.

Lemma 2.2 (Properties of ΠAB.) For all A,B ∈ TΩ, and for all R, S ⊆ 1A, if B ⊆ A, then:

(i) ΠAB(1A) = 1B; (i’) ΠA

B(0A) = 0B;

(ii) ΠAB(R ∪A S) = ΠA

BR ∪B ΠABS; (ii’) ΠA

B(R ∩A S) = ΠABR ∩B ΠA

BS;

(iii) −BΠABR ⊆ ΠA

B(−AR);

(iv) ΠAAR = R; (iv)’ ΠA

∅ R = 1∅.

Lemma 2.3 (Properties of σAB.) For all A,B ∈ TΩ and for all R ⊆ 1A, S, T ⊆ 1B, if

B ⊆ A:

(i) σAB(S∪B T,R) = σA

B(S, R)∪A σAB(T,R); (i’) σA

B(S, R∪A T ) = σAB(S, R)∪A σA

B(S, T );

(ii) σAB(S∩BT,R) = σA

B(S, R)∩AσAB(T, R); (ii’) σA

B(S, R∩AT ) = σAB(S,R)∩AσA

B(S, T );

(iii) σAB(−AS, R) = −BσA

B(S, R);

(iv) σAB(0B, R) = 0A; (iv’) σA

B(S, 0A) = 0A;

(v) σAB(1B, R) = R; in particular, σA

B(1B, 1A) = 1A;

(vi) σAA(S, R) = S ∩A R;

(vii) σAB(S, R) ⊆ R;

(viii) σAB(S, 1A) = S ×B](A−B) 1A−B.

Lemma 2.4 (Properties of ×.) For all A,B, C ∈ TΩ, for all R ∈ 1A, S ∈ 1B, T ∈ 1C :

(i) R×A]B S = S ×B]A R;

(ii) (R×A]B S)×(A]B)]C T = R×A](B]C) (S ×B]C T ).

6

Page 7: pdfs.semanticscholar.orgpdfs.semanticscholar.org/a21d/a84ca3fffe2f309f3bd891b6e...A logic of typed relations and its applications to relational databases Wendy MacCaully⁄ Department

Lemma 2.5 (Properties of ./.) For all A, B,C ∈ TΩ, for all R ∈ 1A, S ∈ 1B, T ∈ 1C :

(i) R ./ A∪A R = R;

(ii) R ./ A∪B S = S ./ B∪A R;

(iii) (R ./ A∪B S) ./ (A∪B)∪C T = R ./ A∪(B∪C) (S ./ B∪C T ).

Lemma 2.6 (Distributivity of × over ∪ and ∩.) For all A,B ∈ TΩ, for all R, S ∈ 1A,T ∈ 1B:

(i) (R ∪A S)×A]B T = (R×A]B T ) ∪A]B (S ×A]B T );

(ii) T ×B]A (R ∪A S) = (T ×B]A R) ∪B]A (T ×B]A S);

(iii) (R ∩A S)×A]B T = (R×A]B T ) ∩A]B (S ×A]B T );

(iv) T ×B]A (R ∩A S) = (T ×B]A R) ∩B]A (T ×B]A S).

Lemma 2.7 (Relationship between σ and Π.) For all A, B ∈ TΩ and for all R ⊆ 1A,S ⊆ 1B, if B ⊆ A, then:

(i) ΠABσA

B(S, 1A) = σBB (S, ΠA

B1A) = S; (ii) ΠABσA

B(S,R) = σBB(S, ΠA

BR) ⊆ S.

Lemma 2.8 (Relationship between Π and ×.) For all A,A1, A2, B, B1, B2 ∈ TΩ and for allR ⊆ 1A, S ⊆ 1B, Ri ⊆ 1Ai, if Bi ⊆ Ai:

(i) ΠA]BA (R×A]B S) = R whenever S 6= 0B; (i’) ΠA]B

B (R×A]B S) = S whenever R 6= 0A;

(ii) ΠA1]A2B1]B2

(R1 ×A1]A2 R2) = ΠA1B1

R1 ×B1]B2 ΠA2B2

R2.

Lemma 2.9 (Relationship between σ and ×.) For all A1, A2, B1, B2 ∈ TΩ, and for allRi ⊆ 1Ai , T ⊆ 1A2 , Si ⊆ 1Bi, if A1 ∩A2 = ∅ and Bi ⊆ Ai, then:

(i) σA1B1

(S1, R1)×A1]A2 T = σA1]A2B1

(S1, R1 ×A1]A2 T );

(ii) R1 ×A1]A2 σA2B2

(S2, T ) = σA1]A2B2

(S2, R1 ×A1]A2 T );

(iii) σA1]A2B1]B2

(S1 ×B1]B2 S2, R1 ×A1]A2 R2) = σA1B1

(S1, R1)×A1]A2 σA2B2

(S2, R2).

Lemma 2.10 (Relationship between ÷ and ×) For all A,B ∈ TΩ, for all R ∈ 1A, S ∈ 1B,S 6= 0B, if B ⊆ A, then:

(R÷AB S)×(A−B)]B S = R = S ×B](A−B) (R÷A

B S).

Lemma 2.11 (Properties of ¯a,b ) For all A ∈ TΩ, for all a, b ∈ A and for all R, S, P, Q ∈1A, if Q 6= ∅, then:

(i) 1A ¯a,b −A1A = 0A;

(ii) (1A ¯a,b −A1A)¯a,b 1A = 0A;

7

Page 8: pdfs.semanticscholar.orgpdfs.semanticscholar.org/a21d/a84ca3fffe2f309f3bd891b6e...A logic of typed relations and its applications to relational databases Wendy MacCaully⁄ Department

(iii) 1A ¯a,b 1A = 1A;

(iv) R¯a,b 0A = 0A = 0A ¯a,b R;

(v) R¯a,b (S ¯a,b P ) = (R¯a,b S)¯a,b P ;

(vi) R¯a,b (Q¯a,b P ) = (R¯a,b P ).

The properties above are straightforward (and somewhat tedious) to verify; we give theproof of Lemma 2.9(ii) and of Lemma 2.11(i) and (ii).

Proof of lemma 2.9(ii):u ∈ R1 × σA2

B2(S2, T )

iff (definition of ×)u = vw, vw ∈ 1A1]A2 , v ∈ 1A1 , w ∈ 1A2 , v ∈ R1 and w ∈ σA2

B2(S, T )

iff (definition of σ)u = v(xy), v(xy) ∈ 1A1]A2 , v ∈ 1A1 , xy ∈ 1A2 , v ∈ R1, xy ∈ 1A2 , x ∈ 1B2 , y ∈ 1A2−B2 , x ∈

S2 and xy ∈ Tiff (rearrange terms and use v(xy) = x(vy))

u = x(vy), x(vy) ∈ 1A1]A2 , x ∈ 1B2 , v ∈ 1A1 , y ∈ 1A2−B2 , x ∈ S2, v ∈ 1A1 , xy ∈ 1A2 , v ∈R1 and xy ∈ T

iff (definition of ])u = x(vy), x(vy) ∈ 1A1]A2 , x ∈ 1B2 , vy ∈ 1A1]((A2−B2), x ∈ S2, v ∈ 1A1 , xy ∈ 1A2 , v ∈ R1

and xy ∈ Tiff (definition of ×)

u = x(vy), x(vy) ∈ 1A1]A2 , x ∈ 1B2 , vy ∈ 1A1]((A2−B2), x ∈ S2, and x(vy) ∈ R1×A1]A2 Tiff (definition of σ)

u ∈ σA1]A2B2

(S2, R×A1]A2 T ).

Proof of Lemma 2.11 (i) and (ii):(i) 1A ¯a,b −A1A

= (definition)(1A−a,b ×ΠA

a 1A)×ΠAb (−A1A)

= (−A1A = 0A)(1A−a,b ×ΠA

a 1A)×ΠAb 0A

= (Lemma 2.2(i’))(1A−a,b ×ΠA

a 1A)× 0b

= (Lemma 2.1(i))0A.

(ii) (1A ¯a,b −A1A)¯a,b 1A

= (Lemma 2.11(i))0A ¯a,b 1A

= (definition)(1A−a,b ×ΠA

a 0A)×ΠAb 1A

= (Lemma 2.2(i’))(1A−a,b × 0a)×ΠA

b 1A

= (Lemma 2.1(i))0A−b ×ΠA

b 1A

8

Page 9: pdfs.semanticscholar.orgpdfs.semanticscholar.org/a21d/a84ca3fffe2f309f3bd891b6e...A logic of typed relations and its applications to relational databases Wendy MacCaully⁄ Department

= (Lemma 2.1(i))0A.

The proof of the next Lemma follows directly from Lemma 2.11(vi) and Lemma 2.11(iii).

Lemma 2.12 If R ⊆ 1A, and R 6= 1A, then (1A ¯a,b −AR)¯a,b 1A = 1A.

Definition 2.3 Let R, S ⊆ 1A and let a 6= b ∈ A; then R ⊃Aa,b S = ((1A ¯a,b −AR) ¯a,b

1A) ∪A S.

Lemma 2.13 Let R, S ⊆ 1A; then for all a 6= b ∈ A:(1) 1A ⊃A

a,b S = S;(2) If R 6= 1A, then R ⊃A

a,b S = 1A.

Proof:(1) 1A ⊃A

a,b S= (definition)

((1A ¯a,b −A1A)¯a,b 1A) ∪A S= (Lemma 2.11(ii))

0A ∪A S = S

(2) R ⊇Aa,b S= (definition)

((1A ¯a,b −AR)¯a,b 1A) ∪A S= (Lemma 2.12)

1A ∪A S = 1A.

The above lemma does not depend on the choice of a, b ∈ A; therefore the result ofapplying the operation ⊇A

a,b does not depend on the choice of a, b ∈ A. As a consequencewe may drop the indices and use R ⊃A S to denote R ⊇A

a,b S for arbitrary a 6= b ∈ A.

Theorem 2.1 Let A,B ⊂ Ω, let R ⊆ 1A, S ⊆ 1B and let C = A ∪ B. Then the followingare equivalent:

(1) R = 1A implies S = 1B;(2) R× 1C−A ⊃C S × 1C−B = 1C .

Proof:(1) => (2) We have 2 cases to consider: (i) R = 1A and (ii) R 6= 1A:

(i) R× 1C−A ⊃C S × 1C−B

= (by condition (1) and Lemma 2.1(v))1A](C−A) ⊃C 1B](C−B)

=1C ⊇ 1C

= (Lemma 2.13(1))1C

(ii) Since R 6= 1A, we may use Lemma 2.1(v) to conclude that R× 1C−A 6= 1A](C−A) =1C ; then using Lemma 2.13(2) we may conclude: R× 1C−A ⊃C S × 1C−B = 1C .

9

Page 10: pdfs.semanticscholar.orgpdfs.semanticscholar.org/a21d/a84ca3fffe2f309f3bd891b6e...A logic of typed relations and its applications to relational databases Wendy MacCaully⁄ Department

(2) => (1) Suppose R = 1A and 1C = R× 1C−A ⊃C S × 1C−B; then:1C

= (definition)((1C ¯a,b −C(R× 1C−A))¯a,b 1C) ∪C (S × 1C−B)

= (Lemma 2.1(v))((1C ¯a,b −C1A](C−A))¯a,b 1C) ∪C (S × 1C−B)

=((1C ¯a,b −C1C)¯a,b 1C) ∪C (S × 1C−B)

= (Lemma 2.11(ii))0C ∪C (S × 1C−B) = (S × 1C−B).

Using Lemma 2.1(v) again, we conclude that S = 1B.

The above theorem allows us to express entailment within the calculus of typed relations.

3 A language for a logic of typed relations and its semantics

Motivated by the above relations and operations on concrete typed relations, we now developa language (in fact a scheme of languages) of typed relations, whose intended models aredatabases. Let Ω be a set of attributes as defined in Section 2.1.

Let TΩ be a set of types for some set Ω of attributes. Then the expressions of a languageL of typed relations over Ω are built from the following pairwise disjoint sets of symbols:

e, where e is interpreted as the the empty tuple, which also, by a slight abuse ofnotation, will be denoted by e.

Oav , an infinite set of object variables of type a, for each a ∈ Ω;

Oac , a set of object constants of type a, for each a ∈ Ω;

OA, a set of mixed objects of type A, for each A ∈ TΩ, defined as follows: if A 6= ∅, thenu ∈ OA iff u is a mapping from A into

⋃Oav ∪Oa

c : a ∈ A such that for each a, u(a) ∈ Oav

or u(a) ∈ Oac . OA

v , the variables of type A, and OAc , the constants of type A, are subsets

of OA; u ∈ OAv iff u is a mapping from A into

⋃Oav : a ∈ A, and similarly for OA

c ; wepresume O∅c = e;

RAv , a set of relation variables of type A, for each A ∈ TΩ;

RAc , a set of relation constants of type A, for each A ∈ TΩ; 0A,1A ∈ RA

c ;OP, a set of operation symbols of varying arities such that: for every k-ary operation⊗ ∈ OP (k ≥ 1), there is associated a sequence τ(

⊗) = (A1, ..., Ak, A) of k + 1 elements of

TΩ; (Ai is the type of the i-th argument of⊗

, i = 1, ..., k, A is the type of the expressionobtained by performing the operation

⊗).

We presume: OP ⊇ ΠAB, ∩A, −A, ×A]C : A,B, C ∈ TΩ, B ⊆ A; where τ(ΠA

B) =(A,B); τ(∩A) = (A,A,A); τ(−A) = (A,A) and τ(×A]C) = (A,C, A ∪ C). It followsthat τ(÷A

B) = (A,B, A − B) and τ(σAB) = (B,A, A) and, for any D ∈ TΩ, τ(./A∪D) =

(A,D, A ∪D).

Assumptions concerning the elements of OA]B and O∅, analogous to the correspondingassumptions on the set of tuples, are assumed to hold. It follows from the definitions thatOA]B = OB]A and O(A]B)]C = OA](B]C). As with the notation defined for the tuples, if

10

Page 11: pdfs.semanticscholar.orgpdfs.semanticscholar.org/a21d/a84ca3fffe2f309f3bd891b6e...A logic of typed relations and its applications to relational databases Wendy MacCaully⁄ Department

u denotes a variable from OA]Bv , it may be replaced by an expression vw, where v ∈ OA

v

and w ∈ OBv . Oa denotes Oa

v ∪ Oac and RA denotes RA

v ∪ RAc . We assume that for all A,

OA 6= ∅, and O∅ = e.For each A ∈ TΩ, TA, the set of terms of type A, is the smallest set such that:(i) RA ⊆ TA;(ii) if

⊗ ∈ OP such that τ(⊗

) = (A1, ...Am, A) and Fi ∈ TAi , i = 1, ..., m, then⊗(F1, ..., Fm) ∈ TA.

Terms of the form (ii), above, are referred to as compound terms. A formula in the languageL of typed relations over Ω is an expression of the form F (u), where F ∈ TA and u ∈ OA,for any A ∈ TΩ. We denote the set of formulas by FΩ. The language L of typed relationsover Ω is a system of the form L = TΩ,FΩ.

A model for the language L of typed relations over Ω is a system M = A : A ∈TΩ, UA : A ∈ TΩ, e, m, where UA is a nonempty set of tuples of type A, U∅ = e andm is a meaning function subject to the following conditions:

(1) If u ∈ OAc , then m(u) ∈ UA and if u = vw, then m(u) = m(v)m(w); in addition,

m(e) = e.(2) If R ∈ RA, then m(R) ⊆ UA; in particular, m(0A) = ∅ and m(1A) = UA.(3) If

⊗ ∈ OP and τ(⊗

) = (A1, ..., Ak, A), then m(⊗

) is a k-ary operation acting onrelations of types A1, ..., Ak (with appropriate restrictions) returning a relation of type A:

m(⊗

) : 2UA1 × ...× 2UAk → 2UA.

Each of the operations defined in Section 2.2 receives their usual database theoretic meaning;we use the same symbol for an operation symbol and its corresponding operation. Themeaning function is extended homomorphically to the set of terms; i.e.:

(4) If F =⊗

(F1, ..., Fk), then m(F ) = m(⊗

)(m(F1), ..., m(Fk)).

It follows that m(F →A G) = −Am(F ) ∪A m(G).

It is easy to see that each database over Ω determines a model for the language of typedrelations.

A valuation in a model M = A : A ∈ TΩ, UA : A ∈ TΩ, e, m is a functionval:

⋃OA : A ∈ TΩ →⋃UA : A ∈ TΩ such that: if u ∈ OA

v , then val(u) ∈ UA; ifu ∈ OA

c , then val(u) = m(u); if u ∈ OA and v ∈ OB then val(vw) = val(v)val(w). Itfollows from the definition of tuple that val(uv) = val(vu), val((uv)w) = val(u(vw)) andval(ue) = val(eu) = val(u).

Let F ∈ TA and let u ∈ OA. We say that the valuation val in the model M satisfies theformula F (u), and write M, val |= F (u), iff val(u) ∈ m(F ). We say that the formula F (u)is true in the model M iff it is satisfied by every valuation in M . Therefore if u ∈ OA

v thenF (u) is true in the model M iff m(F ) = UA. Let C be a class of models. We say that theformula F (u) is C-valid, and write |=C F (u) iff it is true in all models M ∈ C. We say thatF (u) is valid if it is valid in the class of all models as defined above and we write |= F (u).We conclude that if u ∈ OA

v , then (F →A G)(u) is valid iff for all models defined above,m(F ) ⊆ m(G).

By a logic of typed relations we mean a system L = (L, C), where L is a language oftyped relations and C is a class of models for L.

11

Page 12: pdfs.semanticscholar.orgpdfs.semanticscholar.org/a21d/a84ca3fffe2f309f3bd891b6e...A logic of typed relations and its applications to relational databases Wendy MacCaully⁄ Department

4 Deduction system for a logic of typed relations

A relational proof system for any relational logic consists of some finite sequences of formu-las, called axiomatic sequences, and some rules of the form:

HJ1 | J2 ... | Jn

(for 1 ≤ n < ω)

where H,J1, ..., Jn are finite sequences of formulas. A sequence of formulas, H = α1, α2, ..., αk,is C-valid iff for every model M ∈ C, every valuation in the model M satisfies one of theformulas αi. A rule of the above form is admissible for the class C of models in the casethat H is C-valid if and only if each of Ji, i = 1, ..., n is C-valid. Thus rules preserve andreflect validity of sequences. The axiomatic sequences take the place of axioms: an ax-iomatic sequence is admissible for a class C of models iff it is C-valid. If C is the class ofall the models satisfying (1)− (4) of the previous section, then we simply say that a rule isadmissible. From the definition of validity we may observe that any sequence containing asa subsequence all the formulas of an axiomatic sequence admissible for the class C (in anyorder) is C-valid.

There are two kinds of rules - decomposition rules, which enable us to decompose aformula into simpler formulas and specific rules, which enable us to modify a sequenceof formulas. The intended interpretation of an operation symbol of a language of typedrelations determines two decomposition rules; constraints on the intended interpretationof object constants or relation variables or constants determine specific rules. A generalstrategy for developing relational deduction systems can be found in MacCaull and OrÃlowska(2002).

If F (u) is the formula whose validity is in question, we generate a tree by placing F (u)at the root and applying deduction rules to formulas, each of which yields a sequence offormulas or branches to yield several sequences of formulas, until all branches close or thereis an open (i.e., non-closed) branch that is complete. Closure of a branch means we havereached an axiomatic sequence on the branch. Completeness of a branch, roughly speaking,means that all the rules that can be applied have been applied. If all the branches close,the formula F (u) is declared to be provable. A soundness theorem then guarantees thatthe formula is valid. If there exists a branch which is complete and open, a completenesstheorem guarantees the existence of a countermodel for F (u).

We wish to remind the reader more familiar with other styles of proofs that though wespeak of proofs, this process is, in fact, a validity-checker rather than a proof generator. Forthose more accustomed to refutation style proofs, such as in resolution, we stress that thisis not a refutation calculus: instead, we work in a direct manner. If we wish to prove thata formula is valid, then we begin with this formula; the rules are then designed to preserveand reflect validity. A prototype implementation for a deduction system for the classicalrelational calculus may be found in Lee et al. (2002).

We present the deduction system, D, for a language of typed relations whose semanticsis determined by the class of all models satisfying (1)− (4) of Section 3. Below, K and Hrepresent (possibly empty) sequences of formulas.

Decomposition Rules for D

Let F, G ∈ TA, let B ⊆ A and let u ∈ OA, w ∈ OB; then:

12

Page 13: pdfs.semanticscholar.orgpdfs.semanticscholar.org/a21d/a84ca3fffe2f309f3bd891b6e...A logic of typed relations and its applications to relational databases Wendy MacCaully⁄ Department

(∩) K, (F∩AG)(u), H

K, F (u), H | K, G(u), H(−∩) K, −A(F∩AG)(u), H

K, −AF (u), −AG(u), H

(Π)K, (ΠA

BF )(w), H

K, F (wt), H, (ΠABF )(w)

(−Π)K, −B(ΠA

BF )(w), H

K, −AF (wt), H

any t ∈ OA−B new t ∈ OA−Bv

(−−) K, −A(−AF )(u), H

K, F (u), H

Let F ∈ TA, G ∈ TB, v ∈ OA, w ∈ OB and z ∈ OA−B; then:

(×) K, (F×A]BG)(vw), H

K, F (v), H | K, G(w), H(−×) K, −A]B(F×A]BG)(vw), H

K, −AF (v), −BG(w), H

Specific Rules for D

Let F ∈ TA, u ∈ OA, A = A1 ] ... ]An, n ≥ 1 then :

(π) K, F (u1...un), H

K, F (uπ(1)...uπ(n)), H(e) K, F (u1...ui−1(eui)...un), H

K, F (u1...ui−1ui...un), H

n ≥ 1, 1 ≤ i ≤ n

where uj ∈ OAj , j = i, ..., n, π, a permutation on 1, ..., n and e ∈ O∅; and

(]) K, F (u1u2...un), H

K, F (u1...ui−1v1v2ui+1...un), H, F (u1...un)

where uj ∈ OAj , j = 1, ..., n, and for some i, 1 ≤ i ≤ n, ui ∈ OAiv , Ai = B1 ] B2 and any

v1 ∈ OB1v , any v2 ∈ OB2

v .

The rule (π) reflects the fact that objects can be permuted without changing the meaningof a formula, the rule (e) reflects the fact that the interpretation of e is the empty tupleand the rule (]) reflects the fact that any variable can be split into components in such away that its type is preserved. The language includes variables of the empty type so thatthe rule ] holds for all types. However, the rule ] does not permit us to split constants;this will be discussed in Section 6.

Axiomatic Sequences for D

(1) R(u), (−AR)(u) for any R ∈ RA and any u ∈ OA;(2) 1A(u) for any u ∈ OA (in particular, if A = ∅);(3) −A0A(u) for any u ∈ OA;(4) (ΠA

∅ F )(e) for any F ∈ TA, F 6= 0A, e ∈ O∅.

In the rules which involve any v ∈ OA, we usually choose an element which already appearson a branch to whose node we apply the rule. By new v ∈ OA we mean an elementnot already appearing on the branch to whose node we apply the rule. For many of thedecomposition rules (eg., (∩A)) the formula being decomposed does not appear below theline. This signifies that the formula which was being decomposed has become inactive. Weapply the rule one time only for that formula. For other decomposition rules (eg., (ΠA

B)) theformula being decomposed appears below the line. This signifies that this formula remainsactive.

13

Page 14: pdfs.semanticscholar.orgpdfs.semanticscholar.org/a21d/a84ca3fffe2f309f3bd891b6e...A logic of typed relations and its applications to relational databases Wendy MacCaully⁄ Department

We say that the L-formula F (u) is D-provable, and write `D F (u), iff it is provableusing rules and axiomatic sequences from the system D.

Rules for the defined operations may be given explicitly using their set theoretic formula-tion; we present some examples below. The deduction system with these explicit deductionrules is equivalent to that in which those operations are defined in terms of the operations(i)-(iv).

(∪) K, (F∪AG)(u), H

K, F (u), G(u), H(−∪) K, −A(F∪AG)(u), H

K, −AF (u), H | K, −AG(u), H

Let F ∈ TA, G ∈ TB, ∅ 6= B ⊆ A, v ∈ OA, w ∈ OB and t ∈ OA−B; then:

(σ)K, (σA

B(G,F ))(wt), H

K, G(w), H | K, F (wt), H(−σ)

K, −A(σAB(G,F ))(wt), H

K, −BG(w), −AF (wt), H

(÷)K, (F÷A

BG)(t), H

K −BG(w), F (tw), H

new w ∈ OBv

(−÷)K, ,−A−B(F÷A

BG)(t), H

K, G(w), H, −A−B(F÷ABG)(t) | K, ,−AF (tw), H, −A−B(F÷A

BG)(t)

any w ∈ OB

Let F ∈ TA, G ∈ TB, u ∈ OA−(A∩B), v ∈ OA∩B and w ∈ OB−(A∩B); then:

(./) K, (F./A∪BG)(uvw), H

K, F (uv), H | K, G(vw), H

(−./) K, −A∪B(F./A∪BG)(uvw), H

K, −AF (uv), −BG(vw), H

Proposition 4.1 (i) The rules of D are admissible; that is, for each rule, the sequenceabove the line is valid if and only if the sequences below the line are valid.

(ii) The axiomatic sequences of D are valid.

Proof. (i) The admissibility of the decomposition rules for the operation symbols followsfrom the interpretation of the operation symbols (see MacCaull and OrÃlowska (2002)). Theadmissibility of the specific rule (π) follows from the fact that for any tuples u, v and w,uv = vu and u(vw) = (uv)w. The admissibility of the specific rule (e) follows from the factthat eu = ue = u, for any tuple u. The admissibility of the specific rule (]) follows fromthe definition and properties of OA]B.

(ii) The axiomatic sequences encode the facts that for each R ∈ RA, R and −ARrepresent complementary relations, that 1A represents the universal relation of type A,that 0A represents the empty relation of type A and that ΠA

∅ F = 1∅.

We note here that in the above presentation, we have made some simplifications from thegeneral presentation for decomposition rules discussed in MacCaull and Orlowska (2002);in particular for any A ⊆ Ω any u ∈ OA, we have deleted any branch with a sequence offormulas containing 1A(u), because this branch is automatically closed, and we have deleted−A1A(u) from any sequence containing this formula, as the former sequence is valid iff thelatter one is valid.

14

Page 15: pdfs.semanticscholar.orgpdfs.semanticscholar.org/a21d/a84ca3fffe2f309f3bd891b6e...A logic of typed relations and its applications to relational databases Wendy MacCaully⁄ Department

Theorem 4.1 (1) Each of the Boolean algebra identities is D-provable.(2) Each of the expressions in Lemmas 2.1-2.10 is D-provable.

In Section 7 we give proofs of a sampling of expressions whose D-provability is assertedin the above theorem.

5 Soundness and Completeness

Theorem 5.1 (Soundness) Let F (u) be an L-formula; if `D F (u) then |= F (u).

Proof. By definition, `D F (u) iff each branch on the proof tree for F (u) has anaxiomatic, therefore valid, sequence. Proposition 4.1 tells us that the deduction rules areadmissible and therefore reflect validity. Soundness follows immediately.

Suppose F, G ∈ TA; if `D (F →A G)(u) (respectively, `D ((F →A G)∩A(F →A G))(u)),then we know from Theorem 5.1 that |= (F →A G)(u) (respectively, |= ((F →A G) ∩A

(G →A F ))(u)); we may conclude that m(F ) ⊆ m(G) (respectively, m(F ) = m(G)) in allof the models.

By a complete open branch we mean a branch such that:• If the formula (F ∩A G)(u) (respectively, −A(F ∩A G)(u)) is on the branch, then either

F (u) or G(u) is (respectively, both −AF (u) and −AG(u) are) on the branch.• If the formula (ΠA

BF )(u) (respectively, (−BΠABF )(u)) is on the branch, then for any

t ∈ OA−B, F (ut) (respectively, then for some t ∈ OA−B, −AF (ut)) is on the branch.• If the formula −A(−AF )(u) is on the branch, then F (u) is on the branch.• If the formula (F ×A]B G)(vw) (respectively, −A]B(F ×A]B G)(vw)) is on the branch,

where v ∈ OA and w ∈ OB, then either F (v) or G(w) is (respectively, both −AF (v) and−BG(w) are) on the branch.

• If the formula F (u1...un) is on the branch, then F (uπ(1)...uπ(n)) is on the branch, forany permutation π on n-indices.

• If the formula F (u1...ui−1(eui)...un) is on the branch where n ≥ 1, 1 ≤ i ≤ n ande ∈ O∅, then F (u1...ui−1ui...un) is on the branch.

• If the formula F (u1...un) is on the branch where ui ∈ OAiv , some i, 1 ≤ i ≤ n, and if

Ai = B1 ]B2, v1 ∈OB1v and v2 ∈ OB2

v , then F (u1...ui−1v1v2ui+1...un) is on the branch.

We leave to the reader the task of formulating the additional clauses to be added to thedefinition of complete open branch if deduction rules are used which are given explicitlyfor the operations (∪,÷, etc.). A general principle for those completion conditions may befound in MacCaull and OrÃlowska (2002).

A branch structure, bM = A : A ∈ TΩ, UA : A ∈ TΩ, be, bm, corresponding to acomplete open branch b of a proof tree is defined as follows, where for each term F , bF isshorthand for bm(F ):

for any A 6= ∅ ∈ TΩ, the universe, UA, is OA; U∅ = e and be = e;

15

Page 16: pdfs.semanticscholar.orgpdfs.semanticscholar.org/a21d/a84ca3fffe2f309f3bd891b6e...A logic of typed relations and its applications to relational databases Wendy MacCaully⁄ Department

for each R ∈ RA, bR = u ∈ OA : R(u) is not a formula on b; it follows that b1A = OA.

Compound terms are interpreted inductively, as outlined in the definition of model in Section3; that is:

b(F ∩A G) = bF∩A bG; b(−AF ) = OA − bF ;b(F ×A]B G) = bF×A]B bG; b(ΠA

BF ) = ΠAB

bF .

where the operation on the right hand side of each equation is as defined in Section 2; forexample:

ΠAB

bF = u ∈ b1B : ∃v ∈ b1A−B such that uv ∈ bF.

Proposition 5.1 Let b be a complete open branch of a proof tree. Then bM is a model forthe language of typed relations over Ω ; we refer to it as a branch model.

Proof. The proof follows immediately from the definitions of model, branch structure,and tuple.

Two definitions are required before we state the next proposition.

Definition 5.1 The degree of a relational formula F (u), d(F (u)), is defined inductively asfollows:

d(R(u)) = 1 if R ∈ RA.

If F,G ∈ TA:

d(−A(F (u))) = d(F (u)) + 1, whenever F is a compound term and u ∈ OA;d(ΠA

BF (u)) = d(F (ut)) + 1, whenever B ⊆ A, u ∈ OB, and t ∈ OA−B;d((F ∩A G)(u)) = max(d(F (u)), d(G(u))) + 1, whenever u ∈ OA;d((F ×A]B G)(vw)) = max(d(F (v)), d(G(w))) + 1 whenever v ∈ OA, w ∈ OB.

Definition 5.2 A formula F (u) is called decomposable if one of the decomposition rulesapplies to it directly or to the result after the application of a finite number of any combi-nation of the specific rules (π), (e) and (]). Otherwise, it is called indecomposable. Theindecomposable formulas, therefore, are R(u) and −AR(u), A ∈ TΩ, R ∈ RA, u ∈ OA.

Proposition 5.2 Let F (u) be a decomposable L-formula on a complete open branch b of aproof tree, let val be the identity valuation in bM and suppose bM,val |= F (u). Then thereis a formula F ′(u′) on b such that the degree of F ′(u′) is less than the degree of F (u) andbM, val |= F ′(u′).

Proof. The proof is by cases (one for each of the decomposition rules). We present theproof of several cases – the reader will see that the proof of each case rests on the fact thatthe branch is complete.

• Suppose (F1 ∩A F2)(u) is on b and bM, val |= (F1 ∩A F2)(u). Then by definition of |=,u ∈ b(F1∩A F2); so u ∈b F1∩A bF2, whence u ∈ bF1 and u ∈ bF2. Thus bM,val |= Fi(u) andthe degree of Fi(u) is less than the degree of F1∩A F2(u) (i = 1 and 2); by the completenessof b, either F1(u) or F2(u) is on b.

16

Page 17: pdfs.semanticscholar.orgpdfs.semanticscholar.org/a21d/a84ca3fffe2f309f3bd891b6e...A logic of typed relations and its applications to relational databases Wendy MacCaully⁄ Department

• Suppose (F1 ×A]B F2)(u) is on b where u ∈ OA]B and bM, val |= (F1 ×A]B F2)(u).Therefore u ∈ b(F1 ×A]B F2). Since b(F1 ×A]B F2) = bF1×A]B bF2, there is v ∈ OA andw ∈ OB such that v ∈ bF1 and w ∈ bF2. So there is v ∈ OA and w ∈ OB such thatbM, val |= F1(v) and bM, val |= F2(w). By the completeness of b, F1(v) is on b or F2(w)is on b. The fact that each of the degrees of F1(v) and F2(w) is less than the degree of(F1 ×A]B F2)(u) completes the proof.

• Suppose (ΠABF )(u) is on b and bM,val |= (ΠA

BF )(u). So u ∈ b(ΠABF ) and consequently,

u ∈ ΠAB

bF . Thus there is v ∈ b1A−B such that uv ∈ bF ; consequently, bM,val |= F (uv).By rule (ΠA

B) and the completeness of b, for any t ∈ OA−B, F (ut) is on b where the degreeof F (ut) is less than the degree of (ΠA

BF )(u). In particular, F (uv) is on b and the degree ofF (uv) is less than the degree of (ΠA

BF )(u).

• Suppose (−BΠABF )(u) is on b and bM,val |= (−BΠA

BF )(u). So u ∈ b(−BΠABF ) and

consequently, u ∈ OB − ΠAB

bF . So for all t ∈ OA−B, ut 6∈ bF . Thus for all t ∈ OA−B,ut ∈ −A bF , and consequently, ut ∈ b(−AF ). So for all t ∈ OA−B, bM,val |= (−AF )(ut).By the completeness of b, there is t ∈ OA−B

v such that (−AF )(ut) is on b, and by definition,the degree of (−AF )(ut) is less than the degree of (−BΠA

BF )(u).

We are now ready to prove the completeness theorem:

Theorem 5.2 (Completeness) Let F (u) be an L-formula; if |= F (u) then `D F (u).

Proof. Assume that F (u) is valid and suppose that F (u) is not D-provable. Let b be acomplete open branch of a proof tree generated by F (u). By Proposition 5.2, we know thatb determines a model bM . We shall now show that F (u) is not true in bM . This contradictsthe assumption that F (u) is valid and allows us to conclude that if |= F (u), then F (u) isD-provable. The demonstration that F (u) is not true in bM proceeds by contradiction.

Assume that F (u) is true in bM ; therefore for all valuations v in bM , bM ,v |= F (u).Let val be the identity valuation and consider the set of indecomposable formulas on b. Wecan show that bM, val does not satisfy any of the indecomposable formulas on b. If R(u) ison b, where R ∈ RA, u ∈ OA, then by definition of the branch model u 6∈ bR; so bM,val 6|=bR(u); if −AR(u) is on b then, since the branch is open, R(u) is not on b; therefore u ∈bR and thus u 6∈ b(−AR); consequently, bM, val 6|= b −A R(u). Therefore F (u) must bedecomposable.

Consider the set Z of formulas on b which are satisfied by val. The assumed truth of F (u)assures us that Z is nonempty. The existence on any open branch of a formula of minimaldegree is guaranteed by well-ordering of the natural numbers. Let F ′(u′) be a formula ofminimal degree in Z. Proposition 5.3 tells us that if a formula in Z is decomposable it isnot of minimal degree in Z. So we must conclude that F ′(u′) is indecomposable. But valdoes not satisfy indecomposable formulas. This gives a contradiction, so we conclude thatF (u) is not true in bM .

6 Logics with specific classes of models

We now consider rules corresponding to classes of models satisfying some additional rela-tional constraints. Suppose we have a relational theory with constant R such that in each

17

Page 18: pdfs.semanticscholar.orgpdfs.semanticscholar.org/a21d/a84ca3fffe2f309f3bd891b6e...A logic of typed relations and its applications to relational databases Wendy MacCaully⁄ Department

model, R is interpreted as a nonempty relation; we add the following specific rule to thedeductive system:

(∈ R) KK,−AR(t)

new t ∈ OAv

Suppose we have a theory with constants S1, S2 and S3, of type A, such that in each modelS1 ⊆ S2, respectively, S1 ∩ S2 ⊆ S3, holds; then we add the specific rule (S), respectively(T), to the deductive system, where u ∈ OA

v :

(S) K, S2(u), H

K, S1(u), H, S2(u)

(T) K, S3(u), H

K, S1(u), H, S3(u) | K, S2(u), H, S3(u).

Proposition 6.1 (i) If m(R) is non-empty for all models in a class C then (∈ R) is ad-missible for C;

(ii) m(S1) ⊆ m(S2) holds for all models in a class C iff (S) is admissible for C;(iii) m(S1) ∩m(S2) ⊆ m(S3) holds for models in a class C iff (T) is admissible for C.

Proof:(i) Suppose m(R) 6= ∅, let K = α1, ..., αm and let x = x1, ..., xn : xi is a free variable

appearing in a formula in K. By ∀x we mean ∀x1∀x2...∀xn. Then:K is valid iff ∀x(

∨i αi) is valid.

K, −R(t), t new, is valid iff ∀t∀x(∨

i αi ∨ −R(t)) is valid where t 6∈ x.

Clearly if ∀x(∨

i αi) is valid then ∀t∀x(∨

i αi∨−R(t)) is valid. Suppose ∀t∀x(∨

i αi∨−R(t)) isvalid. But ∀t∀x(

∨i αi∨−R(t)) is valid iff ∀x(

∨i αi)∨∀t(−R(t)) is valid, since t 6∈ x. Suppose

in some model ∀x(∨

i αi) is not true; then ∀t(−AR(t)) is true. Then for all valuations vand for all t ∈ OA, v(t) 6∈ m(R). But this is false since m(R) 6= ∅. We conclude that for allmodels ∀x(

∨i αi) is true. Thus if ∀t∀x(

∨i αi ∨−R(t)) is valid then ∀x(

∨i αi) is valid. This

completes the proof of the admissibility of the rule (∈ R).The constraint ∃tR(t) and its corresponding rule (∈ R) is a trivial modification of

the constraint (c3), ∀x∃zB(x, z), x nonempty, and its corresponding rule (rc3) found inMacCaull and OrÃlowska (2002). Proofs of (ii) and (iii) follow from the principles foundthere.

A scheme of soundness and completeness theorems follows for each class C satisfying anycollection of the relational constraints described in Proposition 6.1. To each such C thereis a corresponding DC . The soundness theorems follow from Proposition 6.1. In order toprove completeness we must add the following to the description of a complete open branch:

• If R ∈ RAc and for all models in C, m(R) 6= ∅ then for some t ∈ OA

v , the formula−AR(t) is on the branch.

• Suppose S1, S2 ∈ RAc and for all models in C, m(S1) ⊆ m(S2). If S2(u) is on the

branch, then S1(u) is also on the branch.• Suppose S1, S2, S3 ∈ RA

c and for all models in C, m(S1) ∩m(S2) ⊆ m(S3). If S3(u) ison the branch then either S1(u) or S2(u) is on the branch.

18

Page 19: pdfs.semanticscholar.orgpdfs.semanticscholar.org/a21d/a84ca3fffe2f309f3bd891b6e...A logic of typed relations and its applications to relational databases Wendy MacCaully⁄ Department

In addition we must modify the proof of Proposition 5.1 to show that the branch struc-ture is in the appropriate class of models. We give one demonstration: suppose, that in themodels of C, m(S1) ⊆ m(S2). Assume u ∈ bS1; then S1(u) is not a formula on b. SupposeS2(u) is on b; then by the rule (S), S1(u) is on b. This gives a contradiction. So S2(u) isnot on b; thus u ∈ bS2 and we conclude that bS1 ⊆ bS2.

Completeness now follows exactly as in the proof of Theorem 5.2. If explicit formsof deduction rules for the operations definable in terms of the four basic operations areused (such as for ∪A, σA

B and ./A∪B and ÷AB), the definition of degree of formula and the

definition of complete open branch must be appropriately extended. We leave it to thereader to make these straightforward extensions. Many other relational constraints andtheir corresponding rules are found in MacCaull and OrÃlowska (2002), including Horn-styleconditions, that is, conditions of the form (S1∩ ...∩Sn) ⊆ S. In order to show completenessfor logics with specific classes of models where (S) or (T) hold for relations that are builtfrom constant relations, the rule:

(cut) KK, G(u) | K, (−AG)(u)

must be added for certain formulas G(u). As we discuss below, we may use our deductionsystem to answer queries about a specific database. In this situation, if c ∈ R for somerelation, R, in the database, we add the axiomatic sequence R(c) to the deduction system.If for some constants c, c1, c2 in the database, c = c1c2, then we add the following specificrules to the deductive system:

(c1)K, F (u1...(c1c2)...un), H

K, F (u1...c...un), H(c2)

K, F (u1...c...un), H

K, F (u1...(c1c2)...un), H.

7 Applications and examples

I. The usual Boolean algebra identities and expressions in Lemmas 2.1-2.10 are D-provable;at the end of this section we detail some examples.

II. Query Checking. For particular databases we define deduction systems with axiomaticsequences of the form S(c) where c is an individual constant of the appropriate type indi-cating that tuple c ∈ S, and, possibly, with specific rules corresponding to constraints onparticular relation constants. To determine what tuples are in a relation R in a particulardatabase, we proceed as follows: develop a proof tree for R(u); suppose all branches closeexcept in the following case: u = v1...vn where vi ∈ OAi

v , and for each i = 1, ..., n, S(vi)appears on an open branch; if for all i = 1, ..., n, S(ci) is an axiomatic sequence, whereci ∈ OAi

c , then the tuple c1...cn ∈ R. For example, if S(c), T (d1), T (d2) are axiomatic se-quences for constants c, d1, d2, and if R is the relation S×T , then we can use this procedureto conclude that tuples cd1 and cd2 ∈ R.

III. Model Checking. Let R be a typed relation; the constant tuple c ∈ R if there is a closedproof tree for R(c).

IV. Selections. In classical database theory, the selections are accomplished vis a vis thenotion of comparison formula; from simple comparison formulas such as x = 7 or x ≤ y,compound comparison formulas are built using the connectives of propositional logic. Foreach comparison formula there is an associated selection operation. Here we opt for a more

19

Page 20: pdfs.semanticscholar.orgpdfs.semanticscholar.org/a21d/a84ca3fffe2f309f3bd891b6e...A logic of typed relations and its applications to relational databases Wendy MacCaully⁄ Department

unified presentation via relations and operations on them. This more general selectioncaptures all the selections encountered in database theory. Moreover, by adding specificrules, we can make selections with respect to relations S with various properties. Sincesoundness holds, the proof of a formula demonstrates truth in a class of models whichincludes models where the interpretation of S has the desired properties.

V. Entailment. The following theorem and its corollary follow quickly from the definitionsof truth and validity, using Theorems 2.1, 5.1 and 5.2. We suppress the names of the typesassociated to the × operation.

Theorem 7.1 Let F ∈ TA and let G ∈ TB; if C = A ∪ B, u ∈ OAv , v ∈ OB

v and w ∈ OCv ,

then the following are equivalent:

(1) for every model M , if F (u) is true in M then G(v) is true in M ;(2) (F × 1C−A) ⊃C (G× 1C−B))(w) is D-provable.

Corollary 7.1 Let Fi ∈ TAi, i=1,...,n, and let G ∈ TB; if C = A1 ∪ ...∪An ∪B, ui ∈ OAiv ,

v ∈ OBv and w ∈ OC

v , then the following are equivalent:

(1) for every model M , if Fi(ui), i = 1, ..., n are true in M then G(v) is true in M ;(2) ((

⋂Fi × 1C−Ai : i = 1, ..., n) ⊃C (G× 1C−B))(w) is D-provable.

We conclude this section with some examples showing D-provability of selected expres-sions from Section 2; in 1-4 that follow, it is assumed that u is a variable of the appropriatetype.

1. Let us prove that if R is a relation of type A and B ⊆ A, then R ⊆ (ΠABR)×B](A−B)

1A−B; it suffices to demonstrate that `D (R →A (ΠABR)×B](A−B) 1A−B)(u).

(R→A((ΠABR)×B](A−B)1A−B)(u)

(−AR)(u), (ΠAB

R)×B](A−B)1A−B(u)

(−AR)(vw), (ΠAB

R)×B](A−B)1A−B(vw)

(−AR)(vw), (ΠAB

R)(v)

(−AR)(vw), R(vw)| (−AR)(vw), 1A−B(w)

We have applied the rule (∪), the rule (]) (since A = B ] (A−B), we may replace u by vwwhere v ∈ OB

v and w ∈ OA−Bv ), the rule (×) and finally on the left branch, the rule (Π).

Each branch ends in an axiomatic sequence.

2. Let us prove that if R, S are relations of type A and B ⊆ A then ΠABR ⊆ ΠA

B(R∪A S);it suffices to demonstrate that `D ((ΠA

BR) →A ΠAB(R ∪A S))(u).

((ΠABR)→A(ΠA

B(R∪AS)))(u)(−AΠA

BR)(u), (ΠA

B(R∪AS))(u)

(−AR)(ut), (ΠAB

(R∪AS))(u)

(−AR)(ut), (R∪AS)(ut)

(−AR)(ut), R(ut), S(ut)

We first used the rule (∪), then the rule (−Π) with a new t ∈ OA−Bv , then the rule (Π)

and finally, the rule (∪). We could choose any v ∈ OA−B for the rule (Π), and we chose t, a

20

Page 21: pdfs.semanticscholar.orgpdfs.semanticscholar.org/a21d/a84ca3fffe2f309f3bd891b6e...A logic of typed relations and its applications to relational databases Wendy MacCaully⁄ Department

variable already on the branch. The reader can see that the branch contains an axiomaticsequence so it is closed.

3. Let F, G ∈ TA and let the formula F = G represent the formula ((−AF ) ∪A G) ∩A

((−AG) ∪A F ); then:(a) ΠA

B1A = 1B is D-provable;(b) If S is a relation constant, and C is the class of models such that m(S) 6= ∅, then

ΠA]BA (R×A]B S) = R is DC-provable.

The following proof suffices to demonstrate that 1B ⊆ ΠAB1A:

(1B→BΠAB1A)(u)

−1B(u), ΠAB

1A(u)

−1B(u), 1A(ut)

where t ∈ OA−Bv . The reverse containment is immediate because 1B(u) is an axiomatic

sequence.

We now present two proofs to establish (b); in the first we use the specific rule (∈ S)corresponding to the assumption that m(S) 6= ∅.

(R→AΠA]BA (R×A]BS))(u)

−AR(u), ΠA]BA

(R×A]BS)(u)

−S(t), −AR(u), ΠA]BA

(R×A]BS)(u)

−BS(t), −AR(u), (R×A]BS)(ut)

−BS(t), −AR(u), R(u) | −BS(t), −AR(u), S(t)

(ΠA]BA (R×A]BS)→AR)(u)

−AΠA]BA

(R×A]BS)(u), R(u)

−A]B(R×A]BS)(ut), R(u)

−AR(u), −BS(t), R(u)

4. We demonstrate the following:

(a) `D (T ×A1]A2 σA2B (S, R) →A1]A2 σA1]A2

B (S, T ×R))(u);(b) `D (ΠA

∅ R →∅ 1∅)(u);(c) `D (0A →A (R ∩A S))(u)(d) `D (1∅ ×∅]A R →A R)(u);(e) `D ((R×A]B S) →A]B (S ×B]A R))(u);

(a)(T×A1]A2σ

A2B (S,R)→A1]A2σ

A1]A2B (S,T×R))(u)

−A1]A2(T×A1]A2σA2B

(S,R))(u), (σA1]A2B

(S,T×R))(u)

−A1]A2(T×A1]A2σA2B

(S,R))(tz), (σA1]A2B

(S,T×R))(u)

−A1T (z), −A2σA2B

(S,R))(t), (σA1]A2B

(S,T×R))(u)

−A1T (z), −BS(v), −A2R(vx), (σA1]A2B

(S,T×R))(u)

−A1T (z), −BS(v), −A2R(vx), (σA1]A2B

(S,T×R))(vq)

−A1T (t), −BS(v), −A2R(vx), S(v) | (!!)

where (!!) is:

21

Page 22: pdfs.semanticscholar.orgpdfs.semanticscholar.org/a21d/a84ca3fffe2f309f3bd891b6e...A logic of typed relations and its applications to relational databases Wendy MacCaully⁄ Department

−A1T (z), −BS(v), −A2R(vx), (T×A1]A2R)(vq)−A1T (z), −BS(v), −A2R(vx), (T×A1]A2R)(vzx)

−A1T (z), −BS(v), −A2R(vx), (T×A1]A2R)(zvx)

−A1T (z), −BS(v), −A2R(vx), T (z) | −A1T (z), −BS(v), −A2R(vx), R(vx)

(b)(ΠA

∅ R→∅1∅)(e)−∅(ΠA

∅ R)(e), 1∅(e)(c)

(0A→A(R∩AS))(u)−A0A(u), (R∩AS)(u) (d)

(1∅×∅]AR→AR)(u)−A(1∅×∅]AR)(u), R(u)

−A(1∅×∅]AR)(eu), R(u)

−∅1∅(e), −AR(u), R(u)

(e)(R×A]BS→A]BS×B]AR)(u)

−A]B(R×A]BS)(u), (S×B]AR)(u)

−A]B(R×A]BS)(vw), (S×B]AR)(u)

−AR(v),−BS(w), (S×B]AR)(u)

−AR(v), −BS(w), (S×B]AR)(wv)

−AR(v), −BS(w), S(w) | −AR(v), −BS(w), R(v)

When automating this relational deduction system, some heuristics can be introducedwhich greatly improve efficiency. While we usually perform decompositions in order startingwith the formula on the left, whenever possible we first decompose those formulas whichintroduce new variables. Some restrictions on the application of the relational deductionrules may yield a decidable procedure for certain fragments and allow us to constructfinite countermodels which are often desirable diagnostic tools. Other restrictions improveefficiency, usually an important consideration in automated theorem proving. If either weassume an infinite number of non-empty relations or efficiency is an issue, the restrictionsA ⊆ B, B the type of F (u) should be imposed on rules of the form (∈ R). (In theapplications we considered, it sufficed to restrict application of this rule to one use pernon-empty relation.) The (cut) rule is usually undesirable and a restricted form may be allthat is necessary; one such example may be found in MacCaull (2000). The rule (∈ R) isredundant if the general form of (cut) is assumed.

8 Concluding Remarks

As suggested in the Introduction, when forming the product of a relation R with a relationS, rather than assuming that the types of R and S are disjoint, we can explicitly renamethe attributes in one of them and then form the product. We define a new unary operationas follows:

Renaming (ρ) (unary) Let A, B,C ∈ TΩ, B ⊆ A and R ⊆ 1A; further, suppose car-dinality of B = cardinality of C, r is a one-to-one map from B to C and for all b ∈ B,Dr(b) = Db; then:

ρAB,CR = u ∈ 1(A−B)∪C : ∃v ∈ R such that ∀a ∈ A, if a ∈ B, then

u(r(a)) = v(a) and if a 6∈ B, then u(a) = v(a).

Thus τ(ρAB,C) = (A, (A − B) ∪ C); clearly ρA

B,BR = R and if B 6= C, R and ρAB,CR are of

different types.

Now suppose A,B,C ⊆ Ω, A∩B 6= ∅, cardinality of C = cardinality of A∩B, r is a one-to-one map from (A∩B) to C, C∩(A∪B) = ∅ and R ∈ RA, S ∈ RB; then to construct the

22

Page 23: pdfs.semanticscholar.orgpdfs.semanticscholar.org/a21d/a84ca3fffe2f309f3bd891b6e...A logic of typed relations and its applications to relational databases Wendy MacCaully⁄ Department

product of R and S, we first apply the renaming operator ρAA∩B,C to R obtaining a relation

of type (A − (A ∩ B)) ∪ C which is disjoint from B. As a consequence, the product withexplicit renaming is defined as:

ρAA∩B,CR×((A−(A∩B))∪C)]B S.

Chandra and Harel (1980) discuss the desirability of augmenting relational algebra orpredicate calculus with various constructs to give it more expressive power. Of particularinterest is the transitive closure of a relation. We can make queries about the transitiveclosure if we extend the set of types by including the types A × A = A2, for each A ⊂ Ω,which represent the types of ordered pairs of tuples, and define some operations on them.

Tuples of type A2 are denoted by (u, v), where u, v ∈ 1A; for any a (= (a1, a2)) ∈ A2,define (u, v)(a) = (u(a1), v(a2)); the set of tuples of type A2 is denoted by 1A2

.

Let R,S ∈ 1A2; then R; S = (u, v) : u ∈ 1A, v ∈ 1A and ∃w ∈ 1A such that (u,w) ∈ R

and (w, v) ∈ S. The decomposition rules for ;, composition of relations, are well known;we include them here:

(; ) K, (F ;G)((u,v)), H

K, F (u,w), H, (F ;G)((u,v)) | K, G((w,v)), H, (F ;G)((u,v))

any w ∈ OA

(−; ) K, −A(F ;G)((u,v)), H

K, −AF ((u,w)), −AG(w,v)), H

new w ∈ OAv

We use the composition of relations to define the transitive closure of R, denoted by R!, asfollows: for any R ∈ 1A2

, R! = (u, v) : (u, v) ∈ R or (u, v) ∈ R;R!. The decompositionrules for (!) are:

(!) K, (F !)((u,v)), H

K, F (u,v), (F ;F !)((u,v)), H(−!) K, −A2

(F !)((u,v)), H

K, −A2F ((u,v)), H | K, −A2 (F ;F !)((u,v)), H

In the proof of completeness, we must add appropriate clauses to the definition ofcomplete branch; we note, d((F ; G)((u, v))) = max (d(F ((u, v))), d(G((u, v)))) + 1; andd(F !)((u, v)) = ∞.

We can generalize the results of this paper to deal with generalized databases; that is,databases in which a record entry is a set of subsets of attribute domains (rather than aset of elements of attribute domains) (Lipski (1979)). Let Ω be a set of attributes and letA ∈ TΩ.

Definition 8.1 A generalized tuple of type A is a map u : A → 2DA, such that for alla ∈ A, u(a) ⊆ Da. The collection of all (generalized) tuples of type A is called the relation1A. A generalized relation R of type A is a subset of the set 1A.

In the relational deduction system presented in previous sections, the tuples may be gener-alized tuples.

23

Page 24: pdfs.semanticscholar.orgpdfs.semanticscholar.org/a21d/a84ca3fffe2f309f3bd891b6e...A logic of typed relations and its applications to relational databases Wendy MacCaully⁄ Department

In OrÃlowska (1997) we find numerous information relations for rough set theory, whichallow us to reason about nondeterministic databases. Some of these relations have analoguesfor generalized typed relations. Typed analogues for some information relations of roughset theory are formulated below, where −u(a) is shorthand for Da − u(a); in what followswe assume that a 6= b.

indab = u ∈ 1a,b : u(a) = u(b) (an indiscernibility relation);

simab = u ∈ 1a,b : u(a) ∩ u(b) 6= ∅ (a similarity relation);

nsimab = u ∈ 1a,b : −u(a) ∩ −u(b) 6= ∅ (a negative similarity relation);

disab = u ∈ 1a,b : u(a) ∩ u(b) = ∅ (a disjointness relation (identical to −a,bsima

b ));ina

b = u ∈ 1a,b : u(a) ⊆ u(b) (an inclusion relation);exha

b = u ∈ 1a,b : u(a) ∪ u(b) = Da,b (an exhaustiveness relation);coma

b = u ∈ 1a,b : u(a) = −u(b) (a complementarity relation);pnsima

b = u ∈ 1a,b : u(a) ∩ −u(b) 6= ∅ (a positive negative similarity relation).

Information relations for untyped systems have a number of useful properties (see forexample, OrÃlowska (1997)), and it is interesting to consider meaningful properties of infor-mation relations for typed systems. For example:

indab = indb

a; simab = simb

a; nsimab = nsimb

a; and exhab = exhb

a.

Using the above relations as first arguments when applying the selection operation, wecan perform selections in nondeterministic databases analogous to the typical selections ofclassical databases. For example, σA

a,b(indab , R) = u ∈ R : u(a) = u(b). We can express a

form of transitivity on the indices which holds for the collection of relations indab : a, b ∈ Ω

as follows:

if a, b, c ∈ A then σAa,b(inda

b , R) ∩ σAb,c(indb

c, R) ⊆ σAa,c(inda

c , R).

The obvious modification of rule (T) in Section 6 is the deduction rule corresponding tothe above form of transitivity. This same form of transitivity on the indices holds for thecollection of relations ina

b : a, b ∈ Ω. Other forms of transitivity on the indices may beexpressed; for example:

if a, b, c ∈ A then σAa,b(sim

ab , R) ∩ σA

b,c(inbc, R) ⊆ σA

a,c(simac , R).

We may use selections to express an analogue for 3-transitivity on the indices, which holdsfor collection of relations coma

b : a, b ∈ Ω, and refer to MacCaull and OrÃlowska (2002) forthe deduction rule corresponding to this property.

In summary, we have developed a calculus of typed relations and presented a Rasiowaand Sikorski-style proof system for the calculus which allows us to automate the decision-making procedure for database relations. In addition to the fact that it deals with formulaswhich represent typed relations, the calculus has a number of features which distinguish itfrom ordinary relational proof systems, due to the fact that the individual variables andconstants represent tuples, that is, maps. We may use the calculus to deal with nonde-terministic databases and augmented it to deal with the transitive closure construction.An interesting open problem is to determine the appropriate algebraic semantics for the

24

Page 25: pdfs.semanticscholar.orgpdfs.semanticscholar.org/a21d/a84ca3fffe2f309f3bd891b6e...A logic of typed relations and its applications to relational databases Wendy MacCaully⁄ Department

logic of typed relations. The general problem of modelling spatial and temporal aspects ofmultimedia objects (see Vazirgiannis, (1999)) is also of interest to the authors.

Acknowledgements: We wish to thank the following people for their input to this work:Dan Simovici who first suggested that we develop relational logic for database relations andwho read and commented on early versions of this paper; Dexter Kozen who suggested weinvestigate the possibility of augmenting our typed calculus to give it more expressive powerthan relational algebra; and Harrie de Swart for several useful conversations with respectto the notion of tuple.

References

Balbiani, Ph. and OrÃlowska, E., (1999) A hierarchy of modal logics with relative accessibilityrelations, J. of Applied Nonclassical Logics, Volume 9, 303-328.

Buszkowski, W. and OrÃlowska, E., (1997) Indiscernibility-based formalization of depen-dencies in information systems, E.OrÃlowska, editor, Incomplete Information: Rough SetAnalysis, Physica Verlag, pp 293-315.

Chandra, A.K., and Harel, D., (1980) Computable queries for Relational Data Bases, Jour-nal of Computer and System Sciences, Volume 21, 156-178.

Codd, E., (1970) A relational model for large shared data banks, Comm. ACM, V. 16,377-387.

Cosmadakis, S., (1987) Database theory and cylindric lattices in: A.K. Chandra, editor,Proceedings of the 28th Annual Symposium on Foundations of Computer Science, IEEEComputer Science Press, 411-420.

Demri, S. and OrÃlowska, E., (2002) Incomplete Information: Structure, Inference, Com-plexity, EATCS Monographs in Theoretical Computer Science, Springer.

Duntsch, I., Gediga, G. and OrÃlowska, E., (2001) Relational Attribute Systems, J. HumanComputer Studies, Volume 55, 293-305.

Duntsch, I. and Mikulas, S., (2001) Cylindric structures and dependencies in relationaldatabases, Journal of Theoretical Computer Science, Volume 269, 451-468.

Fitting, M., (2000) Modality and Databases, preprint.

Henkin, L., Monk, J.D. and Tarski, A., (1971) Cylindric Algebras, Part 1, North Holland.

Imielinski, T. and Lipski, W., (1984) The relational model of data and cylindric algebras,Journal of Computer and System Sciences, Volume 28, 80-102.

Lee, G., Little, R., MacCaull, W. and Spencer, B., (2002) ReVAT - Relational Validationvia Analytic Tableaux, St. Francis Xavier U. Technical Report.

25

Page 26: pdfs.semanticscholar.orgpdfs.semanticscholar.org/a21d/a84ca3fffe2f309f3bd891b6e...A logic of typed relations and its applications to relational databases Wendy MacCaully⁄ Department

Lipski, W., (1979) On Semantic issues connected with incomplete information databases,ACM Transactions on Database Systems, Volume 4, 262-296.

MacCaull, W., (2000) Proof theory for generalized dependencies for information relations,Fundamenta Informaticae, Volume 42, 1-27.

MacCaull, W., (2001) A tableaux procedure for the implication problem for association rules,in: Relational Methods for Computer Science Applications, E. OrÃlowska and A. Szalas,editors, Springer-Physica Verlag, pp 73-91.

MacCaull, W. and OrÃlowska, E., (2001) Relational Resolution, Extended Abstract in Pro-ceedings, Workshop in Relational Methods accompanying ISMVL 2001, pp 53-56.

MacCaull, W. and OrÃlowska, E., (2002) Correspondence results for relational proof systemswith application to the Lambek calculus, Studia Logica, Volume 71, 389-414.

MacCaull, W. and OrÃlowska, E., (2003) A calculus of typed relations, in: R. Berghammerand B. Moller, editors, Proceedings, Seventh International Workshop on Relational Methodsin Computer Science, pp 152-158.

Nguyen, T., (1991) A relational model of demonic nondeterministic programs, InternationalJournal of Foundations of Computer Science, Volume 2, 101-131.

OrÃlowska, E., (1997) Introduction: What You Always Wanted to Know About Rough Sets,in: E. OrÃlowska, editor, Incomplete Information: Rough Set Analysis, Physica Verlag, pp1-20.

OrÃlowska, E., (1996) Relational Formalization of Nonclassical Logics, in: C. Brink, W.Kahl and G. Schmidt, editors, Relational Methods in Computer Science, Springer Verlag,pp 90-105.

OrÃlowska, E., (1988) Kripke models with relative accessibility and their application to in-ferences from incomplete information, in: Mathematical Problems in Computation Theory,G. Mirkowska and H. Rasiowa, editors, Banach Center Publications 21, pp 329-339.

OrÃlowska, E., (1987) Algebraic approach to database constraints, Fundamenta Informaticae,Volume 10, 57-66.

Pawlak, Z., (1991) Rough Sets, Kluwer, Dordrecht.

Rasiowa, H. and Sikorski, R., (1963) The Mathematics of Metamathematics, Polish SciencePublishers, Warsaw.

Schmidt, R., OrÃlowska, E. and Hustadt, U., (2003) Two proof systems for Peirce algebras,in: R. Berghammer and B. Moller, editors, Proceedings, Seventh International Workshopon Relational Methods in Computer Science, pp 197-204.

Simovici, D.A., and Tenney, R.L., (1995) Relational Database Systems, Academic Press.

Ullman, J., (1988) Database and Knowledge-Base Systems, Volume 1, Computer SciencePress.

26

Page 27: pdfs.semanticscholar.orgpdfs.semanticscholar.org/a21d/a84ca3fffe2f309f3bd891b6e...A logic of typed relations and its applications to relational databases Wendy MacCaully⁄ Department

Vazirgiannis, M. (1999) Interactive multimedia documents: modeling, authoring and im-plementation experiences, Lecture Notes in Computer Science, 1564, Springer.

Yannakakis, M. and Papadimitriou, C., (1982) Algebraic Dependencies, Journal of Com-puter and System Sciences, Volume 25, 2-41.

27