(Ordinary) mathematical induction is a way to prove things about natural numbers. We can write it as a rule: φ(0) x. φ(x) φ(succ(x)) x.

Size: px
Start display at page:

Download "(Ordinary) mathematical induction is a way to prove things about natural numbers. We can write it as a rule: φ(0) x. φ(x) φ(succ(x)) x."

Transcription

1 1 Ordinary Induction (Ordinary) mathematical induction is a way to prove things about natural numbers. We can write it as a rule: φ(0) x. φ(x) φ(succ(x)) x. φ(x) where φ(x) is a statement involving a number x. Proving φ(0) is called the base case, and proving that φ(succ(x)) follows from φ(x), for any x, is called the induction step (or case). There is a good source of examples of mathematical induction in (what are known as) primitive recursive definitions. Here is an example, we define addition by the following two equations: 0 + y = y succ(x) + y = succ(x + y) where succ(x) is the next number after x, its successor. Note that these equations completely determine addition. The first one tells you how to add 0 to something and the second one tells you how to add the successor of something to something else, provided you know how to add the something to the something else. Looking at them as recursive definitions, we say that the recursion is on the first argument. Using mathematical induction we can then prove the associativity of addition, which is this statement: x, y, z. x + (y + z) = (x + y) + z Here is the proof, which we write out in detail. We take φ(x) to be: y, z. x + (y + z) = (x + y) + z The first thing we have to do is the base case, i.e., we have to prove φ(0) which is: y, z. 0 + (y + z) = (0 + y) + z To this end we choose y and z and we have to prove: 0 + (y + z) = (0 + y) + z To show this we first work on the left-hand-side of the equation: 0 + (y + z) = (y + z) (by the definition of +) and then on the right-hand-side: (0 + y) + z = (y + z) (again, by the definition of +) and we are done with the base case as we have got to the same place. 1

2 Now we have to do the induction step. So we choose a number x, assume y, z. x + (y + z) = (x + y) + z (this is called the induction hypothesis) and we have to prove that x, y, z. succ(x) + (y + z) = (succ(x) + y) + z So we choose y and z and we now have to prove: succ(x) + (y + z) = (succ(x) + y) + z We again do this by working on both sides of the equation. Starting on the left: succ(x) + (y + z) = succ(x + (y + z)) (by the definition of +) and on the right: (succ(x) + y) + z = succ(x + y) + z (by the definition of +) = succ((x + y) + z) (again, by the definition of +) So we still have to prove: succ(x + (y + z)) = succ((x + y) + z) but that follows because we know from the induction hypothesis (instantiating the universal quantifiers) that: x + (y + z) = (x + y) + z In this example we did induction on x. We could also have tried induction on y when we would have taken φ(y) to be: x, z. x + (y + z) = (x + y) + z But that would not have worked so well. The reason is that the definition of + is on the first of its two arguments, so if we look at x + (y + z) the definition works on x, and if we look at (x + y) + z) the definition works on x + y and there it works on x. So x comes up on both sides of the equation and is therefore the natural choice of induction variable. Here is an example you can try: Commutativity x, y.x + y = y + x 2

3 This one is hard since either of x or y are equally natural as induction variables, one from looking at the left and the other from looking at the right. In fact whichever one you choose in doing the base case (and also in doing the induction step) you will need to prove something about the other which will require another induction. But it works in the end! To get more examples one can define multiplication and exponentiation by: and 0 y = 0 succ(x) y = y + (x y) y 0 = 1 y succ(x) = y (y x ) and there are lots of things for you to prove: x. x 1 = x x, y, z. x (y + z) = (x y) + (x z) x, y. (x y) = (y x) x, y, z. x (y z) = (x y) z x, y, z. (y z) x = y x z x x, y, z. y x z = (y z ) x x, y, z. y x+z = y x y z The order they are written in here is deliberate: you will find that, to prove later ones in the list, you will sometimes need earlier ones; you will also sometimes need the properties of addition, +, discussed above. The third example is the hardest; if you can t do it, just go on to the others. 2 List Induction Here we consider lists (same thing as strings) over an alphabet Σ; that is we are interested in Σ rather than the natural numbers. So what now is the right kind of induction principle to prove things about all lists? Well natural numbers are built up from 0 by continually taking successors: you get 0,1,2,3, etc. In the same way lists are built up from the empty list ɛ by adding on elements of Σ at the front. For example, take the case where Σ has just two elements a and b. Then starting from ɛ we first get a and b; then we get aa and bb and also ab and bb. The next time round we get eight things, starting at aaa and finishing at bbb. The function which adds an element of Σ to the beginning of a list is called cons and is written with a raised dot, thus: l x, so that, for example, b aa is baa. So the natural induction principle says that if however you build up your list what you want to prove remains true, then it is true for all lists. In symbols we have the following principle of list induction for Σ : φ(ɛ) l, x. φ(x) φ(l x) x. φ(x) 3

4 Once we have the empty list and consing we can define other functions by the list version of primitive recursion. For example list concatenation is called append and it is defined by: append(ɛ, y) = y append(l.x, y) = l.append(x, y) (for l in Σ) (In CS2 we wrote append(x, y) simply as xy, but here it helps to have the append function made visible. ) Then a natural thing to try to prove by list induction is again associativity, but of append this time: x, y, z. append(x, append(y, z)) = append(append(x, y), z) It turns out that this is very similar indeed to the situation with addition. It is again natural to try the induction formula: y, z. append(x, append(y, z)) = append(append(x, y), z) since both sides of the equation work on x. The base case is: y, z. append(ɛ, append(y, z)) = append(append(ɛ, y), z) and is left to you to do as an exercise (a rather small one!). For the induction step, we assume: y, z. append(x, append(y, z)) = append(append(x, y), z) and we have to prove, for any l in Σ, that: y, z. append(l x, append(y, z)) = append(append(l x, y), z) To that end we choose y and z and we now have to prove: append(l x, append(y, z)) = append(append(l x, y), z) To do this we work on both sides of the equation, just like before, but now using the definition of append: the left-hand-side reduces to: and the right-hand-side reduces to: l append(x, append(y, z)) l append(append(x, y), z) and we use the induction hypothesis and we are done. You might like to fill in the details here they are just as in the case of addition. The reverse function does as its name suggests, so that, for example: rev(abc) = bca 4

5 It can be defined by: rev(ɛ) = ɛ rev(l.x) = append(rev(x), l) (for l in Σ) where l is really a short way of writing l ɛ: it is an element of Σ thought of as a (short) list. Here are a couple of things that can be proved by list induction (exercises). 3 Tree Induction x, y. rev(append(x, y)) = append(rev(y), rev(x)) x. rev(rev(x)) = x Lists are a generalisation of numbers, as numbers can be thought of as lists over an alphabet Σ with a single element, say 1. The idea is that 0 corresponds to ɛ and succ(x) corresponds to l x, so that, for example 3 = succ(succ(succ(0))) corresponds to 111 = ɛ. One then sees that ordinary induction and primitive recursion correspond to list induction and primitive recursion for these unary lists. We now see that in just the same way trees generalise lists. Trees are also built from alphabets Σ, but the alphabets are graded, meaning that each element of the alphabet has a rank, also called an arity, given by a function rank : Σ N The elements of the alphabet Σ are called letters or function symbols. Given that, the Σ-trees are defined by saying that if t 1,..., t n are Σ-trees and a is a letter of rank n then: (tree picture missing here: it has a tip labelled by a and n branches pointing to t 1... t n ) is a Σ-tree. One can equivalently talk about Σ-terms, which are defined by saying that if t 1,..., t n are Σ-terms and a is a letter of rank n then a(t 1,..., t n ) is a Σ- term. Such terms can be alternatively defined by a context-free grammar with a nonterminal T and a production of the form: T a(t,..., T ) for each letter a of arity n, where there are n T s. (If you have done 1st-order logic you will see that these are exactly the terms of first-order logic with the given function symbols containing no variables.) Usually we know what Σ is and we just talk of trees or terms, rather than Σ-trees or Σ-terms. Here are some examples. Natural numbers Here Σ = {succ:1, zero:0} 5

6 where we have shown both the letters and their arity. Here the context-free grammar is: T succ(t ) zero() The possible numbers in this sense are zero(), succ(zero()), succ(succ(zero())), etc, evidently corresponding to 0, 1, 2 etc. Lists (of a s and b s) Here: Here the context-free grammar is: Σ = {a:1, b:1, NIL:0} T s(t ) b(t ) NIL() The possible lists in this sense are NIL, a(nil()), b(nil()), a(a(nil())), a(b(nil())), b(a(nil())), etc, corresponding to ɛ, a, b, aa, ab, ba etc. Binary Trees (with a and b at their leaves.here: Here the context-free grammar is: Σ = {P :2, a:0, b:0, } T P (T, T ) a() b() Let us consider the substitution sub a (t, u) of one binary tree u for all occurrences of a in another binary tree t. For example: sub a (P (P (b, a), a), P (b, a)) = P (P (b, P (b, a)), P (b, a)) This can be defined using a tree form of primitive recursion: sub a (P (t 1, t 2 ), u) = P (sub a (t 1, u), sub a (t 2, u)) sub a (a(), u) = u sub a (b(), u) = b() Now suppose that we want to prove the following: t, u, v. sub a (sub a (t, u), v) = sub a (t, sub a (u, v)) To do this we are going to use the principle of tree induction, also called structural induction, here for binary trees: t 1, t 2,. φ(t 1 ) φ(t 2 ) φ(p (t 1, t 2 )) φ(a()) φ(b()) t. φ(t) In this case we are going to take the induction formula φ(t) to be: u, v. sub a (sub a (t, u), v) = sub a (t, sub a (u, v)) So, we have first to prove that φ(p (t 1, t 2 )), assuming that φ(t 1 ) and φ(t 2 ). So fixing u and v we have to prove that: sub a (sub a (P (t 1, t 2 ), u), v) = sub a (P (t 1, t 2 ), sub a (u, v)) 6

7 starting on the left, we calculate: sub a (sub a (P (t 1, t 2 ), u), v) = sub a (P (sub a (t 1, u), sub a (t 2, u)), v) (by the definition of sub a ) = P (sub a (sub a (t 1, u), v), sub a (sub a (t 2, u), v)) (by the definition of sub a ) = P (sub a (t 1, sub a (u, v)), sub a (t 2, sub a (u, v))) (by induction hypothesis) and, now starting on the right, we calculate: sub a (P (t 1, t 2 ), sub a (u, v)) = P (sub a (t 1, sub a (u, v)), sub a (t 2, sub a (u, v))) (by the definition of sub a ) Next we have to prove that φ(a()). So fixing u and v we have to prove that: sub a (sub a (a(), u), v) = sub a (a(), sub a (u, v)) which is easy as both sides work out to sub a (u, v), using the definition of sub a. Finally we have to prove that φ(b()). So fixing u and v we have to prove that: sub a (sub a (b(), u), v) = sub a (b(), sub a (u, v)) which is also easy as both sides work out to b(), again using the definition of sub a. We can make use things more readable by using the notation: for sub a (t, u). Then we can write: as: t[u/a] t, u, v. sub a (sub a (t, u), v) = sub a (t, sub a (u, v)) t, u, v. t[u/a][v/a] = t[u[v/a]/a] Try rewriting the above proof using this notation: it should look a lot clearer! Here is another such law of substitution: t, u. t[u/a] = t (if a is not in t) Try proving it by tree induction; show too that the condition that a is not in t is needed, in the sense that if you remove it, then the statement becomes false. Obviously, one can also define sub b (t, u), and use the corresponding notation t[u/b]. Then, what happens if we do a substitution on, say, a, followed by a substitution on b? We get the following law: t, u, v. t[u/a][v/b] = t[v/b][u[v/b]/a] (if a is not in v) Try proving it by tree induction; show too that the condition that a is not in v is needed, in the sense that if you remove it, then the statement becomes false. Tree induction for binary trees is obviously a special case of tree induction for any graded alphabet Σ. This is as follows: to prove x.φ(x) 7

8 where x is ranging over all Σ-trees, one proves x 1,... x n. φ(x 1 )... φ(x n ) φ(a(x 1,..., x n )) for all letters a, where n is the arity of a. Check that, using the above tree representations of natural numbers and lists, ordinary induction and list induction are special cases of this general form of tree induction. Abstract syntax In his notes, Pitts uses abstract syntax. For example, LC arithmetic expressions are given by E ::= n!l E iop E where n ranges over integers and l over locations and iop over arithmetic operations. This should not be read as a context-free grammar but rather as giving a graded alphabet, viz: Σ = {n n Z} {!l l L} {iop iop Iop} See Pitts notes, pp. 4,5. All the n and!l have rank 0 and all the arithmetic operations have rank 2. One other small point: our official notation for trees, viz terms, results in many parentheses. The abstract syntax also gives notational conventions to avoid this, such as, here, using infix to write arithmetic operations (and one should add parentheses or use standard priorities to deal with any resulting ambiguities). So structural induction (= tree induction) for arithmetic expressions is as follows: n. φ(n) l. φ(!l) E 1, E 2. iop. φ(e 1 ) φ(e 2 ) φ(e 1 iop E 2 ) E. φ(e) This is exactly what Pitts has on his p. 13. Note that his leaf nodes correspond to our letters of degree 0 8

CVO103: Programming Languages. Lecture 2 Inductive Definitions (2)

CVO103: Programming Languages. Lecture 2 Inductive Definitions (2) CVO103: Programming Languages Lecture 2 Inductive Definitions (2) Hakjoo Oh 2018 Spring Hakjoo Oh CVO103 2018 Spring, Lecture 2 March 13, 2018 1 / 20 Contents More examples of inductive definitions natural

More information

What Is a Language? Grammars, Languages, and Machines. Strings: the Building Blocks of Languages

What Is a Language? Grammars, Languages, and Machines. Strings: the Building Blocks of Languages Do Homework 2. What Is a Language? Grammars, Languages, and Machines L Language Grammar Accepts Machine Strings: the Building Blocks of Languages An alphabet is a finite set of symbols: English alphabet:

More information

Notes for Comp 497 (454) Week 10

Notes for Comp 497 (454) Week 10 Notes for Comp 497 (454) Week 10 Today we look at the last two chapters in Part II. Cohen presents some results concerning the two categories of language we have seen so far: Regular languages (RL). Context-free

More information

Mathematical Preliminaries. Sipser pages 1-28

Mathematical Preliminaries. Sipser pages 1-28 Mathematical Preliminaries Sipser pages 1-28 Mathematical Preliminaries This course is about the fundamental capabilities and limitations of computers. It has 3 parts 1. Automata Models of computation

More information

1 Alphabets and Languages

1 Alphabets and Languages 1 Alphabets and Languages Look at handout 1 (inference rules for sets) and use the rules on some examples like {a} {{a}} {a} {a, b}, {a} {{a}}, {a} {{a}}, {a} {a, b}, a {{a}}, a {a, b}, a {{a}}, a {a,

More information

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

First-Order Logic. 1 Syntax. Domain of Discourse. FO Vocabulary. Terms First-Order Logic 1 Syntax Domain of Discourse The domain of discourse for first order logic is FO structures or models. A FO structure contains Relations Functions Constants (functions of arity 0) FO

More information

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

Mathematics 114L Spring 2018 D.A. Martin. Mathematical Logic Mathematics 114L Spring 2018 D.A. Martin Mathematical Logic 1 First-Order Languages. Symbols. All first-order languages we consider will have the following symbols: (i) variables v 1, v 2, v 3,... ; (ii)

More information

Comp487/587 - Boolean Formulas

Comp487/587 - Boolean Formulas Comp487/587 - Boolean Formulas 1 Logic and SAT 1.1 What is a Boolean Formula Logic is a way through which we can analyze and reason about simple or complicated events. In particular, we are interested

More information

Structural Induction

Structural Induction Structural Induction In this lecture we ll extend the applicability of induction to many universes, ones where we can define certain kinds of objects by induction, in addition to proving their properties

More information

Theory of Computation

Theory of Computation Theory of Computation (Feodor F. Dragan) Department of Computer Science Kent State University Spring, 2018 Theory of Computation, Feodor F. Dragan, Kent State University 1 Before we go into details, what

More information

Theory of Computation

Theory of Computation Theory of Computation Lecture #2 Sarmad Abbasi Virtual University Sarmad Abbasi (Virtual University) Theory of Computation 1 / 1 Lecture 2: Overview Recall some basic definitions from Automata Theory.

More information

Every formula evaluates to either \true" or \false." To say that the value of (x = y) is true is to say that the value of the term x is the same as th

Every formula evaluates to either \true or \false. To say that the value of (x = y) is true is to say that the value of the term x is the same as th A Quick and Dirty Sketch of a Toy Logic J Strother Moore January 9, 2001 Abstract For the purposes of this paper, a \logic" consists of a syntax, a set of axioms and some rules of inference. We dene a

More information

Predicate Logic: Syntax

Predicate Logic: Syntax Predicate Logic: Syntax Alice Gao Lecture 12 Based on work by J. Buss, L. Kari, A. Lubiw, B. Bonakdarpour, D. Maftuleac, C. Roberts, R. Trefler, and P. Van Beek 1/31 Outline Syntax of Predicate Logic Learning

More information

Logic as a Tool Chapter 1: Understanding Propositional Logic 1.1 Propositions and logical connectives. Truth tables and tautologies

Logic as a Tool Chapter 1: Understanding Propositional Logic 1.1 Propositions and logical connectives. Truth tables and tautologies Logic as a Tool Chapter 1: Understanding Propositional Logic 1.1 Propositions and logical connectives. Truth tables and tautologies Valentin Stockholm University September 2016 Propositions Proposition:

More information

Theory of Computation

Theory of Computation Theory of Computation Dr. Sarmad Abbasi Dr. Sarmad Abbasi () Theory of Computation / Lecture 3: Overview Decidability of Logical Theories Presburger arithmetic Decidability of Presburger Arithmetic Dr.

More information

CHAPTER 2. FIRST ORDER LOGIC

CHAPTER 2. FIRST ORDER LOGIC CHAPTER 2. FIRST ORDER LOGIC 1. Introduction First order logic is a much richer system than sentential logic. Its interpretations include the usual structures of mathematics, and its sentences enable us

More information

Models of Computation,

Models of Computation, Models of Computation, 2010 1 Induction We use a lot of inductive techniques in this course, both to give definitions and to prove facts about our semantics So, it s worth taking a little while to set

More information

Notes for Comp 497 (Comp 454) Week 10 4/5/05

Notes for Comp 497 (Comp 454) Week 10 4/5/05 Notes for Comp 497 (Comp 454) Week 10 4/5/05 Today look at the last two chapters in Part II. Cohen presents some results concerning context-free languages (CFL) and regular languages (RL) also some decidability

More information

CS 2800: Logic and Computation Fall 2010 (Lecture 13)

CS 2800: Logic and Computation Fall 2010 (Lecture 13) CS 2800: Logic and Computation Fall 2010 (Lecture 13) 13 October 2010 1 An Introduction to First-order Logic In Propositional(Boolean) Logic, we used large portions of mathematical language, namely those

More information

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

Preliminaries. Introduction to EF-games. Inexpressivity results for first-order logic. Normal forms for first-order logic Introduction to EF-games Inexpressivity results for first-order logic Normal forms for first-order logic Algorithms and complexity for specific classes of structures General complexity bounds Preliminaries

More information

0.Axioms for the Integers 1

0.Axioms for the Integers 1 0.Axioms for the Integers 1 Number theory is the study of the arithmetical properties of the integers. You have been doing arithmetic with integers since you were a young child, but these mathematical

More information

Lecture 10: Predicate Logic and Its Language

Lecture 10: Predicate Logic and Its Language Discrete Mathematics (II) Spring 2017 Lecture 10: Predicate Logic and Its Language Lecturer: Yi Li 1 Predicates and Quantifiers In this action, we show you why a richer language should be introduced than

More information

Chapter 8: Recursion. March 10, 2008

Chapter 8: Recursion. March 10, 2008 Chapter 8: Recursion March 10, 2008 Outline 1 8.1 Recursively Defined Sequences 2 8.2 Solving Recurrence Relations by Iteration 3 8.4 General Recursive Definitions Recursively Defined Sequences As mentioned

More information

Axioms of Kleene Algebra

Axioms of Kleene Algebra Introduction to Kleene Algebra Lecture 2 CS786 Spring 2004 January 28, 2004 Axioms of Kleene Algebra In this lecture we give the formal definition of a Kleene algebra and derive some basic consequences.

More information

Logic: The Big Picture

Logic: The Big Picture Logic: The Big Picture A typical logic is described in terms of syntax: what are the legitimate formulas semantics: under what circumstances is a formula true proof theory/ axiomatization: rules for proving

More information

E.g. The set RE of regular expressions is given by the following rules:

E.g. The set RE of regular expressions is given by the following rules: 1 Lecture Summary We gave a brief overview of inductively defined sets, inductively defined functions, and proofs by structural induction We showed how to prove that a machine is correct using induction

More information

Examples: P: it is not the case that P. P Q: P or Q P Q: P implies Q (if P then Q) Typical formula:

Examples: P: it is not the case that P. P Q: P or Q P Q: P implies Q (if P then Q) Typical formula: Logic: The Big Picture Logic is a tool for formalizing reasoning. There are lots of different logics: probabilistic logic: for reasoning about probability temporal logic: for reasoning about time (and

More information

Introduction to Metalogic

Introduction to Metalogic Philosophy 135 Spring 2008 Tony Martin Introduction to Metalogic 1 The semantics of sentential logic. The language L of sentential logic. Symbols of L: Remarks: (i) sentence letters p 0, p 1, p 2,... (ii)

More information

Suppose h maps number and variables to ɛ, and opening parenthesis to 0 and closing parenthesis

Suppose h maps number and variables to ɛ, and opening parenthesis to 0 and closing parenthesis 1 Introduction Parenthesis Matching Problem Describe the set of arithmetic expressions with correctly matched parenthesis. Arithmetic expressions with correctly matched parenthesis cannot be described

More information

This is logically equivalent to the conjunction of the positive assertion Minimal Arithmetic and Representability

This is logically equivalent to the conjunction of the positive assertion Minimal Arithmetic and Representability 16.2. MINIMAL ARITHMETIC AND REPRESENTABILITY 207 If T is a consistent theory in the language of arithmetic, we say a set S is defined in T by D(x) if for all n, if n is in S, then D(n) is a theorem of

More information

Seminaar Abstrakte Wiskunde Seminar in Abstract Mathematics Lecture notes in progress (27 March 2010)

Seminaar Abstrakte Wiskunde Seminar in Abstract Mathematics Lecture notes in progress (27 March 2010) http://math.sun.ac.za/amsc/sam Seminaar Abstrakte Wiskunde Seminar in Abstract Mathematics 2009-2010 Lecture notes in progress (27 March 2010) Contents 2009 Semester I: Elements 5 1. Cartesian product

More information

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Lecture 4 Ana Bove March 23rd 2018 Recap: Formal Proofs How formal should a proof be? Depends on its purpose...... but should be convincing......

More information

Name: Class: IM8 Block:

Name: Class: IM8 Block: Name: Block: Class: IM8 Investigation 1: Mathematical Properties and Order of Operations Mathematical Properties 2 Practice Level 1: Write the name of the property shown in the examples below. 1. 4 + 5

More information

1 Propositional Logic

1 Propositional Logic 1 Propositional Logic Required reading: Foundations of Computation. Sections 1.1 and 1.2. 1. Introduction to Logic a. Logical consequences. If you know all humans are mortal, and you know that you are

More information

Regular expressions and Kleene s theorem

Regular expressions and Kleene s theorem Regular expressions and Kleene s theorem Informatics 2A: Lecture 5 Mary Cryan School of Informatics University of Edinburgh mcryan@inf.ed.ac.uk 26 September 2018 1 / 18 Finishing DFA minimization An algorithm

More information

Theory of Computation

Theory of Computation Fall 2002 (YEN) Theory of Computation Midterm Exam. Name:... I.D.#:... 1. (30 pts) True or false (mark O for true ; X for false ). (Score=Max{0, Right- 1 2 Wrong}.) (1) X... If L 1 is regular and L 2 L

More information

Automata: a short introduction

Automata: a short introduction ILIAS, University of Luxembourg Discrete Mathematics II May 2012 What is a computer? Real computers are complicated; We abstract up to an essential model of computation; We begin with the simplest possible

More information

Regular Expressions [1] Regular Expressions. Regular expressions can be seen as a system of notations for denoting ɛ-nfa

Regular Expressions [1] Regular Expressions. Regular expressions can be seen as a system of notations for denoting ɛ-nfa Regular Expressions [1] Regular Expressions Regular expressions can be seen as a system of notations for denoting ɛ-nfa They form an algebraic representation of ɛ-nfa algebraic : expressions with equations

More information

CS1800: Mathematical Induction. Professor Kevin Gold

CS1800: Mathematical Induction. Professor Kevin Gold CS1800: Mathematical Induction Professor Kevin Gold Induction: Used to Prove Patterns Just Keep Going For an algorithm, we may want to prove that it just keeps working, no matter how big the input size

More information

Regular expressions and Kleene s theorem

Regular expressions and Kleene s theorem and Kleene s theorem Informatics 2A: Lecture 5 John Longley School of Informatics University of Edinburgh jrl@inf.ed.ac.uk 29 September 2016 1 / 21 1 More closure properties of regular languages Operations

More information

HW 3 Solutions. Tommy November 27, 2012

HW 3 Solutions. Tommy November 27, 2012 HW 3 Solutions Tommy November 27, 2012 5.1.1 (a) Online solution: S 0S1 ɛ. (b) Similar to online solution: S AY XC A aa ɛ b ɛ C cc ɛ X axb aa b Y by c b cc (c) S X A A A V AV a V V b V a b X V V X V (d)

More information

INDUCTIVE DEFINITION

INDUCTIVE DEFINITION 1 INDUCTIVE DEFINITION OUTLINE Judgements Inference Rules Inductive Definition Derivation Rule Induction 2 META-VARIABLES A symbol in a meta-language that is used to describe some element in an object

More information

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever. ETH Zürich (D-ITET) October,

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever.   ETH Zürich (D-ITET) October, Automata & languages A primer on the Theory of Computation Laurent Vanbever www.vanbever.eu ETH Zürich (D-ITET) October, 5 2017 Part 3 out of 5 Last week, we learned about closure and equivalence of regular

More information

Part 3 out of 5. Automata & languages. A primer on the Theory of Computation. Last week, we learned about closure and equivalence of regular languages

Part 3 out of 5. Automata & languages. A primer on the Theory of Computation. Last week, we learned about closure and equivalence of regular languages Automata & languages A primer on the Theory of Computation Laurent Vanbever www.vanbever.eu Part 3 out of 5 ETH Zürich (D-ITET) October, 5 2017 Last week, we learned about closure and equivalence of regular

More information

Lecture 8 : Structural Induction DRAFT

Lecture 8 : Structural Induction DRAFT CS/Math 240: Introduction to Discrete Mathematics 2/15/2011 Lecture 8 : Structural Induction Instructor: Dieter van Melkebeek Scribe: Dalibor Zelený DRAFT Last week we discussed proofs by induction. We

More information

Entropy as a measure of surprise

Entropy as a measure of surprise Entropy as a measure of surprise Lecture 5: Sam Roweis September 26, 25 What does information do? It removes uncertainty. Information Conveyed = Uncertainty Removed = Surprise Yielded. How should we quantify

More information

Lecture 12. Statement Logic as a word algebra on the set of atomic statements. Lindenbaum algebra.

Lecture 12. Statement Logic as a word algebra on the set of atomic statements. Lindenbaum algebra. V. Borschev and B. Partee, October 26, 2006 p. 1 Lecture 12. Statement Logic as a word algebra on the set of atomic statements. Lindenbaum algebra. 0. Preliminary notes...1 1. Freedom for algebras. Word

More information

Logic. Propositional Logic: Syntax. Wffs

Logic. Propositional Logic: Syntax. Wffs Logic Propositional Logic: Syntax Logic is a tool for formalizing reasoning. There are lots of different logics: probabilistic logic: for reasoning about probability temporal logic: for reasoning about

More information

Propositional Logic: Syntax

Propositional Logic: Syntax Logic Logic is a tool for formalizing reasoning. There are lots of different logics: probabilistic logic: for reasoning about probability temporal logic: for reasoning about time (and programs) epistemic

More information

Harvard CS121 and CSCI E-121 Lecture 2: Mathematical Preliminaries

Harvard CS121 and CSCI E-121 Lecture 2: Mathematical Preliminaries Harvard CS121 and CSCI E-121 Lecture 2: Mathematical Preliminaries Harry Lewis September 5, 2013 Reading: Sipser, Chapter 0 Sets Sets are defined by their members A = B means that for every x, x A iff

More information

Automata Theory and Formal Grammars: Lecture 1

Automata Theory and Formal Grammars: Lecture 1 Automata Theory and Formal Grammars: Lecture 1 Sets, Languages, Logic Automata Theory and Formal Grammars: Lecture 1 p.1/72 Sets, Languages, Logic Today Course Overview Administrivia Sets Theory (Review?)

More information

SLD-Resolution And Logic Programming (PROLOG)

SLD-Resolution And Logic Programming (PROLOG) Chapter 9 SLD-Resolution And Logic Programming (PROLOG) 9.1 Introduction We have seen in Chapter 8 that the resolution method is a complete procedure for showing unsatisfiability. However, finding refutations

More information

Computational Models - Lecture 5 1

Computational Models - Lecture 5 1 Computational Models - Lecture 5 1 Handout Mode Iftach Haitner. Tel Aviv University. November 28, 2016 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice Herlihy, Brown University.

More information

Notes on Satisfiability-Based Problem Solving. First Order Logic. David Mitchell October 23, 2013

Notes on Satisfiability-Based Problem Solving. First Order Logic. David Mitchell October 23, 2013 Notes on Satisfiability-Based Problem Solving First Order Logic David Mitchell mitchell@cs.sfu.ca October 23, 2013 Preliminary draft. Please do not distribute. Corrections and suggestions welcome. In this

More information

Induction and Recursion

Induction and Recursion . All rights reserved. Authorized only for instructor use in the classroom. No reproduction or further distribution permitted without the prior written consent of McGraw-Hill Education. Induction and Recursion

More information

CSE 105 Homework 1 Due: Monday October 9, Instructions. should be on each page of the submission.

CSE 105 Homework 1 Due: Monday October 9, Instructions. should be on each page of the submission. CSE 5 Homework Due: Monday October 9, 7 Instructions Upload a single file to Gradescope for each group. should be on each page of the submission. All group members names and PIDs Your assignments in this

More information

Notes on Pumping Lemma

Notes on Pumping Lemma Notes on Pumping Lemma Finite Automata Theory and Formal Languages TMV027/DIT321 Ana Bove, March 5th 2018 In the course we see two different versions of the Pumping lemmas, one for regular languages and

More information

Introduction to Theory of Computing

Introduction to Theory of Computing CSCI 2670, Fall 2012 Introduction to Theory of Computing Department of Computer Science University of Georgia Athens, GA 30602 Instructor: Liming Cai www.cs.uga.edu/ cai 0 Lecture Note 3 Context-Free Languages

More information

Parsing. Context-Free Grammars (CFG) Laura Kallmeyer. Winter 2017/18. Heinrich-Heine-Universität Düsseldorf 1 / 26

Parsing. Context-Free Grammars (CFG) Laura Kallmeyer. Winter 2017/18. Heinrich-Heine-Universität Düsseldorf 1 / 26 Parsing Context-Free Grammars (CFG) Laura Kallmeyer Heinrich-Heine-Universität Düsseldorf Winter 2017/18 1 / 26 Table of contents 1 Context-Free Grammars 2 Simplifying CFGs Removing useless symbols Eliminating

More information

Practice Test III, Math 314, Spring 2016

Practice Test III, Math 314, Spring 2016 Practice Test III, Math 314, Spring 2016 Dr. Holmes April 26, 2016 This is the 2014 test reorganized to be more readable. I like it as a review test. The students who took this test had to do four sections

More information

Introduction to Metalogic 1

Introduction to Metalogic 1 Philosophy 135 Spring 2012 Tony Martin Introduction to Metalogic 1 1 The semantics of sentential logic. The language L of sentential logic. Symbols of L: (i) sentence letters p 0, p 1, p 2,... (ii) connectives,

More information

{a, b, c} {a, b} {a, c} {b, c} {a}

{a, b, c} {a, b} {a, c} {b, c} {a} Section 4.3 Order Relations A binary relation is an partial order if it transitive and antisymmetric. If R is a partial order over the set S, we also say, S is a partially ordered set or S is a poset.

More information

Notes on Inductive Sets and Induction

Notes on Inductive Sets and Induction Notes on Inductive Sets and Induction Finite Automata Theory and Formal Languages TMV027/DIT21 Ana Bove, March 15th 2018 Contents 1 Induction over the Natural Numbers 2 1.1 Mathematical (Simple) Induction........................

More information

Lecturecise 22 Weak monadic second-order theory of one successor (WS1S)

Lecturecise 22 Weak monadic second-order theory of one successor (WS1S) Lecturecise 22 Weak monadic second-order theory of one successor (WS1S) 2013 Reachability in the Heap Many programs manipulate linked data structures (lists, trees). To express many important properties

More information

3. Only sequences that were formed by using finitely many applications of rules 1 and 2, are propositional formulas.

3. Only sequences that were formed by using finitely many applications of rules 1 and 2, are propositional formulas. 1 Chapter 1 Propositional Logic Mathematical logic studies correct thinking, correct deductions of statements from other statements. Let us make it more precise. A fundamental property of a statement is

More information

Introduction to Formal Proof. 5: Theories

Introduction to Formal Proof. 5: Theories Introduction to Formal Proof Bernard Sufrin Trinity Term 2018 5: Theories [05-theories] Theories Theories The subject matter of predicate logic is all models (over all signatures) Mathematical logicians

More information

Languages, regular languages, finite automata

Languages, regular languages, finite automata Notes on Computer Theory Last updated: January, 2018 Languages, regular languages, finite automata Content largely taken from Richards [1] and Sipser [2] 1 Languages An alphabet is a finite set of characters,

More information

Automata theory. An algorithmic approach. Lecture Notes. Javier Esparza

Automata theory. An algorithmic approach. Lecture Notes. Javier Esparza Automata theory An algorithmic approach Lecture Notes Javier Esparza July 2 22 2 Chapter 9 Automata and Logic A regular expression can be seen as a set of instructions ( a recipe ) for generating the words

More information

Math 016 Lessons Wimayra LUY

Math 016 Lessons Wimayra LUY Math 016 Lessons Wimayra LUY wluy@ccp.edu MATH 016 Lessons LESSON 1 Natural Numbers The set of natural numbers is given by N = {0, 1, 2, 3, 4...}. Natural numbers are used for two main reasons: 1. counting,

More information

Context Free Grammars

Context Free Grammars Automata and Formal Languages Context Free Grammars Sipser pages 101-111 Lecture 11 Tim Sheard 1 Formal Languages 1. Context free languages provide a convenient notation for recursive description of languages.

More information

Chapter 0 Introduction. Fourth Academic Year/ Elective Course Electrical Engineering Department College of Engineering University of Salahaddin

Chapter 0 Introduction. Fourth Academic Year/ Elective Course Electrical Engineering Department College of Engineering University of Salahaddin Chapter 0 Introduction Fourth Academic Year/ Elective Course Electrical Engineering Department College of Engineering University of Salahaddin October 2014 Automata Theory 2 of 22 Automata theory deals

More information

UNIT-III REGULAR LANGUAGES

UNIT-III REGULAR LANGUAGES Syllabus R9 Regulation REGULAR EXPRESSIONS UNIT-III REGULAR LANGUAGES Regular expressions are useful for representing certain sets of strings in an algebraic fashion. In arithmetic we can use the operations

More information

Equational Logic. Chapter Syntax Terms and Term Algebras

Equational Logic. Chapter Syntax Terms and Term Algebras Chapter 2 Equational Logic 2.1 Syntax 2.1.1 Terms and Term Algebras The natural logic of algebra is equational logic, whose propositions are universally quantified identities between terms built up from

More information

ECS120 Fall Discussion Notes. October 25, The midterm is on Thursday, November 2nd during class. (That is next week!)

ECS120 Fall Discussion Notes. October 25, The midterm is on Thursday, November 2nd during class. (That is next week!) ECS120 Fall 2006 Discussion Notes October 25, 2006 Announcements The midterm is on Thursday, November 2nd during class. (That is next week!) Homework 4 Quick Hints Problem 1 Prove that the following languages

More information

Syntactical analysis. Syntactical analysis. Syntactical analysis. Syntactical analysis

Syntactical analysis. Syntactical analysis. Syntactical analysis. Syntactical analysis Context-free grammars Derivations Parse Trees Left-recursive grammars Top-down parsing non-recursive predictive parsers construction of parse tables Bottom-up parsing shift/reduce parsers LR parsers GLR

More information

2 Arithmetic. 2.1 Greatest common divisors. This chapter is about properties of the integers Z = {..., 2, 1, 0, 1, 2,...}.

2 Arithmetic. 2.1 Greatest common divisors. This chapter is about properties of the integers Z = {..., 2, 1, 0, 1, 2,...}. 2 Arithmetic This chapter is about properties of the integers Z = {..., 2, 1, 0, 1, 2,...}. (See [Houston, Chapters 27 & 28]) 2.1 Greatest common divisors Definition 2.16. If a, b are integers, we say

More information

3 Propositional Logic

3 Propositional Logic 3 Propositional Logic 3.1 Syntax 3.2 Semantics 3.3 Equivalence and Normal Forms 3.4 Proof Procedures 3.5 Properties Propositional Logic (25th October 2007) 1 3.1 Syntax Definition 3.0 An alphabet Σ consists

More information

Why write proofs? Why not just test and repeat enough examples to confirm a theory?

Why write proofs? Why not just test and repeat enough examples to confirm a theory? P R E F A C E T O T H E S T U D E N T Welcome to the study of mathematical reasoning. The authors know that many students approach this material with some apprehension and uncertainty. Some students feel

More information

How to write proofs - II

How to write proofs - II How to write proofs - II Problem (Ullman and Hopcroft, Page 104, Exercise 4.8). Let G be the grammar Prove that S ab ba A a as baa B b bs abb L(G) = { x {a, b} x contains equal number of a s and b s }.

More information

AC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013

AC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013 Q.2 a. Prove by mathematical induction n 4 4n 2 is divisible by 3 for n 0. Basic step: For n = 0, n 3 n = 0 which is divisible by 3. Induction hypothesis: Let p(n) = n 3 n is divisible by 3. Induction

More information

Algebras with finite descriptions

Algebras with finite descriptions Algebras with finite descriptions André Nies The University of Auckland July 19, 2005 Part 1: FA-presentability A countable structure in a finite signature is finite-automaton presentable (or automatic)

More information

CS156: The Calculus of Computation

CS156: The Calculus of Computation CS156: The Calculus of Computation Zohar Manna Winter 2010 It is reasonable to hope that the relationship between computation and mathematical logic will be as fruitful in the next century as that between

More information

CS375 Midterm Exam Solution Set (Fall 2017)

CS375 Midterm Exam Solution Set (Fall 2017) CS375 Midterm Exam Solution Set (Fall 2017) Closed book & closed notes October 17, 2017 Name sample 1. (10 points) (a) Put in the following blank the number of strings of length 5 over A={a, b, c} that

More information

CHAPTER 12 Boolean Algebra

CHAPTER 12 Boolean Algebra 318 Chapter 12 Boolean Algebra CHAPTER 12 Boolean Algebra SECTION 12.1 Boolean Functions 2. a) Since x 1 = x, the only solution is x = 0. b) Since 0 + 0 = 0 and 1 + 1 = 1, the only solution is x = 0. c)

More information

Information Theory and Statistics Lecture 2: Source coding

Information Theory and Statistics Lecture 2: Source coding Information Theory and Statistics Lecture 2: Source coding Łukasz Dębowski ldebowsk@ipipan.waw.pl Ph. D. Programme 2013/2014 Injections and codes Definition (injection) Function f is called an injection

More information

MA/CSSE 474 Theory of Computation

MA/CSSE 474 Theory of Computation MA/CSSE 474 Theory of Computation Bottom-up parsing Pumping Theorem for CFLs Recap: Going One Way Lemma: Each context-free language is accepted by some PDA. Proof (by construction): The idea: Let the stack

More information

CSCE 222 Discrete Structures for Computing. Propositional Logic. Dr. Hyunyoung Lee. !!!!!! Based on slides by Andreas Klappenecker

CSCE 222 Discrete Structures for Computing. Propositional Logic. Dr. Hyunyoung Lee. !!!!!! Based on slides by Andreas Klappenecker CSCE 222 Discrete Structures for Computing Propositional Logic Dr. Hyunyoung Lee Based on slides by Andreas Klappenecker 1 Propositions A proposition is a declarative sentence that is either true or false

More information

Languages. Languages. An Example Grammar. Grammars. Suppose we have an alphabet V. Then we can write:

Languages. Languages. An Example Grammar. Grammars. Suppose we have an alphabet V. Then we can write: Languages A language is a set (usually infinite) of strings, also known as sentences Each string consists of a sequence of symbols taken from some alphabet An alphabet, V, is a finite set of symbols, e.g.

More information

Equational Logic and Term Rewriting: Lecture I

Equational Logic and Term Rewriting: Lecture I Why so many logics? You all know classical propositional logic. Why would we want anything more? Equational Logic and Term Rewriting: Lecture I One reason is that we might want to change some basic logical

More information

Numbers, proof and all that jazz.

Numbers, proof and all that jazz. CHAPTER 1 Numbers, proof and all that jazz. There is a fundamental difference between mathematics and other sciences. In most sciences, one does experiments to determine laws. A law will remain a law,

More information

CSci 311, Models of Computation Chapter 4 Properties of Regular Languages

CSci 311, Models of Computation Chapter 4 Properties of Regular Languages CSci 311, Models of Computation Chapter 4 Properties of Regular Languages H. Conrad Cunningham 29 December 2015 Contents Introduction................................. 1 4.1 Closure Properties of Regular

More information

Contents. basic algebra. Learning outcomes. Time allocation. 1. Mathematical notation and symbols. 2. Indices. 3. Simplification and factorisation

Contents. basic algebra. Learning outcomes. Time allocation. 1. Mathematical notation and symbols. 2. Indices. 3. Simplification and factorisation basic algebra Contents. Mathematical notation and symbols 2. Indices 3. Simplification and factorisation 4. Arithmetic of algebraic fractions 5. Formulae and transposition Learning outcomes In this workbook

More information

X-machines - a computational model framework.

X-machines - a computational model framework. Chapter 2. X-machines - a computational model framework. This chapter has three aims: To examine the main existing computational models and assess their computational power. To present the X-machines as

More information

Foundations of Mathematics

Foundations of Mathematics Foundations of Mathematics L. Pedro Poitevin 1. Preliminaries 1.1. Sets We will naively think of a set as a collection of mathematical objects, called its elements or members. To indicate that an object

More information

G52DOA - Derivation of Algorithms Predicate Logic

G52DOA - Derivation of Algorithms Predicate Logic G52DOA - Derivation of Algorithms Predicate Logic Venanzio Capretta Predicate Logic So far, we studied propositional logic, in which we started with unspecified propositional variables A, B, C, and combined

More information

Properties of Context-Free Languages

Properties of Context-Free Languages Properties of Context-Free Languages Seungjin Choi Department of Computer Science and Engineering Pohang University of Science and Technology 77 Cheongam-ro, Nam-gu, Pohang 37673, Korea seungjin@postech.ac.kr

More information

Properties of Context-free Languages. Reading: Chapter 7

Properties of Context-free Languages. Reading: Chapter 7 Properties of Context-free Languages Reading: Chapter 7 1 Topics 1) Simplifying CFGs, Normal forms 2) Pumping lemma for CFLs 3) Closure and decision properties of CFLs 2 How to simplify CFGs? 3 Three ways

More information

Constructing Ordinals

Constructing Ordinals Philosophia Scientiæ Travaux d'histoire et de philosophie des sciences CS 6 2006 Constructivism: Mathematics, Logic, Philosophy and Linguistics Constructing Ordinals Herman Ruge Jervell Publisher Editions

More information

The Integers. Math 3040: Spring Contents 1. The Basic Construction 1 2. Adding integers 4 3. Ordering integers Multiplying integers 12

The Integers. Math 3040: Spring Contents 1. The Basic Construction 1 2. Adding integers 4 3. Ordering integers Multiplying integers 12 Math 3040: Spring 2011 The Integers Contents 1. The Basic Construction 1 2. Adding integers 4 3. Ordering integers 11 4. Multiplying integers 12 Before we begin the mathematics of this section, it is worth

More information

Theory of Computer Science

Theory of Computer Science Theory of Computer Science C1. Formal Languages and Grammars Malte Helmert University of Basel March 14, 2016 Introduction Example: Propositional Formulas from the logic part: Definition (Syntax of Propositional

More information