To save content items to your account,
please confirm that you agree to abide by our usage policies.
If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account.
Find out more about saving content to .
To save content items to your Kindle, first ensure no-reply@cambridge.org
is added to your Approved Personal Document E-mail List under your Personal Document Settings
on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part
of your Kindle email address below.
Find out more about saving to your Kindle.
Note you can select to save to either the @free.kindle.com or @kindle.com variations.
‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi.
‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.
Since the development of lattice theory, it became more and more evident that concepts of upper and lower bounds, suprema and infima did not require orderings to be linear. Nevertheless, fuzziness was mainly studied along the linear order of IR and only later began to be generalized to the ordinal level: numbers indicate the relative positions of items, but no longer the magnitude of difference. Then we moved to the interval level: numbers indicate the magnitude of difference between items, but there is no absolute zero point. Examples are attitude scales and opinion scales. We proceed even further and introduce relational measures with values in a lattice. Measures traditionally provide a basis for integration. Astonishingly, this holds true for these relational measures so that it becomes possible to introduce a concept of relational integration.
With De Morgan triples, we then touch yet another closely related concept of relational methods of preference aggregation.
Modelling preferences
Anyone who is about to make important decisions will usually base these on carefully selected basic information and clean lines of reasoning. In general, it is not too dificult to apply just one criterion and to operate according to this criterion. If several criteria must be taken into consideration, one has also to consider the all too common situation that these provide contradictory information: ‘This car looks nicer, but it is much more expensive’.
A full account of relation algebra cannot be given here, just enough to enable us to work with it. This will be accompanied by examples showing the effects. When relations are studied in practice, they are conceived as subsets R ⊆ X × Y of the Cartesian product of the two sets X, Y between which they are defined to hold. Already in Chapter 3, we have given enough examples of relations between sets together with a diversity of ways to represent them. We will now present the operations on relations in a way that is both algebraically sound and suficiently underpinned with examples.
With this algebraic approach we start in full contrast to such texts as, for example, [125], where relations are also presented in extensu. There, however, everything is based on point-wise reasoning.
Typing relations
In many cases, we are interested in solving just one problem. More often, however, we want to find out how a whole class of problems may be solved. While in the first case, we may use the given objects directly, we must work with constants and variables for relations in the latter case. These variables will be instantiated when the concrete problem is presented.
Let us consider timetabling as an example. It may be the case that a timetable has to be constructed at a given school. However, it would not be wise to write a timetabling program just for this school with the present set of teachers and classrooms. If it is intended to sell the program several times so that it may be applied also to other schools, one must allow for the possibility of different sets of teachers, different sets of classrooms, etc.
At this point of the book, a major break in style may be observed. So far we have used free-hand formulations, not least in HASKELL, and have presented the basics of set theory stressing how to represent sets, subsets, elements, relations, and mappings. However, so far we have not used relations in an algebraic form.
From now on, we shall mainly concentrate on topics that inherently require some algebraic treatment. We cannot start immediately with formal algebraic proofs and with the relational language TituRel in which all this has been tested. Rather, we first present Part II, which is full of examples that demonstrate the basics of algebraic rules. Whenever one of these early rules needs a proof, this proof will be very simple, but nevertheless omitted at this point. The postponed proofs can be found in Appendix B.
We will, however, often show how point-free versions, i.e., those hiding quantifiers and individual variables, are derived from a predicate-logic form. These deductions are definitely not an aim of this book. However, they seem necessary for many researchers who are not well trained in expressing themselves in a point-free algebraic manner. These deductions are by no means executed in a strictly formal way. Rather, they are included so as to convince the reader that there is a reason to use the respective point-free construct.
Beyond what has been shown so far, there exist further fascinating areas. One of these is concerned with relational specification. While standard relation algebra formulates what has to be related, here only a region is circumscribed within which the relation envisaged is confined. Although this area has attracted considerable interest from researchers, we omit the presentation of demonic operators used for it.
We continue by mentioning what we cannot present here. With relational grammar applied to natural languages, it has been shown that the translation of relations of time, possession, or modality, for example, can be handled when translating to another natural language. Spatial reasoning has long used relation algebra in order to reason about the relative situatedness of items. This is directed at real-time scanning of TV scenes.
One of the application areas that we present may not be seen as an application in the first place. We also use relations to review parts of standard mathematics, the homomorphism and isomorphism theorems. Additional results may be reported and deeper insights gained when using relations. This area seems particularly promising because many other such reconsiderations may be hoped for. We show possible directions to encourage further research with the Farkas Lemma, topology, projective geometry, etc.
Implication structures study long-range implications, preferably with only a few alternatives; they are helpful in investigating dependency situations. This makes the examples of Sudoku and timetables interesting.
In this chapter we present the third approach to subtree extraction, namely, firstorder (predicate) logic, and its extension, monadic second-order logic (MSO). An advantage of using logic-based queries is that this allows a direct way of expressing retrieval conditions. That is, we do not need to specify the structure of a whole tree (as for patterns in Chapter 5) nor to navigate around the tree (as for path expressions in Chapter 12); we simply need to specify the logical relationships among relevant nodes. Furthermore MSO can express any regular queries, that is, it is at least as powerful as marking tree automata (and thus patterns). However, MSO can express no more than regular queries; indeed, any MSO formula can be translated to a marking tree automaton (Chapter 6). It does mean, however, that we can use efficient on-the-fly algorithms (Chapter 8).
First-order logic
When we consider a logical framework, we usually think of models on which logic formulas are interpreted. In our setting, the models are XML documents; for simplicity, we consider here the binary tree format. Then we can talk about whether a given (binary) tree satisfies a given logic formula.
While in Chapter 5 we defined patterns as an approach to subtree extraction, in this chapter we introduce an alternative approach called path expressions. While patterns use structural constraints for matching subtrees, path expressions use “navigation,” which specifies a sequence of movements on the tree and makes checks on the visited nodes. In practice, path expressions tend to be more concise since they do not require conditions to be specified for the nodes not on the path. In theory, however, path expressions are strictly less expressive (i.e., they cannot express all regular tree languages) unless sufficient extensions are made. In this chapter we first review path expressions used in actual XML processing and then consider a refinement called caterpillar expressions. After this, we study the corresponding automata formalism, called tree-walking automata, and compare their expressiveness with tree automata.
Path expressions
Although there are various styles of path expression, the basic idea is to find a node to which there is a “path” from the “current” node obeying the given path expression. When multiple such nodes are found, usually all are returned.
The main differences between the styles lie in which paths are allowed. A path is, roughly, a sequence consisting of either movements between or tests on nodes. In each movement we specify in which direction to go; we call this axis.
In this part of the present text, we reach a third level of abstraction. Recall that in Part I relations were observed as they occur in real life situations. We then made a step forward using point-free algebraic formulation in Part II; however, we did not introduce the respective algebraic proofs immediately. Instead, we visualized the effects and tried to construct with relations. In a sense, this corresponds to what one always finds in a book treating eigenvectors and eigenvalues of real- or complexvalued matrices, or their invariant subspaces: usually this is heavily supported with visualizing matrix situations. We did this with full mathematical rigor but have not yet convinced the reader concerning this fact. Proofs, although rather trivial in that beginning phase, have been postponed so as to establish an easy line of understanding first.
As gradually more advanced topics are handled, we will now switch to a fully formal style with proofs immediately appended. However, the reader will be in a position to refer to the first two parts and to see there the effects.
Formulating only in algebraic terms – or what comes close to that, formulating in the relational language TituRel – means that we are far more restricted in expressivity. On the other hand this will improve the precision considerably. Restricting ourselves to the relational language will later allow computer-aided transformations and proofs.
Ambiguity refers to the property whereby regular expressions or patterns have multiple matching possibilities. As discussed in Chapter 5, ambiguity can make the behavior of a program harder to understand and can actually be the result of a programming error. Therefore it is often useful to report it to the user. However, when we come to ask exactly what we mean by ambiguity, there is no consensus. In this chapter, we review three different definitions, strong ambiguity, weak ambiguities and binding ambiguity, and discuss how these notions are related to each other and how they can be checked algorithmically.
Caveat: In this chapter, we concentrate on regular expressions and patterns on strings rather than on trees in order to highlight the essence of ambiguity. The extension for the case of trees is routine and can be found in the literature.
Ambiguities for regular expressions
In this section, we study strong and weak ambiguities and how they can be decided by using an ambiguity checking algorithm for automata.
14.1.1 Definitions
Ambiguity arises when a regular expression has several occurrences of the same label. Therefore we need to be able to distinguish between these occurrences.
It has been shown in Chapters 2 and 3 how moderately sized sets (termed basesets when we want to stress that they are linearly ordered, non-empty, and finite), elements, vectors, and relations can be represented. There is a tendency to try to extend these techniques indiscriminately to all finite situations. We do not follow this trend. Instead, sets, elements, vectors, or relations – beyond those related to ground sets – will carefully be constructed, in particular if they are ‘larger’. Only a few generic techniques are necessary. They are presented here in detail as appropriate.
These techniques are far from being new. We have routinely applied them in an informal way since our school days. What is new in the approach chosen here is that we begin to take these techniques seriously: pair forming, if–then–else–fi–handling of variants, quotient forming, etc. For pairs, we routinely look for the first and second components; when a set is considered modulo an equivalence, we work with the corresponding equivalence classes and obey carefully the rule that our results should not depend on the specific representative chosen, etc.
What has been indicated here, however, requires a more detailed language to be expressed. This in turn means that a distinction between language and interpretation is suddenly important, which one would like to abstract from when handling relations ‘directly’. It turns out that only one or two generically defined relations are necessary for each construction step with quite simple and intuitive algebraic properties.
Concerning syntax and notation, everything is now available to work with. We take this opportunity to have a closer look at the algebraic laws of relation algebra. In particular, we will be interested in how they can be traced back to a small subset of rules which can serve as axioms. We present them now and discuss them immediately afterwards.
We should stress that we work with heterogeneous relations. This contrasts greatly with the traditional work of the relation algebra community which is almost completely restricted to a homogeneous environment – possibly enhanced by cylindric algebra considerations. Some of the constructs which follow simply do not exist in a homogeneous context, for example the direct power and the membership relation. At first glance, it seems simpler to study homogeneous as opposed to heterogeneous relations. But attempting domain constructions in the homogeneous setting immediately leads necessarily to non-finite models. Also deeper problems, such as the fact that ╥A,B; ╥B,C = ╥A,C does not necessarily hold, have only recently come to attention; this applies also to unsharpness.
Laws of relation algebra
The set of axioms for an abstract (possibly heterogeneous) relation algebra is nowadays generally agreed upon, and it is rather short. When we use the concept of a category, this does not mean that we are introducing a higher concept. Rather, it is used here as a mathematically acceptable way to prevent multiplying a 7 × 5-matrix with a 4 × 6-matrix.