CS411 Notes 3 Induction and Recursion

Similar documents
Homework #2 Solutions Due: September 5, for all n N n 3 = n2 (n + 1) 2 4

185.A09 Advanced Mathematical Logic

Automata Theory and Formal Grammars: Lecture 1

HOW DO ULTRAFILTERS ACT ON THEORIES? THE CUT SPECTRUM AND TREETOPS

Foundations of Mathematics MATH 220 FALL 2017 Lecture Notes

CS632 Notes on Relational Query Languages I

ACLT: Algebra, Categories, Logic in Topology - Grothendieck's generalized topological spaces (toposes)

HW 4 SOLUTIONS. , x + x x 1 ) 2

ADVANCED CALCULUS - MTH433 LECTURE 4 - FINITE AND INFINITE SETS

In N we can do addition, but in order to do subtraction we need to extend N to the integers

Introduction to Metalogic

Equational Logic. Chapter Syntax Terms and Term Algebras

Propositional and Predicate Logic - IV

Fundamentals of Software Engineering

Introduction to Metalogic 1

5 Set Operations, Functions, and Counting

Mathematics 114L Spring 2018 D.A. Martin. Mathematical Logic

KRIPKE S THEORY OF TRUTH 1. INTRODUCTION

CS 6110 Lecture 21 The Fixed-Point Theorem 8 March 2013 Lecturer: Andrew Myers. 1 Complete partial orders (CPOs) 2 Least fixed points of functions

Models of Computation,

Introduction to Logic in Computer Science: Autumn 2006

7 RC Simulates RA. Lemma: For every RA expression E(A 1... A k ) there exists a DRC formula F with F V (F ) = {A 1,..., A k } and

Fundamentals of Software Engineering

CHAPTER 1. Relations. 1. Relations and Their Properties. Discussion

A should be R-closed: R(A) A. We would like this to hold because we would like every element that the rules say should be in A to actually be in A.

Discrete Mathematics for CS Fall 2003 Wagner Lecture 3. Strong induction

Exercises for Unit VI (Infinite constructions in set theory)

In N we can do addition, but in order to do subtraction we need to extend N to the integers

Applied Logic. Lecture 1 - Propositional logic. Marcin Szczuka. Institute of Informatics, The University of Warsaw

September 14. Fall Software Foundations CIS 500

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Introduction. Chapter 1

Principles of Real Analysis I Fall I. The Real Number System

Lecture Notes on Inductive Definitions

Lecture 13: Soundness, Completeness and Compactness

Basic counting techniques. Periklis A. Papakonstantinou Rutgers Business School

Show Your Work! Point values are in square brackets. There are 35 points possible. Some facts about sets are on the last page.

Supplementary Notes on Inductive Definitions

Notes. Corneliu Popeea. May 3, 2013

On the Complexity of the Reflected Logic of Proofs

Notes on ordinals and cardinals

Informal Statement Calculus

Final Exam Review. 2. Let A = {, { }}. What is the cardinality of A? Is

Software Engineering using Formal Methods

Axiomatic set theory. Chapter Why axiomatic set theory?

Complete Induction and the Well- Ordering Principle

First-Order Logic. Chapter Overview Syntax

Programming Languages and Types

Logic via Algebra. Sam Chong Tay. A Senior Exercise in Mathematics Kenyon College November 29, 2012

Review CHAPTER. 2.1 Definitions in Chapter Sample Exam Questions. 2.1 Set; Element; Member; Universal Set Partition. 2.

Axioms for Set Theory

Automated Reasoning Lecture 5: First-Order Logic

Lecture Notes on Inductive Definitions

Statistics 1 - Lecture Notes Chapter 1

Modal and temporal logic

18.S097 Introduction to Proofs IAP 2015 Lecture Notes 1 (1/5/2015)

CMPSCI 601: Tarski s Truth Definition Lecture 15. where

Herbrand Theorem, Equality, and Compactness

2. Prime and Maximal Ideals

Part II. Logic and Set Theory. Year

Lecture Notes on Heyting Arithmetic

The integers. Chapter 3

Writing proofs for MATH 51H Section 2: Set theory, proofs of existential statements, proofs of uniqueness statements, proof by cases

Set theory and topology

Warm-Up Problem. Is the following true or false? 1/35

Axioms of Kleene Algebra

SOME TRANSFINITE INDUCTION DEDUCTIONS

Introduction to Logic and Axiomatic Set Theory

MATH 55 - HOMEWORK 6 SOLUTIONS. 1. Section = 1 = (n + 1) 3 = 2. + (n + 1) 3. + (n + 1) 3 = n2 (n + 1) 2.

Bisimulation for conditional modalities

Introduction to Real Analysis Alternative Chapter 1

The Importance of Being Formal. Martin Henz. February 5, Propositional Logic

CLASS NOTES FOR APRIL 14, 2000

MATH 521, WEEK 2: Rational and Real Numbers, Ordered Sets, Countable Sets

Lecture Notes 1 Basic Concepts of Mathematics MATH 352

Logic, Sets, and Proofs

Connectedness. Proposition 2.2. The following are equivalent for a topological space (X, T ).

Preliminaries. Introduction to EF-games. Inexpressivity results for first-order logic. Normal forms for first-order logic

Proving languages to be nonregular

Well-Ordering Principle. Axiom: Every nonempty subset of Z + has a least element. That is, if S Z + and S, then S has a smallest element.

Tutorial on Axiomatic Set Theory. Javier R. Movellan

Friendly Logics, Fall 2015, Lecture Notes 5

Generalized Pigeonhole Properties of Graphs and Oriented Graphs

Induction; Operational Semantics. Fall Software Foundations CIS 500

Nondeterministic finite automata

LINDSTRÖM S THEOREM SALMAN SIDDIQI

ALGEBRA. 1. Some elementary number theory 1.1. Primes and divisibility. We denote the collection of integers

SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION

Definition: Let S and T be sets. A binary relation on SxT is any subset of SxT. A binary relation on S is any subset of SxS.

From Constructibility and Absoluteness to Computability and Domain Independence

A n = A N = [ N, N] A n = A 1 = [ 1, 1]. n=1

Economics 204 Fall 2011 Problem Set 1 Suggested Solutions

2.2 Some Consequences of the Completeness Axiom

Propositional Logic: Syntax

MATH1050 Greatest/least element, upper/lower bound

Löwenheim-Skolem Theorems, Countable Approximations, and L ω. David W. Kueker (Lecture Notes, Fall 2007)

However another possibility is

Equational Logic. Chapter 4

COT3100 SI Final Exam Review

First-Order Logic. 1 Syntax. Domain of Discourse. FO Vocabulary. Terms

Transcription:

CS411 Notes 3 Induction and Recursion A. Demers 5 Feb 2001 These notes present inductive techniques for defining sets and subsets, for defining functions over sets, and for proving that a property holds for all elements of a set. They do not deal with simultaneous definitions of multiple sets, a straightforward but tedious extension. 1 Formation Rules (Constructors) 1.1 Defining Sets Here is some formal justification for the technique used to define the IMP syntactic sets. The technique gives a collection FR of formation rules (or constructors). Intuitively, think of formation rules as uninterpreted functions that combine small structures into larger ones. Thus, FR can be any (finite or infinite) set. With each f FR we associate a nonnegative integer k, called the arity of f, that specifies the number of substructures associated with f. We represent an application of f as a tuple f, c 1,..., c k where k = arity(f) Intuitively, we would like the set defined by our formation rules to consist of exactly those objects that can be constructed by finitely many applications of the rules. This suggests a formal definition like C = { f, c 1,..., c k f FR, k = arity(f), c i C} Such a definition is problematic because of the recursive use of C inside the definition of C. A better approach is to rely on our understanding of definition over the natural numbers. That is, we define a sequence C i of intermediate sets, indexed by the 1

natural numbers, such that each set is an approximation to the set C that we are trying to define. We then define C to be the limit that is, the infinite union of all the C i. Specifically, C 0 = { f f FR, arity(f) = 0} C i+1 = C i { f, c 1,..., c k f FR, arity(f) = k, c 1,... c k C i } Here we are implicitly using the property that any set containing 0 and closed under successor contains all the natural numbers, allowing us to conclude that C i is defined for every i. We then define C by C = i C i This countably infinite union certainly exists and is well-defined. 1.2 Proving Properties by Structural Induction When a set C is defined by formation rules, we can prove properties of its elements by structural induction as follows. Suppose we are given some predicate P (x). To prove ( c C) P (c) it suffices to show, for each f F R, P (c 1 )... P (c k ) = P (< f, c 1,..., c k ) (1) where as usual k = arity(f). The soundness of this technique follows by ordinary mathematical induction. First, from the proven implication 1 and and the definition of C i we get ( c C i.p (c)) = ( c C i+1.p (c)) Then, using ordinary mathematical induction we can establish ( i)( c C i.p (c)) By definition of C, this is exactly as desired. ( c C)P (c) 2

1.3 Defining Functions by Structural Recursion Given a set C defined by formation rules, we would like exploit the structure of those formation rules to help define a function mapping elements of C into some arbitrary range set D. This turns out to be straightforward. For every f FR, we define a function [f ] : D k D where k = arity(f). Then there is a unique function F satisfying F ( f, c 1,..., c k ) = [f ](F (c 1 ),..., F (c k )) for all f FR and all c i C. This fact is most naturally proved by two separate structural inductions: one to show the existence of at least one function F with the desired properties, and another to show that all such functions must agree. These are left as exercises. The uniqueness of F follows from a property called unique readability of constructed objects: for any c C, there is at most one rule f F R and one sequence c 1,..., c k such that c = f, c 1,..., c k. Totality of F follows because there is always at least one such rule and sequence (since it is their existence that witnesses the inclusion f, c 1,..., c k in C). The function [f ] was called F f in lecture, rather disastrously, I thought. 2 Well Founded Induction 2.1 Well Founded Relations A powerful generalization of the structural techniques presented above is based on the notion of a well-founded relation. A binary relation on a set A is called a well-founded relation if either of the following two conditions holds: 1. There are no infinite descending chains; i.e., a i a 1 a 0 is not possible (2) Note this implies is irreflexive, since if a a we could construct an infinite descending chain consisting entirely of as. 3

2. Any nonempty Q A has a minimal element; i.e., ((Q A) (Q )) = ( m Q)( b m.b Q) (3) Since is not necessarily a total order, a minimal element is not necessary a least element, and a set may contain numerous minimal elements. The text includes a proof that the above two characterizations are equivalent. One direction is immediate: if there is an infinite descending chain, that chain itself is a nonempty subset of A without a minimal element. For the other direction, assuming there exists a nonempty subset Q A with no minimal element, the text shows how to construct a countably infinite descending chain. 2.2 Proving Properties by WF Induction Given a well-founded relation on set A, the principle of well-founded induction is: to show a property P (a) holds for every a A it is enough to show a A.([ b a.p (b)] P (a)) (4) that is, if P is true of all predecessors of a then P is true of a. This principle easy to prove from characterization 3 above. Suppose it fails; that is, suppose implication 4 holds but P (a) is false for some a A. Let Q be the set of all elements of A on which P is false. Since Q is assumed nonempty, by 3 it must have a minimal element, which we shall call a. Since a Q, it follows that P (a ) is false. But by 3 we know that a has no predecessor in Q; that is, b a.(b Q) If b Q, it follows that P (b) is true. Thus we have b a.p (b) By implication 4, which is assumed to hold, this implies P (a ) is true, a contradiction. Well-founded induction is a generalization of the other techniques we have seen up to now. In particular, 1. If we take to be the successor relation, n n + 1, then the principle of well-founded induction specializes to ordinary mathematical induction on the nonnegative integers. 4

2. If we take to be the strictly-less relation <, then the principle of wellfounded induction specializes to course-of-values induction on the nonnegative integers. 3. If we take to be the immediate-substructure relation on a set defined by formation rules, c i f, c 1,..., c i,..., c k then the principle of well-founded induction specializes to the principle of structural induction. 2.3 Defining Functions by WF recursion Here is a technique for defining functions analogous to well-formed induction. Suppose we are given a set A and a well-founded relation on A, and we want to define a function F : A B where B is arbitrary. Such a function can be defined by well-founded recursion as follows. Define a function F such that F(a, h) B for all a ina and all functions h : 1 (a) B. (Note 1 (a) is the set of immediate predecessors of a.) Then there is a unique function F : A B such that a A.F (a) = F(a, F 1 (a)) This fact is proved in the text (p. 177). It is worth pointing out one important way in which definition by well-founded recursion differs from the structural recursion we have seen earlier: the absence of unique readability. Recall, for a set defined by formation rules, unique readability guarantees that for any a A there is a unique formation rule f and a unique sequence a 1,..., a k of elements of A such that a = f, a 1,..., a k It follows that F can be defined quite simply using this deconstruction. Unique readability guarantees that the function F(a, h) = [f ](h(a 1 ),..., h(a k )) is well-defined for all a and h. In general it is not trivial to come up with a single-valued function {(a, h) without relying on unique readability. 5

For example, let A be finite sets of natural numbers, with the relation that would be induced by building up the sets one element at a time: a a a a n.(a {n} = a) It is tempting to write a definition of the form F(a {n}, h) = 3 h(a ) + 2 n (the details of the function on the right hand side are arbitrary) but such a definition implicitly requires unique readability to determine a unambiguously. Without it, F may fail to be well-defined: Let h 0 be the constant function 0, and consider the two derivations F({1, 2}, h 0 ) = F({1} {2}) = 1 + 4 = 4 F({2, 1}, h 0 ) = F({2} {1}) = 1 + 2 = 3 A little care is required. 3 Rules 3.1 Defining Subsets by Rules Our structural operational semantics for IMP is presented as a collection of inference or proof rules. Each rule contains free metavariables that must be filled in (instantiated) consistently, using actual terms or values, before the rule can be applied. Some rules have additional applicability constraints for example, where n = n 0 + n 1 in rule L1.add of our long step semantics. The proofs can be seen as defining a subset of a predefined universe set U. For example, the large step semantics for IMP formally defines a 3-place relation, a subset of Com Σ Σ. Formally, we deal with the process of instantiating proof rules by the simple expedient of doing all possible instantiations beforehand. An instantiated rule consists of a pair X, y, where X is a finite (possibly empty) subset of U and y is an element of U. We begin with a set R of instantiated rules. An R- derivation of element y is either a rule instance, y or a pair {d 1,..., d k }, y where {x 1,..., x k }, y is a rule instance and, for all i, d i is an R-derivation of x i. We write d R y when d is an R-derivation of y. There are actually two sets being defined by R in this process: 6

a set of R-derivations, for which the definition is analogous to a definition by formation rules, and a set of derivable elements of U (elements y that are the conclusion of some R-derivation), which we denote by I R. This is discussed below. Both are useful. 3.2 Induction on Derivations Properties of operational semantics are sometimes provable by induction on the structure of the program commands themselves. When this approach is inadequate, the best approach to try next is generally induction on derivations. We already have the necessary tools for this. We define a relation on R- derivations as follows: If d is an R-derivation of the form {d 1,..., d k }, y, then we let d i d for all i. That is, d i d iff d i is an immediate subderivation of d. It is easy to verify that is a well-founded relation. Thus, we can use it to support well-founded induction on R-derivations. 3.3 Rule Induction Given a set R of instantiated rules, the principle of Rule Induction enables us to prove properties of the set I R of R-derivable elements. By now, the principle should appear completely unsurprising: Let I R be defined by rule instances R, and let P be a property. To prove x I R.P (x) it suffices to prove ( x X.P (x)) = P (y) (5) for every rule instance X, y in R such that X I R. A proof of the correctness Rule Induction appears in the text. The argument is fairly straightforward. It relies on the following notion of an R-closed set. Let Q be a subset of U. Q is R-closed if X, y R. (X Q y Q) In words, if Q contains all the premises of a rule instance, then in must contain its conclusion as well. 7

It is not too difficult to show that I R is R-closed, and in fact I R = {Q QisR closed} that is, I R is the smallest possible R-closed set. Next, we can show that a proof of implication 5 is enough to guarantee that the set S = {x I R P (x)} is R-closed. Since I R is the intersection of all R-closed sets, it follows that I R S, as desired. 8