251 32 6MB
English Pages 416 [408] Year 2020
Undergraduate Topics in Computer Science
David Makinson
Sets, Logic and Maths for Computing Third Edition
Undergraduate Topics in Computer Science Series Editor Ian Mackie, University of Sussex, Brighton, UK Advisory Editors Samson Abramsky Oxford, UK Chris Hankin
, Department of Computer Science, University of Oxford,
, Department of Computing, Imperial College London, London, UK
Mike Hinchey , Lero – The Irish Software Research Centre, University of Limerick, Limerick, Ireland Dexter C. Kozen, Department of Computer Science, Cornell University, Ithaca, NY, USA Andrew Pitts , Department of Computer Science and Technology, University of Cambridge, Cambridge, UK Hanne Riis Nielson , Department of Applied Mathematics and Computer Science, Technical University of Denmark, Kongens Lyngby, Denmark Steven S. Skiena, Department of Computer Science, Stony Brook University, Stony Brook, NY, USA Iain Stewart
, Department of Computer Science, Durham University, Durham, UK
‘Undergraduate Topics in Computer Science’ (UTiCS) delivers high-quality instructional content for undergraduates studying in all areas of computing and information science. From core foundational and theoretical material to final-year topics and applications, UTiCS books take a fresh, concise, and modern approach and are ideal for self-study or for a one- or two-semester course. The texts are all authored by established experts in their fields, reviewed by an international advisory board, and contain numerous examples and problems, many of which include fully worked solutions. The UTiCS concept relies on high-quality, concise books in softback format, and generally a maximum of 275–300 pages. For undergraduate textbooks that are likely to be longer, more expository, Springer continues to offer the highly regarded Texts in Computer Science series, to which we refer potential authors.
More information about this series at http://www.springer.com/series/7592
David Makinson
Sets, Logic and Maths for Computing Third Edition
123
David Makinson Department of Philosophy, Logic and Scientific Method London School of Economics London, UK
ISSN 1863-7310 ISSN 2197-1781 (electronic) Undergraduate Topics in Computer Science ISBN 978-3-030-42217-2 ISBN 978-3-030-42218-9 (eBook) https://doi.org/10.1007/978-3-030-42218-9 1st and 2nd editions: © Springer-Verlag London Limited 2008, 2012 3rd edition: © Springer Nature Switzerland AG 2020 This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed. The use of general descriptive names, registered names, trademarks, service marks, etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant protective laws and regulations and therefore free for general use. The publisher, the authors and the editors are safe to assume that the advice and information in this book are believed to be true and accurate at the date of publication. Neither the publisher nor the authors or the editors give a warranty, expressed or implied, with respect to the material contained herein or for any errors or omissions that may have been made. The publisher remains neutral with regard to jurisdictional claims in published maps and institutional affiliations. This Springer imprint is published by the registered company Springer Nature Switzerland AG The registered company address is: Gewerbestrasse 11, 6330 Cham, Switzerland
Preface
The first part of this preface is for the student; the second for the instructor. Some readers may find it helpful to look at both. Whoever you are, welcome!
For the Student You have finished secondary school and are about to begin at a university or technical college. You want to study informatics or computing. The course includes some mathematics—and that was not necessarily your favourite subject. But there is no escape: a certain amount of finite mathematics is a required part of the first-year curriculum, because it is a necessary toolkit for the subject itself. What is in This Book? That is where this book comes in. Its purpose is to provide the basic mathematical language required for entering the world of the information and computing sciences. It does not contain all the mathematics that you will need through the several years of your undergraduate career. There are other very good, often quite massive, volumes that do that. At some stage you will find it useful to get one and keep it on your shelf for reference. But experience has convinced this author that no matter how good a compendium is, beginning students tend to feel intimidated, lost, and unclear about what is in it to focus on. This short book, in contrast, offers just the basics that you need to know from the beginning, on which you can build further as needed. It also recognizes that you may not have done much mathematics at school, may not have understood very well what was going on, and may even have grown to detest it. No matter: you can learn the essentials here, and perhaps even have fun doing so. So, what is the book about? It is about certain tools that we need to apply over and over again when thinking about computations. They include, from the world of sets,
v
vi
Preface
• • • •
Collecting things together. In the jargon of mathematics, first steps with sets. Comparing things. This is the theory of relations. Associating one item with another. Introduces the key notion of a function. Recycling outputs as inputs. We explain the ideas of recursion and induction. From other parts of finite mathematics,
• Counting. The mathematician calls it combinatorics. • Weighing the odds. This is done with probability. • Squirrel math. Here we make use of trees. From logic, • • • •
Yea and Nay. Just two truth-values underlie propositional logic. Everything and nothing. That is what quantificational logic is about. Just supposing. How complex proofs are built out of simple ones. Sticking to the Point. How to make logic sensitive to relevance (new to this edition).
How Should You Use It? Without an understanding of basic concepts, large portions of computer science remain behind closed doors. As you begin to grasp the ideas and integrate them into your thought, you will also find that their application extends far beyond computing into many other areas. So, there is work to be done. The good news is that there is not all that much to commit to memory. Your sister studying medicine, or brother going for law, will envy you terribly for this. In our subject, the two essential things are to understand and to be able to apply. But that is a more subtle affair than one might imagine, as the two are interdependent. Application without understanding is blind and quickly leads to errors— often trivial, but sometimes ghastly. On the other hand, comprehension remains poor without the practice given by applications. In particular, you do not fully register a definition until you have seen how it takes effect in specific situations: positive examples reveal its scope, negative ones show its limits. It also takes some experience to be able to recognize when you have really understood something, compared to having done no more than recite the words or call upon them in hope of blessing. For this reason, exercises have been included as an integral part of the learning process. Skip them at your peril. That is part of what is meant by the old proverb ‘there is no royal road in mathematics’. Although all exercises in this edition are accompanied by a solution, you will benefit much more if you first cover the answer and try to work it out for yourself. That requires self-discipline, but it brings real rewards. Moreover, the exercises have been chosen so that in many instances the result is just what is needed to make a step somewhere later in the book. Thus, they are also part of the development of the general theory. By the same token, don’t get into the habit of skipping verifications when you read the text. Postpone, yes, but omit, no. In mathematics, you have never fully appreciated a fact unless you have also grasped why it is true, i.e. have assimilated
Preface
vii
at least one proof of it. The well-meaning idea that mathematics can be democratized by teaching the facts and forgetting about the proofs has wrought disaster in some secondary and university education systems. In practice, the tools that are bulleted above are rarely applied in isolation from each other. They gain their real power when used in concert, setting up a crossfire that can bring tough problems to the ground. For example, the concept of a set, once explained in the first chapter, is used everywhere in what follows; relations reappear in graphs, trees and logic; functions are omnipresent.
For the Instructor Any book of this kind needs to find delicate balances between the competing virtues and shortcomings in different choices of material and ways of presenting it. Manner of Presentation Mathematically, the most elegant and coherent way to proceed is to begin with the most general concepts, and gradually unfold them so that the more specific and familiar ones appear as special cases. Pedagogically, this sometimes works but often it is disastrous. There are situations where the reverse is required: begin with some of the more familiar examples and special cases, and then show how they may naturally be broadened. There is no perfect solution to this problem; we have tried to find a minimally imperfect one. Insofar as we begin the book with sets, relations and functions in that order, we are following the first path. But in some chapters we have followed the second one. For example, when explaining induction and recursion we begin with the most familiar special case, simple induction/recursion over the positive integers; then pass to their cumulative forms for the same domain; broaden to their qualitatively formulated structural versions; finally, give the most general articulation, on arbitrary well-founded sets. Again, in the chapter on trees, we have taken the rather unusual step of beginning with rooted trees, where intuition is strongest and applications abound, then abstracting to unrooted trees. In the chapters on counting and probability, we have had to strike another balance between traditional terminology and notation and its translation into the language of sets, relations and functions. Most textbook presentations do it all in the traditional way, which has its drawbacks. It leaves the student in the dark about the relation of this material to what was taught in earlier chapters on sets and functions. And, frankly, it is not always very rigorous or transparent. Our approach is to familiarize readers with both kinds of presentation—using the language of sets and functions for a clear understanding of the material itself, and the traditional languages of counting and probability to permit rapid communication in the local dialect.
viii
Preface
In those two chapters yet another balance had to be found. One can easily supply counting formulae and probability equalities to be committed to memory and applied in drills. It is more difficult to provide reader-friendly explanations and proofs that permit students to understand what they are doing and why. Again, this book tries to do both, with a rather deeper commitment to the latter than is usual. In particular, it is emphasized that whenever we wish to count the number of selections of k items from a pool of n, a definite answer is possible only when it is clearly understood whether the selections admit repetition and whether they discriminate between orders, giving four options and thus four different counting formulae for the toolbox. The student should learn which tool to choose when, and why, as well as how to use it. The place of logic in the story is delicate. We have left its systematic exposition to the end—a decision that may seem rather strange, as one uses logic whenever reasoning mathematically, even about the most elementary things discussed in the first chapters. Don’t we need a chapter on logic at the very beginning of the book? The author’s experience in the classroom tells him that, in practice, that does not work well. Despite its simplicity—perhaps indeed because of it—logic can be elusive for beginning students. It acquires intuitive meaning only as examples of its employment are revealed. Moreover, it turns out that a really clear explanation of the basic concepts of logic requires some familiarity with the mathematical notions of sets, relations, functions and trees. For these reasons, the book takes a different tack. In early chapters, notions of logic are identified briefly as they arise in the discussion and verification of more ‘concrete’ material. This is done in ‘logic boxes’. Each box introduces just enough to get on with the task in hand. Much later, in the last four chapters, all this is brought together and extended. By then, the student should have little trouble appreciating what the subject is all about and how natural it all is, and will be ready to use other basic mathematical tools to help study it. From time to time there are boxes of a different nature—‘Alice boxes’. This little trouble-maker comes from the pages of Lewis Carroll to ask embarrassing questions in all innocence. Often, they are on points that students find puzzling but which they have trouble articulating clearly, or are too shy to pose. It is hoped that the Mad Hatter’s replies are of assistance to them as well as to Alice. The house of mathematics can be built in many different ways and students often have difficulty reconciling the formulations and constructions of one text with those of another. Quite often, we comment on such variations. In particular, two points in quantificational (first-order) logic always give trouble if variants are not compared explicitly. One concerns distinct, although ultimately equivalent, ways of reading the quantifiers; the other arises from differing conventions for using the terms ‘true’ and ‘false’ in application to formulae containing free variables.
Preface
ix
Choice of Topics Overall, our choice of topics is fairly standard, as can be seen from the chapter titles. If strapped for class time, an instructor can omit some later sections of some chapters, or even entire chapters that are not close to the interests of the students or the dictates of the curriculum. For example, few computer science curricula will require the material of Chaps. 10 and 11 (levels of inference, logic with relevance) and few philosophy students will be fired up by the Chap. 5 (counting) or the last part of Chap. 7 (on unrooted trees). But it is urged that Chaps. 1–3, the first four sections of Chap. 7, as well as 8 and 9, be taught uncut as just about everything in them is useful to everybody. We have not included a chapter on the theory of graphs. That was a difficult call to make, and the reasons for the decision were as follows. Although trees are a particular kind of graph, there is no difficulty in covering everything we want to say about rooted trees without entering into general graph theory. Moreover, an adequate treatment of graphs, even if squeezed into one chapter of about the same length as the others, takes a good two weeks of additional class time to cover properly with enough examples and exercises to make it sink in. The basic theory of graphs is a rather messy topic, with a rather high definition/theorem ratio and multiple options about how wide to cast the net (directed/undirected graphs, with or without loops, multiple edges and so on). The author’s experience is that students gain little from a high-speed run through a series of distinctions and definitions memorized for the examinations and then promptly forgotten. On the other hand, recursion and induction are developed in more detail than is usual in texts of this kind, where it is common to neglect recursive definition in favour of inductive proof and to restrict attention to the natural numbers. Although Chap. 4 begins with induction on the natural numbers it goes on to explain number-free forms of both inductive proof and recursive definition including, in particular the often-neglected structural forms that are so important for computer science, logic and theoretical linguistics. We also explain the very general versions based on arbitrary well-founded relations. Throughout the presentation, the interplay between recursive definition and inductive proof is brought out, with the latter piggy-backing on the former. This chapter ends up being the longest in the book. Instructors may be surprised that the chapters on logic do not attempt to drill readers in building derivations in formal notation, following what is known as a system of ‘natural deduction’. The reason is that the author, after years teaching a variety of such systems, has become convinced that they are of marginal pedagogical benefit. Students take a long time to become accustomed to the idiosyncrasies of whichever layout they are exposed to, tend to lose sight of essential principles in the finicky procedural details, and forget most of it as soon as the exams are over. Instead, Chap. 10, on proof and consequence, seeks to make clear the basic ideas that underlie natural deduction, explaining the difference between
x
Preface
first-level, second-level and split-level derivations as well as how to squeeze a derivation tree into a derivation sequence and how to flatten a split-level derivation into a format that mimics a first-level one. Finally, a decision had to be made whether to include specific algorithms in the book. Most first-year students of computing will be taking courses, in parallel, on principles of programming and some specific programming language; but the languages chosen differ from one institution to another and change over time. The policy in this text is to sketch the essential idea of basic algorithms in plain but carefully formulated English. Instructors wishing to link material with specific programming languages should feel free to do so. Courses Outside Computer Science Computer science students are not the only ones who need to learn about these topics. Students of mathematics, philosophy, as well as the more theoretical sides of linguistics, economics and political science, all need to master basic formal methods covering more or less the same territory. This text can be used, with some omissions and additions, for a ‘formal methods’ course in any of those disciplines. In the case of philosophy there was, in the second half of the twentieth century, an unfortunate tendency to teach only elementary logic, leaving aside any instruction on sets, relations, functions, recursion/induction, probability and trees. The few students going on to more advanced courses in logic were usually exposed to such tools in bits and pieces, but without a systematic grounding. Even within logic, the election of material was often quite narrow, focussing almost entirely on natural deduction. But as already remarked, it is difficult for the student to get a clear idea of what is going on in logic without having those other concepts available in the tool-kit. It is the author’s belief that all of the subjects dealt with in this book (with the exception of Chap. 5 on counting and the last two sections of Chap. 7, on unrooted trees) are equally vital for an adequate course for students of philosophy. With some additional practice on the subtle art of making approximate representations of statements from ordinary language in the language of propositional and predicate logic, the book can also be used as a text for such a course.
The Third Edition The first edition of this book was published in 2008; the second appeared in 2012 and the many changes made were itemized in the preface for that edition. This third edition adds Chap. 11, Sticking to the point: relevance in logic, which introduces procedures of syntactic control for logical consequence; it should be good fun for students of computing as well as those from philosophy.
Preface
xi
In previous editions, only about half of the exercises were accompanied by a solution and some readers using the text for self-study let the author know their unhappiness with that situation. This edition provides solutions to all exercises, mostly in full but occasionally in outline. It is hoped that, as a result, the text is friendlier than before to readers working alone and takes some of the burden off instructors. To be honest, the task of writing out solutions in full also helped better appreciate the student’s situation facing the exercises, leading to many modifications. Together, the solutions and new chapter increase the size of the book by about a third. Even more than in the first two editions, the third takes the time to inform readers of shorthand ways of speaking and useful ‘abuses of language’. Such information is more important than often realized. In the author’s experience, when a student has trouble assimilating a point, as often as not it is a result of misunderstanding the language in which it is made. The notation chosen for the text is the same as in the previous editions except for two items, both in the chapters on logic. For classical logical consequence, we now use the standard double turnstile ⊨ rather than ⊢, reserving the latter sign for consequence relations in general. For the substitution of a term t for all free occurrences of a variable x in a formula a we now write ax:=t instead of the more common notation a(t/x) used in the previous editions; this is to ensure that there can be no hesitation about which way round the substitution goes when t is itself a variable. To bring out its general structure, the book has now been divided into three broad parts: Sets (including mathematical objects built with them, such as relations and functions), Math (in the traditional quantitative sense focusing on counting and finite probability), and Logic. Of course, this partition leaves open the question where to put the chapter on induction and recursion, which begins with induction on the natural numbers while going on to general issues of structural and well-founded recursion and induction, as also the chapter on trees which, conversely, begins as part of the theory of relations but ends with a combinatorial flavour. The former was put in Sets, while the latter went into Math, but the reverse allocation would be almost as appropriate. As the third edition was being prepared a colleague asked whether, leaving aside all options of presentation, the book has content that is not easily found in other introductory texts. The author’s response is relayed here for anyone with the same question. Sections 4.6 (structural recursion and induction), 4.7.3 (defining functions by well-founded recursion on their domains) and 8.4.4 (most modular versions of sets of propositional formulae) bring within the grasp of a beginner important notions that are usually left unexplored. The same is true of most of Chap. 10 (consequence relations and higher-order rules of inference) as well as all of Chap. 11 (relevance in logic).
xii
Preface
A section of the author’s webpage https://sites.google.com/site/davidcmakinson/ is earmarked for material relating to this edition: typos and other errata, additional comments, further exercises, etc. As the text goes to press these rubrics are empty but, with the help of readers, they will surely soon be populated. Observations should go to [email protected]. London, UK February 2020
David Makinson
Acknowledgements The late Colin Howson and ensuing department heads at the London School of Economics (LSE) provided a wonderful working environment and the opportunity to test material in classes. Anatoli Degtyarev, Franz Dietrich, Valentin Goranko, George Kourousias, Abhaya Nayak and Xavier Parent provided helpful comments on drafts of the first two editions; George also helped with the diagrams. For the third edition, Chap. 11 benefitted from valuable remarks by Lloyd Humberstone, Abhaya Nayak, Xavier Parent, Nick Smith and Peter Smith. A number of readers and LSE students drew attention to typos that remained in the first two editions: Luc Batty, Alex Bendig, Michael Broschat, Panagiotis Dimakis, Niklas Fors, Rick Greer, Herbert Huber, Deng (Joe) Jingyuan, Regina Lai, Daniel Mak, Pascal Meier, Fredrik Nyberg, Daniel Shlomo. Thanks to you all.
Contents
Part I
Sets
1
Collecting Things Together: Sets . . . . . . . . 1.1 The Intuitive Concept of a Set . . . . . . 1.2 Basic Relations between Sets . . . . . . . 1.2.1 Inclusion . . . . . . . . . . . . . . . 1.2.2 Identity and Proper Inclusion 1.2.3 Diagrams . . . . . . . . . . . . . . . 1.2.4 Ways of Defining a Set . . . . 1.3 The Empty Set . . . . . . . . . . . . . . . . . 1.3.1 Emptiness . . . . . . . . . . . . . . 1.3.2 Disjoint Sets . . . . . . . . . . . . 1.4 Boolean Operations on Sets . . . . . . . . 1.4.1 Meet . . . . . . . . . . . . . . . . . . 1.4.2 Union . . . . . . . . . . . . . . . . . 1.4.3 Difference and Complement . 1.5 Generalised Union and Meet . . . . . . . 1.6 Power Sets . . . . . . . . . . . . . . . . . . . . 1.7 End-of-Chapter Exercises . . . . . . . . . 1.8 Selected Reading . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
3 3 4 4 6 9 12 13 13 14 15 15 17 21 25 27 31 35
2
Comparing Things: Relations . . . . . . . . . . . . . . . . 2.1 Ordered Tuples, Cartesian Products, Relations 2.1.1 Ordered Tuples . . . . . . . . . . . . . . . . 2.1.2 Cartesian Products . . . . . . . . . . . . . . 2.1.3 Relations . . . . . . . . . . . . . . . . . . . . . 2.2 Tables and Digraphs for Relations . . . . . . . . . 2.2.1 Tables . . . . . . . . . . . . . . . . . . . . . . . 2.2.2 Digraphs . . . . . . . . . . . . . . . . . . . . . 2.3 Operations on Relations . . . . . . . . . . . . . . . . 2.3.1 Converse . . . . . . . . . . . . . . . . . . . . . 2.3.2 Join, Projection, Selection . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
37 37 38 39 41 44 44 45 46 46 48
. . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
xiii
xiv
Contents
2.4
2.5
2.6
2.7
2.8 2.9 3
2.3.3 Composition . . . . . . . . . . . . . . . . . . . . . . 2.3.4 Image . . . . . . . . . . . . . . . . . . . . . . . . . . . Reflexivity and Transitivity . . . . . . . . . . . . . . . . . . 2.4.1 Reflexivity . . . . . . . . . . . . . . . . . . . . . . . . 2.4.2 Transitivity . . . . . . . . . . . . . . . . . . . . . . . Equivalence Relations and Partitions . . . . . . . . . . . 2.5.1 Symmetry . . . . . . . . . . . . . . . . . . . . . . . . 2.5.2 Equivalence Relations . . . . . . . . . . . . . . . . 2.5.3 Partitions . . . . . . . . . . . . . . . . . . . . . . . . . 2.5.4 The Partition/Equivalence Correspondence . Relations for Ordering . . . . . . . . . . . . . . . . . . . . . . 2.6.1 Partial Order . . . . . . . . . . . . . . . . . . . . . . 2.6.2 Linear Orderings . . . . . . . . . . . . . . . . . . . 2.6.3 Strict Orderings . . . . . . . . . . . . . . . . . . . . Closing with Relations . . . . . . . . . . . . . . . . . . . . . 2.7.1 Transitive Closure of a Relation . . . . . . . . 2.7.2 Closure of a Set Under a Relation . . . . . . . End-of-Chapter Exercises . . . . . . . . . . . . . . . . . . . Selected Reading . . . . . . . . . . . . . . . . . . . . . . . . .
Associating One Item with Another: Functions . 3.1 What is a Function? . . . . . . . . . . . . . . . . . 3.2 Operations on Functions . . . . . . . . . . . . . . 3.2.1 Domain and Range . . . . . . . . . . . . 3.2.2 Restriction, Image, Closure . . . . . . 3.2.3 Composition . . . . . . . . . . . . . . . . 3.2.4 Inverse . . . . . . . . . . . . . . . . . . . . . 3.3 Injections, Surjections, Bijections . . . . . . . . 3.3.1 Injectivity . . . . . . . . . . . . . . . . . . 3.3.2 Surjectivity . . . . . . . . . . . . . . . . . 3.3.3 Bijective Functions . . . . . . . . . . . . 3.4 Using Functions to Compare Size . . . . . . . 3.4.1 Equinumerosity . . . . . . . . . . . . . . 3.4.2 Cardinal Comparison . . . . . . . . . . 3.4.3 The Pigeonhole Principle . . . . . . . 3.5 Some Handy Functions . . . . . . . . . . . . . . . 3.5.1 Identity Functions . . . . . . . . . . . . . 3.5.2 Constant Functions . . . . . . . . . . . . 3.5.3 Projection Functions . . . . . . . . . . . 3.5.4 Characteristic Functions . . . . . . . . 3.5.5 Choice Functions . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . .
50 53 55 55 57 59 59 60 62 63 66 66 69 70 73 73 75 76 81
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
83 83 87 87 87 89 90 91 91 93 95 96 96 98 98 100 100 101 102 102 103
Contents
3.6
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
105 105 106 108 113
Recycling Outputs as Inputs: Induction and Recursion . . . . 4.1 What are Induction and Recursion? . . . . . . . . . . . . . . . . 4.2 Proof by Simple Induction on the Positive Integers . . . . . 4.2.1 An Example . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.2 The Principle Behind the Example . . . . . . . . . . 4.3 Definition by Simple Recursion on the Positive Integers . 4.4 Evaluating Functions Defined by Recursion . . . . . . . . . . 4.5 Cumulative Induction and Recursion . . . . . . . . . . . . . . . 4.5.1 Cumulative Recursive Definitions . . . . . . . . . . . 4.5.2 Proof by Cumulative Induction . . . . . . . . . . . . . 4.5.3 Simultaneous Recursion and Induction . . . . . . . 4.6 Structural Recursion and Induction . . . . . . . . . . . . . . . . 4.6.1 Defining Sets by Structural Recursion . . . . . . . . 4.6.2 Proof by Structural Induction . . . . . . . . . . . . . . 4.6.3 Defining Functions by Structural Recursion on Their Domains . . . . . . . . . . . . . . . . . . . . . . 4.7 Recursion and Induction on Well-Founded Sets . . . . . . . 4.7.1 Well-Founded Sets . . . . . . . . . . . . . . . . . . . . . . 4.7.2 Proof by Well-Founded Induction . . . . . . . . . . . 4.7.3 Defining Functions by Well-Founded Recursion on their Domains . . . . . . . . . . . . . . . . . . . . . . . 4.7.4 Recursive Programs . . . . . . . . . . . . . . . . . . . . . 4.8 End-of-Chapter Exercises . . . . . . . . . . . . . . . . . . . . . . . 4.9 Selected Reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
115 115 116 117 118 123 125 127 127 129 131 133 134 138
. . . .
. . . .
. . . .
. . . .
. . . .
140 144 144 147
. . . .
. . . .
. . . .
. . . .
. . . .
149 151 152 156
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
159 159 160 163 164 164 166 169 169 171
3.7 3.8 4
Part II 5
xv
Families and Sequences . . . . . . . 3.6.1 Families of Sets . . . . . . 3.6.2 Sequences and Suchlike End-of-Chapter Exercises . . . . . Selected Reading . . . . . . . . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
Maths
Counting Things: Combinatorics . . . . . . . . . . . . . . . . . . 5.1 Basic Principles for Addition and Multiplication . . . . 5.1.1 Principles Considered Separately . . . . . . . . . 5.1.2 Using the Two Principles Together . . . . . . . 5.2 Four Ways of Selecting k Items Out of n . . . . . . . . . 5.2.1 Order and Repetition . . . . . . . . . . . . . . . . . 5.2.2 Connections with Functions . . . . . . . . . . . . 5.3 Counting Formulae: Permutations and Combinations 5.3.1 The Formula for Permutations . . . . . . . . . . . 5.3.2 Counting Combinations . . . . . . . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
xvi
Contents
5.4
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
175 175 177 179 181 183
6
Weighing the Odds: Probability . . . . . . . . . . . . . . . . . . 6.1 Finite Probability Spaces . . . . . . . . . . . . . . . . . . . . 6.1.1 Basic Definitions . . . . . . . . . . . . . . . . . . . 6.1.2 Properties of Probability Functions . . . . . . 6.2 Philosophy and Applications . . . . . . . . . . . . . . . . . 6.2.1 Philosophical Interpretations . . . . . . . . . . . 6.2.2 The Art of Applying Probability Theory . . 6.2.3 Digression: A Glimpse of the Infinite Case 6.3 Some Simple Problems . . . . . . . . . . . . . . . . . . . . . 6.4 Conditional Probability . . . . . . . . . . . . . . . . . . . . . 6.4.1 The Ratio Definition . . . . . . . . . . . . . . . . . 6.4.2 Applying Conditional Probability . . . . . . . 6.5 Interlude: Simpson’s Paradox . . . . . . . . . . . . . . . . 6.6 Independence . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.7 Bayes’ Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.8 Expectation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.9 End-of-Chapter Exercises . . . . . . . . . . . . . . . . . . . 6.10 Selected Reading . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
185 185 186 188 190 190 192 192 193 196 197 199 205 207 210 214 217 221
7
Squirrel Math: Trees . . . . . . . . . . . . . . . 7.1 My First Tree . . . . . . . . . . . . . . . . . 7.2 Rooted Trees . . . . . . . . . . . . . . . . . 7.2.1 Explicit Definition . . . . . . . 7.2.2 Recursive Definitions . . . . . 7.3 Working with Trees . . . . . . . . . . . . 7.3.1 Trees Grow Everywhere . . . 7.3.2 Labelled and Ordered Trees 7.4 Interlude: Parenthesis-Free Notation . 7.5 Binary Trees . . . . . . . . . . . . . . . . . . 7.6 Unrooted Trees . . . . . . . . . . . . . . . . 7.6.1 Definition . . . . . . . . . . . . . 7.6.2 Properties . . . . . . . . . . . . . . 7.6.3 Spanning Trees . . . . . . . . . 7.7 End-of-Chapter Exercises . . . . . . . . 7.8 Selected Reading . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
223 223 226 226 228 230 230 231 234 236 239 240 241 244 246 248
5.5 5.6 5.7
Selections Allowing Repetition . . . . . . . . . . . . 5.4.1 Permutations with Repetition Allowed . 5.4.2 Combinations with Repetition Allowed Rearrangements . . . . . . . . . . . . . . . . . . . . . . . End-of-Chapter Exercises . . . . . . . . . . . . . . . . Selected Reading . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . .
. . . . . . . . . . . . . . . .
. . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
Contents
Part III
xvii
Logic
8
Yea and Nay: Propositional Logic . . . . . . . . . . . . . . . 8.1 What is Logic? . . . . . . . . . . . . . . . . . . . . . . . . . . 8.2 Truth-Functional Connectives . . . . . . . . . . . . . . . 8.3 Logical Relationship and Status . . . . . . . . . . . . . . 8.3.1 The Language of Propositional Logic . . . 8.3.2 Tautological Implication . . . . . . . . . . . . . 8.3.3 Tautological Equivalence . . . . . . . . . . . . 8.3.4 Tautologies, Contradictions, Satisfiability . 8.4 Normal Forms . . . . . . . . . . . . . . . . . . . . . . . . . . 8.4.1 Disjunctive Normal Form . . . . . . . . . . . . 8.4.2 Conjunctive Normal Form . . . . . . . . . . . 8.4.3 Least Letter Set . . . . . . . . . . . . . . . . . . . 8.4.4 Most Modular Version . . . . . . . . . . . . . . 8.5 Truth-Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.6 End-of-Chapter Exercises . . . . . . . . . . . . . . . . . . 8.7 Selected Reading . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
251 251 252 257 257 258 261 266 270 270 273 275 277 279 285 289
9
Something About Everything: Quantificational Logic . 9.1 The Language of Quantifiers . . . . . . . . . . . . . . . . 9.1.1 Some Examples . . . . . . . . . . . . . . . . . . . 9.1.2 Systematic Presentation of the Language . 9.1.3 Freedom and Bondage . . . . . . . . . . . . . . 9.2 Some Basic Logical Equivalences . . . . . . . . . . . . 9.2.1 Quantifier Interchange . . . . . . . . . . . . . . 9.2.2 Distribution . . . . . . . . . . . . . . . . . . . . . . 9.2.3 Vacuity and Re-lettering . . . . . . . . . . . . . 9.3 Two Semantics for Quantificational Logic . . . . . . 9.3.1 The Shared Part of the Two Semantics . . 9.3.2 Substitutional Reading . . . . . . . . . . . . . . 9.3.3 The x-Variant Reading . . . . . . . . . . . . . . 9.4 Semantic Analysis . . . . . . . . . . . . . . . . . . . . . . . . 9.4.1 Logical Implication . . . . . . . . . . . . . . . . 9.4.2 Clean Substitutions . . . . . . . . . . . . . . . . . 9.4.3 Fundamental Rules . . . . . . . . . . . . . . . . . 9.4.4 Identity . . . . . . . . . . . . . . . . . . . . . . . . . 9.5 End-of-Chapter Exercises . . . . . . . . . . . . . . . . . . 9.6 Selected Reading . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
291 291 292 293 297 298 298 300 301 304 304 306 309 312 313 316 317 319 320 324
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
327 327 328 330
10 Just Supposing: Proof and Consequence . 10.1 Elementary Derivations . . . . . . . . . . 10.1.1 My First Derivation Tree . . 10.1.2 The Logic behind Chaining .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
xviii
Contents
10.2 Consequence Relations . . . . . . . . . . . . . . . . . . . . . . 10.2.1 The Tarski Conditions . . . . . . . . . . . . . . . . 10.2.2 Consequence and Chaining . . . . . . . . . . . . . 10.2.3 Consequence as an Operation . . . . . . . . . . . 10.3 A Higher-Level Proof Strategy: Conditional Proof . . 10.3.1 Informal Conditional Proof . . . . . . . . . . . . . 10.3.2 Conditional Proof as a Formal Rule . . . . . . . 10.3.3 Flattening Split-Level Proofs . . . . . . . . . . . . 10.4 Other Higher-Level Proof Strategies . . . . . . . . . . . . . 10.4.1 Disjunctive Proof and Proof by Cases . . . . . 10.4.2 Proof by Contradiction . . . . . . . . . . . . . . . . 10.4.3 Proof Using Arbitrary Instances . . . . . . . . . 10.4.4 Summary Discussion of Higher-Level Proof 10.5 End-of-Chapter Exercises . . . . . . . . . . . . . . . . . . . . 10.6 Selected Reading . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Sticking to the Point: Relevance in Logic 11.1 Some Curious Classical Principles . . 11.2 A Bit of History . . . . . . . . . . . . . . . 11.3 Analyses of some Truth-Trees . . . . . 11.4 Direct Acceptability . . . . . . . . . . . . 11.5 Acceptability . . . . . . . . . . . . . . . . . 11.6 End-of Chapter Exercises . . . . . . . . 11.7 Selected Reading . . . . . . . . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
331 332 334 336 338 339 340 343 345 345 350 354 356 359 361
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
363 363 365 369 373 379 385 387
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389
Part I
Sets
1
Collecting Things Together: Sets
Chapter Outline In this chapter we introduce the student to the world of sets. Actually, only a little bit of it, enough to get going. After giving a rough intuitive idea of what sets are, we present the basic relations between them: inclusion, identity, proper inclusion, and exclusion. We describe two common ways of identifying sets, and pause to look more closely at the empty set. We then define some basic operations for forming new sets out of old ones: meet, union, difference and complement. These are often called Boolean operations, after George Boole, who first studied them systematically in the middle of the nineteenth century. Up to that point, the material is all ‘flat’ set theory, in the sense that it does not look at what else we can do when the elements of sets are themselves sets. However, we need to go a little beyond flatland. In particular, we need to generalize the notions of meet and union to cover arbitrary collections of sets, and introduce the very important concept of the power set of a set, that is, the set of all its subsets.
1.1
The Intuitive Concept of a Set
Every day you need to consider things more than one at a time. As well as thinking about a particular individual, such as the young man or woman sitting on your left in the classroom, you may focus on some collection of people—say, all those students who come from the same school as you do, or all those with red hair. A set is just such a collection, and the individuals that make it up are called its elements. For example, each student with green eyes is an element of the set of all students with green eyes. © Springer Nature Switzerland AG 2020 D. Makinson, Sets, Logic and Maths for Computing, Undergraduate Topics in Computer Science, https://doi.org/10.1007/978-3-030-42218-9_1
3
4
1
Collecting Things Together: Sets
What could be simpler? But be careful! There might be many students with green eyes, or none, or maybe just one, but there is always exactly one set of them. It is a single item, even when it has many elements. Moreover, whereas the students themselves are flesh-and-blood persons, the set is an abstract object, thus different from those elements. Even when the set has just one element, it is not the same thing as that unique element. For example, even if Achilles is the only person in the class with green eyes, the corresponding set is distinct from Achilles; it is an abstract item and not a person. To anticipate later terminology, the set whose only element is Achilles is often called the singleton for that element, written as {Achilles}. The elements of a set need not be people. They need not even be physical objects; they may in turn be abstract items. For example, they can be numbers, geometric figures, items of computer code, colours, concepts, or whatever you like —and even other sets, which in turn may have sets as elements, and so on. The further reaches of set theory deal with such higher-level sets, but we will not need to go so far. At least to begin with, we will need to consider only sets of items that are not themselves sets (flat sets, or sets of degree zero) and sets of them (sets of degree one). To avoid the unsettling repetition that occurs in the term ‘set of sets’, we will also speak synonymously of a collection, or class of sets. We need a notation to represent the idea of elementhood. We write x 2 A for x is an element of A, and x 62 A for x is not an element of A. Here, A is always a set, while x may or may not be a set; in the simpler examples it will not be one. The sign 2 is derived from one of the forms of the Greek letter epsilon.
1.2
Basic Relations between Sets
Sets can stand in various relations to each other, notably inclusion, identity, proper inclusion and these relationships can diagramed, as explained in this section.
1.2.1 Inclusion One basic relation is that of inclusion. When A, B are sets, we say that A is included in B (or: A is a subset of B) and write A B iff every element of A is an element of B. In other words, iff for all x, if x 2 A then x 2 B. Put in another way that is often useful: iff there is no element of A that is not an element of B. Looking at the same relation from the reverse direction, we also say that B includes A (B is a superset of A) and write B A. For brevity, we write A ⊈ B to mean that A is not included in B.
1.2 Basic Relations between Sets
5
Alice Box: iff Alice Hatter
Alice
Hatter
Hold on, what’s this ‘iff’? It’s not in my dictionary. Too bad for your dictionary. The expression was introduced around the middle of the last century by the mathematician Paul Halmos, as a handy shorthand for ‘if and only if’, and soon became standard among mathematicians. OK, but aren’t we doing some logic here? I see words like ‘if’, ‘only if’, ‘every’, ‘not’, and perhaps more. Shouldn’t we begin by explaining what they mean? We are, and we could. But life will be easier if for the moment we just use these particles intuitively. We will get around to their exact logical analysis later.
Exercise 1.2.1 Which of the following sets are included in which? Use the notation above, and express yourself as succinctly and clearly as you can. Recall that a prime number is a positive integer greater than 1 that is not divisible by any positive integer other than itself and 1. A: The set of all positive integers less than 10 B: The set of all prime numbers less than 11 C: The set of all odd numbers greater than 1 and less than 6 D: The set whose only elements are 1 and 2 E: The set whose only element is 1 F: The set of all prime numbers less than 8. Solution Each of these sets is included in itself, and each of them is included in A. In addition, we have C B, E D, F B, B F, C F. None of the other converses hold. For example, B ⊈ C, since 7 2 B but 7 62 C. Note also that E ⊈ B, since we are not taking 1 to be a prime number. Warning Box: Subset versus element Avoid saying that A is ‘contained’ in B, as this is rather ambiguous. It can mean that A B, but it can also mean that A 2 B. These are not the same, and should never be confused. For example, the integer 2 is an element of the set N+ of all positive integers, but it is not a subset of N+. Conversely, the set E of all even integers is a subset of N+, i.e. each of its elements 2, 4, 6, … is an element of N+; but E itself is not an element of N+. Neglect of this distinction quickly leads to serious confusion.
6
1
Collecting Things Together: Sets
1.2.2 Identity and Proper Inclusion A basic principle of set theory, called the axiom (or postulate) of extensionality, says that whenever sets A and B have exactly the same elements then they are identical; they are one and the same set, and we write A = B. Clearly, A and B have exactly the same elements iff both A B and B A. So we can also say: A = B iff both A B and B A. When A B but A 6¼ B then we say that A is properly included in B, and write A B. Sometimes is written with a small 6¼ underneath. That should not cause any confusion, but another notational dialect is more dangerous: a few older texts use A B for plain inclusion. Be wary when you read. Exercise 1.2.2 (1) In Exercise 1.2.1, which of the sets are identical to which? Solution B = F (so that also F = B). And, of course, A = A, B = B etc., since each of the listed sets is identical to itself. Comment: The fact that we defined B and F in different ways makes no difference: the two sets have exactly the same elements and so by the axiom of extensionality they are identical. By the way, in set theory we do not distinguish between identity and equality; they are synonyms for the same concept. Exercise 1.2.2 (2) Which among the sets in the preceding exercise, are properly included in which? In each case give a ‘witness’ to the proper nature of the inclusion, that is, identify an element of the right one that is not an element of the left one. Solution All of B through F are proper subsets of A, with 9 and 8 as witnesses for all of them. Also, C B with witnesses 2,7; E D with sole witness 2. Comment: F 6 B, since B and F have exactly the same elements. Exercise 1.2.2 (3) Which of the following claimed identities are correct? Read the curly braces as framing the elements of the set so that, for example, {1, 2, 3} is the set whose elements are just 1, 2, 3. Be careful with the answers. (a) {1, 2, 3} = {3, 2, 1}, (b) {9, 5} = {9, 5, 9}, (c) {0, 2, 8} = {|√4|, 0/5, 23}, (d) {7} = 7, (e) {8} = {{8}}, (f) {London, Beijing} = {Londres, Pekin}, (g) {+} = {‘+’}. Solution (a) Yes. The order of enumeration makes no difference: the sets have the same elements. (b) Yes. Repeating an element in the enumeration is inelegant, but it makes no substantive difference: the sets still have the same elements. (c) Yes. The elements have been named differently, as well as being written in a different order, but they are the same.
1.2 Basic Relations between Sets
7
(d) No. 7 is a number while {7} is a set with 7 as its only element, i.e. its singleton. (e) No. Both are sets, and both have just one element, but these elements are not the same. The unique element of the left set is the number 8, while the unique element of the right set is the set {8}. The left set is thus the singleton of the right one. (f) Yes. London is the same city as Londres, and Beijing is the same city as Pekin, although they are named differently. So the sets have exactly the same elements and thus are identical. (g) No. The left set has the operation of addition as its sole element while, under a standard convention for naming by inverted commas, the right set has as its sole element a certain sign serving as the standard name of that operation, so the sets are not identical. End of solution.
The distinction between an object and its name is particularly important when dealing with symbols, as is often the case in computer science, logic, linguistics and some parts of mathematics; its neglect can lead to confusion. That said, it is also the practice among mathematicians to omit the visually distracting inverted commas whenever the context makes it clear that we are considering the symbol rather than what it names. Philosophers tend to be less tolerant. The line between sloppiness and fussiness is fine. Exercise 1.2.2 (4) True or false? In each case use your intuition to make a guess, and establish it by either proving the point from the definitions (if you guessed positively) or giving a simple counterexample (if you guessed negatively). Make sure that you don’t confuse with . (a) (b) (c) (d) (e) (f) (g) (h)
Whenever A B and B C then A Whenever A B and C B then A Whenever A1 A2 … An and also A B iff A B and B ⊈ A. A B iff A B or A = B. A = B iff neither A B nor B A. Whenever A B and B C then A Whenever A B and B C then A
C. C. An A1 then Ai = Aj for all i, j n.
C. C.
Solution (a) True. Take any sets A, B, C. Suppose A B and B C; it suffices to show A C. Take any x, and suppose x 2 A; by the definition of inclusion, it is enough to show x 2 C. But since x 2 A and A B we have by the definition of inclusion that x 2 B. So since also B C we have again by the definition of inclusion that x 2 C, as desired. (b) False. Counterexample: A = {1}, B = {1,2}, C = {2}.
8
1
Collecting Things Together: Sets
(c) True, by essentially the same argument as for (a) repeated sufficiently many times. In more detail: it suffices to show Ai Aj for all i, j n. Take any x, and suppose x 2 Ai; by the definition of inclusion, it is enough to show x 2 Aj. By the given inclusions, we have x 2 Ai+1, x 2 Ai+2, …, x 2 Aj following upwards or round in a loop as needed to Aj. Strictly speaking, we are arguing by induction on the positive integers, to be analysed in Chap. 4. (d) True. First, suppose the RHS, we want to show the LHS. Since B ⊈ A there is an x with x 2 B and x 62 A, so A 6¼ B so, since A B, the definition of strict inclusion tells us that A B. Next, suppose the LHS, we want to show the RHS. We can run essentially the same argument in reverse. Since A B, the definition of strict inclusion tells us that A B but A 6¼ B. From the latter, A does not have exactly the same elements as B, but by the former every element of A is an element of B, so there is some x 2 B with x 62 A, so by the definition of strict inclusion again, B ⊈ A. (e) True. First, suppose the LHS, we want to show the RHS. Now, if A 6¼ B then by the definition of strict inclusion, A B and we are done. For the converse, suppose the RHS. If A = B then A has exactly the same elements as B so by the definition of inclusion, A B, while if A B we again have A B by the definition of strict inclusion. (f) False. The left to right implication is correct, but the right to left one is false, so the entire co-implication (the ‘iff’) is also false. Counterexample: A = {1}, B = {2}. (g) True. Take any sets A, B, C. Suppose A B and B C. From the latter by the definition of proper inclusion we have B C. So by exercise (a) we have A C. It remains to show that A 6¼ C. Since B C we have by exercise (d) that C ⊈ B; but A B by supposition, so A 6¼ C as desired. (h) True, by essentially the same argument as for (g).
Logic Box: Proving conditional statements In Exercise 1.2.2 (4), we needed to show several statements of the form ‘if the first then the second’, and followed the most straightforward way of doing so: we supposed that the first is true, and on that basis showed that the second is true. This is known as conditional proof. For example, in the verification of part (a), we did it twice. First, we supposed that A B and B C, and set our goal as showing A C. That means that whenever x 2 A then x 2 C, so we then supposed that x 2 A, and aimed to get x 2 C. There are other lines of attack for establishing ‘if…then…’ statements, but we will come to them later. In the exercise, there also other logical procedures; for example, in part (a) again, we take any x, and suppose x 2 A. We will have a little more to say about such steps as we go on, and considerably more in the Chap. 10, Sect. 10.3.
1.2 Basic Relations between Sets
9
Exercise 1.2.2 (4) is the first in which you are asked to show something, but it is certainly not the last. As well as the logic of such proofs, there are some general points of common sense that you need to bear in mind when trying to prove, or disprove, something. First, always be clear in your mind (and on paper) what you are trying to show. If you don’t know what you are attempting to prove, it is unlikely that you will succeed in proving it and if by chance you do, the proof will probably be a real mess. Following this rule is not as easy as may appear for, as a proof develops, the goal changes! For example, looking again at part (a) of the preceding exercise, we began by trying to show (a) itself. After choosing A, B, C arbitrarily, our goal was the conditional statement: If A B and B C then A C. Then, after supposing both A B and B C, our goal became A C. We then chose an arbitrary x, supposed x 2 A, and aimed to show x 2 C. In just a few lines, four different goals! At each stage we have to be aware of which one we are driving at. When we start using more sophisticated tools for building proofs, notably reductio ad absurdum, the goal-shifts become even more striking. A second rule of common sense when proving things: as far as possible, be aware of what you are allowed to use, and don’t hesitate to use it. If you neglect available information, you may not have enough to do the job. So what are you allowed to use? Essentially, three kinds of resource. To begin with, you may use the definitions of terms in the problem (in our example, the notions of subset and proper subset). Too many students come to mathematics with the idea that a definition is just something for decoration—something you can hang on the wall like a picture or diploma. A definition is for use. Indeed, in a very simple verification, most of the steps can consist of ‘unpacking’ the definitions and then, after just a little reasoning, packing them together again. Next, you may use whatever basic axioms (also known as postulates) that you have been supplied with. In the last exercise, that was just the principle of extensionality, stated at the beginning of the section. Finally, you can use anything that you have already proven. For example, we did this while proving part (g) of the exercise. Third point of common sense: be flexible and ready to go into reverse. If you can’t prove that a statement is true, try looking for a counterexample in order to show that it is false. If you can’t find a counterexample, try to prove that it is true. With some experience, you can often use the failure of your attempted proofs as a guide to finding a suitable counterexample, and the failures of your trial counterexamples to give a clue for constructing a proof. This is all part of the art of proof and refutation.
1.2.3 Diagrams If we think of a set A as represented by all the points in a circle (or any other closed plane figure) then we can represent the notion of one set A being a proper subset of another B by putting a circle labelled A inside a circle labelled B. We can diagram
10
1
Collecting Things Together: Sets
Fig. 1.1 Euler diagrams for proper inclusion and identity
equality, of course, by drawing just one circle and labelling it both A and B. Thus we have the Euler diagrams of Fig. 1.1, so named after the eighteenth century mathematician Euler who used them when teaching a princess by correspondence. How can we diagram inclusion in general? Here we must be careful. There is no single Euler diagram that does the job. When A B then we may have either of the above two configurations: if A B then the left diagram is appropriate, if on the other hand A = B then the right diagram is the correct one. Diagrams are a very valuable aid to intuition, and it would be pedantic and unproductive to try to do without them. But we must also be clearly aware of their limitations. If you want to visualize A B using Euler diagrams, and you don’t know whether the inclusion is proper, you will need to consider two diagrams and see what happens in each, or add some annotation to the diagram for A B. However, there is another kind of diagram that can represent plain inclusion without ambiguity. It is called a Venn diagram (after the nineteenth century logician John Venn). It consists of drawing two circles, one for A and one for B, always intersecting no matter what the relationship between A and B, and then putting a mark (e.g. ∅) in an area to indicate that it has no elements, and another kind of mark (say, a cross) to indicate that it does have at least one element. With these conventions, the left diagram of Fig. 1.2 represents A B while the right diagram represents A B.
Fig. 1.2 Venn diagrams for inclusion and proper inclusion
1.2 Basic Relations between Sets
11
Note that the disposition of the circles is always the same: what changes are the areas noted as empty or as non-empty. There is considerable variability in the signs used for this—dots, ticks, etc. A great thing about Venn diagrams is that they can represent common relationships like A B by a single diagram, rather than by an alternation of different diagrams. Another advantage is that they can be adapted to represent basic operations on sets as well as relations between them. However, they also have shortcomings. When you have more than two sets to consider, Venn diagrams can become complicated and lose their intuitive clarity—which was, after all, their principal raison d’être. Alice Box: Venn and Euler Alice Hatter
Alice
Hatter
Alice Hatter
So, Venn diagrams are not the same as Euler diagrams? As different as chalk and cheese. They are constructed differently and read differently. Unfortunately, people are sometimes rather confused about the names, using the terms interchangeably or even in reverse. Another question. You said that in Venn diagrams, we indicate that an area is non-empty by putting a cross. But how do we represent non-emptiness in Euler diagrams? That’s a delicate point. The usual convention for Euler diagrams is that all areas considered are non-empty; under that convention there is no way of representing non-emptiness. But in practice, one occasionally sees people mixing the layout of Euler with the annotations of Venn, adding crosses or ∅ signs to various parts of their Euler diagram. Is that legitimate? Can we mix chalk with cheese? Well, diagrams are like these are heuristic devices, not rigorous methods of proof. So, it can be legitimate, so long as it helps intuition and provided you make it clear what conventions you are following.
Exercise 1.2.3 (1) (a) Suppose we want to diagram the double proper inclusion A B C. We can, of course, do it with two separate Euler (or Venn) diagrams. Do it with a single diagram of each kind, with three circles. (b) Suppose we want to represent the two proper inclusions A B, A C in a single diagram with three circles. How many different Euler diagrams are compatible with this configuration? What kind of difficulty do you get into with placing crosses in the Venn diagram, and how might you resolve it?
12
1
Collecting Things Together: Sets
Solution Outline (a) Euler is straightforward: put the A circle inside the B circle, and that inside the C circle. For Venn, put ∅ in the smallest areas that must be empty, then place crosses in the smallest areas that must be non-empty. You will end up with three areas marked ∅ and two marked by crosses (b) When constructing Euler diagrams, think of the various possible relations between B and C. You will end up with four diagrams, according as B = C, B C, C B and none of the above, i.e. where B, C properly intersect with each other. When building the Venn diagram try to proceed as you did for (a). Again, you will end up with three areas marked ∅ and two marked by crosses, but the crosses will need to be placed in boundary lines rather than inside cells to indicate, in a rather ad hoc manner, that there is something on one or the other side of the boundary.
1.2.4 Ways of Defining a Set The examples we have so far looked at already illustrate two important ways of defining or identifying a set. One is to specify all its elements individually, say by listing them between curly brackets, as we did in Exercise 1.2.2 (3). Evidently, such a specification can be completed only when there are finitely many elements, and it is convenient only when the set is fairly small. The order of enumeration makes no difference to what items are elements of the set, e.g. {1,2,3} = {3,1,2}, but we usually write elements in some conventional order such as increasing size for smooth communication. Another way of identifying a set is by providing a common property: the elements of the set are understood to be all (and only) the items that have that property. That is what we did for most of the sets in Exercise 1.2.1. There is a notation for this. For example, we write the first set as follows: A = {x 2 N+: x < 10}, where N+ stands for the set of all integers greater than zero (the positive integers). Some texts use a vertical bar in place of a colon. Exercise 1.2.4 (1) (a) Identify the sets A, B, C, F of Exercise 1.2.1 by enumeration. (b) Identify the sets D, E of the same exercise by properties, using the notation introduced. Solution (a) A = {1,2,3,4,5,6,7,8,9}; B = {2,3,5,7}; C = {3,5}, F = {2,3,5,7}. (b) There are many ways of doing this, here are some. D = {x 2 N+: x divides all even integers}; E = {x 2 N+: x is less than or equal to every positive integer}. End of solution.
1.2 Basic Relations between Sets
13
When a set is infinite, we often use an incomplete ‘suspension points’ notation. Thus, we might write the set of all even positive integers and the set of all primes respectively as follows: {2,4,6, …}, {2,3,5,7,11, …}. But it should be emphasized that this is an informal way of writing, used when it is well understood between writer and reader what particular continuation is intended. Clearly, there are many ways of continuing each of these partial enumerations, and normally it is the most familiar or simplest is the one that is meant. Without a specific understanding of that kind, the notation is meaningless. We can also use the suspended dots notation to abbreviate a finite set. Thus, in the exercise above, we could write as A = {1, …, 9}. Again, this is an informal notation; it hovers between two formal ones: complete enumeration or by a common property. These two ways of identifying a set are not the only ones available. In a later chapter we will be looking at another very important way, known as recursive definition, where one specifies certain initial elements of the set, and a rule for generating new elements out of old ones. It can be thought of as a mathematically precise way of expressing the idea that is hinted at by writing suspension points.
1.3
The Empty Set
Just as zero is a very important natural number, the empty set is basic to set theory. Just as mathematics took a very long time to come up with a clear conceptualization and standard notation for zero, so students can have some initial difficulties with emptiness. By the end of this section, such difficulties should be over.
1.3.1 Emptiness What do the following two sets have in common? A ¼ fx 2 N þ : x is both even and oddg B ¼ fx 2 N þ : x is prime and 24 x 28g Neither of them has any elements. From this it follows that they have exactly the same elements—neither has any element that is not in the other. So by the principle of extensionality given in Sect. 1.2.2 they are identical, that is, they are the same set. In other words, A = B, even though they are described differently. This leads to the following definition. The empty set is defined to be the (unique) set that has no elements at all. It is written ∅. We already used this notation informally in Venn diagrams, when indicating that a certain region of the diagram has no elements. The fact that it has no elements does not mean that it has any less ‘existence’ than other sets, any more than zero has less existence than the positive numbers.
14
1
Collecting Things Together: Sets
Exercise 1.3.1 (1) Show that ∅ A for every set A. Solution We need to show that for all x, if x 2 ∅ then x 2 A. In other words: there is no x with x 2 ∅ but x 62 A. But by the definition of ∅, there is no x with x 2 ∅, so we are done. Alice Box: If…then… Alice
Hatter
Alice Hatter
The solution to Exercise 1.3.1 (1) is certainly short, but rather strange. You say ‘in other words’, but are the two formulations really equivalent? Indeed they are. This is because of the way in which we understand ‘if…then…’ statements in mathematics. We could explain that in detail now, but it is probably better to come back to it a bit later. Another promise? Indeed!
1.3.2 Disjoint Sets We say that sets A, B are disjoint (aka mutually exclusive) iff they have no elements in common. That is, iff there is no x such that both x 2 A and x 2 B. When they are not disjoint, that is, when they have at least one element in common, we can say that they overlap. More generally, when A1, …, An are sets, we say that they are pairwise disjoint iff for any i, j n, if i 6¼ j then Ai has no elements in common with Aj. Exercise 1.3.2 (1) (a) (b) (c) (d) (e)
Of the sets in Exercise 1.2.1, which are disjoint from which? Draw Euler and Venn diagrams to express the disjointness of two sets. Draw a Venn diagram to express the overlapping of two sets. How many Euler diagrams would be needed to express overlapping? Give an example of three distinct sets X, Y, Z such that X is disjoint from Y and Y is disjoint from Z, but X, Y, Z are not pairwise disjoint. (f) Show that the empty set is disjoint from every set, including itself.
Solution (a) D is disjoint from C, E is disjoint from B and from C, F is disjoint from E. And, of course, when one set is disjoint from another, that other is disjoint from the first.
1.3 The Empty Set
15
(b) In the Euler diagram you will have two circles quite separate from each other. In the Venn diagram you will put ∅ in the common part of the two circles. (c) Put a cross in the common part of the two circles. (d) If we follow the standard convention for Euler diagrams that all areas are non-empty, then we need four diagrams to represent four alternative ways in which the overlapping can occur. If we don’t follow that convention and don’t allow mixed diagrams, we can’t represent overlapping by a Euler diagram at all—indeed, we can’t even diagram the non-emptiness of a single set. (e) One simple example: put X = {1,2}, Y = {3}, Z = {1,4}. (f) Since the empty set has no elements, it has no elements in common with any set, not even with itself.
1.4
Boolean Operations on Sets
We now define some operations on sets, that is, ways of constructing new sets out of old beginning, in this section, with three basic ones: meet, union, and relative complement.
1.4.1 Meet If A and B are sets, we define their meet A \ B, also known as their intersection, by the following rule: for all x, x 2 A \ B iff x 2 A and x 2 B: Of the two terms, ‘meet’ and ‘intersection’, the former is short while the latter is perhaps more graphic. Mathematicians and computer scientists tend to favour meet, and we will do the same. Exercise 1.4.1 (1) Show the following: (a) (b) (c) (d) (e) (f) (g)
A \ B A and A \ B B. Whenever X A and X B then X A \ B. A \ B = B \ A (commutation). A \ (B \ C) = (A \ B) \ C (association). A \ A = A (idempotence). A \ ∅ = ∅ (bottom). Reformulate the definition of disjoint sets using meet.
16
1
Collecting Things Together: Sets
Solution For (a): To show A \ B A, notice that whenever x 2 A \ B then immediately by the definition of meet we have x 2 A and we are done. Similar reasoning shows A \ B B. For (b): Suppose X A and X B; we want to show X A \ B. Take any x and suppose x 2 X; we need to show that x 2 A \ B. Since x 2 X and X A we have by the definition of inclusion that x 2 A; similarly, since x 2 X and X B we have x 2 B. So, by the definition of meet, x 2 A \ B as desired. For (c): Take any x and suppose x 2 A \ B. Then x 2 A and x 2 B so x 2 B and x 2 A, so x 2 B \ A. This shows A \ B B \ A. The converse is verified similarly. It can also be seen as saying the same thing with the choice of variables A, B reversed, and so is already established by the first verification. For (d): Take any x and suppose x 2 A \ (B \ C). Then x 2 A and x 2 B \ C, so in turn x 2 B and x 2 C. Thus x 2 A and x 2 B, also x 2 A and x 2 C, so x 2 A \ B, also x 2 A \ C, and hence x 2 (A \ B) \ C. The converse is verified similarly. For (e): Clearly x 2 A iff both x 2 A and x 2 A. For (f): We already have A \ ∅ ∅ by (a) above. And we also have ∅ A \ ∅ by Exercise 1.3.1 (1), so we are done. For (g): Sets A, B are disjoint iff A \ B = ∅. End of solution. Property (a) in Exercise 1.4.1 (1) may be expressed in words by saying that A \ B is a lower bound for A, B. Property (b) tells us that it is a greatest lower bound for A, B. These notions will be useful in later chapters on relations. Heuristics Box: Unpack, reason, repack The solutions to the above exercises exhibit a pattern that reappears whenever we carry out simple verifications of basic properties. We unpack the notions involved in the problem to be solved, using their definitions, rearrange and reason with the information thus obtained, and pack up again using the same definitions. Of course, less simple verifications will require more, but the heuristic works well for basic ones. Meet has been defined using the word ‘and’. But what does this mean? In mathematics it is very simple—much simpler than in ordinary life. Consider any two statements a, b. Each can be true, or false, but not both. When is the statement ‘a and b’, called the conjunction of the two parts, true? The answer is intuitively clear: when each of a, b considered separately is true, the conjunction is true, but in all other cases the conjunction is false. What are the other cases? There are three of them: atrue with b false, a false with btrue, a false with bfalse. All this can be put in the form of a truth-table, presented in the logic box for conjunction.
1.4 Boolean Operations on Sets
17
Logic Box: Conjunction a 1 1 0 0
b 1 0 1 0
a^b 1 0 0 0
In each row, the left two entries represent a possible combination of truth-values of the parts a, b. For brevity we write 1 for ‘true’ and 0 for ‘false’. The rightmost entry in the row gives us the resulting truth-value of the conjunction ‘a and b’, which we write as a ^ b Clearly, the truth-value of the conjunction is fully determined by each combination of truth-values of the parts. For this reason, conjunction is called a truth-functional logical connective. In a later chapter we will study the properties of conjunction and other truth-functional connectives. As you may already have noticed in Exercise 1.4.1 (1), the behaviour of meet (as an operation on sets) reflects that of conjunction (as a connective between statements), because of the direct way in which the latter is used in the definition of the former. For example, the commutativity of meet comes from the fact that ‘a and b’ has exactly the same truth-conditions as ‘b and a’. For reflection: How do you square the truth-table for conjunction with the difference in meaning between ‘They got married and had a baby’ and ‘They had a baby and got married’?
1.4.2 Union Alongside meet we have another operation called union. The two operations are known as duals of each other, in the sense that each is like the other ‘upside down’. For any sets A and B, we define their union A [ B by the following rule. For all x: x 2 A [ B iff x 2 A or x 2 B; where this is understood in the sense: x 2 A [ B iff x 2 A or x 2 B ðor bothÞ; in other words: x 2 A [ B iff x is an element of at least one of A; B:
18
1
Collecting Things Together: Sets
The contrast with meet may be illustrated by Venn diagrams, but they are read differently from those used earlier. Now that we are representing operations rather than statements, we no longer pepper the diagram with ∅ and crosses to say that regions are empty or not. Instead, we shade regions to indicate that they are the ones given by the operation. Thus in the diagrams of Fig. 1.3, two intersecting circles continue to represent the sets A, B, and the shaded area in the left image represents A [ B, while in the right one it represents A \ B. The properties of union are just like those of meet but ‘upside down’. Evidently, this is a rather vague way of speaking; it can be made precise, but it is better to leave the idea on an intuitive level for the present. Exercise 1.4.2 (1) Show the following: (a) (b) (c) (d) (e) (f)
A A [ B and B A [ B. Whenever A X and B X then A [ B X. A [ B = B [ A (commutation). A [ (B [ C) = (A [ B) [ C (association). A [ A = A (idempotence). A [ ∅ = A (bottom).
Solution Outline Re-run ‘upside down’ the solution to Exercise 1.4.1 (1). Exercise 1.4.2 (2) What might you naturally call principles (a) and (b), given the names of their counterparts for meet? Solution For (a): upper bound, for (b): least upper bound. End of solution. When ‘or’ is understood in the sense used in the definition of union, it is known as inclusive disjunction, or briefly just disjunction. Statements ‘a or b’ are written as a _ b. Whereas there is just one way (out of four) of making a conjunction true, there is just way of making a disjunction false. The truth-table is given in the logic box for disjunction.
Fig. 1.3 Venn Diagrams for union and meet
1.4 Boolean Operations on Sets
19
Just as with meet and conjunction, the properties of union between sets reflect those of disjunction as a connective between statements, essentially because of the direct way in which the logical connective is used to define the set-theoretic operation. Logic Box: Disjunction a 1 1 0 0
b 1 0 1 0
a_b 1 1 1 0
Clearly, the truth-value of the disjunction is fully determined by each combination of truth-values of the parts. In other words, it is also a truth-functional logical connective.
Exercise 1.4.2 (3) In ordinary discourse we often use ‘a or b’ to mean ‘either a, or b, but not both’, in other words, ‘exactly one of a, b is true’. This is called exclusive disjunction. What would its truth-table look like? Solution The same table as for inclusive disjunction except that in the top row a _ b is given the value 0. We have seen some of the basic properties of meet and of union, taken separately. But how do they relate to each other? The following exercise covers the most important interactions. Exercise 1.4.2 (4) Show the following: (a) (b) (c) (d) (e)
A A A A A
\ BA [ B \ (A [ B) = A = A [ (A \ B) (absorption) \ (B [ C) = (A \ B) [ (A \ C) (distribution of meet over union) [ (B \ C) = (A [ B) \ (A [ C) (distribution of union over meet) B iff A [ B = B, and likewise iff A \ B = A.
20
1
Collecting Things Together: Sets
Solution In the following answers we use the familiar abbreviations LHS, RHS for the left, right sides respectively of a statement of inclusion or of identity. (a) If x 2 LHS then x 2 A and x 2 B, so x is an element of at least one of A, B, so x 2 RHS. (b) We already know from the exercises on meet and on union taken separately that A \ (A [ B) A and that A A [ (A \ B). It remains to show the two converse inclusions. For A A \ (A [ B), suppose x 2 A. Then also x 2 A [ B, so x 2 A \ (A [ B). For A [ (A \ B) A, suppose x 2 A [ (A \ B). Then x 2 A or x 2 A \ B, and in both cases x 2 A. (c) We need to show that LHS RHS and conversely RHS LHS. For LHS RHS, suppose that x 2 LHS. Then x 2 A and x 2 B [ C. From the latter we have that either x 2 B or x 2 C. Consider the two cases separately. Suppose first that x 2 B. Since also x 2 A we have x 2 A \ B and so by Exercise 1.4.2 (1) part (a) we get x 2 (A \ B) [ (A \ C) = RHS. Suppose alternatively that x 2 C. Since also x 2 A we have x 2 A \ C and so again x 2 (A \ B) [ (A \ C) = RHS. Thus, both cases give us 2 (A \ B) [ (A \ C) = RHS as desired. For RHS LHS, suppose that x 2 RHS. Then x 2 A \ B or x 2 A \ C. Consider the two cases separately. Suppose first that x 2 A \ B. Then x 2 A and x 2 B; from the latter x 2 B [ C, and so combined with the former, x 2 A \ (B [ C) = LHS as desired. Suppose second that that x 2 A \ C. The argument is similar: x 2 A and x 2 C; from the latter x 2 B [ C, and so with the former, x 2 A \ (B [ C) = LHS as desired. (d) We give only the hint: work in the same spirit as for (c). (e) We show A B iff A [ B = B. Suppose first that A B; we need to show A [ B = B. Now B A [ B always holds, as shown in an earlier exercise, so we need only show that A [ B B. But if x 2 A [ B then either x 2 A or x 2 B. But since by supposition A B, x 2 B and we are done.
Logic Box: Breaking into cases In several parts of Exercise 1.4.2 (4) we used a technique known as or disjunctive proof. Suppose we know that either a is true or b is true, but we don’t know which. It can be difficult to proceed with this rather weak information. So, we break the argument into two parts. First, we suppose that a is true (one case) and with this stronger assumption we head for whatever it was that we were trying to establish. Then we suppose instead that bis true (the other case) and argue using this assumption to the same conclusion. If we succeed in reaching the desired conclusion in each case separately, then we know that it must hold irrespective of which case is true. Unlike conditional proof, disjunctive proof holds the goal unchanged throughout. Sometimes, the arguments carried out under the two suppositions resemble each other, sometimes they are quite different. But the suppositions
1.4 Boolean Operations on Sets
21
themselves must be made quite separately: we cannot use one of them in the argument for the other. Closely related to disjunctive proof is a procedure known as proof by cases. We have a set A of premises and we want to get a conclusion c. It can sometimes be useful to articulate a suitable proposition b, first add the supposition that b is true, then the supposition that b is false. If we can get c in each of these two cases separately, then we know that it follows from the premises in A considered alone. There are subtle differences between disjunctive proof and proof by cases but in informal practice, as in this chapter, they are almost indistinguishable; we leave the fine points of discussion to Chap. 10, Sect. 10.4.1, where they are both studied in detail. Sometimes we need to break cases into subcases, and so on—in principle without limit. But when the case-depth becomes too large, the proof becomes rather inelegant, and it can be a good idea to search for a neater one.
Exercise 1.4.2 (5) As an example of proof by cases in arithmetic, show that every positive integer n has the same parity as n2, that is, if n is even or odd then so is respectively n2. Solution Suppose for the first case that n is even. Then n = 2k for some positive integer k, so n2 = 2k 2k = 4k2, which is even. Suppose for the other case that n is odd. In the sub-case that n = 1 we have n2 = 1, which is odd. In the sub-case that n > 1, we have n = 2k + 1 for some positive integer k, so n2 = (2k + 1)2 = 4k2 + 4k + 1, which is odd. Alice Box: Overlapping cases Alice Hatter
What if both cases are true? For example, in the solution to exercise 1.4.2 (4) (c), in the part for LHS RHS: what if both x 2 B and x 2 C? No problem! This just means that we have covered that situation twice. For proof by cases to work, it is not required that the two cases be exclusive. In some examples (as in our exercise) it is easier to work with overlapping cases, while in others it is more elegant and economical to work with cases that exclude each other.
1.4.3 Difference and Complement There is one more Boolean operation on sets that we wish to consider: difference. Let A, B be any sets. We define the difference of B within A (also called A less B),
22
1
Collecting Things Together: Sets
written A\B (alternatively as A − B) to be the set of all elements of A that are not elements of B. That is, A\B = {x: x 2 A but x 62 B}. Exercise 1.4.3 (1) (a) (b) (c) (d) (e) (f) (g) (h)
Draw a Venn diagram for A\B. Give an example to show that we can have A\B 6¼ B\A. Show (i) A\A = ∅, (ii) A\∅ = A. Show that (i) if A A′ then A\B A′\B and (ii) if B B′ then A\B′ A\B. Show that (i) A\(B [ C) = (A\B) \ (A\C), (ii) A\(B \ C) = (A\B) [ (A\C). Show that (A\B)\C = (A\C)\B. Find a counterexample to A\(B\C) = (A\B)\C. Show that A\(B\C) (A\B) [ C.
Solution Outline (a) It is like the right diagram in Fig. 1.3 but with just the left crescent shaded. (b) For a simple example where neither of A, B includes the other, put A = {1,2}, B = {2,3}. Then A\B = {1} 6¼ {3} = B\A. For another kind of example, takes any sets A, B where ∅ 6¼ A B, e.g. A = {1}, B = {1,2}; then ∅ = LHS 6¼ RHS = {2}. (c) For (i), x 2 A\A iff x 2 A and x 62 A, which is impossible, showing that A\A = ∅. For (ii), x 2 A\∅ iff x 2 A and x 62 ∅, which holds just if x 2 A. (d) For (i), suppose A A′ and x 2 A\B. From the latter supposition, x 2 A and x 62 B so, using the former supposition, x 2 A′ and x 62 B, so x 2 A′\B. For (ii), reason along similar lines. (e) For (i), we first show LHS RHS. Suppose x 2 LHS. Then x 2 A and x 62 B [ C, so x 62 B and x 62 C, so both x 2 A and x 62 B and x 2 A and x 62 C, so that x 2 RHS as desired. For the converse LHS RHS, run the same argument backwards. For (ii) argue in the same fashion. (f) We first show LHS RHS. Suppose x 2 LHS. Then x 2 A\B and x 2 6 C so, from the former, x 2 A and x 2 6 B. Putting two of these together, x 2 A\C and so, combining with x 2 6 B, we have x 2 RHS as desired. For the converse, argue in similar fashion. (g) Here is a very simple example: take A to be any non-empty set, e.g. {1}, and put C = B = A. Then LHS = A\(A\A) = A\∅ = A while RHS = (A\A)\A = ∅ \A = ∅. (h) Suppose x 2 LHS. Then x 2 A and x 62 B\C. From the latter, either x 62 B or x 2 C. In the former case, x 2 A\B, so in both cases x 2 (A\B) [ C and we are done. End of solution.
Logic Box: Negation You will have noticed that in our discussion of difference there are a lot of nots. In other words, we made free use of the logical connective of negation in our reasoning. What is its logic? Like conjunction and disjunction, it has a truth-table, which is a simple flip-flop.
1.4 Boolean Operations on Sets
a 1 0
23
a 0 1
The properties of difference and complementation stem, in effect, from the behaviour of negation used in defining them. The difference operation acquires particular importance in a special context. Suppose that we are carrying out an extended investigation into the elements of a fairly large set, such as the set N+ of all positive integers, and that for the purposes of the investigation the only sets that we need to consider are the subsets of that set, which we therefore consider as ‘fixed’. Then it is customary to refer to the fixed set as a local universe writing it, say, as U, and consider the differences U\B for subsets B U. As the set U is fixed throughout the investigation, we then simplify notation and write U\B alias U − B as −UB, or even simply as −B with U left as understood. This application of the difference operation is called complementation (within the given universe U). Many other notations are also used in the literature for this important operation, for example B-, B′, Bc (where the index stands for ‘complement’). To give it a Venn diagram, we simply take the diagram for relative complement A\B and blow the A circle up to coincide with the whole box containing the diagram, so as to serve as the local universe. Exercise 1.4.3 (2) (a) Taking the case that A is a local universe U, rewrite equations (e) (i) and (ii) of the preceding exercise using the simplest of the complementation notations mentioned above. (b) Show that (i) −(−B) = B, (ii) −U = ∅, (iii) −∅ = U. Solution (a) (i) −(B [ C) = −B \ −C; (ii) −(B \ C) = −B [ −C. To be strict, the right-hand sides should have more brackets with (−B) \ (−C), (−B) [ (−C) respectively, but a convention about the scope of the complementation operation, like the minus sign in arithmetic, permits us to omit the brackets, reducing clutter. (b) (i) We need to show that −(−B) = B, in other words that U\(U\B) = B whenever B U (as is assumed when U is taken to be a local universe). We show the two inclusions separately. First, to show U\(U\B) B, suppose x 2 LHS. Then x 2 U and x 62 (U\B). From the latter, either x 62 U or x 2 B. Putting these together we have x 2 B = RHS as desired. For the converse, suppose x 2 B. Then x 62 U \B. But by assumption B U so x 2 U, and thus x 2 U\(U\B) = LHS as desired.
24
1
Collecting Things Together: Sets
(b) (ii) It suffices to show that nothing is an element of the LHS, so it suffices to suppose that x 2 LHS and get a contradiction. Suppose that x 2 LHS. Then x 2 U\U, so x 2 U and x 62 U, which is impossible as required. (b) (iii) Suppose x 2 LHS. Then x 2 U\∅ so x 2 U = RHS. Suppose conversely that x 2 U. Now we know that x 62 ∅, so x 2 U\∅ = LHS. End of solution. The identities −(B \ C) = −B [ −C and −(B [ C) = (−B \ −C) are known as de Morgan’s laws, after the nineteenth century mathematician who drew attention to them. The identity −(−B) = B is known as double complementation. Note how its proof made essential use of the assumption that B U. Exercise 1.4.3 (3) Show that if B ⊈ U, then U\(U\B) 6¼ B. Solution Suppose B ⊈ U. Then there is an x with x 2 B and x 62 U, and from the latter we have x 62 U\(U\B), so RHS 6¼ LHS. Alice Box: Complementation Alice
Hatter
There is something about complementation that I don’t quite understand. As you define it, the complement −B of a set B is always taken with respect to a given local universe U; it is U−B for a given set B. But why not define it in absolute terms? Put the absolute complement −B of B to be the set of all x that are not in B. Then, if you need a complement relative to some B, put U − B = U \ −B. A natural idea indeed! Unfortunately, it leads to contradiction, so we cannot follow it.
A laconic reply: Alice deserves more than that. You may have heard of Russell’s paradox, which considers the set of all those sets that are not elements of themselves, i.e. {x: x is a set and x 62 x}. Call this set S. Question: do we have S 2 S or S 62 S? Suppose first that S 2 S. Then, by the very definition of S, we get S 62 S, giving a contradiction. Suppose on the other hand that S 62 S. Since S is a set, the definition of S gives us S 2 S, again a contradiction. We are forced to conclude that there is no such set S—contrary to initial expectations. Axiomatic set theory developed as a way of generating the sets that we need for mathematical work while avoiding those that lead to such paradoxes; the standard axiom system in use today is Zermelo-Fraenkel set theory, ZF for short, or ZFC when the axiom of choice is included. How does this relate to absolute complement, as defined by Alice? Suppose that we admit absolute complements. Then, given the empty set ∅, there is a set
1.4 Boolean Operations on Sets
25
−∅ = {x: x 62 ∅}. Since ∅ has no elements, −∅ has everything as an element: it is an ‘absolutely universal’ set U with x 2 U for all x whatsoever. Now one of the principles of Zermelo-Fraenkel set theory is that given any set A and any property expressible in purely set-theoretic terms, there is a set consisting of exactly those items that are elements of A and have the property. This is called the axiom of separation. So, choosing A to be the absolutely universal set U and taking the property of ‘being a set that is not an element of itself’, we get a set whose elements are just those sets x 2 U such that x 62 x. By the definition of U, this is just Russell’s set S = {x: x is a set and x 62 x}, and we can apply the same argument as before to get a contradiction. In summary, any set theory that, like ZF, admits the principle of separation must reject the absolutely universal set and so, if it also admits the empty set, must reject absolute complementation. To be sure, there are some versions of set theory that, unlike ZF, do admit the universal set and absolute complementation. The best known is called NF (short for ‘New Foundations’) devised by the logician W.V.O. Quine. To avoid contradiction, they give up the principle of separation, which in turn leads to losing many important theorems, especially about infinite sets; there are also many important results that can be retained but with much more complex formulations and proofs. For this reason, such systems are not in general favoured by working mathematicians or computer scientists. Our presentation of the ‘nuts and bolts’ of set theory follows the ideas of ZFC, but there is no need for the reader to study its axiomatization to understand what is going on. Moreover, the lack of a universal set and absence of an operation of absolute complementation are not troublesome for our work. Whenever you feel that you need to have some elbow-room, just look for a set that is sufficiently large to contain all the items that you are currently working on, using it as your ‘local universe’ for relative complementation. If, however, your curiosity has been aroused, and you would like to read more on absolute complementation, the universal set, ZF and NF, you can follow up with references mentioned at the end of this chapter.
1.5
Generalised Union and Meet
It is time to go a little beyond the cosy world of ‘flat’ set theory and look at some sets whose elements are themselves sets. We begin with the operations of generalised union and meet. We know that when A1, A2 are sets then we can form their union A1 [ A2, whose elements are just those items that are in at least one of A1, A2. Evidently, we can repeat the operation, taking the union of A1 [ A2 with another set A3, giving us (A1 [ A2) [ A3. We know from an exercise that this is independent of the order of assembly, i.e. (A1 [ A2) [ A3 = A1 [ (A2 [ A3). Thus, its elements are just those
26
1
Collecting Things Together: Sets
items that are elements of at least one of the three, and we might as well write it without brackets as A1 [ A2 [ A3. Clearly, we can do this any finite number of times, and so it is natural to consider doing it infinitely many times. In other words, if we have sets A1, A2, A3, … we would like to consider a set A1 [ A2 [ A3 [ … whose elements are just those items in at least one of the Ai for i 2 N+. To make the notation more explicit, we write this set as [ {Ai: i 2 N+} or more compactly as [ {Ai}i2N+ or as [ i2N+{Ai}. The sign is the same as that for binary union; often it is written rather larger than the binary operation but we write it in the same font except when a larger size makes easier reading. Quite generally, if we have a collection {Ai: i 2 I} of sets Ai, one for each element i of a fixed set I, we may consider the following two sets: • [ i2I{Ai}, whose elements are just those things that are elements of at least one of the Ai for i 2 I. It is called the union of the sets Ai for i 2 I. • \ i2I{Ai}, whose elements are just those things that are elements of all of the Ai for i 2 I. It is called the meet (or intersection) of the sets Ai for i 2 I. When there is any possibility of confusing the signs for generalized union and meet with those for the two-place versions, they are customarily written larger, as in the exercise below. They are natural generalizations, and their properties are similar. For example, we have de Morgan and distribution principles. These are the subject of the next exercise. Alice Box: Sets, collections, classes, families Alice
Hatter
Alice Hatter
One moment! Why did you refer to {Ai: i 2 I} as a collection while its elements Ai, and its union [ i2I{Ai} and meet \ i2I{Ai}, are sets? Shouldn’t you say that {Ai: i 2 I} is a set of sets? The difference of words does not mark a difference of content. It is merely to make reading easier. The human mind has difficulty in processing phrases like ‘set of sets’, and even more with ‘set of sets of sets’; the use of a word like ‘collection’ or ‘class’ helps keep us on track. I think I have also seen the word ‘family’. Here you should be a little careful. Sometimes the term ‘family’ is used rather loosely to refer to a set of sets. But strictly speaking, it means something a little different, a certain kind of function. So better not to use that term until it is explained in Chap. 3.
1.5 Generalised Union and Meet
27
Exercise 1.5 (1) From the definitions of general union and meet, prove the following distribution and de Morgan principles. In the last two, complementation is understood to be relative to an arbitrary sufficiently large universe. (a) (b) (c) (d)
A \ ( [ i2I{Bi}) = [ i2I (A \ Bi} (distribution of meet over general union) A [ ( \ i2I{Bi}) = \ i2I (A [ Bi} (distribution of union over general meet) − [ i2I{Ai} = \ i2I{−Ai} (de Morgan) − \ i2I{Ai} = [ i2I{−Ai} (de Morgan).
Solution These are simple ‘unpack, rearrange, repack’ verifications. For each of them we show the inclusion LHS RHS; for the converse inclusion RHS LHS, you should check that the same arguments can be run backwards (in other words, that the steps all correspond to iffs). (a) Suppose x 2 LHS. Then x 2 A and x 2 [ i2I{Bi}. From the latter, by the definition of general union, we know that x 2 Bi for some i 2 I. So for this i 2 I we have x 2 A \ Bi, and thus again by the definition of general union, x 2 RHS as desired. For the converse, check that the same argument works backwards. (b) Suppose x 2 LHS. Then either x 2 A or x 2 \ i 2I{Bi}. By the definition of general meet, the latter implies that x 2 Bi for all i 2 I. So, in both cases, x 2 A [ Bi for all i 2 I, and thus again by the definition of general meet, x 2 RHS as desired. For the converse, check that the same argument works backwards. (c) Suppose x 2 LHS. Then x 62 [ i2I{Ai} so x 62 Ai for all i 2 I, so x 2 −Ai for all i 2 I, so x 2 RHS. (d) Suppose x 2 LHS. Then x 62 \ i2I{Ai} so x 62 Ai for some i 2 I, so x 2 −Ai for some i 2 I, so x 2 RHS.
1.6
Power Sets
Our next construction is a little more challenging. Let A be any set. We may form a new set, called the power set of A, written as P(A) or 2A, consisting of all (and only) the subsets of A. In other words, P(A) = {B: B A}. This may seem like a rather exotic construction, but we will need it as early as Chap. 2 when working with relations. Exercise 1.6 (1) Let A = {1,2,3}. List all the elements of P(A). Using the list, define P(A) itself by enumeration. How many elements does P(A) have?
28
1
Collecting Things Together: Sets
Solution with warning The elements of P(A) are as follows, beginning with the smallest and working our way up: ∅, {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3}. Thus P(A) = {∅,{1},{2}, {3},{1,2},{1,3},{2,3}, {1,2,3}}. Counting, we see that P(A) has 8 elements. Warning: Do not forget the two ‘extreme’ elements of P(A): the smallest subset A, namely ∅, and the largest one, namely A itself. Also be careful with the curly brackets. Thus 1, 2, 3 are not elements of P(A), but their singletons {1}, {2}, {3} are. When defining P(A) by enumeration, the curly brackets may seem like pedantic points of punctuation, but if they are missed then you can easily get into a dreadful mess. End of solution. All the elements of P(A) are subsets of A, but some of them are also subsets of others. For example, the empty set is a subset of all of them. This may be brought out clearly by the following Hasse diagram, called after the mathematician who introduced it (Fig. 1.4). Exercise 1.6 (2) Draw Hasse diagrams for the power sets of each of ∅, {1}, {1,2}, {1,2,3,4} and count how many elements does each of these power sets has. Solution Outline They have 1, 2, 4 and 16 elements respectively. End of solution. There is a pattern here. Quite generally, if A is a finite set with n elements, its power set P(A) has 2n elements. Here is a rough but simple proof. Let a1, …, an be the elements of A. Consider any subset B A. For each ai there are two possibilities: either ai 2 B or ai 62 B. That gives us 2 2 … 2 (n times) = 2n independent choices to determine which among a1, …, an are elements of B, thus 2n possible identities for B. This fact is very important for computing. Suppose that we have a way of measuring the cost of a computation as a function of, say, the number of input items. It can happen that this measure increases in proportion to 2n, i.e. is of the
Fig. 1.4 Hasse diagram for P(A) when A = {1,2,3}
1.6 Power Sets
29
form k 2n for some fixed k. This is known as exponential growth and it is to be avoided whenever possible, as it quickly leads to unfeasibly expensive calculations. For example, suppose that such a process is dealing with an input of 10 items. Now 210 = 1024, which may seem reasonable. But if the input has 100 items to deal with, we have 2100 steps to be completed, which would take a very long time indeed (try writing it out in decimal notation). In this chapter we have frequently made use of if…then… (alias conditional) statements, as well as iff (alias biconditional) ones. It is time to fulfill a promise to Alice to make their meanings clear. In mathematics, they are used in a very simple way. Like conjunction, disjunction, and negation, they are truth-functional. The biconditional is perhaps the easier of the two to grasp; the logic box for ‘iff’ gives its truth-table. Logic Box: Truth-table for ‘iff’ The biconditional a if and only if b, written briefly as a iff b and, in formal notation, as a $ b, is true whenever a and b have the same truth-value, and false whenever they have opposite truth-values. Its table is as follows. a
b
a$b
1 1 0 0
1 0 1 0
1 0 0 1
The table for the conditional is rather more difficult for students to assimilate. It differs from the biconditional in its third row. Logic Box: Truth-table for ‘if’ The conditional if a then b, in formal notation a ! b, is true in all cases except one, namely the ‘disastrous combination’ that a is true and b is false. a
b
a!b
1 1 0 0
1 0 1 0
1 0 1 1
From the table one can see that a ! b is always true except in the situation described in the second row. Comparing the two tables, it is easy to check that a $ b is true just when a ! b and its converse b ! a are both true.
30
1
Collecting Things Together: Sets
Alice Box: The truth-table for the conditional Alice
Hatter
Well, at least you kept your promise! But I am not entirely satisfied. I see why the ‘disastrous combination’ makes if a then b false. But why do all the other combinations make it come out true? The two statements a and b may have nothing to do with each other, like ‘London is in France’ and ‘kangaroos are fish’. These are both false, but it is strange to say that the statement ‘if London is in France then kangaroos are fish’ is true. Indeed, it is rather strange and, to be frank, in everyday life we use if…then… in subtle ways that are more complex than any truth-table. But in mathematics, one uses the conditional in the simplest possible manner, which is that given by the truth-table. Moreover, it turns out that this way of understanding the conditional underlies all the other ones, in the sense that it is an important ingredient in their analysis.
Once again, we should say a bit more than the Hatter. Here is an example that may not entirely convince you, but it should make the truth-table rather less strange. We know that all positive integers divisible by four are even. This is, in effect, a universally generalized conditional. It says: for every positive integer n, if n is divisible by four then it is even. So for every particular choice that we make of a positive integer n, the statement if n is divisible by four then it is even, is true. For example, the following three are all true: If 8 is divisible by 4 then it is even If 2 is divisible by 4 then it is even If 9 is divisible by 4 then it is even: But the first of these corresponds to the top row of our truth-table (both components true); the second corresponds to the third row (a false, b true); the last corresponds to the fourth row (both components false)—while in each of these three cases, as we noted, the conditional is true. The following exercise, due to Dov Gabbay, also helps bring out the same point. Exercise 1.6 (2) A shop hangs a sign in the window, saying ‘If you buy a computer, then you get a free printer’. The relevant government office suspects the shop of false advertising, and sends agents disguised as customers to purchase something and report back on what happened. Agent 1 buys a computer and gets a free printer. Agent 2 buys a computer but is not offered a free printer. Agents 3 and 4 buy wi-fi modems, and while agent 3 does not get a free printer, in a burst of generosity agent 4 does. Which of these configurations would justify charging the manager with false advertising?
1.6 Power Sets
31
Solution Evidently, only the second. The first fulfills the promise, while in the third and fourth the condition of the promise is not satisfied. End of solution. Finally, we recall the names of some familiar sets of numbers. We have already mentioned the set N+ = {1, 2, 3, …} of all positive integers. Some other number sets that we will need to refer to are the following. N = N+ [ {0}, i.e. the set consisting of zero and all the positive integers. This is usually called the set of the natural numbers. Warning: Some authors use this name to refer to the positive integers only. Be wary when you read. Z = {0, ±1, ±2, ±3, …}, the set of all integers (positive, negative and zero). Z-= {…, −3, −2, −1} = Z\N, which is the set of all negative integers. Q = {p/q: p, q 2 Z and q 6¼ 0}, the set of all rational numbers (positive, negative and zero). R = the set of all real numbers, also representable as the set of all numbers of the form p + d1d2… where p 2 Z and d1d2… is an ending or unending decimal (series of digits from 0 to 9).
1.7
End-of-Chapter Exercises
Exercise 1 (1) Boolean operations on sets We define the operation A + B of symmetric difference (sometimes known as disjoint union) by putting A + B = (A\B) [ (B\A). Notations vary: often ⊕ is used for this operation, sometimes D. (a) Show that for any x, x 2 A + B iff x is an element of exactly one of A, B. (b) Draw a Venn diagram for the operation (and use it to help intuition in what follows). (c) Show that A + B A [ B. Give a simple counter-example to the converse. (d) Show that A + B is disjoint from A \ B. (e) Show that A + B = (A [ B)\(A \ B). (f) For each of the following properties of [ , check out whether it also holds for +, giving a proof or a counterexample as appropriate: (i) commutativity, (ii) associativity, (iii) distribution of \ over +, (iv) distribution of + over \ . (g) Express −(A + B) using union, meet, complement. (h) We have seen that each of meet, union and difference corresponds to a truth-functional logical connective. To what connective mentioned in this chapter does symmetric difference correspond? Draw its truth-table.
32
1
Collecting Things Together: Sets
Solution (a) Suppose first that x 2 A + B. Then x 2 (A\B) [ (B\A) so either x 2 (A\B) or (B \A). In the former case, x is an element of exactly one of A, B, and the same holds in the latter case. For the converse, run the same argument backwards. (b) Take the diagram for A [ B in Fig. 1.3 and de-shade the cell in the middle. (c) Suppose x 2 LHS. Then x 2 (A\B) [ (B\A) so either x 2 (A\B) or (B\A). In the former case, x 2 A so x 2 A [ B, while in the latter case, x 2 B so x 2 A [ B. For a counter-example to the converse, put A = {1,2}, B = {2,3}. Then, 2 2 A [ B but 2 62 A + B. (d) Suppose x 2 A \ B. Then x 2 A and x 2 B, so x 62 A\B and x 62 B\A so x 62(A \B) [ (B\A) = A + B. (e) Suppose first that x 2 LHS. Then x 2 (A\B) [ (B\A) so either x 2 (A\B) or (B \A). In both cases x 2 A [ B, and in both cases x 62 A \ B, so x 2 RHS. For the converse, suppose x 2 RHS. Then x 2 A [ B and x 62 A \ B. From the former, either x 2 A or x 2 B. If x 2 A then since x 62 A \ B we have x 2 LHS; similarly when x 2 B. (f) (i) Yes. We need to show that A + B = B + A. But LHS = (A\B) [ (B\A) = (B \A) [ (A\B) = RHS and we are done. (g) (ii) Yes. We need to show that (A + B) + C = A + (B + C). For one direction, suppose x 2 LHS. Then x 2 (A + B)\C or x 2 C\(A + B). In the first case, x 2 A + B and x 62 C. Since x 2 A + B we have either x 2 A while x 62 B or x 2 B while x 62 A. In the first of these two sub-cases we have x 2 A and x 62 B + C so x 2 RHS. In the second of the two sub-cases we have x 62 A and x 2 B + C so again x 2 RHS as desired. The converse can be verified in the same spirit. (e) (iii) Yes. We need to show that A \ (B + C) = (A \ B) + (A \ C). For one direction, suppose x 2 LHS. Then x 2 A, x 2 B + C so x is in exactly one of B, C, so x is in exactly one of A \ B, A \ C, so x 2 RHS. For the converse, re-run the argument in the reverse direction. (f) (iv) No! We need to find a counter-example to A + (B \ C) = (A + B) \ (A + C). Put A = B = {1} and C = ∅. Then 1 2 LHS but 1 62 A + B so 1 62 RHS. (g) −(A + B) = (A \ B) [ (−A \ −B). (h) Exclusive disjunction. The table is like that for inclusive disjunction given in Sect. 1.4.2 except that in the top row we have 0 for a _ b.
Alice Box: Running in the reverse direction Alice Hatter Alice
Hold on! Before we do any more exercises, I have a question. Fire away! In several of the exercises so far, the proposed solution said that the converse can be verified by running the same argument in the
1.7 End-of-Chapter Exercises
Hatter
Alice Hatter
33
reverse direction. But, how can I know in advance that this can be done without hitting a snag? With experience one can anticipate this quite well, but you can’t know for sure in advance; you need to do the reverse run and check that there are no hidden obstacles. And sometimes there are obstacles. For example, you can easily verify the inclusion (A + B) \ (A + C) A + (B \ C) but, as we have just seen in (f) (iv), the converse fails. So, strictly speaking, such answers are incomplete, with pointers for completion? Exactly.
Exercise 1 (2) Counting principles for Boolean operations When A is a finite set we write #(A) for the number of elements that it contains. Use the definitions of the Boolean operations together with your knowledge of elementary arithmetic to verify the following for finite sets. They will all be used in the chapter on counting. #(A [ B) #(A) + #(B), but sometimes #(A [ B) < #(A) + #(B). #(A [ B) = #(A) + #(B) − #(A \ B). When A, B are disjoint then #(A [ B) = #(A) + #(B). #(A \ B) min(#(A), #(B)), but sometimes #(A \ B) < min(#(A), #(B)). Here, min(m, n) is whichever is the lesser of the integers m, n. (e) Formulate a necessary and sufficient condition for the equality #(A \ B) = min(#(A), #(B)) to hold.
(a) (b) (c) (d)
Solution (a) If you count the elements of A, then count the elements of B, you will certainly have counted all the elements of A [ B. But if A, B have any common elements, you will have counted them twice, making #(A) + #(B) > #(A [ B). A simple example: put A = {1} = B. Then #(A [ B) = 1 < 2 = #(A) + #(B). (b) We can calculate #(A [ B) by counting #(A), adding #(B), and taking away the number of items that we counted twice, that is, subtracting #(A \ B). (c) When A, B are disjoint then #(A \ B) = 0, so (b) gives us the desired equality. (d) Since A \ B A and A \ B B we have #(A \ B) #(A) and #(A \ B) #(B) so #(A \ B) min(#(A), #(B)). For a simple example of the two sides not being equal, put A = {1}, B = {2}. Then #(A \ B) = 0 < 1 = min(#(A), # (B)). (e) Either A B or B A.
34
1
Collecting Things Together: Sets
Exercise 1 (3) Generalized union and meet (a) Let {Ai}i2I be any collection of sets. Show that for any set B we have (i) [ {Ai}i2I B iff Ai B for every i 2 I, (ii) B \ {Ai}i2I iff B Ai for every i 2 I. (b) Find a collection {Ai}i2N of non-empty sets with each Ai Ai+1 but with \ {Ai}i2N empty. (c) Why can’t (b) be done for some finite collection {Ai}i2I of non-empty sets? Solution (a) (i) For the left-to-right implication, suppose [ {Ai}i2I B. Let i 2 I and take any x 2 Ai. We need to show x 2 B. But since x 2 Ai we have x 2 [ {Ai}i2I and so by our supposition x 2 B. For the converse, suppose Ai B for every i 2 I. Let x 2 [ {Ai}i2I. We need to show x 2 B. But since x 2 [ {Ai}i2I we have x 2 Ai for some i 2 I so, by the supposition, x 2 B. (ii) For the left-to-right implication, suppose B \ {Ai}i2I. Let x 2 B and choose any i 2 I. We need to show x 2 Ai. But since x 2 B the supposition tells us that x 2 \ {Ai}i2I and so x 2 Ai. For the converse, suppose B Ai for every i 2 I. Let x 2 B. We need to show x 2 \ {Ai}i2I. But since x 2 B the supposition tells us that x 2 Ai for every i 2 I so x 2 \ {Ai}i2I as desired. (b) Put A0 = N, A1 = A0\{0} and quite generally An+1 = An\{n}. Then the collection {Ai}i2N has the desired properties. In particular, \ {Ai}i2N is empty because each n 62 An+1. (c) If the collection {Ai}i2N is finite and each Ai Ai+1 then \ {Ai}i2I = Ak which by supposition is non-empty. Exercise 1(4) Power sets (a) Show that whenever A B then P(A) P(B). (b) True or false: P(A \ B) = P(A) \ P(B)? Give a proof or a counterexample. (c) True or false? P(A [ B) = P(A) [ P(B). Proof or counterexample. Solution (a) Suppose A B and X 2 P(A). Then X A so X B so X 2 P(B). (b) True. X 2 LHS iff X A \ B, iff X A and X B, iff X 2 P(A) and X 2 P(B), iff X 2 RHS. (c) False. Put A = {1}, B = {2}. Then {1,2} 2 LHS but {1,2} 62 RHS.
1.8 Selected Reading
1.8
35
Selected Reading
For a very gentle introductions to sets, which nevertheless takes the reader up to an outline of the Zermelo-Fraenkel axioms for set theory, see E. D. Bloch Proofs and Fundamentals: A First Course in Abstract Mathematics, Springer 2011 (second edition), chapter 3. For more on the axiomatizations ZF and NF, as well as on the universal set and absolute complementation, consult also the articles on those topics, as well as on Russell’s paradox, on the websites of The Stanford Encyclopedia of Philosophy and Wikipedia. A classic and beautiful exposition but presupposing a certain mathematical sophistication, is Paul R. Halmos Naive Set Theory, Springer, 2001 (new edition), chapters 1–5, 9. It is short on exercises and readers should, instead, verify systematically all claims made in the text. The present material is also covered, with lots of exercises, in Seymour Lipschutz Set Theory and Related Topics, McGraw Hill Schaum’s Outline Series, 1998, chapters 1 and 2 as well as chapters 5.1–5.3.
2
Comparing Things: Relations
Chapter Outline Relations play an important role in computer science, both as tools of analysis and for representing computational structures such as databases. In this chapter we introduce the basic concepts you need to master in order to work with them. We begin with the notions of an ordered pair (and more generally, ordered n-tuple) and the Cartesian product of two more or more sets, from which one may define the notion of a relation. We then consider operations on relations, notably those of forming the converse, join, and composition of relations, as well as some other operations that make relations interact with sets, notably the image and the closure of a set under a relation. We also explore two of the main jobs that relations are asked to carry out: to classify and to order. For the task of classifying we explain the notion of an equivalence relation (reflexive, transitive, symmetric) over a set and how it corresponds to the notion of a partition of the set. For ordering, we look at several kinds of reflexive order, and then at their strict parts.
2.1
Ordered Tuples, Cartesian Products, Relations
What do the following have in common? One car overtaking another; a boy loving a girl; one tree being shadier than another; an integer dividing another; a point lying between two others; a set being a subset of another; a student exchanging one book for another with a friend.
© Springer Nature Switzerland AG 2020 D. Makinson, Sets, Logic and Maths for Computing, Undergraduate Topics in Computer Science, https://doi.org/10.1007/978-3-030-42218-9_2
37
38
2
Comparing Things: Relations
They are all examples of relations involving at least two items—in some instances three (one point between two others), four (the book exchange), or more. Often they involve actions, intentions, the passage of time, and causal connections; but in mathematics and computer science we abstract from all those features and work with a very basic, stripped-down concept. To explain what it is, we begin with the notions of an ordered tuple and Cartesian product.
2.1.1 Ordered Tuples Recall from the preceding chapter that when a set has exactly one element, it is called a singleton. When it has exactly two distinct elements, it is called a pair. For example, the set {7,9} is a pair, and it is the same as the pair {9,7}. We have {7,9} = {9,7} because the order is irrelevant: the two sets have exactly the same elements. An ordered pair is like a (plain, unordered) pair except that order matters. To highlight this, we use a different notation. The ordered pair whose first element is 7 and whose second element is 9 is written as (7,9) or, in older texts, . It is distinct from the ordered pair (9,7) although they have the same elements. In other words, (7,9) 6¼ (9,7) because the elements are considered in a different order. Abstracting from this example, the criterion for identity ordered pairs is as follows: (x1,x2) = (y1,y2) iff both x1 = y1 and x2 = y2. This contrasts with the identity criterion for plain sets: {x1,x2} = {y1,y2} iff the left and right hand sets have exactly the same elements, which, it is not difficult to show, holds iff either (x1 = y1 and x2 = y2) or (x1 = y2 and x2 = y1). More generally, the criterion for identity of two ordered n-tuples ðx1 ; x2 ; . . .; xn Þ and ðy1 ; y2 ; . . .; yn Þ is as you would expect: ðx1 ; x2 ; . . .; xn Þ ¼ ðy1 ; y2 ; . . .; yn Þ iff xi = yi for all i from 1 to n. Exercise 2.1.1 Check in detail the claim that {x1,x2} = {y1,y2} iff either (x1 = y1 and x2 = y2) or (x1 = y2 and x2 = y1). Solution From right to left: suppose either (x1 = y1 and x2 = y2) or (x1 = y2 and x2 = y1). We consider the case that x1 = y1 and x2 = y2; the other is similar. By the condition of the case, fx1 ; x2 g fy1 ; y2 g and also fy1 ; y2 g fx1 ; x2 g so {x1,x2} = {y1,y2}. From left to right: suppose {x1,x2} = {y1,y2} and x1 6¼ y1 or x2 6¼ y2; we need to show x1 = y2 and x2 = y1. Case 1: suppose x1 6¼ y1. Then since fx1 ; x2 g fy1 ; y2 g we have x1 = y2, and since fy1 ; y2 g fx1 ; x2 g we also have y1 = x2 and this case is done. Case 2: suppose x2 6¼ y2. We argue in similar fashion.
2.1 Ordered Tuples, Cartesian Products, Relations
39
Alice Box: Ordered pairs Alice
Hatter
Isn’t there something circular in all this? You promised that relations will be used to build a theory of order, but here you are defining the concept of a relation by using the notion of an ordered pair, which already involves the concept of order! A subtle point! But I would call it a spiral rather than a circle. We need just a rock-bottom kind of order—no more than the idea of one thing coming before another—in order to understand what an ordered pair is. From that we can build a very sophisticated theory of relations and order in general.
2.1.2 Cartesian Products With this in hand, we can introduce the notion of the Cartesian product of two sets. If A, B are sets then their Cartesian product, written A B and pronounced ‘A cross B’ or ‘A by B’, is defined as follows: A B = {(a,b): a 2 A and b 2 B}. In English, this says that A B is the set of all ordered pairs whose first term is in A and whose second term is in B. When B = A, so that A B = A A it is customary to write it as A2, calling it ‘A squared’. The operation takes its name from René Descartes who, in the seventeenth century, made use of the Cartesian product R2 of the set R of all real numbers. His seminal idea was to represent each point of a plane by an ordered pair (x,y) of real numbers, and use this representation to solve geometric problems by algebraic methods. The set R2 is called the Cartesian plane. A very simple concept—but be careful, it is also easy to trip up! Take note of the and in the definition but don’t confuse Cartesian products with intersections. For example, if A, B are sets of numbers, then A \ B is also a set of numbers; but A B is a set of ordered pairs of numbers. Exercise 2.1.2 (1) Let A = {John, Mary} and B = {1,2,3}, C = ∅. What are A B, B A, A C, C A, A2, B2? How many elements in each? Solution A B ¼ fðJohn; 1Þ; ðJohn; 2Þ; ðJohn; 3Þ; ðMary; 1Þ; ðMary; 2Þ; ðMary; 3Þg B A ¼ fð1; JohnÞ; ð2; JohnÞ; ð3; JohnÞ; ð1; MaryÞ; ð2; MaryÞ; ð3; MaryÞg AC ¼£¼CA A2 ¼ fðJohn; JohnÞ; ðJohn; MaryÞ; ðMary; JohnÞ; ðMary; MaryÞg B2 ¼ fð1; 1Þ; ð1; 2Þ; ð1; 3Þ; ð2; 1Þ; ð2; 2Þ; ð2; 3Þ; ð3; 1Þ; ð3; 2Þ; ð3; 3Þg #ðA BÞ ¼ 6 ¼ #ðB AÞ; #ðA CÞ ¼ 0 ¼ #ðC AÞ; #ðA2 Þ ¼ 4; #ðB2 Þ ¼ 9: Comment: Note that we also have, for example: A B = {(John,1), (Mary,1), (John,2), (Mary,2), (John,3), (Mary,3)}. Within the curly brackets we are
40
2
Comparing Things: Relations
enumerating the elements of a set, so we can write them in any order we like; but within the round brackets we are enumerating the terms of an ordered pair (or ordered n-tuple), where the order is vital. End of solution. From Exercise 2.1.2 (1) you may already have guessed a general counting principle for Cartesian products of finite sets: #(A B) = #(A) #(B), where the dot stands for ordinary multiplication. Here is a proof. Let #(A) = m and #(B) = n. Fix any element a 2 A. Then there are n different pairs (a,b) with b 2 B. And when we fix a different a0 2 A, then the n pairs ða0 ; bÞ will all be different from the pairs (a,b), since they differ on their first terms. So, there are n + n+… + n (m times), i.e. mn pairs altogether in A B. Thus, although the operation of forming the Cartesian product of two sets is not commutative (i.e. we may have A B 6¼ B A), the operation of counting the elements of the Cartesian product is commutative: always #(A B) = #(B A). Exercise 2.1.2 (2) (a) Show that when AA0 and BB0 then A BA0 B0 . (b) Show that when both A 6¼ ∅ and B 6¼ ∅ then A B = B A iff A = B Solution (a) Suppose AA0 and BB0 and let (a,b) 2 A B. Then a 2 A and b 2 B so a 2 A0 and b 2 B0 so ða; bÞ 2 A0 B0 . (b) Suppose A 6¼ ∅ and B 6¼ ∅. We need to show that A B = B A iff A = B. First, we show that if A = B then A B = B A. Suppose A = B. By the supposition, A B = A2 and also B A = A2, so that A B = B A as desired. Next, we show the converse, that if A B = B A then A = B. The easiest way to do this is by showing its contrapositive: if A 6¼ B then A B 6¼ B A. Suppose A 6¼ B. Then at least one of A B, B A fails. We consider the former case; the latter is similar. Then there is an a 2 A with a 62 B. By supposition, B 6¼ ∅, so there is a b 2 B. Thus (a,b) 2 A B but since a 62 B, (a,b) 62 B A. Thus A B 6¼ B A as desired. End of solution.
The solution to part (b) of Exercise 2.1.2(2) is instructive in two respects. In the first place, it uses a ‘divide and rule’ strategy, breaking the problem down into two component parts, and tackling them one by one. In order to prove an if and only if statement (also known as a biconditional), it is often convenient to do it in two parts: first prove the if in one direction, and then prove it in the other. As we saw in the preceding chapter, these are not the same; they are called converses of each other. In the second place, the exercise illustrates the tactic of proving by contraposition. Suppose we want to prove a statement if a then b. As mentioned earlier, the most straightforward way of tackling this is to suppose a and drive towards b. But that is not always the most transparent way. Sometimes it is better to suppose not-b and head for not-a. Why is proof by contraposition legitimate? Because the two
2.1 Ordered Tuples, Cartesian Products, Relations
41
conditionals a ! b and ¬b ! ¬a are equivalent, as can be seen from their truth-tables in the preceding chapter. How can the tactic help? Sometimes, one supposition gives us more to ‘grab hold of’ than the other. In our example, the supposition A 6¼ B tells us that there is an a with a 2 A, a 62 B (or conversely); that is not yet very concrete, but we can then consider such an a, and start reasoning about it. Exercise 2.1.2 (3) (a) An example from arithmetic of proving a biconditional via its two parts: show that for any positive integers m, n we have: m = n iff each of m, n divides the other. (b) An example from arithmetic of proving via the contrapositive: show that for any two real numbers x, y if x y is irrational then at least one of x, y is irrational. Solution (a) The left-to-right conditional is immediate, since m divides m. Right-to-left, if each of m, n divides the other then n = a m and m = b n for some natural numbers a, b so n = a (b n) = (a b) n so a b = 1, so a = 1 = b so m = n. As often, one direction is easier than the other, and it is usually good manners towards the reader to give the easier one first. (b) Suppose that x, y are both rational. Then x = a/b and y = c/d for integers a, b, c, d with b 6¼ 0 6¼ d. Then x y ¼ ða cÞ=ðb dÞ where numerator and denominator are integers with the latter non-zero, so x y is rational.
2.1.3 Relations Let A, B be any sets. A binary relation from A to B is defined to be any subset of the Cartesian product A B. In other words, it is any set of ordered pairs (a,b) such a 2 A and b 2 B. Thus, it is fully determined by the ordered pairs that it has as elements, and it makes no difference to the its identity how those pairs are presented or described. It is customary to use R, S, … as symbols standing for relations. As well as saying that the relation is from A to B, one also says that it is over A B. From the definition, it follows that in the case that A = B, a binary relation from A to A is any set of ordered pairs (a,b) such both a, b 2 A. It is thus a relation over A2, but informally we often abuse language a little and describe it as a relation over A. Evidently, the notion may be generalised to any number of places. Let A1 ; . . .; An be sets (n 1). An n-place relation over A1 . . . An is defined to be any subset of A1 . . . An . In other words, it is any set of n-tuples ða1 ; . . .; an Þ with each ai 2 Ai . Binary relations are thus 2-place relations. As a limiting case of the more general notion, when n = 1 we have 1-place relations over A, which may be identified with subsets of A.
42
2
Comparing Things: Relations
In this chapter we will be concerned mainly with binary relations, and when we speak of a relation without specifying the number of places, that is what will be meant. Exercise 2.1.3 (1) Let A = {John, Mary} and B = {1,2,3} as in Exercise 2.1.2 (1). (a) Which of the following are (binary) relations from A to B: (i) {(John,1), (John,2)}, (ii) {(Mary,3), (John,Mary)}, (iii) {(Mary,2), (2,Mary)}, (iv) {(John,3), (Mary,4)}, (v) ({Mary,1}, {John,3})? (b) What is the smallest relation from A to B? What is the largest? (c) Identify (by enumeration) three more relations from A to B. (d) How many relations are there from A to B? Solution (a) Only (i) is a relation from A to B. (ii) is not, because Mary is not in B. (iii) is not, because 2 is not in A. (iv) is not, because 4 is not in B. (v) is not because, if you read the brackets carefully, it is an ordered pair of sets, not a set of ordered pairs. (b) ∅ is the smallest, in the sense that ∅ R A B for every relation R from A to B. A B is the largest relation A to B; it is often called the total relation over A B or, when B = A, the total relation over A. (c) For brevity, we can choose three singleton relations: {(John,1)}, {(John,2)}, {(John,3)}. (d) Since #(A) = 2 and #(B) = 3, #(A B) = 2 3 = 6. From the definition of a relation from A to B it follows that the set of all relations from A to B is just P(A B), and by a counting principle in the chapter on sets, #ðPðA BÞÞ ¼ 2#ðABÞ ¼ 26 ¼ 64. End of solution.
When R is a relation from A to B, we call the set A a source of the relation, and B a target. Sounds simple enough, but caution is advised. As already noted in an exercise, when A A0 and B B0 then A B A0 B0 , so when R is a relation from A to B then it is also a relation from A0 to B0 . Thus the source and target of R, in the above sense, are not unique: a single relation will have indefinitely many sources and targets. For this reason, we also need terms for the least possible source and least possible target of R. We define the domain of R to be the set of all a such that (a, b) 2 R for some b, writing briefly dom(R) = {a: there is a b with (a,b) 2 R}. Likewise we define range(R) = {b: there is an a with (a,b) 2 R}. Clearly, whenever R is a relation from A to B then dom(R) A and range(R) B. Warning Box: Codomain You may occasionally see the term ‘codomain’ contrasting with ‘domain’. But care is again needed, as the term is sometimes used broadly for ‘target’, at other times more specifically for ‘range’. In this
2.1 Ordered Tuples, Cartesian Products, Relations
43
book we will follow a fairly standard terminology, with domain and range defined as above, and source, target for any supersets of them.
Exercise 2.1.3 (2) (a) Consider the relation R = {(1,7), (3,3), (13,11)} and the relation S = {(1,1), (3,11), (13,12), (15,1)}. Identify dom(R), range(R), dom(S), range(S). (b) The identity relation IA (also written =A) over a set A is defined by putting I = {(a,a): a 2 A}. Identify dom(IA) and range(IA). (c) Identify dom(A B), range(A B). Solution (a) dom(R) = {1,3,13}, range(R) = {7,3,11}, dom(S) = {1,3,13,15}, (S) = {1,11,12}. (b) dom(IA) = A = range(IA). (c) dom(A B) = A, range(A B) = B. End of solution.
range
Since relations are sets (of ordered pairs or tuples) we can apply to them all the concepts that we have developed for sets. In particular, it makes sense to speak of one relation R being included in another relation S: every tuple that is an element of R is an element of S. In this case we also say that R is a subrelation of S. Likewise, it makes sense to speak of the empty relation: it is the relation that has no elements, and it is unique. It is thus the same as the empty set, and can be written ∅. Exercise 2.1.3 (3) (a) Use the definitions to show that the empty relation is a subrelation of every relation. (b) Identify dom(∅), range(∅). (c) What would it mean to say that two relations are disjoint? Give an example of two non-empty disjoint relations over a small finite set A. Solution (a) The argument is the same as for showing that the empty set is a subset of every set, in an exercise of Chap. 1. In detail: we need to show that for all (x,y), if (x,y) 2 ∅ then (x,y) 2 R. In other words: there is no (x,y) with (x,y) 2 ∅ but (x,y) 62 R. But by the definition of ∅, there is no (x,y) with (x,y) 2 ∅ and we are done. (b) dom(∅) = ∅ = range(∅). (c) R is disjoint from S iff there is no pair (x,y) with both (x,y) 2 R and S; that is, iff R \ S = ∅. Example: Put A = {1,2}, R = (1,1), S = {2,2}.
44
2.2
2
Comparing Things: Relations
Tables and Digraphs for Relations
In mathematics, rigour is important, but so is intuition; the two should go hand in hand. One way of strengthening one’s intuition is to use graphic representations. This is particularly so in the case of binary relations. For sets in general we used Euler and Venn diagrams; for the more specific case of relations, tables and especially arrow diagrams are helpful.
2.2.1 Tables Let’s go back to the sets A = {John,Mary} and B = {1,2,3} of earlier exercises. Consider the relation R = {(John,1), (John,3), (Mary,2), (Mary,3)}. How might we represent it by a table? We need two rows and three columns, for the elements of A and of B respectively. Each cell in this table is uniquely identified by its coordinate (a,b) where by convention a is the element for the row and b is the element for the column. In the cell write 1 (for ‘true’) or 0 (for ‘false’) according as the ordered pair (a,b) is or is not an element of the relation. For the R chosen above, this gives us the Table 2.1. Tabular representations are particularly useful when dealing with relations in databases, because good software is available for writing and manipulating them. Moreover, when a table has the same number of columns as rows, geometrical operations such as folding along the diagonal can also reveal interesting features. Exercise 2.2.1 (a) Let A = {1,2,3,4}. Draw tables for each of the following relations over A2: (i) a2 … of mutually distinct elements of A (using transitivity here), so A is infinite. Remark: our reasoning here is a little rough. It is really a proof by induction, and its structure will become clearer in Chap. 4. End of solution.
Dual notions of maximal and greatest elements are defined just as one would expect. Let A be a set and a partial ordering of A. An element a 2 A is said to be a maximal element of A (under ) iff there is no b 2 A with a < b. On the other hand, an element a 2 A is said to be a greatest element of A (under ) iff b a for every b 2 A. Also as one would expect, maximal and greatest elements behave dually to minimal and least ones. In detail, they have the following properties as counterparts to those listed in Exercise 2.6.1 (2). (a) Whenever a is a greatest element of A then it is a maximal element of A but (b) the converse can fail. (c) A can have zero, one, or more than one maximal elements, but (d) it can have at most one greatest element. (e) If A is finite and non-empty then it must have at least one maximal element. The verifications also routinely dualize. With these notions in hand, we can define the concepts of lower and upper bounds. As some readers will know already, they play a strategic role in the theory of continuity for functions on the real numbers; they are also very useful in the more general context of any partial order of an arbitrary set. Let A be a set, a partial ordering of A, X A. An element a 2 A is called a lower bound of X (in A, under ) iff a x for all x 2 X. When a 2 A is a greatest element of the set of all lower bounds of X in A, i.e. it is greatest among all the lower bounds of X (in A, under ) then it is said to be a greatest lower bound of X (in A, under ). ‘Greatest lower bound’ is commonly abbreviated to glb and is sometimes called infimum. When the identity of the set A and its partial order are clearly identified and fixed, it is common to omit mention of one or both, leaving them as understood. Exercise 2.6.1 (3) (a) Let A be a set, a partial ordering of A, X A. Show that if X has a greatest lower bound (in A, under ) then it is unique. (b) Let A be a set, a partial ordering of A. Let X A and suppose that X has a glb in A. Show that for all a 2 A, a is a lower bound of X iff a glb(X). Solution (a) Suppose a, b are both glbs of X in A under . Then they are both lower bounds of X in A and so by the definition of glb we have both a b and b a so, by antisymmetry of , a = b as desired. The application of antisymmetry here is vital; there is no decent theory of glbs for orderings that lack that property.
2.6 Relations for Ordering
69
(b) From left to right is given explicitly by the definition of glb. For right to left, glb(X) x for all all x 2 X so if a glb(X) then by transitivity we have a x for all x 2 X so that a is a lower bound of X. Transitivity is thus also vital for a good theory of glbs.
2.6.2 Linear Orderings A reflexive relation R over a set A is said to be complete over A iff for all a, b 2 A, either (a,b) 2 R or (b,a) 2 R. A poset that is also complete is often called a linear ordering or chain. Clearly the relation over N is complete and so a linear ordering, since for all m, n 2 N either m n or n m. So is the usual lexicographic ordering of words in a dictionary. On the other hand, whenever a set A has more than one element, then the relation over P(A) is not complete. To show this, take any two distinct a, b 2 A, and consider the singletons {a},{b}; they are both elements of P(A), but neither {a} {b} nor {b} {a} because a 6¼ b. Exercise 2.6.2 (1) (a) Give two more linear orderings of N. (b) Which of the following are linear orderings over an arbitrary set of people? (i) is at least as old as, is (ii) identical to or a descendent of. (c) Give an example of an infinite linearly ordered set without any minimal element. Solution (a) There are plenty, but here are two: (i) the relation , i.e. the converse of , (ii) the relation that puts all odd positive integers first, and then all the even ones, each of these blocks being ordered separately as usual. (b) (i) Yes, it meets all the requirements, (ii) no, since it is not complete. (c) The simplest example is the set of all negative integers (or the set of all integers positive, negative or zero).
Warning Box: total ordering vs total relation A linear ordering over a set A is sometimes called a ‘total ordering’. It should not be confused with the unique ‘total relation’ over A in the sense of exercises 2.1.3 (1) and 2.5.4 (c), which is A2 itself. Evidently, for sets A with more than one element, A2 is not a linear order, since it is not antisymmetric.
70
2
Comparing Things: Relations
Exercise 2.6.2 (2) Show that for linear orderings: (i) A can have at most one minimal element, and (ii) if a minimal element exists then it is the least element of A. Solution Let be a linear ordering of A. (i) Let a, b be minimal elements of A; we want to show that a = b. By minimality, a ¥ b and b ¥ a so either a b or a = b and either a b or b = a. But completeness requires that either a b or a b so we have either a = b or b = a, thus a = b. (ii) Let a be a minimal element of A and let x 2 A; we need to check that a x. By minimality x ¥ a so either x = a or x a. The former gives a x immediately, and the latter gives it by linearity.
2.6.3 Strict Orderings Whenever we have a reflexive relation we can always look at what is known as its strict part. It is usually written as < (or a square or curly variant of this) even though it need not have all the properties of ‘less than’ over the usual number systems. The definition is as follows: a < b iff a b but a 6¼ b. In language that looks like gibberish but makes perfect sense if you read it properly: ( 1. Then A has at least two distinct elements a, a′. But if f: A ! B is a constant function then f(a) = f(a′), failing injectivity. For (ii), suppose that #(B) > 1 and let f: A ! B be a constant function. If A = Ø then f must be the empty function, and since B is not empty, f is not onto B. On the other hand, if A 6¼ Ø then there is an a 2 A so, since # (B) > 1, there is a b 2 B with b 6¼ f(a). But since f is a constant function, f(a ′) = f(a) for all a′ 2 A, so b 6¼ f(a′) for all a′ 2 A, so that f is not onto B.
102
3 Associating One Item with Another: Functions
3.5.3 Projection Functions Let f: A B ! C be a function of two arguments, and let a 2 A. By the right projection of f from a we mean the one-argument function fa: B ! C defined by putting fa(b) = f(a,b) for each b 2 B. Likewise, letting b 2 B, the left projection of f from b is the one-argument function fb: A ! C defined by setting fb(a) = f(a,b) for each a 2 A. In other words, to form the left or right projection of a two-argument function, we hold one of the arguments of f fixed at some value and consider the one-argument function obtained by allowing the other argument to vary. Exercise 3.5.3 (a) What is the right projection of the two-argument function f: N N ! N defined by putting f(m.n) = mn, when m is chosen to be 2? And the left projection when n is chosen to be 3? (b) Describe (i) the right projection of the multiplication function x y: N N ! N at the value x = 3, (ii) the left projection at the value y = 3. Are they the same function? Solution (a) f2(n) = 2n. f3(m) = m3. (b) (i) f: N ! N with f(y) = 3 y, (ii) g: N ! N with g(x) = x 3. Yes, f = g because multiplication is commutative.
3.5.4 Characteristic Functions Let U be any set fixed as a local universe. For each subset A U we can define a function fA: U ! {1,0} by putting fA(u) = 1 when u 2 A and fA(u) = 0 when u 62 A. This is known as the characteristic function of A (modulo U), sometimes called its indicator function. Thus, in terminology from logic, the characteristic function fA specifies the truth-value of the statement that u 2 A. Conversely, when f: U ! {1,0}, we can define the associated subset of U by putting Af = {u 2 U: f(u) = 1}. Clearly, there is a bijection between the subsets of U and the functions f: U ! {1,0}, and in fact we can make either do the work of the other. In some contexts, it can be conceptually or notationally more convenient to work with characteristic functions than with subsets. Exercise 3.5.4 (a) What is the characteristic function of (i) the set of all prime numbers, in the local universe N+ of positive integers? (ii) Of the composites (non-primes)? (iii) Of the empty set, and (iv) of N+ itself?
3.5 Some Handy Functions
103
(b) Let U be a local universe, and let A, B U. Express the characteristic function of A \ B in terms of those for A, B. Then do the same for A [ B and for U \A. Do these remind you of anything from earlier logic boxes? Solution (a) (i) It is the function f: N+ ! {1,0} that puts f(n) = 1 when n is prime, otherwise 0. (ii) The function f: N+ ! {1,0} that puts f(n) = 0 when n is prime, otherwise 1. (iii) The function f: N+ ! {1,0} that puts f(n) = 0 for all n 2 N+. (iv) The function f: N+ ! {1,0} that puts f(n) = 1 for all n 2 N+. (b) fA \ B(x) = 1 iff fA(x) = 1 and fB(x) = 1; fA [ B(x) = 1 iff fA(x) = 1 or fB(x) = 1; fU \A(x) = 1 iff fA(x) = 0, for all x 2 U. They correspond respectively to the truth-tables for conjunction, disjunction and (approximately) negation as applied to the propositions (x 2 A) ^ (x 2 B), (x 2 A) _ (x 2 B), (x 2 U) ^ (x 62 A).
3.5.5 Choice Functions Let A be any collection of non-empty sets. Then there is a function f: A ! [ A such that f(A) 2 A for all A 2 A. In other words, there is a function that picks out, from each set in the collection, one of its elements. They are called choice functions and are very useful in both workaday and abstract set theory. The principle has considerable notoriety because of its ‘non-constructive’ nature: it asserts the existence of at least one choice function without at the same time providing a way of specifying any one such function uniquely. A famous illustration of this, devised by Bertrand Russell for a non-mathematical audience, imagines that we have an infinite set A of pairs of socks. A choice function for A would pick out one sock from each pair. Whereas shoes come in left and right pairs, socks have no built-in features for such a choice function to be fully specified yet, by the axiom of choice, at least one choice function exists. Because of this non-constructive aspect, when A is infinite the principle cannot in general be proven from more elementary principles of set theory; it must instead be assumed as a postulate, called the axiom of choice. Actually, a more adequate name would be the ‘axiom for carrying out infinitely many choices all at once’ since that is what the function does when A is infinite; but that is quite a mouthful, so the shorter name is standard. On the other hand, when A is finite a choice function for it can be specified constructively, if only by giving a long but finite list of all the ordered pairs in the function. As also noted by Russell, the axiom of choice can be formulated equivalently without speaking of functions at all: for any collection A of disjoint non-empty sets, there is a set that contains exactly one element of each set in A. Note the qualification ‘disjoint’ in this formulation, which we call Russell’s version.
104
3 Associating One Item with Another: Functions
The axiom of choice has a great many useful consequences, some of which turn out to be equivalent to it. Perhaps the most famous among the equivalent principles is the well-ordering theorem: for every non-empty set A there is a relation R that well-orders A (in a sense to be defined in Chap. 4). Its derivation from the axiom of choice is quite difficult (although the converse is easy) and is suited for a more advanced course in set theory. Another equivalent principle, very useful in abstract algebra and advanced logic, is known as Zorn’s Lemma. Using notions and terminology from Chap. 2, it says: every partially ordered set A each of whose sub-chains, has an upper bound in A has a maximal element. A much more immediate consequence of the axiom of choice that is handy in everyday applications of set theory is that for every relation R there is a set f R with the same domain. That in turn permits a way of reformulating multiply-quantified statements of the kind “for all x 2 A there is a y 2 B such that (x, y) 2 R” as “there is a function f: A ! B such that for all x 2 A, (x, f(x)) 2 R”. We will be doing this, as an essential step in a construction, in Chap. 4 Sect. 4.7.1 and as a stylistic simplification of another one in Chap. 11, Sect. 11.4. Exercise 3.5.5 (a) Give a simple finite example that shows why the condition of disjointedness is needed in Russell’s version of the axiom of choice. (b) Show that the standard, Russell, and ‘f R’ versions of the axiom of choice are mutually equivalent. Solution (a) Let X = {1,2,3} and put A = {{1,2}, {2,3}, {1,3}}; the sets in A are non-empty but A is not disjoint. We claim that there is no set C X containing exactly one element from each element of A. Suppose there is such a set C. It must contain 1 or 2. If it contains 1 then it doesn’t contain 2 so it must contain 3 so it contains both elements of {1,3}. Similarly, if it contains 2 then it doesn’t contain 1 so it must contain 3 so it contains both elements of {2,3}. (b) We show that the standard version implies Russell’s, which implies the ‘f R’ one, which implies the standard one. Of course, one could cycle around the three versions in a different order, or choose one of the three and show that it is equivalent to each of the other two. Assume the standard version of the axiom of choice. Let A be any disjoint collection of non-empty sets; we want to show that there is a set that contains exactly one element of each set in A. By the standard version, there is a function f: A ! [ A such that f(A) 2 A for all A 2 A. Put C = {f(A): A 2 A}. By definition, C contains at least one element from each element of A and, since A is disjoint, C contains no more than one from each. Assume now the Russell version. Let R be any relation with A its domain and B its range. For each a 2 A, put Sa = {(a,b): b 2 R(a)} and put A = {Sa: a 2
3.5 Some Handy Functions
105
A}. Then the elements of A are non-empty and disjoint—it is to ensure disjointedness that we did not simply put Sa = R(a)—so, by Russell, there is a set C consisting of exactly one element (a,b) from each Sa. Define f as follows: for each a 2 dom(R), f(a) is the unique b in range(R) such that (a,b) 2 Sa. Then f is a function on the domain of R into the range of R with f R. Assume now the ‘f R’ version. Let A be any collection of non-empty sets. We need to show that there is a function f: A ! [ A such that f(A) 2 A for all A 2 A. Put R = {(A,a): a 2 A 2 A}. Note that since the elements of A are non-empty, the domain of R is just A and the range of R is [ A. By the assumption, there is a function f with the same domain with f R, that is, f is a function on A into [ A with f(a) 2 A for all A 2 A as desired.
3.6
Families and Sequences
The uses of functions are endless. In fact, their role is so pervasive that some mathematicians prefer to see them, rather than sets, as providing the bedrock of their discipline. When that is done, sets are defined, roughly speaking, as their characteristic functions. We will not go further into that perspective, which belongs rather to the philosophy of mathematics. Instead, we illustrate the versatility of functions by seeing how they can clarify the notion of a family of sets, and a sequence of arbitrary items.
3.6.1 Families of Sets In Sect. 1.5, we introduced sets of sets. They are usually written {Ai: i 2 I} where the Ai are sets and the set I, called an index set, helps us keep track of them. Because the phrase ‘set of sets’ tends to be difficult for the mind to handle, we also speak of {Ai: i 2 I} as a collection of the sets Ai; but the term ‘collection’ does not mean anything new—it is merely to facilitate mental processing. We now introduce the subtly different concept of a family of sets. This refers to any function on a domain I (again called an index set) such that for each i 2 I, f(i) is a set. Writing f(i) as Ai, it is thus the set of all ordered pairs (i, f(i)) = (i, Ai) with i 2 I. The range of this function is the collection {Ai: i 2 I} referred to in the preceding paragraph. The difference is fine, and in some contexts sloppiness does not matter and the collection notation {Ai: i 2 I} may then be used indiscriminately for both the collection and abused, for the family. But in certain situations, notably applications of the pigeonhole principle and other counting rules of Chap. 5, the distinction between a collection of sets and a family of sets becomes very important. Suppose, for example, that the index set I has n elements, say I = {1, …, n}, but the function f is not injective, say f(1) = f(2), in other words, A1 = A2. In that case the family
106
3 Associating One Item with Another: Functions
containing all the pairs (i, Ai) with i n, has n elements, but the collection containing all the sets Ai with i n has fewer than n elements, since A1 = A2. Once more, the substance of mathematics is intricately entwined with the way that it uses language. The convention of subscripting items with a variable is often an implicit way of describing a function. For example, when we say ‘let pi be the ith prime number, for any i 2 N+’, we are inviting consideration of the function p: N+ ! N+ such that each p(i) is the ith prime number, as well the collection that is its range—which, in this instance, is just the set of all prime numbers. The moral of this story is that when you see or use a notation like {Ai: i 2 I} you should pause to ask yourself two questions: is this referring to the function (family) or its range (collection), and does it matter for the issue under discussion? Exercise 3.6.1 Let I be a set with n elements, and f a constant function on I into a collection of sets. (a) How many elements are there in the collection {Ai: i 2 I} = {f(i): i 2 I}. (b) How many elements are there in the family {(i, Ai)}: i 2 I} = {(i, f(i))}: i 2 I}? (c) What if f is an injective function? Solution (a) When f is a constant function, the collection has just one element. (b) The family has exactly n elements, whatever function is in question, so long as its domain has n elements. (c) When f is injective, then both the collection and the family have n elements.
3.6.2 Sequences and Suchlike In computer science, as in mathematics itself, we often need to consider sequences a1, a2, a3, … of items. The items ai might be numbers, sets or other mathematical objects; in computer science they may be the instructions in a program, steps in its execution and so on. The sequence itself may be finite, with just n terms a1, …, an for some n, or infinite with a term ai for each positive integer i, in which case we usually write it with an informal suspended dots notation, as a1, a2, a3, …. But what is such a sequence? It is convenient to identify an infinite sequence a1, a2, a3, … with a function f: N+! A for some appropriately chosen set A, with f(i) = ai for each i 2 N+. The ith term in the sequence is thus just the value of the function for argument (input) i. The sequence is thus a family with index set N+. When the sequence is finite, there are two ways to go. We can continue to identify it with a function f: N+! A with f(i) = ai for each i n 2 N+ and with f (n + m) = f(n) for all m 2 N+, so that the function becomes constant in its value from f(n) upwards. Or, more intuitively, we can take it to be a function f: {i n 2 N+} ! A, i.e. as a partial function on N+ whose domain is the initial segment {i n 2 N+} of N+. Formally, it doesn’t really matter which way we do it; in either case one has made a rather vague notion sharper by explaining it in terms of functions. In what follows we will follow the former definition.
3.6 Families and Sequences
107
Alice Box: n-tuples, sequences, strings and lists Alice
Hatter Alice
Hatter
I’m getting confused! So a finite sequence of elements of A is a function f: {i n 2 N+} ! A and we write it as a1, a2, …, an. But what’s the difference between this and the ordered n-tuple (a1, a2, …, an) that we saw back in Chap. 2 Sect. 2.1.1? While we are at it, I have been reading around, and I also find computer scientists talking about finite strings and finite lists. Are they the same, or different? Well, er… They come at me with different notations. Sequences are written as a1, a2, …, an and tuples with external brackets as (a1, a2, …, an), but strings are written just as a1a2…an with neither commas nor external brackets. I see lists written with angular external brackets and sometimes with further internal brackets. And the symbols used for the empty tuple, sequence, string and list are all different. Help! What is going on? Let’s have some more tea.
We should try to help Alice and to get the Hatter off the hook. This sort of thing is rarely explained, and it can be quite confusing to the beginning student. The most abstract concept is that of a tuple. If we go back to the account in Sect. 2.1.1, we see that we don’t care what it is. All we care about is how it behaves, and in particular that it satisfies the criterion for identity that we mentioned there: (x1, x2, …, xn) = (y1, y2, …, yn) iff xi = yi for all i from 1 to n. An n-tuple can be anything that satisfies that condition. A sequence is a more specific kind of object. In this section we have defined a finite sequence of n items to be a function f: {i n 2 N+} ! A. So defined, sequences satisfy the identity criterion just mentioned, and so we may regard them as a particular kind of tuple. Mathematicians like them because they are accustomed to working with functions on N+. That leaves us with strings and lists. They are best thought of as tuples, usually of symbols, that come equipped with a tool for putting them together and taking them apart. In the case of strings, in particular strings of symbols, this tool is the operation of concatenation, which consists of taking any strings s and t and forming a string con (s,t). This is the longer symbol formed by writing s and then immediately to its right the other symbol t. When we talk of strings, we are thus thinking of tuples where concatenation is the only available way, or the only permitted one, of building or dismantling them. Computer scientists like them, as concatenation is an operation that their machines can work with quickly. Lists may also be thought of as tuples, likewise equipped with a single tool for their construction and decomposition. But this time the tool is more limited in its power. We are allowed to take any list y and put in front of it an element a of the
108
3 Associating One Item with Another: Functions
base set A of elementary symbols (often called the alphabet for constructing lists). This forms a slightly longer list ⧼a,y⧽. Here a is called the head, and y is the tail of the list ⧼a,y⧽. If y itself is compound, say y = ⧼b,x⧽ where b 2 A and x is a shorter list, then ⧼a,y⧽ = ⧼a, ⧼b,x⧽⧽, and so on. Being a restricted form of concatenation, the operation is given the very similar name cons, so that cons(a,y) = ⧼a,y⧽. The important thing about the cons operation is that while it can take any list of any length as its second argument, it can take only elements of the basic alphabet A as its first argument. It is, in effect, a restriction of the first argument of the concatenation operation con to the alphabet set A. The restriction may at first seem rather odd, but there is a reason for making it. For the restricted kind of concatenation, lists satisfy a mathematical condition of unique decomposability, which is not in general satisfied by concatenation. That permits us to carry out definitions by structural recursion, as we will explain in Chap. 4. To sum up: For tuples we don’t care what they are, so long as they satisfy the appropriate condition for identity. Finite sequences may be defined as functions on initial segments of the positive integers, so are a particular kind of tuple. Strings and lists are tuples accompanied by a tool for their construction and decomposition— concatenation in one case and, on the other, a restricted form of concatenation that ensures unique decomposability. These tools are vital to the computer scientist for constructing, manipulating and proving things about composite symbols.
3.7
End-of-Chapter Exercises
Exercise 3.7 (1) Partial functions (a) Characterize the notion of a partial function from A to B in terms of (i) its table as a relation and (ii) its digraph as a relation. (b) Let R be a relation from A to B. Show that it is a partial function from A to B iff it is a function from dom(R) to B. Solution (a) (i) In terms of tables: a partial function from A to B is a relation R A B whose table has at most one 1 in each row. In terms of digraphs: every point in the A circle has at most one arrow going out from it to the B circle. (b) Let R be a relation from A to B. For the left-to-right implication, suppose that R is a partial function from A to B. Then it is a set of ordered pairs (a,b) with a 2 A, b 2 B such that for each a 2 A there is at most one b 2 B with (a,b) 2 R. But dom(R) is the set of all a 2 A such that there is at least one b 2 B with (a,b) 2 R. So R is a set of ordered pairs (a,b) with a 2 dom(R), b 2 B such that for each a 2 dom(R) there is exactly one b 2 B with (a,b) 2 R; that is, R is a function from dom(R) to B.
3.7 End-of-Chapter Exercises
109
For the right-to-left part, the verification is essentially the same in reverse, but we give it in full. Suppose that R is a function from dom(R) to B. Then R is a set of ordered pairs (a,b) with a 2 dom(R), b 2 B such that for each a 2 dom(R) there is exactly one b 2 B with (a,b) 2 R. Since dom(R) A, we can say that R is a set of ordered pairs (a,b) with a 2 A, b 2 B such that for each a 2 A there is at most one b 2 B with (a,b) 2 R, that is, R is a partial function from A to B. Exercise 3.7 (2) Image, closure (a) The floor function from R into N is defined by putting ⌊x⌋ to be the largest integer less than or equal to x. What are the images under the floor function of the sets (i) [0,1] = {x 2 R: 0 x 1}, (ii) [0,1) = {x 2 R: 0 x < 1}, (iii) (0,1] = {x 2 R: 0 < x 1}, (iv) (0,1) = {x 2 R: 0 < x < 1}? (b) Let f: A ! A be a function from set A into itself. (i) Show that f(X) f[X] for all X A, and (ii) give a simple example of the failure of the converse inclusion. (c) Show that when f(X) X then f[X] = X. (d) Show that for any partition of A, the function f taking each element a 2 A to its cell is a function on A into the power set PðAÞ of A with the partition as its range. (e) Let f: A ! B be a function from set A into set B. Recall the ‘abstract inverse’ function f−1: B !PðAÞ defined at the end of Sect. 3.3.1 by putting f−1(b) = {a 2 A: f(a) = b} for each b 2 B. (i) Show that the family of all sets f−1(b) for b 2 f(A) B is a partition of A in the sense defined in Chap. 2. (ii) Is this still the case if we include in the family the sets f−1(b) for b 2 B\f(A)? Solution (a) (i) {0,1}, (ii) {0}, (iii) {0,1}, (iv) {0}. (b) (i) Using the top-down definition, it suffices to show that every set Y A such that both X Y and f(Y) Y, includes f(X). But if X Y then clearly f(X) f (Y), so f(X) Y and we are done. Using the bottom-up definition by unions, we note that f[X] = [ {Xn: n 2 N} where X0 = X and Xn+1 = Xn [ f(Xn) so that f(X) X [ f(X) = X1 f[X]. (ii) For an example of the failure of the converse inclusion, put A = N, f(n) = n + 1, X = {0} so f(X) = {1} while f [X] = N. (c) It is convenient to use the bottom-up definition. Suppose f(X) X. Since f [X] = [ {Xn: n 2 N}, it suffices to show that Xn = X for every n 2 N. Now by definition X0 = X; and whenever Xk = X then Xk+1 = Xk [ f(Xk) = Xk = X. This kind of argument is known as proof by induction and we will have more to say about it in the next chapter. (d) Let {Bi}i2I be a partition of A and, for each a 2 A, let f(a) be the unique Bi with a 2 Bi. This is indeed a function with domain A and, since each Bi A, it is into the powerset PðAÞ of A. Since the cells Bi are non-empty and together exhaust A, range(f) = {Bi}i2I.
110
3 Associating One Item with Another: Functions
(e) Let f: A ! B be a function from set A into set B. For (i), we need to show that the sets f−1(b) for b 2 f(A) are non-empty, disjoint, and exhaust A. For non-emptiness, let b 2 f(A); we need to check that f−1(b) is not empty. Now b = f(a) for some a 2 A and by the definition of the abstract inverse f−1 we have a 2 f−1(f(a)) = f−1(b). For exhaustion, let a 2 A; we need to check that a 2 f−1(b) for some b 2 f(A). Put b = f(a). Then a 2 f−1(f(a)) = f−1(b) as desired. For disjointedness, suppose a 2 f−1(b) \ f−1(b′); we need to check that b = b′. By the supposition, f(a) = b and f(a) = b′ so, since f is a function, b = b′ as needed. For (ii), suppose we include in the family the sets f−1(b) for b 2 B\f(A). In the case that f is not onto B, there is at least one such b. By the definition of abstract inverse, f−1(b) = ∅, contrary to the requirement for a partition that each cell be non-empty. Exercise 3.7 (3) Injections, surjections, bijections (a) (i) Is the floor function from R into N injective? (ii) Is it onto N? (b) Is the composition of two bijections always a bijection? (c) Use the equinumerosity principle to show that there is never any bijection between a finite set and any of its proper subsets. (d) Give an example to show that there can be a bijection between an infinite set and certain of its proper subsets. (e) Use the principle of comparison to show that for finite sets A, B, if there are injective functions f: A ! B and g: B ! A, then there is a bijection from A to B. Solution (a) (i) No since, for example ⌊0.1⌋ = 0 = ⌊0.2⌋. (ii) Yes, since for every n 2 N we have ⌊n⌋ = n. (b) Yes, since by Exercise 3.3.1 (1) (c) it is injective and by Exercise 3.3.2 (2) (b) it is surjective. (c) Let A be a finite set, B a proper subset of A. Then if A has n elements, B must have m < n elements, and for an injective function f: B ! A, if B has m elements then also f(B) has m elements, so f(B) 6¼ A and f is not onto A. (d) Let E be the set of all even natural numbers. Then E N, but the function f: N ! E defined by putting f(n) = 2n is clearly a bijection between N and E. This simple fact was surprisingly difficult to assimilate in the history of mathematics before the nineteenth century. It is sometimes known as Galileo’s paradox, although it is not a contradiction but a behaviour that is in contrast with that for finite sets, as shown by (c). (e) Let A, B be finite sets and suppose if there are injective functions f: A ! B and g: B ! A. The principle of comparison tells us that #(A) #(B) and #(B) # (A), so #(A) = #(B). we may thus write A = {a1, …, an} and B = {b1, …, bn} for the same natural number n. Define h: A ! B by putting h(ai) = ai for all i n; clearly h is both injective and onto B. For infinite sets the same
3.7 End-of-Chapter Exercises
111
principle holds, but it cannot be proven by the pigeonhole principle, which applies only to finite sets. It is known as the Cantor-Schröder-Bernstein theorem and can be proven by a very beautiful argument that is suited for a more advanced course in set theory. Exercise 3.7 (4) Pigeonhole principle (a) Use the general form of the pigeonhole principle to show that of any seven propositions, there are at least four with the same truth-value. (b) If a set A is partitioned into n cells, how many distinct elements of A need to be selected to guarantee that at least two of them are in the same cell? (c) Let A = {1,2,3,4,5,6,7,8}. How many distinct numbers must be selected from A to guarantee that there are two of them that sum to 9? Solution (a) Let P be a set of seven propositions, V = {0,1} the set of the two truth-values, and f: P ! V the function that attributes to each proposition in P its truth-value. Since #(P) > 3 #(V) the general form of the pigeonhole principle tells us that there is a truth-value v 2 V such that v = f(p) for at least 3 + 1 = 4 propositions p 2 P. (b) The answer may be intuitively obvious, but we give full details carefully. When we select k distinct elements of A (the qualification ‘distinct’ is important here), we are specifying a subset X of A with k elements. So, the question amounts to: What is the smallest integer k such that for every subset X of A where #(X) = k, at least two elements of X are in the same cell? With this reconceptualization in mind, let A be a set, X A, B a partition of A into n cells, and f: X ! B the function that attributes to each element of X its cell. The pigeonhole principle tells us immediately that if #(X) > n then there is a B 2 B with B = f(x) for at least two distinct elements x of X. Thus n + 1 does the job. No smaller integer can do the job: for any m n we can take m of the n disjoint cells and select one element from each, getting a subset X A with #(X) = m and no two elements of X are in the same cell. (c) Let A = {1, …, 8}. We set things up so that we can apply (b). Let B be the set of all unordered pairs {x,y} with x, y 2 A and x + y = 9. Then B = {{1,8}, {2,7},{3,6},{4,5}}, which is clearly a partition of A into four cells. So, by part (b) of this exercise, selecting five distinct elements of A will guarantee that there are two of them that are in the same cell, i.e. that sum to 9. We can also give a solution that does not appeal to partitions or even to the pigeonhole principle. Consider the subsets X A such that no two distinct elements of X sum to 9. How big can X be? Write X as {x1, …, x8}. There are 8 ways of choosing x1 with the constraint unviolated. Note that for each x 2 A there is a unique y 2 A such that x 6¼ y and x + y = 9. Hence there are 7 − 1 = 6 ways of choosing a distinct x2 so as not to sum to 9, 6 − 2 = 4 ways of choosing a distinct x3
112
3 Associating One Item with Another: Functions
so that no two of x1, …, x3 sum to 9, 5 − 3 = 2 ways of choosing a distinct x4 so that no two of x1, …, x4 sum to 9, and 4 − 4 = 0 ways of choosing a distinct x5 so that no two of x1, …, x5 sum to 9. So, selecting five distinct elements of A will guarantee that there are two of them that sum to 9. This illustrates how a single problem can often be solved by quite different methods. That can lead us to think more about the methods themselves, and sometimes we can see that at bottom, they are not quite so different as they seemed. Exercise 3.7 (5) Handy functions (a) Let f: A ! B and g: B ! C. (i) Show that if at least one of f, g is a constant function, then g º f: A ! C is a constant function. (ii) If g º f: A ! C is a constant function, does it follow that at least one of at least one of f, g is a constant function (give a verification or a counter-example). (b) What would be the natural way of defining the projection of an n-place function from its ith argument place, thus generalizing the notions of left and right projection. (c) Let f: A B ! C be a function of two arguments. Verify or give counter-examples to the following. (i) If f is injective in the strongest of the three senses of Exercise 3.3.1 (2), then every (left and right) projection of f is also injective. (ii) If f is surjective then every projection of f is also surjective. Solution (a) (i) Let f: A ! B and g: B ! C. Suppose that there is a c 2 C such that g (b) = c for all b 2 B. Choose such a c, call it c0. Then since always f(a) 2 B, we have that for all a 2 A, g º f(a) = g(f(a)) = c0. Suppose alternatively that there is a b 2 B such that f(a) = b for all a 2 A. Choose such a b, call it b0. Then, for all a 2 A, g º f(a) = g(f(a)) = g(b0). (a) (ii) No; draw a diagram as you read this counter-example. Put A = {1,2}, B = {3,4,5}, C = {6,7}. Define f by f(1) = 3, f(2) = 4 and define g by g(3) = g (4) = 6 but g(5) = 7. Then neither f nor g is a constant function but g º f is a constant function with value 6 for all its arguments. (b) In general terms, we hold the ith argument fixed at some value and consider the (n − 1)-argument function obtained by allowing the other arguments to vary. In full notational glory, let f: A1 … An! C be a function of n arguments and let a 2 Ai. We define fa: A1 … Ai−1 Ai+1 … An! C by putting fa(a1, …, ai−1, ai+1, …, an) = fa(a1, …, ai−1, a, ai+1, …, an) for all aj 2 Aj with j 6¼ i. (c) (i) True. Verification: suppose f is injective in the strongest of the three senses of Exercise 3.3.1 (2). Then, for the right projection, if fa(b) = fa(b′) we have f (a,b) = f(a,b′) so b = b′ as needed. Similarly, for the left projection. (ii) False; draw a diagram as you read this counter-example. Put A = {1,2}, B = {3}, C = {4,5}. Define f by f(1,3) = 4, f(2,3) = 5. Then f is onto C but neither of its right projections f1, f2 is onto C.
3.8 Selected Reading
3.8
113
Selected Reading
The texts of Bloch, Halmos, Hein, Lipschutz and Velleman, listed at the end of chapters 1 and 2, also have good chapters on functions with the same attractions as their presentations of sets and relations. The specific chapters are 4, 8–10, 2, 4–5 and 5 respectively. If you are tempted to explore the axiom of choice or the Cantor-Schröder-Bernstein theorem, a good place to begin is Paul R. Halmos Naive Set Theory, Springer, 2001 (new edition) chapters 15–17 and 22 respectively.
4
Recycling Outputs as Inputs: Induction and Recursion
Chapter Outline This chapter introduces induction and recursion, which are omnipresent in computer science and logic. The simplest context in which they arise is in the domain of the positive integers, and that is where we begin. We explain induction as a method for proving facts about the positive integers, and recursion as a method for defining functions on the same domain. We also describe two different methods for evaluating such functions. From this familiar terrain, the basic concepts of recursion and induction can be extended to structures, processes and procedures of many kinds, not only numerical ones. Particularly useful for computer scientists are the forms known as structural induction and recursion, and we give them special attention. We look at structural recursion as a way of defining sets, structural induction as a way of proving things about those sets, and then structural recursion once more as a way of defining functions with recursively defined domains. At this last point special care is needed, as the definitions of such functions succeed only when a special condition of unique decomposability is satisfied by their domains. The broadest and most powerful kind of induction/recursion may be formulated for any set at all, provided it is equipped with a relation that is well-founded in a sense we explain. All other kinds may be seen as special cases of that one. In a final section we look briefly at the notion of a recursive program and see how the ideas that we have developed in the chapter are manifested there.
4.1
What are Induction and Recursion?
The two words are used in different contexts. ‘Induction’ is the term more commonly applied when talking about proofs. ‘Recursion’ is the one used in connection with constructions and definitions. We will follow this tendency, speaking of inductive proofs and recursive definitions. But it should not be thought that they © Springer Nature Switzerland AG 2020 D. Makinson, Sets, Logic and Maths for Computing, Undergraduate Topics in Computer Science, https://doi.org/10.1007/978-3-030-42218-9_4
115
116
4
Recycling Outputs as Inputs: Induction and Recursion
answer to two fundamentally different concepts: the same basic idea is involved in each. What is this basic idea? It will help if we look for a moment at the historical context. We are considering an insight that goes back to ancient Greece and India, but whose explicit articulation had difficulty breaking free from a long-standing rigidity. From the time of Aristotle onwards it was a basic tenet of philosophy, logic and science in general, that nothing should ever be defined in terms of itself on pain of making the definition circular. Nor should any proof assume what it is setting out to prove, for that too would create circularity. Taken strictly, these precepts remain perfectly acceptable. But it was also gradually realized that definitions, proofs, and procedures may ‘call upon themselves’, in the sense that later steps may systematically appeal to the outcome of earlier steps. For example, the value of a function for a given value of its argument may be defined in terms of its value for smaller arguments; a proof of a fact about an item may assume that we have already proven the same fact about lesser items; an instruction telling us how to carry out steps of a procedure or program may specify this in terms of what previous steps have already been performed. In each case what we need, to keep control, is a clear stepwise ordering of the domain we are working on, with a clearly specified starting point. What do these two requirements mean? To clarify them we begin by looking at the simplest context in which they are satisfied: the positive integers. There we have a definite starting point, 1. We also have a clear stepwise ordering, namely the passage from any number n to its immediate successor s(n), more commonly written n + 1. This order exhausts the domain, in the sense that every positive integer may be obtained by applying the step finitely many times from the starting point. Not all number systems are of this kind. For example, the set Z of all integers, negative as well as positive, has no starting point under its natural ordering. The set Q of rational numbers not only lacks a starting point, but it also has the wrong kind of order: no rational number has an immediate rational successor; likewise for the set R of reals. Conversely, recursion and induction need not be confined to number systems. They can be carried out in any structure satisfying certain abstract conditions that make precise the italicised requirements above. Such non-numerical applications are very important for computer science but are often neglected in accounts written from a traditional mathematical perspective, where numbers take front stage. We will come to them later in the chapter.
4.2
Proof by Simple Induction on the Positive Integers
We begin with a simple example familiar from high school, and then articulate the principle lying behind it.
4.2 Proof by Simple Induction on the Positive Integers
117
4.2.1 An Example Suppose that we want to find a formula that identifies explicitly the sum of the first n positive integers. We might calculate a few cases, seeing that 1 = 1, 1 + 2 = 3, 1 + 2+3 = 6, 1 + 2 + 3 + 4 = 10, etc. In other words, writing R{i: 1 i n} or Ri{1 i n} or just f(n) for the sum of the first n positive integers, we see by calculation that f(1) = 1, f(2) = 3, f(3) = 6, f(4) = 10, etc. After some experimenting, we may hazard the conjecture (or hear somewhere) that quite generally f (n) = n (n + 1)/2. But how can we prove this? If we continue calculating the sum for specific values of n without ever finding a counterexample to the conjecture, we may become more and more convinced that it is correct; but that will never give us a proof that it is so. For no matter how many specific instances we calculate, there will always be infinitely many still to come. We need another method—and that is supplied by simple induction. Two steps are needed. • The first step is to note that the conjecture f(n) = n (n + 1)/2 holds for the initial case that n = 1, in other words that f(1) = 1 (1 + 1)/2. This is a matter of trivial calculation, since we have already noticed that f(1) = 1, while clearly also 1 (1 + 1)/2 = 1. This step is known as the basis of the inductive proof. • The second step is to prove a general statement: whenever the conjecture f (n) = n (n + 1)/2 holds for n = k, then it holds for n = k + 1. In other words, we need to show that for all positive integers k, if f(k) = k (k + 1)/2 then f (k + 1) = (k + 1) (k + 2)/2. This general if-then statement is known as the induction step of the proof. It is a universally quantified conditional statement. Notice how the equality in its consequent is formulated by substituting k + 1 for k in the antecedent. Taken together, these two are enough to establish our original conjecture. The first step shows that the conjecture holds for the number 1. The induction step may then be applied to that to conclude that it also holds for 2; but it may also be applied to that to conclude that the conjecture also holds for 3, and so on for any positive integer n. We don’t actually have to perform all these applications one by one; indeed, we couldn’t possibly do so, for there are infinitely many of them. But we have a guarantee, from the induction step, that each of these applications could be made. In the example, how do we go about proving the induction step? As it is a universally quantified conditional statement about all positive integers k, we proceed in the standard way described in an earlier logic box. We let k be an arbitrary positive integer, suppose the antecedent to be true, and show that the consequent must also be true. In detail, let k be an arbitrary positive integer. Suppose f(k) = k (k + 1)/2. We need to show that f(k + 1) = (k + 1) (k + 2)/2. Now:
118
4
Recycling Outputs as Inputs: Induction and Recursion
f ðk þ 1Þ ¼ 1 þ 2 þ . . . þ k þ ðk þ 1Þ
by the definition of the function f
¼ ð1 þ 2 þ . . . þ kÞ þ ðk þ 1Þ arranging brackets ¼ f(k) + (k + 1) ¼ ½k ðk þ 1Þ=2 þ ðk þ 1Þ
by the definition of the function f again by the supposition f ðkÞ ¼ k ðk þ 1Þ=2
¼ ½k ðk þ 1Þ þ 2ðk þ 1Þ=2 ¼ k2 þ 3k þ 2 =2
by elementary arithmetic ditto
¼ ðk þ 1Þ ðk þ 2Þ=2
ditto:
This completes the proof of the induction step, and thus of the proof as a whole! The key link in the chain of equalities is the italicized one, where we apply the supposition.
4.2.2 The Principle Behind the Example The rule used in this example is called the simple principle of mathematical induction and may be stated as follows. Consider any property that is meaningful for positive integers. To prove that every positive integer has the property, it suffices to show: Basis: The least positive integer 1 has the property, Induction step: Whenever a positive integer k has the property, then so does k + 1. The same principle may be stated in terms of sets rather than properties. Consider any set A N+. To establish that A = N+, it suffices to show two things: Basis: 1 2 A, Induction step: Whenever a positive integer k 2 A, then also (k + 1) 2 A. Checking the basis is usually a matter of trivial calculation. Establishing the induction step is carried out in the same way as in the example: we let k be an arbitrary positive integer, suppose that k has the property (that k 2 A), and show that k + 1 has the property (that k + 1 2 A). In our example, that was easily done; tougher problems require more sweat, but still within the same general framework. Within the induction step, the supposition that k has the property, is called the induction hypothesis. What we set out to show from that supposition, i.e. that k + 1 has the property, is called the induction goal. We will often need to use these two terms in what follows.
4.2 Proof by Simple Induction on the Positive Integers
119
Exercise 4.2.2 (1) Use the principle of induction over the positive integers to show that for every positive integer n, the sum of the first n odd integers is n2. Solution Write f(n) for the sum of the first n odd integers, i.e. for 1 + 3+ … + (2n − 1). We need to show that f(n) = n2 for every positive integer n. Basis: We need to show that f(1) = 12. But clearly f(1) = 1 = 12 and we are done. Induction step: Let k be any positive integer, and suppose (induction hypothesis) that the property holds when n = k, i.e. suppose that f(k) = k2. We need to show (induction goal) that it holds when n = k + 1, i.e. that f(k + 1) = (k + 1)2. Now: f ðk þ 1Þ ¼ 1 þ 3 þ . . . þ ð2k 1Þ þ ð2ðk þ 1Þ 1Þ
by definition of f
¼ ð1 þ 3 þ . . . þ ð2k 1ÞÞ þ ð2ðk þ 1Þ 1Þ arranging brackets ¼ f ðkÞ þ 2ðk þ 1Þ 1 also by definition of f ¼ k2 þ 2ðk þ 1Þ 1 2
¼ k þ 2k þ 1 2
¼ ðk þ 1Þ
by the induction hypothesis by elementary arithmetic ditto: End of solution
What if we wish to prove that every natural number has the property we are considering? We proceed in exactly the same way, except that we start with 0 instead of 1: Basis: The least natural number 0 has the property, Induction step: Whenever a natural number k has the property, then so does k + 1. In the language of sets: Basis: 0 2 A, Induction step: Whenever a natural number k 2 A, then also (k + 1) 2 A. Sometimes it is more transparent to state the induction step in an equivalent way using subtraction by one rather than addition by one. For natural numbers, say, in the language of properties: Induction step: For every natural number k > 0, if k − 1 has the property, then so does k.
120
4
Recycling Outputs as Inputs: Induction and Recursion
In the language of sets: Induction step: For every natural number k > 0, if k − 1 2 A, then also k 2 A. Note carefully the proviso k > 0: this is needed to ensure that k − 1 is a natural number when k is. If we are inducing over the positive integers only, then of course the proviso becomes k > 1. When should you use induction over the positive integers, and when over the natural numbers? Quite simply, when you are trying to prove something for all the natural numbers, induce over them; if you are interested only in the positive integers, induce over them. In what follows, we will pass from one to the other without further comment. It is quite common to formulate the induction step in an equivalent contrapositive form, particularly when it is stated with subtraction rather than addition. Thus for example, the last version of the induction step becomes: For every natural number k > 0, if k 62 A, then also k − 1 62 A. Exercise 4.2.2 (2) Reformulate the first two of the displayed formulations of the induction step in contrapositive form, stating them with subtraction rather than addition. Solution For every positive integer k > 1, if k lacks the property than so does k − 1. For every positive integer k > 1, if k 62 A, then k − 1 62 A. Exercise 4.2.2 (3) In Exercise 3.4.1 (b) of Chap. 3, we used the pigeonhole principle to show that in any reception attended by n 1 people, if everybody shakes hands just once with everyone else, then there are n (n − 1)/2 handshakes. Show this again, by using the simple principle of induction over the positive integers. Solution Basis: This is the case n = 1. In this case there are 0 handshakes, and 1 (1 − 1)/ 2 = 0, so we are done. Induction step: Let k be any positive integer, and suppose (induction hypothesis) that the property holds when n = k, that is, suppose that when there are k people, there are k (k − 1)/2 handshakes. We need to show (induction goal) that it holds when n = k + 1, in other words, that when there are k + 1 people then there are (k + 1) ((k + 1) − 1)/2 = k (k + 1)/2 handshakes. Consider any one of these k + 1 people, and call that person a. Then the set of all handshakes is the union of two disjoint sets: the handshakes involving a, and those not involving a. Hence (recall from Chap. 1) the total number of handshakes is equal to the number involving a plus the number not involving a. Clearly there are just k handshakes of the former kind, since a shakes hands just once with everyone
4.2 Proof by Simple Induction on the Positive Integers
121
else. Since there are just k people in the reception other than a, we also know by the induction hypothesis that there are k (k − 1)/2 handshakes of the latter kind. Thus there is a total of k + [k (k − 1)/2] handshakes. It remains to check by elementary arithmetic that k + [k (k − 1)/2] = [2k + k (k − 1)]/2 = (2k + k2 − k)/2 = (k2 + k))/2 = k (k + 1)/2 as desired. End of solution.
Exercise 4.2.2 (3) illustrates the fact that a problem can sometimes be tackled in two quite different ways—either by induction, or directly. The same phenomenon can be illustrated by the very first example of this chapter, where we showed by simple induction that the sum of the first n positive integers equals n (n + 1)/2. A short, clever proof of the same fact is attributed to Gauss when still a schoolboy. It could be called a geometric proof or an argument by rearrangement. Let s be the sum of the first n positive integers. Clearly 2s = (1 + …+n) + (n + …+1) = n (n + 1) by adding the corresponding terms n times, so s = n (n + 1)/2. When a ‘direct’ proof like this is available, people often find it more illuminating and, in some elusive sense, more explanatory, than an inductive proof, but the two are equally conclusive. We end this section with some general advice. When proving something by induction it is essential to keep clearly in mind what the induction hypothesis and induction goal are. Unless they are made explicit, it is easy to become confused. Students rarely have difficulty with the basis, but often get into a mess with the induction step because they have not identified clearly what it is, and what its two components (induction hypothesis, induction goal) are. Always write out the proposition expressing the induction step explicitly before trying to prove it and, until the whole procedure becomes second nature, label the induction hypothesis and induction goal within it. To keep a clear idea of what is going on, separate in your mind the general strategy of the induction from whatever numerical calculations may come up within its execution. Students are sometimes puzzled why here (and in most presentations) we use one variable n when stating the proposition to be proven by induction, but another variable k when proving the induction step. Does it make a difference? The short answer is: No. The reason for using different variables is purely pedagogical. We could perfectly well use the same one (say n) in both, but classroom experience again warns that doing so irrevocably confuses those who are already struggling. So, to emphasise that the proposition to be proven by induction and the proposition in the proof serving as induction hypothesis are two quite different things, we use different variables. Alice Box: How to cook up the right property? Alice
That is all very well, but I am still rather dissatisfied. If you ask me to prove by induction that, say, for every positive integer n, the sum of the first n even integers is n(n + 1), I am sure that I could do it now. But if you were to ask me, instead, to show by induction that we can express the sum of the first n even positive integers in some
122
Hatter
4
Recycling Outputs as Inputs: Induction and Recursion
neat way, I am not sure that I could think up that expression n (n + 1) in order to begin the proof. Induction seems to be good for proving things that you already suspect are true, but not much use for imagining what might be true in the first place! Indeed, it is quite an art to guess the right equality (or more generally, property) to induce on; once you think it up, the induction itself is often plain sailing. Like all art, it needs practice and experience. But that’s part of what makes it interesting…
Exercise 4.2.2 (4) (a) Do what Alice is sure that she can do now. (b) Do it again, but this time without a fresh induction. Instead, use what had already been shown by induction about the sum of the first n positive integers and the sum of the first n odd ones. Solution (a) We want to show that R{2i: 1 i n}, that is, the sum of the first n even positive integers, is n(n + 1). Basis: When n = 1, then LHS = 2 while RHS = 1 (1 + 1) = 2. Induction step: Suppose (induction hypothesis) that R{2i: 1 i k} = k(k + 1). We want to show (induction goal) that R{2i: 1 i k + 1} = (k + 1)(k + 2). Now, LHS = R{2i: 1 i k} + 2(k + 1) = k (k + 1) + 2(k + 1) = k2 + 3k + 2 = RHS using the induction hypothesis for the second equality and multiplying out the RHS for the last equality. (b) Begin by observing that the first 2n positive integers are precisely the first n odd ones and the first n even ones. So, the sum of the first n odd integers plus the sum of the first n even integers equals the sum of the first 2n integers. In other words, the sum of the first n even integers equals the sum of the first 2n integers minus the sum of the first n odd integers. We already have the formulae for the RHS: 2n (2n + 1)/2 − n2 = n (2n + 1) − n2 = n2 + n = n(n + 1) as desired. End of solution.
Exercise 4.2.2 (4) shows that we sometimes have the choice between proving something from first principles or proving it from facts already established. Usually, the latter is quicker, but not always; in this instance they are about the same length.
4.3 Definition by Simple Recursion on the Positive Integers
4.3
123
Definition by Simple Recursion on the Positive Integers
We now dig below the material of the preceding section. Roughly speaking, one can say that underneath every inductive proof lurks a recursive definition. In particular, when f is a function on the positive integers (or natural numbers) and we can prove inductively something about its behaviour, then f itself may be defined (or at least characterized) in a recursive manner. For an example, consider again the function f used in the first example of this chapter. Informally, f(n) was understood to be the sum 1 + 2 + 3 + … + n of the first n positive integers. The reason why induction could be applied to prove that f (n) = n (n + 1)/2 is that the function f can itself be defined recursively. What would such a definition look like? As one would expect, it consists of a basis giving the value of f for the least positive integer argument 1, and a recursive (or, as is often said, an inductive) step giving the value of f for any argument n + 1 in terms of its value for argument n. Thus, in a certain sense the function is being defined in terms of itself, but in a non-circular manner: the value f(n + 1) is defined in terms of f(n) with the lesser argument n. Specifically, in our example, the basis and recursive step are as follows: Basis of definition : f ð1Þ ¼ 1 Recursive step of definition : when n 1 then f ðn þ 1Þ ¼ f ðnÞ þ ðn þ 1Þ: This way of expressing the recursive step defines f(n + 1) in terms of f(n) (and other functions taken as given, in our example addition). Another way of writing it defines f(n) in terms of f(n − 1). In our example, this puts: Recursive step of definition : when n [ 1 then f ðnÞ ¼ f ðn 1Þ þ n: Other ways of writing recursive definitions are also current among computer scientists. In particular, one can think of the basis and induction step as being limiting and principle cases respectively, writing in our example: If n ¼ 1 then f ðnÞ ¼ 1 If n [ 1 then f ðnÞ ¼ f ðn 1Þ þ n: This can be abbreviated to the popular if-then-else form: If n ¼ 1 then f ðnÞ ¼ 1 Else f ðnÞ ¼ f ðn 1Þ þ n:
124
4
Recycling Outputs as Inputs: Induction and Recursion
Some computer scientists like to abbreviate this further to the ungrammatical declaration: f ðnÞ ¼ if n ¼ 1 then 1 else f ðn 1Þ þ n; which can look like mumbo-jumbo to the uninitiated. All of these formulations say the same thing. You will meet each of them in applications and should be able to recognize them. The choice is partly a matter of personal preference, partly a question of which one allows you to get on with the problem in hand with the least clutter. Exercise 4.3 (a) Define recursively the following functions f(n) on the positive integers: (i) The sum 2 + 4+ … + 2n of the first n even integers, (ii) The sum 1 + 3 + … + (2n − 1) of the first n odd integers. (b) Define recursively the function that takes a natural number n to 2n. This is called the exponential function. (c) Define recursively the product of the first n positive integers. This is known as the factorial function, written n!, is pronounced ‘n factorial’. (d) Use the recursive definitions of the functions concerned to show that for all n 4, n! > 2n. Hint: Here the basis will concern the case that n = 4. Solution (a) (i) Basis: f(1) = 2. Recursive step: when n > 1 then f(n + 1) = f(n) + 2(n + 1). (ii) Basis: f(1) = 1. Recursive step: when n > 1 then f(n + 1) = f(n) + 2n + 1. (b) Basis: 20 = 1. Recursive step: 2n+1 = 2 2n. (c) Basis: 1! = 1. Recursive step: (n + 1)! = (n + 1) n! (d) Basis of proof: We need to show that 4! > 24. This is immediate by calculating 4! = 1 2 3 4 = 24 > 16 = 24. Inductive step of proof: Let k be any positive integer with k 4. Suppose that k! > 2k (induction hypothesis). We need to show that (k + 1)! > 2k+1 (induction goal). This can be done as follows: ðk þ 1Þ! ¼ ðk þ 1Þ k! by definition of the factorial function [ ðk þ 1Þ 2k [22 ¼2
k
kþ1
by the induction hypothesis since k 4 by definition of the exponential function: End of solution:
The factorial and exponentiation functions are both very important in computer science, as indications of the alarming way in which many processes can grow in size (as measured by, say, number of steps required, time taken or memory required) as inputs increase in size. In Chap. 1 we saw that exponentiation already gives unmanageable rates of growth. Exercise 4.3 shows that factorial is worse.
4.4 Evaluating Functions Defined by Recursion
4.4
125
Evaluating Functions Defined by Recursion
Go back yet again to the first function that was defined by recursion in the preceding section: the sum f(n) of the first n positive integers. Suppose that we want to calculate the value of f(7) using the recursive definition and without appealing to a general formula such as f(n) = n (n + 1)/2. There are basically two ways of doing it. An obvious way is bottom-up or forwards. We first calculate f(1), use it to get f(2), use it for f(3), and so on. Thus we obtain: fð1Þ ¼ 1 fð2Þ ¼ fð1Þ þ 2 ¼ 1 þ 2 ¼ 3 fð3Þ ¼ fð2Þ þ 3 ¼ 3 þ 3 ¼ 6 fð4Þ ¼ f ð3Þ þ 4 ¼ 6 þ 4 ¼ 10 fð5Þ ¼ f ð4Þ þ 5 ¼ 10 þ 5 ¼ 15 fð6Þ ¼ f ð5Þ þ 6 ¼ 15 þ 6 ¼ 21 fð7Þ ¼ f ð6Þ þ 7 ¼ 21 þ 7 ¼ 28: Here we have made one application of the base clause followed by six applications of the recursion clause. Each application is followed by arithmetic simplification as needed. Each of the seven steps fully eliminates the function sign f on the right-hand side and provides us with a specific numeral as value of f(i) for some i 7. The other way of calculating, at first a little less obvious, is top-down, or backwards. It is also known as unfolding the recursive definition or tracing the function, and is as follows: fð7Þ ¼ fð6Þ þ 7 ¼ ðfð5Þ þ 6Þ þ 7 ¼ ððfð4Þ þ 5Þ þ 6Þ þ 7 ¼ ðððfð3Þ þ 4Þ þ 5Þ þ 6Þ þ 7 ¼ ððððfð2Þ þ 3Þ þ 4Þ þ 5Þ þ 6Þ þ 7 ¼ ðððððfð1Þ þ 2Þ þ 3Þ þ 4Þ þ 5Þ þ 6Þ þ 7 ¼ ððððð1 þ 2Þ þ 3Þ þ 4Þ þ 5Þ þ 6Þ þ 7 ¼ ðððð3 þ 3Þ þ 4Þ þ 5Þ þ 6Þ þ 7 ¼ ððð6 þ 4Þ þ 5Þ þ 6Þ þ 7 ¼ ðð10 þ 5Þ þ 6Þ þ 7 ¼ ð15 þ 6Þ þ 7 ¼ 21 þ 7 ¼ 28:
126
4
Recycling Outputs as Inputs: Induction and Recursion
In this calculation, we begin by writing the expression f(7) whose value we are seeking, then make a substitution for it as authorized by the recursion clause of the definition then, in that expression, substitute for f(6), and so on until after six steps we can at last apply the basis of the definition to f(1) to obtain (in line 7) a purely numerical expression in which f does not appear. From that point on, we simplify the numerical expression until, in another six steps, we emerge with a standard numeral. Which is the better way to calculate? In this example, it does not make a significant difference. Indeed, quite generally, when the function is defined using simple recursion of the kind described in this section, the two modes of calculation will be of essentially the same length. The second one looks longer, but that is because we have left all arithmetic simplifications to the end (as is customary when working top-down) rather than doing them as we go. Humans often prefer the first mode, for the psychological reason that it gives us something ‘concrete’ at each step, making them feel safer; but a computer would not care. Nevertheless, when the function is defined by more sophisticated forms of recursion that we will describe in the following sections, the situation may become quite different. It can turn out that one, or the other, of the two modes of evaluation is dramatically more economical in resources of memory or time. Such economies are of little interest to the traditional mathematician, but they are of great importance for the computer scientist. They may make the difference between a feasible calculation procedure and one that, in a given state of technology, is quite unfeasible. Exercise 4.4 Evaluate 6! bottom-up and then again top-down (unfolding). Solution See Table 4.1. Table 4.1 Calculating 6! bottom-up and top-down Bottom-up
Top-down
1! 2! 3! 4! 5! 6!
6! = 5! 6 ¼ (4! 5) 6 ¼ ((3! 4) 5) 6 ¼ (((2! 3) 4) 5) 6 ¼ ((((1! 2) 3) 4) 5) 6 ¼ ((((1 2) 3) 4) 5) 6 ¼ (((2 3) 4) 5) 6 ¼ ((6 4) 5) 6 ¼ (24 5) 6 ¼ 120 6 ¼ 720
= = = = = =
1 1! 2! 3! 4! 5!
2 3 4 5 6
= = = = =
12=2 23=6 6 4 = 24 24 5 = 120 120 6 = 720
4.5 Cumulative Induction and Recursion
4.5
127
Cumulative Induction and Recursion
We now turn to some rather more sophisticated forms of recursive definition and inductive proof. Ultimately, the forms introduced in this section can be derived from the simple one, but we will not do so here; we are interested in them as tools-for-use.
4.5.1 Cumulative Recursive Definitions In definitions by simple recursion such as that of the factorial function we reached back only one notch at a time, in other words, the recursion step defined f(n) out of f (n − 1). But sometimes we want to reach back further. A famous example is the Fibonacci function on the natural numbers (that is, beginning from 0 rather than from 1), named after an Italian mathematician who considered it in the year 1202. Since then it has found surprisingly many applications in computer science, biology and elsewhere. To define it we use recursion. The basis now has two components: Fð0Þ ¼ 0 Fð1Þ ¼ 1: So far, F behaves just like the identity function. But then, in the recursion step, Fibonacci takes off: FðnÞ ¼ Fðn 1Þ þ Fðn 2Þ whenever n 2. This function illustrates how a top-down evaluation by unfolding, if not pruned somehow, can lead to great inefficiencies in computation due to repetition of calculations already made. Beginning a top-down computation of F(8) we have to make many calls, as represented in Table 4.2. To read it, notice that each cell in a row is split into two in the row below, following the recursive rule for the function, so that value of each cell equals the sum of the values in the two cells immediately below. The table is not yet complete—it hasn’t even reached the point where all the letters F are eliminated and the arithmetic simplifications begin—but it is already clear that there is a great deal of repetition. The value of F(6) is calculated twice, that of F(5) three times, F(4) five times, F(3) eight times (if we include the one still to come in the next row). Unless partial calculations are saved and recycled in some manner, the inefficiency of the procedure is very high.
128
4
Recycling Outputs as Inputs: Induction and Recursion
Table 4.2 Calls when computing F(8) top-down
F(8) F(7)
F(6)
F(6) F(5) F(4)
F(3)
F(5) F(4)
F(3)
F(2)
F(4) F(3)
F(2)
F(5) F(3)
F(2)
F(4)
F(1)
F(3)
F(2)
F(4) F(3)
F(2)
F(1)
F(3) F(2)
F(1)
F(2) F(1)
F(0)
etc
Exercise 4.5.1 (a) Rewrite the definition of the Fibonacci function in if-then-else language. (b) Express the recursion clause for the Fibonacci function by defining F(n + 2) in terms of F(n + 1) and F(n). Be explicit about the bound of your quantification. (c) Carry out a bottom-up evaluation of F(8) and compare it with the (incomplete) top-down evaluation in the text. Solution (a) If n = 0 then F(n) = 0, if n = 1 then F(n) = 1, else F(n) = F(n − 1) + F(n − 2). (b) When n 2 then F(n + 2) = F(n + 1) + F(n). (c) F(0) = 0, F(1) = 1, F(2) = 1 + 0 = 1, F(3) = 1 + 1 = 2, F(4) = 2 + 1 = 3, F (5) = 3 + 2 = 5, F(6) = 5 + 3 = 8. End of solution.
On the other hand, there are situations in which evaluation bottom-up can be less efficient. Here is a simple example. Define f as follows: Basis: f(0) = 2. Recursion step: f(n) = f(n − 1)n for odd n > 0, f(n) = f(n/2) for even n > 0. To calculate f(8) by unfolding is quick and easy: f(8) = f(4) = f(2) = f(1) by three applications of the second case of the recursion step and finally f(1) = f (0)1 = 21 = 2 by the first case of the recursion step together with the basis. But if we were to calculate f(8) bottom-up without devising shortcuts, we would be doing a lot of unnecessary work calculating f(n) for odd values 3,5,7 of n. We will see a more dramatic example of the same phenomenon shortly, when considering what is known as the Ackermann function.
4.5 Cumulative Induction and Recursion
129
4.5.2 Proof by Cumulative Induction There is no limit to how far a recursive definition may reach back when defining f (n), and so it is useful to have a form of argument that permits us to do the same when proving things about f(n). It is called cumulative induction, sometimes also known as course-of-values induction. Formulated for the natural numbers, in terms of properties, the principle of cumulative induction is as follows: To show that every natural number has a certain property, it suffices to show the basis and induction step: Basis: 0 has the property. Induction step: For every natural number k, if every natural number j < k has the property, then k itself also has the property. Exercise 4.5.2 (1) (a) Express the induction step of the principle of cumulative induction contrapositively. (b) Use cumulative induction to show that every natural number n 2 is the product of (one or more) prime numbers. Solution (a) For every natural number k, if k lacks the property, then there is a natural number j < k that lacks the property. This way of expressing the principle is sometimes known as descending induction. (b) Basis: We need to show that 2 has the property. Since 2 is itself prime, we are done. Induction step: Let k be any natural number with k 2. Suppose (induction hypothesis) that every natural number j with 2 j < k has the property. We need to show (induction goal) that k also has it. There are two cases to consider. If k is prime, then we are done. On the other hand, if k is not prime, then by the definition of prime numbers k = a b where a, b are positive integers with 2 a, b < k. So the induction hypothesis tells us that each of a, b has the property, i.e. is the product of (one or more) prime numbers. Hence their product is too, and we are done. End of solution. Part (b) of Exercise 4.5.2 (1) prompts several comments. The first concerns presentation. In the solution we kept things brief by speaking of ‘the property’ when we mean ‘the property of being the product of two prime numbers’. The example was simple enough for it to be immediately clear what property we are interested in; in more complex examples you are advised to take the precaution of stating the property in full at the beginning of the proof. Second, we began the induction at 2 rather than at 0 or 1. This is in fact covered by the version that begins from 0, for when we say that every natural number n 2
130
4
Recycling Outputs as Inputs: Induction and Recursion
has a certain property, this is the same as saying that for every natural number n, if n 2 then n has the property; when n < 2 then, as we saw in Sect. 1.6, the conditional is vacuously true. But when the induction begins at a specified number a > 0, it is usually more transparent to formulate its induction step in a form that mentions a explicitly as a bound on the quantifier. So expressed, cumulative induction starting at a is as follows. Basis: a has the property. Induction step: For every natural number k a, if every natural number j with a j < k has the property, then k itself also has the property. Don’t forget the a j in the induction step, as the property may not hold for smaller numbers! The third comment is that, strictly speaking, for cumulative induction the basis is covered by the induction step, and so is redundant! This contrasts with simple induction, where the basis is quite independent of the induction step and always needs to be established separately. The reason for the redundancy in the cumulative case is most easily seen when the induction starts from zero. There are no natural numbers less than zero so, vacuously, every natural number j < 0 has whatever property is under consideration so that, given the induction step, we may apply it to conclude that zero has the property and the basis holds. It looks like magic, but it is logic. Nevertheless, even for cumulative induction it is quite common to state the basis explicitly and even to check it out separately, in effect double-checking that we did not carelessly overlook some peculiarity of the case k = 0 when establishing the induction step in its generality. You are free to do likewise. Finally, the principle of cumulative induction is in fact derivable from that of simple induction. If this were a text for students of mathematics, we would give the proof, now but it isn’t, so we don’t. The important point for us is that although cumulative induction is derivable from the simple form, it is nevertheless extremely useful to have available as a rule in its own right, ready for application. Exercise 4.5.2 (2) (a) Use cumulative induction to show that for every natural number n, F(n) is even iff n is divisible by 3, where F is the Fibonacci function. (b) Adapt the remarks above to explain why the basis for cumulative induction is redundant when it starts from a > 0. Solution (a) Although we are carrying out a cumulative induction, we give the basis explicitly. Consider first the case n = 0, which is divisible by 3 while F(n) = 0, which is even. Consider next the case n = 1, which is not divisible by 3 while F(n) = 1, which is not even.
4.5 Cumulative Induction and Recursion
131
For the induction step, let k be any natural number 2 and suppose (induction hypothesis) that for every j < k, F(j) is even iff j is divisible by 3; we need to show that F(k) is even iff k is divisible by 3. We show the two implications separately. Suppose that k is divisible by 3; we need to check that F(k) is even. By the condition of the case, neither of k − 1, k − 2 is divisible by 3 so by the induction hypothesis F(k − 1), F(k − 2) are both odd, so F(k − 1) + F(k − 2) = F(k) is even. Suppose that k is not divisible by 3; we need to check that F(k) is odd. By the condition of the case, exactly one of k − 1, k − 2 is divisible by 3 so by the induction hypothesis one of F(k − 1), F(k − 2) is even while the other is odd, so F(k − 1) + F(k − 2) = F(k) is odd. (b) There is no natural number j less than a with a j so, vacuously, every natural number j less than a with a j < a has the property (whatever that property is) so, given the induction step, a itself also has the property.
4.5.3 Simultaneous Recursion and Induction When a function has more than one argument, its definition will have to take account of both of them. If the definition is recursive, we can often get away with recursion on just one of the arguments, holding the others as parameters. A simple example is the recursive definition of multiplication over the natural numbers using addition, which can be expressed as follows: Basis : m 0 ¼ 0 Recursion step : m ðn þ 1Þ ¼ ðm nÞ þ m The equality in the recursion step is usually taught in school as a fact about multiplication, which is assumed to have been defined or understood intuitively in some other way. In axiomatizations of arithmetic in the language of first-order logic, the equality is treated as an axiom of the system. But here we are seeing it as the recursive part of a definition of multiplication, given addition, which is how things are done in what is called second-order arithmetic. The same mathematical edifice can be built in many ways! Exercise 4.5.3 (1) (a) Give a recursive definition of the power function that takes a pair (m,n) to mn, using multiplication and with recursion on the second argument only. (b) Comment on the pattern shared by this definition of the power function and the preceding definition of multiplication.
132
4
Recycling Outputs as Inputs: Induction and Recursion
Solution (a) Basis: m0 = 1; recursion step: mn+1 = mn m. (b) In both cases the basis puts f(m,0) = a where a is a specified natural number, while the recursion step puts f(m,n + 1) = g(f(m,n), m) where g is a two-place function assumed to be already available. End of solution.
When a two-argument function is defined in this way, then inductive proofs for it will tend to follow the same lines as before, with induction carried out on the argument that was subject to recursion in the definition. But sometimes we need to define functions of two (or more) arguments with recursions on each of them. This is called definition by simultaneous recursion. A famous example is the Ackermann function. It has two arguments and can be given the following definition, due to Rósza Péter. Að0; nÞ ¼ n þ 1 Aðm; 0Þ ¼ Aðm 1; 1Þ for m [ 0 Aðm; nÞ ¼ Aðm 1; Aðm; n 1ÞÞ for m; n [ 0 The reason why this function is famous is its spectacular rate of growth. For m < 4 it remains leisurely, but when m 4 it accelerates dramatically, much more so than either the exponential or the factorial function. Even A(4,2) is about 2 1019728. This gives it a theoretical interest: although the function is computable, it can be shown that it grows faster than any function in the class of so-called ‘primitive recursive’ functions which are, roughly speaking, functions that can be defined by recursions of a fairly simple syntactic kind. For a short while after their articulation as a class of functions, they were thought to exhaust all the computable functions, until the Ackermann function provided a counterexample. But what interests us here us is the way in which the second and third clauses of the definition makes the value of the Ackermann function A(m,n) depend on its value for the first argument diminished by 1, but paired with a value of the second argument larger than n—larger by one in the case of the second clause and, after a few steps, very much larger for the third. As the function picks up speed, to calculate the value of A(m,n) for a given m may require prior calculation of A(m − 1,n′) for an extremely large n′ > n. Indeed, given the way in which the recursion condition reaches ‘upwards’ on the second variable, it is not immediately obvious that the three clauses taken together really succeed in defining a unique function. It can, however, be shown that they do, by introducing a suitable well-founded ordering on N2, and using the principle of well-founded recursion. We will explain the concept of a well-founded ordering in Sect. 4.7.
4.5 Cumulative Induction and Recursion
133
Alice Box: Basis and recursion step Alice
Hatter
Alice Hatter
There is something about the definition of the Ackermann function that bothers me. There are three clauses in it, not two. So which is the basis and which is the recursion step? The first clause gives the basis. Although it covers infinitely many cases, and uses a function on the right hand side, the function A that is being defined does not appear on the right. And the recursion step? It is given by the other two clauses together: the distinguishing feature that marks them both as parts of the recursion step is the reappearance of A on the right. The second clause is recursive in so far as the first argument is concerned, although it is a basis for the second argument; the third clause is recursive for both arguments. Quite a subtle pattern.
The Ackermann function illustrates dramatically the difference that can arise between calculating bottom-up or top-down, in the sense explained at the end of Sect. 4.4. For the first few values of m, n the two procedures are of about the same efficiency, but after a while the top-down approach does better and better. The reason is that a bottom-up calculation of A(m,n) without clever short-cuts will in general require calculating values of the function for many values of the arguments that are not really needed for the task.
4.6
Structural Recursion and Induction
We now come to the form of recursion and induction that is perhaps the most frequently used by computer scientists—structural. It can be justified or replaced by the versions for the natural numbers but may also be used, very conveniently, without ever mentioning any kind of number. It tends to be ignored in courses for mathematics students, but it is essential that those heading for computer science or logic be familiar with it. We introduce structural recursion/induction in three stages, remembering as we go the rough dictum that behind every inductive proof lurks a recursive definition. First, we look at the business of defining sets by structural recursion. That will not be difficult, because back in Chaps. 2 and 3 on sets and functions we were already doing it without, however, paying attention to the recursive aspect. Then we turn to the task of proving things about these sets by structural induction, which will also be quite straightforward. Finally, we come to the rather delicate part: the task of taking a recursively defined set and using structural recursion to define a function with it as domain. That is where care must be taken, for such definitions are legitimate only when a special constraint of ‘unique decomposability’ is satisfied.
134
4
Recycling Outputs as Inputs: Induction and Recursion
4.6.1 Defining Sets by Structural Recursion In earlier chapters we introduced the notions of the image and the closure of a set under a relation (Chap. 2) or function (Chap. 3). We now make intensive use of those notions. We begin by recalling their definitions, generalizing a little from binary (i.e. two-place) relations to relations of any finite number of places. Let X be any set, and let R be any relation (of at least two places) over the local universe within which we are working. Since m-argument functions are (m + 1)place relations, this covers functions of one or more arguments as well. The image of X under an (m + 1)-place relation R (where m 1) is defined by putting y 2 R(X) iff there are x1, …, xm 2 X with (x1, …, xm,y) 2 R. In the case that R is an m-argument function f, this is equivalent to saying: y 2 f(X) iff there are x1, …, xm 2 X with y = f(x1, …, xm). This definition is not recursive; that comes with the closure R[X]. We saw that it can be defined in either of two ways which we recall, leaving mention of the local universe implicit. The way of union (bottom up) defines R[X] recursively a sequence of sets indexed by the natural numbers and then takes their union: X0 ¼ X Xn þ 1 ¼ Xn [ RðXn Þ; for each natural number n R½X ¼ [ fXn : n 2 Ng: The way of intersection (top down) dispenses with numbers altogether. It puts R [X] = \ {Y: X Y R(Y)}. In other words, it defines R[X] as the intersection of the collection of all those sets Y such that both X Y and R(Y) Y. When R(Y) Y holds, it is often convenient to say that Y is closed under R; in that terminology, the top-down definition says that R[X] is the intersection of the collection of all those sets Y X that are closed under R. Exercise 4.6.1 (1) asks you to check out some important facts about closure that were stated without proof in Chap. 2 Sect. 2.7.2. They are quite challenging, but well worth the effort of mastering. Exercise 4.6.1 (1) (a) Verify that the intersection of all sets Y X that are closed under R is itself closed under R. (b) Writing X [ as temporary notation for R[X] defined bottom-up and X \ as temporary notation for R[X] defined top-down, show that X [ = X \ . Solution (a) Let x1, …, xm 2 \ {Y: X Y R(Y)} and suppose (x1, …, xm, y) 2 R; we need to show that y 2 \ {Y: X Y R(Y)}. Take any set Y with X Y R(Y); it suffices to show that y 2 Y. But since x1, …, xm 2 Y and (x1, …, xm, y) 2 R we have y 2 R(Y) and so, since R(Y) Y, we have y 2 Y as desired.
4.6 Structural Recursion and Induction
135
(b) To show that X [ = X \ it is best to check the two inclusions X [ X \ and X \ X [ separately. (i) For X [ X \ it suffices to show that each Xn A \ , which we do by induction on n. For the basis, we need to check that X0 X \ . But X0 = X, and X \ is an intersection of sets all of which include X so that X0 = X X \ . For the induction step, suppose that Xk X \ ; we need to show that Xk+1 X \ . Now, Xk+1 = Xk [ R(Xk), so it suffices to show that R(Xk) X \ , and so in turn it suffices to show that R(Xk) Y for each of the sets Y that are intersected to form X \ . Take any one such set Y. We know by the induction hypothesis Xk X \ , so Xk Y so clearly R(Xk) R(Y). We also know from the definition of X \ that R(Y) Y. Putting these together gives R(Xk) Y as desired. (ii) For X \ X [ , it suffices to show that X [ is one of the Y that are intersected to form X \ ; in other words, it suffices to show that X X [ and R(X [ ) X [ . The first is immediate from X = X0 [ {Xn : n 2 N} = X [ . For the second, suppose x1, …, xm 2 X [ and (x1, …, xm, y) 2 R; we need to show that y 2 X [ . Since xi 2 X [ = [ {Xn: n 2 N} we know that for each xi with 1 i m there is a natural number n(i) with xi 2 Xn(i). Let k be the greatest of the numbers n(1), …, n(m). Since the sets X0, X1, X2, … form a chain under inclusion, this implies that xi 2 Xk for all i with 1 i m. Hence y 2 R(Xk) Xk+1 [ {Xn: n 2 N} = X [ . End of solution. Having shown that X [ = X \ , we can now leave aside the temporary notation and refer to the set again as R[X], or even more briefly as X+ when the identity of the relation R is understood. Evidently, the definition of X+ can also be extended to cover an arbitrary collection of relations, rather than just one. The closure X+ of X under a collection {Ri}i2I of relations is defined to be the intersection of all sets Y X that are closed under all the relations in the collection. This brings us, at last, to the notion of definition by structural recursion. A set is defined by structural recursion whenever it is introduced as the closure X+ of some set X (referred to as the basis, or initial set of the definition) under some collection {Ri}i2I of relations (often called the constructors or generators of X+). In this context, it is sometimes intuitively helpful to think of each (m + 1)-place relation R as a rule that authorizes us to pass from items a1, …, am in X+ to an item y 2 X+ whenever (a1, …, am, y) 2 R. In this vein, X+ is also described as the closure of A under a collection of rules. We illustrate the idea of definition by structural recursion with five examples, the first two drawn from computer science, the next two from logic, and finally one from abstract algebra.
136
4
Recycling Outputs as Inputs: Induction and Recursion
Example 1 The notion of a string, already mentioned informally Chap. 3 Sect. 3.6.2, is of central importance for formulating many ideas of computer science, for instance the theory of finite state machines. Let X be any alphabet, consisting of elementary signs. Let k be an abstract object, distinct from all the letters in X, which is understood to serve as the empty string. The set of all strings over X, conventionally written as X*, is the closure of X [ {k} under the rule of concatenation, that is, under the operation of taking two strings s, t and forming their concatenation by writing s immediately followed by t. Example 2 We can define certain specific kinds of string by structural recursion. For instance, a string over an alphabet X is said to be a palindrome iff it reads the same from each end. Can we give this informal notion, known to grammarians since ancient times, a recursive definition? Very easily! The empty string k reads the same way from each end, and is the shortest even palindrome. Each individual letter in X reads the same way from left and from right, and so these are the shortest odd palindromes. All other palindromes may be obtained by successive symmetric flanking of given palindromes. So we may take the set of palindromes to be the closure of the set {k} [ X under the rule permitting passage from a string s to a string xsx for any x 2 X. In other words, it is the least set Y including {k} [ X such that xyx 2 Y for any y 2 Y and x 2 X. Example 3 Logicians also work with symbols, and constantly define sets by structural recursion. For example, the set of formulae of classical propositional logic (or any other logical system) is defined as the closure of an initial set X under some operations. In this case, X is a set of proposition letters. It is closed under the rules for forming compound formulae by means of the logical connectives allowed, for instance ¬, ^, _ (with parentheses around each application of a connective, to ensure unambiguous reading). So defined, the set of propositional formulae is a proper subset of the set Y* of all strings in the alphabet Y = X [ {¬,^,_} [ {(,)}. In case you have trouble reading the last bit, {(,)} is the set consisting of the left and right parentheses. Example 4 The set of theorems of a formal logical system is also defined by structural recursion. It is the closure X+ of some initial set X of formulae (known as the axioms of the system) under certain functions or relations between formulae (known as derivation rules of the system). A derivation rule that is very often used in this context is modus ponens (also known as detachment or !-elimination), permitting passage from formulae a and a ! b to the formula b. Example 5 Algebraists also use this kind of definition, even though they are not, in general dealing with strings of symbols. For example, if X is a subset of an algebra, then the subalgebra generated by X has as its carrier (i.e. underlying set) the closure X+ of X under the operations of the algebra, and as its operations the restriction to that carrier of the given operations over the whole algebra.
4.6 Structural Recursion and Induction
137
In all these cases, it is perfectly possible to use natural numbers as indices for successive sets X0, X1, X2, … in the generation of the closure by the way of union, and replace the structural definition by one that makes a cumulative recursion on those indices. Indeed, that is a fairly common style of presentation, and in some contexts has its advantages. But in other cases, it is more convenient to dispense with numerical indices and carry out the recursive definition in perfectly set-theoretic terms using the top-down formulation. Alice Box: Defining the set of natural numbers recursively Alice
Hatter
Alice Hatter
Alice Hatter
My friend studying the philosophy of mathematics tells me that even the set of natural numbers may be defined by structural recursion. This, he says, is the justification for induction over the integers. Is that possible? We can define the natural numbers in that way, if we are willing to identify them with certain designated sets. There are many ways of doing it. For example, we can take N to be the least collection that contains the empty set ∅ and is closed under the operation taking each set Y to Y [ {Y}. In this way arithmetic is reduced to set theory. Does that justify induction over the natural numbers? It depends on which way you are doing things. On the one hand, when arithmetic is axiomatized in its own terms, without reducing it to anything else, induction is simply treated as an axiom and so is not given a formal justification. But when arithmetic is reduced to set theory along the lines that I just mentioned, induction is longer treated as an axiom, since it can be proven. But which is the best way of proceeding? That depends on your philosophy of mathematics. In my view, it is not a question of one way being right and the other being wrong, but one of convenience for the tasks in hand. But discussing that any further would take us too far off our track.
Exercise 4.6.1 (2) Define by structural recursion the set of even palindromes over an alphabet X, i.e. the palindromes with an even number of letters. Solution The set of even palindromes over X is the closure of {k} under the same rule as used for palindromes in general, i.e. passage from a string s to a string xsx for any x 2 X.
138
4
Recycling Outputs as Inputs: Induction and Recursion
4.6.2 Proof by Structural Induction We have seen that the procedure of defining a set by structural recursion, i.e. as the closure of a set under given relations or functions, is pervasive in computer science, logic and abstract algebra. Piggy-backing on that mode of definition is a mode of demonstration that we will now examine—proof by structural induction. Let X be a set of any items whatsoever, let X+ be the closure of X under a collection {Ri}i2I of relations. Consider any property that we would like to show holds of all elements of X+. We say that a relation R preserves the property iff whenever x1, …, xm have the property and (x1, …, xm, y) 2 R, then y also has it. When R is a function f, this amounts to requiring that whenever x1, …, xm has the property then f(x1, …, xm) also has the property. The principle of proof by structural induction may now be stated as follows. Again, let X be a set, and X+ the closure of X under a collection {Ri}i2I of relations. To show that every element of X+ has a certain property, it suffices to show two things: Basis: Every element of X has the property. Induction step: Each relation R 2 {Ri}i2I preserves the property. Proof of the principle is almost immediate given the definition of the closure X+. Let P be the set of all items that have the property in question. Suppose that both basis and induction step hold. By the basis, X P. Since the induction step holds, P is closed under the relations Ri. Hence by the definition of X+ as the least set with those two features, we have X+ P, i.e. every element of X+ has the property, as desired. For an example of the application of this principle, suppose we want to show that every even palindrome has the property that every letter that occurs in it occurs an even number of times. Recall from the last exercise, that the set of even palindromes over a set X of letters is the closure of {k} under passage from a string s to a string xsx where x 2 X. So we need only show two things: that k has the property in question, and that whenever s has it then so does xsx for any x 2 X. The former holds vacuously, since there are no letters in k (remember, k is not itself a letter). The latter is trivial, since the passage from s to xsx adds two more occurrences of the letter x without disturbing the other letters. Thus the proof is complete. The next exercise will be meaningful to those who have already done a little bit of propositional logic. Others should return to it when doing the end-of-chapter exercises for Chap. 8. Exercise 4.6.2 (a) Use proof by structural induction to show that in any (unabbreviated) formula of propositional logic, the number of left brackets equals the number of right brackets. (b) If you were to prove the same by induction on a numerical measure of the depth of formulae, what would be a suitable measure of depth?
4.6 Structural Recursion and Induction
139
(c) Let X be any set of formulae of propositional logic, and let R be the derivation rule of detachment defined in Example 4 above. Use structural induction to show that every formula in the closure X+ of X under R is a sub-formula of some formula in X. (d) Show by structural induction that, in classical propositional logic, no formula built using propositional letters and connectives from the set {^,_,!,$} is a contradiction. Solution (a) It suffices to show (basis) that the set of proposition letters has the property, and (induction step) that application of the connectives to build formulae (¬a), (a ^ b), (a _ b) out of formulae a, b preserves the property. The basis is immediate from the fact that proposition letters contain no brackets. For the induction step, suppose that the number of left brackets in a equals the number of right brackets in a, and likewise for b. Then the formulae (¬a), (a ^ b), (a _ b) each add one more left bracket and one more right bracket so that the number of left brackets continues to equal the number of right ones. (b) Put depth(p) = 0 for every proposition letter p, depth((¬a)) = depth(¬a) + 1, depth((a ^ b)) = max(depth(a), depth(b)) + 1. In effect, we are here defining depth as a function on the set of formulae of propositional logic into the set of the natural numbers, by structural recursion on the domain. You might have been tempted to use addition in the recursion step; that cannot be said to be wrong, but it is less simple and less useful than using max. By the way, depth is also often called length. (c) For the basis we need only observe that every formula is a sub-formula of itself. For the induction step, suppose that each of the formulae a, a ! b is a sub-formula of some formula v 2 X. We need to show that b is a sub-formula of some formula in X. But b is a sub-formula of a ! b, and any sub-formula of a sub-formula of v is itself a sub-formula of v, so we are done. (d) Let v be the assignment that puts v(p) = 1 for every sentence letter p. We verify that v+ (a) = 1 for every formula a constructed from sentence letters using only the connectives ^,_,!,$. Basis. If a is a sentence letter p, then v+(a) = v (p) = 1 by the definition of the assignment v. Induction Step. Suppose v+ (b) = 1 = v+(b); we need to show that v+(a ^ b) = v+(a _ b) = v+(a ! b) = v+(a $ b) = 1. But this is immediate from the truth-tables for those connectives (recall the boxes in Chap. 1).
Alice Box: What property should I induce on? Alice
In Exercise 4.6.2 (d) we are asked to show that no formula of the kind specified is a contradiction, in other words, that every such formula has the property that there is some assignment v such that v
140
Hatter
Alice Hatter
Alice Hatter
4
Recycling Outputs as Inputs: Induction and Recursion
(a) = 1. But the solution is not carried out in terms of that property; instead, it worked with the property that v(a) = 1 for a certain specific assignment, namely the one putting v(p) = 1 for sentence letters p. Why? Because the inductive argument would have snagged in the induction step, due to the existential nature of the property under consideration. I don’t understand. Look at the case for conjunction. Suppose, as induction hypothesis, that there is an assignment v with v+(a) = 1 and that there is an assignment u with u+(b) = 1. Nothing tells us that v = u, so we have no guarantee that v+(a ^ b) = 1, nor that u+(a ^ b) = 1. To unblock the argument we must work with the same assignment throughout the induction step. So we are actually proving something a bit stronger than what was requested? Indeed we are. For inductive proofs, proving more can sometimes be easier than proving less. It happens quite often when we want to establish an existential property by induction, as in the exercise. It sometimes happens when we want to establish a conditional property; we may need to articulate a suitable biconditional that implies it and establish the latter by induction.
4.6.3 Defining Functions by Structural Recursion on Their Domains There is an important difference between the examples in parts (a), (c) of Exercise 6.6.2. In the recursive definition of the set of formulae of propositional logic, we begin with a set X of proposition letters, and the closing functions (forming negations, conjunction s, disjunctions) always produce strictly longer formulae, so always giving us something fresh. But an application of the closing three-place relation (which is, indeed, a two-place function) of detachment to input formulae a, a ! b gives us the formula b, which is shorter than one of the two inputs. As a result, detachment is not guaranteed always to give us something fresh: b may already be in the initial set X or already available at an earlier stage of the closing process. This difference is of no significance for structural induction as a method of proof, but it is vital if we want to use structural recursion to define a function whose domain is a set that was already defined by structural recursion—a situation that arises very frequently.
4.6 Structural Recursion and Induction
141
Suppose that we want to give a recursive definition of a function f whose domain is the closure X+ of a set A under a function g. For example, we might want to define f: X+ ! N, as some kind of measure of the depth or complexity of the elements of the domain X+, by setting as the basis f(x) = 0 for all x 2 X and, as the recursion step, putting f(g(x)) = f(x) + 1 for all x 2 X+. Is this legitimate? Unfortunately, not always! If the function g is not injective, then we will have two distinct x, x′ with g(x) = g(x′) yet it may be that the recursion has already given us f(x) 6¼ f(x′) so that f(x) + 1 6¼ f(x′) + 1, in which case the recursion step does not give f(g(x)) a unique value. Even if g is injective, we may still be in trouble. For g (x) may already be an element x′ 2 X, so that f(g(x)) is defined as 0 by the basis of the definition but as f(x) + 1 > 0 by the recursion clause, again lacking a unique value so that f fails to be well-defined. To illustrate this second eventuality, let g: N ! N the function of adding one to a natural number except that g(99) is 0. That is, g(n) = n + 1 for n 6¼ 99, while g (99) = 0. Clearly, this function is injective. Put X = {0}. Then the closure X+ of X under g is the set {0, …, 99}. Now suppose that we try to define a function f: X+ ! N by structural induction putting f(0) = 0 and f(g(n)) = f(n) + 1 for all n 2 X+. The recursion step is fine for values of n < 99, indeed we get f(n) = n for all n < 99. But it breaks down at n = 99. It tells us that f(g(99)) = f(99) + 1 = 99 + 1 = 100, but since g(99) = 0, the basis has already forced us to say that f(g(99)) = f(0) = 0. Although the basis and the recursion step make sense separately, they conflict, and we have not succeeded in defining a function! In summary: whereas structural recursion is always legitimate as a method of defining a set as the closure of an initial set under relations or functions, it can fail as a method of defining a function with a recursively defined set as its domain unless precautions are taken. What precautions? What condition needs to be satisfied to guarantee that such definitions are legitimate? Fortunately, analysis of examples like the one above suggests an answer. To keep notation simple, we focus on the case that the closure is generated by functions. Let X be a set and X+ its closure under a collection {gi}i2I of functions. An element x of X+ is said to be uniquely decomposable iff either: (1) x 2 X and is not in the range of any of the functions gi, or (2) x 62 X and x = gi(x1, …, xm) for a unique function gi in the collection and a unique tuple x1, …, xm 2 X+. Roughly speaking, these two conditions together guarantee that there is a unique way in which x can have got into X+. When the elements of X+ are symbolic expressions of some kind, this property is also called unique readability. Unique decomposability/readability suffices to guarantee that a structural recursion on X+ succeeds, i.e. that it defines a unique function with X+ as domain. To be precise, we have the following principle of structural recursive definition: let X be a set, {gi}i2I a collection of functions, and X+ the closure of X under the functions. Suppose that every element of X+ is uniquely decomposable. Let V be any set (we use this letter because it is often convenient to think of its elements as
142
4
Recycling Outputs as Inputs: Induction and Recursion
values) and let f: X ! V be a given function on X into V. Then, for every collection {hi}i2I of functions hi on powers of V into V with arities corresponding to those of the functions gi, there is a unique function f+: X+ ! V satisfying the following recursively formulated conditions. Case
Conditions
Basis: x 2 X Recursion step: x = gi(x1, …, xk) is the unique decomposition of x
f+(x) = f(x) f+(x) = hi(f+(x1), …, f+(xk))
Another way of putting this principle, which will ring bells for readers who have done some abstract algebra, is as follows: We may legitimately extend a function f: X ! V homomorphically to a function f+: X+ ! V if every element of X+ is uniquely decomposable. This is highly abstract and may, at first, be rather difficult to follow. It may help to focus on the case that we close a singleton under a single function g with just one argument, so that there is also just one function h under consideration, which likewise has just one argument. This basic case may also be represented by Fig. 4.1. In the diagram, the left set is generated from the singleton A = {a} by the single one-place function g, so we write it as A+. The unique decomposition condition becomes the requirement that in the left ellipse, the bottom element is not hit by any arrow while the other elements in that ellipse are hit by at most one arrow (and hence, since A+ is the closure of {a} under g, by exactly one arrow). With these conditions satisfied, the function f+ in the diagram is well-defined. Is the unique decomposition/readability condition an obstacle, in practice, to defining functions recursively on recursively defined domains? The good news is that when we look at examples in computer science and logic, particularly those
Fig. 4.1 A recursive structural definition
4.6 Structural Recursion and Induction
143
dealing with symbolic expressions, the condition is often satisfied. Moreover, the applications of the principle can be very natural—so much so that they are sometimes carried out without mention, taking the existence of unique extensions for granted. For a very simple example of this, suppose we are given an alphabet X, and let X+ be the set of all (finite) lists that can be formed from this alphabet by the operation cons, that is, of prefixing a letter of the alphabet to an arbitrary list (see Chap. 3, Sect. 3.6.2). We might define the length of a list recursively as follows, where ⧼⧽ is the empty list: Basis: length(⧼⧽) = 0 Recursion step: If length(s) = n and a 2 A, then length(as) = n + 1. The principle tells us that this definition is legitimate, because it is clear that each non-empty list has a unique decomposition into a head and a body. On the other hand, if we had tried to make a similar definition using the con operation, of concatenating any two strings s and t and putting length length(ts) = length(t) + length(s), the unique readability condition would not hold: the string ts could have been broken down in other ways. To be sure, in this simple example we could get around the failure of unique readability by showing that nevertheless whenever ts = t′s′ then length(t) + length(s) = length(t′) + length(s′) even when length(t) 6¼ length(t′) and length(s) 6¼ length(s′). But that is a bit of a bother and in other examples such a patch may not be available. For another example of appeal to the unique readability condition, consider the definition of the depth of a formula of propositional logic. Suppose our formulae are built up using just negation, conjunction and disjunction. We proceed as in the solution to Exercise 4.6.2 (a), where we took it for granted that the depth function, introduced by the following recursion, is well defined. Basis: depth(p) = 0 for any elementary letter p. Recursion step: If depth(a) = m and depth(b) = n then depth (¬a) = m + 1 and depth(a ^ b) = depth(a _ b) = max(m,n) + 1. The principle of structural recursive definition guarantees that the function is indeed well-defined. This is because the formulae of propositional logic have unique decompositions under the operations of forming negations, conjunctions, and disjunctions, provided they are written with suitable bracketing. Indeed, we can say that the mathematical purpose of bracketing is to ensure unique decomposition. Exercise 4.6.3 (a) Suppose we forget brackets from formulae of propositional logic, without introducing any conventions about the cohesive powers of connectives. Show that the depth of the expression ¬p ^ ¬q is not well defined. (b) In propositional logic, to substitute a formula u for a sentence letter p in a formula a is, intuitively, to replace all the occurrences of p in a by u. Fix a formula u and a proposition letter p, and define this operation by recursion on a, as a function r: F ! F, where F is the set of formulae. For simplicity, assume that the primitive connectives of the propositional logic are just ¬, ^.
144
4
Recycling Outputs as Inputs: Induction and Recursion
Solution (a) When we omit brackets without making any conventions about the cohesive powers of negation and conjunction, the expression ¬p ^ ¬q has two decompositions, one as the conjunction (¬p ^ ¬q) of two negated propositional letters, the other as the negation ¬(p ^ ¬q) of the conjunction of a letter with the negation of a letter. The depth of the former is 2 but the depth of the latter is 3. So, brackets are needed for unique readability of formulae of propositional logic (as also for expressions of elementary algebra). Nevertheless, in Chap. 7 Sect. 7.4 we will see a trick for writing formulae in a different way that restores unique readability without brackets! (b) The basis is r(q) = a when q is a proposition letter. The recursion step has two cases. Case 1: a = ¬b: put r(a) = ¬r(b). Case 2: a = b ^ c: put r(a) = r(b) ^ r(c). Or just say briefly: r(¬b) = ¬r(b), r(b ^ c) = r(b) ^ r(b).
4.7
Recursion and Induction on Well-Founded Sets
The notion of a well-founded set provides the most general context for recursion and induction. It permits us to apply these procedures to any domain whatsoever, provided we have available a well-founded relation over that domain. Every other form can in principle be derived from this one. We explain the basics.
4.7.1 Well-Founded Sets We begin by defining the notion of a well-founded relation over a set. Let W be any set, and < any irreflexive, transitive relation over W (attention: we are not requiring linearity, i.e. that the relation is also complete, cf Chap. 2 Sect. 2.6.2). We say that W is well-founded by < iff every non-empty subset A W has at least one minimal element. This definition is rather compact, and needs to be unfolded carefully. • We recall from Chap. 2 Sect. 2.6.1 that a minimal element of a set A W (under 2 and suppose that every finite set of size less than k is well-founded under any transitive irreflexive relation over it. Let A be a set with #(A) = k and let < be a transitive irreflexive relation over it; we want to show that A is well-founded under 5 we compare 6 with the right child 7 of 5. Since 6 < 7 we compare 6 with the left child 6 of 7. Since 6 = 6 we print yes. (b) We compare 8 with the root 5. Since 8 > 5 we compare 8 with the right child 7 of 5. Since 8 > 7 we compare 8 with the right child 10 of 7. Since 8 < 10 we compare 8 with the left child 9 of 10. Since 8 < 9 and 9 has no left child, we print no. End of solution.
The algorithm described above can be refined. There are also algorithms to insert nodes into a binary search tree and to delete nodes from it, in each case ensuring that the resulting structure is still a binary search tree. The one for insertion is quite simple, as it always inserts the new node as a leaf, while the one for deletion is rather more complex since it deletes from anywhere in the tree.
7.5 Binary Trees
239
We sketch the insertion algorithm, omitting the deletion one. To insert an item x, we begin by searching for it using the search algorithm. If we find x, we do nothing, since it is already there. If we don’t find it, we go to the node y where we learned that x is absent from the tree (it should have been in a left resp. right subtree of y, but y has no left resp. right child). We add x as a child of y with an appropriate left or right label. Exercise 7.5 (3) Consider again the binary search tree in Fig. 7.6. What is the tree that results from inserting a node 8 by means of the algorithm sketched above? Solution Searching for 8 in the tree, in Exercise 7.5 (2) (b), we reached node 9 and noted that 8 should be in its left subtree, but that 9 is a leaf. So we add 8 as left child of 9. End of solution. We can also iterate the insertion algorithm to construct a binary search tree from a list. Take for example the list l of nine words: this, is, how, to, construct, a, binary, search, tree, and that our ordering relation < for the tree construction is the lexicographic one (dictionary order). We begin with the empty tree, and search in it for the first item in the list, the word ‘this’. Evidently it is not there, so we put it as root. We then take the next item in the list, the word ‘is’ and search for it in the tree so far constructed. We don’t find it, but note that ‘is’ < ‘this’ and so we add it as a left child of ‘this’. We continue in this way until we have completed the tree. Evidently, the shape of a tree constructed by this algorithm depends on the order in which the items are listed. For example, if in the above example the same words were presented in the list l′ = (a, binary, construct, how, is, search, this, to, tree), the binary search tree would be a chain going down diagonally to the right, and just as high as the list is long. Normally, we would like to keep the height of the tree as low as possible. The optimum is to have a binary tree with two children for every node other than the leaves, and all branches of the same length. This is possible only when the list to be encoded has node-length 2h − 1 for some h 0. Nevertheless, for any value of h 0 it is possible to construct a binary search tree in which no branch is more than one node longer than any other, and where the longer branches are all to the left of the shorter ones. There are good algorithms for carrying out this construction, although we will not describe them here.
7.6
Unrooted Trees
We now go back to the rooted tree in Fig. 7.1, at the beginning of this chapter, and play around with it. Imagine that instead of the figure made of dots and lines on paper, we have physical version of the same, made of beads connected with pieces of string or wire, lying on a table facing us. We can then pull the root a down and push up b, say, so that it becomes the root. Or we can rearrange the beads on the table so that the assembly loses its tree-like shape and looks more like a road map in which none of the nodes seems to have a special place. When we do this, we are treating the structure as an unrooted tree.
240
7
Squirrel Math: Trees
7.6.1 Definition Formally, an unrooted tree (aka undirected tree) may be defined as any structure (T, S) that can be formed out of a rooted tree (T,R) by taking S to be the symmetric closure of R. Recall the definition of the symmetric closure S of R: it is the least symmetric relation (i.e. intersection of all symmetric relations) that includes R; equivalently and more simply, S = R [ R−1. Diagrammatically, it is the relation formed by deleting the arrow-heads from the diagram of R (if there were any) and omitting any convention for reading a direction into the links. In the context of unrooted trees, terminology changes (yes, yet again). Nodes in unrooted trees are usually called vertices. More important, as well as speaking of links, which are ordered pairs (x,y), i.e. elements of the relation, we also need to speak of edges (in some texts, arcs), identifying them with the unordered pairs {x,y} such that both (x,y) and (y,x) 2 S. It appears that the mathematical concept of an unrooted tree was first articulated in the nineteenth century and popularized by Arthur Cayley in 1857 when discussing problems of chemistry. Graphs were already being used to represent the structure of molecules, with vertices (nodes) representing atoms and (undirected) edges representing bonds. Cayley noticed that the saturated hydrocarbons—that is, the isomers of compounds of the form CnH2n+2—have a special structure: they are all what we now call unrooted trees. For rooted trees, intuitive applications go back much further. For example, in the third century AD a neoplatonist philosopher commentating on the logic of Aristotle introduced what became known as the ‘tree of Porphyry’. Alice Box: Unrooted trees Alice
Hatter
That’s a nice, simple definition of unrooted trees—provided we are coming to unrooted trees from rooted ones. But what if I wanted to study unrooted trees before the rooted ones? Could I define them in a direct way? No problem. In fact that is the way most textbooks do it. We will see how in Sect. 7.6.2, after noting some properties emerging from our present definition.
Exercise 7.6.1 In Exercise 7.2.2, we observed that a rooted tree (T,R) with n 1 nodes has exactly n − 1 links. Use this to show that an unrooted tree (T,S) with n 1 vertices has exactly n − 1 edges. Solution Consider any unrooted tree (T,S) with n 1 vertices. By the above definition of an unrooted tree, S is the symmetric closure of a relation R such that (T,R) is a rooted
7.6 Unrooted Trees
241
tree. Since the carrier set T is the same, (T,R) has n nodes. So, by Exercise 7.2.2 (2), (T,R) has n − 1 links. But, since S = R [ R−1, there is a bijection between the links in R and the edges in S, so (T,S) has exactly n − 1 edges.
7.6.2 Properties Let (T,S) be an unrooted tree, with S the symmetric closure of the link relation R of a rooted tree (T,R). Then it is easy to show that S is connected (over T), i.e. for any two distinct elements x, y of T, there is an S-path from x to y, i.e. a finite sequence a0, …, an (n 1) of elements of T such that x = a0, y = an, and each pair (ai,ai+1) 2 S. The proof is very straightforward. Since (T,R) is a rooted tree, it has a root a. We distinguish three cases. In the case that a = x, by the definition of a rooted tree and using the assumption that y 6¼ x, we have a R-path from x to y, and this is an S-path. In the case that a = y, we have a R-path from y to x and thus, running it in reverse (which is legitimate since S is symmetric), we have a S-path from x to y. Finally, if a 6¼ x and a 6¼ y we know, again from the definition of a rooted tree, that there are R-paths from a to each of x, y considered separately. Reversing the path from a to x and composing with the path from a to y, we have an S-path from x through a to y. Less obvious is the fact that S is a minimal connected relation over T. In other words, no proper sub-relation of S is connected over T. The following proof is the most intricate in the entire book and needs to be read carefully—then re-read it after looking at the logic box nearby. Since any super-relation of a connected relation is connected, it suffices to show that, for any pair (x,y) 2 S, the relation S′ = S\{(x,y)} is not connected over T. Choose any (x,y) 2 S. Then either (x,y) 2 R or (y,x) 2 R. Consider the former case; the argument in the latter case is similar. Since (x,y) 2 R, we know by the definition of a rooted tree that y 6¼ a where a is the root of (T,R). So, to show that S′ is not connected over T, it will suffice to show that there is no S′-path from a to y. Suppose for reductio ad absurdum that there is such a S′-path, i.e. a finite sequence r = (a0, …, an) (n 1) of elements of T such that a0 = a, an= y, and each pair (ai,ai+1) 2 S′. We may assume without loss of generality that r is a shortest such path so that, in particular, no ai = ai+2. Since (an−1, an) 2 S′, we have either (an−1, an) 2 R or conversely (an, an−1) 2 R. But the former alternative is impossible. For, suppose for reductio that (an−1,an) 2 R; then since an= y we have (an−1,y) 2 R and so, since by supposition (x,y) 2 R and no node can have two R-parents, we have an−1 = x, so that (x,y) is the last link in the S′-path, contradicting the fact that (x,y) 62 S′. Thus the latter alternative (an, an−1) 2 R must hold. But then by induction on i from 0 to n, we must have each (an−i, an−i−1) 2 R for otherwise, using the definition of S, we would have an an−i with two distinct R-parents, namely an−i−1 and an−i+1. This gives us an R-path from y to the root a, which is impossible by the definition of a rooted tree.
242
7
Squirrel Math: Trees
Logic Box: An interesting proof
From a logical point of view, the proof that S is a minimal connected relation over T is interesting, because it has two features that we have not seen in earlier verifications. (1) It uses a proof by contradiction that is within the scope of another one (as well as being in one arm of a proof by cases) as flagged by the phrases ‘suppose for reductio’. (2) It makes a ‘without loss of generality’ (abbreviation: wlog) step. Both features are legitimate. (1) There is no limit to the number of possible layers of proof by contradiction one within another, just as there is no limit to the levels of conditional proof that may be embedded within each other or, for that matter, to the number of levels of proof by cases mixed with conditional proof and proof by contradiction. (2) Wlog steps can serve to simplify presentation, notably by reducing the number of variables deployed. Typically, such steps arise when we are given, or have already shown, that there is an item (in the above example, the finite sequence r) with a certain property P. When it can easily be checked that if there is such an item then there is also one that has both that property P and another property Q, then we simply say that we may assume without loss of generality that the item also has the property Q. This avoids dragging in additional variables in our formulation, in the example a primed variable r′. Thus, while feature (1) is a matter of logical power, (2) is a device for notational economy in certain situations. We will see some more examples of the wlog gambit in later exercises. Another important property of unrooted trees is that they have no cycles that are, in a certain sense, ‘simple’. A cycle is a path whose first and last items are the same. So, unpacking the definition of a path, a cycle of an unrooted tree (T,S) is a sequence a0, …, an (n 1) of elements of T with each (ai,ai+1) 2 S and an = a0. A simple cycle is one with no repeated edges, i.e. for no i < j < n do we have {ai,ai +1} = {aj,aj+1}. Expressed in terms of the relation R of the underlying rooted tree: the sequence a0, …, an = a0 never repeats or reverses an R-link. It may, however, repeat nodes. For example, the cycles a,b,c,b,a and a,b,c,e,c,b,a are not simple, since each contains both links (b,c) and (c,b) so that the edge {b,c} appears twice. The cycle a, b,c,e,b,c,a is not simple either, as it repeats the link (b,c), so again the edge {b,c} appears twice. On the other hand, the cycle a,b,c,d,e,c,a is simple: despite the repetition of vertices; there is no repetition of edges (i.e. no repetition or reversal of links). Exercise 7.6.2 (1) Take the first-mentioned cycle a,b,c,b,a and add c in third place, i.e. after the first b. Is it simple?
7.6 Unrooted Trees
243
Solution The new cycle is a,b,c,c,b,a. It is not simple, because it still contains links (b,c) and (c,b), so the edge {b,c} appears twice. End of solution. Clearly, any unrooted tree with more than one vertex is full of cycles: whenever (x,y) 2 S then by symmetry (y,x) 2 S giving us the cycle x,y,x. The interesting point is that it never has any simple cycles. It can be a bit tricky for students to get this point clear in their minds, for when we unpack the definition of simplicity we have two negations: there are no cycles that contain no repeated edges. To get a better handle on it, we can express it positively: every cycle in (T,S) has at least one repeated edge.
Alice Box: No simple cycles Alice Hatter
Alice Hatter
No simple cycles: in other words, (T,S) is acyclic? Not so fast! Acyclicity, as we have defined it in Sect. 7.2.1, means that there are no cycles at all. Here we are claiming less: we are saying only that there are no simple cycles in the unrooted tree. Indeed, that is all we can ask for; since S is symmetric, the unrooted tree will contain non-simple cycles x,y,x. I hope I don’t get mixed up with the two negations… If you do, rely on the positive formulation above: ‘no simple cycles’ means ‘every cycle has a repeated edge’.
To prove the claim just made, suppose for reductio ad absurdum that (T,S) is an unrooted tree containing a simple S-cycle a0, …, an = a0. We may assume without loss of generality (wlog again) that this is a shortest one, so that in particular ai 6¼ aj for distinct i,j except for the end points a0 = an. We distinguish three cases and find a contradiction in each. Case 1. Suppose (a0,a1) 2 R. Then for all i with 0 i < n we have (ai,ai+1) 2 R, for otherwise some ai+1 would have two distinct Rparents ai and ai+2, which is impossible. Thus the S-cycle a0, …, an = a0 is in fact an R-cycle, which we know from Sect. 7.2.1 is impossible for the link relation R of a rooted tree. Case 2. Suppose (an,an−1) 2 R. A similar argument shows that this case is also impossible. Case 3. Neither of the first two cases holds. Then (a1a0) 2 R and (an−1,an) 2 R. Since a0 = an and no node of a rooted tree can have two distinct parents, this implies that a1 = an−1. But that gives us a shorter S-cycle a1, …, an−1 = a1 which must also be simple, again bringing us to a contradiction. Indeed, we can go further and prove a stronger result: when (T,S) is an unrooted tree then S is maximally without simple cycles. What does this mean? Let (T,S) be an unrooted tree, derived from a rooted tree (T,R). Let x,y be distinct elements of T with (x,y) 62 S. Then the structure (T, S′) where S′ = S [ {(x,y), (y,x)} is an unrooted tree and we can show that it contains a simple cycle. We will not give a full proof of this, just sketching the underlying construction. In the principal case that x, y are both distinct from the root a of (T,R), there are
244
7
Squirrel Math: Trees
unique R-paths from a to each of them. Take the last node b that is common to these two R-paths, and form an S-path from x up to b (using R−1) and then down to y (using R). With (y,x) also in S′, we thus get an S′-cycle from x to x, and it is not difficult to check that this cycle must be simple. Summarizing what we have done so far in this section, we see that unrooted trees (T,S) have a symmetric relation S and, when T is non-empty, they satisfy the following six conditions: • S is the symmetric closure of the link relation of some rooted tree (T,R) (by definition) • S minimally connects T • S connects T and has n − 1 edges, where n = #(T) • S connects T and has no simple cycles • S is maximally without simple cycles • S has no simple cycles and has n-1edges, where n = #(T). In fact, it turns out (although we do not prove it here) that these six conditions are mutually equivalent for any non-empty set T and symmetric relation S T2, so that any one of them could serve for a characterization of unrooted trees. The first bulleted condition defined unrooted trees out of rooted ones; each of the remaining ones answers a question that Alice raised in Sect. 7.6.1: how could we define unrooted trees directly, without reference to rooted ones? Alice Box: Explicit versus recursive definitions of unrooted trees Alice
Hatter
Thanks, this does answer my query. But one question leads to another. Could we also define unrooted trees recursively, as we did for rooted ones? Of course. Indeed, one need only take the recursive definition for rooted trees and tweak it a little. But let’s stop there.
7.6.3 Spanning Trees The second of the six characterizations of an unrooted tree in the bullet points at the end of Sect. 7.6.2 gives rise to an important practical problem. A symmetric relation S that minimally connects a set (thus satisfying the condition) is known as a spanning tree for the set. Such minimality is valuable, as it helps reduce computation; how can we obtain it algorithmically? Suppose we are given a set A connected by a symmetric relation S. There will be many S-paths between vertices, and perhaps many simple cycles. In the limit, every element of A may be related to every one including itself, giving n(n + 1)/2 edges
7.6 Unrooted Trees
245
where n = #(A); in the case of an irreflexive relation every element of A may be related to every other one, still flooding us with n(n − 1)/2 edges. That is a lot of information, most of which may be redundant for our purposes. So the question arises: Is there an algorithm which, given a set A connected by a symmetric relation S over it, finds a minimal symmetric sub-relation S′ S that still connects A? In other words, is there an algorithm to find a spanning tree for A? Exercise 7.6.3 Check the figures n(n + 1)/2 and n(n − 1)/2 above, using material from Chap. 5. Solution In the case of an irreflexive symmetric relation, we are in effect looking at the collection of all two-element subsets of A. this is given by the formula n!/k!(n − k)! of Table 5.4 of Chap. 5 with n = 2, that is, n!/2!(n − 2)!, which simplifies to n(n − 1)/2. For an arbitrary symmetric relation, we need to add n for the singleton subsets of A, giving us [n(n − 1)/2] + n, which simplifies to n(n + 1)/2. End of solution. Clearly there is a ‘top down’ procedure that does the job of finding a spanning tree for A. We take the given relation S connecting A and take off edges one by one in such a way as to leave A connected. To begin with, we can get rid of all the edges connecting a vertex with itself, and then start removing edges between distinct vertices without damaging connectivity. When we get to a point where it is no longer possible to delete any edge without de-connecting A (which will happen when we have got down to n-1 edges, where n is the number of vertices), we stop. That leaves us with a minimal symmetric relation S′ S connecting A—which is what we are looking for. But there is also a ‘bottom up’ procedure that accomplishes the task. We begin with the empty set of edges, and add in edges from S one by one in such a way as never to create a simple cycle. When we get to a point where it is no longer possible to add an edge from S without creating a simple cycle (which will happen when we have got up to n − 1 edges, where n is the number of vertices), we stop. That leaves us with a maximal relation S′ S without simple cycles. By two of the equivalent conditions bulleted in Sect. 7.6.2, S′ will also be a minimal symmetric relation connecting A—which is what we are looking for. Both procedures are non-deterministic algorithms, since they allow choice from a finite range of edges at each step; they can be rendered deterministic by specifying an order on the set of all possible edges over the underlying set. In general, the ‘bottom up’ procedure is much more efficient than the ‘top down’ one for finding a spanning tree, since it is less costly computationally to check whether a given relation creates a simple cycle than to check whether a given set is connected by a relation. In many practical situations, one needs to go further and consider symmetric relations whose edges have numerical weights attached to them. These weights may represent the distance between vertices, or the time or cost involved in passing from one to the other. In this context, we often want to do something more subtle than minimize the set of edges in a relation connecting the domain; we may wish to
246
7
Squirrel Math: Trees
minimize total cost, i.e. minimize the sum of their weights. The ‘bottom up’ algorithm that we have described for finding a spanning tree can be refined to solve this problem. However doing so would take us beyond the limits of the present book. The references at the end of the chapter follow the subject further.
7.7
End-of-Chapter Exercises
Exercise 7.7 (1) Properties of rooted trees (a) Show that the relation R of any finite rooted tree (T,R) is intransitive. (b) Consider the ‘new root’ definition of a rooted tree. What is the relation between the height (whether understood as node-height or link-height) of the ‘output’ tree issuing from an application of the recursion step, to the heights of its ‘input’ immediate subtrees? Solution (a) We use the basic properties established in Sect. 7.2.1. Let (T,R) be a finite rooted tree. Suppose for reductio that there are x, y, z 2 T with (x,y), (y,z), (x, z) 2 R. Since (x,y) 2 R the irreflexivity of R (established in Sect. 7.2.1) tells us that x 6¼ y so z has two parents, contradicting the uniqueness of parents (also established in Sect. 7.2.1). (b) It is immediate from the recursive definition that each branch in the output tree has height one more than that of the branch in the input tree from which it is formed, so the height of the output tree itself is one larger than the maximal height of its input trees. Exercise 7.7 (2) Labelled trees (a) Construct the syntactic decomposition tree of the arithmetic expression −(y3 + (x − 5)). What is the most salient difference between it and the decomposition trees in Figs. 7.3 and 7.4? (b) What would be special about the shape of syntactic decomposition tree of an arithmetic expression formed from two-place arithmetic operations alone? (c) Write the arithmetic expression −(7 y + (x − 5)) in prefix notation and in postfix notation. Solution (a) The initial minus sign is a one-place operation, and expressions yz are shorthand for applications of the two-place operation exp(y,z) of taking y to the power z. The appropriate syntactic decomposition tree is thus as in Fig. 7.7. The most salient difference to the trees of Figs. 7.3 and 7.4 is that the root has only one child.
7.7 End-of-Chapter Exercises
247
• −( y3+(x−5)) 3 • y +(x−5)
• y3 •y
• x−5 •3
•x
•5
Fig. 7.7 Syntactic decomposition tree for the expression −(y3 + (x − 5))
(b) In such a tree, every non-leaf node has exactly two children. (c) For unique readability to be guaranteed, each sign should have a unique number of argument places. So, we need to write say * for the one-place minus sign to distinguish it from the two-place minus sign −. Then we can write −(7 y + (x − 5)) in prefix notation as *+7y − x5 and in postfix notation as 7y x5 − + *. Exercise 7.7 (3) Binary search trees (a) Consider the set of letters {g, c, m, b, i, h, a} and its usual alphabetical ordering. Construct a binary search tree for them, such that all branches are of equal height and all non-leaves have two children. (b) In the tree you have constructed, trace the steps in a search for the letter c, using the search algorithm in the text. Do the same for the letter j. Solution (a) See Fig. 7.8. (b) For c: Compare c with the root g; since c < g, compare c with the left child b of g; since b < c, compare c with the right child c of b; since c = c, print yes and stop. For j: Compare j with the root g; since g < j, compare j with the right child i of g; since i < j, compare j with the right child m of b; since j < m and m has no left child, print no and stop.
g •
•b •a
•c
Fig. 7.8 Binary search tree for Exercise 7 (3)
•i •h
•m
248
7
Squirrel Math: Trees
Exercise 7.7 (4) Unrooted trees Consider the complete (irreflexive) graph (G,R) with five vertices 1, …, 5, that is, the graph in which there is an edge between each vertex and every other vertex. (a) Construct a spanning tree for this graph by the top-down method. (b) Construct a different spanning tree for this by the bottom-up procedure, in such a way that it is determined by a rooted tree in which all non-leaves have exactly two children. Solution (a) For visual intuition, draw the complete irreflexive graph over G as a five-pointed star, numbered clockwise and with edges around the perimeter. Following the algorithm, take out successively say the edges {1,2}, {2,3}, {3,4}, {4,5}, {5,1}, {1,3} and stop. (b) Take the empty set of edges, add to it say {1,2}, {1,3}, {2,4}, {2,5} and stop.
7.8
Selected Reading
Almost all introductory texts of discrete mathematics have a chapter on trees, usually preceded by one on the more general theory of graphs and treating unrooted trees before rooted ones, thus proceeding resolutely from the more general context to the more particular. Richard Johnsonbaugh Discrete Mathematics, Pearson 2009 (7th edition) chapter 9 follows this path, while Bernard Kolman et al. Discrete Mathematical Structures, Pearson 2009 (6th edition) chapter 7 follows an order closer to the present one. Both texts cover considerably more ground than we have done.
Part III
Logic
8
Yea and Nay: Propositional Logic
Chapter Outline We have been using logic on every page of this book—in every proof, verification and informal justification. In the first four chapters we inserted some ‘logic boxes’; they gave just enough to be able to follow what was being done. Now we gather the material of these boxes together and develop their principles. Logic thus emerges as both a tool for reasoning and an object for study. We begin by explaining different ways of approaching the subject and situating the kind of logic that we will be concerned with, then zooming into a detailed account of classical propositional logic. The basic topics will be the truth-functional connectives, the family of concepts around tautological implication, the availability of normal forms for formulae, and the use of semantic decomposition trees as a shortcut method for testing logical status.
8.1
What is Logic?
What we will be studying in these chapters is only one part of logic, but a very basic part. In a general sense, logic may be understood as the study of reasoning or, in even broader terms, belief management. It concerns ways in which agents (human or other) may develop and shape their beliefs, by inference, organization, and change. • Inference is the process by which a proposition is accepted given others, in other words, is considered as justified by them. • Belief organization is the business of getting whatever we accept into an easily stocked, communicable and exploitable pattern. It is important in computer © Springer Nature Switzerland AG 2020 D. Makinson, Sets, Logic and Maths for Computing, Undergraduate Topics in Computer Science, https://doi.org/10.1007/978-3-030-42218-9_8
251
252
8
Yea and Nay: Propositional Logic
science for database management, but also in mathematics, where it traditionally takes the form of axiomatization. • Belief change takes place when we decide to abandon something that we had hitherto accepted, a process known to logicians as contraction. It can also take the form of revision, where we accept something that we previously ignored or even rejected, at the same time carrying out sufficient contraction to maintain consistency of the whole. A closely related form of belief change, of particular interest to computer science, is update, where we modify our records to keep up with changes that are taking place in the world. Evidently, this is very close to revision, but there are also subtle differences. Of all these processes of belief management, the most basic is inference. It reappears as an ingredient within all the others, just as sets reappear in relations, functions, recursion, counting, probability and trees. For this reason, introductory logic books usually restrict themselves to inference, leaving other concerns for more advanced work. Even within that sphere, it is customary to look at only one kind of inference—admittedly the most fundamental one, underlying others— deductive inference. Reluctantly, we must do the same. That this is a serious limitation becomes apparent if one reflects on the kind of reasoning that is carried out in daily life, outside the study and without the aid of pen and paper. Often, it is not so much inference as articulating, marshalling, and comparing information and points of view. Even when it takes the form of inference, it is seldom fully deductive. The conclusions reached are treated as plausible, reasonable, probable, or convincing given the assumptions made; but they are rarely if ever perfectly certain relative to them. There is the possibility, perhaps remote, that even if the assumptions are true, the conclusion might still be false. But within mathematics and most of computer science the game is quite different. There we use only fully deductive inference, rendering the conclusions certain given the assumptions made. This is not to say that there is any certainty in the assumptions themselves, nor for that matter in the conclusions. It lies in the link between them: it is impossible for the premises to be true without the conclusion also being so. That is the only kind of reasoning we will be studying in these chapters. It provides a basis that is needed before trying to tackle uncertain inference, whether that is expressed in qualitative terms or probabilistically, and before analysing other kinds of belief management. Its study goes back two thousand years; in its modern form, it began to take shape in the middle of the nineteenth century.
8.2
Truth-Functional Connectives
We begin by looking at some of the ways in which statements, often also called propositions, may be combined. The simplest are by means of the truth-functional connectives ‘not’, ‘and’, ‘or’, ‘if’, ‘iff’, etc. We have already introduced each of
8.2 Truth-Functional Connectives
253
these one in a corresponding logic box in Chap. 1 and you are encouraged to flip back to review those boxes, for we will not repeat all of the comments made there. However, for easy reference, we recall the truth-tables themselves writing a, b, … for arbitrary propositions. For the one-place connective ‘not’, see Table 8.1. Here 1 is for truth, and 0 is for falsehood, often written T, F respectively. A basic assumption made in the table is the principle of bivalence: every proposition under consideration is either true, or false, but not both. Another basic assumption is that this is all that matters for determining the truth-value of the compound item, in this case ¬a. In other words, negation may be represented by a function with the two-element set {1,0} as both domain and range. The two-place connectives ‘and’, ‘or’, ‘if’ and ‘iff’ have truth-tables that can be grouped together as in Table 8.2. Table 8.1 Truth-table for negation a
¬a
1 0
0 1
Table 8.2 Truth-table for familiar two-place connectives a
b
a^b
a_b
a!b
b!a
a$b
a+b
1 1 0 0
1 0 1 0
1 0 0 0
1 1 1 0
1 0 1 1
1 1 0 1
1 0 0 1
0 1 1 0
Alice Box: The principle of bivalence
Alice Hatter
Alice Hatter
Alice Hatter
Can we relax the principle of bivalence? Yes, we can, if we are willing to depart from the standard account of logic. There are two main ways of going about it. One is to allow that the classical values are not exhaustive, in other words, that there may be truth-values other than truth and falsehood. This gives rise to the study of what is called many-valued logic. And the other? We can allow that the values may not be exclusive, so that a proposition may be both true and false. That idea can, moreover, be accommodated within the first one by using new values to represent subsets of the old values. For example, we might use four values (the two old ones and two new ones) to represent the four subsets of the two-element set consisting of the classical values 1 and 0. Will we be looking at any of these? Not in this book.
254
8
Yea and Nay: Propositional Logic
It is time to look more closely at the concept of a truth-function in two-valued logic. A one-place truth-function, such as the one associated with negation, is simply a function on domain {1,0} into {1,0}. A two-place truth-function, such as those associated with conjunction, disjunction, the conditional and the bi-conditional in Table 8.2, is a function on {1,0}2 into {1,0}, and so on for those with more than two arguments. This immediately suggests all kinds of questions. How many one-place truth-functions are there? How many two-place, and generally n-place ones? Are there zero-place truth-functions? Are the specific truth functions given in Tables 8.1 and 8.2 sufficient to represent all of them, or do we need further logical connectives for that? We can answer these questions quite easily. Clearly, there are just four one-place truth-functions. Each can be represented by a truth-table. In the leftmost column we write the two truth values 1 and 0 that a proposition a can bear. In the remaining columns we write the possible values of the functions for those two values of their arguments (Table 8.3). Exercise 8.2 (1) (a) Which of these four truth-functions fi corresponds to negation? (b) Can you express the other three one-place truth-functions in terms of connectives with which you are already familiar (¬, ^, _, !, $)? Solution (a) Obviously, f3. (b) f2 is the identity function, i.e. f2(a) = a, so we don’t need to represent it by more than a itself. f1 is the constant function with value 1, and so can be represented as any of a _ ¬a, a ! a, or a $ a. Finally, f4 is the constant function with value 0, and can be represented by a ^ ¬a, or by the negation of any of those for f1. End of solution. Going on to the two-place truth-functions, the Cartesian product {1,0}2 has 2 = 4 elements, which may be listed in a table with four rows, as in the tables for the familiar two-place connectives. For each pair (a,b) 2 {1,0}2 there are two possible values for the function, which gives us 24 = 16 columns to fill in, i.e. 16 truth-functions. 2
Table 8.3 The one-place truth-functions a
f1(a)
f2(a)
f3(a)
f4(a)
1 0
1 1
1 0
0 1
0 0
8.2 Truth-Functional Connectives
255
For smooth communication we always write the rows of a truth-table in a standard order. In the case of a two-place function with arguments a, b we begin with the row (1,1) where both a and b are true, and end with the row (0,0) where both are false. The principle for constructing each row from its predecessor, for truth-functions of any number of arguments: take the last 1 in the preceding row, change it to 0, and replace all 0 s to its right to 1. The following exercise may look tedious, but you will learn a lot by carrying it out in full. Exercise 8.2 (2) (a) Write out a table grouping together all of the 16 two-place truth-functions, calling them f1 ; . . .; f16 . (b) Identify which of the 16 columns represent truth-functions with which you are already familiar. (c) Express the others using combinations of familiar ones. Solution (a) To fit the 16 columns onto the page, we write each two-place function fi(a,b) simply as fi. as in Table 8.4. (b) Familiar: f4, f6, f13, f11 represent a, b ¬a, ¬b respectively; f8 ; f2 ; f5 ; f3 ; f7 ; f10 represent a ^ b, a _ b, a ! b, b ! a, a $ b, a + b respectively. (c) Others: f1 is the constant function with value 1 and represents say a _ ¬a (or, say, a _ ¬a _ b if you want to mention the second argument explicitly); f16 is the constant function with value 0 and represents, say, a ^ ¬a; f9 represents ¬ (a ^ b); f12 represents a ^ ¬b; f12 represents ¬a ^ b; f15 represents ¬(a _ b). You could equally well choose formulae that are logically equivalent (in a sense to be defined shortly)—for example, f15 also represents ¬a ^ ¬b. End of solution. While ¬ is one-place, ^, _, !, $, + are all two-place, Is there a gap in their expressive power, or can every truth-function of two places, indeed of arbitrary n places, be captured using them? Fortunately, there is no gap. In Exercise 8.2 (2) (c) we have checked this out for all the two-place truth-functions. We now show, in a more systematic way, that every truth-function of any finite number of places, may be represented using at most the three connectives ¬, ^, _. Then we will see how that set of three may be pared down. Table 8.4 The two-place truth-functions a
b
f1
f2
f3
f4
f5
f6
f7
f8
f9
f10
f11
f12
f13
f14
f15
f16
1
1
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
1
0
1
1
1
1
0
0
0
0
1
1
1
1
0
0
0
0
0
1
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
256
8
Yea and Nay: Propositional Logic
The idea may be illustrated looking more carefully at any one of the two-place truth-functions fi in Table 8.2. Take the rows in which fi(a,b) = 1; for example, in the case of f3 there are three of them. For each such row, form the conjunction ± a ^ ± b where ± is empty or negation according as the argument has 1 or 0. In the case of f3, this gives us the three conjunctions a ^ b (for the first row), a ^ ¬b (for the second row), and ¬a ^ ¬b (for the fourth row). Form their disjunction: for f3, this will be (a ^ b) _ (a ^ ¬b) _ (¬a ^ ¬b). That formula expresses the truth-function under consideration. Why? Look again at the example of f3, By the table for disjunction, it will come out true just when at least one of the three disjuncts is true. But the first disjunct is true in just the first row, the second is true in just the second row, and the third is true in just the last row. So, the constructed expression has exactly the same truth-table as f3, i.e. it expresses that truth-function. Exercise 8.2 (3) (a) Of the 16 two-place truth-functions, there is exactly one that cannot be expressed in this way. Which is it? Show how we can still represent it using ¬, ^, _. (b) Would it have made a difference if we had written exclusive disjunction + instead of inclusive disjunction _ in the above procedure for devising a formula to express an arbitrary-n-place truth function? Why? Solution (a) It is the function f16, with constant value 0, since there are no rows in which it comes out true. All other truth-functions come out true in at least one row. But, as we have already seen, f16 can still be represented by, say, a ^ ¬a and many other equivalent formulae. (b) No, it would not have made any difference, despite that fact that _ and ⊕ have different truth-tables. The reason is that the two tables differ only in their top row, where a and b are both assigned the value 1 (i.e. are both taken as true), and that row cannot be exemplified under the construction described. For example, for f3 we generated the formula (a ^ b) _ (a ^ ¬b) _ (¬a ^ ¬b) and (a ^ b) + (a ^ ¬b) + (¬a ^ ¬b) is its counterpart with +. Now, by the truth-tables for ¬ and ^, there is no way in which the disjuncts (a ^ b) and (a ^ ¬b) can both be true under a given assignment to the elementary parts; likewise for the other two disjunct-pairs. Hence exclusive disjunctions of this kind must always get the same truth values as the corresponding inclusive ones. End of solution. Thus, every truth-function can be expressed using only ¬, ^, _. Are all three connectives really needed, or can we do the job with even fewer ones? We will return to this question in the next section, after clarifying some fundamental concepts that we have already been using intuitively in examples.
8.3 Logical Relationship and Status
8.3
257
Logical Relationship and Status
A special feature of logic, as compared with most other parts of mathematics, is the very careful attention that it gives to the language in which it is formulated. Whereas the theory of trees, say, is about a certain kind of abstract structure— arbitrary sets equipped with a relation satisfying a certain condition—logic is about the interconnections between certain kinds of language and the abstract structures that may be used to interpret them. A good deal of logic thus looks at the language, seeing how it corresponds to structures in which it is interpreted. This can take quite some time to get used to, since ordinarily in mathematics we look through the language to the structures alone. It is like learning to look at the window pane as well as at the landscape beyond it, as in René Magritte’s painting La clef des champs or the three levels of visual existence in Maurits Cornelis Escher’s engraving Three worlds (look them up on the web).
8.3.1 The Language of Propositional Logic Our language be able to should express all truth-functions. Since we know that the trio ¬, ^, _ are together sufficient for the task, we may as well use them. They are the primitive connectives of the language. We take some set of expressions p1, p2, p3,…, understood intuitively as ranging over propositions, and call them propositional variables (their most common name) or elementary letters (less common, but our preferred one). This set may be finite or infinite; the usual convention is to take it as either countably infinite or finite but of unspecified cardinality. As subscripts are a pain, we usually write elementary letters as p, q, r, … bringing in indices only when we run short of letters or they are convenient for formulating general facts. The formulae (US dialect ‘formulas’, in some texts ‘well-formed formulae’ abbreviated ‘wffs’) of our language are expressions that can be obtained recursively from elementary letters by applying connectives. If the chapter on recursion and induction has not been forgotten entirely, it should be clear what this means: the set of formulae is the least set L that contains all elementary letters of the language and is closed under the connectives. In other words, whenever a, b 2 L then so are (¬a), (a ^ b), (a _ b); and only expressions that can be formed from elementary letters in a finite number of such steps are counted as formulae. In the chapter on trees, we have already seen why at least some brackets are needed in such propositional formulae. For example, we need to be able to distinguish (p ^ q) _ r from p ^ (q _ r) and likewise ¬(p ^ q) from (¬p) ^ q. We also saw how the brackets may in principle be dispensed with if we adopt a prefix (Polish) or postfix (reverse Polish) notation, and we learned how to draw the syntactic decomposition tree of a formula. If you did not cover Chap. 7 before coming to the present one, you are advised to read now its Sect. 7.4 and do the exercises there.
258
8
Yea and Nay: Propositional Logic
We also agreed to make reading easier by omitting brackets when this can be done without ambiguity, for example by omitting the outermost brackets of a formula, which, in fact, we have just done in the above examples and will continue to do. Finally, we reduce brackets a bit further by using a few standard grouping conventions, notably for negation, for example reading bracket-free ¬p ^ q as (¬p) ^ q rather than as ¬(p ^ q). You will get used to these conventions just as you did in school for expressions using arithmetic operations. With this out of the way, we can get down to more serious business, defining the fundamental concepts of classical propositional logic. An assignment is defined to be a function v: E ! {1,0} on the set E of elementary letters of the language into the two-element set {1,0}. Roughly speaking, an assignment corresponds to left-hand part of a row in a truth-table, the part under the elementary letters. Using the fact that the brackets in compound formulae ensure unique readability, we can apply the general principle of structural recursive definition (Chap. 4, Sect. 4.6.3) to conclude that for each assignment v: E ! {1,0} there is a unique function v+: L ! {1,0}, where L is the set of all formulae, that satisfies the following two conditions: (1) It agrees with v on E; that is, v+(p) = v(p) for every elementary letter p (2) it satisfies the familiar truth-table conditions; that is, v+(¬a) = 1 iff v+(a) = 0, v+(a^b) = 1 iff v+(a) = v+(b) = 1, and v+(a _ b) = 0 iff v+(a) = v+(b) = 0. Such a function v+ is called a valuation of formulae, specifically, the valuation determined by the assignment v. Assured of this unique determination and in accord with the precept of minimizing notational fuss, we will soon be ‘abusing notation’ by dropping the superscript from v+ and writing it too as plain v. Only in contexts where confusion could possibly arise will we put the superscript back in. We are interested in a group of five notions that are intimately related to each other: the relations of tautological implication, tautological equivalence and inconsistency and the properties being a tautology and satisfiability
8.3.2 Tautological Implication We begin with the relation of tautological implication, whose converse is known as tautological consequence. On its most basic level, it is a relation between individual formulae. Let a, b be formulae. We say that a tautologically implies b and write a ⊨ b iff there is no valuation v such that v(a) = 1 but v(b) = 0. It is convenient, from the beginning, to consider this in a more general form as a relation between sets of formulae on the left and individual formulae on the right. Let A be a set of formulae, and b an individual formula. We say that A tautologically implies b and write A ⊨ b iff there is no valuation v such that v(a) = 1 for all a 2 A but v(b) = 0. In other words, for every valuation v, if v(a) = 1 for all a 2 A then v(b) = 1. When A is a singleton {a}, this comes to requiring that v(b) = 1 whenever v(a) = 1, that is, requiring that a ⊨ b in the sense of the first definition.
8.3 Logical Relationship and Status
259
The definition can be expressed in terms of truth-tables. If we draw up a truth-table that covers all the elementary letters that occur in formulae in A [ {b}, then it is required that every row which has a 1 under each of the a 2 A also has a 1 under b. It is very important to understand that the symbol ⊨ is not one of the connectives of propositional logic, as are ¬, ^, _ (or whichever connectives are chosen). Whereas p ! q is a formula of the language L of propositional logic (or abbreviates a formula such as ¬p _ q if ! is not one of the chosen (or, as one says, ‘primitive’) connectives of the language, the expression p ⊨ q is not a formula. The sign ⊨, known as a turnstile or gate, is a symbol that we use when talking about formulae of propositional logic. In handy jargon, one says that it belongs to our metalanguage rather than to the object language. This distinction takes a little getting used to, but it is vital; its neglect can lead to inextricable confusion. Table 8.5 lists some of the more important tautological implications, between a set of either one or two formulae on the left and a single formula on the right. The left column gives their more common names—typically a traditional name followed in some cases by its acronym, in some instances also a modern symbolic name. The Greek letters a, b, c stand for arbitrary formulae of propositional logic. In each row, the item under the heading LHS (left hand side) tautologically implies the item under the heading RHS (right hand side). In most cases we have a singleton on the left, but in four rows we have a two-element set whose elements are separated by a comma with the curly brackets omitted. Thus, for example, the premise set for modus ponens is the pair {a, a ! b} and the conclusion is b. We can check each of these tautological implications by building a truth-table. For example, for modus tollens the four possible truth-value combinations for a, b are given in the left part Table 8.6. The resulting values of a ! b, ¬b, ¬a are
Table 8.5 Some important tautological implications Name
LHS
RHS
Simplification, ^−
a^b a^b a, b a b a ! b, a a ! b, ¬b, a _ b, ¬a a ! b, b ! c b ¬a a ^ ¬a a
a b a^b a_b a_b b ¬a b a!c a!b a!b b b _ ¬b
Conjunction, ^+ Disjunction, _+ Modus ponens, MP, !− Modus tollens, MT Disjunctive syllogism, DS Transitivity Material implication Limiting cases, right and left explosion
260
8
Yea and Nay: Propositional Logic
Table 8.6 Truth-tabular verification of modus tollens a
b
a!b
¬b
¬a
1 1 0 0
1 0 1 0
1 0 1 1
0 1 0 1
0 0 1 1
calculated step by step, from the inside to the outside, in other words, from the leaves of the miniature syntactic decomposition trees for the three formulae to their roots. We ask: Is there a row in which the two premises a ! b, ¬b get 1 while the conclusion ¬a gets 0? No, so the premises tautologically imply the conclusion; in brief, {a ! b, ¬b} ⊨ ¬a. Once understood, the entries in Table 8.5 should be committed firmly to memory. That is rather a bore, but it is necessary in order to make progress. It is like learning some basic equalities and inequalities in arithmetic; you need to have them at your fingertips, so as to apply them without hesitation. Exercise 8.3.2 (a) Draw a truth-table to check out disjunctive syllogism. (b) (i) Check the first limiting case of tautological implication, called also right explosion. (ii) Explain in general terms why it holds, even when the formulae a and b share no elementary letters with a or b. (iii) Give a similar general explanation for the other limiting case of ‘left explosion’. (c) Show that the relation of tautological implication between individual formulae is reflexive and transitive, but not symmetric. (d) Show that the relation of tautological implication between individual formulae is not complete in the sense of Chap. 2, Sect. 2.6.2. Solution (a) In Table 8.7 for disjunctive syllogism, there is just one row in which both premises come out true, and that row makes the conclusion true. So, the set of the two premises does tautologically imply the conclusion. (b) (i) In Table 8.8 for right explosion, there is no row that makes the sole premise true so, a fortiori, there is no row that makes all premises (i.e. just that one) true and makes the conclusion false. So, the premise does tautologically imply the conclusion. By the way, when drawing up the truth-table, there is no need to repeat the column for b again on the right, although no damage is done if you do so. (b) (ii) Instead of talking in terms of rows, we now speak more briefly of valuations of truth-values and use the usual notation for functions. Since there is no valuation v of truth-values with v(a ^ ¬a) = 1, there is no valuation that simultaneously does that and makes v(b) = 0.
8.3 Logical Relationship and Status
261
Table 8.7 Truth-tabular verification of disjunctive syllogism a
b
a_b
¬a
b
1 1 0 0
1 0 1 0
1 1 1 0
0 0 1 1
0 0 1 1
Table 8.8 Truth-tabular verification of right explosion a
b
a ^ ¬a
1 1 0 0
1 0 1 0
0 0 0 0
(b) (iii) Since there is no valuation v with v(b _ ¬b) = 0, there is no valuation v with both v(b _ ¬b) = 0 and v(a) = 1. We will have more to say about the explosion principles (and disjunctive syllogism) in Chap. 11. (c) For reflexivity, let a be any formula. Clearly, if v(a) = 1 then v(a) = 1. For transitivity, suppose for reductio that a ⊨ b and b ⊨ c but a ⊭ c. By the last, there is a valuation v with v(a) = 1, v(c) = 0. Since v(a) = 1, we know from a ⊨ b that v(b) = 1, so we have from b ⊨ c that v(c) = 1, contradicting v(c) = 0. For failure of symmetry, let p, q be distinct elementary letters. Then p ^ q ⊨ p but p ⊭ p ^ q. Remarks: Although symmetry fails, the relation ⊨ is not asymmetric, witness a ⊨ a. And although a ⊨ a ^ b fails for some formulae, there are choices of a, b for which it holds—for example, let a be any formula and choose b to be a. (d) Take any two distinct elementary letters p, q; clearly neither p ⊨ q nor q ⊨ p.
8.3.3 Tautological Equivalence Let a, b be formulae. Depending on the choice of these formulae, we may have none, just one, or both of a ⊨ b, b ⊨ a holding (see Exercise 8.3.2 (c) for the failure of symmetry). When a ⊨ b and b ⊨ a both hold, we say that the two formulae are tautologically equivalent and write a ⟚ b. Equivalently: a ⟚ b iff v (a) = v(b) for every valuation v. In terms of truth-tables: a is tautologically equivalent to b iff, when we draw up a truth-table that covers (at least) all the elementary letters that occur in them, the column for a comes out the same as the column for b. Once again, the symbol ⟚ does not belong to the object language of propositional logic but is part of our metalanguage.
262
8
Yea and Nay: Propositional Logic
Table 8.9 Some important tautological equivalences using ¬, ^, _ Name
LHS
RHS
Double negation Commutation for ^ Association for ^ Commutation for _ Association for _ Distribution of ^ over _ Distribution of _ over ^ Absorption
a a^b a ^ (b ^ a_b a _ (b _ a ^ (b _ a _ (b ^ a a a a ¬(a ^ b) ¬(a _ b) a^b a_b a ^ ¬a a _ ¬a
¬¬a b^a (a ^ b) ^ c b_a (a _ b) _ c (a ^ b) _ (a (a _ b) ^ (a a ^ (a _ b) a _ (a ^ b) (a ^ b) _ (a (a _ b) ^ (a ¬a _ ¬b ¬a ^ ¬b ¬(¬a _ ¬b) ¬(¬a ^ ¬b) b ^ ¬b b _ ¬b
Expansion De Morgan
Limiting cases
c) c) c) c)
^ c) _ c)
^ ¬b) _ ¬b)
We list the most important tautological equivalences that can be expressed in up to three elementary letters: Table 8.9 contains equivalences using at most the connectives ¬, ^, _, while Table 8.10 considers !, $, by themselves as well as in interaction with the others. Just as for the tautological implications in Table 8.5, they should be committed to memory after being understood. The ones that students have most difficulty memorizing correctly are distribution and expansion, particularly the latter version of each; for some reason that nobody has explained, humans seem to have more difficulty processing a conjunction of disjunctions than a disjunction of conjunctions. Exercise 8.3.3 (1) (a) Verify distribution of _ over ^ by reasoning verbally about valuations, rather than by drawing a table. (b) What syntactic feature is shared by the limiting case equivalences, absorption and expansion, but none of the others? (c) Show from the definition that tautological equivalence is indeed an equivalence relation.
8.3 Logical Relationship and Status
263
Table 8.10 Some important tautological equivalences using !, $ Name
LHS
RHS
Contraposition
a!b a ! ¬b ¬a ! b a ! (b ! c) a ! (b ! c) a ! ¬a ¬a ! a a$b a $ (b $ c) ¬(a $ b) ¬(a $ b) a$b a$b a!b a!b a_b ¬(a ! b) ¬(a ^ b) ¬(a $ b)
¬b ! ¬a b ! ¬a ¬b ! a (a ^ b) ! c b ! (a ! c) ¬a a b$a (a $ b) $ c a $ ¬b ¬a $ b (a ! b) ^ (b ! a) (a ^ b) _ (¬a ^ ¬b) ¬(a ^ ¬b) ¬a _ b ¬a ! b a ^ ¬b a ! ¬b (a ^ ¬b) _ (b ^ ¬a)
Packing/unpacking (import/export) Permutation Consequentia mirabilis (miraculous consequence) Commutation for $ Association for $ ¬ through $ Translations between two-place connectives
Translations of negations of two-place connectives
Solution (a) We want to show that a _ (b ^ c) ⟚ (a _ b) ^ (a _ c). For LHS ⊨ RHS, let v be a valuation and suppose v(LHS) = 1. Then either v(a) = 1 or v(b ^ c) = 1. In the former case, v(a _ b) = 1 = v(a _ c), so v(RHS) = 1. For RHS ⊨ LHS, suppose v(LHS) = 0. Then v(a) = 0, also v(b ^ c) = 0 so that either v(b) = 0 or v(c) = 0. In the former case, v(a _ b) = 0 so v(RHS) = 0. In the latter case, v (a _ c) = 0 so similarly v(RHS) = 0 and we are done. Suggestion: Draw up a truth-table (8 rows) for this tautological equivalence and compare the two verifications: which is longer, more easily programmed for computer, more boring? (b) For all other tautological equivalences in Table 8.9, LHS and RHS contain the same elementary letters, while that is not always the case for the absorption, expansion, limiting case equivalences. In absorption and expansion the RHS may gain letters, in explosion LHS and RHS may have no letters in common. (c) Reflexivity holds since trivially: if v(a) = 1 then v(a) = 1. Symmetry is immediate from the definition. Transitivity holds by the same reasoning as given for tautological implication in Exercise 8.3.2 (c) but carried out in both directions. End of solution.
264
8
Yea and Nay: Propositional Logic
Many of the equivalences in Table 8.9 have well-known analogues for sets, familiar from Chap. 1. For example, the first two de Morgan principles for propositions have as counterparts the identities −(A \ B) = –A [ –B and –(A B) = –A \ –B for arbitrary sets A, B, where—is complementation with respect to some local universe. Indeed, there is a systematic correspondence between tautological equivalences and Boolean identities between sets and, similarly, one between tautological implications and rules of inclusion between sets. This is not surprising, since intersection, union and complementation were defined in Chap. 1 using ‘and’, ‘or’ and ‘not’ respectively: the behaviour of those logical connectives is reflected in the mirror of the corresponding set operations. The de Morgan equivalences in Table 8.9 answer a question that we posed, at the end of Sect. 8.2, about connectives needed to express all truth-functions. Every truth-function can be expressed using just the two connectives ¬, ^, since from them we can get _ by the last of the four de Morgan equivalences, and we already know that with that trio we may obtain all the others. Likewise, the pair ¬, _ suffices to express all possible truth-functions, via the third de Morgan equivalence. Exercise 8.3.3 (2) (a) Use a truth-table to verify association for $. (b) Use information from the list of equivalences to show that the pair {¬, !} is enough to express all truth-functions. (c) (i) Use information from Tables 8.9 and 8.10 to sketch the basic idea for a proof that any formula built using at most the connectives ¬, $ is equivalent to one in which all occurrences of ¬ act on elementary letters. (ii) How might one go about transforming that idea into a rigorous proof by structural induction, following the principles of Chap. 4? Solution (a) See Table 8.11. To facilitate comparison, we have put in bold type the columns for a $ (b $ c) and (a $ b) $ c; to reduce clutter we have not repeated the columns for a and c alone, as they can be read off from the left side. (b) The last of the listed translations between two-place connectives tells us how _ may be expressed in terms of ¬,!, and we already know that the pair {¬,_} suffices to express all truth-functions. (c) (i) Use either of the two ‘¬ through $’ equivalences in Table 8.10 to ‘push negations inwards’ through material equivalences, using also the equivalence in Table 8.9 to delete any double negations that appear in the process, continuing until all negations have been pushed up against sentence letters.
8.3 Logical Relationship and Status
265
Table 8.11 Truth-tabular verification of association for $ a
b
c
1 1 1 1 0 0 0 0
1 1 0 0 1 1 0 0
1 0 1 0 1 0 1 0
a
$
(b $ c)
(a $ b)
$
1 0 0 1 0 1 1 0
1 0 0 1 1 0 0 1
1 1 0 0 0 0 1 1
1 0 0 1 0 1 1 0
c
(c) (ii) One way is by defining a suitable function on formulae into the natural numbers to measure the distance of a formula as it is from the shape we would like it to be in, and induce on that. Articulating a function that does the job properly is trickier than might at first appear; here is one. Given a formula a using at most the connectives ¬, $, construct its syntactic decomposition tree with economical labels (Chap. 7, Sects. 7.3 and 7.4). For each branch B of the tree, define d(B) to be the number of occurrences of ¬, $ in the branch such that $ is in the scope of ¬, then put d(a) to be the maximum value of d(B) for branches B in the tree. Carry out a cumulative induction on the structure of formulae, noting in the induction step that d(a $ ¬b), say, is less than d(¬(a $ b)). End of solution. A set of truth-functional connectives is said to be functionally complete if all truth-functions, of any finite number of places, may be expressed using only connectives from that set. From what we have done so far, we know that the sets {¬,^,_}, {^,¬}, {¬,_} and {¬,!} are all functionally complete. Exercise 8.3.3 (3) (a) Is there any two-place truth-connective that, taken alone, is functionally complete? (b) Show that if a truth-functional connective (of any arity) is functionally complete by itself, then it must be both (i) contrarian (in the sense that it receives value 0 in the top row of its truth-table) and (ii) dual-contrarian (receives 1 in the bottom row). Solution outline (a) Go through the sixteen two-place truth-functions in Table 8.4. You will find two that do the job: f9 (known as not-both, or nand) and f15 (known as neithernor). To check them, first express ¬ (hint: identify elementary letters), and then express either ^ or _, whichever you find easier.
266
8
Yea and Nay: Propositional Logic
(b) Call the connective * and consider formulae built using it alone. For (i), suppose that * is not contrarian. Let v be the valuation that puts v(p) = 1 for all elementary letters p. An easy structural induction shows that v(a) = 1 for all formulae. Hence, * cannot express any truth-function that has 0 in the top row of its table; for example, it cannot express negation. For (ii), suppose that * is not dual-contrarian and carry out a dual argument. End of solution. We already know that tautological equivalence is, indeed, an equivalence relation. We end this subsection by noting that it has two further properties. It is also a congruence relation with respect to every truth-functional connective. That is, whenever a ⟚ a′ then ¬a ⟚ ¬a′; whenever a ⟚ a′ and b ⟚ b′ then a ^ b ⟚ ′ ^ b′ and a _ b ⟚ a′ _ b′ and likewise for all other truth-functional connectives since they are definable from these two. Moreover, tautological equivalence has the replacement property. That is, whenever a ⟚ a′ then if we take a formula c and replace one or more occurrences of a in c by a′ to get a formula c′, then c ⟚ c′. Exercise 8.3.3 (4) Verify that tautological equivalence is a congruence relation. Solution For negation, suppose a ⟚ a′ and let v be any valuation. By the supposition v (a) = v(a′) so by the truth-table for negation, v(¬a) = v(¬a′). For conjunction, suppose a ⟚ a′ and b ⟚ b′ and let v be any valuation. Then v(a^b) = 1 iff both v (a) = 1 and v(b) = 1, which by the supposition holds iff both v(a′) = 1 and v (b′) = 1, thus iff v(a′^b′) = 1. End of solution. The concept of tautological equivalence may evidently be ‘lifted’ to a relation between sets of formulae. If A, B are sets of formulae, we say that they are tautologically equivalent and write A ⟚ B iff both A ⊨ b for all b 2 B and B ⊨ a for all a 2 A. Equivalently: for every valuation v, v(a) = 1 for all a 2 A iff v(b) = 1 for all b 2 B. In a concise notation, we could write v(A) = 1 to abbreviate ‘v(a) = 1 for all a 2 A’ and say: A ⟚ B iff for all valuations v, v(A) = 1 iff v(B) = 1. By suitably editing the argument for Exercise 8.3.3 (1)(c) we can verify that ⟚ is, as its name suggests, a genuine equivalence relation between sets of formulae.
8.3.4 Tautologies, Contradictions, Satisfiability Now that we have the relations of tautological implication and equivalence under our belt, the properties of being a tautology, contradiction, or contingent are child’s play. Let a be any formula. • We say that a is a tautology iff v(a) = 1 for every valuation v, in other words, iff a comes out with value 1 in every row of its truth-table. • We say that a is a contradiction iff v(a) = 0 for every valuation v, that is, iff a comes out with value 0 in every row of its truth-table.
8.3 Logical Relationship and Status
267
• We say that a is contingent iff it is neither a tautology nor a contradiction, in other terms, iff v(a) = 1 and u(a) = 0 for some valuations v and u. Clearly, every formula is either a tautology, or a contradiction, or contingent, and only one of these. In other words, these three sets partition the set of all formulae into three cells. Personally, the author prefers the term ‘counter-tautology’ to ‘contradiction’, but has never been able to persuade anyone else to use it, so we follow the standard name. Exercise 8.3.4 (1) Classify the following formulae as tautologies, contradictions, or contingent: (i) p _ ¬p, (ii) ¬(p _ ¬p), (iii) p _ ¬q, (iv) ¬(p _ ¬q), (v) (p ^ (¬p _ q)) ! q, (vi) ¬(p _ q) $ (¬p ^ ¬q), (vii) p ^ ¬p, (viii) p ! ¬p, (ix) p $ ¬p, (x) (r ^ s)_ ¬(r ^ s), (xi) (r ! s) $ ¬(r ! s). Solution Tautologies: (i), (v), (vi), (x). Contradictions: (ii), (vii), (ix), (xi). Contingent: (iii), (iv), (viii). End of solution. If you did Exercise 8.3.4 (1) conscientiously, you will have sensed several general lessons that emerge from it. • A formula is a tautology iff its negation is a contradiction. Example: (i) and (ii). • A formula is contingent iff its negation is contingent. Example: (iii) and (iv). • A conditional formula a ! b is a tautology iff a ⊨ b. Indeed, for all n 1; fa1 ; . . .; an g ⊨ b iff the formula ða1 ^ . . . ^ an Þ ! b is a tautology. Example: formula (v) of the exercise and disjunctive syllogism in Table 8.4. • A bi-conditional formula a $ b is a tautology iff a ⟚ b. Example: formula (vi) of the exercise and one of the de Morgan equivalences in Table 8.10. Exercise 8.3.4 (2) Verify the third bullet point in its general form. Solution Suppose fa1 ; . . .; an g ⊭ b. Then there is a valuation v with each v(ai) = 1 and v (b) = 0. Hence vða1 ^ . . . ^ an Þ ¼ 1 while v(b) = 0, so ða1 ^ . . . ^ an Þ ! b is not a tautology. For the converse, run the same argument backwards. End of solution. Another lesson is suggested by parts (x) and (xi) of Exercise 8.3.4 (1). The former tells us that (r ^ s) _ ¬(r ^ s) is a tautology. Without making a truth-table, we can see that it must be so since it is merely a substitution instance of the simple tautology p _ ¬p. Likewise, (r ! s) $ ¬(r ! s) is a contradiction, being a substitution instance of the contradiction p $ ¬p. Quite generally, we have the following principle, which we will prove in a moment. • Every substitution instance of a tautology or a contradiction is, respectively, a tautology or contradiction.
268
8
Yea and Nay: Propositional Logic
On the other hand, not every substitution instance of a contingent formula is contingent. For example, we saw that p _ ¬q is contingent, but its substitution instance p _ ¬p (formed by substituting p for q) is a tautology, while another of its substitution instances (p ^ ¬p) _ ¬ (q _ ¬q), formed by substituting p ^ ¬p for p and q _ ¬q for q, is a contradiction. The notion of a substitution in propositional logic can be given a precise mathematical content. A substitution is a function r: L ! L, where L is the set of all formulae, satisfying the following homomorphism conditions: rð:aÞ ¼ :rðaÞ rða ^ bÞ ¼ rðaÞ ^ rðbÞ Here, for simplicity, we are assuming that ¬, ^ are the only two primitive connectives in L. Note that, in this definition, = is not just tautological equivalence; it is full identity between formulae, i.e. the left and right sides stand for the very same formula. Since the bracketing in formulae guarantees unique readability (Chap. 4, Sect. 4.6.3) a substitution function is uniquely determined by its values for elementary letters, in other words, the notion is well-defined by those values. Since a _ b, a ! b, a $ b are understood as abbreviations for ¬a ^ ¬b, ¬(a ¬b), (a ^ b) _ (¬a ^ ¬b) respectively, substitution functions satisfy analogous homomorphism conditions for them too. Exercise 8.3.4 (3) (a) Suppose r(p) = q ^ ¬r, r(q) = ¬q, r(r) = p ! s. Identify the formulae (i) r(¬p), (ii) r(p _ ¬q), (iii) r(r _ (q ! r)). (b) Write out the analogous homomorphism conditions for !, $. Solution (a) (i) r(¬p) = ¬r(p) = ¬(q ^ ¬r), (ii) r(p _ ¬q) = r(p) _ r(¬q) = r(p) _ ¬r (q) = (q ^ ¬r) _ ¬¬q. For (iii), omitting the intermediate calculations, r(r_ (q ! r)) = (p ! s) _ (¬q ! (p ! s)). By now, you will have seen that you can perform substitutions by using the copy-paste facility on your word processor. (b) r(a ! b) = r(a) ! r(b), r(a $ b) = r(a) $ r(b). End of solution.
Note that substitutions are carried out simultaneously, not serially. For example, in part (a) (ii) of the exercise, r(p _ ¬q) is obtained by simultaneously substituting r(p) for p and r(q) for q. If we were to replace serially, first substituting r(p) for p to get (q ^ ¬r) _ ¬q and then substituting r(q) for q, we would get the result (¬q ^ ¬r) _ ¬¬q, which differs in the sign on the first occurrence of q.
8.3 Logical Relationship and Status
269
We are now able to prove the claim that every substitution instance of a tautology is a tautology or, as we also say in the terminology of Chap. 3, Sect. 3.2.2, the set of all tautologies is closed under substitution. Let a be any formula, and r any substitution function. Suppose that r(a) is not a tautology. Then there is a valuation v such that v(r(a)) = 0. Let v′ be the valuation defined on letters by putting v0 ðpÞ ¼ vðrðpÞÞ. Then it is easy to verify by structural induction that for every formula b, v0 ðbÞ ¼ vðrðbÞÞ. In particular, v0 ðaÞ ¼ vðrðaÞÞ ¼ 0, so that a is not a tautology. Likewise, the set of all contradictions, and the relations of tautological equivalence and tautological implication are closed under substitution. That is, for any substitution function r we have the following. • • • •
Whenever Whenever Whenever Whenever
a is a contradiction then r(a) is too a ⟚ b then r(a) ⟚ r(b) a ⊨ b then r(a) ⊨ r(b) A ⊨ b then r(A) ⊨ r(b).
Here A is any set of formulae, and r(A) is defined, as you would expect from the chapter on functions, as {r(a): a 2 A}. Exercise 8.3.4 (4) Complete the inductive details in the verification that the set of all tautologies is closed under substitution. Solution For the basis, we need to show that v0 ðpÞ ¼ vðrðpÞÞ; but that is given explicitly by the definition of v. For the induction step, suppose that the property holds for u, w; we need to show that it holds for ¬u, u^w. For negation, we need to show that v0 ð:uÞ ¼ vðrð:uÞÞ: Now, RHS ¼ vð:rðuÞÞ ¼ 1 vðrðuÞÞ ¼ 1 v0 ðuÞ ¼ LHS; using the induction hypothesis for the penultimate equality. For conjunction, we need to show that v0 ðu ^ wÞ ¼ vðrðu ^ wÞÞ: Now, RHS ¼ vðrðuÞ ^ rðwÞÞ ¼ minfvðrðuÞÞ; vðrðwÞÞg ¼ minfv0 ðuÞ; v0 ðwÞg ¼ LHS; again using the induction hypothesis for the penultimate equality. The last of the inter-connected notions that we need to define is that of the satisfiability of a set of formulae. When A is a set of formulae and v is a valuation, we say that v satisfies A iff v(a) = 1 for all a2 A (briefly, iff v(A) = 1). The set A is satisfiable iff there is some valuation v that satisfies it, otherwise it is said to be unsatisfiable. Exercise 8.3.4 (5) Verify the following: (a) (i) A singleton {a} is satisfiable iff a is not a contradiction, and (ii) {a} is unsatisfiable iff ¬a is a tautology, (a) (i) A finite set of formulae is satisfiable iff the conjunction of all its elements is not a contradiction. (ii) It is unsatisfiable iff the disjunction of the negations of all its elements is a tautology.
270
8
Yea and Nay: Propositional Logic
Solution outline Just apply the definitions and, where needed, the relevant truth-tables.
8.4
Normal Forms
The formulae of propositional logic may be of any length, depth or level of complexity. It is important to be able to express them in the most transparent possible way. The motivation is the same as in school arithmetic when we express polynomials in a standard form, but the way in which this plays out in logic is rather different. In this section we will look briefly at four kinds of normal form for logic. The first two focus on the positioning of connectives in a formula, showing that they may always be applied in a neat order. The next two concern the interplay of elementary letters; one of them is about letters that can be eliminated while the other compartmentalizes their interaction as much as possible.
8.4.1 Disjunctive Normal Form Normal forms are common in logic, mathematics and computer science. A normal form for an expression is another expression, equivalent (in a suitable sense) to the first, but with a nice simple structure. When the normal form is used a lot, it is sometimes also referred to as a canonical form. A ‘normal form theorem’ is one telling us that every expression (from some broad category) has a normal form (of some specified kind). In propositional logic, the best-known such forms are disjunctive normal form, abbreviated dnf and its dual, conjunctive normal form, aka cnf. To explain them, we need the concepts of a literal and basic conjunction. A literal is simply an elementary letter or its negation. A basic conjunction is any conjunction of n 1 literals in which no letter occurs more than once. Thus, we do not allow repetitions of an unnegated letter as in p ^ q ^ p, nor repetitions of a negated letter as in ¬p ^ q ^ ¬p, nor a letter occurring both negated and unnegated as in ¬p ^ q ^ p. We write a basic conjunction as p1 ^ . . . ^ pn , where ± indicates the presence or absence of a negation sign. In the limiting case that n = 1, a basic conjunction is of the form ±p, without any conjunction sign. A formula is said to be in disjunctive normal form (dnf) iff it is a disjunction of m 1 basic conjunctions. Again, in the limiting case that m = 1, a dnf will not contain a disjunction sign. A formula is said to be in full dnf iff it is in dnf and moreover every letter in it occurs in each of its disjuncts, i.e., in each of the basic conjunctions.
8.4 Normal Forms
271
Exercise 8.4.1 (1) (a) Which of the following are in disjunctive normal form? When your answer is negative, explain briefly why. (i) ((p ^ q) _ ¬r) ^ ¬s, (ii) (p _ q) _ (q ! r), (iii) (p ^ q) _ (¬p ^ ¬q), (iv) (p ^ q) _ (¬p ^ ¬q ^ p), (v) (p ^ q) _ (¬p ¬q ^ ¬p), (vi) p ^ q ^ r, (vii) p, (viii) ¬p, (ix) p _ q, (x) p _ ¬p, (xi) p ^ ¬p. (b) Which of the above are in full dnf? Solution (a) No: there is a disjunction inside a conjunction. (ii) No: we have not eliminated !. (iii) Yes. (iv) No: ¬p ^ ¬q ^ p contains two occurrences of p and so is not a basic conjunction. (v) No: ¬p ^ ¬q ^ ¬p contains two occurrences of ¬p. (vi) through (x) all yes. (xi) No: p ^ ¬p has two occurrences of p, one negated and the other unnegated. (b) (ix) is not in full dnf because its two disjuncts do not contain exactly the same letters. On the other hand, the remaining dnf formulae (iii), (vi), (vii), (viii), (x) are full. End of solution. How can we find a disjunctive normal form for an arbitrarily given formula a? There are two basic algorithms. One is semantic, via the truth-table for a. The other is syntactic, via successive transformations of a that are justified by tautological equivalences from Tables 8.9 and 8.10. The semantic construction is the simpler of the two, although not always the shortest to carry out. In fact, we already made use of it in Sect. 8.3, when we showed that the trio {¬,^,_} of connectives is functionally complete. We begin by drawing up the truth-table for a. Then: • In the principal case that a is not a contradiction, the dnf of a is the disjunction of the basic conjunctions that correspond to rows of the table in which a receives value 1. • When there are no such rows, i.e., in the limiting case that a is a contradiction, the formula does not have a dnf. It is clear from the construction that every non-contradictory formula has a disjunctive normal form. It is also clear that the dnf obtained is unique up to the ordering and bracketing of literals and basic conjuncts. Moreover, it is clearly full. Exercise 8.4.1 (2) Find the full disjunctive normal form (if it exists) for each of the following formulae, using the above truth-table algorithm: (i) p $ q, (ii) p ! (q _ r), (iii) ¬(p ! (q ! p)), (iv) (p _ q) ^ (¬p _ ¬q) ^ (¬p _ q).
272
8
Yea and Nay: Propositional Logic
Solution outline We give the final results without the intermediate calculations. (i) (p ^ q) _ (¬p ¬q). (ii) (p ^ q ^ r) _ (p ^ q ^ ¬r) _ (p ^ ¬q ^ r) _ (¬p ^ q ^ r) _ (¬p ^ q ¬r) _ (¬p ^ ¬q ^ r) _ (¬p ^ ¬q ^ ¬r). (iii) The formula has no dnf, a fortiori no full dnf, since it is a contradiction. (iv) ¬p ^ q. End of solution. For the syntactic method, we start with the formula a and proceed by a series of transformations that massage it into the desired shape. The basic idea is fairly simple, although the details are rather fussy. Translate the connectives ! and $ (and any others in the formula, such as exclusive disjunction) into ¬, ^, _ using translation equivalences such as those in Table 8.10. • Use the de Morgan rules ¬(a ^ b) ⟚ ¬a _ ¬b and ¬(a _ b) ⟚ ¬a ^ ¬b iteratively, to move negation signs inwards until they act directly on elementary letters, eliminating double negations as you go by the rule ¬¬a ⟚ a. • Use the distribution rule a ^ (b _ c) ⟚ (a^b) _ (a^c) to move all conjunctions inside disjunctions. • Use idempotence, with help from commutation and association, to eliminate repetitions of literals. • Clean up by deleting repetitions of a literal with the same sign within each basic conjunction, and by deleting those basic conjunctions that contain a letter in both negated and unnegated form. It is understood that when carrying out these steps the association and commutation principles for each of ^ and _ may be applied whenever convenient. The algorithm gives us as output a formula in disjunctive normal form, except when a is a contradiction; in that case the output comes out as empty as a result of applications of the ‘clean-up’ step. However, the dnf obtained in this way is rarely full: there will usually be basic conjunctions with less than the full collection of letters occurring in them. Exercise 8.4.1 (3) (a) Use the syntactic algorithm to transform the formula (p _ ¬(q _ r)) ! r into disjunctive normal form. (b) How might you transform the dnf obtained in (a) into a full one, by further basic equivalences and without resorting to truth-tables? Solution (a) (p _ ¬(q _ r)) ! r ⟚ ¬(p _ ¬(q _ r)) _ r ⟚ (¬p ^ ¬¬(q _ r)) _ r ⟚ (¬p ^ (q _ r)) _ r ⟚ (¬p ^ q) _ (¬p ^ r) _ r. This exercise is interesting since, while the output is in dnf, there is a way in which it can be further simplified. Clearly, ¬p ^ r ⊨ r so our formula is tautologically equivalent to (¬p ^ q) _ (¬p ^ r) obtained by dropping the last disjunct and still in dnf.
8.4 Normal Forms
273
(b) Apply repeatedly the expansion principle a ⟚ (a ^ b) _ (a ^ ¬b) from Table 8.9, then clean out a repeated disjunct, as follows:
8.4.2 Conjunctive Normal Form Conjunctive normal form is like disjunctive normal form but ‘upside-down’: the roles of disjunction and conjunction are reversed. Technically, they are called duals of each other. A basic disjunction is defined to be any disjunction of (one or more) literals in which no letter occurs more than once. A formula is said to be in conjunctive normal form (cnf) iff it is a conjunction of (one or more) basic disjunctions; it is a full conjunctive normal form of a iff every letter of a occurs in each of the basic disjunctions. Cnfs may also be constructed in any of three ways: syntactically, semantically, or piggybacking on dnfs. Syntactically, we can follow the same algorithm as for dnfs, except that we use the dual distribution rule a _ (b ^ c) ⟚ (a _ b) ^ (a _ c) to move all disjunctions inside conjunctions and, in the final ‘cleaning stage’, we delete any basic disjunction that contains both a letter and its negation. Semantically, we look at the rows of the truth-table that give a the value 0. For each such row we construct a basic disjunction: this will be the disjunction of those letters with the value 0 and the negations of the letters with value 1. We then conjoin these basic disjunctions. This will give an output in conjunctive normal form except when the initial formula a is a tautology. At first sight, the semantic construction may seem a little mysterious. Why, when constructing the basic disjunctions, do we take letters that were assigned 0 and negations when the letter was assigned 1? Is there an underlying idea? There is, indeed. Instead of allowing the valuations that make the formula a true, we are disallowing those that make a false. To do that, we take each row that gives a the value 0, and declare it not to hold. That is the same as negating the basic conjunction of that row, and by de Morganizing that negation we get the basic disjunction described in the construction. In effect, the basic disjunction says ‘not in my row, thank you’.
274
8
Yea and Nay: Propositional Logic
Alice Box: Conjunctive normal form
Alice Hatter
Why should we bother with cnfs when we already have dnfs? They are much less intuitive! Indeed they are, with their conjunctions of disjunctions. But they have been found useful in a discipline known as logic programming. Such a programme may, in the simplest case, be seen as a set (or conjunction) of positive clauses ðp1 ^ . . . ^ pn Þ ! q with n 0 (understood as just the letter q in the limiting case that n = 0). They are also known as Horn clauses, after the mathematician Alfred Horn who made good use of them in abstract algebra. Any such formula may be expressed as a basic disjunction with just one unnegated letter, namely :p1 _ . . .:pn _ qðn 0Þ. A finite collection of such formulae may be treated as behaving like their conjunction, which evidently is in cnf.
Finally, here is how to construct a cnf for a formula a by piggy-backing on a dnf for its negation ¬a. Given a, we construct a dnf of its negation ¬a by whichever method you like (truth-tables or successive transformations). This will be a disjunction b1 ^ . . . ^ bn of basic conjunctions bi. Negate it, getting :ðb1 _ . . . _ bn Þ, which is tautologically equivalent to ¬¬a and thus by double negation equivalent to the original a. Then use de Morgan to push all negations inside, getting :ðb1 ^ . . . ^ bn Þ. Each ¬bi is of the form :ðp1 ^ . . . ^ pn Þ, so we can apply de Morgan again, with double negation elimination as needed, to express it as a disjunction of literals, and we are done. Exercise 8.4.2 (a) Take again the formula (p _ ¬(q _ r)) ! r, and find a cnf for it by all three methods: (i) successive syntactic transformations, (ii) semantic, (iii) the piggy-backing method. (b) Evidently, in most cases a formula that is in dnf will not be in cnf. But in some limiting cases it will be in both forms. When can that happen? (c) Check that ¬p1 _ …¬pn _ q ⟚ (p1^…^ pn) ! q. Solution (a) (i) (p _ ¬(q _ r)) ! r ⟚ ¬(p _ ¬(q _ r)) _ r ⟚ (¬p ^ ¬¬(q _ r)) _ r ⟚ (¬p ^ (q _ r)) _ r ⟚ (¬p _ r) ^ (q ^ r _ r) ⟚ (¬p _ r) ^ (q _ r). (a) (ii) Three of the eight rows make the formula false; applying the cnf algorithm to those rows gives us (¬p _ ¬q _ r) ^ (¬p _ q _ r) ^ (p _ q _ r). This is not quite the same formula as in (a) (i), but they are easily checked to be tautologically equivalent. (a) (iii) The same three rows make the negation of the formula true, so the dnf of that negation is (p ^ q ^ ¬r) _ (p ^ ¬q _ r) _ (¬p _ ¬q _ ¬r). Negate
8.4 Normal Forms
275
that and apply successive de Morganizations and double negation eliminations to get the same output as in (a) (ii). From this example, you can see that the piggy-backing method is very close to the direct semantic one. (b) When the formula is tautologically equivalent to a basic conjunction or to a basic disjunction. (c) There is exactly one way of making the LHS false, namely each v(pi) = 1 and v(q) = 0, and that is the same as the unique valuation that makes the RHS false.
8.4.3 Least Letter Set A set A of propositional formulae may contain redundant elements in the sense that A ⟚ A\{b} for some b 2 A. For example, the element q is redundant in the set A = {p, p ! q, q} since {p, p ! q, q} ⟚ {p, p ! q}. Indeed, {p, p ! q} is a minimal subset of A that is tautologically equivalent to A, since none of its three proper subsets have that property. Note, however, that it is not the least such subset, since we also have {p, p ! q, q} ⟚ {p, q}. But there is also another, quite different kind of redundancy, this time of elementary letters occurring within a formula (or within some element of a set of formulae): it can happen that we are able to rewrite the formula (resp. set of formulae) in such a way that the elementary letter in question no longer appears in it (resp. no longer appears in any of its elements). That is the notion that will be studied in the present section. We begin with a simple example. We have already seen in Table 8.9 that p (p _ q) ⟚ p ⟚ p _ (p ^ q); the letter q is thus eliminable from each of the two outlying formulae. The expansion equivalences (p ^ q) _ (p ^ ¬q) ⟚ p ⟚ (p _ q) ^ (p _ ¬q) in the same table give another example. So does the equivalence (p ! q) ^ (¬p ! q) ⟚ q, not in the table: the letter p on the LHS does not appear on the RHS. In general terms, we say that an elementary letter p is eliminable from a formula a (resp. from a set A of formulae) if there is some formula a′ (resp. some set A′ of formulae) with a ⟚ a′ (resp. A ⟚ A′) such that p does not occur in a′ (resp. does not occur in any element of A′). The word ‘redundant’ is sometimes also used for this concept, but that is not a good idea as it invites confusion with the sense of that term given at the beginning of this section. Notice that while the letter p is redundant in the set A = {p, p ! q, q}, it is not eliminable from that set: there is no set A′ ⟚ A such that p does not occur in any element of A′. Notice also that while the formula p ! q is also redundant in the same A, the question of its eliminability does not even arise, as the latter concept applies only to elementary letters. Conversely, while the letter q is eliminable from the formula (p _ q) ^ (p _ ¬q), it is not a redundant element of the singleton {(p _ q) ^ (p _ ¬q)}, since it is not an element of that set at all.
276
8
Yea and Nay: Propositional Logic
In the study of eliminability, it helps streamline our formulations if we expand our language a little to admit a zero-ary connective ⊥ (called the falsum, or bottom), so that ⊥ is a formula with no elementary letters. We stipulate that it receives the value 0 under every valuation. We also stipulate that r(⊥) = ⊥ for any substitution function r. Then contradictions like p ^ ¬p and tautologies like p _ ¬p and will also have eliminable letters, since p ^ ¬p ⟚ ⊥ and p _ ¬p ⟚ ¬⊥. It is clear that for every formula a containing elementary letters p1, .., pn (n 0) there is a minimal set of letters in terms of which a may equivalently be expressed. That is, there is some minimal set Ea of letters such that a ⟚ a′ for some formula a′ all of whose letters are drawn from Ea. This is because a contains only finitely many letters to begin with, and so as we discard letters we must eventually come to a set (perhaps empty) from which no more can be eliminated. But is this minimal set unique? In other words, is there a least such set – one that is included in every such set. In general, as seen in Exercise 2.5(d) at the end of Chap. 2, minimality does not in general imply leastness. However, in the present context, intuition suggests that surely there should be a least letter-set. And in this case intuition is right. The proof is not really difficult, given the availability of the falsum. Let a be any formula and let {p1, …, pm} be a minimal letter-set for a, so that there is a formula a′ ⟚ a containing only the letters p1, …, pm. We want to show that {p1, …, pm} is in fact a least letter-set for a. Suppose that it is not. Then there is a formula a″ equivalent to a and a letter pi 2 {p1, …, pm} such that pi does not occur in a″. We get a contradiction. Let r be the substitution that puts the falsum ⊥ for pi leaving all other letters unchanged. Since a′ ⟚ a″, we know from Sect. 8.3.4 that r(a′) ⟚ r(a″). But, since pi does not occur in a″, we also have r(a″) = a″ ⟚ a, so r(a′) ⟚ a. Now, r(a′) has one less letter than a′, namely pi (remember, ⊥ is not an elementary letter), contradicting the assumption that the letters in a′ form a minimal letter-set for a. Thus every formula a has a least letter-set, which we know from Chap. 2 to be unique. Any formula a′ equivalent to a that is built from those letters is known as a least letter-set version of a. Such formulae a′ are not themselves unique, but they are all tautologically equivalent and they all have the same letter-set. The same considerations apply for arbitrary sets of formulae, even when they are infinite: each set A of formulae has a unique least letter-set, and thus also a least letter-set version A′. It is possible to construct algorithms to find a least letter-set version of any formula, although they are too complex to be carried out easily by hand. So, for small examples like those of the next exercise, we rely on our experience with truth-functional formulae to inspire guesses, which we then settle by checking. Exercise 8.4.3 (a) Find a least letter-set version for each of the following formulae: (i) p ^ ¬p, (ii) (p ^ q ^ r) _ (p ^ ¬q ^ r), (iii) (p $ q) _ (p $ r) _ (q $ r). (b) Do the same for the following sets of formulae: (i) {p _ q _ r, p _ ¬q _ r _ s, p _ ¬q _ r _ ¬s}, (ii) {p ! q, p!¬q}. (c) True or false? “The least letter-set of a finite set of formulae is the same as the least letter-set of the conjunction of all of its elements”.
8.4 Normal Forms
277
Solution (a) (i) ⊥, (ii) p ^ r, (iii) ¬⊥ (which, for obvious reasons, is sometimes written as ⊤). (b) (i) p _ r, (ii) ¬p. (c) True: A finite set A of formulae has the same elementary letters as the conjunction ^A of all its elements; clearly the two are tautologically equivalent and so whatever is equivalent to one is equivalent to the other.
8.4.4 Most Modular Version The next kind of simplification is rather more subtle. It leads us to a representation that does not change the letter-set, but makes the deployment of the letters as ‘modular’ or ‘compartmentalized’ as possible. Its definition makes essential use of the notion of a partition and, before going further, you are advised to review the basic theory of partitions in Chap. 2 (Sect. 2.5.3). Consider the formula set A = {¬p, r ! ((¬p^s)_q), q!p}. This set has three formulae as its elements. Between them the formulae contain four elementary letters p, q, r, s. None of these letters is eliminable – the least letter-set is still {p, q, r, s}. But the way in which the letters occur in formulae in A is unnecessarily ‘mixed up’: they can be separated out rather better from each other. In other words, we can make the presentation of A more ‘modular’, without necessarily reducing the set of letters involved. Observe that A is tautologically equivalent to the set A′ = {¬p, r!s, ¬q}. We have not eliminated any letters, but we have disentangled their role in the set. In effect, we have partitioned the letter set {p, q, r, s} of A into three cells {p}, {r,s}, {q}, with each formula in A′ drawing all its letters from a single cell of the partition. Thus the formula ¬p takes its sole letter from the cell {p}; r!s draws its letters from the cell {r,s}; and ¬q takes its letter from the cell {q}. We say that the partition {{p}, {r,s}, {q}} of the letter-set {p,q,r,s} is a splitting of E for A. In general terms, here is the definition. Let A be any set of formulae, with EA the set of elementary letters occurring in it. If EA 6¼ ∅, a splitting of EA for A is defined to be a partition of EA such that A is tautologically equivalent to some set A′ of formulae with EA′ = EA but with each formula in A′ taking all its letters from a single cell of the partition. Now, as we saw in Exercise 2.5.3 (b) of the chapter on relations, partitions of a given set can be compared according to their fineness: one partition is said to be at least as fine as another iff every cell of the former is a subset of some cell of the latter. This relation between partitions is a partial ordering: reflexive, transitive, antisymmetric. As we also saw in the end-of-chapter Exercise 2.4 (f), one partition is at least as fine as another iff the equivalence relation corresponding to the former is a sub-relation of that corresponding to the latter. Since a splitting of a set of propositional formulae is a special kind of partition of the set of its elementary letters, it makes sense to compare splittings according to
278
8
Yea and Nay: Propositional Logic
their fineness. In our example A = {¬p, r ! ((¬p^s)_q), q!p}, the three-cell splitting {{p}, {r,s}, {q}} mentioned above is finer than the two-cell splitting {{p, q}, {r,s}} that corresponds to the formula set A′ = {¬p ^ ¬q, r ! s} that is also equivalent to A; and this is in turn finer than the trivial one-cell splitting {{p, q, r, s}} that corresponds to A itself. It turns out that for any set A of formulae, EA has a unique finest splitting for A. In our running example, it is the three-cell partition {{p}, {r,s}, {q}} of EA = {p, q, r, s}. The four-cell partition {{p}, {r}, {s}, {q}} of EA is finer – but it is not a splitting for A, since no set A″ of formulae each of which draws its letters from a single cell of this partition, is equivalent to A. We will not prove this, but intuitively it is to be expected, since each formula in A″ contains only a single letter while r!s is not equivalent to any of ⊥, ¬⊥, r, ¬r, s, ¬s. Let A be a set of formulae with letter-set EA and let F be the unique finest splitting of EA for A. By a most modular version of A, we mean any set A′ of formulae that ‘witnesses’ this finest splitting; that is, any set A′ with A′ ⟚ A such that for each a 2 A′, all the letters of a are taken from a single cell of F. Thus a most modular version of A disentangles, as much as possible, the roles that are played by the different elementary letters in elements of A. It makes the presentation of the set as compartmentalized as possible: we have reached the finest way of partitioning the letters such that no formula in our presentation A′ of A contains letters from two distinct cells Strictly speaking, the definitions above cover only the principal case that there is some elementary letter in some formula of A. For in the limiting case that there are no elementary letters, that is, when E = ∅, the notion of a partition of E is not defined. However, in this case A must be tautologically equivalent either to ⊥ or to ¬⊥ and we can, if we wish, take that as the most modular version of A. Whereas the idea of the least letter-set of a set of formulae is quite old, perhaps dating back into the nineteenth century, that of the finest splitting is surprisingly new. It was first formulated and verified for the finite case by Rohit Parikh only in 1999; a proof of uniqueness for the infinite case was given by the author in 2007. Just as for least letter-set versions, any general algorithm for finding most modular versions is highly exponential, and very laborious to execute by hand. But in very simple examples, we can use our experience with truth-functional formulae to inspire a guess and then check it out. Exercise 8.4.4 (1) Find the finest splitting and a most modular version for each of the following sets of formulae: A = {p ^ q, r}, B = {p ! q, q ! r, r!¬p}, C = {(¬p ^ q ^ r) _ (q ¬s ^ ¬p)}, D = {p _ q, q _ r, r _ ¬p, ¬q _ r}. Solution Remember, we are not eliminating letters—in fact, in these examples no letters are eliminable. We are splitting the set of letters that occur in formulae of the set. The finest splitting of the letter-set EA = {p, q, r} for A partitions EA into three singleton cells {p}, {q}, {r}, with A′ = {p, q, r} a most modular version of A.
8.4 Normal Forms
279
The finest splitting of the letter-set EB = {p, q, r} for B partitions EB into two cells {p}, {q,r}, with B′ = {¬p, q ! r} a most modular version of B. The finest splitting of the letter-set EC = {p, q, r, s} for C partitions EC into two cells {p,q}, {r,s}, with C′ = {¬p ^ q, r _ ¬s} a most modular version of C. The finest splitting of the letter-set ED = {p, q, r} for D partitions ED into two cells {p,q}, {r}, with a most modular version D′ = {p _ q, r}. End of solution. We have described three kinds of letter management: constructing a disjunctive or conjunctive normal form (full or otherwise), finding the least letter-set, getting a most modular representation. We have given algorithms for dnfs and cnfs; although algorithms for finding the least letter-set and a most modular version do exist, we have not attempted to articulate them, merely working out some simple examples by guess-and-check. There is nothing to stop us from combining the three kinds of manipulation with each other. In particular, we can often get a better understanding of the logical import of a set A of formulae by finding a most modular version A2 of a least letter-set version A1 of A. Exercise 8.4.3 (2) Consider the set A = {p ! q, ¬q ^ (p _ u), (u ! s) ^ (r ! u)} of formulae. Find a most modular version A2 of a least letter-set version A1 of A. Solution The first two elements of A tautologically imply u, which tautologically implies r ! u, so A ⟚ A1 = {p ! q, ¬q ^ (p _ u), u ! s} where r is eliminated. The letter-set is {p, q, u, s} of A1 is indeed a least letter-set for A, as one can quickly convince oneself by unsuccessfully trying to eliminate more letters, although it would be quite tedious to verify it rigorously. A most modular presentation of A1 is A2 = {¬p, ¬q, u, s}, which splits {p, q, u, s} into singleton subsets {p},{q},{u},{s}. The elements of A2 are literals, which are already in dnf, so no further transformation is useful.
8.5
Truth-Trees
By now, you are probably sick of drawing up truth-tables, even small ones of four or eight rows, to test for the various kinds of tautological relations and properties (tautological implication and equivalence, tautologies and contradictions). In this section, we describe a another procedure, called the method of truth-trees, also known as semantic decomposition trees or semantic tableaux. It is usually rather faster, and certainly less boring, than the method of truth-tables. Moreover, it provides a useful support for some theoretical investigations; when we consider the issue of relevance in Chap. 11, it will be exploited intensively. It is semantic, in the sense that it is formulated in terms of truth-values; algorithmic, in the sense that it its steps can be carried out by a computer; and two-sided, in that it gives a way of determining, in a finite time, whether or not a formula is a
280
8
Yea and Nay: Propositional Logic
tautology, thus supplying us with a decision procedure. In these respects, it is just as powerful as the truth-table method. We begin with an example. We already know that the de Morgan formula a = ¬ (p ^ q) ! (¬p _ ¬q) is a tautology, but let’s verify it by a reductio ad absurdum argument without constructing a truth-table. Suppose that v(a) = 0 for some valuation v. We show, by successive decompositions of the formula, that this supposition leads to a violation of bivalence. From the supposition, we have by the table for material implication that v(¬(p ^ q)) = 1 while v(¬p _ ¬q) = 0. From the latter by the table for disjunction, v(¬p) = 0 and v(¬q) = 0, so by the table for negation, v(p) = 1 and v(q) = 1. On the other hand, since v(¬(p ^ q)) = 1 we have v(p ^ q) = 0 so by the table for conjunction, either v(p) = 0 or v(q) = 0. In the first case we get a contradiction with v(p) = 1 and in the second case a contradiction with v(q) = 1. Thus the initial supposition that v(a) = 0 is impossible, so ¬(p ^ q) ! (¬p _ ¬q) is a tautology. This reasoning can be set out in the form of a labelled tree, as in Fig. 8.1. It is constructed from the root down, and should be read in the same order. To see what is going on, notice the following features of the way in which this tree is built. • The root is labelled with the formula that we are testing, together with a truth-value. In our example, we are testing whether a is a tautology, i.e. whether it is impossible for it to receive value 0, so the label is 0: a. If we had been testing whether a is a contradiction, the label would have been 1: a. • At each step we decompose the current formula, passing from information about its truth-value to resulting information about its immediate sub-formulae. Never in the opposite direction. The information is supplied by the truth-table for whatever connective that is being decomposed at that point.
Fig. 8.1 Truth-tree for ¬(p ^ q) ! (¬p _ ¬q)
8.5 Truth-Trees
281
• When we get definite information about the immediate sub-formulae of u, we put it on every branch below the node for u. One way of not forgetting this is by writing it down immediately before any further dividing takes place. • When we get disjunctive information about the immediate sub-formulae of u, we divide our branch into two sub-branches, with one of the alternatives on one branch and the other alternative on the other. Having constructed the decomposition tree, we need to be able to read off our answer from it. We make sure that we have decomposed each node in the tree whenever it is not an elementary letter. In our example, the ticks next to nodes keep a record that we have actually carried out the decomposition. We locate the crashpairs in the tree (also commonly referred to as explicit contradictions), that is, pairs (1: u and 0: u) of nodes on a common branch, labelled by the same formula but with opposite signs. Then, we read the completed tree as follows: • If every branch contains a crash-pair, then the label of the root is impossible. This is what happens in our example: there are two branches, one containing both 1: p and 0: p, the other with both 1: q and 0: q. We label these branches dead and conclude that 0: a is impossible, i.e. that a is a tautology. • On the other hand, if at least one branch is without any crash-pair, then the label of the root is possible, provided we have really decomposed all decomposable formulae in that branch. We label these branches alive; we can read off any one of them a valuation that gives the root formula the value indicated in the label. In most texts, the rather bland terms closed and open are used in place of dead and alive. For a second example, consider the formula a = ((p ^ q) ! r) ! (p ! r), and test to determine whether it is a tautology. We get the labelled tree of Fig. 8.2. It contains three branches. The leftmost and rightmost ones each contain a crash-pair (1: p and 0: p in the left one, 0: r and 1: r in the right one) and so we label them dead. The middle branch does not contain any explicit contradiction. We check
Fig. 8.2 Truth-tree for ((p ^ q) ! r) ! (p ! r)
282
8
Yea and Nay: Propositional Logic
carefully that we have completed all decompositions in this branch—that we have ticked every formula in it other than elementary letters. We collect from the branch the valuation v(p) = 1, v(r) = v(q) = 0. The valuation generated by this assignment agrees with the label for every formula on the branch; in particular, the root formula a gets the value 0 and so is not a tautology. The construction of such trees always terminates: as we go down branches we work with shorter and shorter formulae until we reach elementary letters and can decompose no further. A rigorous proof of this would be by structural induction on formulae. Evidently, the method is algorithmic and can be programmed. It is certainly less boring than a full truth-table and can sometimes be quite interesting. At the same time, it is usually quicker to calculate—although it must be admitted that in worst-case examples, it can turn out to be just as exponential. There are ways in which the method can be streamlined to maximize its efficiency. Some gains may be obtained by controlling the order in which decompositions are carried out. In Fig. 8.2, after decomposing the root to introduce the second and third nodes, we had a choice of which of those to decompose first. We opted to decompose the third node before the second, but we could perfectly well have done the reverse. The choice was motivated by the fact that the third node gives definite information, and we were following a policy of postponing branching for as long as possible. This is a control heuristic that works well, at least for humans in small finite examples, because it reduces repetition of a given labelled node on different branches. If we were to decompose the second node of the tree in Fig. 8.2 before decomposing the third one, we would repeat 1: p, 0: r on at least two branches. But whichever order of decomposition is followed, the final verdict is the same. Other tricks for avoiding unnecessary labour stem from the fact that we can sometimes stop constructing a tree before it is finished. This can happen in two distinct ways. • If a branch contains a crash-pair before having been fully decomposed, we can already declare that branch dead without completing its decomposition, and pass on to other branches. This occasionally saves some work. • If we have a branch all whose nodes have been decomposed, free of crash-pairs, then we can declare that this branch is live, so that the label of the root (and of everything on the branch) is possible, without bothering to complete any other branches. This often saves a lot of work. For an example, see end-of chapter Exercise 8.4. To take full advantage of the latter kind of economy, one can develop heuristics to guide the choice, when one forks, which side of the fork to construct first and how far down to go before looking at the other side, in effect balancing depth-first and breadth-first strategies of construction. Such heuristics can make a considerable difference to efficiency, but their study takes us beyond the limits of this introduction. Tables 8.12 and 8.13 recapitulate the definite and indefinite (resp. non-forking and forking) decompositions that one may carry out. Their justification is immediate from the truth-tables for the connectives concerned.
8.5 Truth-Trees
283
Table 8.12 Definite decompositions 1: ¬a
0: ¬a
1: a ^ b
0: a _ b
0: a ! b
0: a
1: a
1: a 1: b
0: a 0: b
1: a 0: b
Table 8.13 Forking decompositions 1: a _ b 1: a 1: b
0: a ^ b 0: a 0: b
1: a ! b 0: a 1: b
1: a $ b 1: a 0: a 1: b 0: b
0: a $ b 1: a 0: a 0: b 1: b
Inspecting the tables, one sees that we have two rules for decomposing each connective, one for sign 1 and the other for sign 0. Note that the rules for ¬ are definite no matter what the sign (1 or 0); those for ^, _, ! are definite or fork depending on the sign, and both of the rules for $ fork irrespective of sign. Most common student errors: (1) misremembering the rules for !, usually from not having remembered its truth-table well enough, (2) forgetting that for $ we always need to make two entries on each side of the fork. The rule for decomposing 0: a!b will play a very important role in Chap. 11 when we consider so-called ‘relevance logics’ and we already give it a special name, counter-case. Exercise 8.5 (1) (a) What would the decomposition rules for exclusive disjunction look like? Would they be definite, or fork? How many outputs? Any connection with the rules for other connectives? (b) Use the method of truth-trees to test whether the following formulae are tautologies: (i) (p ! (q ! r)) ! ((p ! q) ! (p ! r)), (ii) (p ! q) _ (q ! p), (iii) (p ! q) ! ¬(p ! ¬q), (iv) (p $ q) _ (p $ r) _ (q $ r). Solution (a) Recall the truth-table for exclusive disjunction given in Exercise 1.4.2 (3) of Chap. 1. We write it as +, using the same sign as for the corresponding operation of symmetric difference of sets (see end-of-chapter Exercise 1(1)). The decomposition rules are as follows. 1: a + b 1: a 0: b
0: a 1: b
0: a + b 1: a 1: b
0: a 0: b
284
8
Yea and Nay: Propositional Logic
Both rules fork, with two outputs on each branch. They are like those for $ but inverted: the output for 1: a + b is the same as for 0: a $ b and dually. This is because a + b ⟚ ¬(a $ b). (b) We give the verdicts only: (i), (ii), (iv) are tautologies but (iii) is not. End of solution. Clearly, truth-trees may also be used to determine whether a formula is a contradiction, whether two formulae are tautologically equivalent, one formula tautologically implies another or, more generally, whether a finite set of formulae tautologically implies a formula. • To test whether a is a contradiction, check whether its negation ¬a is a tautology. • To test whether a ⟚ b, check whether the formula a $ b is a tautology. • To test whether a ⊨ b, check whether the formula a ! b is a tautology. • To test whether fa1 ; . . .; an g b, whether ða1 ^ . . . ^ an Þ ! b is a tautology. Exercise 8.5 (2) (a) Use truth-trees to determine whether (i) (p _ q) ! r ⟚ (p ! r) ^ (q ! r), (ii) (p ^ q) ! r ⟚ (p ! r) _ (q ! r), (iii) p ^ ¬p ⟚ q $ ¬q. (b) Use truth-trees to determine whether {¬q _ p, ¬r ! ¬p, s, s ! ¬r, t ! p} ⊨ ¬t ^ ¬q. Solution outline (a) All three tautological equivalences hold; in Fig. 8.3 we give the tree for (ii). To reduce clutter, we omit the vertical links in the definite (non-forking) decomposition steps. (b) The tautological implication holds. The tree has seven branches, arising from forking nodes labelled 1: u!w, 1: u_w and 0: u^w, so manual presentation needs a full sheet of paper and small handwriting.
A word on presentation. The truth-trees in this chapter are said to be signed, since each node is labelled by a formula accompanied by the sign 1 or 0 for truth or falsehood. It is possible to do away with the signs, by making the formula u do the work of 1: u and its negation ¬u carry out the job of 0: u. To illustrate, in such a presentation of the tree in Fig. 8.2, the root node would be labelled by the formula ¬[((p ^ q) ! r) ! (p ! r)]; the three leaves, from left to right, would be labelled ¬p, ¬q, r, and so on for the intermediate nodes. The decomposition rules themselves are rewritten accordingly; for example, the rule allowing passage from 0: a ! b to 1: a and 0: b becomes one to pass from ¬
8.5 Truth-Trees
285 • 0: [(p∧q)→r]↔[(p→r)∨(q→r)] ✔ • 1: (p∧q)→r ✔
• 0: (p∧q)→r ✔
• 0: (p→r)∨(q→r) ✔
• 1: (p→r)∨(q→r) ✔
• 0: p→r ✔
• 1: p∧q ✔
• 0: q→r ✔
• 0: r
• 1: p
• 1: p
• 0: r
• 1: q
• 1: q
• 1: p→r ✔
• 0: r • 0: p∧q ✔ • 0: p dead
• 0: q dead
• 0: p dead
• 1: r dead
• 1: q→r ✔ • 0: q • 1: r dead dead
• 1: r dead
Fig. 8.3 Truth-tree for Exercise 8.5 (2)(a) (ii)
(a ! b) to a and ¬b. A crash-pair becomes a pair of nodes, on the same branch, one of which is labelled by a formula u and the other labelled by ¬u. The difference between the two displays is essentially notational: in the unsigned format the object-language connective of negation does the work that the metalinguistic attribution of falsehood does in the signed one. Textbook expositions seem to show a slight preference for signed trees.
8.6
End-of-Chapter Exercises
Exercise 8.6 (1) Truth-functional connectives (a) Construct, from the appropriate truth-table, the full disjunctive normal form for each of the two-place truth-functions f2, f11 and f15 constructed for Exercise 8.2 (2). Can any of them be expressed more simply by a less-than-full dnf? (b) Show that the connective-set {^, _, !, $} is not functionally complete. Hint: Think about the top row of the truth-table, in order to show that negation is not expressible. (c) Show that the pair {¬, $} is not functionally complete. This exercise is quite challenging; do not be disappointed if you get stuck. Hint: It will suffice to show that conjunction is not expressible. To do that, show that every formula u built from at most two letters p, q using at most the connectives ¬, $ is ‘even’, in the sense that v(u) = 1 for an even number of the four assignments v: {p,q} !{1,0}.
286
8
Yea and Nay: Propositional Logic
(d) If, when reading Chap. 4, you were not in a position to do Exercise 4.6.2 illustrating definitions and proofs by structural recursion/induction in propositional logic, you should now be in aposition to do so and check with the solution provided there. Solution (a) For f2: (a ^ b) _ (a ^ ¬b); for f11: (a ^ ¬b) _ (¬a ^ ¬b); for f15: ¬a ^ ¬b. Yes, f2 and f11 respectively have a and ¬b as less-than-full dnfs, while there is no way to simplify the above dnf for f15. By the way, the notion of simplicity is, itself, far from simple; comparison can depend on the tasks that we wish to perform with the items in question, giving rise to non-equivalent definitions. In this example, however, there can hardly be any intuitive disagreement. (b) Note that when v(a) = 1 = v(b) then v(a ^ b) = 1 = v(a _ b) = v(a ! b) = v(a $ b). Using that fact, an easy structural induction shows that when v (p) = 1 for every elementary letter p (corresponding to the top row of a truth-table) then v(u) = 1 for every formula u that is constructed using at most those connectives. But negation and, indeed, any truth-functional connective that is contrarian in the sense defined in Exercise 8.3.3 (3), gets the value false in the top row. That is, v(¬p) = 0 and, more generally v(u) = 0, for any contrarian formula u when v puts v(p) = 1 for every elementary letter p. So, neither negation nor any other contrarian connective can be expressed using only the connectives ^, _, !, $. (c) It suffices to show that there is no formula u using at most the connectives ¬, $ such that p ^ q ⟚ u. Now, we may assume wlog (see the logic box in Sect. 7.6.2 of Chap. 7) that any such u contains at most the letters p, q since we can substitute p, say, for all the letters other than those two and we still have p ^ q = r(p ^ q) ⟚ r(u). Call a formula u built from the letters p, q even iff v(u) = 1 for an even number of the four assignments v: {p, q} ! {1,0}. Clearly, p ^ q is odd, so, it will suffice to show that every formula u built from the letters p, q using at most ¬, $ is even. This we do by induction. The basis, where u is an elementary letter, is trivial. For the induction step, we need to consider each of ¬, $. The case for ¬ is also trivial: if u is even then ¬u is even since four minus an even number is even. The case for $ is the tricky part of the proof. (d) Suppose that a, b are both even; we need to show that a $ b is also even. Now a $ b ⟚ (a ^ b) _ (¬a ^ ¬b), so it will suffice to show that formula to be even. Suppose for reductio that it is odd. Since its disjuncts are mutually inconsistent, exactly one of a ^ b, ¬a ^ ¬b is odd. Consider the case that a^b is even while ¬a ^ ¬b is odd; the other case is similar. Since a ⟚ (a ^ b) _ (a ^ ¬b) and both a, a ^ b are even, we know that a ^ ¬b is even. But since ¬b ⟚ (a ^ ¬b) _ (¬a ^ ¬b) and we know that a ^ ¬b is even while ¬a ^ ¬b is odd, we may conclude that ¬b is odd, so b is also odd, contradicting the supposition that it is even.
8.6 End-of-Chapter Exercises
287
Exercise 8.6 (2) Tautologies etc. (a) In informal mathematics we often say briefly, when asserting a chain of equivalences, ‘a iff b iff c’, just as in arithmetic we say a = b = c. What does such an informal statement mean: a $ (b $ c), (a $ b) $ c, or (a $ b) (b $ c)? Are they tautologically equivalent? (b) Explain why the following two properties are equivalent: (i) a is a contradiction, (ii) a ⊨ b for every formula b. (c) Explain why the following three properties are equivalent: (i) a is a tautology, (ii) ∅ ⊨ a, (iii) b ⊨ a for every formula b. (d) Show by structural induction that every formula constructed using the zero-ary connective ⊥ and the usual ¬, ^, _ but without any elementary letters, is either a tautology or a contradiction. (e) In Exercise 1.4.3 (1) (h) of Chap. 1, we saw that A\(B\C) (A\B) [ C for arbitrary sets A, B, C. What would the counterpart of this be in propositional logic, expressed using the usual classical connectives? Solution (a) The phrase ‘a iff b iff c’ in informal mathematics is used to mean (a $ b) (b $ c). This is not tautologically equivalent to either of the other two, which are, however, tautologically equivalent to each other (associativity for $). For this reason, a little comma after the b would add clarity to the English phrase, just as commas would clarify ‘eats shoots and leaves’ when referring to a cowboy in a western saloon rather than a panda in the forest. (b) If a is a contradiction, then there is no valuation v with v(a) = 1 so, a fortiori no matter what b is chosen, there is no valuation v with both v(a) = 1 and v (b) = 0 so a ⊨ b. Conversely, if a is not a contradiction, then there is some valuation v with v(a) = 1 so, choosing b as an elementary letter p not occurring in a and putting v(p) = 1, we have both v(a) = 1 and v(b) = 0, so a ⊭ b. Alternatively, choose b to be any contradiction. (c) Outline: reason dually to the solution to (b). (d) Basis: ⊥ is a contradiction, by its truth-conditions (Sect. 8.4.3). Induction step: If a is a tautology or a contradiction then ¬a is a contradiction or a tautology. If each of a, b is a tautology or a contradiction then a ^ b is a contradiction unless both components are tautologies, in which case a ^ b is a tautology; dually for _. (e) a ^ ¬(b ^ ¬c) ⊨ (a ^ ¬b) _ c. Exercise 8.6 (3) Normal forms (a) Find a dnf for the formula r ! ¬(q _ p) using (i) the semantic method and (ii) the method of successive syntactic transformations. (b) Use your work in (a) to find a cnf for the same formula by the same two methods.
288
8
Yea and Nay: Propositional Logic
(c) For each of the following sets of formulae, find a least letter-set version: A = {p $ q, q $ r, r $ ¬p}, B = {(p ^ q ^ r) _ (s ^ r}, C = {(p ^ q ^ r) _ (s ^ q), ¬p}. (d) Find most modular versions of your answers to (c). (e) True or false? For each, give a proof or counter-example. (i) The least letter-set of a formula is empty iff the formula is either a tautology or a contradiction. (ii) If the same letter is eliminable from each of a, b then it is eliminable from a ^ b. (iii) The least letter-set of a disjunction is the union of the least letter-sets of its disjuncts. Solution (a) (i) Make an eight-row truth-table for r ! ¬(q _ p). It comes out true in five rows; write down the disjunction of the five basic conjunctions that correspond to those rows, giving (p ^ q ^ ¬r) _ (p ^ ¬q ^ ¬r) _ (¬p ^ q ^ ¬r) _ (p ^ ¬q ^ r) _ (¬p ^ ¬q ^ ¬r). Remark: The more rows (i.e. valuations on the letters) make the formula true, the more basic conjunctions there are to disjoin, so the more tedious this method becomes when done manually. (ii) r ! ¬(q_p) ⟚ ¬r _ ¬(q _ p) ⟚ ¬r _ (¬q ^ ¬p), which is in (non-full) dnf. (b) (i) There are just three rows that make r ! ¬(q _ p) false, so we form the corresponding three basic disjunctions and conjoin them, giving (¬p _ ¬q _ ¬r) ^ (¬p _ q _ ¬r) ^ (p _ ¬q _ ¬r) in full cnf. (ii) Distribute the last formula in the chain of equivalences of (a) (ii) to get ¬r _ (¬q ^ ¬ p) ⟚ (¬r _ ¬q) ^ (¬r _ ¬p) whose RHS is in cnf. (c) A ⟚ {⊥} with least letter-set ∅ and all three letters eliminable; B is already in least letter-set form since none of its letters are eliminable; C ⟚ {s ^ q, ¬p} with least letter-set {p, q, s} and r eliminable. (d) Put A0 ¼ f?g with splitting {∅} of the empty letter-set; B0 ¼ fr; ðp ^ qÞ _ sg with partition ffrg; fp; q; sgg; C 0 ¼ f:p; q; sg with partition {{p}, {q}, {s}}. (e) (i) Yes; immediate from the definitions. (ii) Yes; if a ⟚ a′ and b ⟚ b′ where p occurs in neither of a′, b′, then a ^ b ⟚ a′ ^ b′ and p does not occur in the RHS. (iii) No; taking an elementary letter p, the least letter-set of each of p, ¬p is {p} but the least letter-set of p _ ¬p is ∅. Exercise 8.6 (4) Truth-trees Use truth-trees to determine whether each the following hold: (i) p ! (q ^ r) ⟚ (p ! q) ^ (p ! r), (ii) p ! (q _ r) ⟚ (p ! q) _ (p ! r), (iii) p ! (q ! r) ⊨ (p ! q) ! r. Solution outline Implications (i), (ii) both hold, but (iii) does not. Figure 8.4 gives a truth-tree for (v) with three live branches on the left. If one has the flair or good luck to construct, say, the leftmost branch first, one can save work by omitting all nodes to the right below the one labelled 1: q ! r.
8.7 Selected Reading
289
• 0: [p→(q→r)]→[(p→q)→r] ✔ • 1: p→(q→r) ✔ • 0: (p→q)→r ✔ • 1: p→q ✔ • 0: r • 0: p • 0: p live
• 1: q live
• 1: q→r ✔ • 0: p • 0: q live
• 1: r dead
• 1: q • 0: q dead
• 1: r dead
Fig. 8.4 Truth-tree for end-of-chapter Exercise 8.4 (iii)
8.7
Selected Reading
Introductions to discrete mathematics tend to put their chapters on logic right at the beginning. In the order of nature, this makes good sense but, as explained in the preface, it has some serious disadvantages so we have reversed the order. One of the few texts written for computer science students that also does that is James Hein Discrete Structures, Logic and Computability. Jones and Bartlett 2002 (second edition), chapter 6. Computer science students may like to look at chapter 1 of Michael Huth & Mark Ryan Logic in Computer Science, Cambridge University Press 2000, and the rather more mathematical chapters 1–4 of Mordechai Ben-Ari Mathematical Logic for Computer Science, Springer 2012 (third edition). Philosophy students may prefer L.T.F. Gamut Logic, Language, and Meaning. Volume I: Introduction to Logic. University of Chicago Press 1991, chapters 1–2, while general readers can derive profit from Wilfrid Hodges Logic, Penguin 1977, sections 1–25. For semantic decomposition trees, there is a gentle introduction in Colin Howson Logic with Trees, Routledge 1997, chapters 1–4 as well as a solid on-line resource written by Peter Smith at https://www.logicmatters.net/wp-content/uploads/2019/ 10/TruthTreesPL1.pdf.
9
Something About Everything: Quantificational Logic
Chapter Outline Although fundamental to logic, truth-functional connectives have very limited expressive power. In this chapter we go further, explaining the basic ideas of quantificational logic (also known as first-order or predicate logic), which is sufficiently expressive to cover most of the deductive reasoning that is carried out in standard mathematics and computer science. We begin by presenting its language, built around the universal and existential quantifiers, showing how they can be used to express complex relationships. With no more than an intuitive understanding of them, some of the basic logical equivalences involving quantifiers can already be appreciated. For a deeper understanding, we then present the semantics of the language, which is still bivalent, yet goes beyond truth-tables. This semantics may be given in two versions, substitutional and x-variant, which however are equivalent under a suitable condition. After explaining the distinction between free and bound occurrences of variables, and the notion of a clean substitution, the chapter ends with a review of some of the most important logical implications turning on the quantifiers, some with the identity relation.
9.1
The Language of Quantifiers
We have been using quantifiers informally throughout the book, and made a few remarks on them in a logic box of Chap. 2. Recall that there are two quantifiers 8 and 9, meaning ‘for all’ and ‘for some’. They are always used with an attached variable.
© Springer Nature Switzerland AG 2020 D. Makinson, Sets, Logic and Maths for Computing, Undergraduate Topics in Computer Science, https://doi.org/10.1007/978-3-030-42218-9_9
291
292
9 Something About Everything: Quantificational Logic
9.1.1 Some Examples Before getting systematic, we give some examples of statements in ordinary English and their representation using quantifiers, commenting on their salient features. Each of these examples raises a host of questions, whose answers will emerge as we continue through the chapter. The numbers below correspond to the rows in the Table 9.1. 1. This symbolization uses the universal quantifier 8, the variable x, two predicate letters, the truth-functional connective !. Could we use a different variable, say y? Why are we using ! here instead of ^? Can we express this using 9 instead of 8? What is its relation to 8x(Px ! Cx)? 2. Why are we using ^ here instead of ! as we did in the first statement? Can we express it with 8 instead of 9? Is it logically implied by the first statement? What is its relation to 9x(Cx^¬Px)? 3. Can we express this using 9, ^, ¬? What is its relation to 8x(Cx!¬Px)? 4. Why haven’t we used a predicate P for ‘is a person’? Does the meaning change if we write 8x9y(Lyx)? 5. Is this logically equivalent to 4? Does either logically imply the other? 6. Could we somehow replace the individual constant by a predicate? 7. Can we express this equivalently with both quantifiers ‘up the front’? 8. Is it possible to express the statement more ‘positively’? Could we express it with a relation symbol F and two variables? 9. Can we simplify this by getting rid of some negations? Does the meaning change if we reverse the initial quantifiers? 10. Shouldn’t the second universal quantifier take a different variable? Can we move the second quantifier ‘out to the front’? What about the first quantifier? Table 9.1 Examples of quantified statements 1 2 3 4 5 6 7 8 9 10
English
Symbols
All composer are poets Some composers are poets No poets are composers Everybody loves someone There is someone who is loved by everyone There is a prime number less than 5 Behind every successful man stands an ambitious woman No man is older than his father The successors of distinct integers are distinct The English for this should be familiar from Chap. 4!
8x(Cx ! Px) 9x(Cx ^ Px) 8x(Px ! ¬Cx) 8x9y(Lxy) 9y8x(Lxy) 9x(Px ^ (x < 5)) 8x½ðMx ^ SxÞ ! 9yðWy ^ Ay ^ ByxÞ ¬9x(Oxf(x)) 8x8y½:ðx ¼ yÞ ! :ðsðxÞ ¼ sðyÞ fP0 ^ 8xðPx ! PsðxÞÞg ! 8xðPxÞ
9.1 The Language of Quantifiers
293
Exercise 9.1.1 On the basis of your informal experience with quantifiers, have a go at answering the bulleted questions. Solution promise If you feel confident about most of your answers, congratulations—you seem to have a head start! But keep a record of them to check later! If some of questions leave you puzzled or uncertain, don’t worry; answers will become apparent as we go through the chapter and we will state them explicitly at the end.
9.1.2 Systematic Presentation of the Language The basic components of the language of quantificational logic are set out in Table 9.2. The familiar truth-functional connectives are there, along with the quantifiers. But to allow the latter to do their work, we also need some further ingredients: individual constants, variables, predicate letters, the identity relation sign and (optionally) function letters. In each of the categories of basic terms, function letters and predicates, we assume that we have an infinite supply of signs. These can be referred to by using numerical subscripts e.g. f1 ; f2 ; . . . for the function letters. We could also have numerical superscripts to indicate the arity of the function and predicate letters, so that the two-place predicate letters, say, are listed as R21 ; R22 ; . . .. But, as this is rather cumbersome, we ordinarily use a few chosen letters as indicated in the table, with context or comment indicating the arity. How are these ingredients put together to build formulae? Recursively, as you would expect, but in two stages. First we define recursively the notion of a term, and then afterwards we use that to define, again recursively, the set of (well-formed) formulae. We begin with terms. Basis: Constants and variables are terms (we call them basic terms, in some texts ‘atomic terms’). Recursion step: If f is an n-place function symbol and t1 ; . . .; tn are terms, then f ðt1 ; . . .; tn Þ is a term. Exercise 9.1.2 (1) Which of the following are terms, where f is 2-place and g is 1-place? In the negative cases, give a brief reason. (i) a, (ii) ax, (iii) f(x,b), (iv) f(c,g(y)), (v) g(g(x,y)), (vi) f(f(b,b), f (a,y)), (vii) g(g(a)), (viii) g(g(a)), (ix) gg(a). Solution (i) Yes, it is a basic term. (ii) No: it juxtaposes two basic terms but is not itself basic, nor is it formed using a function symbol. (iii), (iv) Yes. (v) No: g is 1-place. (vi) Yes. (vii) Yes, (viii) Not quite: a right-hand parenthesis forgotten. (ix) Strictly
294
9 Something About Everything: Quantificational Logic
speaking no, but this often used to abbreviate g(g(a)), and we will sometimes do the same in what follows. End of solution. Given the terms, we can now define formulae recursively. Basis: If R is an n-place predicate and t1 ; . . .; tn are terms, then R(t1, …, tn) is a formula (sometimes called an atomic formula), and so is (t1 = t2) where = is the symbol for the identity relation. Recursion step: If a,b are formulae and x is a variable, then the following are formulae: ð:aÞ; ða ^ bÞ; ða _ bÞ; ða ! bÞ; 8xðaÞ; 9xðaÞ. As in propositional logic we drop parentheses whenever context or convention suffices to ensure unique decomposition. For ease of reading, when there are multiple parentheses we use different styles of bracketing, e.g. square and curly. The special relation sign = for identity is customarily infixed, whereas all other predicates and function symbols are prefixed. For this reason, the parentheses and commas in terms and atomic formulae without the identity sign can in principle be omitted without ambiguity, which we will sometimes do to improve readability.
Alice Box: Use and mention
Alice
Hatter
Alice Hatter
I notice that when you talk about a specific sign, say the conjunction sign or the universal quantifier, you do not put it in inverted commas. For example, you say ‘The symbol 8 is the universal quantifier’, rather than ‘The symbol ‘8’ is the universal quantifier’. Is this legitimate? Isn’t it like saying ‘The word London has six letters’ when you should be saying ‘The word ‘London’ has six letters’? Yes and no. Strictly speaking one should distinguish between use and mention, in this context between the use of a symbol like the quantifier in the object language and its mention when talking about it in our metalanguage. That can be done by various typographical devices such as quotation marks, italics, underlining or font change. But when carried out systematically it is very tiresome. As is customary in computer science and mathematics writing, we omit them except when really needed to avoid confusion; in most cases it is perfectly clear what is meant. What about the identity sign? Is that part of the object language or the metalanguage? Well, both: the author is abusing notation by allowing the same sign, namely = , to play both roles. It serves as a component of formulae in the object language and as a sign in our metalanguage to represent the identity of two items of the object language. Purists may not be happy about this and, indeed, in earlier editions of this book the author took pains to distinguish the two signs. But classroom experience has convinced him that this was quite pedantic; students worked without confusion with the standard sign for identity in both contexts.
9.1 The Language of Quantifiers
295
Another example of deliberate abuse of notation can be seen in our definition of the set of formulae. In the recursion step we used one particular variable, namely x. But what we really meant was that we can use any of the variables x; y; z; . . . in the way described, so that 8yðaÞ; 8zðaÞ; . . . are formulae whenever a is a formula. The reason for articulating with a sample variable is that it keeps the notation down. In our metalanguage, we already have meta-variables a; b; . . . ranging over formulae; we don’t want to add special signs (say Gothic letters) to serve as meta-variables ranging over the set of variables of the object language, and yet others to range over the set of constants etc., unless we really have to. Exercise 9.1.2 (2) Which of the following are formulae, where R is a 2-place predicate and P is a 1-place predicate, and f, g are as in the previous exercise? In the negative cases, give a brief reason. (a) R(a,a), (b) R(x,b) ^ ¬P(g(y)), (c) R(x,P(b)), (d) P(P(x)), (e) 9P(Px), (f) 8x(Px ! Rxy), (g) 8x9y(Rxy), (h) 8x8x(Px). Solution (a) (b) Yes. (c) (d) No, because P(b), P(x) are formulae, not terms, and we need a term in this position if the whole expression is to be a formula. Note this carefully, as it is a common student error. (e) No: the quantifier has a predicate attached to it, rather than a variable. Such expressions are not formulae of first-order logic. They are admitted in what is called second-order logic which, however, goes beyond our remit. (f) (g) Yes, provided we understand them as having some commas and/or brackets omitted without ambiguity. (h) Yes, despite the fact that both quantifiers have the same variable attached to them. To be sure, such formulae are rather pathological, as we will see later, and some presentations do exclude them. But the standard presentations find it convenient to allow them in. Exercise 9.1.2 (3) Express the following statements in the language of quantificational logic, using naturally suggestive letters for the predicates. For example, in (a) use L for the predicate ‘is a lion’, T for ‘is a tiger’, D for ‘is dangerous’. (a) Lions and tigers are dangerous, (b) If a triangle is right-angled then it is not equilateral, (c) Anyone who likes Albert likes Betty, (d) Albert doesn’t like everybody Betty likes, (e) Albert doesn’t like anybody Betty likes, (f) Everyone who loves someone is loved by someone, (g) Everyone who loves someone is loved
296
9 Something About Everything: Quantificational Logic
by that person, (h) There are exactly two prime numbers less than 5, (i) My mother’s father is older than my father’s mother. Solutions (a) It can be 8xðLx ! DxÞ ^ 8xðTx ! DxÞ or 8xððLx _ TxÞ ! DxÞ. It cannot be expressed as 8xððLx ^ TxÞ ! DxÞ—try to understand why! Notice that the universal quantifier is not explicit in the English, but it evidently part of the meaning. Well, to be honest, in everyday street English, the statement would usually mean something less radical, along the lines of ‘lions and tigers are almost always dangerous’ but, in our treatment of first-order logic, we will be understanding the universal quantifier literally: ‘all’ means ‘all’, no exceptions. (b) 8xððTx ^ RxÞ ! :ExÞ. Here we are using T for ‘is a triangle’. You can also simplify life by declaring the set of all triangles as your domain (also called universe) of discourse, writing simply 8xðRx ! :ExÞ. Declaring a domain of discourse is often useful when symbolizing; but it is legitimate only when the statement says nothing about anything outside the domain. (c) 8xðLxa ! LxbÞ. Here, we declare our domain of discourse to be the set of all people, write Lxy stands for ‘x likes y’ and use individual constants for Albert and Betty. To reduce clutter, we have omitted commas between the terms of a relational expression when they are simply variables or constants. (d) (e) In many contexts, the English words ‘every’ and ‘any’ tend do much the same work but in others, for example negative ones, they can be used to say markedly different things. Taking the domain of discourse to be people (or some appropriate set of people that contains both Albert and Betty) we can write (d) as :½8xðLbx ! LaxÞ while (e) is ½8xðLbx ! :LaxÞ. The difference between them is manifested in the different scopes of the negation operator. These sentences can also be written using the existential quantifier, but we will come to that a little later. (f) (g) In examples like these, you should first try to understand intuitively the difference of meaning. For (f), you need three quantifiers over the domain of people: 8x½9yðLxyÞ ! 9zðLzxÞ with bracketing as indicated. We can, however, make use of only two variables, writing 8x½9yðLxyÞ ! 9yðLyxÞ—the reason for this will become clear as we proceed. For (g), on the other hand, two quantifiers suffice and, despite the idiomatic English, both are universal: 8x8y½Lxy ! Lyx. (h) The problem here is how to say, with the limited means available, that there are exactly two items with a certain property. Try paraphrasing it as: There is an x and there is a y such that (1) they both have that property and (2) everything with that property is identical to at least one of them. This goes into the language of first-order logic as 9x9y[Px ^ Py ^ (x < 5) ^ (y < 5) ^ 8z{(Pz ^ (z < 5)) ! ((z = x) _ (z = y))}], where we take the set of positive integers as our domain of discourse and Px means that x is prime. (i) The easiest way is with function letters f(x), m(x) for the father, mother of x, O(x,y) for x is older than y, and a constant a for myself: O(f(m(a),m(f(a)).
9.1 The Language of Quantifiers
297
No quantifiers or truth-functional connectives needed. It can be done with relations in place of the functions, but in a more complex way saying, in effect, that I have exactly one mother, who has exactly one father, and I have exactly one father, who has exactly one mother, and all of the fathers of my mothers are older than any of the mothers of my fathers. Quite long in words, and just as long when put in symbols.
9.1.3 Freedom and Bondage To understand the internal structure of a formula of quantificational logic, three notions are essential—the scope of a quantifier, and free versus bound occurrences of a variable. We explain them through some examples. Consider the formula 8z½Rxz ! 9yðRzyÞ. It has two quantifiers. The scope of each quantifier is the material in the parentheses immediately following it. Thus the scope of the first quantifier is the material between the square brackets, and the scope of the second one is given by the round brackets. Note how the scope of one quantifier may lie inside the scope of another, as in this example, or be entirely separate from it; but they never overlap. In a quantified formula 8xðaÞ or 9xðaÞ the quantifier is said to bind all occurrences of the same variable x occurring in a, unless some other quantifier occurring inside a already binds them; it is convenient to say that it also binds the occurrence of the variable x that is attached to it. An occurrence of a variable x in a formula a is said to be bound in a iff there is some quantifier in a that binds it. Occurrences of a variable that are not bound in a formula are called free in the formula. Finally, a formula with no free occurrences of any variables is said to be closed, otherwise open. Closed formulae are also called sentences. A full translation into symbols of any complete sentence of English should have all its variables bound, i.e. it should be closed, since a free variable is not specifying anything in particular, nor yet expressing a universal or existential quantification. Go back to Table 9.1 to check that all symbolic representations there are closed formulae. Exercise 9.1.3 (a) Identify the free and bound occurrences of variables in the formula 8z½Rxz ! 9yðRzyÞ. (b) Identify the free and bound occurrences of variables in the formula 8x9yðRxyÞ _ 8zðPy ! 8xðRzx ^ RyxÞÞ. (c) Consider the formula 8x9y8x9yðRxyÞ. Which occurrences of y do the two existential quantifiers bind? (d) Which of the formulae mentioned in this exercise are closed? Solution (a) In 8z½Rxz ! 9yðRzyÞ, all occurrences of z and of y are bound, while the unique occurrence of x is free. (b) In 8x9yðRxyÞ _ 8zðPy ! 8xðRzx ^ RyxÞÞ, all occurrences of x, z are bound while, for y, the occurrences to the left of _ are bound and those on the right are free. This example illustrates the fact that a single variable can have some
298
9 Something About Everything: Quantificational Logic
Table 9.2 Ingredients of the language of quantificational logic Broad category
Specific items
Signs used
Purpose
Basic terms
Constants
a; b; c; . . .
Variables
x; y; z; . . .
1-Pace n-Place 1-Place 2-Place n-Place Special relation sign Universal Existential ‘Not’ etc. Parentheses and commas
f ; g; h; . . .
Name specific objects: e.g. 5, Charlie Chaplin, London Range over specific objects, combine with quantifiers to express generality Form compound terms out of simpler terms, starting from the basic ones
Function letters Predicates
Quantifiers Connectives Auxiliary
P; Q; R; . . .
¼ 8 9 ¬, ^, _, !
E.g. is prime, is funny, is polluted E.g. is smaller than, resembles E.g. lies between (3-place) Identity For all There is Usual truth-tables To ensure unique decomposition and make formulae easier to read
occurrences bound, others free, in the same formula. It also illustrates how a variable can be bound in a formula while free in one of its sub-formulae; for example, x is bound in 8x9yðRxyÞ, but is free in its sub-formula 9yðRxyÞ. (c) In the formula 8x9y8x9yðRxyÞ, the innermost 9 binds both the occurrence of y attached to it and the y in Rxy. The outer 9 binds only its attached occurrence of y. (d) Only 8x9y8x9yðRxyÞ is closed; the others are open.
9.2
Some Basic Logical Equivalences
At this point we could set out the semantics for quantificational formulae, with rigorous definitions of logical relationships such as consequence and equivalence. But we will postpone that a little and continue to cultivate intuitions; with good intuitions, the formal definitions are easier to assimilate.
9.2.1 Quantifier Interchange There are a number of basic logical equivalences that can already be appreciated when you read 8xðaÞ and 9xðaÞ intuitively as saying respectively ‘a holds for every x in our domain of discourse’ and ‘a holds for at least one x in our domain of discourse’.
9.2 Some Basic Logical Equivalences
299
First among these equivalences are the quantifier interchange principles, which show that anything expressed by one of our two quantifiers may equivalently be expressed by the other, with the judicious help of negation. In the following table, the formulae on the left are logically equivalent to those on the right. Here a stands for any formula of quantificational logic. We will re-use the sign ⟚, familiar from propositional logic, for the intuitively understood but not yet formally defined concept of logical equivalence for quantificational formulae. Alice Box: 9x(¬a) or 9x¬(a)?
Alice Hatter
A question about the right column in the table. Should we write 9x (¬a), 8x(¬a) or perhaps 9x¬(a),8x¬(a)? It doesn’t matter. With all brackets present we would have 9xð:ðaÞÞ; 8xð:ðaÞÞ and we can leave off one of the two pairs without ambiguity.
Actually, any one of the four equivalences in Table 9.3 can be obtained from any other by means of double negation and the principle of replacement of logically equivalent formulae. For example, suppose we have the first one, and want to get the last one. Since a ⟚ ¬¬a, we have 9x(a) ⟚ 9x(¬¬a) ⟚ ¬8x(¬a) by replacement and then the first equivalence, and we are done. Exercise 9.2.1 (1) (a) Obtain the second and third quantifier interchange principles from the first one by a similar procedure. (b) Use quantifier interchange and suitable truth-functional equivalences to show that (i) ¬8x(a ! b) ⟚ 9x(a ^ ¬b), (ii) ¬9x(a ^ b) ⟚ 8x(a ! ¬b), (iii) 8x(a ! b) ⟚ ¬9x(a ^ ¬b), (iv) 9x(a ^ b) ⟚ ¬8x(a ! ¬b). Make free use of the principle of replacement in your work. Solution (a) To show ¬9x(a) ⟚ 8x(¬a): LHS ⟚ ¬9x(¬¬a) ⟚ ¬¬8x(¬a) ⟚ RHS by replacement using the first equivalence in the table, double negation. To show that 8x(a) ⟚ ¬9x(¬a): LHS ⟚ ¬¬8x(a) ⟚ RHS by double negation then replacement using the first equivalence table. (b) (i) ¬8x(a ! b) ⟚ 9x¬(a ! b) ⟚ 9x(a ^ ¬b). (ii) ¬9x(a ^ b) ⟚ 8x¬(a ^ b) ⟚ 8x(a ! ¬b). (iii) 8x(a ! b) ⟚ ¬9x¬(a ! b) ⟚ ¬9x(a ^ ¬b). (iv) 9x(a ^ b) ⟚ ¬8x¬(a ^ b) ⟚ ¬8x(a ! ¬b). End of solution. Table 9.3 Quantifier interchange equivalences ¬8x(a) ¬9x(a) 8x(a) 9x(a)
9x(¬a) 8x(¬a) ¬9x(¬a) ¬8x(¬a)
300
9 Something About Everything: Quantificational Logic
Table 9.4 Distribution equivalences 8x(a ^ b) 9x(a _ b)
8x(a) ^ 8x(b) 9x(a) _ 9x(b)
The equivalences in the exercise are important, because the formulae correspond to familiar kinds of statement in English. For example, in (b)(i), the left side says ‘not all as are bs’, while the right one says ‘at least one a is not a b’ or, more idiomatically though rather more loosely, ‘some as are not bs’. Exercise 9.2.1 (2) To what English statement-forms do the equivalences in Exercise 9.2.1 (1) (b) correspond? Solution (b)(ii) LHS: It is not the case that at least one a is a b. Using ‘some’: It is not the case that some as are bs. RHS: No as are bs. (b)(iii) LHS: All as are bs’. RHS: It is not the case that at least one a is not a b. Using ‘some’: It is not the case that some as are not bs. (b)(iv) LHS: At least one a is a b. Using ‘some’: Some as are bs. RHS: It is not the case that no as are bs’.
English has many other idioms for expressing these basic relationships, as do all other natural languages. They can also be expressed in the language of elementary set theory using the notations of Chap. 1. They were first subjected to systematic study by Aristotle but without the notion of a variable, nor that of a truth-functional connective, whose roles became clear only in the late nineteenth century.
9.2.2 Distribution The next group of equivalences may be described as distribution principles. They show the way in which universal quantification distributes over conjunction while existential quantification distributes over disjunction. Why does the universal quantifier get on so well with conjunction? Essentially, because it is, itself, like a long conjunction. Suppose we specify a finite domain of discourse with just n elements, naming all of them by n individual constants a1 ; . . .; an . Then saying that every element of the domain has the property P amounts to saying, of each element in the domain, that it has that property, in other words, given the choice of domain and the names for all its elements, 8x(Px) says the same as Pa1 ^ . . . ^ Pan . The latter is called a finite transform of the former and we write 8xðPxÞ n Pa1 ^ . . . ^ Pan . Of course, if we change the size of the domain, then we change the length of the conjunction. To make the transform work we must have enough constants to name
9.2 Some Basic Logical Equivalences
301
all the elements of the domain (it doesn’t matter, however, if some of them are named more than once). But, even with these provisos, the principles for 8 reflect those for ^, while those for 9 resemble familiar ones for _. Exercise 9.2.2 (a) Write out 8xðPx ^ QxÞ as a conjunction in a domain of three elements named a, b, c. Then write out 8xðPxÞ ^ 8xðQxÞ in the same way and explain in terms of familiar tautological equivalences why they are equivalent. (b) What does 9x(Px) amount to in a domain of n elements? (c) If we think of the universal and existential quantifier as expressing generalized conjunctions and disjunctions respectively, to what familiar truth-functional equivalences do the entries in Table 9.3 correspond? Solution (a) 8xðPx ^ QxÞ 3 ðPa ^ QaÞ ^ ðPb ^ QbÞ ^ ðPc ^ QcÞ while 8xðPxÞ ^ 8xðQxÞ 3 ðPa ^ Pb ^ PcÞ ^ ðQa ^ Qb ^ QcÞ. They are equivalent by several applications of association and commutation for conjunction. (b) Call the domain elements a1 ; . . .; an . Then 9xðPxÞ 3 Pa1 _ . . . _ Pan . (c) They correspond to four forms of de Morgan.
9.2.3 Vacuity and Re-lettering The last intuitive equivalences that we mention are the vacuity and re-lettering principles. Two vacuity equivalences are expressed in Table 9.5, where all formulae in a given row are equivalent. In other words, to quantify twice in a row on the same variable does no more than quantifying on it once. To say, ‘there is an x such for every x we have Px’, as in the top row right column, is just a redundant way of saying ‘Px for every x’. Note that in these vacuity equivalences it is the ‘inner’ quantifier that ‘takes precedence’ and that the variables must be the same: 8x(Rxy) is not logically equivalent to 8y8x (Rxy), nor to 9y8x(Rxy). The equivalences of Table 9.5 are special cases of a general principle of vacuous quantification: When there are no free occurrences of x in u, then each of 8x(u) and 9x(u) is logically equivalent to u. To see how the table accords with this principle, take u to be 8x(a) in the top row, while in the bottom row put u to be 9x(a). Table 9.5 Two vacuity equivalences 8x(a) 9x(a)
8x8x(a) 9x9x(a)
9x8x(a) 8x9x(a)
302
9 Something About Everything: Quantificational Logic
Table 9.6 Two more vacuity equivalences Proviso: when there are no free occurrences of x in a 8x(a _ b) a _ 8x(b) 9x(a ^ b) a ^ 9x(b)
Another two vacuity principles are given in Table 9.6 where, again, all formulae in a given row are equivalent. Note that, this time, the equivalences are asserted only in the circumstance that no occurrences of the variable x occur free in a. Exercise 9.2.3 (1) (a) Use vacuity and distribution equivalences as well as suitable tautological equivalences to show that (i) 9x(Px _ 9y8y(Qy)) ⟚ 9x8y(¬Px ! Qy) and (ii) 8x(Px ! 9y(Qy)) ⟚ 8x9y(Px ! Qy). (b) In each of the above, the RHS has a special form. Can you guess what it is? Solution (a)(i) 9x(Px _ 9y8y(Qy)) ⟚ 9x(Px _ 8y(Qy)) ⟚ 9x8y(Px _ Qy) ⟚ 9x8y(¬Px ! Qy). The three equivalences are justified respectively by Tables 9.5 and 9.6 (noting that y does not occur free in Px), and a tautological equivalence. (a)(ii) 8x(Px ! 9y(Qy)) ⟚ 8x(¬Px _ 9y(Qy)) ⟚8x(9y(¬Px) _ 9y(Qy)) ⟚ 8x9y (¬Px _ Qy) ⟚ 8x9y(Px ! Qy). The four equivalences are justified respectively by: a tautological equivalence, the general vacuity principle enunciated after Table 9.5, a distribution principle from Table 9.4, another tautological equivalence. (b) In each of the two equivalences, the RHS is a formula with all its quantifiers ‘up the front’, that is, it is of the form Q1x1, …, Qnxn(a) where each Qi is a universal or existential quantifier and a is a formula with no quantifiers in it. End of solution. Formulae with all quantifiers ‘up the front’, in the sense defined in the solution to Exercise 9.2.3 (1) (b), are said to be in prenex (or maxiscope) normal form. It can be shown that every formula of quantificational logic is logically equivalent to (at least) one of that kind, which can be found algorithmically by successive transformations using principles such as distribution, vacuous quantification (already described) and re-lettering, which we shall explain in a moment. Prenex normal forms can be very useful for the mathematical analysis of theories expressed in the language of first-order logic, as well as for programming purposes; but they are not always easy to process in the head, without pencil and paper. Humans are better at handling formulae in miniscope form, that is, where each quantifier has the smallest possible scope, and this fact is reflected by the frequency with which ordinary speech tends to correspond to the latter rather than the former. There is a striking example of this in the first end-of-chapter exercise.
9.2 Some Basic Logical Equivalences
303
We will not be considering either of these kinds of normal form in this book, but readers wishing to look into prenex normal forms can easily find material in the references at the end of this chapter. Unfortunately, there has been little formal study of miniscope forms, as they are of more interest to cognitive scientists and linguists than to the mathematicians and computer scientists who have carried out most of the research in mathematical logic over the last century. To explain re-lettering, we begin with some examples. Intuitively, it is clear that 8x(Px) ⟚ 8y(Py) and 8x(Px ^ Qy) ⟚ 8z(Pz ^ Qy)—although 8x(Px ^ Qy) is not equivalent to 8y(Py ^ Qy) where the free occurrence of x in in the former has become a bound occurrence of y in the latter. Again, 8x9y(Rxy) ⟚ 8x9z(Rxz) ⟚ 8y9z(Ryz) ⟚ 8y9x(Ryx)—although 8x9y(Rxy) is certainly not equivalent to 8x9y (Ryx) where the variables attached to the quantifies have been left unchanged but those on the body Rxy are reversed to Ryx; nor is 8x9y(Rxy) equivalent to 8x9x (Rxx), where two distinct variables, bound by different quantifiers, become a single variable bound by just the inner quantifier. The general principle of re-lettering of bound variables lying behind the equivalences thus needs careful enunciation. Let u be a formula and x any variable. Let y be a fresh variable, in the sense that it does not occur at all (whether free or bound) in u. Then u ⟚ u′, where u′ is obtained by replacing all bound occurrences of x in u by y. The proviso that y is fresh for u is essential; so too is the restriction to replacing only bound occurrences of x in u. Exercise 9.2.3 (2) (a) Use re-lettering to show in several steps that 9x8y(Rxy) ⟚ 9y8x(Ryx). (b) Can re-lettering be used to show that 9x8y(Rxy) ⟚ 9y8x(Rxy)? (c) Is there an analogous principle of re-lettering of free variables? Solution (a) You need to bring in and then eliminate a fresh variable z. In detail, 9x8y(Rxy) ⟚ 9z8y(Rzy) ⟚ 9z8x(Rzx) ⟚ 9y8x(Ryx). The second equivalence is legitimate because the variable x that it puts in place of y is fresh to the outcome of the first equivalence; similarly, the variable y that the third equivalence puts in place of z is fresh to the outcome of the second equivalence. (b) No. Syntactically, the reason is that no matter how many replacements you make, the variable attached to a quantifier will continue to occupy the same place in the body of the formula, that is, the part between parentheses. Intuitively, if one thinks of meanings, the two sentences say different things. We will soon be able to make this more precise using a semantics for first-order logic. (c) No. For example, Px is not logically equivalent to Py. However, there is a weaker principle for free variables. Let u be any formula and x any variable. Let y be a variable fresh to u, and form u′ by replacing all free occurrences of x in u by y. Then u is logically true iff u′ is logically true. If the subtle difference between this weaker but valid principle and the stronger but incorrect one is not intuitively clear to you, return to it after completing the chapter.
304
9.3
9 Something About Everything: Quantificational Logic
Two Semantics for Quantificational Logic
It is time to get rigorous. In this section we present the semantics for quantificational logic. To keep a sense of direction, remember that we are working towards analogues, for our enriched language, of concepts already familiar from propositional logic: assignments, valuations, tautological implication and so on. It turns out that there are two ways of doing this; we begin by explaining the common ingredients.
9.3.1 The Shared Part of the Two Semantics Just as in propositional logic, valuations are certain functions on the set of formulae into the set {0,1}, and they are defined recursively from assignments. Both notions are considerably more complex than their propositional counterparts, to cope with the more complex language. Our terminology and notation will follow as closely as possible the propositional case, to highlight the parallels and locate the substantive differences. A domain (aka universe) of discourse is any non-empty set, in this context written D. An assignment wrt domain D is any function v that assigns a value to each constant sign, variable, function letter and predicate letter of the language in the following manner. • For each constant sign a, v(a) is an element of the domain, i.e. v(a) 2 D, • Likewise, for each variable x, v(x) is an element of the domain, i.e. v(x) 2 D, • For each n-place function letter f, v(f) is an n-argument function over the domain, i.e. v(f): Dn ! D, • For each n-place predicate P other than the identity symbol, v(P) is an n-place relation over the domain, i.e. v(P) Dn. • For the identity symbol, we put v(=) to be the identity relation over the domain. The last clause of this definition means that we are giving the identity symbol special treatment. Whereas other predicate symbols of the language may be interpreted as any relations of the right arity (i.e. number of places) over the domain, the identity symbol is always read as the relation of identity over the domain. Such a semantics is often said to be standard with respect to identity. It is also possible to give a non-standard treatment, in which the identity sign is interpreted as any equivalence relation over the domain that is also well-behaved in a certain respect (sometimes known as congruence) in its interaction with all function letters and predicates. However, in this chapter we will confine ourselves, as is customary, to standard assignments. Given an assignment wrt domain D, we define valuations v+ recursively, in two stages. The first stage defines recursively v+(t) for any term t of the language, following the definition of the terms themselves. Recall from Sect. 9.1.2 that terms
9.3 Two Semantics for Quantificational Logic
305
are built from constants and variables by applying function letters. The recursive definition of v+ follows suit, with two base clauses and a recursion step. v+(a) = v(a) for every constant a of the language v+(x) = v(x) for every variable x of the language v þðf ðt1 ; . . .; tn ÞÞ = ðvðf ÞÞðv þðt1 Þ; . . .; v þðtn ÞÞ. The recursion step needs some commentary. We are in effect defining v þ ðf ðt1 ; . . .; tn ÞÞ homomorphically. The value of a term f ðt1 ; . . .; tn Þ is defined by taking the value assigned to the function letter f, which will be a function on Dn into D, and applying that function to the values, assigned or already defined, of the terms t1 ; . . .; tn . The values of those terms are all elements of D, and so the value of the compound term f ðt1 ; . . .; tn Þ is also an element of D. The notation may at first make the definition look complicated, but the underlying idea is natural and simple. As v+ is a uniquely determined extension of v we will, as soon as the definitions are over, follow the same ‘abuse of notation’ as in propositional logic and write it simply as v, thereby eliminating an endless repetition of superscripts. There are some contexts in which the notation could be simplified further. When considering only one valuation, we could reduce clutter by writing v+(t) as t, that is, by simply underlining the term. But in contexts where we are considering more than one valuation (which is most of the time), this simple notation is not open to us unless, of course, we use more than one kind of underlining, which would soon become cumbersome. Exercise 9.3.1 Rewrite the recursion step of the definition of v+ using the underlining notation. Solution f(t1,…,tn) = f(t1,…,tn), where on the LHS the whole expression is underlined while on the RHS the signs f, t1,…,tn are underlined. This is certainly less cluttered than writing v þðf ðt1 ; . . .; tn ÞÞ ¼ ðvð f ÞÞðv þðt1 Þ; . . .; v þðtn ÞÞ, but to understand it one has to look carefully for the underlining. End of solution. The second stage in the recursive definition of a valuation v+ given an assignment v defines v+(a) 2 {0,1} for any formula of the language. As is to be expected, the definition follows the recursive construction of formulae. In each clause, we will merely specify when v+(a) = 1, leaving it understood that otherwise v+(a) = 0. • Basis, first part: For any atomic formula of the form Pt1 ; . . .; tn ; v þðPt1 ; . . .; tn Þ ¼ 1 iff ðv þðt1 Þ; . . .; v þðtn ÞÞ 2 vðPÞ. • Basis, second part: For any atomic formula of the form t1 ¼ t2 : v þðt1 ¼ t2 Þ ¼ 1 iff ðv þðt1 Þ; v þðt2 ÞÞ 2 vð¼Þ. Since v(=) is required to be the identity relation over D, this means that v+(t1 = t2) = 1 iff v+(t1) = v+(t2). The recursion step also has two parts, one for the truth-functional connectives and the other for the quantifiers. The former is familiar:
306
9 Something About Everything: Quantificational Logic
• Recursion step for the truth-functional connectives: v+(¬a) = 1 iff v+(a) = 0 and so on for the other truth-functional connectives, just as in propositional logic. The recursion step for the quantifiers lies at the heart of the semantics. But it is subtle, and needs careful formulation. In the literature, there are two ways of going about it. They are equivalent, under a suitable condition, and from an abstract point of view one can see them as essentially two ways of doing the same thing. Passions can run high over which is better to use; in the author’s view, sometimes one is more convenient, sometimes the other—in any case, it is advisable to understand both of them. They are known as the substitutional and x-variant readings of the quantifiers.
9.3.2 Substitutional Reading The substitutional reading of the quantifiers is not often used by mathematicians but is frequently employed by computer scientists and philosophers; we present it first because, in the author’s experience, non-mathematical students find it easier to grasp. We emphasize, however, that it is no less rigorous than the x-variant reading that will follow. As promised earlier, from this point onwards we simplify (‘abuse’) notation by dropping the superscripted plus sign from v+ when speaking about valuations: v will stand for both the valuation and its underlying assignment. As the valuation is an extension of the assignment which, in turn is a restriction of the valuation to the domain of ingredients of the language, this should not lead to any confusion and context will also make it clear, in any instance, which is meant. First, one needs to explain a particular kind of substitution. Given a formula a and a variable x, write ax:=t to stand for the result of substituting the term t for all free occurrences of x in a. For example, if a is the formula 8z½Rxz ! 9xðRzxÞ then ax:¼a ¼ 8z½Raz ! 9xðRzxÞ, obtained by replacing the unique free occurrence of x in a by the constant a, leaving the two bound occurrences of x untouched. Exercise 9.3.2 (1) (a) Let a be the same formula 8z½Rxz ! 9xðRzxÞ. Write out ax:=b, ay:=b, az:=b. (b) Do the same for the formula 8x9yðRxyÞ _ 9z½Py ! 8xðRzx ^ RyxÞ. Solution (a) ax:¼b ¼ 8z½Rbz ! 9xðRzxÞ but ay;¼b ¼ 8z½Rxz ! 9xðRzxÞ ¼ a ¼ az¼b , since there are no free occurrences of y in a, nor any free occurrences of z in a. In this case we say that the substitution is vacuous. (b) Calling the formula in question b, we have bx:¼b ¼ b ¼ bz:¼b , since both substitutions are vacuous. But by¼b ¼ 8x9yðRxyÞ _ 9z½Pb ! 8xðRzx ^ RbxÞ, replacing the two free occurrences of y in b by b. End of solution.
9.3 Two Semantics for Quantificational Logic
307
We are now ready to give the substitutional reading of the quantifiers under a valuation v with domain D. We first make sure that the function v, restricted to the set of all constants of the language, is surjective, that is, onto D, in other words that every element of D is the value under v of some constant symbol. If it is not already onto D, we add enough constant signs to the language to be able to extend the assignment function to ensure that it is onto D and consider that extension. Then we evaluate the quantifiers as follows. • v(8x(a)) = 1 iff v(ax:=a) = 1 for every constant symbol a of the language (thus extended). • v(9x(a)) = 1 iff v(ax:=a) = 1 for at least one constant symbol a of the language (thus extended). The reason for requiring surjectivity is to guarantee that 8x really means ‘for every element in the domain’ and not merely ‘for every element of the domain that happens to have a name in our language’. There is no need to require injectivity.
Alice Box: Oddities
Alice
Hatter
Alice
Hatter
One moment, there is something funny here! The surjectivity requirement has a strange consequence: the language itself is not fixed independently of its interpretation, since the supply of constants in the language may vary according to the domain of discourse under consideration. That’s odd! Odd, yes, but not incoherent. It works perfectly well. But it is one reason why some philosophers and logicians prefer the other reading of the quantifiers, which we will give shortly. Another puzzle. Reading the above rules, it seems that we are using quantifiers in our metalanguage when defining the semantics of quantifiers in the object language. Sure, just as we used truth-functional connectives in the metalanguage when defining their semantics in the object language. There’s no other way.
Exercise 9.3.2 (2) (a) With a domain D consisting of two items 1 and 2, construct a valuation that makes the formula 8x(Px _ Qx) true but makes 8x(Px) _ 8x(Qx) false. Show in detail your calculations of the respective truth-values. (b) Do the same for 8x9y(Rxy) and 9y8x(Rxy).
308
9 Something About Everything: Quantificational Logic
Solution (a) With D = {1,2}, put v(P) = {1}, v(Q) = {2}, and let a, b be constants in the language with v(a) = 1 and v(b) = 2. We claim that v(8x(Px _ Qx)) = 1 while v(8x(Px) _ 8x(Qx)) = 0. For the former, it suffices to show that both v(Pa _ Qa) = 1 and v(Pb_Qb) = 1. But since v(Pa) = 1 we have v(Pa_Qa) = 1, and likewise since v(Qb) = 1 we have v(Pb_Qb) = 1. For the latter, v(Pb) = 0 so that v(8x(Px)) = 0; likewise v(Qa) = 0 so that v(8x(Qx)) = 0. Thus v(8x(Px) _ 8x(Qx)) = 0 as desired. (b) With D = {1,2} we specify constant signs in the language that are assigned 1, 2 as their respective values. We could use a, b as in part (a) of this exercise, but we can simplify mental coordination by using the numerals ‘1’, ‘2’ as constants with v(‘1’) = 1 and v(‘2’) = 2; we can also abuse notation by omitting the inverted commas. Put v(R) = {(1,1), (2,2)}. Suggestion: for visualization, draw an arrow diagram (aka digraph, Chap. 2, Sect. 2.2.2). We claim that v (8x9y(Rxy)) = 1 while v(9y8x(Rxy)) = 0.
For the former, it suffices to check that both v(9y(R1y)) = 1 and v(9y(R2y)) = 1, so in turn it suffices to show that either v(R11) = 1 or v(R12) = 1, and either v (R21) = 1 or v(R22)) = 1. But, since v(R) = {(1,1), (2,2)}, we have v(R11) = 1 = v (R22) which, by truth-functional calculation, does the job. For the latter, it suffices to show that both v(8x(Rx1)) = 0 and v(8x(Rx2)) = 0. But we have the first since v (R21) = 0 and we have the second since v(R12)) = 0. End of solution. The substitutional account of the quantifiers throws light on the finite transforms of a quantified formula, which we discussed briefly in the preceding section. Let v be any valuation with domain D, each named by a constant of the language. Then, under the substitutional reading, for any universally quantified formula we have v (8x(a)) = 1 iff v((ax:=a) = 1 for every constant symbol a of the language. If D is finite and a1 ; . . .; an are constants naming all its elements, then this holds iff vðax:¼a1 ^ . . . ^ ax:¼an Þ ¼ 1. Similarly for the existential quantifier: v(9x(a)) = 1 iff vðax:¼a1 _ . . . _ ax:¼an Þ ¼ 1. Thus the truth-value of a formula under a valuation v with a finite domain D of n elements can also be calculated by a translation into a quantifier-free formula (that is, the only logical operators in it are truth-functional connectives). We recursively translate 8x(a) and (9x(a) into ðax:¼a1 ^ . . . ^ ax:¼an Þ and ðax:¼a1 _ . . . _ ax:¼an Þ respectively, where a1, …,an are constants chosen to name all elements of D. Exercise 9.3.2 (3) Do Exercise 9.3.2 (2) (a) again, but this time translating into quantifier-free formulae and assigning truth-values. Solution Take constants a, b. The translation of 8x(Px _ Qx) is (Pa _ Qa) ^ (Pb_Qb) while the translation of 8x(Px) _ 8x(Qx) is (Pa ^ Pb) _ (Qa ^ Qb). Let v be the
9.3 Two Semantics for Quantificational Logic
309
propositional assignment that e.g. puts v(Pa) = 1 = v(Qb) and v(Pb) = 0 = v(Qa). Then by truth-tables v((Pa _ Qa) ^ (Pb _ Qb)) = 1 while v((Pa ^ Pb) _ (Qa ^ Qb)) = 0 as desired.
Alice Box: Why the colon?
Alice Hatter
Alice Hatter
One last question. Why the colon in the subscripts of ax:=a, ax:=b? We are substituting constants for variables, not conversely. Equality is symmetric, so we need a sign that reflects the difference. We borrow an idea from computing and write : = rather than = . Isn’t that a bit pedantic? Aren’t we trying to simplify notation? Perhaps it is. One could omit the colon so long as one understands what one is doing. Keeping it has the incidental advantage of helping flag the difference between substitution and another operation called replacement, to be defined in Sect. 9.4.4 when analysing identity.
9.3.3 The x-Variant Reading We now explain the rival x-variant reading of the quantifiers. Roughly speaking, whereas the substitutional reading of a formula 8x(a) under valuation v looked at the values of certain formulae that are (except in limiting cases) different from a under the same valuation v, the x-variant reading will consider the values of the same formula a under certain valuations that are (except in limiting cases) different from v. Let v be any valuation with domain D, and let x be any variable of the language. By an x-variant of v we mean any valuation v′ with the same domain D that agrees with v in the values given to all constants, function letters and predicates (i.e. v0 ðaÞ ¼ vðaÞ; v0 ðf Þ ¼ vðf Þ; v0 ðPÞ ¼ vðPÞ for all letters of the respective kinds), and also agrees on the valuation given to all variables except possibly the particular variable x (so that v′(y) = v(y) for every variable y of the language other than the variable x). With this notion in hand, we evaluate the quantifiers for a valuation v with domain D, as follows: v(8x(a)) = 1 iff v′(a) = 1 for every x-variant valuation v′ of v. v(9x(a)) = 1 v′(a) = 1 for at least one x-variant valuation v′ of v. Exercise 9.3.3 (1) Re-solve Exercise 9.3.2 (2) using the x-variant reading of the quantifiers and compare the calculations. In other words:
310
9 Something About Everything: Quantificational Logic
(a) With domain D = {1,2}, construct a valuation v such that under the x-variant reading of the quantifiers that makes 8x(Px_Qx) true but 8x(Px)_8x(Qx) false. Show your calculations. (b) Do the same for 8x9y(Rxy) and 9y8x(Rxy). Solution (a) Put v(P) = {1}, v(Q) = {2}, and v(x) any element of D (it will not matter how it is chosen in D, since the formulae we are evaluating are closed). We claim that v(8x(Px_Qx)) = 1 while v(8x(Px)_8x(Qx)) = 0. To show that v(8x(Px_Qx)) = 1, it suffices to show that v′(Px_Qx) = 1 for every x-variant valuation v′ of v. But there are only two such x-variants, vx:=1 and vx:=2, defined by putting vx:=1(x) = 1 and vx:=2(x) = 2. Now, we have vx: =1(Px) = 1 while vx:=2(Qx) = 1, so vx:=1(Px_Qx) =1 = vx:=2(Px_Qx) and thus v (8x(Px_Qx)) = 1. To show that v(8x(Px)_8x(Qx)) = 0, we have vx:=2(Px) = 0 = vx:=1(Qx) so that v(8x(Px)) = 0 = v(8x(Qx)) and so finally v(8x(Px)_8x (Qx)) = 0 as desired. (b) Put v(R) = {(1,1), (2,2)}. We claim that v(8x9y(Rxy)) = 1 while v(9y8x (Rxy)) = 0. To show that v(8x9y(Rxy)) = 1, it suffices to show that v′(9y (Rxy)) = 1 for every x-variant valuation v′ of v. But there are only two such xvariants, vx:=1 and vx:=2, defined by putting vx:=1(x) = 1 and vx:=2(x) = 2 (while leaving the value of y unchanged). Consider first vx:=1(9y(Rxy)). To check that this equals 1, it suffices to observe that vx:=1,y:=1(Rxy) = 1, where vx:=1,y:=1 is the y-variant of vx:=1 that gives y the value 1 (while keeping the value of x at 1). The verification that vx:=2(9y(Rxy)) = 1 is similar with 2 in place of 1. To show that v(9y8x(Rxy)) = 0, we need to show that v′(8x(Rxy)) = 0 for every y-variant valuation v′ of v. But there are only two such y-variants, vy:=1 and vy: =2, defined by putting vy:=1(y) = 1 and vy:=2(y) = 2 (while leaving the value of x unchanged). Consider first vy:=2(8x(Rxy)). To check that this equals 0, it suffices to observe that vy:=2,x:=1(Rxy) = 0 where vy:=2,x:=1 is the x-variant of vy: =2 that gives x the value 1 (while keeping the value of y at 2). The verification that vy:=1(8x(Rxy)) = 0 is similar with 2 and 1 interchanged. End of solution. In Exercise 9.3.3 (1), we used a notation for x-variants, vx:=1, vx:=2 etc., that allows us to keep track of what is going on. It runs parallel to the notation for the substitutional reading of the preceding section, but with x: = 1, x: = 2 etc. subscripted to valuations v for the x-variant reading and to formulae a for the substitutional reading. At some deep level, the two procedures are thus ‘doing the same thing’. Evidently, detailed verifications like those in Exercises 9.3.2 (2) and 9.3.3 (1) are tedious when done by hand, even with very small domains, and become more than exponentially so as the size of the domain increases. Moreover, for infinite domains one cannot simply run through a finite number of substitutions or make a finite
9.3 Two Semantics for Quantificational Logic
311
number of x-variants; verification of the truth-value of a formula under a valuation into an infinite domain requires more abstract reasoning and is not in general algorithmic. However, once one has done a number of verifications, one can begin to ‘see’ the value of fairly simple formulae under a given valuation without writing out all the details. One can also program a computer to do the job, as far as specified finite domains are concerned. Exercise 9.3.3 (2) In the opening paragraph of this section the substitutional and x-variant readings were contrasted by saying that whereas the substitutional reading of 8x(a) under v considers the values of certain formulae that are (except in limiting cases) different from a under the same valuation v, the x-variant reading considers the values of the same formula a under certain valuations that are (except in limiting cases) different from v. Why the qualifications ‘except in limiting cases’? Solution For the substitutional reading: in the limiting case that there are no free occurrences of x in a, then ax:=a is the formula a itself. For the x-variant reading: in the limiting case that v(x) = a 2 D, then vx:=a is the valuation v itself. End of solution. It should be clear from the exercises that, under both the substitutional and the xvariant readings, the truth-value of a formula a under a valuation v is independent of the value that v gives to the variables that do not occur free in a. For example, in the formula 8x(Px _ Qy) the variable x does not occur free—all its occurrences are bound by the initial universal quantifier—so the truth-value of that formula under a valuation v is independent of the value v(x) of the variable x—although it does depend on the value the truth-value v(y). Hence, for sentences (aka closed formulae) a, since no variable occurs free in a, v(a) is always independent of v(x) for any variable x whatsoever.
Alice Box: Truth of formulae that are not closed
Alice
Hatter Alice
Hatter
I have been browsing in several other books on logic written for students of mathematics. They all use the x-variant account, but in a rather different way. How is that? Under the definitions in this chapter, a formula always gets a specific truth-value under a given valuation with specified domain, that is, we always have either v(a) = 1 or v(a) = 0. But the texts that I have been looking at insist that when a formula a has free occurrences of variables in it, then in general it is neither true nor false in a given model! What is going on? That is another way of building the x-variant semantics. It is different in some of the terminology, but in the end it does the same job. The two accounts agree on closed formulae.
312
9 Something About Everything: Quantificational Logic
The Hatter’s response is correct but far too laconic; Alice deserves rather more, although students who have not been exposed to the alternative way of proceeding may happily skip to the next section. Under the presentation that Alice has been reading, formulae are evaluated in exactly the same way as above, but with a difference in terminology. Rather than speaking of truth and falsity and writing v(a) = 1 and v(a) = 0, the valuation is said to ‘satisfy’ or ‘not satisfy’ the formula, writing v ⊨ a or v ⊭ a. A ‘model’ is understood as a valuation stripped of the values assigned to variables, and a formula is called ‘true’ in a given model iff it is satisfied by every valuation extending that model to cover variables, that is, by every valuation that agrees with the model but in addition gives values to the variables of the language. A formula is said to be false in the model iff it is satisfied by none of those valuations. Now, using that terminology, a formula containing free occurrences of variables will in general be neither true nor false in a given model: some assignments of values in the domain to its free variables may satisfy it, others not. The simplest example is the atomic formula Px. The model with domain D = {1,2} and v (P) = {1} does not make Px true, nor false in the sense we are now considering, since the valuation with v(x) = 1 satisfies Px while the valuation with v(x) = 2 does not. But when a formula is closed (that is, has no free occurrences of variables) then the gap disappears: for any given model, a closed formula is either true in the model or false in the model. Moreover, it turns out that an arbitrary formula a is true in a model iff its universal closure 8x1 . . .8xn ðaÞ is true in that same model. The reason why the present text does not follow the alternative manner of presentation is that it creates unnecessary difficulties for students. Having become accustomed to the fundamental bivalence of propositional logic, they are then asked to deploy the terms ‘true’ and ‘false’ in a trivalent way in quantificational logic— and yet are often told, quite correctly, that this is still classical two-valued logic, not some many-valued one. A sure recipe for classroom confusion! The terminology followed in this book (along with quite a few others) retains bivalence for the terms ‘true’ and false’, just as in propositional logic, rather than complicate matters by making those terms trivalent and shifting bivalence to fresh terms ‘satisfy’ and ‘does not satisfy’
9.4
Semantic Analysis
We now apply the semantic tools developed in Sect. 9.3 to analyse the notion of logical implication in the presence of quantifiers and establish some fundamental rules. They are even more fundamental, though more technical and less familiar, than the equivalences listed in tables of Sect. 9.2.
9.4 Semantic Analysis
313
9.4.1 Logical Implication To define notions of logical relationship and logical status in quantificational logic, we simply take the definitions of the corresponding notions in truth-functional logic (Chap. 8, Sect. 8.3) and re-understand them in terms of the more elaborate notion of a valuation in the first-order context. To mark the difference of context, the convention is to reserve the term ‘tautological’ for the propositional context and speak instead of ‘logical’ this and that. • A set A of formulae is said to logically imply a formula b iff there is no valuation v such that v(a) = 1 for all a 2 A but v(b) = 0. This relation is written with the same ‘gate’ or ‘turnstile’ sign as in propositional logic, A ⊨ b, and we also say that b is a logical consequence of A. • a is logically equivalent to b, and we write a ⟚ b, iff both a ⊨ b and b ⊨ a. Equivalently: a ⟚ b iff v(a) = v(b) for every valuation v. • a is a logically true, and we write ⊨a, iff v(a) = 1 for every valuation v; it is a contradiction iff v(a) = 0 for every valuation v: it is contingent iff it is neither logically true nor a contradiction. • More generally, a set A of formulae is satisfiable iff there is some valuation v such that v(a) = 1 for every formula a 2 A. Otherwise, it is unsatisfiable. Evidently, the bulleted concepts above are interrelated in the same way as their counterparts in propositional logic with the same verifications (Sect. 8.3). For example, ⊨ a iff ∅ ⊨ a. In the exercises of Sect. 9.3 we checked some negative results; in particular, we saw that 8xðPx _ QxÞ 2 8xðPxÞ _ 8xðQxÞ and 8x9yðRxyÞ 2 9y8xðRxyÞ. In both instances, we found a valuation in a very small domain (two elements) that does the job. For more complex non-implications one often needs larger domains; indeed, there are formulae a, b such that a ⊭ b but such that v(b) = 1 for every valuation v in any finite domain with v(a) = 1. In other words, there are some non-implications that can be witnessed only in infinite domains (which, however, can always be chosen to be countable). But that is beyond our remit, and we remain with more elementary matters. The second of the non-implications just mentioned suggests the general question of which alternating quantifiers imply which. This is answered in Fig. 9.1. The double-headed arrows in the diagram indicate logical equivalence; single-headed ones are for logical implication. We are looking at formulae with two initial quantifiers with attached variables; the left column changes the quantifiers leaving the attached variables in the fixed order x, y (22 = 4 cases), while the right column does the same but with the attached variables in reverse order y, x (another 22 = 4 cases), thus 8 cases in all. In each case the material quantified, here written (…), remains unchanged. The figure is complete in the sense that when there is no path in it following arrows from u to w, then in fact u ⊭ w.
314
9 Something About Everything: Quantificational Logic
Fig. 9.1 Logical relations between alternating quantifiers
Exercise 9.4.1 (1) Verify the non-implication 9x8y(a) ⊭ 9y8x(a) by choosing a to be Rxy and considering a suitable valuation in the smallest domain that you can get away with. Use either the x-variant or substitutional account of the quantifier in your verification as you prefer, but in either case follow the notation that was given in Sect. 9.3. Solution This is not quite the same as Exercise 9.3.2 (2) (b). There it was shown, in effect, that 8x9y(Rxy) ⊭ 9y8x(Rxy) permuting quantifiers-with-attached-variables. Now we check that 9x8y(Rxy) ⊭ 9y8x(Rxy), keeping the order of quantifiers fixed but permuting the variables attached. The smallest domain in which this can be done has two elements. Put D = {1,2} and v(R) = {(1,1), (1,2)} (draw a digraph for visualization). We claim that v(9x8y (Rxy)) = 1 while v(9y8x(Rxy)) = 0, verifying with the substitutional reading of the quantifiers. To check that v(9x8y(Rxy)) = 1, it suffices to show that either v(8y (R1y)) = 1 or v(8y(R2y)) = 1; the former holds since both v(R11)) = 1 and v (R12) = 1 immediately from the valuation of R. To show v(9y8x(Rxy)) = 0 it suffices to show that both v(8x(Rx1)) = 0 and v(8x(Rx2)) = 0; the former holds since v(R21)) = 0 while the latter holds since v(R22) = 0. End of solution. So far, we have been using the semantics to get negative results. We can also use it to get positive ones. Exercise 9.4.1 (2) Verify 9x8y(a) ⊨ 8y9x(a) using the x-variant reading of the quantifiers. Solution Let v be a valuation with domain D, and suppose v(9x8y(a)) = 1 while v(8y9x(a)) = 0; we get a contradiction. By the first supposition, there is an x-variant of v, which we write as vx:=a, with vx:=a(8y(a)) = 1. By the second supposition, there is a y-variant vy:=b of
9.4 Semantic Analysis
315
v with vy:=b(9x(a)) = 0. Now take the y-variant vx:=a,y:=b of vx=a. Since vx:=a(8y(a)) = 1, we have vx:=a,y:=b(a) = 1; likewise, since vy:=b(9x(a)) = 0, we get vy:=b,x:=a(a) = 0. But clearly the two valuations vx:=a,y:=b and vy:=b,x:=a are the same so long as x and y are distinct variables, as was implicitly presupposed in the formulation of the problem. For the former is obtained by re-specifying the value given to x and then re-specifying the value given to the different variable y, while the latter re-specifies in reverse order. So 1 = vx:=a,y:=b(a) = vx:=a,y:=b(a) = 0, giving us a contradiction. Alice Box: This looks like a fraud
Alice
Hatter
Alice
Hatter
Alice Hatter
You make me laugh! In Exercise 9.4.1 (2) you are verifying an intuitively obvious principle and, to do it, you use the very same principle! OK, you do it in the metalanguage rather than the object language, but it still looks like a fraud. A disappointment, yes; a pain in the neck, I agree. But not a fraud. To establish a principle expressed in the object language, we must reason and our reasoning is carried out in a metalanguage. Back in propositional logic we did exactly the same—in a sense it was even worse, because there too we reasoned with quantifiers although they were not even present in the object language. So, what’s the advantage? The metalinguistic verification is sometimes more complicated and less transparent than the item in the object-language that it is verifying. Why not just think intuitively in the object language? Indeed, heuristically, one does just that, but it can quickly become vague and unmanageable without assistance. One advantage of using the formal semantics is that verification often becomes a matter of calculation. We have no need to guess, intuit, or carry loads of information in our heads; it is all down on paper. When dealing with infinite domains, calculation alone may not suffice. Quite so. But with the resources supplied by the formal semantics, the task of making an informed guess, as well as that of articulating a watertight verification for it, become more straightforward. Moreover, checking whether a proposed verification really works is still a matter of calculation.
Exercise 9.4.1 (3) Verify 8x(a) ⊨ 9x(a) using (i) the x-variant and then (ii) the substitutional reading of the quantifiers.
316
9 Something About Everything: Quantificational Logic
Solution The phenomenon discussed by Alice and the Hatter appears again in the solution to this exercise. Let v be any valuation with domain D 6¼ ∅, and suppose v(8x(a)) = 1. We need to check that v(9x(a)) = 1. (i) Using the x-variant reading: Since v(8x(a)) = 1, we have v′(a) = 1 for every xvariant v′ of v. Hence, in particular, v(a) = 1 and so v′(a) = 1 for at least one xvariant v′ of v and thus v(9x(a)) = 1 as desired. (ii) Using the substitutional reading: Since v(8x(a)) = 1, we have v(ax:=a) = 1 for every constant a of the language. D 6¼ ∅ and every element of D is given a constant as name (Sect. 9.3.2), we have v(ax:=a) = 1 for at least one constant a so, by the evaluation rule for the existential quantifier, v(9x(a)) = 1 as desired. End of solution. We note in passing that some philosophers have seen the implication 8x(a) ⊨ 9x(a) as a defect of first-order logic. They feel that, for complete generality, one should admit the empty domain and extend the relevant definitions in such a way that there is a valuation v into it with v(8x(a)) = 1 and v(9x(a)) = 0. While this idea sounds attractive, its rigorous execution turns out to be tricky. The first point to notice is that there are no functions taking a non-empty set, such as the set of individual constants or that of the individual variables of the language, into the empty set. Thus, unless we modify the definitions, there are no assignments, hence no valuations, into the empty domain. To ensure that there is a valuation v into ∅ with v(8x(a)) = 1 and v(9x (a)) = 0 as proposed above, we have to reconstruct the semantics, beginning with the definition of an assignment. But, despite valiant attempts in the literature, it is still not clear how that can be done without affecting the treatment of non-empty domains or creating endless complications. Since, in practice, we never knowingly work with the empty domain, few logicians take that path.
9.4.2 Clean Substitutions All the logical relations between quantifiers rest on four fundamental principles that we have not yet enunciated. To formulate them we need a further concept—that of a clean substitution of a term t for a variable x. Recall that a term t may contain variables as well as constants and function letters; indeed, a variable standing alone is already a term. So when we substitute t for free occurrences of x in a, it may happen that t is, or contains, a variable y that is ‘captured’ by some quantifier of a. For example, when a is the formula 9y(Rxy) and we substitute y for the sole free occurrence of x in it, we get ax:=y = 9y(Ryy), where the y that is introduced is in the scope of the existential quantifier. Such substitutions are inappropriate from the point of view of two of the principles that we are about to articulate. We say that a substitution passing from a to ax:=t is clean iff no free occurrence of x in a falls within the scope of a quantifier that binds some variable occurring in t.
9.4 Semantic Analysis
317
Exercise 9.4.2 Let a ¼ 9yfPy _ 8z½Rzx ^ 8xðSaxÞg. Which of the following substitutions are clean? (i) ax:=y, (ii) ax:=a, (iii) ax:=x, (iv) ax:=z, (v) ay:=z, (vi) aw:=y. Solution (i) Not clean, because the sole free occurrence of x is in the scope of 9y. (ii), (iii) Both clean. (iv) No, because the free occurrence of x is in the scope of 8z. For (v), note that there are no free occurrences of y so, vacuously, the substitution ay:=z is clean. (vi) Vacuously clean again: there are no occurrences of w in a at all. End of solution. Exercise 9.4.2 illustrates several general facts, whose verifications are immediate from the definitions. • The substitution of a constant for a variable is always clean. • The identity substitution is always clean. • A substitution is clean whenever the variable being replaced has no free occurrences in the formula. • In particular, a substitution is clean whenever the variable being replaced does not occur in the formula at all.
9.4.3 Fundamental Rules We can now formulate the promised fundamental principles about quantifiers, beginning with 8. The first one for 8 is a logical consequence, also known as a firstlevel rule, whilst the second is a rule allowing us to get one logical consequence from another, known as a second-level rule. They called 8− (universal instantiation, UI) and 8+ (universal generalization, UG). • 8−: 8x(a) ⊨ ax:=t, provided the substitution ax:=t is clean. • 8+: Whenever A ⊨ a then A ⊨ 8x(a), provided the variable x has no free occurrences in any formula a 2 A. As one would expect, there are dual principles for 9. They are dubbed 9+ (existential generalization, EG) and 9− (existential instantiation, EI). • 9 þ : ax:¼t 9xðaÞ, provided the substitution ax:=t is clean. • 9−: Whenever A, b ⊨ c then A, 9x(b) ⊨ c, provided the variable x has no free occurrences in any formula a 2 A [ {c}. In the second-level rule 8+, the entire consequence A ⊨ 8x(a) serves as output of the rule; the input is the consequence A ⊨ a. Similarly the input and output of 9− are both entire consequences.
318
9 Something About Everything: Quantificational Logic
Note carefully that the two first-level implications 8− and 9+ make substitutions and require that these substitutions be clean. In contrast, the second-level ones 8+ and 9− do not make substitutions, and have the different proviso that the quantified variable has no free occurrences in certain formulae. Commit to memory to avoid confusion! We draw attention to a detail about the first-level rule 9+ that sometimes throws students. While the implication goes from ax:=t to 9x(a), the substitution goes in the reverse direction, from the body a of 9x(a) to ax:=t. This contrasts with the situation in the first-level rule 8−, where the direction of the substitution is the same as that of the inference. It is perhaps for this reason, as well as the apparent syntactic complexity of 9− compared to that of 8+ that renders the rules for the existential quantifier more difficult to assimilate compared to their universal counterparts. Alice Box: Why the minus sign in the acronym 9−?
Alice
Hatter
Alice
Hatter
Alice Hatter
I’m rather bothered by the name of one of these four rules. I can see why you call the first three as you do, but not the fourth one. Why the minus sign in 9−? Surely we are adding the existential quantifier 9x to a. To see the rationale for the name, one has to remember that 9− is a second-level rule and think backwards. Imagine that you are given A, 9x(b) as premises and want to infer a conclusion c. The rule tells us that to do that, it suffices to treat b as a premise in place of 9x(b) and head for the same goal c (so long as the proviso is satisfied). So it is more subtle than what one is doing in the 9+ rule, where we are simply inferring 9x(a) from ax:=t (so long as the proviso of that rule is satisfied)? Indeed. We are not inferring b from 9x(b)—in general, that would be quite invalid. We are moving procedurally from considering 9x (b) as a premise to considering b in the same role, in the process of building a deduction of c from the original premises A, 9x(b). I think I understand, but you seem to be describing a mental process more than a mathematical fact. Can we go deeper? Indeed we can, and will do so in Chap. 10.
The following exercise is very boring, but you need to do it conscientiously in order to make sure that you have really understood what these two rules are saying. Exercise 9.4.3 (a) Which of the following are instances of the first-level rule 8−? (i) 8xðPx ! QxÞ Px ! Qx, (ii) 8xðPx ! QxÞ Pb ! Qb, (iii) 8xðPx^ QxÞ Px ^ Qy, (iv) 8x9yðRxyÞ 9yðRxyÞ, (v) 8x9yðRxyÞ 9yðRyyÞ, (vi) 8x9xðRxyÞ 9xðRayÞ, (vii) 8x9yðRxyÞ 9yðRyxÞ, (viii) 8x9yðRxyÞ 9yðRzyÞ, (ix) 8x9yðRxyÞ 9yðRayÞ, (x) 8x9yðRxyÞ Rxy.
9.4 Semantic Analysis
319
(b) Which of the following are instances of the first-level rule 9+? (i) Pa 9xðPxÞ, (ii) Rxy 9xðRxxÞ, (iii) Rxy 9zðRzyÞ, (iv) Rxy 9zðRzxÞ, (v) 9yðRxyÞ 9z9yðRzyÞ. (c) We know that that 8x9yðRxyzÞ 9yðRzyzÞ. Which of the following may be obtained from it by just an application of the second-level rule 8+? (i) 8x9yðRxyzÞ 8z9yðRzyzÞ, (ii) 8x9yðRxyzÞ 8w9yðRzyzÞ, (iii) 8x9y ðRxyzÞ 8w9yðRwyzÞ, (iv) 8x9yðRxyzÞ 9x9yðRzyzÞ, (v) 8x9yðRxyzÞ 8y9yðRzyzÞ. (d) We know that Px, 8yðRyzÞ Px ^ 9zðRxzÞ. Which of the following may be obtained from it by a single application of the second-level rule 9−? (i) Px, 9z8yðRyzÞ Px ^ 9zðRxzÞ, (ii) Px, 9z8yðRyzÞ Px ^ 9zðRxzÞ, (iii) Px, 9w8yðRywÞ Px ^ 9zðRxzÞ, (iv) Px, 9w8yðRyzÞ Px ^ 9zðRxzÞ, (v) 9xðPxÞ; 8yðRyzÞ Px ^ 9zðRxzÞ. Be careful. In (a), (b) we are not asking whether the logical consequence actually holds, but whether it holds as an instance of the rule concerned. Similarly, in (c), (d) it is not a matter of whether one logical consequence holds given another, but whether it does so as an instance of the rule mentioned. Solution (a) (b) (c) (d)
(i), (ii) yes; (iii) no; (iv) yes; (v), (vi) and (vii) no; (viii) and (ix) yes; (x) no. (i) yes, (ii) no, (iii) yes, (iv) no, (v) yes. (i) no; (ii) yes; (iii), (iv) no; (v) yes. (i) yes, (ii) no, (iii) no, (iv) yes, (v) no.
9.4.4 Identity So far, we have ignored the identity relation sign. Recall from Sect. 9.3.1 that this symbol is always given a highly constrained valuation. At the most lax, it is interpreted as a congruence relation over elements of the domain; in the standard semantics that is used here, it is always taken as the identity relation over the domain. Whichever of these readings one follows, standard or non-standard, some special properties emerge. As would be expected, these include formulae expressing that it is an equivalence relation: reflexive, symmetric, transitive (see Chap. 2). To be precise, each of the following formulae is logically true, in the sense defined in Sect. 9.4.1: 8xðx ¼ xÞ; 8x8y½ðx ¼ yÞ ! ðy ¼ xÞ, 8x8y8z½fðx ¼ yÞ ^ ðy ¼ zÞ ! ðx ¼ zÞg. A more subtle principle for identity is known as replacement. It reflects the fact that whenever x is identical with y then whatever is true of x is true of y. Sometimes dubbed the principle of the ‘indiscernibility of identicals’, its formulation in the language of first-order logic is a little trickier than one might anticipate. To state the rule, let t, t′ be terms and a a formula. Remember that terms may be constants, variables, or more complex items made up from constants and/or variables by iterated application of function letters.
320
9 Something About Everything: Quantificational Logic
We say that an occurrence of a term t in a formula a is free iff it does not fall within the scope of a quantifier of a that binds a variable in t. A replacement of t by t′ in a, here written at::=t′ with a double colon to distinguish it from substitution, is defined to be the result of taking one or more free occurrences of the term t in a and replacing them by t′. Such a replacement at::=t′ is said to be clean iff the occurrences of t′ thereby introduced are also free in at::=t′. Using these concepts, we can articulate the following principle of replacement: a, t = t′ ⊨ at::=t′, provided the replacement is clean. For example, taking a to be 9y(Rxy), t to be x, and t′ to be z we have 9y(Rxy), x = z ⊨ 9y(Rzy), since the introduced variable z is free in 9y(Rzy) and the replacement is clean. On the other hand, if we take t′ to be y and propose the inference 9y(Rxy), x = y ⊨ 9y(Ryy), the introduced occurrence of y y is not free in 9y(Ryy), so the replacement is not clean and the step is not authorized. The proof of the replacement principle can be carried out by a rather tedious induction on the complexity of the formula a; we omit it. Exercise 9.4.4 (1) Show that the principle of replacement authorizes x = x, x = y ⊨ y = x. Solution Let (x = x)x::=y be the result of replacing the first occurrence of the variable x in the formula x = x by the variable y, giving the formula y = x; since there are no quantifiers the replacement is clean. Thus by the replacement principle, x = x, x = y ⊨ y = x. Replacement can also be used in a trickier way to yield the transitivity of identity.
9.5
End-of-Chapter Exercises
Exercise 9.5 (1) The language of quantifiers (a) Return to the ten questions that were raised after Table 9.1 and answer them in the light of what you have learned in this chapter. (b) Express the following statements in the language of first-order logic. In each case specify explicitly an appropriate domain of discourse. (i) (ii) (iii) (iv) (v) (vi)
Zero is less than or equal to every natural number If one real number is less than another, there is a third between the two Every computer program has a bug Any student who can solve this problem can solve all problems Squaring on the natural numbers is injective but is not onto Nobody loves everybody, but nobody loves nobody.
9.5 End-of-Chapter Exercises
321
Solution (a) (1) Yes, we can use any variable, writing for example 8y(Cy ! Py). We are using ! rather than ^ because we are not saying that everything in the domain of discourse (people) is both a composer and a poet; we are claiming that for any person in the domain, if he/she is a composer then he/she is a poet. We can write 8x(Cx ! Px) as ¬9x(Cx ^ ¬Px). The formulae 8x(Cx ! Px) and 8x(Px ! Cx) are said to be converses of each other (for obvious reasons, given what you know from propositional logic) and are independent in the sense that neither logically implies the other. (a) (2) We are saying that someone in the domain is both a composer and a poet, whereas 9x(Cx ! Px) would say that there is somebody in the domain such that if he/she is a composer then he/she is a poet. The latter is automatically true if there is somebody in the domain who is not a composer! We can write 9x(Cx ^ Px) as ¬8x(Cx ! ¬Px). It is not logically implied by the first statement: when nobody in the domain is a composer, 8x(Cx ! Px) is automatically true while 9x(Cx ^ Px) is false. 9x(Cx ^ Px) is independent of 9x(Cx ^ ¬Px) in the sense that neither logically implies the other; they are also jointly satisfiable. (a) (3) We can write 8x(Px ! ¬Cx) as ¬9x(Px^Cx). The two statements are logically equivalent. (a) (4) To simplify the expression, we let the domain of discourse be the set of all persons. Yes, the meaning does change: 8x9y(Lyx) says that everyone is loved by someone. (a) (5) No, 9y8x(Lxy) is not equivalent to 8x9y(Lxy), but the former does logically imply the latter. (a) (6) Yes, but it would be clumsy. Write Fy for ‘y is equal to five’ and symbolize as 9xðPx ^ 8yðFy ! ðx\yÞÞ. (a) (7) Yes, as 8x9y½ðMx ^ SxÞ ! ðWy ^ Ay ^ ByxÞ. (a) (8) We can express ¬9x(Oxf(x)) as 8x¬(Oxf(x)); while this still contains a negation, it is no longer the principal connective. Writing Fyx for ‘y is a father of x’ we can write ¬9x(Oxf(x)) as ¬9x9y(Fyx^Oxy). (a) (9) We can contrapose 8x8y½:ðx ¼ yÞ ! :ðsðxÞ ¼ sðyÞ to 8x8y½ðsðxÞ ¼ sðyÞ ! ðx ¼ yÞ and reverse the initial quantifiers to 8y8x without changing logical force. (a) (10) There is no logical need for the second quantifier to take a different variable in fP0 ^ 8xðPx ! PsðxÞÞg ! 8xðPxÞ, since the scope of the first quantifier has already ended before the second begins, but some may find it easier to read when a different variable is used. Yes, we can move the second universal quantifier up the front without complications, getting the equivalent formula 8x½fP0 ^ 8xðPx ! PsðxÞÞg ! Px. But moving the other quantifier ‘up the front’ takes more work and yields a formula that is strange and indigestible, although equivalent to the original. A chain of equivalences follows, in which we bring first one quantifier to the front and then the
322
9 Something About Everything: Quantificational Logic
other. If we do this in reverse order, we can also get another formula in prenex normal form with the same body but with the two initial quantifiers reversed, from 9x8y to 8y9x. That is a rather exceptional feature of the example; in general, one cannot reverse the order of a universal with an existential quantifier. {P0 ∧ ∀x(Px → Ps(x))} → ∀x(Px) ⟚ ∀x{P0 ∧ (Px → Ps(x))} → ∀x(Px) ⟚ ¬∀x{P0 ∧ (Px → Ps(x))} ∨ ∀x(Px) ⟚ ∃x¬{P0 ∧ (Px → Ps(x))} ∨ ∀x(Px) ⟚ ∃x[¬{P0 ∧ (Px → Ps(x))} ∨ ∀x(Px)] ⟚ ∃x[{P0 ∧ (Px → Ps(x))} → ∀x(Px)] ⟚ ∃x[{P0 ∧ (Px → Ps(x))} → ∀y(Py)] ⟚ ∃x∀y[{P0 ∧ (Px → Ps(x))} → Py].
Exercise 9.5 (2) Valuations (a) Consider the relation between valuations of being x-variants, for a fixed variable x. Is it an equivalence relation? And if the variable x is not held fixed? (b) Find a formula using the identity sign that is true under every valuation whose domain has less than three elements, but is false under every valuation whose domain has three or more elements. (c) Sketch an explanation why there is no hope of finding a formula that does not contain the identity sign, with the same properties. Solution (a) For a fixed variable x, it is an equivalence relation, as is easily checked from the definition. But, if the variable is not held fixed, it is not in general an equivalence relation: a y-variant of an x-variant of v will in general differ from v in the value given to both those two variables. (b) 9x9y8z½z ¼ x _ z ¼ y. (c) Consider any domain D of more than two elements. Select two individuals a1, a2 from it, and define a valuation that treats every element of D other than a1 as indistinguishable from a2. This is possible since for all function signs and predicates other than the identity sign, there are no restrictions on the functions resp. relations of D that they can be given as values, so long as their arity is respected. Thus, for example, if P is a one-place predicate, we can define v (P) in such a way that for all a 2 D with a 6¼ a1, a 2 v(P) iff a2 2 v(P). Then it is not difficult to verify that every formula without the identity sign receives the same truth-value under this valuation as it would in the corresponding valuation in the two-element domain D′ = {a1, a2}. Exercise 9.5 (3) Semantic analysis (a) Justify the general principle of vacuous quantification (Sect. 9.2.3) semantically, first using the substitutional reading of the quantifiers, and then using the x-variant reading. (b) Which of the following claims are correct? (i) 8xðPx ! QxÞ 9xðPxÞ ! 9xðQxÞ, (ii) 9xðPx ! QxÞ 9xðPxÞ ! 9xðQxÞ, (iii)
9.5 End-of-Chapter Exercises
323
8xðPx ! QxÞ 9xðPxÞ ! 8xðQxÞ, (iv) 8xðPx ! QxÞ 8xðPxÞ ! 9 xðQxÞ, and (v)–(viii) their converses. In the negative cases, specify a valuation in a small finite domain to serve as witness. In the positive cases, sketch a semantic verification using either the x-variant or the substitutional reading of the quantifiers. (c) Find simple formulae a, b of quantificational logic without the identity predicate such that (i) 8x(a) is a contradiction but a is not, (ii) 9x(b) is logically true but b is not. (d) Recall from the text that a set A of formulae is said to be consistent iff there is some valuation that makes all of its elements true. Verify the following (i) The empty set is consistent, (ii) A singleton set is consistent iff its unique element is not a contradiction. (iii) An arbitrary set A of formulae is consistent iff A ⊭ p ^ ¬p. (iv) Every subset of a consistent set of formulae is consistent. (v) A finite set of formulae is consistent iff the conjunction of all its elements is consistent. Solution (a) The general principle of vacuous quantification says: when there are no free occurrences of x in u, then each of 8x(u) and 9x(u) is logically equivalent to u. We consider the universal quantifier; the treatment of the existential is similar. Suppose there are no free occurrences of x in u. (i) Under the substitutional reading, v(8x(u)) = 1 iff v(ux:=a) = 1 for every constant symbol a of the language (suitable expanded, if needed). But since there are no free occurrences of x in u, the substitutions are all empty and each such formula ux:=a is just u. Thus v(8x(u)) = 1 iff v(u) = 1. (ii) Under the x-variant reading, v(8x(u)) = 1 iff vx:=a(u) = 1 for every xvariant vx:=a of v. But it is not difficult to show by a structural induction that, since x does not occur free in u, each vx:=a(u) = v(u). Thus, v(8x (u)) = 1 iff v(u) = 1. (b) Solution outline: (i) Yes, but its converse is not. (ii), (iii) No, but its converse is. (iv) Yes, but its converse is not. We verify for (ii). As a witness to LHS ⊭ RHS, Put D = {1}, v(P) = ∅ = v(Q). You may find it easier to process this mentally if you translate from ! to _. To show RHS ⊨ LHS, suppose v(LHS) = 0. Using say the substitutional reading, we have v(Pa!Qa) = 0 for every constant a so, for every constant a, both v (Pa) = 1 and v(Qa) = 0. Since v(Qa) = 0 for every constant a, we also have v(9x(Qx)) = 0. Choosing the constant a with v(a) = 1, we also have v (Pa) = 1 so v(9x(Px)) = 1. Putting these together, v(RHS) = 0 as desired. (c) (i) Put a = Px ^ ¬8x(Px), (ii) b = Px _ ¬9x(Px). (d) (i) Vacuously, every valuation makes all elements of ∅ true. (d) (ii) {a} is consistent iff there is some valuation v with v(a) = 1, which holds iff a is not a contradiction. (d) (iii) Suppose that A is consistent. Then there is a valuation v with v(a) = 1 for all a 2 A. But v(p ^ ¬p) = 0, so A ⊭ p ^ ¬p. Conversely, suppose that A is inconsistent. Then there is no valuation v with v(a) = 1 for all a 2 A so, a
324
9 Something About Everything: Quantificational Logic
fortiori, there is no valuation v with both v(p ^ ¬p) = 0 and v(a) = 1 for all a 2 A. (d) (iv) Let A be a set of formulae and B A. If A is consistent then there is a valuation v with v(a) = 1 for all a 2 A, in which case v(a) = 1 for all a 2 B, so B is consistent. (d) (v) Let A be a finite set of formulae and let ^A be the conjunction of all its elements. Now, A is consistent iff there is a valuation v with v(a) = 1 for all a 2 A, which holds iff v(^A) = 1. The reason why we needed the qualification ‘finite’ is that the language of first-order logic does not contain infinitely long conjunctions. Exercise 9.5 (4) Fundamental rules (a) Give a simple example of how the rule 8+ can fail if its proviso is not respected. (b) Give two simple examples of how the rule 9− can go awry if its proviso is ignored, one with a free occurrence of x in an, the other with a free occurrence of x in one of a1, …, an−1. Solution (a) Recall that the rule 8+ says: whenever A ⊨ a then A ⊨ 8x(a), provided the variable x has no free occurrences in any formula a 2 A. Example of violation if its proviso is not respected: put a = Px, A = {a}. Clearly {Px} ⊨ Px but {Px} ⊭ 8x(Px) as is easily witnessed in the two-element domain {1,2} with v(x) = 1, v(P) = {1}. (b) Recall that the rule 9− says: whenever A, b ⊨ c then A, 9x(b) ⊨ c, provided the variable x has no free occurrences in any formula a 2 A [ {c}. Example of violation if its proviso is not respected: put A = ∅, a = b = Px. Clearly {Px} ⊨ Px but {9x(Px)} ⊭ Px as is easily witnessed in the two-element domain {1,2} with v(x) = 1, v(P) = {0}. It is no accident that the solutions to (a) and (b) are so similar; the rules 8+, 9− are themselves essentially the same when we take for granted the principles of quantifier interchange and suitable tautologies. The same can be said for 8−, 9+.
9.6
Selected Reading
Essentially the same books as for propositional logic with later chapters; for example the following. For computer science students: James Hein Discrete Structures, Logic and Computability, Jones and Bartlett 2002 (second edition), chapter 7; Michael Huth and Mark Ryan Logic in Computer Science, Cambridge University Press 2000,
9.6 Selected Reading
325
chapter 4; on a more advanced level Mordechai Ben-Ami Mathematical Logic for Computer Science, Springer 2001 (second edition), chapters 5–7. For students of philosophy and linguistics: L.T.F. Gamut Logic, Language, and Meaning Volume I: Introduction to Logic, University of Chicago Press 1991, chapters 3–4. For the general reader: Wilfrid Hodges Logic. Penguin 1977, sections 34–41.
Just Supposing: Proof and Consequence
10
Chapter Outline In the last two chapters we learned some of the basics of propositional and quantificational logic and, in particular, the relations of logical implication that they provide. In this chapter, we look at how simple logical implications may be put together to make a deductively valid argument, or proof. At first glance, this may seem trivial: just string them together! But although it starts like that, it goes well beyond and is, indeed, quite subtle. We begin by looking at the easy process of chaining, which creates elementary derivations, and show how its validity is linked with the Tarski conditions defining consequence relations/operations. We then review several higher-level proof strategies used in everyday mathematics and uncover the logic behind them. These include the strategies traditionally known as conditional proof, disjunctive proof (and the closely related proof by cases), proof by contradiction, as well as arguments to and from an arbitrary instance. Their analysis leads us to distinguish firstlevel from second-level and split-level rules, articulate their recursive structures and explain the informal procedure, in mathematical practice, of flattening a split-level proof into its familiar ‘suppositional’ form.
10.1
Elementary Derivations
We begin with an example, and then see what is required in order to make it work. While reading this section, the reader is advised to have at hand the tables of basic tautological implications and equivalences from Chap. 8.
© Springer Nature Switzerland AG 2020 D. Makinson, Sets, Logic and Maths for Computing, Undergraduate Topics in Computer Science, https://doi.org/10.1007/978-3-030-42218-9_10
327
328
10 Just Supposing: Proof and Consequence
10.1.1 My First Derivation Tree Suppose that we are given three propositions as assumptions (also called, more traditionally, premises) and that they are of the form (p _ ¬q) ! (s ! r), ¬s ! q, and ¬q. We want to infer r. How can we do it? This is, in effect, a matter of showing that {(p _ ¬q) ! (s ! r), ¬s ! q, ¬q} ⊨ r so, in principle, we could use a truth-table with 24 = 16 rows, or a semantic decomposition tree as in Chap. 8. But there is another method that parallels much more closely how we would tackle such a problem intuitively. We can apply some basic tautological implications or equivalences with which we are already familiar (e.g. from the tables in Chap. 8) and chain them together to get the desired conclusion out of the assumptions given. Specifically, from the third premise we have p _ ¬q by addition (_+), and from this together with the first premise we get s ! r by modus ponens (!−). But from the third premise again, combined this time with the second one, we have ¬¬s by modus tollens, which evidently gives us s by double negation elimination. Combining this with s ! r gives us r by modus ponens, as desired. One way of setting this out, which takes up a lot of page-space but helps bring out clearly the structure of the derivation, is as a labelled derivation tree as in Fig. 10.1. Such a tree is conventionally written with leaves at the top, since it is usually constructed from the leaves to the root. The leaves are labelled by the premises (alias assumptions) of the inference. The parent of a node (or pair of nodes) is labelled by the proposition immediately inferred from it (resp. them). If desired, we may also label each node with the usual name of the inference rule used to get it or, in the case of the leaves, give it the label ‘premise’. Note that the labelling function in the example is not quite injective: there are two distinct leaves labelled by the third premise. Exercise 10.1.1 What happens to the tree in Fig. 10.1 if we merge the two nodes labelled ¬q? Solution It would no longer be a tree, only a graph. Nothing intrinsically wrong with that, but it turns out to be more convenient to represent derivations as trees rather than as graphs. End of solution.
Fig. 10.1 Example of a labelled derivation tree
10.1
Elementary Derivations
329
Table 10.1 Example of a derivation displayed as a sequence with annotations Number
Formula
1 2 3 4 5 6 7 8
(p _ ¬q) ! (s ! r) ¬s ! q ¬q p _ ¬q s!r ¬¬s s r
Obtained from
By rule
3 4, 1 3, 2 6 7, 5
Premise Premise Premise Addition Modus ponens Modus tollens Double negation Modus ponens
Given the convention of linearity that is inherent in just about all traditional human writing systems, a derivation such as the above would not normally be written out as a tree, but as a finite sequence. This is always possible and may be accompanied by annotations to permit unambiguous reconstruction of the tree from the sequence. The process of transforming a derivation from tree to sequence layout may be called squeezing the tree into linear form. Table 10.1 gives an annotated sequence of formulae corresponding to the tree in Fig. 10.1. The sequence itself is in the second column, numbered in the first column and with annotations in the third and fourth columns. The linear form is the one with which the layman first thinks of, with vague memories of proofs done at school, and is the presentation that one finds most commonly in elementary logic texts. One begins with the premises and works one’s way, proposition by proposition, to the conclusion. Building a derivation like this is often called chaining. Although tree presentations reveal structure more readily to the eye, linearization has practical advantages. It takes up less space on the handwritten page, and is easier to write down using current word-processing software. A further advantage to linearization is that it eliminates the need to repeat propositions that may have occurred at more than one node in the tree. The saving may appear derisory; indeed, it is so in our example, which is short and the repeated formula ¬q is a premise appearing only twice, each time as a leaf in the tree. But it is easy to imagine a long derivation in which a proposition is called upon, perhaps several times, near the conclusion. In tree form, this will be represented by a large tree with a node repeated near the root, and that forces repetition of the entire subtree above it, from the node in question, to the leaves from which it was obtained. In such cases, the amount of repetition can become very significant. It should be intuitively clear from the example considered in Fig. 10.1 and Table 10.1, that we can algorithmically ‘squeeze’ any derivation tree into an annotated derivation sequence without repetitions; conversely, we can ‘unfold’ any linearly presented derivation into tree form. For the squeezing operation to be
330
10 Just Supposing: Proof and Consequence
well-defined, one needs a convention to choose the order in which nodes of the tree are listed that is consistent with each node being preceded by its parent(s). For the unfolding operation to be injective the linear presentation needs to have enough labelling to indicate which predecessor(s) each item was obtained from.
10.1.2 The Logic behind Chaining That is all very easy, but it gives rise to a rather subtle question. What guarantee do we have that when each of the individual steps in a derivation sequence/tree is valid (that is, corresponds to a logical implication in the sense of Chaps. 8 or 9) then their combination is valid? In other words, how can we be sure that the conclusion of the derivation (root of the tree) is implied by the premises (leaves) taken together, no matter how distant they are from each other? In the example, how can we be sure that the propositions (1) through (3) given as premises really do tautologically imply the proposition (8)? The first answer that comes to mind is that we are just applying the transitivity of ⊨. But while transitivity is indeed involved, there is more to it than that. In our example, we want to show that each formula a in the sequence is tautologically implied by the three premises numbered taken together. We consider them in turn, using the numbers in the leftmost column of Table 10.1 as names of the corresponding formulae in the next column. First, we want to check that formula 1 is implied by the set {1,2,3}. Clearly, this requires a principle even more basic than transitivity, namely that a formula is a consequence of any set of formulae of which it is an element. Known as strong reflexivity, it says: A a whenever a 2 A: Formulae 2 and 3 are checked in a similar manner. What about 4? We saw that it is tautologically implied by 3, but we need to show that it is tautologically implied by the set {1,2,3}. For this we need a principle called monotony. It tells us that whenever c is a consequence of a set A, then it remains a consequence of any set obtained by adding any other formulae to A. In other words, increasing the stock of premises never leads us to drop a conclusion: B b whenever both A b and A B: In our example A = {3}, b = 4 and B = {1,2,3}. What about 5? In the annotations, we noted that it is obtained from {1,4}, so monotony tells us that it implied by {1,2,3,4}. But we need to show that it is tautologically implied by {1,2,3}, so we need to ‘get rid of’ 4. We are in effect using the following principle, called cumulative transitivity, where in our example A = {1,2,3}, B = {4} and c = 5. A c whenever both A b for all propositions b 2 B and A [ B c:
10.1
Elementary Derivations
331
All three of these principles—strong reflexivity, monotony and cumulative transitivity—are needed to ensure that when each individual step in a derivation is justified by an inference relation ⊨ (in this example, that of tautological implication) then so too is the combination of those steps. The surprising thing is that the three are not only necessary for the job; together they suffice to do it. Inference relations satisfying them are thus very important and are called consequence relations. In the next section we study them closely, showing that they do indeed suffice to guarantee the validity of chaining. Exercise 10.1.2 (a) Complete the enumeration for the sequence in Table 10.1 by considering formulae 6, 7, 8 in turn and noting the application of the principles of strong reflexivity, monotony, and/or transitivity. (b) (i) Construct an elementary derivation for {¬q _ p, ¬r ! ¬p, s, s!¬r, t!p} ⊨ ¬t ^ ¬q as an annotated derivation sequence. (ii) What happens if you transform this sequence into a tree? Solution (a) To check that {1,2,3} ⊨ 6 we first note that {2,3} ⊨ 6 (by modus tollens, as recorded in the annotation) and then apply monotony. For {1,2,3} ⊨ 7, we first note that 6 ⊨ 7 (by double negation elimination, as annotated), so {1,2,3,6} ⊨ 7 by monotony. But we already know that {1,2,3} ⊨ 6, so we may apply cumulative transitivity to get the desired {1,2,3} ⊨ 7. For the last check, that {1,2,3} ⊨ 8, note that {7,5} ⊨ 8 (by modus ponens as indicated in the table) so by monotony {1,2,3,7,5} ⊨ 7. But we already know that {1,2,3} ⊨ 5 and {1,2,3} ⊨ 7, so we may once more apply cumulative transitivity to get {1,2,3} ⊨ 7 as desired. From these verifications, you may get the impression that when chaining we are implicitly using cumulative transitivity over, and over, again. That impression is correct. (b) (i) See Table 10.2. (ii) In the derivation, we appeal to item 7 twice: first for a modus ponens and again for a disjunctive syllogism. Transforming this into a tree (rather than just into a graph) requires that we repeat the part of the tree that leads up to 7; that will give us 5 + 3 = 8 leaves and a total of 15 nodes (try it). The tree structure is clearer, but the repetition is tedious.
10.2
Consequence Relations
We now abstract on the material of Sect. 10.1 to define the general concept of a consequence relation, establish its relationship to elementary derivations, and show how it may also conveniently be expressed as an operation.
332
10 Just Supposing: Proof and Consequence
Table 10.2 Answer to Exercise 10.1.2 (b) Number
Formula
1 2 3 4 5 6 7 8 9 10
¬q _ p ¬r ! ¬p s s ! ¬r t!p ¬r ¬p ¬t ¬q ¬t ^ ¬q
Obtained from
By rule
3, 4 6, 2 7, 5 7,1 8, 9
Premise Premise Premise Premise Premise Modus ponens Modus ponens Modus tollens Disjunctive syllogism Conjunction
10.2.1 The Tarski Conditions Let ⊢ be any relation between sets of formulae on its left (the formulae coming from the language of propositional, quantificational, or some other logic), and individual formulae (of the same language) on its right. We use the symbol ⊢, similar to ⊨ for logical implication, because it will be treated as an abstraction on that relation. It is called a consequence relation iff it satisfies the three conditions that we isolated in the previous section. Strong reflexivity: A ⊢ a whenever a 2 A Monotony: Whenever A ⊢ b and A B then B ⊢ b Cumulative transitivity: Whenever A ⊢ b for all b 2 B and A [ B ⊢ c then A ⊢ c A few words on terminology may be useful. Strong reflexivity is sometimes called ‘identity’, though that could possibly give rise to confusion with principles for the identity relation in first-order logic. ‘Monotony’ is sometimes written ‘monotonicity’. Cumulative transitivity is often called ‘cut’ (but be careful, there are a number of variants that are also given that name). The three conditions are often called the Tarski conditions in honour of Alfred Tarski, who was perhaps the first to realize their joint importance. Algebraically-minded logicians often call consequence relations logical closure relations, as they are just a particular case of the closure relations/operations that play a very important role in abstract algebra. The notion of the closure of a set under a relation that we studied in Chap. 2 Sect. 2.7 is another particular case of the same general concept. Given a relation ⊢ between sets of formulae and individual formulae, we reduce clutter by writing a1,…, an ⊢ b to abbreviate {a1,…, an} ⊢ b and in particular a ⊢ b for {a} ⊢ b. To mark the contrast with strong reflexivity and cumulative transitivity, the conditions of reflexivity (a ⊢ a) and transitivity (whenever a ⊢ b and b ⊢ c then a ⊢ c) may sometimes be called plain reflexivity and transitivity.
10.2
Consequence Relations
333
Exercise 10.2.1 (1) (a) Show that both tautological implication in propositional logic and logical implication in quantificational logic are indeed consequence relations. (b) Show that (i) strong reflexivity immediately implies plain reflexivity, (ii) plain reflexivity together with monotony implies strong reflexivity. (c) Give a simple example of a relation (between sets of formulae on the left and formulae on the right) that satisfies both monotony and cumulative transitivity but does not satisfy strong or even plain reflexivity. Solution (a) We can use a single argument to cover both propositional and first-order logic, by considering valuations without bothering to specify which of the two languages we are considering. For strong reflexivity: Suppose a 2 A. Then any valuation that makes all formulae in A true, makes a true, so A ⊨ a. For monotony: Suppose A B and A ⊨ b. Let v be any valuation that makes all formulae in B true. Then it makes all formulae in A true so, since A ⊨ b, it makes b true. Cumulative transitivity is a tad less immediate. Suppose A ⊨ b for all b 2 B and A [ B ⊨ c; we need to show A ⊨ c. Let v be any valuation, and suppose v(a) = 1 for all a 2 A; we need to get v(c) = 1. By the first supposition we have v(b) = 1 for all b 2 B. Thus v(v) = 1 for all v 2 A [ B. Hence by the second supposition, v(c) = 1. (b) (i) Assume strong reflexivity and consider any formula a. Put A = {a}. Since a 2 A, strong reflexivity tells us that A ⊢ a, that is, a ⊢ a. (ii) Assume plain reflexivity and monotony. Consider any formula a and set A with a 2 A. By plain reflexivity, a ⊢ a, that is, {a} ⊢ a so, since {a} A, monotony tells us that A ⊢ a. (c) The empty relation is the simplest. For an example that is less of a limiting case, put A to have the relation to a iff a is a tautology in A. End of solution.
While, as verified in Exercise 10.2.1 (1)(a), classical logical implication satisfies all three of the Tarski conditions, it should also be appreciated that neither monotony nor cumulative transitivity is appropriate, in unrestricted form, for relations of uncertain inference (or, as one says in another terminology, non-deductive as opposed to deductive inference). Monotony fails under both probabilistic and qualitative accounts of uncertain reasoning and, while cumulative transitivity is acceptable under some qualitative accounts, it too fails probabilistically. But that goes beyond our present concerns; the guide to further reading at the end of the chapter gives a pointer.
334
10 Just Supposing: Proof and Consequence
Exercise 10.2.1 (2) (a) Sketch an intuitive example of non-deductive reasoning (say, an imaginary one concerning the guilt of a suspect in a criminal case) that illustrates how the principle of monotony may fail for uncertain reasoning. (b) Give an intuitive explanation why plain transitivity is not appropriate for uncertain inference. Solution (a) Consider the following scenario. The testimony of a number of eyewitnesses, expressed in the premise-set A, gives reasonable grounds for believing that the suspect committed the crime c. But traces of DNA left by the assassin on the murder weapon are quite different from that of the suspect; call this evidence b. Then A supports c but A [ {b} may not support c; in some cases, it may even support another conclusion that is incompatible with c. (b) One way of illustrating this is in terms of an intuitive notion of risk. When we pass from a to b non-deductively, there is a small risk of losing truth, and passage from b to c may likewise incur a small risk. Taking both steps compounds the risk, which may thereby exceed a reasonable threshold that is respected by each of the separate steps. Thus, the strength of the chain is in general even less than that of its weakest link.
10.2.2 Consequence and Chaining We are almost ready to articulate in a rigorous manner the fact that the chaining is always justified for consequence relations. First, we define, more carefully than before, the notion of an elementary derivation. Let ▷ be any relation between sets of formulae and individual formulae of a formal language. To guide intuition, think of ▷ as (the union of the instances of) some small finite set of rules like ^+, _+, !−, or others that you select from the logical implication tables of Chaps. 8 and 9, or yet others that you find of interest. We do not assume that it satisfies any of the three Tarski conditions. Let A be any set of formulae, a an individual formula. We say that a finite sequence r = a1, …, an of formulae is an elementary derivation of a from A using the relation ▷ iff (1) an = a and (2) for every i n, either ai 2 A or B ▷ ai for some B {a1,…,ai-1}. This definition is in terms of sequences. It may equivalently be expressed in terms of trees. For intuition, continue to think of these trees as with their leaves at the top and the root at the bottom, like that of Fig. 10.1. We say that a finite tree T whose nodes are labelled by formulae is an elementary derivation of a from A using the relation ▷ iff (1) its root is labelled by a, (2) every leaf node in the tree is labelled by a formula in A, and (3) each non-leaf node x is labelled by a formula b such that the labels of the children of x form a set B of formulae with B ▷ b.
10.2
Consequence Relations
335
The soundness theorem for chaining tells us the following. Consider any relations ▷, ⊢ between sets of formulae and individual formulae of a formal language, such that ▷ ⊢ and ⊢ satisfies the three Tarski conditions. If there is an elementary derivation r = a1, …, an of a from A using ▷ then A ⊢ a. The proof of this is easy-once-you-see-it, but it can be difficult for a student to set it up from scratch, so we give it in full detail. It is most simply expressed in terms of sequences (rather than trees), and proceeds by cumulative induction on the length of the derivation (i.e. the number of terms in the sequence). The reader is advised to refresh memories of cumulative induction from Chap. 4 Sect. 4.5.2; in particular, it should be recalled that in this form of induction, we do not need a base (although one can put one in if one wishes), only an induction step. Suppose that ▷ ⊢ and ⊢ satisfies the three Tarski conditions, and that there is an elementary derivation r = a1, …, an of a from A using ▷. To show that A ⊢ a, it suffices to show by induction on i that A ⊢ ai for all i n. Let k n and suppose (induction hypothesis) that A ⊢ ai for all i < k; we need to show that A ⊢ ak. Now, by the definition of an elementary derivation either ak 2 A, or B ▷ ak for some B {a1,…,ak−1}. In the former case we have A ⊢ ak by strong reflexivity of ⊢. In the latter case, we have B ⊢ ak by the supposition that ▷ ⊢ so that (1) A [ B ⊢ ak by monotony of ⊢. But by the induction hypothesis we have (2) A ⊢ ai for all i 2 B. Applying cumulative transitivity to (2) and (1) gives us A ⊢ ak as desired. Alice Box: What did we use in this proof?
Alice
Hatter Alice
Hatter
It’s nice to see how that little proof appeals explicitly to each of the three Tarski conditions. But it does not seem to use the full power of monotony or cumulative transitivity. How is that? In the applications of those two conditions we needed only the case that B is finite, even when A is infinite. I wonder whether there is any significance in that? I have no idea …
Eagle eye! Alice is going beyond the boundaries of the text, but we can say a few words for those who are interested. Indeed, the proof goes through unchanged with versions of monotony and cumulative transitivity in which B is finite. For many inference relations ⊢, including classical consequence ⊨ in both propositional and first-order logic, the full and restricted versions are in fact equivalent. This is because those relations are compact in the sense that whenever A ⊨ a then there is some finite subset A′ A with A′ ⊨ a. But for relations ⊢ that are not compact (and they do exist, for what is known as second-order classical logic as well some non-classical logics, all beyond our remit) such restricted versions of monotony and cumulative transitivity can be weaker than their full versions.
336
10 Just Supposing: Proof and Consequence
Exercise 10.2.2 (a) Explain why the converse of compactness holds trivially for every consequence relation. (b) Show that if a relation ⊢ is both compact and monotonic, then whenever A is infinite and A ⊢ b there are infinitely many finite subsets X A with X ⊢ b. Solution (a) The converse of compactness says that whenever there is some finite subset A′ ⊢ A with A′ ⊢ a, then A ⊢ a. This holds immediately by monotony. (b) Suppose that ⊢ is both compact and monotonic, A is infinite and A ⊢ b. By compactness, there is some finite subset A′ ⊢ A with A′ ⊢ a. Then there are infinitely many finite subsets A′′ with A′ A″ A. By monotony, we have A″ ⊢ b for all of them.
10.2.3 Consequence as an Operation One can express the notion of logical consequence equivalently as an operation instead of a relation. This is often helpful, since its behaviour can usually be stated rather more succinctly in operational terms. Admittedly, the operational formulation does take a bit of time to get used to but, once you have it under your belt, you will find it very convenient. Let A be any set of propositions expressed in a formal language L like that of propositional or first-order logic and let ⊢ be any inference relation for that language. We define C: P(L) ! P(L) quite simply by putting C(A), for any A L, to be the result of gathering together all the propositions b such that A ⊢ b. Briefly, C (A) = {b: A ⊢ b}. When ⊢ is a consequence relation, that is, satisfies the three Tarski conditions, then the operation C has the following three properties, also called Tarski conditions. Inclusion: Idempotence: Monotony:
A C(A) C(A) = C(C(A)) C(A) C(B) whenever A B
These correspond to the properties for consequence as a relation and are easily derived from them (next exercise). Operations C: P(L) ! P(L) satisfying these three conditions are known to logicians as consequence operations and are instances of the general mathematical notion of a closure operation; the letter C is used to recall those words. Be warned, however, that in topology closure operations are sometimes required to satisfy the equality C(A) [ C(B) = C(A [ B) which does not hold for classical consequence (next exercise) and rarely holds for interesting non-classical consequence operations.
10.2
Consequence Relations
337
We have distinguished the notations for an arbitrary consequence relation ⊢ and the specific relation ⊨ of classical consequence. Similarly, while we write C for an arbitrary consequence relation, we will let Cn stand for the specific operation of classical consequence. By the definition, Cn(A) = {b: A ⊨ b}. Exercise 10.2.3 (a) Give a very simple example to show that (i) classical consequence does not satisfy the equality Cn(A) [ Cn(B) = Cn(A [ B). Show that nevertheless, (ii) the LHS RHS half holds for every consequence relation (including, therefore, classical consequence). (b) Show that the three Tarski conditions for logical consequence as an operation follow from those for consequence relations, via the definition C(A) = {b: A ⊢ b} given in the text. (c) What would be the natural way of defining consequence as a relation back from consequence as an operation? (d) Show that the three Tarski conditions for logical consequence as a relation follow from those for consequence operations, via the definition given in answer to (c). (e) (i) Express the equality C({a _ b}) = C{a} \ C{b} in terms of consequence relations and (ii) show that it holds for classical consequence ⊨. Solution (a) (i) Take two distinct elementary letters p, q and put A = {p}, B = {q}. Then p ^ q 2 RHS but p ^ q 62 LHS. (ii) A A [ B and also A A [ B so by monotony Cn(A) Cn(A [ B) and also Cn(B) Cn(A [ B) so Cn(A) [ Cn (B) Cn(A [ B). (b) For A C(A): Let a 2 A; we need to show that a 2 C(A), in other words by the definition of C, that A ⊢ a. This is immediate by the Tarski condition of strong reflexivity for ⊢. For C(A) C(A [ B): Let a 2 C(A), in other words, A ⊢ a. We need to show that a 2 C(A [ B), in other words that A [ B ⊢ a. Since A A [ B, this is given immediately by the Tarski condition of monotony for ⊢. For the identity C(A) = C(C(A)) we verify its two inclusions separately. Theinclusion C(A) C(C(A)) is an instance of the inclusion A C(A) (substituting C(A) for A), which we have already checked. For theconverse inclusion, suppose a 2 C(C(A)). We want to show that a 2 C(A), i.e. that A ⊢ a. On the one hand, we have C(A) = {b: A ⊢ b} by the definition of C, so (i) A ⊢ b for all b 2 C(A). On the other hand, since a 2 C(C(A)) we also have by the definition of C that C(A) ⊢ a so, by monotony for ⊢, (ii) A [ C(A) ⊢ a. Applying cumulative transitivity for ⊢ to (i) and (ii) gives A ⊢ a as desired. Remarks: Although it is short, this verification of C(C(A)) C(A) tends to give students headaches. Note that we need to appeal to both cumulative transitivity and monotony for ⊢, whereas for A C(A) we needed only strong reflexivity of ⊢ and, for C(A) C(A [ B), just monotony of ⊢.
338
10 Just Supposing: Proof and Consequence
(c) Put A ⊢ b iff b 2 C(A). (d) For strong reflexivity of ⊢, suppose a 2 A. Now, A C(A) by inclusion for C, so a 2 C(A), so A ⊢ a by the definition of ⊢. For monotony of ⊢, suppose A ⊢ a. Then a 2 C(A) by the definition of ⊢ so by monotony for C we have a 2 C(A [ B), that is A [ B ⊢ a. For cumulative transitivity of ⊢, suppose (i) A ⊢ b for all b 2 B and (ii) A [ B ⊢ c; we need to show that A ⊢ c. By the definition of ⊢, (i) tells us that B C(A); by inclusion for C also A C(A), so A [ B C(A), so C(A) = (A [ B) [ C(A). But by (ii), A [ B ⊢ c, that is, c 2 C(A [ B) C((A [ B) [ C (A)) = C(C(A)) = C(A) using monotony for the inclusion and idempotence of C for the last equality, so finally A ⊢ c as desired. Students usually find the last verification rather tricky. It is important to keep clearly in mind what you are supposing and what you are trying to get. Note that we needed all three Tarski conditions on C to establish cumulative transitivity for ⊢. (e) (i) a _ b ⊢ c iff a ⊢ c and b ⊢ c. (ii) For classical consequence, this says a _ b ⊨ c iff a ⊨ c and b ⊨ c and we verify the contrapositive a _ b ⊭ c iff a ⊭ c or b ⊭ c. Suppose LHS. Then for some valuation v, v(a _ b) = 1 while v(c) = 0. Hence either v(a) = 1 while v(c) = 0, or v(b) = 1 while v(c) = 0, so RHS as needed. For the converse, we run the same argument in reverse. Suppose RHS. Then for some valuation v, either v(a) = 1 while v(c) = 0, or v(b) = 1 while v (c) = 0. Hence v(a _ b) = 1 while v(c) = 0 and so RHS. If you don’t like all this negativity, you can equally well argue positively, supposing LHS of the original to get its RHS and then conversely.
10.3
A Higher-Level Proof Strategy: Conditional Proof
In this section and the next, we review some of the proof strategies that are used in traditional mathematical reasoning. These include conditional proof, disjunctive proof and its variant proof by cases, proof by contradiction, and finally proof to/from an arbitrary instance. Linguistically, they are typically marked by terms like ‘suppose’, ‘let x be an arbitrary such-and such’, or ‘choose any so-and-so’. From a logical point of view, they make use of higher-level rules as well as the implications deployed in chaining—which, for contrast, we refer to as first-level rules. We begin with the strategy known as conditional proof. We already said a few words about it in a logic box in Chap. 1, Sect. 1.2.2, but now we analyse the logical machinery behind it. We do so slowly and carefully, as conditional proof serves as an exemplar; after examining it, we can describe the other higher-level strategies rather more briskly.
10.3
A Higher-Level Proof Strategy: Conditional Proof
339
10.3.1 Informal Conditional Proof Consider a situation where we want to prove a conditional proposition b ! c, given background propositions a1, …, an that we are willing to take as known. The standard way of doing this is to make a supposition, and change the goal. We suppose the antecedent b of the conditional, and seek to establish, on this basis, the consequent c of that conditional. If we manage to get c out of {a1, …, an, b} then our proof is complete. From that point on, we disregard the supposition; it is like a ladder that we kick away after having used it to climb. This kind of reasoning is known as conditional proof, acronym CP. In everyday mathematics it is relatively rare to prove a bare conditional b ! c; usually it has, implicitly if not explicitly, one or more initial universal quantifiers. For example, we might want to prove (using facts we already know) that whenever a positive integer n is even then so is n2 which, taking the set of all positive integers as domain, may be written 8n(En ! En2). To prove that, we begin by stripping off the initial quantifier “whenever”; we first let n be an arbitrary positive integer, and only then suppose that n is even, going on to show that n2 is even. However, in our analysis we want to separate out the moves made for different logical connectives. Manipulations for the quantifiers will be discussed shortly; for now, we consider the situation in which conditional proof is the only method used beyond familiar chaining. Consider the following example: three premises (p ^ q) ! r, (t ! ¬s), (r ! (t _ u)) (these are the a1,…,an of our schematic description) from which we wish to prove (p ^ s) ! (q ! u) (the b ! c of the scheme). What do we do? We suppose p ^ s (b in the scheme) and reset our goal as q ! u (c in the scheme). That happens still to be a conditional, so we may iterate the procedure by supposing its antecedent q, with the desired conclusion now reset as u. If we succeed in getting u out of the five assumptions a1,…,a5 (three initial premises plus two suppositions), then our proof is complete. But it is straightforward to do that with an elementary derivation using some of the tautological implications from Chap. 8. Exercise 10.3.1 Write out the above proof in full, including the steps described as straightforward. Solution Given premises (p ^ q) ! r, (t ! ¬s), (r ! (t _ u)), suppose p ^ s in order to get q ! u. For that, suppose q in order to get u. The rest is chaining elementary inferences, as follows. From p ^ s we have p (by simplification) and from that with q we have p ^ q so, by modus ponens with the first premise, r. Another modus ponens with the third premise gives t _ u. But also, from p ^ s we have s (again by simplification), so (by double negation and modus tollens using the second premise) we get ¬t. Combining that with t _ u finally produces u (by disjunctive syllogism) as desired. End of solution. Sometimes when we want to prove a conditional b ! c, it is more convenient to prove its contrapositive ¬c ! ¬b. In that case we apply the same method to ¬c ! ¬b: we suppose ¬c and try to get ¬b. If we succeed, we have proven ¬c ! ¬b from
340
10 Just Supposing: Proof and Consequence
whatever the original premises were, and so we can finally apply the first-level implication of contraposition to end with the desired b ! c. This procedure is often known as contraposed or indirect conditional proof. However, it is important to realize that its central feature is still plain conditional proof, and for the purposes of logical analysis we continue to focus on that. A text more concerned with heuristics than logic would give the contraposed version more attention since it is very often employed as, for example, in the argument used in the sample solution to Exercise 10.2.3 (e).
Alice Box: Why bother with suppositions?
Alice Hatter Alice Hatter
Alice Hatter
Why bother making suppositions? Can’t we do it without them? How? Well, by a using truth-table or a semantic decomposition tree. The last example has 6 elementary letters, so the table will have 26 = 64 rows. The decomposition tree will also be quite big. That’s no problem for a computer but, manually, it is neither elegant nor convenient. Well, by an elementary derivation, without suppositions? Try it. It will be tricky to find and, if you succeed, the elementary deviation will be much longer and less transparent.
10.3.2 Conditional Proof as a Formal Rule Let’s articulate the logical rule underlying the procedure, expressing it in terms of an arbitrary inference relation ⊢. Quite simply, it is that A ⊢ b ! c whenever A [ {b} ⊢ c. Writing a slash for the central transition, it may be displayed as: A [ fbg ‘ c = A ‘ b ! c: The conventions for understanding this parenthesis-free display are that connectives are most cohesive, then set-theoretic union, then the turnstile, finally the slash. Full bracketing would write [(A [ {b}) ⊢ c] / [A ⊢ (b ! c)] but that is rather distracting so we omit the parentheses, hopefully without any risk of confusion. Often one abbreviates A [ {b} as A, b to write the rule even more economically: A; b ‘ c = A ‘ b ! c: When visual intuition is more important than saving page-space, one often replaces the slash by an extended horizontal bar, writing:
10.3
A Higher-Level Proof Strategy: Conditional Proof
341
A; b ‘ c A ‘ b ! c: The output A ⊢ b ! c of the rule is called its principal (or main) inference, while A, b ⊢ c is its subordinate inference (or sub-proof). The proposition b appears as the antecedent of the conclusion of the principal inference and functions as the supposition of the subordinate inference. Like the informal procedure that it underlies, the rule is known as conditional proof with acronym CP. It is often called !+ because an arrow is introduced as main connective of the conclusion of the principal inference. There are several important points that we should immediately note about conditional proof. They concern its shape, status, and benefits and apply, mutatis mutandis, to other higher-level rules to be explained in the following section. • In its present formulation, it is a second-level rule, in the sense that it takes us from the validity of an entire inference A, b ⊢ c to the validity of another inference A ⊢ b ! c. In this respect, it contrasts with the tautological implications and equivalences in tables of Chap. 8, all of which take us from various propositions as premises to a proposition as conclusion and are therefore called first-level rules. • It is correct for the inference relation ⊨ of classical (tautological or first-order) logical implication. That context is the only one that we will be considering specifically in this chapter, but we will continue to formulate conditional proof in terms of an arbitrary consequence relation, using the sign ⊢, since it is also correct for many non-classical inference relations for logics. • When carrying out a deduction, conditional proof makes life easier because it gives us more premises to play around with. While the principal inference A ⊢ b ! c has n premises, the subordinate inference A, b ⊢ c has n + 1 of them. That gives us one more premise to grab. If conditional proof is iterated, as in our example, then each application makes another premise available. • Finally, the conclusion c of the subordinate argument has one less occurrence of a connective than the conclusion b ! c of the principal argument. In this way, it reduces the question of obtaining a conditional conclusion to that of getting a logically simpler one. In all of the second-level rules that will be considering, indeed in all of those routinely employed in mathematics, the premises of the subordinate inference form a superset of the premises of the principal inference. This property permits great simplifications of presentation for derivations, as we will see shortly; we say that such rules are incremental. More specifically, for most of the rules the premises of the subordinate inference form a proper superset with just one additional element, functioning as the supposition of the sub-proof. In one of the second-level rules, for the universal quantifier, the premise sets of the principal and subordinate inferences are identical, with no supposition made.
342
10 Just Supposing: Proof and Consequence
Now, conditional proof may be written in another way, as what we will call a split-level rule. Whereas the second-level formulation allows us to pass from an inference A, b ⊢ c to the corresponding inference A ⊢ b ! c, the split-level formulation authorizes passage from the propositions in A taken together with the inference A, b ⊢ c, to the proposition b ! c. The split-level rule thus passes from various propositions plus an inference, to a proposition. It may be written with a slash: A; A; b ‘ c = b ! c or with a horizontal bar: A; A; b ‘ c b ! c: This too is incremental, in that the premise-set A [ {b} of the input inference is a superset (by just one element) of the input set A of propositions. Second-level formulations are used in what are called sequent calculi while split-level ones are employed in natural deduction. Both were developed in the 1930s: sequent calculi by Gerhard Gentzen (building on earlier hints of Paul Hertz), natural deduction independently by Gentzen and Stanisław Jaśkowski. Exercise 10.3.2 Show that conditional proof, in both its second-level and split-level forms, is correct for classical consequence. Solution (a) This can be done in essentially the same fashion for the two kinds of formulations. For brevity, write v(A) = 1, where A is a set of formulae, as shorthand for v(a) = 1 for all a 2 A. For the second-level version, we argue contrapositively: Suppose that A ⊭ b ! c; we want to show that A, b ⊭ c. By the supposition, there is a valuation v with v (A) = 1 and v(b ! c) = 0. Then v(b) = 1, v(c) = 0, so v(A [ {b}) = 1 while v (c) = 0, so A, b ⊭ c as desired. For the split-level version: Suppose that A, b ⊨ c and v is a valuation with v (A) = 1; we need to show that v(b ! c) = 1. If v(b) = 0 then v(b ! c) = 1 as desired. On the other hand, if v(b) = 1 then v(A [ {b}) = 1 so v(c) = 1 and thus again v(b ! c) = 1 as needed. End of solution. Derivations using only second-level rules are extremely tedious to construct by hand because of the immense amount of repetition that they generate. On the other hand, they can be very helpful for studying the behaviour of a logical system, because they lend themselves to the systematic application of complex inductive arguments on well-orderings of derivations. Such investigations make up what is
10.3
A Higher-Level Proof Strategy: Conditional Proof
343
known as proof theory, a subject that forms a world of its own with a vast literature; there is a pointer in the guide at the end of the chapter. Derivations using split-level rules lend less suited for abstract studies about logic, but they have a great advantage for conducting the everyday business of inference. When they are incremental in the sense defined above, derivations employing them can be ‘flattened’ to mimic first-level derivations, reducing repetition radically and paralleling the informal style that mathematicians have refined over the centuries to communicate their proofs with minimum fuss. We describe the flattening operation in the next section.
10.3.3 Flattening Split-Level Proofs It is not possible to combine first-level rules directly with second-level ones. The inputs and and output of the former are propositions while the inputs and output of the latter are inferences, so an input or output of one cannot be, respectively, an output or input of the other. But first-level rules do combine easily with split-level ones. Since the output of a split-level rules is a proposition, as are some of is inputs, the former can readily serve as input and the latter as output of first-level rules. A proof using both split-level and first-level rules will thus be a finite tree or sequence with a mix of nodes. Some nodes will be labelled by propositions while others will be labelled by inferences known as sub-proofs. When all higher-level rules employed are incremental, it is possible to rewrite such a tree or sequence as one where all nodes are labelled by propositions-with-annotations, thus mimicking a first-level derivation but with a bit more book-keeping. This is the operation we call flattening. Flattening is most easily described in terms of sequences. In a sequence serving as a derivation using both first-level and split-level rules, we replace each point in the sequence that is labeled by a sub-proof, by a sequence of propositions beginning with the premises (if any) of the sub-proof that are additional to those already assumed, labelling them as suppositions, and continue with the propositions of the sub-proof until its conclusion is reached, at which point another label indicates that the supposition is ‘de-supposed’ or, as is usually said, discharged. In the case of conditional proof in split-level format, A; A, b ⊢ c / b ! c, this means that we add to the premises A of the main proof the incrementing premise b of the sub-proof, calling it a supposition and making free use of it as well as the original premises in A until we reach the conclusion c of the sub-proof, where we annotate that the supposition is no longer active (discharged) and, by the rule of conditional proof, claim that b ! c may be concluded from the original premises A alone. In brief, given the premises in A, and wanting to get b ! c, the original split-level proof carries out a sub-proof of c from A [ {b}. The flattened version thus carries out the following procedure: • Given A, wanting to get b ! c: • Suppose b
344
10 Just Supposing: Proof and Consequence
• Argue to c, • Discharge b, • Conclude b ! c from A alone. The advantage of such flattening is practical. By integrating the sub-proof into the main proof it cuts down on repetition. In the unflattened derivation we needed to repeat all the inputs in A as premises of the subordinate inference A, b ⊢ c; in the flattened version they appear only once. That may seem a very meagre gain but in practice it makes things much more manageable, at least for humans as contrasted with computers—especially when there are multiple embedded sub-proofs, each with many premises. On the other hand, flattening can have the conceptual side-effect of moving the recursion contained in the very notion of split-level proof out of the spotlight to the back of the stage. By mimicking an elementary derivation, it can lead the unwary student into thinking that it is one. To avoid misunderstandings of that kind, a flattened presentation should retain enough annotative signals such as the label ‘suppose’ and indication of points of discharge, to let the reader know where the recursions are, permitting in principle recovery of the split-level or second-level derivations in full. All of this applies, mutatis mutandis, to the other higher-level proof rules that will be explained in following sections. In each case, the higher-level rule is incremental, so that flattening is possible. Recapitulating the chapter so far, we have noted two ways of reducing repetition in a derivation. One, described in Sect. 10.1.1, was called squeezing; the other, described in this section, is flattening. They should not be confused. In a nutshell, one can say that squeezing takes trees to sequences, while flattening puts split-level reasoning into a format resembling first-level reasoning. More specifically: • Squeezing may be applied to any derivation in tree form, transforming it into a sequence accompanied by some labels to record its pattern of justification. This eliminates the obligation that trees impose on us to repeat propositions that are appealed to more than once, thereby also repeating the subtrees above them. This operation is always possible. • On the other hand, flattening transforms arguments that combine first-level with split-level rules (independently of whether they are in tree or sequence form) into structures that mimic elementary derivations in that they contain only propositions, but which have the implicit application of higher-level rules flagged by further labels such as ‘suppose’ and indicating points of discharge. This allows us to forbear repeating in the sub-proofs all among their premises that are already premises of the main proof. It is possible when all split-level rules employed are incremental.
10.4
10.4
Other Higher-Level Proof Strategies
345
Other Higher-Level Proof Strategies
Now that we have a clear picture of what is going on behind the scenes in a conditional proof, we can review more easily other higher-level proof strategies, namely disjunctive proof and the closely related method of proof by cases, proof by contradiction, also known as reductio ad absurdum, and proofs to and from arbitrary instances.
10.4.1 Disjunctive Proof and Proof by Cases We said a little about disjunctive proof in a logic box of Chap. 1, Sect. 1.4.2; now we dig deeper. Consider a situation where we have among our premises, or have already inferred, a disjunction b1 _ b2. We wish to establish a conclusion c. The disjunction doesn’t give us much definite information, so how can we make good use of it? One way is to translate it into a conditional ¬b1 ! b2 and try to apply modus ponens or modus tollens, but that will work only when our original premises logically imply one of ¬b1, ¬b2, which will not often be the case. However, we can tackle the problem in another way, by a ‘divide and rule’ strategy. We first suppose b1 and try to get the same conclusion, c. If we succeed, we discharge that supposition without yet concluding anything, and suppose b2 aiming again at c. If we succeed again, we discharge the second supposition and conclude c from whatever our original premises were. This is disjunctive proof, acronym DP. Again, it is not usual in mathematical arguments for disjunctive proof to occur in isolation. More commonly, the information available will be of the kind 8x(b1 _ b2) or 8x[a ! (b1 _ b2)], and we have to peel off the outer quantifier and, in the second kind, start a conditional proof before working on the disjunction. For example, we might wish to show that for any sets A, B, P(A) [ P(B) P(A [ B). We first let A, B be arbitrary sets, suppose for conditional proof that X 2 P(A) [ P(B) and reset our goal as X 2 P(A [ B). From the supposition we know that either X 2 P(A) or X 2 P(B), so we are now ready to apply disjunctive proof. We first suppose that X 2 P(A) and argue to our current goal X 2 P(A [ B); then we suppose that X 2 P(B) and do the same. If we succeed in both, we are done. Exercise 10.4.1 (1) (a) Does it matter which disjunct we handle first? (b) Do we need to require that the two disjuncts are exclusive, that is, that they cannot both be true? (c) Construct informal verbal arguments explicitly using disjunctive proof to show that (A [ B) C (A C) [ (B C) and conversely.
346
10 Just Supposing: Proof and Consequence
Solution (a) No, it does not matter which disjunct is dealt with first, because the two subordinate arguments are independent of each other. In practice, it is good style, because better communication, to cover the easier sub-proof first. (b) No, we don’t need to require that the two disjuncts are exclusive. When they are both true, the situation is covered twice, once by each of the sub-proofs. That said, it is a little inelegant to cover the same ground twice, and it is sometimes possible to choose one’s disjuncts so that they are exclusive without introducing other complications. (c) To show LHS RHS, suppose (x,y) 2 LHS. Then x 2 A [ B and y 2 C. By the former, either x 2 A or x 2 B. Suppose first that x 2 A. Then (x,y) 2 A C RHS. Suppose alternatively that x 2 B. Then (x,y) 2 B C RHS. Thus in both cases (x,y) 2 RHS, as desired. For the converse, suppose (x,y) 2 RHS. Then either (x,y) 2 A C or (x,y) 2 B C. Suppose first that (x,y) 2 A C. Then x 2 A and y 2 C so x 2 A [ B and y 2 C so (x,y) 2 LHS. Suppose alternatively that (x,y) 2 B C. Then x 2 B and y 2 C so x 2 A [ B and y 2 C so again (x,y) 2 LHS. End of solution.
What is the logical rule underlying disjunctive proof? Expressing it incrementally, it is: A; b1 _ b2 ; b1 ‘ c; A; b1 _ b2 ; b2 ‘ c = A; b1 _ b2 ‘ c: In other words, when the two inferences expressed by turnstiles to the left of the slash are correct, then so is the inference expressed by the turnstile to the right of the slash. Of course, for classical consequence (or anything reasonably like it) we have b1 ⊢ b1 _ b2 and b2 ⊢ b1 _ b2 so, for such consequence relations, the rule may be expressed more succinctly without b1 _ b2 appearing as a premise in the subordinate inferences. That gives us the following more succinct and familiar version: A; b1 ‘ c; A; b2 ‘ c = A; b1 _ b2 ‘ c: This is the formulation of disjunctive proof that we will usually refer to, with acronym DP and often known as _− because it eliminates a disjunction.
Alice Box: Why is this described as elimination?
Alice Hatter
Why do you say that DP eliminate disjunction? Surely it introduces the disjunction into the principal inference! Indeed it does; in this respect, it is like the rule 9− discussed in Chap. 9, Sect. 9.4.3. But notice that each of DP and 9− introduces its connective into the premises of the principal inference, not into the conclusion of the principal inference. To appreciate the rationale
10.4
Other Higher-Level Proof Strategies
Alice Hatter
347
for the names 9−, _−, you should understand that the minus signs do not refer to what happens in the transition from subordinate inference to principal inference, but rather what takes place in the passage from the premises of the principal inference to the conclusion of that same inference. Each of the rules _−, 9− eliminates its connective in that passage. That’s weird! What would you expect from a mad hatter? But seriously, it brings out a deep pattern that will be defined precisely at the end of the chapter
Exercise 10.4.1 (2) Verify that the rule of disjunctive proof, in both its succinct and incremental versions, is correct for classical consequence. Solution Consider first the succinct version. Suppose A, b1 _ b2 ⊭ c. Then there is a valuation v such that v(b1 _ b2) = 1, v(c) = 0 and v(A) = 1 (recall from Exercise 10.3.2 that this is shorthand for v(a) = 1 for all a 2 A). Then either v(b1) = 1 or v(b2) = 1. In the former case we have v(A) = 1, v(b1) = 1, v(c) = 0 so A, b1 ⊭ c. In the latter case we have v(A) = 1, v(b2) = 1, v(c) = 0 so A, b2 ⊭ c and the verification is complete. The same verification works with minimal editing for the incremental formulation. End of solution. Of course, in Exercise 10.4.1 (2) we are using disjunctive proof informally in the meta-language to verify the correctness of its formal articulation in the object-language; but this is a pervasive phenomenon that we have already seen several times in Chaps. 8 and 9 and there is no point in trying to disguise it. What would a split-level formulation of disjunctive proof look like? Consider the succinct formulation, A, b1 ⊢ c; A, b2 ⊢ c / A, b1 _ b2 ⊢ c. We would move A, b1 _ b2 across from its position as premise of the principal inference, to become a third input to the rule, giving us: A; b1 _ b2 ; A; b1 ‘ c; A; b2 ‘ c = c: In words: proposition c is true whenever b1 _ b2 as well as all propositions in A are true and the inferences A, b1 ⊢ c and A,b2 ⊢ c are both valid. Just as for conditional proof, this split-level-formulation can be flattened to look like this: Given A and b1 _ b2, wanting to get c: Suppose b1 Argue to c Discharge b1
348
10 Just Supposing: Proof and Consequence
Suppose b2 Argue to c again Discharge b2 Conclude c as desired. For disjunctive proof, flattening reduces repetition even more than it does for conditional proof. A single application of the unflattened version of split-level DP would write all the propositions in A three times, once for each input; a flattened version writes them only once, in the top line of the above schematic presentation. Exercise 10.4.1 (3) Given premises p ! ((r _ s) ! t), q ! (¬(s _ u) _ t), s, get the conclusion (p _ q) ! t, by a semi-formal suppositional argument using both conditional and disjunctive proof strategies. Solution Assume as premises p ! ((r _ s) ! t), q ! (¬(s _ u) _ t), s; we want to get (p _ q) ! t. Suppose (for a conditional proof) p _ q; our goal now is t. Suppose first (for disjunctive proof) p. Then by modus ponens on the first premise we have (r _ s) ! t. We also have s as third premise so an application of _ + provides r _ s so by modus ponens we have t as desired. Discharge the first supposition for disjunctive proof and make the second supposition q. Modus ponens on the second premise yields ¬(s _ u) _ t. But since we have s as third premise, we have s _ u; double negating it ¬¬(s _ u) permits us to carry out disjunctive syllogism yielding t again. Discharging the second supposition for disjunctive prof leaves us with t on the supposition p _ q. Discharging that supposition by conditional proof gives us the original goal (p _ q) ! t. End of solution. If you find it helpful, you can set out the solution to Exercise 10.4.1 (3) as a numbered sequence with each item in the sequence annotated to indicate whether it is a premise, a supposition, obtained from what by which elementary rule, or obtained by discharging a supposition using a higher-level rule. That is the way in which textbooks focusing on natural deduction do it. As remarked in Chap. 1, in mathematical practice, disjunctive proof often appears in a variant (though classically equivalent) form known as proof by cases. We have a premise-set A and we wish to infer a conclusion c. We may not be able to find a single form of argument that works in all possible cases, so we divide them into two. We think up a suitable proposition b—which need not be mentioned explicitly in A or in c—and consider separately two cases, one for b and the other for ¬b. Each of them may open the way to a neat proof of c. The two proofs may quite similar but they can also turn out to be very different. If both succeed, we are done. For example, we may want to show in the arithmetic of the natural numbers that for all n, n2 + n is even. The natural way to do it is by first considering the case that n is even, then the case that n is odd. Again, we might want to show that the remainder when a square natural number n2 is divided by 4 is either 0 or 1; here too it is natural to break the problem down into the cases that n is even and that it is
10.4
Other Higher-Level Proof Strategies
349
odd. In the chapter on trees, Sect. 7.6.2, we used a quite sophisticated proof by cases when showing that every cycle in an unrooted tree contains at least one repeated edge: we broke the situation into three cases (this, that, neither of the two) rather than just two, and this was done inside a proof by contradiction. You will find it profitable to revisit that proof in the light of what you now know about its underlying logic. The underlying second-level rule for proof by cases is: A; b ‘ c; A; :b ‘ c = A ‘ c: Expressed in split-level form, this becomes: A; A; b ‘ c; A; :b ‘ c = c: Flattening this split-level rule we get the procedure: Given A, wanting to get c Suppose b Argue to c Discharge b Suppose ¬b Argue to c again Discharge ¬b Conclude c as desired. Exercise 10.4.1 (4) Verify that the rule of proof by cases is correct for classical consequence. Solution Again, the verification is essentially the same for second-level and split-level formulations. It is slightly more elegant for the former, so we do it that way. Suppose A ⊭ c. Then there is a valuation v such that v(A) = 1, v(c) = 0. If v(b) = 1 then v(A [ {b}) = 1, v(c) = 0 so A, b ⊭ c, while if v(b) = 0 then v(A [ {¬b}) = 1, v(c) = 0 so A, ¬b ⊭ c. End of solution. In our two arithmetical examples of proof by cases, it was rather obvious how best to choose the proposition b that defines the two cases; in such instances, the difference between proof by cases and disjunctive proof can be little more than a matter of verbal editing. But there are other examples, such as that about cycles in unrooted trees, in which it is not immediately obvious what would be a good choice of a proposition b to distinguish cases. Indeed, it can happen that finding one can be the key to solving the problem. Experience helps one do that, just as it helps us cut a roast turkey at the joints. Exercise 10.4.1 (5) Use proof by cases to give a simple proof that there are positive irrational numbers x, y such that xy is rational.
350
10 Just Supposing: Proof and Consequence
Solution We cook up two pairs (x,y) and (x′,y′) and show that at least one of them does the job, although we do not show which of them does. pffiffiffipffiffi2 Put y = √2, which is irrational. Now 2 is either rational or irrational. In the pffiffiffi pffiffiffipffiffi2 former case put x ¼ 2 and we are done. In the latter case, put x ¼ 2 which, by pffiffiffiffiffiffiffi pffiffiffi pffiffi pffiffiffi pffiffi pffiffi the supposition of the case, is irrational. Then xy ¼ ð 2 2 Þ 2 ¼ ð 2Þ 2 2 ¼ pffiffiffi ð 2Þ2 ¼ 2 which is rational and again we are done. End of solution. The solution to Exercise 10.4.1 (5), known as Jarden’s proof, is widely cited as an example of an elementary proof that is non-constructive. It considers cases b, ¬b (where b is a sentence, that is, without free variables) and proves the desired result separately for each case without knowing which of them really holds. Such arguments generally convey less information than constructive ones and some non-classical mathematicians go so far as to cast doubt on their validity. On the other hand, constructive proofs can be much longer and more intricate. In the case of the exercise, it is possible to render the proof constructive by establishing which of the two cases holds; in fact, it is the second case that holds, as can be shown by a long and difficult proof that we do not attempt to describe. Sometimes, in a proof, one finds oneself iterating the splitting to get sub-cases, sub-sub-cases, and so on, ending up with dozens of them in several layers. Such arguments can be rather inelegant and are disdained by mathematicians when less fragmented ones can be found. However, computers are not so averse to them. A notorious example arose in the celebrated solution of the four-colour problem of graph theory, which required a breakdown into a myriad of cases treated separately with the assistance of a computer.
10.4.2 Proof by Contradiction Our next method of argument has been famous since Greek antiquity. It is known as proof by contradiction or, using its Latin name, reductio ad absurdum, briefly reductio, and bearing the acronym RAA. It was sketched in an Alice box in Chap. 2 ; here we go further on a more analytic level. Imagine that we are given a premise-set A and we want to get a conclusion b. We may even have tried various other methods and got stuck, so we try the following: we suppose the proposition ¬b opposite to what we want to show, and seek to establish, on this basis, a contradiction. If we manage to do so, the proof of b from A is complete. What is meant by ‘a contradiction’ here? We mean an explicit contradiction, that is, any statement c and its negation ¬c which, in Chap. 8 Sect. 8.5 in the context of truth-trees, we called briefly crash-pairs. As remarked by the Hatter in the Alice box, it does not matter what contradiction it is, that is, how c is chosen. Indeed, when constructing the proof, we often do not have a clear idea which contradiction we will end up with. Moreover, a little editing such as replacing a modus ponens by
10.4
Other Higher-Level Proof Strategies
351
a modus tollens can modify the contradiction that is obtained; but we don’t care in the least. Proof by contradiction is a universal rule in the sense that neither the premises nor the conclusion of the principal inference need be in any specific form. This is in contrast with conditional proof, which is designed specifically for getting a conditional conclusion, as well as disjunctive proof, which proceeds from a disjunctive premise. Sometimes, using reductio can make an argument a great deal easier due to the availability of the supposition as one more item available to work with, but on other occasions it will not make much difference. Some mathematicians prefer to use reductio only when they really need to; others apply it at the slightest pretext. When RAA is used to establish the existence of an item with a certain property it will usually be non-constructive. In such applications, it gets a contradiction from the supposition that nothing has that feature—but without thereby specifying an item possessing it. As we have already seen in Exercise 10.4.1 (4), the same can happen with proof by cases, but it is much more common in proofs by contradiction. The most famous example of proof by contradiction, dating back to Greek pffiffiffi antiquity, is a standard proof that 2 is irrational. Everybody learned it at school, but we recall it here to highlight the logical structure. The argument makes use of pffiffiffi the fact that an integer n is even iff n2 is even. Suppose that 2 is rational. Then by pffiffiffi the definition of rationality, 2 ¼ a=b where a, b are integers. We may assume wlog (without loss of generality, see Chap. 7, Sect. 7.6.2) that a, b share no factors pffiffiffi other than 1. Since 2 ¼ a=b we have 2 ¼ ða=bÞ2 ¼ a2 =b2 so a2 ¼ 2b2 so a2 is even; hence a is even, that is, a = 2c for some integer c. Substituting 2c for a in the equality a2 ¼ 2b2 gives us ð2cÞ2 ¼ 2b2 , hence 2b2 ¼ 4c2 so b2 ¼ 2c2 . Thus, b2 is even, so b is even. Hence 2 is a common factor of a, b, giving us the desired contradiction. We used proof by contradiction many times in previous chapters. In particular, Chap. 7 on trees was full of them—there were five in a row in Sect. 7.2.1 and one reductio inside another in Sect. 7.6.2. Reviewing those proofs will help appreciate the power and convenience of the method in practice. Exercise 10.4.2 (1) Given the premises s ! q, (r _ q) ! ¬p, use proof by contradiction and elementary inferences to get ¬(p ^ s). Solution Suppose ¬¬(p ^ s); we want to get an explicit contradiction. Eliminating the double negation, we have p ^ s. From that we have each of s, p; using s with the first premise gives us q by modus ponens, from which we have r _ q and so by another modus ponens ¬p, giving us the desired contradiction. End of solution. When we are aiming for a negative conclusion ¬b as in Exercise 10.4.2 (1), we can evidently take a short cut and suppose b directly rather than suppose ¬¬b and then get rid of the double negation.
352
10 Just Supposing: Proof and Consequence
Writing ⊥ to stand for any explicit contradiction, we can state the second-level rule underlying the procedure: A ⊢ b whenever A, ¬b ⊢ ⊥. With a slash for the central transition, this is written: A; :b ‘? = A ‘ b: In split-level form, it becomes: A; A; :b ‘? = b: Finally, a flattened rendering of the split-level version: Given A, wanting to get b: Suppose ¬b Argue to an explicit contradiction Discharge ¬b, Conclude b as desired. Exercise 10.4.2 (2) Show that proof by contradiction is correct for classical consequence. Solution We consider the second-level formulation A, ¬b ⊨ ⊥/A ⊨ b and argue contrapositively. Suppose that A ⊭ b; we want to show that A, ¬b ⊭ ⊥. By the supposition, there is a valuation v with v(A) = 1 and v(b) = 0, so v(A [ {¬b}) = 1. But since ⊥ is shorthand for an explicit contradiction, we have v(⊥) = 0 so that A, ¬b ⊭ ⊥ as desired. Alice Box: Indirect inference
Alice
Hatter
Alice Hatter
Alice
In other discussions, I have seen the term indirect inference. Is that the same as proof by contradiction? Or does it cover, more broadly, all higher-level strategies? The term ‘indirect inference’ is more of a cognitive description than a logical one. It is used to mean any way of writing out an argument in which the order of development appears to ‘swim against the stream of implication’. So understood, it covers more than proof by contradiction, but less than all higher-level proof procedures. For example? Conditional proof, disjunctive proof and proof by cases are usually considered direct. Proof by contradiction, on the other hand, is always seen as indirect as it supposes the very opposite of what we want to prove. Any others?
10.4
Other Higher-Level Proof Strategies
Hatter
Alice Hatter
353
The variant of conditional proof that we called ‘contraposed conditional proof’ in Sect. 8.3.1, is also often described as indirect. Presented as a second-level rule, it has the form A [ {¬c} ⊢ ¬b / A ⊢ b ! c. It gives the impression of swimming against the direction of implication, and so is often called ‘indirect conditional proof’. Any formal basis for that impression? The supposition ¬c (resp. conclusion ¬b) of the subordinate inference is the negation of the consequent c (resp. antecedent b) of the conclusion of the principal inference.
There is a sense in which, if we are given any one of the three higher-level rules that we have been discussing, the others become redundant. For example, we can make conditional proof do the work of disjunctive proof as follows. Given premises A, b1 _ b2, first suppose b1 to get c, apply CP to get b1 ! c and discharge b1; then suppose b2 to get c, apply CP again to obtain b2 ! c and discharge b2. Finally, use the tautological implication b1 ! c, b2 ! c, b1 _ b2 ⊨ c, which one could add to the list in Table 8.5 of Chap. 8, to conclude c from A, b1 _ b2 as desired. But this is a rather roundabout way to proceed so, in mathematical practice, disjunctive proof is considered as a strategy in its own right. We end this section with some remarks for the philosophically inclined; others may skip to the next section. There are a few mathematicians and rather more philosophers of mathematics who are wary of the use of truth-values in the discipline. For them, the notion of truth has no meaning in mathematics beyond ‘intuitively provable’; moreover falsehood means no more than ‘intuitively provable that we cannot have an intuitive proof’. For this reason, they feel that the whole of classical logic must be reconstructed. In the resulting intuitionistic logic dating back to the early twentieth century, some classical principles go out the window. The most notorious of these is the tautology of excluded middle a _ ¬a. But other principles are also affected; in particular, a number of classical equivalences involving negation are retained in one direction only. For example, using ⊢ for intuitionistically acceptable logical implication, classical double negation ¬¬a ⟚ a is reduced to a ⊢ ¬¬a; contraposition a ! b ⟚ ¬b ! ¬a drops to a ! b ⊢ ¬b ! ¬a; de Morgan ¬(a ^ b) ⟚ ¬a _ ¬b is cut to ¬a _ ¬b ⊢ ¬(a ^ b); quantifier interchange ¬8x(a) ⟚ 9x¬(a) becomes only 9x¬(a) ⊢ ¬8x(a). There are also losses of principles where negation does not figure. For example, the classical tautology (a ! b) _ (b ! a) is not intuitionistically acceptable, nor is the following classical tautology that uses implication alone: ((a ! b) ! a) ! a. As one would expect, such cutbacks have repercussions for higher-level inference rules. In intuitionistic logic, conditional proof is accepted, but its contraposed version is not; disjunctive proof is retained, but argument by cases in any form that presumes excluded middle is out; proof by contradiction is not accepted in the form that we have been using, but only in a form with interchanged negations: A, b ⊢ ⊥ / A ⊢ ¬b. However, all that is beyond our remit.
354
10 Just Supposing: Proof and Consequence
10.4.3 Proof Using Arbitrary Instances In Chap. 9, Sect. 9.4.3, we articulated the second-level rules 8+ and 9− for the quantifiers in classical logic, contrasting them with the first-level logical implications 8− and 9+. Their formulations for classical consequence ⊨ were: 8+: Whenever A ⊨ a then A ⊨ 8x(a), provided the variable x has no free occurrences in any formula a in A 9−: Whenever A, b ⊨ c then A, 9x(b) ⊨ c, provided the variable x has no free occurrences in any formula a 2 A [ {c}. As also noted, 8+ is also commonly called ‘universal generalization’ (UG) and 9 referred to as ‘existential instantiation’ (EI), although those names do little to bring out the second-order nature of the rules or reflect the logic of what is going on, being more apposite as descriptions of the flattened presentations of the split-level versions of these rules. There is one respect in which 8+ differs from both its dual 9− and all the second-level rules for propositional connectives that we have considered. It makes no supposition! The premises of the subordinate inference are exactly those of the principal inference. So, we cannot simply identify higher-level inference with the making and discharging of suppositions. Suppositions are a frequent and salient feature of such inferences, but not an invariable one. Nevertheless, like the other higher-level rules that we have considered, 8+ is incremental since the principal and subordinate inferences have the same premises. On the other hand, the rule 9−, as we have written it, is not incremental: the premise 9x(a) of the principal inference is not a premise of the subordinate one. Nevertheless, since a ⊨ 9x(a), we may make it incremental by reformulating it a little redundantly, just as we did with disjunctive proof: −
9−: Whenever A, b, 9x(b) ⊨ c then A, 9x(b) ⊨ c, provided the variable x has no free occurrences in any formula a 2 A [ {c}. However, in practice, one usually works with the non-incremental formulation since it is simpler. For arbitrary consequence relations ⊢, using the schematic slash notation and writing ‘x not free in A’ to abbreviate ‘x is not free in any formula in A’, the rules 8+ and 9− say: 8+: A ⊢ a / A ⊢ 8x(a) (x not free in A) 9−: A, b ⊢ c / A, 9x(b) ⊢ c (x not free in A or in c). Written as split-level rules, distinguishing semi-colons for separate rule-inputs from commas for separate premises in an inferential input: 8+: A; A ⊢ a / 8x(a) (x not free in A) 9−: A; 9x(b); A, b ⊢ c / c (x not free in A or in c).
10.4
Other Higher-Level Proof Strategies
355
Flattening 8+: Given A, wanting to get 8x(a): Argue to a Check that x is not free in A Conclude 8x(a) as desired. Flattening 9−: Given A, 9x(b), wanting to get c: Suppose b Argue to c Check that x is not free in A or in c Conclude c as desired. Conventional mathematical English does not go in for full formal presentation of its propositions and so cannot routinely identify free and bound occurrences of variables in them. In that context, the flattened versions of 8+, 9− are conveyed using terms like ‘arbitrary’ and ‘choose’. It is in terms such as these that we have been carrying out our own reasoning in this book: 8+: To show that every element of the domain has a certain property, it suffices to consider an arbitrary x and show that it has that property. 9−: When we know that at least one element of the domain has a certain property, we may without loss of generality choose an arbitrary x and suppose that it has the property.
Alice Box: Arbitrary items?
Alice
Hatter Alice Hatter
I have a philosophical worry about this talk of ‘arbitrary x’, say an arbitrary positive integer or triangle. There is no such thing as an arbitrary triangle or arbitrary number. Every integer is either even or odd, every triangle is either equilateral, isosceles or scalene. Arbitrary triangles do not exist! If I were as mad as hatters are made out to be, I might try to disagree. But, of course, you are quite right. So how can we legitimately use the word? Well, it’s just a manner of speaking; let’s move on …
Alice was right to be puzzled. Her point was made already by the eighteenth-century philosopher Berkeley in a forceful critique of the mathematics of his time, so perhaps we should flesh out the Hatter’s response a little. Let’s look at
356
10 Just Supposing: Proof and Consequence
8+. Although there is no such thing as an arbitrary element of a domain, we can prove theorems using a variable x that is treated arbitrarily as far as the particular proof is concerned. What does that mean? It means that the premises of the proof in question do not ascribe any attributes to x other than those that it asserts, or are implied, for all elements of the domain. The arbitrariness lies not in the item, but in the way in which we handle it. Such a way of understanding talk of arbitrary items dispels the air of paradox around them, but it is still quite vague. In the end, the only way to make the notion perfectly precise is by using the precise language and concepts of first-order logic, requiring that a certain variable does not occur free in certain places. In this way, a conceptual puzzle is resolved by applying a banal syntactic criterion in the language of first-order logic.
10.4.4 Summary Discussion of Higher-Level Proof The construction of logical derivations is a recursive affair. That is so even for chaining even though it uses only elementary rules, since chaining explores the closure of a set of premises under those rules. As observed in Sect. 10.2, the construction of elementary derivations by chaining makes implicit use of the three Tarski conditions for logical consequence and, while strong reflexivity is a first-level rule, the other two are second-level. Exercise 10.4.4 Write the Tarski conditions of monotony and cumulative transitivity for inference relations as second-level rules in the schematic slash manner. Solution Monotony is most concisely expressed as A ⊢ b / A [ X ⊢ b although one could of course write: A ⊢ b / B ⊢ b whenever A B. Cumulative transitivity may be written: A ⊢ b for all b 2 B; A [ B ⊢ c / A ⊢c. End of solution. Recursion enters into derivations in another way when we use any of the second-level rules of conditional proof (in direct or contraposed versions), disjunctive proof (or its variant, proof by cases), reductio ad absurdum, and for the quantifiers, for then we are considering the closure of the set of all elementary derivations under those rules. To interact with elementary rules, second-level ones may be expressed in split-level form and, to reduce repetition, derivations using split-level rules can be flattened to become annotated sequences that mimic elementary derivations. While in theory we could restrict ourselves to first-level rules and the Tarski conditions, in practice all serious proof requires unremitting use of higher-level inference. On the other hand, it does not seem to call upon any rules of third level or beyond. For quick reference, we recapitulate the main second-level rules in Table 10.3.
10.4
Other Higher-Level Proof Strategies
357
Table 10.3 The most important second-level inference rules Disjunctive proof (DP, _−)
Proof by contradiction (RAA, reductio)
Universal generalization (UG, 8+)
Existential instantiation (EI, 9−)
A, b1 ⊢ c; A, b2 ⊢ c A ⊢ b ! c A, b1 _ b2 ⊢c None None
A, ¬b ⊢ c ^ ¬c A⊢b
A⊢a
A, b ⊢ c
A ⊢ 8x(a)
A, 9x(b) ⊢ c
None
x not free in A
x not free in c or in A
Conditional proof (CP, !+) Subordinate inference(s) Principal inference Provisos
A, b ⊢ c
We end by fulfilling a promise made to Alice, to dig deeper into why disjunctive proof (DP) and existential instantiation (EI) are classified as elimination rules. When need some precise definitions of different types of second-level rules A1 ⊢ a1; …; An ⊢ an / B ⊢ b. In the first place, they may be partitioned into three categories: structural, intelim and undistinguished: • A second-level inference rule A1 ⊢ a1; …; An ⊢ an / B ⊢ b is said to be structural iff it contains no connectives at all. • It is an intelim rule iff it contains only one connective and that connective occurs just once, with the unique occurrence being in the principal inference B ⊢ b. • It is undistinguished if it is neither structural nor intelim. The intelim rules are partitioned into introduction and elimination rules: • When the unique occurrence of the connective occurs in b (the conclusion of the output of the rule) then it is an introduction rule. • When the unique occurrence of the connective occurs in B (the premise-set of the output of the rule) then it is an elimination rule. It should be noted that in the literature, particularly of a philosophical kind, the notion of an intelim rule (and thus of its sub-categories, introduction and elimination) is sometimes used quite loosely with one or more of the above conditions relaxed. Sometimes two connectives are allowed, or the unique connective may occur twice in the principal inference, or it may also occur in the subordinate inference. Exercise 10.4.5 Classify the second-level rules discussed in this chapter, namely monotony, cumulative transitivity, conditional proof, disjunctive proof, proof by cases, reductio, UG, EI as structural, introduction, elimination or undistinguished.
358
10 Just Supposing: Proof and Consequence
Solution Monotony and cumulative transitivity are structural. CP is an introduction rule, as is UG (hence their icons !+, 8+ with a plus sign). On the definitions provided, DP and EI are elimination rules (signaled by icons _−, 9−). This answers Alice’s earlier questions about the nomenclature. In contrast to DP, its cousin proof by cases is undistinguished, since negation appears in the subordinate inference. This difference is of little importance for classical deductive practice, but for some non-classical logics it is significant. For example, DP is accepted in the system of intuitionistic logic mentioned in Sect. 10.4.2 while proof by cases in the form considered here is not. Reductio is the most interesting of our rules to classify. Inspecting its formulation, A, ¬b ⊢ c ^ ¬c / A ⊢ b, we see that there is a negation (in fact, two) in the subordinate inference so, like proof by cases, it is undistinguished. To be sure, a variant version of reductio, A, b ⊢ c ^ ¬c / A ⊢ ¬b gets rid of one the negations, but the other remains. Moreover, if we introduce into the language the zero-ary connective ⊥ known as the falsum (see Chap. 8 Sect. 8.4.3) we can rewrite the rule as A, b ⊢ ⊥ / A ⊢ ¬b thus eliminating both negations from the subordinate inference. But this manipulation introduces another connective, namely ⊥, into the subordinate inference so we still do not have an intelim rule in the strict sense of the term. Exercise 10.4.6 Recall from Exercise 8.3.3 (3) that a truth-functional connective *(p1, …, pk) (k 0) is called contrarian iff v(*(p1, …, pk)) = 0 when all v(pi) = 1 (i k). (a) Identify five familiar contrarian truth-functional connectives with k 2. (b) Show that no contrarian truth-functional connective of any arity has a classically correct introduction rule. Solution (a) The truth-functional connectives ¬, ⊕ (exclusive disjunction), nand (not-both), # (neither-nor), and the zero-ary falsum ⊥ are all familiar contrarian ones. For a complete list, inspect Table 8.4 in Chap. 8, recalling that zero-place and one-place connectives reappear as two-place ones with one or both of their letters redundant. (b) Consider any introduction rule A1 ⊨ a1; …; An ⊨ an / B ⊨ b for classical consequence ⊨ and a k-place truth-functional connective *(p1, …, pk). Such a rule contains * as its unique connective and * occurs in it just once, with the unique occurrence being in b. Now substitute a classical tautology, e.g. p _ ¬p, for all sentence letters in this scheme, writing r for the substitution function. Since classical consequence is closed under substitution, we have r(A1) ⊨ r(a1), …, r(An) ⊨ r(an). Since the formulae in B contain no connectives, they are all sentence letters so that all formulae in r(B) are tautologies. Since the connective * occurs exactly once in b, we have b = *(p1, …, pk) for some sentence letters p1, …, pk. Hence r(b) = r(*(p1, …, pk)) = *(r(p1), …, r(pk)). Now let v be any valuation. Then each v(r(pi)) = 1 so, since * is
10.4
Other Higher-Level Proof Strategies
359
contrarian, v(r(b)) = 0 while v(r(B)) = 1. Putting all this together, we have a substitution instance of the rule where all n subordinate inferences are classically correct while the principle inference is not, so the scheme fails for classical logic.
10.5
End-of-Chapter Exercises
Exercise 10.5 (1) Consequence relations (a) Show that cumulative transitivity taken together with monotony implies (plain) transitivity, i.e. the principle that whenever a ⊢ b and b ⊢ c then a ⊢ c. (b) Let ⊢ be the relation defined by putting A ⊢ b iff either (i) A is a singleton {a} and a = b or (ii) A has more than one element. Show that ⊢ satisfies the three Tarski conditions. Solution (a) Suppose a ⊢ b, b ⊢ c. By monotony on the latter, {a,b} ⊢ c, so a ⊢ c by cumulative transitivity. (b) For strong reflexivity, suppose a 2 A. If A = {a}, then A ⊢ a by clause (i), while if A has more than one element, then again A ⊢ a by clause (ii). For monotony, suppose A ⊢ a and A B. By the supposition, either A = {a} or A has more than one element. In the former case, a 2 B so B ⊢ a by strong reflexivity as already checked while in the latter case B also has more than one element so B ⊢ a by clause (ii). For cumulative transitivity, suppose A ⊢ b for all b 2 B and A [ B ⊢ c; we need to check that A ⊢ c. We consider three cases. Case 1: A = ∅. Since A ⊢ b for all b 2 B we must have B = ∅ so A [ B = ∅ contradicting A [ B ⊢ c. Case 2: A is a singleton {a}. Then since A ⊢ b for all b 2 B we must have B A so A [ B = A = {a} so, since A [ B ⊢ c, we have c = a so A ⊢ c. Case 3: A has more than one element. Then immediately A ⊢ c by clause (ii) and we are done. Exercise 10.5 (2) Consequence operations (a) In Exercise 10.2.3 (a) we noted that although the inclusion C(A) [ C(B) C (A [ B) holds for any consequence operation C, its converse C(A [ B) C (A) [ C(B) fails for C = Cn. Show that nevertheless C(A [ B) = C(C(A) [ C (B)) holds for all consequence operations C. (b) (i) Show that for any consequence operation C, if A C(B) and B C(A) then C(A) = C(B); (ii) express the principle in terms of consequence relations (c) Show that C(A) \ C(B) = C(C(A) \ C(B)) for any consequence operation.
360
10 Just Supposing: Proof and Consequence
Solution (a) In one direction: Since C(A) [ C(B) C(A [ B) as shown in Exercise 10.2.3 (a), monotony and idempotence give us C(C(A) [ C(B)) CC(A [ B) C (A [ B). For the converse, we have A C(A), A C(B) by strong reflexivity so, by basic set theory, A [ B C(A) [ C(B) and hence by monotony C(A [ B) C(C(A) [ C(B)) as desired. (b) (i) Suppose A C(B) and B C(A). Applying monotony and idempotence to the former gives C(A) CC(B) = C(B); applying the same to the latter gives C (B) CC(A) = C(A); put these together and we are done. (ii) Whenever both A ⊢ b for all b 2 B and B ⊢ a for all a 2 A, then A ⊢ c iff B ⊢ c for all c. (c) LHS RHS is immediate by strong reflexivity; the converse inclusion is a bit trickier. Clearly C(A) \ C(B) C(A) so, by monotony, C(C(A) \ C(B)) CC(A) = C(A). Similarly, C(A) \ C(B) C(B) so C(C(A) \ C(B)) CC (B) = C(B). Putting these together gives us C{C(A) \ C(B)} C(A) \ C (B) as desired. Exercise 10.5 (3) Higher-level rules (a) Show how the rule of proof by cases for a consequence relation ⊢ may be obtained from disjunctive proof for ⊢ whenever ⊢ satisfies the condition that A ⊢ b _ ¬b for all A, b. (b) Show, conversely, how the rule of disjunctive proof for a consequence relation ⊢ may be obtained from proof by cases for ⊢ whenever ⊢ satisfies disjunctive syllogism, i.e. the condition that {b1 _ b2, ¬b1} ⊢ b2 for all formulae b1, b2. (c) Write out the converses of conditional proof, reductio, 8+, 9− and disjunctive proof and check whether they are classically correct. Solution (a) Assume that a consequence relation ⊢ satisfies disjunctive proof and suppose that both A, b ⊢ c and A, ¬b ⊢ c; we need to show that A ⊢ c. Applying DP to the suppositions we have A [ {b _ ¬b} ⊢ c. But it is assumed that A ⊢ b _ ¬b, so A ⊢ c by cumulative transitivity. (b) This direction is a bit less immediate. Assume that a consequence relation ⊢ satisfies proof by cases and suppose that both A [ {b1} ⊢ c and A [ {b2} ⊢ c; we need to show that A [ {b1 _ b2} ⊢ c. Proof by cases tells us that it will suffice to get both A [ {b1 _ b2} [ {b1} ⊢ c and A [ {b1 _ b2} [ {¬b1} ⊢ c. The former is immediate by monotony from the first supposition. For the second, monotony applied to the second supposition gives us A [ {b1 _ b2} [ {¬b1} [ {b2} ⊢ c, and monotony applied to the assumption {b1 _ b2, ¬b1} ⊢ b2 provides A [ {b1 _ b2} [ {¬b1} ⊢ b2. Cumulative transitivity thus yields A [ {b1 _ b2} [ {¬b1} ⊢ c and the verification is complete. (c) All five converses are classically correct. For this reason, the rules are often said to be invertible (in contrast, neither of the two second-level Tarski conditions of monotony and cumulative transitivity is invertible). We state the five
10.5
End-of-Chapter Exercises
361
converses for classical consequence ⊨ and verify their correctness. In the last three verifications, when we say “essentially because so-and-so” we mean that it is easily checked using both so-and-so and the Tarski conditions. CP: Its converse is the rule A ⊨ b ! c / A, b ⊨ c. Verification: suppose A, b ⊭ c. Then there is a valuation v with v(A) = v(b) = 1 and v(c) = 0 so v(b ! c) = 0 hence A ⊭ b ! c. Reductio: Its converse is A ⊨ b / A, ¬b ⊨ c ^ ¬c. Verification: suppose A, ¬b ⊭ c^¬c. Then there is a valuation v with v(A) = v(¬b) = 1 so v(b) = 0 so A ⊭ b. 8+: Its converse is A ⊨ 8x(a) / A ⊨ a. It is classically correct, irrespective of whether x occurs free in A, essentially because 8x(a) ⊨ a is an instance of 8− using the identity substitution (which automatically satisfies the 8− proviso). 9−: Its converse is A, 9x(a) ⊨ b / A, a ⊨ b. It is classically correct, irrespective of whether x occurs free in A or in b, essentially because a ⊨ 9x(a) is an instance of 9+ using the identity substitution (which automatically satisfies the 9+ proviso). DP: Its converse is the rule-pair A, b1 _ b2 ⊨ c / A, b1 ⊨ c and A, b1 _ b2 ⊨ c / A, b2 ⊨ c. Both are classically correct essentially because b1 ⊨ b1 _ b2 and b2 ⊨ b1 _ b2.
10.6
Selected Reading
The concept of a consequence operation/relation is explained in a Wikipedia entry at http://en.wikipedia.org/wiki/Consequence_operators; this presentation highlights algebraic and topological aspects, with lots of useful links. A succinct account can also be found in chapter 1 of Ryszard Wójcicki Theory of Logical Calculi: Basic Theory of Consequence Operations, Reidel 1988. For an examination of the extent to which the Tarski conditions succeed or fail in various logics of uncertain inference, both qualitative and probabilistic, see David Makinson Bridges from Classical to Nonmonotonic Logic, College Publications 2007. Informal proof-strategies in mathematics are illustrated very clearly in the textbooks E.D. Bloch Proofs and Fundamentals: A First Course in Abstract Mathematics, Springer 2011 (second edition), chapter 2 and Daniel Velleman How to Prove It: A Structured Approach, Cambridge University Press 2006 (second edition), chapter 3. Section 10.2.6 of the Bloch text also contains useful advice on writing proofs in coherent and elegant English; in that connection, it is well worth reading the celebrated article of Paul Halmos ‘How to write mathematics’ in L’Enseignement Mathématique 16: 1970, now available on several websites including https://www.math.uh.edu/tomforde/Books/Halmos-How-To-Write.pdf. For a first glimpse of the world of proof theory, see Jan von Plato ‘The development of proof theory’, Stanford Encyclopedia of Philosophy http://plato.stanford. edu/entries/proof-theory-development; this perspective is developed at length in Sara Negri & Jan von Plato Structural Proof Theory, Cambridge University Press 2008. A recent concise text is Hiroakira Ono Proof Theory and Algebra in Logic,
362
10 Just Supposing: Proof and Consequence
Springer 2019. For more on intelim rules in classical logic see David Makinson ‘Intelim rules for classical connectives’ via the author’s webpage https://sites. google.com/site/davidcmakinson/. This chapter has not sought to drill readers in building extended ‘natural deductions’ in formal notation; the reasons are explained in the Preface. Those wishing to cultivate the skill can find a classic presentation in Patrick Suppes Introduction to Logic, republished in 2003 in the series Dover Books in Mathematics. More recent presentations include Nicholas Smith Logic: The Laws of Truth, Princeton University Press 2012 and the third edition of Peter Smith An Introduction to Formal Logic, Cambridge University Press, expected 2020. These are only three of the great many textbook presentations with a wide variety of notations and variant procedures. Instructors may find interest in an overview of the diversity in Jeffry Pelletier & Allen Hazen ‘Natural deduction’, chapter 7 of Dov Gabbay & John Woods Handbook of the History of Logic, Vol. 11: Central Concepts, North Holland 2012.
Sticking to the Point: Relevance in Logic
11
Chapter Outline When presenting classical propositional logic in Chap. 8, we observed that the connective of material implication, defined by its truth-table, makes no claim of any kind of ‘relevance’ between antecedent and consequent; nor does the relation of tautological implication require that premises and conclusion share any content. This leads to some rather surprising results, notably the so-called principles of ‘explosion’. In this chapter, we explore a way of excluding such runaway principles while retaining a logic that is smoothly behaved and easily applied. The basic idea is to adapt the method of truth-trees, from Chap. 8 Sect. 8.5, by imposing syntactic constraints of ‘actual use’ of antecedents and consequents in the production of crash-pairs. Readers are encouraged to review Sect. 8.5 to come up to speed for the present chapter.
11.1
Some Curious Classical Principles
As usual, it is best to begin with some examples. Among tautologies of the form a ! b, there are some where a appears to ‘have nothing to do with’ b. The simplest are the formulae (p ^ ¬p) ! q, p ! (q _ ¬q), (p ^ ¬p) ! (q _ ¬q) whose antecedents and consequents share no sentence letters, so that propositions instantiating them may be utterly unrelated to each other in content. The first of the three is widely known as explosion and, by extension, we will refer to the three respectively as right, left and symmetric explosion. Like all arrow formulae, their status as tautologies is echoed in corresponding classical logical consequences, namely p ^ ¬p ⊨ q, p ⊨ q _ ¬q, p ^ ¬p ⊨ q _ ¬q, also called principles of explosion. More generally, when either a is a contradiction or b is a tautology, then a ⊨ b holds and a ! b is a tautology, even when antecedent and consequent share no letters. © Springer Nature Switzerland AG 2020 D. Makinson, Sets, Logic and Maths for Computing, Undergraduate Topics in Computer Science, https://doi.org/10.1007/978-3-030-42218-9_11
363
364
11
Sticking to the Point: Relevance in Logic
Among the tautologies, there are also arrow formulae whose antecedents and consequents do share letters but where, intuitively, relevance still seems to fail. For example, the formulae ¬q ! (q ! p), p ! (q ! p), (¬q _ p) ! (q ! p) all share at least one letter between antecedent and consequent but, intuitively, they are dubious as candidates for logical truth when the arrow is read as expressing, in the object language, some kind of relevant implication. The same doubts arise for the corresponding tautological consequences ¬q ⊨ q ! p, p ⊨ q ! p, ¬q _ p ⊨ q ! p. For instance, in the second of the three, the mere truth of p hardly seems to guarantee that an arbitrary q relevantly implies p. Finally, there are tautologies in which the principal connective is not arrow so that the letter-sharing requirement does not arise, that are difficult to swallow under a reading of their internal arrows as claiming relevance; a well-known example is the ‘comparability’ tautology (p ! q) _ (q ! p). It is thus natural to wonder whether one can construct a logic that avoids these and any other principles that appear counter-intuitive when the arrow is understood as expressing some kind of relevance between antecedent and consequent, while remaining as close to classical propositional logic as is compatible with such a goal. That is the project of relevance logic, also known in Australian dialect as relevant logic. The trouble is that the counter-intuitive principles are interdependent with others that, at first sight, are quite innocuous. The point can be illustrated starkly for right explosion by what is known as the Lewis derivation or Lewis dilemma, named after the twentieth century logician C.I. Lewis, although it is known to go back at least as far as Alexander Neckam at the end of the twelfth century. It is most transparently formulated as a short ‘natural deduction’ from premise p ^ ¬p to conclusion q (Neckam chose ‘Socrates is a man’ for p and ‘Socrates is a stone’ for q). The names and acronyms for rules should be familiar from Chap. 10, which readers are encouraged to consult again whenever needed. 1. 2. 3. 4. 5.
p ^ ¬p p ¬p p_q q
Supposition From 1 by ^− From 1 by ^− From 2 by _+ From 3,4 by Disjunctive Syllogism (DS)
Clearly, if we are to reject the inference from p ^ ¬p to q, something here must go! We must abandon or at least restrict at least one of the first-level rules ^− (conjunction elimination, simplification), _+ (disjunction introduction, addition), DS (disjunctive syllogism) or the second-level rules of cumulative transitivity and monotony which, as we saw in Chap. 10, are implicit in all derivations. All these paring options have received attention in the literature on relevance logic, each with its own peculiarities and, one might say, eccentricities. Most people seeing the Lewis dilemma for the first time tend to regard disjunction introduction, applied here to pass from p to p _ q, as the principle to be blamed; the arbitrarily chosen disjunct q looks like a Trojan horse for smuggling irrelevant material into its conclusion. On the other hand, it may be suggested that
11.1
Some Curious Classical Principles
365
the problem is not so much the introduction of irrelevancies as the subsequent elimination of whatever material is still relevant to the starting point, for which DS is responsible. On balance, one might say that blaming _+ for the Lewis dilemma is intuitively more convincing but turns out to lead to less interesting logical systems than does attributing it to DS. Whichever path is chosen, inferential practice takes a serious hit. You apply _+ when, seeing that your watch is in the top drawer you conclude that it is in the chest of drawers; also, in mathematics, when you treat a set as either finite or countable having shown that it is countable. Disjunctive syllogism is also applied in many situations. In Stoic antiquity it was famous as ‘the dog’, for it was maintained that even a canine can reason in accord with it. When following a scent down a road and coming to a fork, the animal may sniff some distance down one branch finding nothing then, presuming that the quarry must have gone down one of the two, race down the other path without even bothering to sniff. Such behaviour bears all the signs of performing an inference from two premises p _ q, ¬p to the conclusion q, even though the agent is unable to articulate what it is doing. You behave similarly when, knowing that your watch is in the chest of drawers, and finding that it is not in the upper one, you conclude that it must be in one of the others. Readers who play sudoku will recognize that disjunctive syllogism is one of the most pervasive kinds of inference used in the game. Finally, having shown that a certain set is either infinite or empty, and checking that it is not empty, a mathematician will without hesitation conclude that it is infinite. The approach followed in this chapter blocks DS while allowing _+ to work unhindered. Readers may continue in this chapter with some scepticism but it is hoped that they will find the material interesting, illuminating, and even fun. The author has no metaphysical agenda: his purpose is not to reject classical logic as incorrect, as those working in relevance logic have sometimes done, but to explain one way of monitoring its application to block certain surprising inferences. It is logic at play rather than logic with a reformatory mission.
11.2
A Bit of History
Historically, formal work on relevance-sensitive logics first got under way in the middle of the last century. Initially, it was dominated by the construction and study of what are called Fregean (or Hilbertian) axiom systems. They are defined recursively as the closure of a set of formulae (called the axioms of the system, usually presented as all instances of certain axiom schemes, optimally few in number and intuitively well-motivated) under certain rules (called derivation rules; formulae in the closure are called the theorems of the system. For classical logic, one of the most popular Fregean axiomatizations works with a language using only the connectives ¬, !, which we know to be functionally complete (Sect. 8.3.3 of Chap. 8). A marvel of compact elegance, it takes as axioms all formulae that are instances of any of the three schemes a ! (b ! a), (a ! (b !
366
11
Sticking to the Point: Relevance in Logic
c)) ! ((a ! b) ! (a ! c)), (¬a ! ¬b) ! ((¬a ! b) ! a) and it has a single derivation rule, which in this context is called detachment, telling us that whenever a, a ! b are theorems then b is a theorem. One of the basic results in the mathematical theory of classical logic, dating from the early twentieth century, is the soundness-and-completeness theorem: there are axiom systems (such as the one just described) whose set of theorems coincides with the set of tautologies (in the language of the system). Nothing succeeds like success and so, for relevance logic, the idea was to construct a similar Fregean axiom system for a language containing a connective !, now read as ‘relevant implication’, alongside the truth-functional connectives ¬, ^, _ (from which, as we saw in Chap. 8, one may easily define material implication). This project was marked by some success and, among those active in the field, a certain level of consensus grew around the axiom system R, which accepts all the principles that are involved in the Lewis derivation except for disjunctive syllogism. For reference, we note that R has two derivation rules. One is detachment with respect to relevant implication, a, a ! b / b, echoing detachment with respect to material implication in the axiomatization of classical logic. The other is a rule which, in this context, is known as adjunction: a, b / a ^ b. It would be redundant if added to the usual axiomatizations of classical propositional logic, but it is not redundant in R. There are about a dozen axiom schemes, the exact number depending on how we count certain paired schemes. The following choice of axioms is quite standard for the system, as are their names, but we list them in an order that passes, very roughly, from those that are more transparent to others that are less so. The terminology ‘introduction’ and ‘elimination’ for some of these axioms reflects that for corresponding rules explained in Chap. 10. a!a ¬¬a ! a (a ! ¬b) ! (b ! ¬a) (a ^ b) ! a and (a ^ b) ! b a ! (a _ b) and b ! (a _ b) ((a ! b) ^ (a ! c)) ! (a ! (b ^ c)) ((a ! c) ^ (b ! c)) ! ((a _ b) ! c) (a ^ (b _ c)) ! ((a ^ b) _ (a ^ c)) (a ! b) ! ((b ! c) ! (a ! c)) (a ! (a ! b)) ! (a ! b) a ! ((a ! b) ! b)
Identity Double Negation Elimination One form of Contraposition ^-Elimination _-Introduction ^-Introduction _-Elimination Distribution Suffixing Contraction Assertion
All these axioms become classical tautologies when ! is read as material implication. Since each of the two derivation rules preserves the property of being a tautology it follows that, under that reading, all theorems of the system are tautologies (but not conversely).
11.2
A Bit of History
367
The last of the axioms of R deserves special mention. It illustrates the difference between requiring merely the relevance of antecedent to consequent in an arrow formula, and requiring (alone or in addition) that there is of some kind of necessity in the connection between the two. They are not the same. On the one hand, the explosion formulae (p ^ ¬p) ! q and p ! (q _ ¬q) with the arrow read as material implication are logically necessary since they are tautologies but there is no relevance between antecedent and consequent. On the other hand, the ‘assertion’ scheme a ! ((a ! b) ! b), last in the above list, is plausible when relevance alone is in question (and turns out to be acceptable on the analysis developed in this chapter), but is not so when the arrow is read as some kind of necessary implication. Another example of the same phenomenon is the formula (a ! (b ! c)) ! (b ! (a ! c)), known as permutation or exchange, which is derivable in R. The two are intimately related; indeed given permutation, assertion becomes equivalent to (a ! b) ! (a ! b), which is just an instance of a ! a. There is a broad consensus on how to build logics with a connective that can be read as expressing necessity; they are called modal logics (references can be found in the guide to further reading). One might wish to inject both relevance and necessity into the arrow connective. In the relevance logic literature, the systems called E (for entailment) and NR (for necessity with relevance) seek to do just that, rejecting both permutation and assertion. However, in the author’s view, it is better to obtain a clear view of each of the two non-classical ingredients—modality and relevance—considered separately before attempting to combine them. Accordingly, in this chapter, we consider only the requirement of relevance. Roughly speaking, the goal is to examine a ‘relevance-sensitive counterpart of material implication’. The list of axioms of R is quite long, its elements disparate and there is no immediately obvious rationale for how, exactly, the line is drawn between what deserves to go in and what should be kept out. One naturally hankers for a semantic approach analogous to the valuation procedure for classical propositional logic, with respect to which the soundness and completeness of this axiom system (or another close to it) may be established. Such an approach has in fact been devised; it is known as the Routley-Meyer semantics for relevance logic and a soundness-and-completeness theorem has been proven linking it with the above axiom system. For readers familiar with the Kripke semantics for modal logic (not discussed in this text) it may be helpful to say that Routley-Meyer abstracts on Kripke by replacing his two-place relations by three-place ones, between ‘states’ at which formulae may be counted as true or false under a given valuation. To calculate the truth-value of a formula a ! b at a given state, one needs to know the values of its antecedent and consequent, not only at that state but also at others specifiable in terms of the three-place relation. In addition, the truth-value of a formula ¬a at a given state is determined by that of a in another state that is selected by an auxiliary one-place function commonly known as a ‘star function’. The approach is very flexible and can be adapted to yield a wide variety of logics. In particular, with suitable constraints on the three-place relation and the star function, along with a suitable articulation of the above idea for
368
11
Sticking to the Point: Relevance in Logic
evaluating the truth-value of an arrow formula at a given state, one can ensure that the semantics validates all and only the theorems of R. However, the Routley-Meyer semantics has two major shortcomings, at least in so far as its application to relevance logic is concerned. One is that the constraints required on the three-place relations turn out to be arcane and intuitively uninterpretable—unlike the transparent constraints of reflexivity, transitivity and/or symmetry that are placed on two-place relations in the Kripke semantics for basic systems of modal logic. The other is that negation is evaluated in a non-classical way, despite the fact that the only connective that was initially in question was the arrow and even though the semantics ends up validating all classical tautologies in the connectives ¬, ^, _ alone. The valuation of ¬a, as true at a given state s iff a is false in state *(s), has the effect of allowing both a, ¬a to be true at the same state. While this may be seen as no more than a technical device to make Routley-Meyer models output a desired set of formulae it has also had the unfortunate effect of encouraging flights of fancy and (to put it bluntly) mystification in the shape of a philosophy of dialetheism that hails the existence of true contradictions in logic, mathematics, thought and nature. In this chapter we have no need for such hypotheses. A quite different way of articulating relevance logic is to take a classical system of natural deduction (see Chap. 10 especially Sect. 10.3.3) and restrict the rule of conditional proof (CP) to enforce a requirement of relevance. Recall that classical CP in, say, its second-level presentation, has the form A, b ⊨ c/A ⊨ b ! c. For relevance-sensitive natural deduction, it is required that the subordinate inference A, b ⊨ c be carried out in a way that, in a certain syntactically defined sense, actually uses the supposition b. The idea is intuitively natural and, again, may be elaborated in a manner that generates the same output as the axiom system R. The shortcomings are in the details of its articulation. While negation is not disturbed, as it is in the Routley-Meyer semantics, it turns out that inelegant and apparently ad hoc restrictions need to be placed on classical natural deduction rules for conjunction and disjunction (specifically on ^+, _−) in order to block ‘cheating’ manoeuvres that would otherwise get around the restriction on conditional proof and bring us back to classical logic for the arrow. We do not go further into the quite labyrinthine details of these three approaches —Fregean axiomatization, Routley-Meyer style semantics and constrained natural deduction (there are pointers to good expositions at the end of the chapter). Instead, we adapt the method of semantic decomposition trees (truth-trees), as set out in Sect. 8.5 of Chap. 8. By suitably monitoring the classical decomposition rule for 0: a ! b and modifying that for 1: a ! b, while leaving unchanged the rules for all the other connectives, one can generate an interesting logic for relevance-sensitive implication that turns out to be a little stronger than R.
11.3
11.3
Analyses of some Truth-Trees
369
Analyses of some Truth-Trees
In this section, we examine the classical truth-trees of some of the ‘undesirable’ tautologies mentioned in Sect. 11.1 and analyse what is going on in them. It is convenient to begin with right explosion and then look at disjunctive syllogism and comparability. Their trees will, for the duration of this section only, be constructed using the decomposition rules for classical logic that are summarized in Tables 8.12 and 8.13 of Chap. 8. The rule decomposing 0: a ! b to 1: a, 0: b on the same branch is called counter-case: its output nodes, labelled 1: a, 0: b, are called critical nodes and are partners of each other. They will play a central role in our analysis. Although counter-case is the very same rule that was used for classical logic in Table 8.12 of Chap. 8, its status is rather different in the present context. Whereas for truth-functional arrow, critical nodes are consequences of their negated arrow formula, that is not the case for relevant arrow where the falsehood of a ! b can have two sources: the truth of a accompanied by the falsehood of b, or the lack of relevance between a and b. In the present context, passage from 0: a ! b to 1: a, 0: b serves as a procedural rather than an inferential step, with the critical nodes serving as wlog suppositions (see the logic box in Sect. 7.6.2 of Chap. 7, and further examples later in the same chapter). In other words, to obtain a crash pair from 0: a ! b, it suffices to do so from the pair 1: a, 0: b. Figure 11.1 gives the tree for right explosion. To reduce clutter, links are omitted in this and following figures when there is no branching. The annotations ‘dead’ and ‘alive’ on each branch are left for the reader to fill in if desired, likewise for the ticks signalling that decompositions have actually been carried out. For rapid visual inspection, however, critical nodes are written as ⦿, with • for non-critical nodes; they will play a vital role in what follows. The crash-pair is {1: p, 0: p}, Consider the two critical nodes obtained by applying the counter-case rule to the root 0: (p ^ ¬p) ! q. One of them, 1: p ^ ¬p, is used in getting the crash-pair but its partner 0: q is not. Using the same basic idea as is applied to conditional proof in relevant natural deduction (briefly described in Sect. 11.2), we will require that if one critical node is used in obtaining the crashpair then so is its partner. We call this requirement parity and will define it rigorously in the following section. It sounds straightforward, but we need to be careful, since not all examples are as simple as right explosion! A truth-tree may
•
0: (p∧¬p)→q
⦿
1: p∧¬p
⦿
0: q
•
1: p
•
1: ¬p
•
0: p
Fig. 11.1 Truth-tree for right explosion
370
11
Sticking to the Point: Relevance in Logic
have multiple branches and on any given branch there may be multiple critical pairs, also multiple crash-pairs—we will see examples of all of these as we go along. So, a rigorous definition of parity will need to juggle adroitly with branches, critical pairs and crash-pairs.
Alice Box: Nodes and labels
Alice
Hatter Alice
Hatter
Alice Hatter
Before we go any further, I have a question. Figure 11.1 represents nodes anonymously as points, written ⦿ or • according as they are or aren’t critical nodes. But shouldn’t they be given names to distinguish them from each other? In Fig. 11.1, that is done by the labels, made up of a formula and a truth-value. Is that sufficient? After all, it might happen that we may have two distinct nodes bearing the same label at different places in a truth-tree so, if we refer to the node by the label alone, we will not have identified it fully. Quite so. Putting your point briefly in the language of set theory: in some trees the labelling function is not injective. When that happens, as it will in a few of our examples, we will indeed need to give the nodes in question explicit names. But when it doesn’t happen, as in Fig. 11.1, we can safely use the labels alone to refer to the nodes. And when it does happen, do we name just the nodes involved in the failure of injectivity, or all the nodes of the tree? Both conventions are feasible but, in the interests of uniformity and visual harmony, I would suggest that when you need to name one node, you name them all
Let’s now look at disjunctive syllogism, whose truth-tree in Fig. 11.2 has two branches. Given the fact that we are ‘blaming’ it for the Lewis derivation of right explosion, its truth- tree will be of particular interest. As there is more than one crash-pair in the tree, we use arrow annotations to signal them visually. If you prefer to signal crash-pair nodes by writing a sign such as ⊥ next to them, feel free to do so but, to be clear about what clashes with what, you will need a bit more detail. In Fig. 11.2 you would need to write ⊥1 at nodes 5 and 7 of the left branch and ⊥2 at nodes 3 and 7 of the right branch. Both branches of the tree crash, with crash-pair {0: p, 1: p} on the left and {0: q, 1: q} on the right. But the left branch does not crash with parity, since the critical node 1: (p _ q) ^ ¬p is used in getting the unique crash-pair on that branch while its partner 0: q is not. The lesson is that an adequate definition of parity will need to consider all branches. Lest it be thought that this lesson is peculiar to disjunctive syllogism, the same consideration arises for many other formulae that are close to right explosion, for example ((p _ (q ^ ¬q)) ! p.
11.3
Analyses of some Truth-Trees
371
• 0: ((p∨q)∧¬p)→q ⦿ 1: (p∨q)∧¬p ⦿ 0: q • 1: ¬p • 0: p • 1: p∨q • 1: p
• 1: q
Fig. 11.2 Truth-tree for disjunctive syllogism
Alice Box: Disjunctive syllogism versus modus ponens
Alice
Hatter
Alice
I think that you have a difficulty here! In classical logic, disjunctive syllogism is essentially the same as modus ponens: the truth tables for _, ¬ and ! make ((p _ q) ^ ¬p) ! q semantically indistinguishable from ((¬p ! q) ^ ¬p) ! q. So, if the parity constraint knocks out the former, surely it will knock out the latter which, presumably, we do not want to do! Indeed it would, if positive arrow nodes 1: a ! b were decomposed by a forking rule as is customary for the classical arrow. Principles like contraposition would also be lost, as we will see in an exercise. But that is not the only way to decompose 1: a ! b. In the next section you will see how the forking rule for such nodes may be replaced by a non-forking one that leaves modus ponens, contraposition and their friends unscathed. I hope you keep your promise …
We consider two more examples of the decomposition of negative arrows 0: a ! b, focusing on the role of the parity condition. The tautology (p ! q) _ (q p), sometimes known as ‘comparability’, appears to be undesirable for relevant arrow. Its truth-tree in Fig. 11.3 has only one branch, but two crash-pairs and two pairs of critical nodes. The critical pairs are linked by crescents to highlight which node is a partner of which. A peculiarity of this tree is that while each critical node is used in getting some crash-pair (namely, the crash-pair of which it is an element), there is no crash-pair such that, whenever a critical node n is used in getting it, then so is n’s partner. Consider, for example, the first of the two crash-pairs, {1: p, 0: p}. Its two elements are themselves critical nodes, but they are not partners as they emanate from distinct applications of counter-case, as flagged by the crescents. Now, a node in a truth-tree is always the last item in the path of nodes used to reach it, so it is natural to understand the notion of dependency in such a way that each node depends on itself
372
11
Sticking to the Point: Relevance in Logic
•
0: (p→q)∨(q→p)
•
0: p→q
•
0: q→p
⦿
1: p
⦿
0: q
⦿
1: q
⦿
0: p
Fig. 11.3 Truth-tree for comparability
as well as on the preceding nodes in its path. With this understanding, the crash-pair {1: p, 0: p} depends on the critical node 1: p, but does not depend on its partner 0: q. Similar considerations apply to the other crash-pair {0: q, 1: q}. This example has two morals. One is that when there is more than one crashpair or more than one pair of critical nodes on a branch, we need to be careful about the order of quantifiers over them in our definition of parity. The other is that we need to be rigorous in our definition of dependence in a decomposition tree. Essentially the same considerations arise in the truth-tree for the tautology p ! (p ! p), known as mingle. Its antecedent and consequent share a letter, but it is not generally accepted by relevance logicians (and is not derivable in the axiomatic system R). Its tree is given in Fig. 11.4. Two of the nodes have the same label 1: p so, following the Hatter’s recommendation, we give them and all the other nodes explicit names. Note that while n1, n3 are both obtained by counter-case they issue from different nodes, namely r, n2 respectively. There are two overlapping crash-pairs, namely {n1, n4}, {n3, n4}, as indicated by the pointers. The first crash-pair {n1, n4} depends on critical node n4 but not on its partner n3, their partnership highlighted by a crescent. The second crash pair {n3, n4} depends on critical node n2 but not on its partner n1.
•
r 0: p→(p→p)
⦿ n1: 1: p ⦿ n2: 0: p→p ⦿ n3: 1: p ⦿ n4: 0: p Fig. 11.4 Truth-tree for mingle
11.4
11.4
Direct Acceptability
373
Direct Acceptability
We now articulate rigorous definitions of the ideas that were explored informally in Sect. 11.3, namely decomposition rules for positive and negative arrows as well as notions of crash-pair, critical pair, dependence, parity, and acceptability of a tree and formula. Table 11.1 gives the rules for arrow. Just as in the classical context, negative arrows are still decomposed by counter-case without restriction on its actual application; the restriction will be a global one, on what can be done with the outputs in the entire tree, and will be defined in the parity condition shortly. On the other hand, positive arrows are no longer handled by implicative forking but by modus ponens. Eyebrows may rise at a description of modus ponens as a ‘decomposition’ rule, but the output is indeed a sub-formula of one of the two inputs. For ease of reference, Table 11.2 recalls the decomposition rules for the connectives ^, _, ¬. They are unchanged from the classical context as described in Chap. 8 Sect. 8.5. We recall from Chap. 8 that a crash-pair is a pair (1: f, 0: f) of nodes on the same branch, labelled by the same formula with opposite signs. On the other hand, a critical pair is a pair of nodes, labelled 1: u, 0: w, that are introduced on the same branch by an application of the counter-case rule to a node labelled 0: u ! w. The two critical nodes so introduced are said to be partners of each other. Note that critical nodes can sometimes themselves elements of crash-pairs; for example, when we decompose 0: p ! p the two critical nodes form a crash-pair. Dependence is defined recursively, going backwards. We say that a node x depends on a node n in a decomposition tree iff n is in the least set D(x) of nodes such that x 2 D(x) and whenever D(x) contains a non-root node then it also contains the node (or both nodes, for modus ponens) from which it was obtained by an application of a decomposition rule. Note that, as a limiting case, every node depends on itself and that the relation is transitive. The set D(x) is referred to as the trace of x. A set of nodes is said to depend on n iff at least one of its elements does so. In other words, writing X for any set of nodes and D(X) for its trace, D(X) = [ {D(x): x 2 X}. In particular, for crash-pairs X = {1: f, 0: f}—which are the only sets of nodes whose dependency will interest us in what follows—we have D(X) = D({1: f, 0: f}) = D(1: f) [ D(0: f). Table 11.1 Decomposition rules for relevance-sensitive implication Modus ponens
Counter-case
Given nodes m, m′ on a branch, labelled by Given a node m on a branch, labelled by 1: a, 1: a ! b 0: a ! b we can add to that branch, without forking one further node n labelled by two nodes n1, n2 labelled respectively by 1: b 1: a, 0: b
374
11
Sticking to the Point: Relevance in Logic
Table 11.2 Classical decomposition rules for ^, _, ¬ Given a node m on a branch, labelled by 1: a ^ b 0: a ^ b 1: a _ b 0: a _ b we can add to that branch two two two two further nodes n1, n2, with the branch not forking forking forking not forking where n1, n2 are labelled respectively by the formulae 1:a, 1:b 0: a, 0: b 1: a, 1: b 0: a, 0: b
1: ¬a
0: ¬a
one node n
labelled by 0: a 1: a
A truth-tree is said to be directly acceptable iff for every branch B of the tree, there is a crash-pair Z = {(1: f), (0: f)} on B such that for every critical node n, if Z depends on n then it also depends on the partner of n. When this condition is satisfied for a specific branch B and crash-pair Z on B, we also say briefly that B and Z satisfy parity. Some readers may find this definition easier to digest if the words ‘for every critical node n’ are expanded to ‘for every critical node n on B’; the two formulations are equivalent since whenever a node is on a branch B then so too is every node on which it depends. On the other hand, the order of the quantifiers in the definition is vital: 8B9Z8n rather than in some other sequence. As often for such conditions, it can be convenient to replace the existential quantifier 9Z by a choice function on B. So formulated, the definition requires that there is a choice function B ↦ ZB taking each branch of the tree to a designated crash-pair lying on it, such that for every branch B and critical node n, either both n and its partner are in the trace of the designated crash-pair ZB or neither of them are. Finally, a formula u is said to be directly acceptable iff it has some directly acceptable tree, that is, iff there is a directly acceptable truth-tree with root labelled 0: u. A formula scheme is deemed directly acceptable iff all its instances are. Inspecting Figs. 11.1 through 11.4 and the small number of trees obtainable from them by varying the order in which decomposition rules are applied, it is easy to check that none of the formulae (p ^ ¬p) ! q (right explosion), ((p _ q) ^ ¬p) ! q (disjunctive syllogism), (p ! q) _ (q ! p) (comparability), p ! (p ! p) (mingle) are directly acceptable, in accord with our informal discussion in Sect. 11.3.
Alice Box: Why the existential quantier?
Alice Hatter
Alice
Why the existential quantifier over crash-pairs on a branch? Why not require that for every branch B and every crash-pair Z on B, etc.? For a branch to be dead (to use the terminology of Chap. 8) only one crash-pair is needed. Others may happen to turn up on the branch without being involved in that crash. If they fail to satisfy parity, it should not affect the situation. Can you give me an example?
11.4
Direct Acceptability
Hatter
375
Sure. Consider the contraction formula (p ! (p ! q)) ! (p ! q), one of the axioms of the system R. It is easily checked to be directly acceptable, and so too is its instance (p ! (p ! p)) ! (p ! p), where p is substituted for q. The tree for the latter is just a substitution instance of the tree for the former but, because of the identification of letters, it has a second crash-pair that happens to fail parity. That does not affect the damage done to the branch by the other crash-pair, which does respect parity.
The more applications of counter-case are carried out in a tree, the more care is needed in checking the traces of crash-pairs to see whether parity is satisfied. To identify the trace D(x) for a given node x, do not just eyeball the tree as a whole or try to work downwards from the root. Work backwards from x by systematically applying the recursive definition of dependence. When there are at most two branches, each with its designated crash-pair, you can keep track of your work by placing ticks alongside the nodes, say on the left of them for the left branch and on the right for the right branch. You may find it helpful to use other annotations and pointers to record dependencies in more complex examples. We have not done that in this chapter as it quickly generates clutter that makes the figure annoying to read for anyone other than the person who constructed it. Exercise 11.4.1 Check that (a) contraposition (p ! q) ! (¬q ! ¬p) is directly acceptable, but (b) it would not be so if we used implicative forking as decomposition rule for positive arrow formulae. (c) Compare the two truth-trees to explain ‘geometrically’ the difference of outcome. This fulfills a promise made to Alice. Solution (a) See Fig. 11.5. There is a unique branch with a unique crash-pair. There are two pairs of critical nodes, but parity is satisfied; indeed, every critical need is used in getting the crash-pair. (b) See Fig. 11.6. Implicative forking applied to the second node creates two branches; we have delayed the branching as late as possible, but advancing it makes no difference to the analysis. The crash-pair in the left branch is {1: p, 0: p} depending on critical node 0: ¬p but not on its partner 1: ¬q. Similarly, the crash-pair in the right branch is {0: q, 1: q}, which depends on critical node 1: ¬q but not on its partner 0: ¬p. Double trouble! (c) The first seven nodes are the same in the two trees, but modus ponens in Fig. 11.5 allows us to omit the left branch of Fig. 11.6 and retain only the right one. Parity in that branch, which failed in Fig. 11.6, is now satisfied since 1: q is now obtained by modus ponens using 1: p as minor premise, which in turn depends on the critical node 0: ¬p. End of solution.
376
11
Sticking to the Point: Relevance in Logic
• 0: (p→q)→(¬q→¬p) ⦿ 1: p→q ⦿ 0: ¬q→¬p ⦿ 1: ¬q ⦿ 0: ¬p • 0: q • 1: p • 1: q Fig. 11.5 Truth-tree for contraposition
•
0: (p→q)→(¬q→¬p)
⦿ 1: p→q ⦿ 0: ¬q→¬p ⦿ 1: ¬q ⦿ 0: ¬p • 0: q • 1: p • 0: p
• 1: q
Fig. 11.6 Contraposition fails under implicative forking
Exercise 11.4.2 (a) Show that all classical tautologies in the connectives ¬, ^, _ are directly acceptable. (b) Which of the axiom schemes of the system R, listed in Sect. 11.2, are directly acceptable? (c) Which of the ‘undesirable’ tautologies (¬p _ q) ! (p ! q), (p ! (q ! p)) are directly acceptable? (d) What about the tempting formulae (p ! q) ! (p ! (p ^ q)) and its dual (p ! q) ! ((p _ q) ! q)? (e) And the formulae ((p ! (q ! r)) ! (q ! (p ! r)), (p ! (q _ (p ! q))) ! (p ! q)?
11.4
Direct Acceptability
377
Solution outline (a) The truth-tree for such a formula uses only the classical decomposition rules of Table 11.2 and parity is vacuously satisfied since there are no critical nodes. (b) All axioms of R turn out directly acceptable. The construction of their trees and inspections for parity are straightforward. When writing out the tree for the axiom of contraction, one can instantiate it to obtain a tree for (p ! (p ! p)) ! (p ! p) to check out the Hatter’s remark in the last Alice Box. (c) Neither of the two formulae is directly acceptable. The first has two branches, both of which fail parity. The second has a single branch, which fails parity. Variations in the order of applying the decomposition rules do not remedy matters. (d) Despite their initial attractiveness, these formulae are not directly acceptable. In both cases, every branch of the decomposition tree contains a crash-pair, but parity fails in one branch. For example, for the first formula, parity fails in the branch passing from 0: p ^ q to 0: p. Again, variations in order of rule-application do not repair the situation. (e) Both formulae are directly acceptable. End of solution. The first formula in Exercise 11.4.2 (e), ((p ! (q ! r)) ! (q ! (p ! r)) is known as permutation and is very useful in manipulating formulae into equivalent forms. It is a theorem of R but is not generally accepted in systems like E that attempt to combine requirements of relevance and necessity in the arrow. The second formula, (p ! (q _ (p ! q))) ! (p ! q), has been called skewed cases. It and its one-letter substitution instance (p ! (p _ (p ! p))) ! (p ! p) are the simplest known examples of formulae that are directly acceptable but not theorems of R. It is possible to show that direct acceptability satisfies the letter-sharing condition, in other words, u shares at least one sentence letter with w whenever u ! w is directly acceptable. However, it also has a major limitation: it is not as broad as one would like it to be. There are formulae that appear perfectly reasonable when one reads the arrow as relevance-sensitive implication, but which are not directly acceptable. Perhaps the simplest example is (¬¬p ! q) ! (p ! q), contrasting with its directly acceptable converse (p ! q) ! (¬¬p ! q). Its truth-tree is given in Fig. 11.7.
• 0: (¬¬p→q)→(p→q) ⦿ 1: ¬¬p→q ⦿ 0: p→q ⦿ 1: p ⦿ 0: q Fig. 11.7 Truth-tree for (¬¬p ! q) ! (p ! q)
378
11
Sticking to the Point: Relevance in Logic
In this tree, one would like to apply modus ponens to 1: ¬¬p ! q and its antecedent 1: ¬¬p, but we do not have that antecedent at hand. We cannot obtain it by decomposing 1: p, since decomposition always eliminates a connective, never introduces one. We cannot apply implicative forking to 1: ¬¬p ! q since that rule has been replaced by modus ponens—and even if we retain and apply it, parity fails in both branches. Nor can we apply modus tollens to 1: ¬¬p ! q accompanied by 0: q, since modus tollens is not one of our direct decomposition rules. Direct decomposition can go no further. We note in passing that the tree of Fig. 11.7 would still be blocked if we were not requiring parity. It thus illustrates the fact that if we were to replace implicative forking by modus ponens in the truth-trees for classical propositional logic, the method would become incomplete: not all tautologies would be validated. Exercise 11.4.3 (a) Show that while the tautology (p ! q) ! ((p ^ p) ! q) is directly acceptable, its converse is not. (b) Show that the tautology ¬((p _ ¬p) ! (q ^ ¬q)) is not directly acceptable. Solution outline (a) The truth-tree for the converse, ((p ^ p) ! q) ! (p ! q), snags because we cannot go from 1: p to 1: p ^ p although we can decompose in the reverse direction. (b) We can show, quite generally, that no negated conditional ¬(u ! w) has a directly acceptable tree. The root of such a tree is labelled 0: ¬(u ! w) and the only decomposition rule we can apply to it is one for negation, getting 1: u ! w. The only rule that could possibly be applied to 1: u ! w is modus ponens, but that needs 1: u as minor premise, which is not available in the tree thus far constructed. End of solution.
The negative results of Exercise 11.4.3 and Fig. 11.7 point to an intuitive difficulty with the definition of direct acceptability, since the formulae concerned seem quite agreeable when read ‘relevantly’. The same results also reveal a formal weakness: that the set of directly acceptable formulae is not closed under detachment wrt the arrow. For each of the three formulae, call it w, we can find a formula u such that both u and u ! w are directly acceptable although we know that w is not. For example, we can check that both of u: = (p ! ¬¬p) and u ! w: = (p ! ¬¬p) ! ((¬¬p ! q) ! (p ! q)) are directly acceptable while, as seen in Fig. 11.7, w: = (¬¬p ! q) ! (p ! q) is not.
11.5
11.5
Acceptability
379
Acceptability
The question thus arises: Is there a principled way of extending our decomposition procedure to validate formulae such as those in Fig. 11.7 and Exercise 11.4.2 and, more generally, ensure closure under detachment—without losing the letter-sharing property enjoyed by direct acceptability? We can get some mileage by adding modus tollens as a decomposition rule to accompany modus ponens, but that is not enough. We need a more radical remedy, which we articulate as a recursion with the directly acceptable trees as basis, to be closed under an appropriate operation. Specifically, we define the notion of an acceptable tree as follows. Basis: Every directly acceptable tree is acceptable. Recursion step: If the formula u ! w is acceptable then, at any stage in the construction of a tree, we allow passage from a node labelled 1: u to a node labelled 1: w (forwards clause) and we also allow passage from 0: w to 0: u (backwards clause). A formula is deemed acceptable iff it has at least one acceptable decomposition tree. Evidently, applications of the recursive step do not always decompose in a strict sense since in, the forwards clause, w may be more complex than u and conversely in the backwards clause. Nevertheless we will call this a ‘decomposition’ step in an indirect sense of that term. Note that in the recursive rule the ‘justifying’ formula u ! w need not label any node of the tree. Observe also that both forward and backward clauses apply the recursive rule to a single node, not two, unlike the direct decomposition rule of modus ponens, which passes from two nodes as input. We digress with a comment for those accustomed to working with unsigned truth-trees in classical logic (cf. the remarks at end of Chap. 8). If we use unsigned trees in the present context (as is done in the extended treatment referenced at the end of the chapter) then we can dispense with a backwards clause in the recursion step; only a forwards clause is needed. This could be seen as being a minor advantage for the unsigned option; on the other hand, the signed one seems to be easier for most students to assimilate. The choice between the two modes of presentation remains largely a matter of taste, as in classical logic. Exercise 11.5.1 We have already noticed that although the tautologies (i) (¬¬p ! q) ! (p ! q), (ii) ((p ^ p) ! q) ! (p ! q), (iii) ¬((p _ ¬p) ! (q ^ ¬q)) are attractive under an understanding of arrow as relevant material implication, they are not directly acceptable. Show that they are acceptable. Solution outline In the truth-trees for these formulae we apply the recursive rule, in each instance appealing to a suitable directly acceptable formula as ‘justification’. For (i) appeal to p ! ¬¬p, for (ii) to p ! (p ^ p). For (iii), which we call polarity, appeal to ((p _ ¬p) ! (q ^ ¬q)) ! (¬(p _ ¬p) _ (q ^ ¬q)). This looks rather long, but is merely an instance of the directly acceptable scheme (a ! b) ! (¬a _ b). Figure 11.8 gives details for polarity.
380
11
Sticking to the Point: Relevance in Logic
• 0: ¬((p∨¬p)→(q∧¬q)) • 1: (p∨¬p)→(q∧¬q) • 1: ¬(p∨¬p)∨(q∧¬q) • 1: ¬(p∨¬p)
• 1: q∧¬q
• 0: p∨¬p
• 1: q
• 0: p
• 1: ¬q
• 0: ¬p
• 0: q
• 1: p Fig. 11.8 Acceptable truth-tree for polarity
Exercise 11.5.2 Which among the three schemes for the popular Fregean axiomatization of classical logic mentioned in Sect. 11.2, are acceptable? Solution outline The second axiom scheme (a ! (b ! c)) ! ((a ! b) ! (a ! c)) and the third one (¬a ! ¬b) ! ((¬a ! b) ! a) are acceptable; indeed, they are directly so. On the other hand, the first one, a ! (b ! a), is not acceptable since its instance p ! (q ! p) (which we call mangle) and even the more specific instance p ! (p ! p) (mingle) are not acceptable. A decomposition tree for mingle was given in Fig. 11.4 of this chapter and the informal analysis there carries through unchanged under our formal definitions.
Alice Box: Negative outcomes
Alice
Hatter Alice
Hatter
Just a minute! I think that there is a gap in the verification that mingle is not acceptable. I see that the decomposition tree for it in Fig. 11.4 fails parity, but that tree does not even apply the recursive rule! There are lots of ways in which we could apply the recursive rule to nodes in that tree, but I see none that gets a crash-pair with parity… Agreed. But that does not mean that no successful application is possible! Clearly, there are more than just ‘lots’ of ways of applying the recursive rule—there are infinitely many, giving rise to infinitely many candidate truth-trees for any given formula. How do we know in advance that none of them will satisfy parity, thus providing a clever or devious verification of acceptability? Er, um …
11.5
Acceptability
381
Alice has an important point here. The failure of a specific tree to satisfy parity does not mean that there is no tree satisfying it. For direct acceptability, where the recursive rule is not available, we can get around the difficulty, because there is only a limited number of ways in which one can vary the order of application of the decomposition rules; the variant trees can thus be checked out one by one. But for acceptability, where the recursive rule is available and there is no limit on the number of trees that one could create, one needs a proof that none of them are acceptable. At the time of writing, techniques for such proof have not yet been developed; thus we have as yet no rigorous method for establishing negative results for acceptability. In practice, after working with a variety of examples, one gets a feel for them and, for certain among them (such as mingle or explosion), one acquires intuitive confidence that there is no way of repairing the failure of parity that arose in the most natural tree. Nevertheless, we should acknowledge explicitly that in the absence of full proof, all negative assessments that arise from inspecting a single tree, or just a few of them, should be treated as presumptive, even if we sometimes neglect to include that qualification explicitly in what follows. In contrast, positive assessments of acceptability are fully verifiable with a single tree. A closely related fact is that while the set of directly acceptable formulae is computable (decidable) in the sense that we can, in principle, write a computer program that will check out whether an arbitrarily given formula is directly acceptable, it is not clear whether the same holds for acceptability. Another way of saying the same thing, which will make sense to readers familiar with some basic notions from the theory of computability, is that while the set of acceptable formulae is semi-computable (recursively enumerable), it is not currently known whether its complement is also semi-computable. There is some reason to suspect that it is not so, for it is known that the set of theorems of the closely related axiomatic system R is not computable. Exercise 11.5.3 Which of the tautologies (¬p _ q) ! (p ! q), (p ! q) ! (p ! (p ^ q)), (p ! q) ! ((p _ q) ! q), which we have already seen not to be directly acceptable, are nevertheless acceptable? Solution outline None of them appear to be acceptable; in each instance, attempts to use the recursive rule get nowhere. End of solution. Notwithstanding the situation for negative assessments, acceptability has features that make it attractive. We list some of them, with verifications. 1. All directly acceptable formulae are acceptable. 2. The set of acceptable formulae is closed under substitution, adjunction (as conjunction is usually termed in this context) and detachment with respect to the arrow. 3. Every theorem of the axiomatic system R is acceptable.
382
11
Sticking to the Point: Relevance in Logic
4. The set of acceptable formulae coincides with the closure of the set of directly acceptable formulae under the decomposition rules of adjunction and detachment. Feature (1) is immediate by the definition. By Exercise 11.4.2 (a), this also shows that all classical tautologies in the connectives ¬, ^, _ are acceptable. For (2), we have three closure conditions to establish. Verifying substitution, suppose that u is acceptable and r is a substitution function; we want to show that r(u) is acceptable. Take an acceptable tree for u and make the same substitution r throughout the tree. Substitution instances of crash-pairs are still crash-pairs since r(¬u) = ¬r(u), and it is not difficult to check by induction on the construction of the tree that decomposition steps and parity are preserved. For adjunction, suppose that u, w are acceptable; we want to show that u ^ w is acceptable. Construct a tree with root 0: u ^ w, decompose to 0: u, 0: w on separate branches, copy-paste acceptable trees for u, w. Clearly, parity is preserved. For detachment, suppose u and u ! w are both acceptable; we want to construct an acceptable truth-tree for w. Put 0: w as root, apply the ‘backwards’ part of the recursive rule using the acceptability of u ! w as justification, to get 0: u, then paste in an acceptable tree for u. Parity is preserved. Since the axioms of system R are directly acceptable, as noted in Exercise 11.4.2 (b), point (3) is immediate from points (1), (2). For (4), the inclusion RHS LHS is already given by properties (1) and (2). The verification of the converse inclusion is rather more complex and will not be given here (it can be found in the extended treatment referenced at the end of the chapter). The operation of detachment mentioned in the points above should not be confused with that of modus ponens, nor with the forwards part of the recursive rule as these are defined in the chapter. We emphasized the distinction between the latter two when defining acceptability at the beginning of this section; this is a good moment to compare all three explicitly. • Modus ponens, as here understood, is a rule that is applied within trees. It says that we may pass from a nodes labelled 1: u ! w, 1: u on a branch to a node labelled 1: w, irrespective of whether the formula u ! w is acceptable. The rule is legitimate for acceptable as well as directly acceptable trees. • The forwards clause of the recursive rule, as defined in this section, is also applied within trees. It tells us that we may pass from a node labelled 1: u on a branch to a node labelled 1: w on the same branch whenever the formula u ! w is acceptable, irrespective of whether any node on the branch is labelled 1: u ! w. It is legitimate for acceptable trees, but not for directly acceptable ones. • Detachment, in the present context, is not a rule for constructing trees. It is a closure condition that holds for the set of all formulae that have some acceptable tree. It does not hold for the base set of directly acceptable formulae.
11.5
Acceptability
383
Exercise 11.5.4 (a) Show that whenever ¬w and u ! w are both acceptable, so too is ¬u. (b) Which of the following formulae are acceptable: (i) ((p ! q) ^ (p ! ¬q)) ! (p ! (q ^ ¬q)), (ii) (p ! q) ! ((p ! ¬q) ! (p ! (q ^ ¬q))), (iii) ((p ! q) ^ (p ! ¬q)) ! ¬p, (iv) (p ! q) ! ((p ! ¬q) ! ¬p)? Solution (a) Suppose ¬w and u ! w are both acceptable. Now the contraposition formula (u ! w) ! (¬w ! ¬u) is easily checked to be directly acceptable and so acceptable. Since acceptability is closed under detachment, ¬w ! ¬u is acceptable and so, by detachment again, ¬u is acceptable. (b) (i) Acceptable, in fact directly so. It is, indeed, an instance of ^ -introduction, one of the axiom schemes of R all of which are directly acceptable as we saw in Exercise 11.4.2 (b). (ii) Not directly acceptable and presumably not acceptable. Comparing (i) with (ii) we see the important difference, in relevance logic, between the classically equivalent schemes (u ^ w) ! v and u ! (w ! v). (iii) Acceptable, in fact directly so. (iv) Acceptable, in fact directly so. End of solution.
After having seen the failure of (ii) in Exercise 11.5.4 (b), one might be rather surprised at the positive status of (iv). Intuitively, one can understand the latter outcome by noting that, modulo a contraposition of p ! ¬q, it says the same as (p ! q) ! ((q ! ¬p) ! ¬p), and that the latter follows naturally from (p ! q) ! ((q ! ¬p) ! (p ! ¬p)), which is an instance of the transitivity scheme (one of the axioms of R) together with the directly acceptable (p ! ¬p) ! ¬p. Exercise 11.5.5 While modus ponens is one of the decomposition rules, modus tollens is not. In other words, we do not have a decomposition rule that authorizes passage from nodes labelled 1: u ! w and 0: w on a common branch to 0: u on that same branch. Show that it is, however, admissible for acceptability in the sense that in acceptable trees, its application merely shortens a longer decomposition without it. Solution Let nodes labelled 1: u ! w and 0: w lie on a branch of a decomposition tree. We want to show that a node labelled 0: u may legitimately be added to that branch. Now, an application of the forwards clause of the recursive rule, justified by the fact that (u ! w) ! (¬w ! ¬u) is directly acceptable, allows us to pass from 1: u ! w to 1: ¬w ! ¬u. Moreover, the backwards clause of the recursive rule authorizes us to pass from 0: w to 0: ¬¬w, justified by the fact that ¬¬w ! w is directly acceptable. From 0: ¬¬w we decompose to 1: ¬w, perform modus ponens on that in association with 1: ¬w ! ¬u to get 1: ¬u, and finally decompose to 0: u. End of solution.
384
11
Sticking to the Point: Relevance in Logic
Modus tollens can be a very useful short-cut in the construction of acceptable trees, as in the next exercise. Note, however, that the proof of admissibility in Exercise 11.5.5 appealed to both the forwards and backwards clauses of the recursive rule; the short-cut is not available for direct acceptability. Exercise 11.5.6 Show that every formula is acceptably equivalent to some arrow formula. In other words, for every formula a (in the language of ^, _, ¬, !) there is a formula b (in the same language) with principal connective arrow, such that both a ! b and b ! a are acceptable. Solution outline Put b = (a ! a) ! a. Then it is easy to check that a ! b is directly acceptable. Using the fact that modus tollens is admissible as a decomposition rule for acceptability (Exercise 11.5.5), we can construct an acceptable tree for b ! a with a single branch of just six nodes. End of solution. Exercise 11.5.7 Defining $ in the usual way as the conjunction of arrows in both directions, show that (¬(p ! q) ! r)$(p ! (¬q ! r)) is acceptable. Solution outline Since acceptability is closed under adjunction, it suffices to show that each of the two directions is acceptable. For (¬(p ! q) ! r) ! (p ! (¬q ! r)), see Fig. 11.9 which uses the admissible decomposition step of modus tollens. For the converse formula you are on your own. We end the chapter by stating a major open problem. We know that direct acceptability satisfies the letter-sharing condition (Sect. 11.4). But does acceptability continue to satisfy it? In other words, is it the case that u, w share at least one
• 0: (¬(p→q)→r)→(p→(¬q→r)) ⦿ 1: ¬(p→q)→r ⦿ 0: p→(¬q→r) ⦿ 1: p ⦿ 0: ¬q→r ⦿ 1: ¬q ⦿ 0: r • 0: q
direct decomposition up to here
• 0: ¬(p→q)
using modus tollens
• 1: p→q • 1: q Fig. 11.9 Acceptable truth-tree for (¬(p ! q) ! r) ! (p ! (¬q ! r))
11.5
Acceptability
385
sentence letter whenever u ! w is acceptable? At the time of writing, this question is still open. If the answer turns out to be negative, the author apologizes for the time you have put into this chapter. Relevance logic is still in an unsettled state!
11.6
End-of Chapter Exercises
Exercise 11.6 (1) Packing and unpacking arrows (a) (i) Show that the formula p ! (q ! r)) ! ((p ^ q) ! r) (packing, also known as import) is directly acceptable while (ii) its converse ((p ^ q) ! r) ! (p ! (q ! r)) (unpacking, export) is not directly acceptable. (b) Is unpacking nevertheless acceptable? Solution (a) (i) For packing, see the tree in Fig. 11.10, which clearly satisfies parity. (ii) For unpacking, the direct truth-tree in Fig. 11.11 grinds to a halt without reaching a crash-pair. Direct decomposition can go no further, so the formula is not directly acceptable. Note, in particular, that we are not allowed to conjoin 1: p and 1: q to get the antecedent of the second node and thus a modus ponens to 1: r. Do not confuse such conjunction of node labels within a tree with the property of adjunction, which tells us that the set of all acceptable formulae is closed under conjunction. (b) No, it appears to be inacceptable. Although we can apply the recursive rule to the second node in Fig. 11.10 to get 1: ¬(p ^ q) _ r, then fork and continue to crash-pairs on each branch, parity fails. No other way of applying the recursive rule seems to get us round this failure, so the formula is presumably unacceptable. • 0: (p→(q→r))→((p∧q)→r) ⦿ 1: p→(q→r) ⦿ 0: (p∧q)→r ⦿ 1: p∧q ⦿ 0: r • 1: p • 1: q • 1: q→r • 1: r Fig. 11.10 Directly acceptable truth-tree for packing
386
11
Sticking to the Point: Relevance in Logic
• 0: ((p∧q)→r)→(p→(q→r)) ⦿ 1: (p∧q)→r ⦿ 0: p→(q→r) ⦿ 1: p ⦿ 0: q→r ⦿ 1: q ⦿ 0: r Fig. 11.11 Failed direct truth-tree for unpacking
Exercise 11.6 (2) Some enthymemes We have seen in Exercise 11.4.2 (d) that the tempting formulae (p ! q) ! (p ! (p ^ q)) and (p ! q) ! ((p _ q) ! q) are not directly acceptable; natural attempts to show acceptability by applying the recursive rule also fail. Show that we may, however, regard these formulae as enthymemes, in the sense that we can add (trivially directly acceptable) antecedents u, w to obtain directly acceptable formulae ((p ! q) ^ u) ! (p ! (p ^ q)) and ((p ! q) ^ w) ! ((p _ q) ! q). Solution outline For the first formula, put u = p ! p, obtaining ((p ! q) ^ (p ! p)) ! (p ! (p ^ q)). This is an instance of the scheme ^+, which we know from Exercise 11.4.2 (b) to be directly acceptable. For the second formula, put w = q ! q, forming ((p ! q) ^ (q ! q)) ! ((p _ q) ! q). This is an instance of the directly acceptable scheme _−, which the same exercise tells us is directly acceptable. Exercise 11.6 (3) Some tricky formulae Check whether the following formulae are acceptable: (a) (p ! ¬p) ! ¬(¬p ! p); (b) (((p ^ q) ! r) ^ (p ! q)) ! (p ! r); (c) ((p ! q) ! p) ! p; (d) ((p ! p) ! p) ! p, (e) ((p $ (p ! q)) ! q. In (e), the biconditional abbreviates the conjunction of two conditionals. Solution outline (a) Acceptable, although not directly so. The key step in the decomposition is an application of the forwards clause of the recursive rule to a node labelled 1: ¬p ! p to get 1: p _ p. Inspection shows that parity is satisfied in the resulting tree. (b) Acceptable, although not directly so. The key step in the decomposition is an application of the forwards clause of the recursive rule to a node labelled 1: (p ^ q) ! r to get 1: ¬r ! ¬(p ^ q). Careful inspection of the resulting tree shows that parity is satisfied. Note, on the other hand, that parity fails in the corresponding tree for the unpacked version (p ! q) ! ((p ^ q) ! r) ! (p ! r)) which, as far as one can tell, is not acceptable.
11.6
End-of Chapter Exercises
387
(c) Neither directly acceptable nor, as far as one can tell, acceptable since the most natural ways of using the recursive decomposition rule snag. In more detail, beginning its tree with root 0: ((p ! q) ! p) ! p, counter-case gives 1: (p ! q) ! p and 0: p but here, already, direct decomposition is stuck; no further rule can be applied. When the recursive rule is available we can continue with modus tollens (see Exercise 11.5.5) to get 0: p ! q, then counter-case to 1: p and 0: q, thus providing a crash-pair {0: p, 1: p}. However, the parity condition is not satisfied in this tree: of the two critical nodes 1: p and 0: q, only the former is in the trace of the crash-pair. Historical note: This formula is known as ‘Peirce’s law’, after the late nineteenth century polymath Charles Sanders Peirce. It is a tautology, as is easily seen by translating the sub-formula p ! q into ¬p _ q. (d) Acceptable, notwithstanding the fact that it is also an instance of the unacceptable (c). Indeed, it is also an instance of the acceptable formula ((p ! p) ! q) ! q. More generally: whenever u is acceptable then (u ! q) ! q is also acceptable. To verify this, construct a tree with root 0: (u ! q) ! q, apply counter-case to get 1: u ! q, 0: q, modus tollens (Exercise 11.5.5) to get 0: u and finally paste in any acceptable tree for u (there is at least one, since by supposition u is acceptable). Clearly the resulting tree satisfies parity. (e) Acceptable, although not directly so. The key step when constructing its tree is to use the directly acceptable contraction formula ((p!(p!q))!(p!q) (Exercise 11.4.2 (b)) as justification for an application of the recursive rule.
11.7
Selected Reading
The approach in this chapter is set out in greater depth and detail in “Relevance-sensitive truth-trees”, available via the author’s webpage and also directly at https://drive.google.com/file/d/1Yw8J2QsJHhpaMa-E7mTS1RXe9rrYts Ge/view. This extends an initial presentation (with variant title) in the Australasian Journal of Logic 14:3 2017 http://ojs.victoria.ac.nz/ajl/article/view/4009/3617. For some healthy skepticism about the project of relevance logic, see chapter 5 of John Burgess Philosophical Logic, Princeton University Press 2012. That is probably the best place to go before reading further, in order to keep a sense of balance. Introductory entries on ‘Relevant Logic’ in Wikipedia and ‘Logic, relevance’ in the Stanford Encyclopedia of Philosophy review a variety of different approaches to the area, emphasizing the currently fashionable Routley-Meyer semantics. More detail and pointers to further literature can be found in J.M. Dunn & G. Restall’s chapter on relevance logic in D. Gabbay & F. Guenthner eds. Handbook of Philosophical Logic, 2nd edn, Vol. 6, Amsterdam: Kluwer 2002 as well as the chapter by E. Mares & R. Meyer on relevant logics in L. Goble ed. The Blackwell
388
11
Sticking to the Point: Relevance in Logic
Guide to Philosophical Logic, Blackwell 2001. The route via natural deduction is clearly presented for students by S. Sterrett as Part 3 of Three Views of Logic: Mathematics, Philosophy, and Computer Science by D. Loveland, R. Hodel and S. Sterrett, Princeton University Press 2014. First-degree relevance logic (that is, the fragment consisting of formulae a ! b where the only connectives in a, b are ¬, ^, _) is discussed in chapter 2 of the author’s book Topics in Modern Logic, Methuen 1973, reprinted by Routledge 2020 as volume 14 of its collection of Library Editions in Logic. For a discussion of (ultimately unsuccessful) attempts to use relevance logic in the axiomatization of set theory, see chapter 4 of Luca Incurvati Conceptions of Set and the Foundations of Mathematics, Cambridge University Press 2020. An instance of the formula in our end-of-chapter Exercise 11.6 (3) (e) plays a central role in the analysis. Those wishing to study modal logic can get quite far with various entries in the Stanford Encyclopedia of Philosophy. Textbooks include G. Hughes & M. Cresswell’s A New Introduction to Modal Logic London: Routledge 1996 directed mainly to students of philosophy and, for graduate students of mathematics and computing, P. Blackburn, M. de Rijke & Y. Venema Modal Logic, Cambridge University Press 2001.
Index
A Absorption, 19, 262, 263 Acceptability, 373, 380–384, 386 Acceptable formula, 381, 382, 385, 387 Acceptable tree, 379, 382–384, 387 Ackermann function, 132, 133, 149, 153 Acyclic, 77, 78, 149, 223, 227, 228, 243 Addition principle, 160–163, 173, 181, 183, 193, 202, 203 Admissible rule, 384 Algorithms, 236, 238, 239, 245–248, 271–274, 276, 278, 279 Alice boxes, 5, 11, 14, 21, 24, 26, 30, 32, 39, 47, 50, 61, 65, 71, 85, 91, 93, 96, 100, 107, 121, 133, 137, 139, 148, 161, 162, 167, 170, 195, 196, 198, 203, 209, 216, 217, 231, 233, 240, 243, 244, 253, 294, 299, 307, 309, 311, 315, 318, 335, 340, 346, 350, 352, 355, 370, 371, 374, 377, 380 Alphabet, 99, 108, 136, 137, 143, 150, 154, 155, 181 Alternating quantifiers, 313, 314 Andreescu, Titu, 184 Antisymmetry, 66–68, 70, 71, 73, 79, 80 Arbitrary instance, 327, 338, 345, 354 Archimedes’ principle, 192 Argument of a function, 83, 84 Aristotle, 116, 240, 300 Arity of a relation, 49 Assignment, 139, 155, 256, 258, 282, 285, 286, 304–307, 309, 312, 316 Association, 15, 18, 200–202, 262–265, 272, 301, 383 Asymmetric, 59, 60, 66, 70–72, 74, 75, 77, 78, 80, 223, 261 Atomic formula, 294, 305, 312 Axiom, 6, 9, 24, 25, 96, 103, 131, 136, 137, 365–368, 374, 376, 377, 380, 382, 383
B Backwards evaluation, 125 Bags, 167 Base rate, 211–213 Base rate fallacy, 213 Basic conjunction, 270–275, 288 Basic disjunction, 273–275, 288 Basic term, 293, 298 Basis, 75, 117–124, 127–130, 132, 133, 135, 138, 139, 141–144, 147, 152–155, 228, 229, 252, 286, 287, 293, 294, 305, 379 Bayesians, 212 Bayes’ theorem, 211 Belief organization and change, 251, 252 Ben-Ari, Mordechai, 289 Bendig, Alex Biconditional, 29, 40, 41, 139 Bijective functions, 95 Binary relation, 41, 42, 44, 45, 48, 84, 86 Binary search tree, 236–239, 247 Binary tree, 223, 226, 236, 237, 239 Bivalence, 253, 280, 312 Blackburn, P., 388 Bloch, E.D., 35, 81, 113, 361 Block of a partition, 63 Boolean operations, 3, 15, 21, 31, 33, 46 Bottom, 15, 18, 39, 44, 72, 75, 88, 112, 125, 126, 128, 133, 134, 142, 166, 175, 213, 223, 245, 246, 248, 265, 276, 301, 334 Bottom-up definition, 73, 74, 81, 109 Bottom-up evaluation, 128 Bound occurrence, 291, 297, 303, 306, 355 Branch of a tree, 224, 374 Breadth-first strategies, 282 Burgess, John, 387 C Canonical form, 270 Cantor, Georg, 96
© Springer Nature Switzerland AG 2020 D. Makinson, Sets, Logic and Maths for Computing, Undergraduate Topics in Computer Science, https://doi.org/10.1007/978-3-030-42218-9
389
390 Cantor-Schröder-Bernstein theorem, 111 Cardinality of a set, 96 Cartesian plane, 39 Cartesian product, 37–41, 76, 85, 150, 155, 159, 162, 163, 175, 179, 254 Causal relationship, 84, 199, 200 Cayley, Arthur, 240 Cell of a partition, 277 Chaining of inferences, 330, 331, 339 Characteristic function, 102, 103, 105 Children of a node, 227, 234 Choice, axiom of, 24, 103, 104, 145 Choice function, 100, 103, 374 Class, 4, 26, 65, 99, 132, 161, 178, 189 Clause, backwards, 379, 383, 384 Clause, forwards, 379, 382, 383, 386 Clean substitution, 291, 316 Closed formula, 297, 311, 312 Closure, 37, 45, 73, 75, 76, 80, 83, 87–89, 109, 134–139, 141, 142, 312, 332, 356, 365, 379, 382 Closure operation, 336 Closure relation, 332 Codomain, 42 Collection, 3, 4, 26, 34, 62–65, 74, 75, 103–106, 134, 135, 137, 138, 141, 142, 146, 149, 150, 167, 190, 193, 208, 209, 229, 230, 245, 272, 274, 388 Combination, 17, 19, 29, 30, 161, 168, 169, 171–175, 177–180, 182, 195, 196, 255, 259, 330, 331 Combination with repetition, 168, 169, 177 Combinatorics, 183 Common property, 12, 13 Commutation, 15, 18, 262, 263, 272, 301 Compactness, 336 Comparability formula, 364, 369, 371, 372, 374 Comparison principle, 98, 110 Complement, 3, 15, 21, 23, 24, 31, 46, 56, 81, 189, 193, 209, 212, 381 Complete graph, 248 Completeness in logic, 366, 367 Complete relation, 69, 144 Composition of functions, 89 Computable, 132, 381 Concatenation, 107, 108, 136 Conditionalization, 203, 204, 213 Conditional probability, 185, 190, 196–204, 206–208, 210, 211, 218 Conditional Proof (CP), 8, 20, 242, 327, 338–343, 345, 347, 348, 351–353, 356–358, 360, 361, 368, 369 Conditional statements, 8, 9, 117
Index Congruence relation, 266, 319 Conjunction, 16–19, 22, 29, 103, 139, 140, 143, 144, 254, 256, 259, 262, 266, 269–274, 276, 277, 280, 285, 294, 300, 301, 323, 324, 332, 364, 368, 381, 384, 385 Conjunctive Normal Form (CNF), 270, 273, 274, 279, 287, 288 Connected set, 244, 245 Connective, 17, 19, 22, 31, 136, 139, 143, 154, 155, 234, 236, 253–257, 259, 262–266, 270–272, 280, 282, 283, 285–287, 298, 321, 339–341, 346, 354, 357, 358, 363–368, 373, 376, 378, 382, 384, 388 Consequence operation, 336, 337, 359 Consequence relation, 327, 331–334, 336, 337, 341, 346, 354, 359, 360 Consequentia mirabilis, 263 Consistent, 323, 324, 330 Cons operation, 108 Constant, 106, 198, 235, 256, 292, 295, 296, 300, 304–309, 316, 317, 319, 323 Constant function, 84, 101, 106, 112, 186, 254, 255 Constructive proof, 350 Constructor, 135 Contingent, 266–268, 313 Contraction, 252, 366, 374, 377, 387 Contradiction, 24, 25, 67, 70, 71, 79, 95, 100, 110, 139, 148, 227, 243, 266–269, 271, 272, 276, 279, 280, 284, 287, 288, 313–315, 323, 350, 351, 363, 368 Contraposition, 40, 263, 340, 353, 366, 371, 375, 376, 383 Contrapositive, 40, 41, 71, 120, 147, 338, 339 Contrarian connective, 286 Converse, 5, 8, 16, 20, 22, 23, 27, 29, 31, 32, 34, 37, 40, 46, 47, 54, 57, 60, 67–69, 72–75, 77, 79–81, 90, 91, 96, 98, 104, 109, 145, 146, 155, 161, 200, 218, 258, 267, 321, 323, 336–338, 346, 359–361, 377, 378, 382, 384, 385 Countable set, 96 Counter-case, 283, 369, 371–373, 375, 387 Counter-tautology, 267 Counting formulae, 168–173, 177–180 Course-of-values induction, 129 Crash-pair, 281, 282, 285, 350, 363, 369–375, 377, 380, 382, 385, 387 Cresswell, Max, 388 Critical nodes, 369–375, 377, 387 Cumulative induction, 127, 129, 130, 147, 152, 153, 265, 335 Cumulative recursion, 55, 137
Index Cumulative transitivity, 330–333, 335, 337, 338, 356–360, 364 Cut, 332, 353 Cycle, 78, 226, 242–244, 349 D Dead branch, 281, 282, 285, 289, 374 Decision procedure, 280 Decomposition, 107, 108, 144, 232, 280–284, 368, 369, 371, 373–375, 377–379, 381–387 Decomposition tree, 235, 246, 281, 340, 372, 373, 377, 379, 380, 383 Deduction, 318, 341 Definition, bottom up, 81 Definition, by enumeration, 27, 28 Definition, top-down, 73–75, 88, 109, 134 Dependence, 56, 219, 372, 373, 375 Depth-first strategy, 282 Depth of a formula, 143 de Rijke, M., 388 Derivation, elementary, 327, 331, 334, 335, 339, 340, 344, 356 Derivation rule, 136, 139, 365, 366 Derivation tree, 328, 329 Descartes, René, 39 Detachment, 136, 139, 140, 366, 378, 379, 381–383 Deterministic program, 151 Devlin, Keith, 211 Diagonal construction, 96 Diagonal of a relation, 44 Difference, 3, 6, 12, 17, 20–23, 26, 31, 41, 46, 49, 60, 62, 65, 67, 86, 101, 105, 107, 121, 126, 133, 140, 159, 160, 165, 179, 188, 192, 194, 198, 207, 212, 215, 232, 233, 246, 252, 256, 282, 285, 296, 303, 304, 309, 312, 313, 349, 351, 358, 367, 375, 383 Digraph, 44, 45, 47, 53, 55, 57, 59, 61, 72, 84, 92, 94, 95, 108, 226, 308, 314 Direct acceptability, 373, 377–379, 381, 384 Directed graph (digraph), 45, 226 Directed tree, 223 Directly acceptable formula, 378, 379, 381, 382, 386 Directly acceptable tree, 374, 378, 379, 382 Discharge of a supposition, 345 Disjoint sets, 14, 15, 120, 155, 159–161, 163, 164, 181, 193, 219 Disjoint union, 31, 159, 181 Disjunction, 18, 19, 22, 29, 32, 103, 140, 143, 254, 256, 259, 262, 269–274, 280, 288, 300, 301, 345, 346, 364, 368
391 Disjunctive Normal Form (DNF), 270–274, 279, 285–288 Disjunctive proof, 20, 327, 338, 345–349, 351–354, 356, 357, 360 Disjunctive Syllogism (DS), 259–261, 267, 331, 332, 339, 348, 360, 364–366, 369–371, 374 Disjuncts, 256, 270–273, 286, 288, 345, 346, 364 Dispersion, 216 Distribution, 19, 26, 27, 31, 179, 186–189, 192–195, 197, 202, 214, 215, 217, 262, 272, 273, 300, 302, 366 Division by zero, 198 Domain, 42, 56, 61, 76, 83, 84, 86, 87, 89, 90, 92, 95, 100, 101, 104–106, 109, 115, 116, 133, 139–142, 144, 146, 149, 155, 185, 192, 193, 198, 204, 214, 232, 235, 237, 245, 253, 254, 296, 298, 300, 301, 304, 306–316, 319–324, 339, 355, 356 Double negation, 262, 264, 272, 274, 275, 299, 328, 329, 331, 339, 351, 353, 366 Dual-contrarian, 265, 266 Duals, 17, 68, 266, 270, 273, 317, 354, 376 Dunn, Jon, 387 E Edge, 240–245, 248, 349 Elementary derivation, 327, 331, 334, 335, 339, 340, 344, 356 Elementary event, 187, 190 Elementary letter, 143, 257–266, 268, 270, 272, 275–278, 281, 282, 286–288, 337, 340 Element of a set, 144, 275 Eliminable letter, 276 Empty relation, 43, 56, 57, 60, 145, 333 Empty set, 3, 13–15, 24, 25, 28, 43, 56, 58, 63, 102, 137, 145, 190, 198, 229, 245, 248, 316, 323 Enthymeme, 386 Enumeration, 6, 12, 13, 42, 65, 331 Equality, 6, 10, 33, 47, 59, 61, 89, 90, 117, 118, 121, 122, 131, 159, 177, 188, 189, 199, 201–203, 205, 211, 218, 260, 269, 309, 336–338, 351 Equinumerosity, 83, 96–98, 110, 159 Equiprobable, 186, 187, 192–197, 214, 215 Equivalence class, 64 Equivalence relation, 37, 59–66, 78–80, 262, 266, 277, 304, 319, 322 Escher, Maurits Cornelis, 257 Euler diagram, 10–12, 14, 15 Evaluating a function, 125
392 Evaluating an expression, 234 Event, 187, 189–192, 194, 195, 197, 200, 201, 207–210, 213, 218, 219 Exclusion, 3 Exclusive disjunction, 19, 32, 154, 256, 272, 283, 358 Exhaustion, 64, 110 Existential Generalization (EG), 317 Existential Instantiation (EI), 317, 354, 357, 358 Existential quantifier, 51, 57, 63, 291, 296, 297, 301, 302, 308, 316, 318, 322, 374 Expansion, 262, 263, 273, 275 Expectation, 24, 190, 214–216, 220 Expected value, 185, 215, 216 Experiment, 190 Explicit contradiction, 207, 281, 350–352 Explosion, left, 259, 260 Explosion, right, 260, 261, 364, 369, 370, 374 Explosion, symmetric, 363 Exponential function, 124 Exponential growth, 29 Extensionality, axiom of, 6 F Factorial function, 124, 127, 132, 169, 170 Falsehood, 253, 284, 285, 353, 369 Falsum, 276, 358 Family of sets, 105 Fibonacci function, 127, 128, 130, 153 Field of subsets, 193 Fineness of a partition, 277, 278 Finest splitting, 278, 279 Finite path, 73, 74 Finite transform, 300, 308 First-degree formulae, 388 First-level rule, 317–319, 338, 341, 343, 356, 364 First-order logic, 131, 295, 296, 302, 303, 316, 319, 320, 324, 332, 333, 335, 336, 356 Flat set, 4 Flattening, 327, 343, 344, 348, 349, 355 Floor function, 109, 110 Formulae of propositional logic, 136, 138–140, 143, 144, 231, 234, 259, 270 Forwards evaluation, 125 Four-colour problem, 350 Free occurrence, 297, 301–303, 306, 311, 312, 316–318, 318, 320, 323, 324, 354 Fregean axiom system, 231, 365, 366 Frequentist conception, 191 Function, 26, 28, 48, 50, 68, 83–112, 115, 116, 123–127, 131–134, 136, 138–143, 149–153, 155, 159, 166–168, 175, 177,
Index 180, 186, 187, 189, 190, 193, 198, 203–204, 214, 231–233, 235–237, 252–256, 258, 260, 265, 268, 269, 276, 293, 294, 296–298, 304, 305, 307, 309, 316, 319, 322, 328, 341, 358, 370, 382 Functional completeness, 265, 271, 285, 365 G Gabbay, Dov, 30 Gamble, 215, 216 Gamut, L.T.F., 289, 325 Gate sign, 259, 313 Generalized union and intersection, 25 Generation, 137 Generator, 135 Gentzen, Gerhard, 342 Goble, Lou, 387 Grammatical structure, 230, 234 Graph, 223, 226, 240, 248, 328, 331, 350 Greatest Lower Bound (GLB), 16, 68, 69, 79 Guenthner, F., 387 H Haggarty, Rod, 183 Halmos, Paul, 5, 96 Hasse diagram, 28, 45, 71 Hazen, Allen, 362 Head of a list, 108 Hein, James, 81, 113, 156, 289, 324 Herman, Jiri, 184 Heuristics, 11, 16, 67, 282, 340 Higher-level proof, 327, 338, 344, 345, 352, 356 Hilbertian axiom system, 231, 365 Hodel, R., 388 Hodges, Wilfrid, 289, 325 Homomorphism, 268 Horn, Alfred, 274 Horn clause, 274 Howson, Colin, 289 Hughes, G., 388 Huth, Michael, 289, 324 I Idempotence, 15, 18, 272, 336, 338, 360 Identity, 3, 4, 6, 10, 20, 24, 28, 38, 41, 43, 48, 49, 56, 59–62, 65, 68, 77, 79, 81, 83, 86, 100, 107, 108, 135, 231, 264, 268, 291, 293, 294, 298, 304, 305, 309, 317, 319, 320, 322, 323, 332, 337, 361, 366 Identity function, 100, 127, 254 iff, 5, 29, 92, 95, 96, 98 if…then, 14, 29, 30 if-then-else, 123, 128
Index Image, 18, 37, 53, 54, 64, 75, 76, 83, 87–89, 109, 134, 166, 233 Immediate predecessor, 57, 72 Implication, logical, 291, 312, 313, 327, 330, 332–334, 341, 353, 354 Implicative forking, 373, 375, 376, 378 Import/export, 263 Inclusion, 3, 4, 6–8, 10, 11, 16, 20, 23, 27, 32, 66, 71, 74, 76, 109, 135, 145, 146, 160, 197, 264, 336–338, 338, 359, 360, 382 Inclusion and exclusion rule, 174, 182, 188 Inclusive order, 66 Inconsistent, 286, 323 Incremental rule, 341, 343, 344, 347, 354 Incurvati, Luca, 388 Independence, 185, 195, 207–210, 217–219 Index set, 105, 106 Indirect proof, 340, 352 Indiscernibility, 319 Induction, 8, 68, 109, 115, 116, 118–123, 129, 130, 132, 133, 135, 137, 138, 144, 147–149, 153, 154, 159, 241, 257, 320, 335, 382 Induction goal, 118–122, 124, 129 Induction hypothesis, 118–122, 124, 129, 131, 135, 139, 145, 152, 154, 230, 269, 335 Induction step, 81, 117–123, 129–131, 135, 138, 139, 145, 147, 152–155, 229, 265, 269, 286, 287, 335 Inference, 200, 251, 252, 318, 320, 328, 331, 333, 335, 336, 339–343, 346, 347, 351–354, 356, 359, 364, 365 Infinite descending chain, 144, 146, 149 Infix notation, 235 Injective function, 92, 95, 98, 106, 110, 166 Input, 28, 29, 85, 91, 106, 115, 124, 140, 151, 212, 246, 317, 342–344, 347, 348, 354, 373, 379 Insertion into a tree, 238, 239 Integer, 5, 8, 12, 13, 21, 23, 30, 31, 33, 37, 41, 54, 65–67, 69, 72, 76, 86, 96, 102, 106, 108, 109, 111, 115–125, 129, 137, 145–147, 152, 153, 159, 170, 181, 193, 207, 232, 237, 292, 296, 339, 351, 355 Intelim rule, 357, 358 Interior node of a tree, 233 Interpretation, 178, 179, 190, 192, 307 Intersection of sets, 73, 135 Intransitive relation, 57, 58, 78, 224, 246 Intuitionistic logic, 353, 358 Inverse of a function, 91 Irreflexive relation, 55, 77, 145, 245
393 J Jaśkowski, Stanisław, 342 Johnsonbaugh, Richard, 183, 248 Join of relations, 37 K Kolman, Bernard, 248 Kripke, Saul, 367 Kripke semantics, 367, 368 L Label, 53, 121, 177, 232, 233, 235, 236, 280–282, 328, 343, 344, 370, 372, 379 Labelled tree, 231, 232, 246, 280, 281 Leaf of a tree, 224, 225, 228, 229, 231, 238, 239, 247, 329, 334 Least element, 67, 68, 70, 80, 145 Least letter set, 275 Least Upper Bounds (LUB), 18, 79, 80 Left projection, 93, 102, 112 Length of a list, 143 Letter-sharing condition, 377, 384 Lewis, C.I., 364 Lewis derivation (dilemma), 364–366, 370 Lexicographic order, 150 Limiting case, 41, 56, 87, 170, 171, 176, 177, 187, 198, 199, 202, 207, 208, 228, 259, 260, 262, 263, 270, 271, 274, 278, 309, 311, 373 Linearization, 329 Linear order, 69, 79, 80, 146, 232 Link, 59, 71, 72, 83, 118, 151, 166, 225, 227–230, 232, 236, 241–244, 252, 284, 369 Link-height, 227, 228, 246 Link-length, 225, 228 Lipschutz, Seymour, 35, 81, 113, 156, 183, 221 Lipson, Marc, 183, 221 List, 27, 72, 96, 98, 103, 107, 108, 143, 168, 171, 172, 188, 236, 239, 264, 358, 367 Literal, 270–274, 279 Local universe, 23–25, 100, 102, 103, 134, 264 Logical closure relation, 332 Logical equivalence, 291, 298, 299, 313 Logical implication (consequence), 291, 312, 313, 317, 319, 327, 330, 332–334, 336, 337, 341, 353, 354, 356, 363 Logical system, 136, 342, 365 Logical truth, 364 Logic boxes, 8, 16–20, 22, 29, 51, 103, 117, 241, 242, 251, 253, 286, 291, 338, 345, 369
394 Logic programming, 274 Logic, propositional, 138, 139, 143, 154, 234, 251, 257–259, 261, 268, 270, 287, 293, 299, 304–306, 312, 313, 315, 321, 333, 363, 364, 366, 367, 378 Logic, quantificational, 291, 293, 295, 297–299, 299, 302, 304, 312, 313, 323, 327, 333 Loveland, D., 388 Lower bound, 16, 68, 69, 79, 201 Łukasiewicz, Jan, 235 M Magritte, René, 257 Makinson, David, 361, 362 Mangle formula, 380 Many-valued logic, 253 Mares, Edwin, 387 Maxiscope form, 302 Meet of sets, 15, 26 Metalanguage, 259, 261, 294, 295, 307, 315 Meta-variable, 295 Mingle formula, 372, 374, 380, 381 Minimal element, 67–70, 144–148, 150, 151, 155 Miniscope form, 302, 303 Modal logic, 367, 368 Model, 312, 368 Modes of selection, 159, 166–169, 175, 176, 182 Modus ponens, 136, 259, 328, 331, 332, 339, 345, 348, 350, 351, 371, 373, 375, 378, 379, 382, 383, 385 Modus tollens, 259, 260, 328, 329, 331, 332, 339, 345, 351, 378, 379, 383, 384, 387 Monotony (monotonicity), 330–338, 356–360, 364 Monty Hall problem, 221 Most modular version, 277–279, 288 Multiplication principle, 162, 163, 170, 175, 181, 182 Multiset, 167 N Nand, 265, 358 Natural deduction, 342, 348, 364, 368, 369 Natural number, 13, 31, 41, 46, 53–57, 59, 61, 66, 67, 75, 76, 88, 92, 95, 96, 110, 119, 120, 123, 124, 127, 129–135, 137, 139, 141, 145–147, 152–155, 159, 265, 320, 348 Negation, 22, 29, 103, 140, 143, 144, 235, 243, 253, 254, 256, 258, 263, 264, 266, 267, 269, 270, 272–274, 280, 284–286, 292,
Index 296, 299, 321, 350, 352, 353, 358, 368, 378 Negri, Sara, 361 Neither-nor, 265, 358 New Foundations (NF), 25 Node height, 227, 228, 246 Node of a tree, 223, 225, 227, 228, 230, 282, 329, 330, 370, 379, 380 Non-classical logic, 335, 358 Non-constructive proof, 350 Non-deductive inference, 333 Nonmonotonic logic, 361 Non-standard analysis, 193 Normal Form (CNF), 251, 270, 274, 302, 303 Not-both, 265, 358 N-place function, 85, 112, 293, 304 N-place relation, 41, 47, 304 Null event, 190 O O + R+, 165, 166, 168, 169, 175, 176, 178 O + R–, 165, 166, 168, 169, 172, 175, 182, 195 Objectivist conception, 191 Object language, 259, 261, 294, 295, 307, 315, 364 One-one correspondence, 95, 162, 163, 178, 181 One-place function, 84, 85, 142, 203, 204, 367 Ono, Hiroakira, 361 Open formula, 281, 297 Open problem, 384 O–R+, 165–169, 175, 177, 178 O–R–, 165, 166, 168, 169, 171, 172, 175, 177, 178, 182 Ordered n-tuple, 37, 38, 40, 99, 107, 232 Ordered pair, 37–44, 46, 50, 72, 84, 85, 89, 90, 97, 99, 103, 105, 108, 109, 150, 181, 197, 203, 240 Ordered tree, 231–234 Order, inclusive, 66 Order, linear, 69, 79, 80, 146, 232 Order of selection, 172 Order, partial, 66, 68, 72, 79, 80 Order, strict, 66 Order, total, 69 Organization of beliefs, 251 Output, 85, 91, 151, 152, 235, 246, 272, 273, 275, 283, 284, 317, 341, 343, 357, 368, 369, 373 Overcounting and undercounting, 174 P Packing formula, 9, 263, 385
Index Pair, 38, 40, 41, 43, 50, 65, 66, 71, 72, 74, 79, 84, 97–99, 103, 106, 111, 131, 150, 164, 165, 187, 194, 197, 213, 215, 223, 226, 240, 241, 254, 259, 264, 281, 285, 299, 328, 350, 361, 369–373, 375 Pairwise disjoint, 14, 62–64, 160, 163, 193, 229 Palindrome, 136–138, 154 Parent, 47, 50–52, 56–59, 74, 224, 225, 227, 230, 232, 235, 236, 241, 243, 246, 328, 330 Parenthesis-free notation, 234 Parikh, Rohit, 278 Parity, 21, 49, 61, 369–375, 377, 378, 380–382, 385–387 Partial function, 86, 90–92, 106, 108, 109, 198, 202, 232 Partial order, 66, 68, 72, 79, 80 Partition, 37, 59, 62–67, 78, 79, 109–111, 180, 206, 213, 214, 267, 277–279, 288 Partner, 369–375 Path, 45, 72, 96, 223–228, 241, 242, 244, 313, 316, 365, 371, 372 Payoff function, 185, 214–216, 220 Pearson, Karl, 205 Peirce, Charles Sanders, 387 Pelletier, Jeffry, 362 Perms and coms, 168, 169 Permutation, 65, 168–172, 175, 177, 179, 182, 195, 196, 263, 367, 377 Permutation formula in logic, 169 Permutation with repetition, 168, 169, 175–177, 179 Péter, Rósza, 132 Philosophy, 55, 105, 116, 137, 161, 185, 190, 191, 200, 212, 368 Pigeonhole principle, 98, 99, 105, 111, 120 Polarity formula, 379, 380 Polish notation, 235 Porphyry, 240 Poset, 66, 69 Positive clause, 274 Postfix notation, 235, 246, 247 Power set, 3, 27, 28, 34, 93, 96, 109, 145, 187 Predicate, 50, 292–295, 298, 304, 309, 322, 323 Predicate logic, 291 Prefix notation, 235, 246, 247 Premise, 20, 252, 259, 260, 318, 328–330, 332, 334, 339–348, 350, 351, 353, 354, 356, 357, 363–365, 375, 378 Prenex normal form, 302, 303, 322 Primitive connective, 143, 154, 257, 268 Principal case, 177, 207, 243, 271, 278
395 Principal inference, 341, 346, 347, 351, 354, 357 Prior probability, 197, 213 Probability, 185, 186, 189–201, 205–220, 223, 252 Probability distribution, 186, 187, 190, 192, 194, 215, 217 Probability function, 185–189, 191, 193, 202, 204, 205, 207–209, 215, 218 Probability space, 185, 187, 192, 217 Procedural step, 369 Product rule, 198, 199 Projection, 48–50, 77, 83, 100, 112, 204, 207 Proof, 9, 11, 20, 24, 25, 28, 31, 34, 40, 46, 68, 71, 74, 96, 97, 115–118, 121, 123, 124, 127, 129, 130, 132–134, 138–140, 147–149, 151–155, 167, 177, 178, 192, 202, 226–228, 231, 241–243, 251, 264, 276, 278, 282, 286, 288, 320, 327, 329, 335, 338, 339, 343–345, 348–351, 353, 354, 356, 381, 384 Proof by cases, 20, 21, 242, 327, 338, 345, 348, 349, 351, 352, 356–358, 360 Proof by contradiction, 71, 227, 242, 327, 338, 345, 349–353, 357 Proof theory, 343 Proposition, 20, 71, 103, 111, 121, 136, 139, 140, 143, 144, 197, 234, 251–254, 257, 264, 328–330, 336, 339, 341–344, 347–350, 355, 363 Propositional logic, 138, 139, 143, 154, 234, 251, 257–259, 261, 268, 270, 287, 294, 299, 304–306, 312, 313, 315, 321, 333, 363, 364, 366, 367, 378 Propositional variable, 257 Proving a general statement, 117 Q Quantificational logic, 291, 293, 295, 297–299, 302, 304, 312, 313, 323, 327, 333 Quantifier, existential, 51, 57, 63, 291, 296, 297, 301, 302, 308, 316, 318, 322, 374 Quantifier-free formula, 308 Quantifier interchange, 298, 299, 324, 353 Quantifier, universal, 51, 292, 294, 296, 300, 311, 321, 323, 339, 341 Quine’s set theory (NF), 25 Quine, W.V.O., 25 R Random variable, 190, 214 Range, 42, 43, 47, 76, 77, 83, 87, 89, 90, 92–95, 100, 104–106, 109, 141, 151,
396 166, 167, 172, 190, 198, 214, 245, 253, 295, 298 Range space, 190, 214 Ratio definition, 197–199, 201 Rational number, 31, 116, 145, 153, 186, 349 Ratio/unit definition, 198 Real interval, 186 Real number, 31, 39, 41, 68, 96, 186, 187, 320 Rearrangement, 121, 179, 180, 183 Reasoning, 9, 16, 71, 175, 200, 201, 251, 252, 262, 263, 280, 291, 311, 333, 334, 338, 339, 344 Recursion, 115, 116, 125–128, 131, 132, 141, 143, 144, 149, 150, 159, 231, 238, 257, 344, 356, 379 Recursion step, 74, 75, 127, 128, 131–133, 139, 141–144, 150, 151, 153–155, 228, 229, 246, 293–295, 305, 306, 379 Recursively enumerable, 381 Recursive program, 115, 151 Reductio ad absurdum (RAA), 9, 71, 227, 241, 243, 280, 345, 350, 351, 356, 357 Redundant letter, 358 Reflexive order, 37 Reflexive relation, 55, 66, 69, 70, 78 Relation, 3, 4, 11, 12, 16, 27, 37–39, 41–61, 64–67, 69–81, 83–93, 95, 98, 101, 104, 108, 115, 134–136, 138, 140, 141, 144–151, 155, 159, 197, 208, 210, 223, 224, 226–228, 230, 237, 239–246, 252, 257, 258, 260, 261, 266, 269, 277, 279, 291–294, 297, 298, 304, 305, 313, 314, 316, 319, 322, 327, 331–337, 340, 341, 356, 359, 363, 367, 368, 373 Relative product, 50, 51 Relettering, 301–303 Relevance, 279, 283, 363–369, 372, 377, 383, 385 Relevance logic E, 367 Relevance logic R, 367 Repetition, in a selection, 175 Replacement, 266, 299, 303, 309, 319, 320 Restall, Greg, 387 Restriction, 49, 83, 87, 92, 100, 108, 136, 155, 303, 306, 322, 368, 373 Reverse Polish notation, 235, 257 Revision, 252 Revisionary conditional probability, 198 Right projection, 102, 112 Risk, 57, 93, 172, 334, 340 Rooted tree, 223, 224, 226–230, 236, 239–244, 246, 248 Root of a tree, 224, 226, 227, 330 Rosenhouse, Jason, 221
Index Rosen, Kenneth, 221 Routley-Meyer semantics, 367, 368 Rules, elimination, 357, 358 Rules, higher-level, 338, 341, 343, 344, 348, 353, 354, 360 Rules, introduction, 357, 358 Rules, second level, 231, 317–319, 341, 342, 349, 352, 354, 356, 357, 364 Rules, split level, 327, 342–344, 349, 354, 356 Russell, Bertrand, 103, 182 Russell’s paradox, 24 Ryan, Mark, 289, 324 S Sample point, 187, 190 Sample space, 185–190, 192–199, 203, 204, 206–208, 213, 217, 219, 220 Satisfiable, 269, 313, 321 Schumacher, Carol, 156 Scope of a quantifier, 297, 316, 320 Second-level inference, 357 Second-level rule, 231, 317–319, 341, 342, 349, 352, 354, 356, 357, 364 Second-order logic, 295 Selection, 48, 49, 159, 162, 163, 165–172, 175–180, 195 Semantic decomposition tree, 231, 251, 279, 328, 340, 368 Semantics, 291, 298, 303, 304, 306, 307, 311, 314–316, 319, 368 Semantic tableau, 279 Semi-computable, 381 Separation axiom scheme, 25 Sequence, 68, 73, 74, 83, 105–108, 134, 151, 164, 168, 170, 176, 177, 181–183, 226, 228, 235, 236, 241, 242, 329–331, 334, 335, 343, 344, 348, 356, 374 Sequent calculi, 342 Set, 3–9, 12–28, 31, 33, 34, 37–51, 53–81, 84–90, 93–106, 108–111, 115, 116, 118–151, 153–156, 159–164, 166, 167, 169–171, 173–175, 177–183, 185–190, 192–197, 202–206, 208, 209, 213, 214, 218, 219, 223, 226–229, 231, 236, 237, 241, 244, 245, 247, 252, 253, 255, 257–260, 264–269, 274–280, 283–285, 287, 288, 293, 295, 296, 300, 304, 307, 313, 316, 321, 323, 324, 330, 332–336, 339–342, 345, 348, 350, 356, 357, 360, 365, 366, 368, 370, 373, 378, 381, 382, 385 Sibling, 47, 56, 60, 225 Sigma-additivity, 193 Signed vs unsigned truth-trees, 285, 379
Index Similarity relation, 60 Simple cycle, 242–245 Simple induction, 116, 117, 121, 130, 152 Simple recursion, 123, 126, 127, 153 Simplification, 104, 125–127, 259, 277, 339, 341, 364 Simpson’s paradox, 185, 205, 207, 221 Simultaneous induction, 131 Simultaneous recursion, 131, 132 Singleton, 4, 7, 28, 38, 42, 49, 63, 69, 79, 88, 142, 148, 180, 190, 193, 224, 226, 228, 229, 245, 258, 259, 269, 275, 278, 279, 323, 359 Smith, Nicholas, 362 Smith, Peter, 289, 362 Soundness-and-completeness theorem, 366, 367 Soundness in logic, 366, 367 Soundness theorem for chaining, 335 Source of a relation, 42 Spanning tree, 244–246, 248 Split-level rules, 327, 342–344, 349, 354, 356 Splitting, 277, 278, 288, 350 Squeezing, 329, 344 Standard distribution, 216 Stanford Encyclopedia of Philosophy, 35, 97, 361, 387, 388 Star function, 367 States, 367 Sterrett, S., 388 Strict order, 66 Strict partial order, 72 Strict part of a relation, 37, 70, 72, 80 String, 48, 107, 108, 136–138, 143, 154, 155, 239, 327 Strong reflexivity, 330–333, 335, 337, 338, 356, 359, 360 Structural induction, 115, 133, 138–141, 154, 264, 266, 269, 282, 286, 287, 323 Structural recursion, 108, 115, 133–141, 154, 155 Subalgebra, 136 Subjectivist conception, 191 Subordinate inference, 341, 344, 346, 352, 354, 357–359, 368 Sub-proof, 341, 343, 344, 346 Subrelation, 43, 52, 73, 78 Subset, 3–6, 9, 23, 27, 28, 37, 41, 43, 45, 48, 49, 53, 54, 56, 62–65, 67, 71, 72, 75, 87, 88, 90, 102, 110, 111, 136, 144–148, 150, 155, 163, 166, 167, 171, 172, 174, 178, 180, 182, 187–190, 192,
397 193, 196–198, 203, 204, 207, 208, 232, 245, 253, 275, 277, 279, 323, 335, 336 Substitution, 62, 126, 267–269, 276, 306, 309, 316–318, 320, 323, 358, 359, 361, 374, 377, 381, 382 Substitutional reading, 306–311, 311, 314–316, 322, 323 Subtraction principle, 160 Subtree, 229, 237–239, 246, 329, 344 Superset, 4, 42, 45, 88, 93, 341, 342 Suppes, Patrick, 362 Supposition, 8, 20, 22, 34, 40, 41, 58, 60, 64, 70, 71, 73, 77–80, 110, 118, 148, 151, 203, 205, 209, 219, 227, 241, 266, 280, 286, 314, 333, 335, 339–343, 345, 348, 350–352, 354, 359, 360, 364, 368, 369, 387 Surjective function, 94 Suspension points, 13 Symmetric closure, 240, 241, 244 Symmetric difference, 31, 218, 283 Symmetry, 44, 59, 60, 64, 66, 78–80, 172, 209, 210, 219, 243, 261, 263, 368 Syntactic decomposition tree, 234, 246, 247, 257, 260, 265 T Table for a relation, 44 Tail of a list, 108 Target, 42, 45, 46, 48, 50, 84, 89, 92, 94, 95, 186, 210, 218 Tarski conditions, 327, 332–338, 356, 359–361 Tautological consequence, 258, 364 Tautological equivalence, 258, 261–264, 266, 268, 269, 271, 284, 301, 302 Tautological implication, 251, 258–260, 262–264, 266, 269, 279, 284, 304, 327, 328, 331, 333, 339, 341, 353, 363 Tautology, 154, 231, 258, 266–269, 273, 276, 279–284, 287, 288, 324, 353, 358, 363, 364, 366–369, 371, 372, 376, 378, 379, 381, 382, 387 Term, 4, 9, 11, 15, 26, 39, 42, 52, 58, 84, 86, 88, 91, 95, 105, 106, 115, 168, 174, 191, 194, 207, 208, 214, 228, 235, 238, 267, 275, 293, 295, 304–306, 313, 316, 320, 352, 358, 379 Theorem of a formal system, 136 Third-level rule, 356 Top-down definition, 74, 75, 88, 109, 134 Top-down evaluation, 127, 128 Total order, 69
398 Trace, 334, 373–375, 387 Tracing a function, 125 Transitive closure, 45, 73, 74, 80, 224, 225 Transitivity, 55, 57–61, 64, 67–71, 73, 77–80, 146–150, 155, 210, 218, 219, 261, 320, 330–332, 334, 359, 368, 383 Translation, 52, 190, 264, 272, 297, 308 Tree, 37, 223–234, 236–240, 246, 247, 265, 280–282, 284, 328–331, 334, 343, 386, 387 Truth, 62, 155, 253, 254, 256, 284, 312, 334, 353, 364, 369, 371 Truth-function, 254–257, 264–266, 285 Truth-functional connective, 17, 251, 252, 265, 266, 285, 286, 291–293, 297, 300, 305–308, 358, 366 Truth-tables, 16–19, 22, 29–31, 41, 103, 139, 155, 236, 253–256, 258–261, 263–267, 270–274, 279, 280, 282, 283, 285, 286, 288, 291, 298, 309, 328, 340, 363 Truth-tree, 231, 279–281, 283–285, 288, 350, 363, 368–372, 374–380, 382, 384–386 Tuple, ordered, 37, 38 Turnstile, 259, 313, 340, 346 Two-sided procedure, 279 U Uncertain inference, 252, 333, 334 Uncountable sets, 96, 193 Undirected tree, 240 Unfolding, 125–128, 330 Uniform distribution, 186 Union of sets, 49, 73 Unique decomposition, 142, 143, 294, 298 Unique minimality, 276 Unique readability, 141, 143, 144, 155, 247, 258, 268 Universal Generalization (UG), 317, 354, 357, 358 Universal Instantiation (UI), 317 Universal quantifier, 51, 292, 294, 296, 300, 311, 321, 323, 339, 341 Universe of discourse, 296, 304 Unpacking formula, 9, 146, 202, 242, 263, 385, 386 Unrooted tree, 226, 239–244, 248, 349 Unsatisfiable, 269, 313 Until clause, 151 Update, 252 Upper bound, 18, 68, 79, 80, 104, 201 Use vs mention, 294
Index V Vacuous quantification, 301, 302, 322, 323 Valuation of a formula, 258 Value of a function, 83–85, 106 Variable, 16, 65, 83, 93, 101, 106, 121, 132, 168, 178, 212, 214, 218, 233–235, 242, 291–298, 300–306, 309, 311–322, 314–318, 320–322, 324, 350, 354–356 Variance, 216 Velleman, Daniel, 81, 113, 156, 361 Venema, Y., 388 Venn diagram, 10–15, 18, 22, 23, 31, 44, 161, 173 Vertex, 243, 245, 248 Von Plato, Jan, 361 W Way of intersection, 134 Way of union, 134, 137 Well-Formed Formula (WFF), 257 Well-founded induction, 147–149 Well-founded recursion, 132, 149 Well-founded relation, 144, 147, 149 Well-founded set, 144–151, 155 Well-ordered set, 146, 147 Well-ordering theorem, 104 Whenever, 6–8, 16, 23, 29, 34, 42, 57, 59, 61, 66, 69, 71–75, 88, 90, 91, 100, 109, 117, 127, 135, 138, 143, 147, 148, 186, 187, 199, 202, 204, 205, 230, 234, 243, 257, 258, 266, 272, 281, 294, 295, 317, 319, 324, 330, 332, 335, 336, 339, 340, 347, 352, 356, 359, 360, 364, 366, 371, 373, 374, 377, 382, 383, 385, 387 While clauses, 151 Whitehead, 234 Wikipedia, 167 Without Loss Of Generality (WLOG), 242, 243, 286, 351, 369 Wójcicki, Ryszard, 361 Woods, John, 362 X X-variant reading, 306, 309–311, 314, 316, 322, 323 Y Yule, G.U., 205 Z Zermelo-Frankel set theory (ZF, ZFC), 24, 25 Zero-ary connective, 276, 287, 358