Languages & Automata

Similar documents
Let's start with an example:

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton

Worked out examples Finite Automata

CHAPTER 1 Regular Languages. Contents. definitions, examples, designing, regular operations. Non-deterministic Finite Automata (NFA)

CHAPTER 1 Regular Languages. Contents

Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Kleene-*

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014

Finite-State Automata: Recap

Finite Automata-cont d

CS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.)

a,b a 1 a 2 a 3 a,b 1 a,b a,b 2 3 a,b a,b a 2 a,b CS Determinisitic Finite Automata 1

CS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018

Non-deterministic Finite Automata

CSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science

Deterministic Finite Automata

Minimal DFA. minimal DFA for L starting from any other

Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages

Deterministic Finite-State Automata

Lecture 08: Feb. 08, 2019

CS 311 Homework 3 due 16:30, Thursday, 14 th October 2010

Regular expressions, Finite Automata, transition graphs are all the same!!

CS375: Logic and Theory of Computing

Non-deterministic Finite Automata

CSCI 340: Computational Models. Transition Graphs. Department of Computer Science

Chapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1

Grammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages

CISC 4090 Theory of Computation

Theory of Computation Regular Languages. (NTU EE) Regular Languages Fall / 38

Chapter 2 Finite Automata

Convert the NFA into DFA

Homework 3 Solutions

Converting Regular Expressions to Discrete Finite Automata: A Tutorial

Fundamentals of Computer Science

Some Theory of Computation Exercises Week 1

Theory of Computation Regular Languages

Today s Topics Automata and Languages

Automata and Languages

Formal Languages and Automata

Nondeterminism and Nodeterministic Automata

Non Deterministic Automata. Linz: Nondeterministic Finite Accepters, page 51

CS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata

5. (±±) Λ = fw j w is string of even lengthg [ 00 = f11,00g 7. (11 [ 00)± Λ = fw j w egins with either 11 or 00g 8. (0 [ ffl)1 Λ = 01 Λ [ 1 Λ 9.

Java II Finite Automata I

Chapter 1, Part 1. Regular Languages. CSC527, Chapter 1, Part 1 c 2012 Mitsunori Ogihara 1

Anatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute

Designing finite automata II

80 CHAPTER 2. DFA S, NFA S, REGULAR LANGUAGES. 2.6 Finite State Automata With Output: Transducers

CS:4330 Theory of Computation Spring Regular Languages. Equivalences between Finite automata and REs. Haniel Barbosa

NFAs continued, Closure Properties of Regular Languages

1 Nondeterministic Finite Automata

3 Regular expressions

First Midterm Examination

CSE : Exam 3-ANSWERS, Spring 2011 Time: 50 minutes

CS 310 (sec 20) - Winter Final Exam (solutions) SOLUTIONS

CSC 311 Theory of Computation

NFAs continued, Closure Properties of Regular Languages

Thoery of Automata CS402

In-depth introduction to main models, concepts of theory of computation:

Name Ima Sample ASU ID

Non-Deterministic Finite Automata. Fall 2018 Costas Busch - RPI 1

First Midterm Examination

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2016

Harvard University Computer Science 121 Midterm October 23, 2012

Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem 2/16/15

input tape head moves current state

Myhill-Nerode Theorem

Finite Automata. Informatics 2A: Lecture 3. Mary Cryan. 21 September School of Informatics University of Edinburgh

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

Regular Language. Nonregular Languages The Pumping Lemma. The pumping lemma. Regular Language. The pumping lemma. Infinitely long words 3/17/15

Formal Language and Automata Theory (CS21004)

2.4 Linear Inequalities and Interval Notation

NFAs and Regular Expressions. NFA-ε, continued. Recall. Last class: Today: Fun:

Finite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh

More on automata. Michael George. March 24 April 7, 2014

Lexical Analysis Finite Automate

Table of contents: Lecture N Summary... 3 What does automata mean?... 3 Introduction to languages... 3 Alphabets... 3 Strings...

CS375: Logic and Theory of Computing

Talen en Automaten Test 1, Mon 7 th Dec, h45 17h30

Lecture 09: Myhill-Nerode Theorem

Automata Theory 101. Introduction. Outline. Introduction Finite Automata Regular Expressions ω-automata. Ralf Huuck.

Coalgebra, Lecture 15: Equations for Deterministic Automata

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY. FLAC (15-453) - Spring L. Blum

Formal languages, automata, and theory of computation

Homework 4. 0 ε 0. (00) ε 0 ε 0 (00) (11) CS 341: Foundations of Computer Science II Prof. Marvin Nakayama

Closure Properties of Regular Languages

Section: Other Models of Turing Machines. Definition: Two automata are equivalent if they accept the same language.

Compiler Design. Fall Lexical Analysis. Sample Exercises and Solutions. Prof. Pedro C. Diniz

Scanner. Specifying patterns. Specifying patterns. Operations on languages. A scanner must recognize the units of syntax Some parts are easy:

Non Deterministic Automata. Formal Languages and Automata - Yonsei CS 1

Hybrid Control and Switched Systems. Lecture #2 How to describe a hybrid system? Formal models for hybrid system

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers

GNFA GNFA GNFA GNFA GNFA

Intermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4

The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER LANGUAGES AND COMPUTATION ANSWERS

Revision Sheet. (a) Give a regular expression for each of the following languages:

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers. Mehryar Mohri Courant Institute and Google Research

Turing Machines Part One

NFA DFA Example 3 CMSC 330: Organization of Programming Languages. Equivalence of DFAs and NFAs. Equivalence of DFAs and NFAs (cont.

Automata and Languages

Transcription:

Lnguges & Automt Dr. Lim Nughton Lnguges A lnguge is sed on n lphet which is finite set of smols such s {, } or {, } or {,..., z}. If Σ is n lphet, string over Σ is finite sequence of letters from Σ, (strings re like words!) e.g. for Σ = {, } the following re ll strings over Σ,,,,,, etc. The empt or null string is denoted Λ. sustring: is sustring of ecuse. Strings hve length e.g. for s = we hve s = 7, Λ =. B Σ we denote the set of ll words over Σ. A lnguge over Σ is suset of Σ. Wh? Emple Let Σ = {, } nd Σ e the set of ll strings over Σ. Then the following re ll lnguges over Σ. L = {,,, } L = {s Σ : s = }. L = {Λ} the empt lnguge! We cn define n opertion (multipliction?) on strings conctention s follows. For s = nd t = st =, ts = Nottion: k = The string conctented together k times, e.g. 4 =.

For n lphet Σ we define Σk = {s Σ : s = k} i.e. the set of strings of length k. For e.g. s = sk we denote k copies of s conctented together e.g. s =. We cn conctente lnguges too! If L nd M re lnguges then LM = {st : s L, t M }, M L = {ts : s L, t M } Emple If L = {pl, send} nd M = {ing, of f } then LM = {pling, plof f, sending, sendof f }. We will write L for the conctention LL of L with itself, L for LLL nd so on. We then hve L = [ Li i= nd + L = [ Li. i= Wht s the difference? Ans: L+ = LL = L L. Most of the lnguges we del with will e infinite so we cn t list ll their strings. We ll descrie them in ws like the following L = {,,, } {}{}. L = {s {, } : N (s) < N (s)}, where e.g. N (s) refers to the numer of occurrences of the letter in the string s. Here L shows how n ritrr string is constructed wheres L shows how to recognize string from the lnguge. Emple Find n emple of lnguges L nd M over {, } such tht (L M ) 6= L M. Solution Let L = {}, M = {} then L M = {, } nd (L M ) = {,, } i.e. the lnguge of ll strings tht cn e constructed using s nd s. L = {} nd M = {} nd L M = {} {} which onl contins strings of repeted s or repeted s, e.g., {} {} ut is not.

Emple List some elements of {, }. How cn ou recognize strings in this lnguge? Solution {Λ,,,,,,...}. This is the lnguge of strings which egin with nd don t contin s sustring. We will e concerned with recognising lnguges. B recognizing the lnguge we men providing method for determining whether or not given string is in the lnguge. This m e done using Finite Automt (Finite Stte Mchine) or Turing Mchine. the lnguges we re concerned with re clled regulr lnguges (more lter). Automt Definition.. A deterministic finite utomton (or finite stte mchine) is n ordered quintuple (Q, Σ, q, δ, A) where Q is finite set of sttes, Σ is finite lphet, q Q is the initil stte, δ is trnsition function, rule which governs wht the mchine does in given stte if it is pssed given input smol/word. A Q is set of ccepting sttes. A finite utomton cn e pictured directed grph clled stte trnsition digrm with nodes representing sttes nd rrows leled letters of the lphet. An rrow from stte q to stte q will e leled to men tht if the mchine is in stte q nd the net smol red is the mchine chnges to stte q. Emple An utomton tht ccepts ll words over {, } ending in. strt In the ove emple Q = {,,, }, q =, Σ = {, }, the ccepting stte is A = {} nd the trnsition function is given:

q δ(q, ) δ(q, ) Emple The DFA elow ccepts the lnguge of ll words over Σ = {, } which end in nd don t contin. strt Λ, N Emple For the DFA elow, descrie the lnguge it recognizes., strt A B C It recognizes the lnguge of ll strings tht do not contin the sustring. Eercises Q. Construct DFA ccepting the lnguge {n : n 6}. Q. Let Σ = {, }. Construct deterministic finite utomton M ccepting the lnguge L = {α Σ : α is divisile }, i.e. ll words where the numer of occurrences of the letter is divisile. Note tht divides so the empt word L. 4

Eercises Q. Let Σ = {, }. Construct deterministic finite utomton M ccepting the lnguge L = {α Σ : α is not divisile }, i.e. ll words where the numer of occurrences of the letter is not divisile. Note tht divides so the empt word / L. Q4. Let Σ = {, }. Construct deterministic finite utomton M ccepting the lnguge L = {α Σ : α does not contin s sustring }. Q5. Construct DFA M such tht L(M ) = { 4k : k N}. 5

Solutions Q. Construct DFA ccepting the lnguge { n : n 6}. strt 6 5 4 Q. Let Σ = {, }. Construct deterministic finite utomton M ccepting the lnguge L = {α Σ : α is divisile }, i.e. ll words where the numer of occurrences of the letter is divisile. Note tht divides so the empt word L. strt Q. Let Σ = {, }. Construct deterministic finite utomton M ccepting the lnguge L = {α Σ : α is not divisile }, i.e. ll words where the numer of occurrences of the letter is not divisile. Note tht divides so the empt word / L. strt 6

Q4. Let Σ = {, }. Construct deterministic finite utomton M ccepting the lnguge L = {α Σ : α does not contin s sustring }. strt, Q5. Construct DFA M such tht L(M) = { 4k : k N}. strt 4 5 8 R 7, 6 7