MATHEMATICAL LOGIC FOR COMPUTER SCIENCE

Size: px
Start display at page:

Download "MATHEMATICAL LOGIC FOR COMPUTER SCIENCE"

Transcription

1 MATHEMATICAL LOGIC FOR COMPUTER SCIENCE Second Edition

2 WORLD SCIENTIFIC SERIES IN COMPUTER SCIENCE 25: Computer Epistemology A Treatise on the Feasibility of the Unfeasible or Old Ideas Brewed New (T Vamos) 26: Applications of Learning and Planning Methods (Ed. N G Bourbakis) 27: Advances in Artificial Intelligence Applications and Theory (Ed. J Bezdek) 28: Introduction to Database and Knowledge-Base Systems (S Krishna) 29: Pattern Recognition: Architectures, Algorithms and Applications (Eds. R Plamondon & H D Cheng) 30: Character and Handwriting Recognition Expanding Frontiers (Ed. P S P Wang) 31: Software Science and Engineering Selected Papers from the Kyoto Symposia (Eds. / Nakata & M Hagiya) 32: Advances in Machine Vision Strategies and Applications (Eds. C Archibald & E Petriu) 33: Mathematical Foundations of Parallel Computing (V V Voevodin) 34: Language Architectures and Programming Environments (Eds. T Ichikawa & H Tsubotani) 35: Information-Theoretic Incompleteness (G J Chaitin) 36: Advanced Visual Interfaces (Eds. T Catarci, M Costabile & S Levialdi) 37: Non-Deterministic Concurrent Logic Programming in PANDORA (R Bahgat) 38: Computer Vision: Systems, Theory and Applications (Eds. A Basu & X Li) 39: New Approaches to Knowledge Acquisition (Lu Ruqian) 40: Current Trends in Theoretical Computer Science Essays and Tutorials (Eds. G Rozenberg & A Salomaa) 41: Distributed Constraint Logic Programming (Ho-Fung Leung) 42: RLISP '88 An Evolutionary Approach to Program Design & Reuse (J Marti) 43: Cooperation in Industrial Multi-agent Systems (N Jennings) 44: Compositional Methods for Communication Protocol Design A Petri Net Approach (N A Anisimov) 45: Computer Simulation of Developing Structures in Nature, Society & Culture (V V Alexandrov & A I Semenkov) 46: Mathematical Aspects of Natural and Formal Languages (G Paun) 47: Mathematical Logic for Computer Science (2nd Edn.) (Lu Zhongwan) For a complete list of published titles in the series, please write in to the publisher.

3 Series in Computer Science Vol. 47 MATHEMATICAL LOGIC FOR COMPUTER SCIENCE Second Edition Lu Zhongwan Chinese Academy of Sciences Beijing World Scientific Singapore New Jersey'London Hong Kong

4 Published by World Scientific Publishing Co. Pte. Ltd. P O Box 128, Fairer Road, Singapore USA office: Suite IB, 1060 Main Street, River Edge, NJ UK office: 57 Shelton Street, Covent Garden, London WC2H 9HE British Library Cataloguing-in-Publication Data A catalogue record for this book is available from the British Library. MATHEMATICAL LOGIC FOR COMPUTER SCIENCE (Second Edition) Copyright 1998 by World Scientific Publishing Co. Pte. Ltd. All rights reserved. This book, or parts thereof, may not be reproduced in any form or by any means, electronic or mechanical, including photocopying, recording or any information storage and retrieval system now known or to be invented, without written permission from the Publisher. For photocopying of material in this volume, please pay a copying fee through the Copyright Clearance Center, Inc., 222 Rosewood Drive, Danvers, MA 01923, USA. In this case permission to photocopy is not required from the publisher. ISBN This book is printed on acid-free paper. Printed in Singapore by Uto-Print

5 PREFACE Mathematical logic studies logical problems with mathematical methods, principally logical problems in mathematics. It is a branch of mathematics. There are two kinds of mathematical research, proof and computation, which are essentially related to each other. Hence mathematical logic is essentially related to computer science, and many branches of mathematical logic have applications in it. This book describes those aspects of mathematical logic which are closely related to each other, including classical and non-classical logics. Roughly, non-classical logics can be divided into two groups, those that rival classical logic and those which extend it. This first group includes, for instance, constructive logic and multi-valued logics. The second includes modal and temporal logics, etc. Of non-classical logics, this book chooses to describe constructive and modal logics. Materials adopted in this book are intended to attend to both the peculiarities of logical systems and the requirements of computer science, but those concerning the applications of mathematical logic in computer science are not involved. Topics are discussed concisely with the essentials emphasized and the minor details excluded. For various logics, their background, language, semantics, formal deduction, soundness and completeness are the main topics introduced. Formal deduction is treated in the form of natural deduction which resembles ordinary mathematical reasoning. This book consists of an introduction, nine chapters, and an appendix. In the Introduction, the nature of mathematical logic is explained. In Chapter 1 of prerequisites, the basic concepts of set theory, including the fundamental theorems of countable sets, are reviewed; and inductive definitions and proofs are explained in detail, since many concepts in mathematical logic are defined inductively. Besides these prerequisites, this book is self-contained. v

6 VI Chapters 2-5 describe classical logics. Classical propositional logic may be regarded as part of classical first-order logic; but these logics are described separately in Chapters 2 and 3 because classical propositional logic has its own characteristics. Classical logic is the basis of this book; its soundness and completeness are studied in Chapter 5. Especially, the completeness problem of classical propositional logic and the different cases of classical first-order logic with and without equality are treated separately, in order to show the distinction of these cases in the treatment of completeness. Chapter 4 introduces the axiomatic deduction system, and proves the equivalence between it and the natural deduction system. Chapter 6 studies, on the basis of soundness and completeness, Compactness Theorem, Lowenheim-Skolem Theorem, and Herbrand Theorem, which is the basis of one approach of automatic theorem proving in artificial intelligence. Chapters 7-9 describe constructive and modal logics, and discuss the relationship between classical logic and these non-classical logics. In Appendix, a simple form of formal proof in natural deduction system is introduced. The first edition of this book was printed in The revisions in this edition are essentially concerned with rewriting proofs and expanding the explanations in the remarks. New terms and notations are adopted instead of original ones; for instance, "propositional logic" and "first-order logic" are renamed as "classical propositional logic" and "classical firstorder logic", and "interpretation" and "assignment" are combined into one term "valuation". Furthermore, Sec. 6.4 of Chapter 6 is eliminated. I would like to offer my deepest thanks to many people. Professor Hu Shihua taught me mathamatical logic selflessly. In the writing of this book, Professor Wang Shiqiang, Professor Tang Zhisong, Professor Xu Kongshi, Professor Yang Dongping, and the late Professor Wu Yunzeng provided much criticism and advice. Mr. Zhang Li helped in making suggestions and preparing the revisions. The Graduate School of University of Science and Technology of China (in Beijing) and Tsinghua University provided me with the opportunity to teach the materials of this book. The discussions with the students during my years of teaching in the universities have been very helpful in the revision of this book.

7 VII I would also like to thank the staff of World Scientific Publishing Company, first Professor K. K. Phua, and then Mr. S. J. Han, Ms. G. K. Tan, Ms. Jennifer Gan, Ms. H. M. Ho, and Ms. S. H. Gan, for their friendly and efficient help in the production of this book. Finally I would like to express gratitude to my wife Ding Yi for her patient typing and encouragement during the long writing period. Lu Zhongwan Institute of Software, Chinese Academy of Sciences Garduate School of University of Science and Technology of China (in Beijing) October 1996

8 This page is intentionally left blank

9 CONTENTS Preface Introduction 1 1. Prerequisites Sets Inductive definitions and proofs Notations Classical Propositional Logic Propositions and connectives Propositional language Structure of formulas Semantics Tautological consequence Formal deduction Disjunctive and conjunctive normal forms Adequate sets of connectives 65 v 3. Classical First-Order Logic Proposition functions and quantifiers First-order language Semantics Logical consequence Formal deduction Prenex normal form 106 ix

10

11 Contents ts XI 9.2 Semantics Formal deduction Soundness Completeness Equality 217 Appendix (a simple form of formal proof in natural deduction) 221 Bibliography 227 List of Symbols 229 Index 233