Theory of Languages and Automata

Similar documents
Mathematical Preliminaries. Sipser pages 1-28

Automata Theory and Formal Grammars: Lecture 1

Foundations of Mathematics MATH 220 FALL 2017 Lecture Notes

Informal Statement Calculus

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

HANDOUT AND SET THEORY. Ariyadi Wijaya

Axiomatic set theory. Chapter Why axiomatic set theory?

CSE 1400 Applied Discrete Mathematics Definitions

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

Packet #2: Set Theory & Predicate Calculus. Applied Discrete Mathematics

Theory of Computation

CA320 - Computability & Complexity

Handbook of Logic and Proof Techniques for Computer Science

Review 3. Andreas Klappenecker

Lecture Notes 1 Basic Concepts of Mathematics MATH 352

CS 208: Automata Theory and Logic

CSCE 222 Discrete Structures for Computing. Review for Exam 1. Dr. Hyunyoung Lee !!!

COMP 182 Algorithmic Thinking. Proofs. Luay Nakhleh Computer Science Rice University

Logic Overview, I. and T T T T F F F T F F F F

CS2742 midterm test 2 study sheet. Boolean circuits: Predicate logic:

With Question/Answer Animations. Chapter 2

Propositional logic (revision) & semantic entailment. p. 1/34

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Discrete Mathematical Structures: Theory and Applications

Chapter 1 : The language of mathematics.

Foundations of Mathematics

UNIVERSITY OF CALICUT SCHOOL OF DISTANCE EDUCATION B Sc (MATHEMATICS) I Semester Core Course. FOUNDATIONS OF MATHEMATICS (MODULE I & ii) QUESTION BANK

AN EXTENSION OF THE PROBABILITY LOGIC LP P 2. Tatjana Stojanović 1, Ana Kaplarević-Mališić 1 and Zoran Ognjanović 2

n Empty Set:, or { }, subset of all sets n Cardinality: V = {a, e, i, o, u}, so V = 5 n Subset: A B, all elements in A are in B

586 Index. vertex, 369 disjoint, 236 pairwise, 272, 395 disjoint sets, 236 disjunction, 33, 36 distributive laws

Sets are one of the basic building blocks for the types of objects considered in discrete mathematics.

Intro to Logic and Proofs

Lecture 11: Measuring the Complexity of Proofs

The Limit of Humanly Knowable Mathematical Truth

Undecidability. Andreas Klappenecker. [based on slides by Prof. Welch]

Automata Theory for Presburger Arithmetic Logic

3515ICT: Theory of Computation. Regular languages

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

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

2.2 Lowenheim-Skolem-Tarski theorems

Preliminaries to the Theory of Computation

Conjunction: p q is true if both p, q are true, and false if at least one of p, q is false. The truth table for conjunction is as follows.

Automata and Languages

Class 29 - November 3 Semantics for Predicate Logic

Notes for Math 290 using Introduction to Mathematical Proofs by Charles E. Roberts, Jr.

Review 1. Andreas Klappenecker

Copyright c 2007 Jason Underdown Some rights reserved. statement. sentential connectives. negation. conjunction. disjunction

Analysis I. Classroom Notes. H.-D. Alber

Introduction to Metalogic

1. Propositional Calculus

CSCE 222 Discrete Structures for Computing. Review for the Final. Hyunyoung Lee

Logic, Sets, and Proofs

Equational Logic. Chapter Syntax Terms and Term Algebras

Logic and Proofs. (A brief summary)

Handout on Logic, Axiomatic Methods, and Proofs MATH Spring David C. Royster UNC Charlotte

Propositional Logic, Predicates, and Equivalence

Introduction. Foundations of Computing Science. Pallab Dasgupta Professor, Dept. of Computer Sc & Engg INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR

FOUNDATIONS & PROOF LECTURE NOTES by Dr Lynne Walling

Contents Propositional Logic: Proofs from Axioms and Inference Rules

BASIC MATHEMATICAL TECHNIQUES

Fuzzy and Rough Sets Part I

Victoria Gitman and Thomas Johnstone. New York City College of Technology, CUNY

Gödel s Incompleteness Theorems

Discrete Mathematics. W. Ethan Duckworth. Fall 2017, Loyola University Maryland

COMP 2600: Formal Methods for Software Engineeing

Classical Propositional Logic

Economics 204 Summer/Fall 2017 Lecture 1 Monday July 17, 2017

Infinite constructions in set theory

Introduction to Proofs

1. Propositional Calculus

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

This section will take the very naive point of view that a set is a collection of objects, the collection being regarded as a single object.

CS 514, Mathematics for Computer Science Mid-semester Exam, Autumn 2017 Department of Computer Science and Engineering IIT Guwahati

CS 455/555: Mathematical preliminaries

CSE 1400 Applied Discrete Mathematics Proofs

2/2/2018. CS 103 Discrete Structures. Chapter 1. Propositional Logic. Chapter 1.1. Propositional Logic

Sets, Logic, Relations, and Functions

Chapter Summary. Sets The Language of Sets Set Operations Set Identities Functions Types of Functions Operations on Functions Computability

3. The Logic of Quantified Statements Summary. Aaron Tan August 2017

The Process of Mathematical Proof

A Guide to Proof-Writing

Introduction to Logic and Axiomatic Set Theory

CSE 311: Foundations of Computing I Autumn 2014 Practice Final: Section X. Closed book, closed notes, no cell phones, no calculators.

MAGIC Set theory. lecture 1

Logic and Proofs. (A brief summary)

Gödel s Completeness Theorem

Predicate Logic. Andreas Klappenecker

Chapter 1 Elementary Logic

CSCI3390-Lecture 6: An Undecidable Problem

Today s topics. Introduction to Set Theory ( 1.6) Naïve set theory. Basic notations for sets

Axioms of Kleene Algebra

Meta-logic derivation rules

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

CHAPTER 6. Copyright Cengage Learning. All rights reserved.

Practice Test III, Math 314, Spring 2016

Exercises for Unit VI (Infinite constructions in set theory)

Digital Logic Design: a rigorous approach c

Topics in Logic and Proofs

Section 0. Sets and Relations

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

Transcription:

Theory of Languages and Automata Chapter 0 - Introduction Sharif University of Technology

References Main Reference M. Sipser, Introduction to the Theory of Computation, 3 nd Ed., Cengage Learning, 2013. Additional References P. Linz, An Introduction to Formal Languages and Automata, 3 rd Ed., Jones and Barlett Publishers, Inc., 2001. J.E. Hopcroft, R. Motwani and J.D. Ullman, Introduction to Automata Theory, Languages, and Computation, 2 nd Ed., Addison-Wesley, 2001. P.J. Denning, J.B. Dennnis, and J.E. Qualitz, Machines, Languages, and Computation, Prentice-Hall, Inc., 1978. P.J. Cameron, Sets, Logic and Categories, Springer-Verlag, London limited, 1998. Theory of Languages and Automata Prof. Movaghar 2

Grading Policy Assignments 30% First Quiz 15% Second Quiz 15% Final Exam 40% Theory of Languages and Automata Prof. Movaghar 3

Main Topics Complexity Theory Computability Theory Automata Theory Mathematical Notions Alphabet Strings Languages Theory of Languages and Automata Prof. Movaghar 4

Complexity Theory The scheme for classifying problems according to their computational difficulty ptions: Alter the problem to a more easily solvable one by understanding the root of difficulty Approximate the perfect solution Use a procedure that occasionally is slow but usually runs quickly Consider alternatives, such as randomized computation Applied area: Cryptography Theory of Languages and Automata Prof. Movaghar 5

Computability Theory Determining whether a problem is solvable by Computers Classification of problems as solvable ones and unsolvable ones Theory of Languages and Automata Prof. Movaghar 6

Automata Theory Definitions and properties of mathematical models of computation Finite automaton Usage: Text Processing, Compilers, Hardware Design Context-free grammar Usage: Programming Languages, Artificial Intelligence Theory of Languages and Automata Prof. Movaghar 7

Logic The science of the formal principles of reasoning Theory of Languages and Automata Prof. Movaghar 8

History of Logic Logic was known as 'dialectic' or 'analytic' in Ancient Greece. The word 'logic' (from the Greek logos, meaning discourse or sentence) does not appear in the modern sense until the commentaries of Alexander of Aphrodisias, writing in the third century A.D. While many cultures have employed intricate systems of reasoning, and logical methods are evident in all human thought, an explicit analysis of the principles of reasoning was developed only in three traditions: those of China, India, and Greece. Theory of Languages and Automata Prof. Movaghar 9

History of Logic (cont.) Although exact dates are uncertain, particularly in the case of India, it is possible that logic emerged in all three societies by the 4 th century BC. The formally sophisticated treatment of modern logic descends from the Greek tradition, particularly Aristotelian logic, which was further developed by Islamic Logicians and then medieval European logicians. The work of Frege in the 19th century marked a radical departure from the Aristotlian leading to the rapid development of symbolic logic, later called mathematical logic. Theory of Languages and Automata Prof. Movaghar 10

Modern Logic Descartes proposed using algebra, especially techniques for solving for unknown quantities in equations, as a vehicle for scientific exploration. The idea of a calculus of reasoning was also developed by Leibniz. He was the first to formulate the notion of a broadly applicable system of mathematical logic. Frege in his 1879 work extended formal logic beyond propositional logic to include quantification to represent the "all", "some" propositions of Aristotelian logic. Theory of Languages and Automata Prof. Movaghar 11

Modern Logic (cont.) A logic is a language of formulas. A formula is a finite sequence of symbols with a syntax and semantics. A logic can have a formal system. A formal system consists of a set of axioms and rules of inference. Theory of Languages and Automata Prof. Movaghar 12

Logic Types of Interest Propositional Logic Predicate Logic Theory of Languages and Automata Prof. Movaghar 13

Syntax of Propositional Logic Let {p0, p1,..} be a countable set of propositional variables, {,,,, } be a finite set of connectives, Also, there are left and right brackets, A propositional variable is a formula, If φ and ψ are formulas, then so are ( φ), (φ ψ), (φ ψ), (φ ψ), and (φ ψ). Theory of Languages and Automata Prof. Movaghar 14

Semantics of Propositional Logic Any formula, which involves the propositional variables p 0,...,p n, can be used to define a function of n variables, that is, a function from the set {T, F} n to {T, F}. This function is often represented as the truth table of the formula and is defined to be the semantics of that formula. Theory of Languages and Automata Prof. Movaghar 15

Examples ψ φ ( φ) (φ ψ) (φ ψ) (φ ψ) (φ ψ) T T F T T T T F T F F T F F T F T F T T F F F T F F T T Theory of Languages and Automata Prof. Movaghar 16

ther Definitions A formulae is a tautology if it is always true. (P ( P)) is a tautology. A formulae is a contradiction if it is never true. (P ( P)) is a contradiction. A formulae is a contingency if it is sometimes true. (P ( P)) is a contingency. Theory of Languages and Automata Prof. Movaghar 17

Formal System A formal system includes the following: An alphabet A, a set of symbols. A set of formulae, each of which is a string of symbols from A. A set of axioms, each axiom being a formula. A set of rules of inference, each of which takes as input a finite sequence of formulae and produces as output a formula. Theory of Languages and Automata Prof. Movaghar 18

Proof A proof in a formal system is just a finite sequence of formulae such that each formula in the sequence either is an axiom or is obtained from earlier formulae by applying a rule of inference. Theory of Languages and Automata Prof. Movaghar 19

Theorem A theorem of the formal system is just the last formula in a proof. Example: For any formula φ, the formula (φ φ) is a theorem of the propositional logic. Theory of Languages and Automata Prof. Movaghar 20

A Formal System for Propositional Logic There are three schemes of axioms, namely: (A1) (φ (ψ φ)) (A2) (φ (ψ θ)) ((φ ψ) (φ θ)) (A3) ((( φ) ( ψ)) (ψ φ)) Each of these formulas is an axiom, for all choices of formulae φ, ψ, θ. There is only one rule of inference, namely Modus Ponens: From φ and (φ ψ), infer ψ. Theory of Languages and Automata Prof. Movaghar 21

Example of a Proof Using (A2), taking φ, ψ, θ to be φ, (φ φ) and φ respectively ((φ ((φ φ) φ)) ((φ (φ φ)) (φ φ))) Using (A1), taking φ, ψ to be φ and (φ φ) respectively (φ ((φ φ) φ)) Using Modus Ponens ((φ (φ φ)) (φ φ)) Using (A1), taking φ, ψ to be φ and φ respectively (φ (φ φ)) Using Modus Ponens (φ φ) Theory of Languages and Automata Prof. Movaghar 22

Soundness & Completeness A formal system is said to be sound if all theorems in that system are tautology. A formal system is said to be complete if all tautologies in that system are theorems. Theory of Languages and Automata Prof. Movaghar 23

Predicate A proposition involving some variables, functions and relations Example P(x) = x > 3 Q(x,y,z) = x 2 + y 2 = z 2 Theory of Languages and Automata Prof. Movaghar 24

Quantifier Universal: for all x P(x) P(x 1 ) P(x 2 ) P(x 3 ) Existential: there exists x P(x) P(x 1 ) P(x 2 ) P(x 3 ) Combinations: x y y > x Theory of Languages and Automata Prof. Movaghar 25

Quantifiers: Negation ( x P(x)) x P(x) ( x P(x)) x P(x) x y P(x,y) x y P(x,y) x y P(x,y) x y P(x,y) Theory of Languages and Automata Prof. Movaghar 26

Rules of Inference 1. Direct Proof 2. Indirect Proof 3. Proof by Contradiction 4. Proof by Cases 5. Induction Theory of Languages and Automata Prof. Movaghar 27

Direct Proof If the two propositions (premises) p and p q are theorems, we may deduce that the proposition q is also a theorem. This fundamental rule of inference is called modus ponens by logicians. p q p q Theory of Languages and Automata Prof. Movaghar 28

Indirect Proof Proves p q by instead proving the contrapositive, ~q ~p p q ~q ~p Theory of Languages and Automata Prof. Movaghar 29

Proof by Contradiction The rule of inference used is that from theorems p and q p, we may deduce theorem q. p ~q ~p q Theory of Languages and Automata Prof. Movaghar 30

Proof by Cases You want to prove p q P can be decomposed to some cases: p p 1 ν p 2 ν ν p n Independently prove the n implications given by p i q for 1 i n. Theory of Languages and Automata Prof. Movaghar 31

Proof by Induction To prove xp ( x ) 1. Proof P(0), 2. Proof x [ P( x) P( x 1)] Theory of Languages and Automata Prof. Movaghar 32

Constructive Existence Proof Want to prove that x P(x) Find an a and then prove that P(a) is true Theory of Languages and Automata Prof. Movaghar 33

Non-Constructive Existence Proof Want to prove that x P(x) You cannot find an a that P(a) is true Then, you can use proof by contradiction: ~ x P( x) x ~ P( x) F Theory of Languages and Automata Prof. Movaghar 34

Intuitive (Naïve) Set Theory There are three basic concepts in set theory: Membership Extension Abstraction Theory of Languages and Automata Prof. Movaghar 35

Membership Membership is a relation that holds between a set and an object x A to mean the object x is a member of the set A, or x belongs to A. The negation of this assertion is written x A as an abbreviation for the proposition (x A) ne way to specify a set is to list its elements. For example, the set A = {a, b, c} consists of three elements. For this set A, it is true that a A but d A Theory of Languages and Automata Prof. Movaghar 36

Extension The concept of extension is that two sets are identical if and if only if they contain the same elements. Thus we write A=B to mean x [x A x B] Theory of Languages and Automata Prof. Movaghar 37

Abstraction Each property defines a set, and each set defines a property If p(x) is a property then we can define a set A A = {x p(x)} If A is a set then we can define a predicate p(x) p(x) = x A Theory of Languages and Automata Prof. Movaghar 38

Intuitive versus axiomatic set theory The theory of set built on the intuitive concept of membership, extension, and abstraction is known as intuitive (naïve) set theory. As an axiomatic theory of sets, it is not entirely satisfactory, because the principle of abstraction leads to contradictions when applied to certain simple predicates. Theory of Languages and Automata Prof. Movaghar 39

Russell s Paradox Let p(x) be a predicate defined as P(X) = (X X) Define set R as R={X P(X)} Is P(R) true? Is P(R) false? Theory of Languages and Automata Prof. Movaghar 40

Gottlob Frege s Comments The logician Gottlob Frege was the first to develop mathematics on the foundation of set theory. He learned of Russell Paradox while his work was in press, and wrote, A scientist can hardly meet with anything more undesirable than to have the foundation give way just as the work is finished. In this position I was put by a letter from Mr. Bertrand Russell as the work was nearly through the press. Theory of Languages and Automata Prof. Movaghar 41

Power Set The set of all subsets of a given set A is known as the power set of A, and is denoted by P(A): P(A) = {B B A} Theory of Languages and Automata Prof. Movaghar 42

Set peration-union The union of two sets A and B is A B = {x (x A) (x B)} and consists of those elements in at least one of A and B. If A 1,, A n constitute a family of sets, their union is = (A 1 A n ) = {x x A i for some i, 1 i n} Theory of Languages and Automata Prof. Movaghar 43

Set peration-intersection The intersection of two sets A and B is A B = {x (x A) (x B)} and consists of those elements in at least one of A and B. If A 1,, A n constitute a family of sets, their intersection is = (A 1 A n ) = {x x A i for all i, 1 i n} Theory of Languages and Automata Prof. Movaghar 44

Set peration-complement The complement of a set A is a set A c defined as: A c = {x x A} The complement of a set B with respect to A, also denoted as A-B, is defined as: A-B = {x A x B} Theory of Languages and Automata Prof. Movaghar 45

rdered Pairs and n-tuples An ordered pair of elements is written (x,y) where x is known as the first element, and y is known as the second element. An n-tuple is an ordered sequence of elements (x 1, x 2,, x n ) And is a generalization of an ordered pair. Theory of Languages and Automata Prof. Movaghar 46

rdered Sets and Set Products By Cartesian product of two sets A and B, we mean the set A B = {(x,y) x A, y B} Similarly, A 1 A 2 A n = {x 1 A 1, x 2 A 2,, x n A n } Theory of Languages and Automata Prof. Movaghar 47

Relations A relation ρ between sets A and B is a subset of A B: ρ A B The domain of ρ is defined as D ρ = {x A for some y B, (x,y) ρ} The range of ρ is defined as R ρ = {y B for some x A, (x,y) ρ} If ρ A A, then ρ is called a relation on A. Theory of Languages and Automata Prof. Movaghar 48

Types of Relations on Sets A relation ρ is reflexive if (x,x) ρ, for each x A A relation ρ is symmetric if, for all x,y A (x,y) ρ implies (y,x) ρ A relation ρ is antisymmetric if, for all x,y A (x,y) ρ and (y,x) ρ implies x=y A relation ρ is transitive if, for all x,y,z A (x,y) ρ and (y,z) ρ implies (x,z) ρ Theory of Languages and Automata Prof. Movaghar 49

Partial rder and Equivalence Relations A relation ρ on a set A is called a partial ordering of A if ρ is reflexive, anti-symmetric, and transitive. A relation ρ on a set A is called an equivalence relation if ρ is reflexive, symmetric, and transitive. Theory of Languages and Automata Prof. Movaghar 50

Total rdering A relation ρ on a set A is a total ordering if ρ is a partial ordering and, for each pair of elements (x,y) in A A at least one of (x,y) ρ or (y,x) ρ is true. Theory of Languages and Automata Prof. Movaghar 51

Inverse Relation For any relation ρ A B, the inverse of ρ is defined by ρ -1 = {(y,x) (x,y) ρ} If D ρ and R ρ are the domain and range of ρ, then D ρ-1 = R ρ and R ρ-1 = D ρ Theory of Languages and Automata Prof. Movaghar 52

Equivalence Let ρ A A be an equivalence relation on A. The equivalence class of an element x is defined as [x] = {y A (x,y) ρ} An equivalence relation on a set partitions the set. Theory of Languages and Automata Prof. Movaghar 53

Functions A relation f A B is a function if it has the property: for all x,y,z, (x,y) f and (x,z) f implies y = z If f A B is a function, we write f: A B and say that f maps A into B. We use the common notation to mean (x,y) f. Y = f(x) Theory of Languages and Automata Prof. Movaghar 54

Functions (cont.) As before, the domain of f is the set D f = {x A for some y B, (x,y) f} and the range of f is the set R f = {y B for some x A, (x,y) f} If D f A, we say the function is a partial function; if D f = A, we say that f is a total function. Theory of Languages and Automata Prof. Movaghar 55

Functions (cont.) If x D f, we say that f is defined at x; otherwise f is undefined at x. If R f = B, we say that f maps D f onto B. If a function f has the property for all x,y,z, f(x) = z and f(y) = z implies x = y then f is a one-to-one function. If f: A B is a one-to-one function, f gives a one-to one correspondence between elements of its domain and range. Theory of Languages and Automata Prof. Movaghar 56

Functions (cont.) Let X be a set and suppose A X. Define function C A : X {0,1} such that C A (x) = 1, if x A; C A (x) = 0, otherwise. C A (x) is called the characteristic function of set A with respect to set X. If f A B is a function, then the inverse of f is the set f --1 = {(y,x) (x,y) f} f --1 is a function if and only if f is one-to-one. Theory of Languages and Automata Prof. Movaghar 57

Functions (cont.) Let f: A B be a function, and suppose that X A. Then the set Y = f(x) = {y B y = f(x) for some x X} is known as the image of X under f. Similarly, the inverse image of a set Y included in the range of f is f -1 (Y) = {x A y = f(x) for some y Y} Theory of Languages and Automata Prof. Movaghar 58

Cardinality Two sets A and B are of equal cardinality, written as A = B if and only if there is a one-to-one function f: A B that maps A onto B. We write A B if B includes a subset C such that A = C. If A B and A B, then A has cardinality less than that of B, and we write A < B Theory of Languages and Automata Prof. Movaghar 59

Cardinality (cont.) Let J = {1, 2, } and J n = {1, 2,, n}. A sequence on a set X is a function f: J X. A sequence may be written as f(1), f(2), f(3), However, we often use the simpler notation x 1, x 2, x 3,., x i X A finite sequence of length n on X is a function f: J n X, usually written as x 1, x 2, x 3,., x n, x i X The sequence of length zero is the function f: X. Theory of Languages and Automata Prof. Movaghar 60

Finite and Infinite Sets A set A is finite if A = J n for some integer n 0, in which case we say that A has cardinality n. A set is infinite if it is not finite. A set X is denumerable if X = J. A set is countable if it is either finite or denumerable. A set is uncountable if it is not countable. Theory of Languages and Automata Prof. Movaghar 61

Some Properties Proposition: Every subset of J is countable. Consequently, each subset of any denumerable set is countable. Proposition: A function f: J Y has a countable range. Hence any function on a countable domain has a countable range. Proposition: The set J J is denumerable. Therefore, A B is countable for arbitrary countable sets A and B. Theory of Languages and Automata Prof. Movaghar 62

Some Properties (cont.) Proposition: The set A B is countable whenever A and B are countable sets. Proposition: Every infinite set X is at least denumerable ; that is X J. Proposition: The set of all infinite sequence on {0, 1} is uncountable. Theory of Languages and Automata Prof. Movaghar 63

Some Properties (cont.) Proposition: (Schröder-Bernestein Theorem) For any set A and B, if A B and B A, then A = B. Proposition: (Cantor s Theorem) For any set X, X < P(X). Theory of Languages and Automata Prof. Movaghar 64

1-1 correspondence Q N Proof (dove-tailing): Theory of Languages and Automata Prof. Movaghar 65

Countable Sets Any subset of a countable set The set of integers, algebraic/rational numbers The union of two/finite number of countable sets Cartesian product of a finite number of countable sets The set of all finite subsets of N Set of binary strings Theory of Languages and Automata Prof. Movaghar 66

Diagonal Argument Theory of Languages and Automata Prof. Movaghar 67

Uncountable Sets R, R 2, P(N) The intervals [0,1), [0, 1], (0, 1) The set of all real numbers The set of all functions from N to {0, 1} The set of functions N N Any set having an uncountable subset Theory of Languages and Automata Prof. Movaghar 68

Transfinite Cardinal Numbers Cardinality of a finite set is simply the number of elements in the set. Cardinalities of infinite sets are not natural numbers, but are special objects called transfinite cardinal numbers. 0 : N, is the first transfinite cardinal number. continuum hypothesis claims that R = 1, the second transfinite cardinal. Theory of Languages and Automata Prof. Movaghar 69

Alphabet A finite and nonempty set of symbols (usually shown by or Г). Example: = {,,,, } Theory of Languages and Automata Prof. Movaghar 70

Strings A finite list of symbols from an alphabet Example: house If ω is a string over, the length of ω, written ω, is the number of symbols that it contains. The empty string (ε or λ) is the string of length zero. εω = ωε = ω String z is a substring of ω if z appears consecutively within ω. Theory of Languages and Automata Prof. Movaghar 71

perations on Strings Reverse of a string: w = a 1 a 2 a n ababaaabbb w R = a n a 2 a 1 bbbaaababa Concatenation: w = a 1 a 2 a n abba v = b 1 b 2 b m bbbaaa wv = a 1 a 2 a n b 1 b 2 b m abbabbbaaa wv = w + v Theory of Languages and Automata Prof. Movaghar 72

perations on Alphabet * : The set of all strings that can be produced from. + : The set of all strings, excluding λ, that can be produced from. Suppose that λ={λ}. Then: Theory of Languages and Automata Prof. Movaghar 73

Languages A set of strings Any language on the alphabet is a subset of *. Examples: Theory of Languages and Automata Prof. Movaghar 74

perations on Languages Languages are a special kind of sets and operations on sets can be defined on them as well. Union Intersection Relative Complement Complement λ, b, aa, ab, bb, aaa, } Theory of Languages and Automata Prof. Movaghar 75

perations on Languages (cont.) Reverse of a language Example: Theory of Languages and Automata Prof. Movaghar 76

perations on Languages (cont.) Concatenation Example: Theory of Languages and Automata Prof. Movaghar 77

perations on Languages (cont.) *: Kleene * The set of all strings that can be produced by concatenation of strings of a language. Example: +: The set of all strings, excluding λ, that can be produced by concatenation of strings of a language. Theory of Languages and Automata Prof. Movaghar 78

Gödel Numbering Let be an alphabet containing n objects. Let h: J n be an arbitrary one-to-one correspondence. Define function f as: f: * N such that f(ε) =0; f(w.v) = n f(w) + h(v), for w * and v. f is called a Gödel Numbering of *. Proposition: * is denumerable. Proposition: Any language on an alphabet is countable. Theory of Languages and Automata Prof. Movaghar 79