SlideShare a Scribd company logo
1 of 6
Homework 4 Solutions
#1 Prove that the following is not a regular
language: The set of strings of 0’s and 1’s that are
of the form w w
Proof by contradiction using the Pumping Lemma
• The language is clearly infinite, so there exists m such
that if I choose a string with |string| > m, the 3 properties
will hold.
• Pick string = 0m10m1. This has length > m.
• So, there is an u, v, w such that string = u v w
with |u v| < m, |v| > 0.
– Thus, uv = 0n, v = 0k, and w = 0 m-n 1 0m 1
• The string u v v w is supposed to also be in the language.
– But u v v w = 0n+k 1 0 m-n 1 0m 1, and a few minutes staring at
this should convince that there is no way this could be of
the form w w (Be sure you see why).
#2. Show that the language L = {ap} p is prime is
not a regular language
Proof by contradiction using the Pumping Lemma
• The language is clearly infinite, so there exists k such
that if I choose a string with |string| > k, the 3 properties
will hold.
• Pick string = ap
• Then we can break string into u v w such that v is not
empty and |u v| < k.
– Suppose |v| = m. Then |u w| = p – m.
• If the language really is regular, the string u vp-m w must
be in the language.
– But, | u vp-m w| = p – m+ (p-m)m which can be factored into
(m+1 )(p-m).
– Thus this string does not have a length which is prime, and
cannot be in L.
This is a contradiction. Thus, L is not regular
#3. Suppose h is the homomorphism from {0,1,2}
to {a,b} defined by h(0) = a; h(1) = ab; h(2) = ba.
a) What is h(21120)
h(21120) = ba ab ab ba a
b) If L = 01*2, what is h(L)?
h(L) = a(ab)*ba
c) If L = a(ba)*, what is h-1(L)?
02*U 1*0
#4. a) Show that the question: Does L = S*? for
regular language L is decidable.
• First the question Does L = F is decidable: Just have to
look at the dfa for L to see if there is a path from the start
state to a final state.
• Now look at the complement of L, L’. It is decidable
whether it is empty because the complement of a regular
language is regular. If L’ is empty, then L =S*; otherwise L
≠ S*.
• A more interesting proof is that a language is empty
(hence its complement is S*) if and only if the related dfa
accepts a string whose length is less than k, the number
of states (Then we have a decision procedure: just check
if any strings of length 0, 1, … k-1 are accepted). You
can show this using the pumping lemma!
b) Show that the question, Given a FA M over S,
does M accept a string of length < 2? is decidable
This is a finite set: just check each such
string to see if it leads to a final state.

More Related Content

Similar to hw4s05solns.ppt

Busy week • Lab 9 due Thursday at 5 pm L = { M,s s.docx
Busy  week • Lab 9 due Thursday at 5 pm L = { M,s  s.docxBusy  week • Lab 9 due Thursday at 5 pm L = { M,s  s.docx
Busy week • Lab 9 due Thursday at 5 pm L = { M,s s.docx
jasoninnes20
 
Busy week • Lab 9 due Thursday at 5 pm L = { M,s s.docx
Busy  week • Lab 9 due Thursday at 5 pm L = { M,s  s.docxBusy  week • Lab 9 due Thursday at 5 pm L = { M,s  s.docx
Busy week • Lab 9 due Thursday at 5 pm L = { M,s s.docx
clairbycraft
 

Similar to hw4s05solns.ppt (20)

rs1.ppt
rs1.pptrs1.ppt
rs1.ppt
 
09.LearningMaterial_Sample.pdf
09.LearningMaterial_Sample.pdf09.LearningMaterial_Sample.pdf
09.LearningMaterial_Sample.pdf
 
Busy week • Lab 9 due Thursday at 5 pm L = { M,s s.docx
Busy  week • Lab 9 due Thursday at 5 pm L = { M,s  s.docxBusy  week • Lab 9 due Thursday at 5 pm L = { M,s  s.docx
Busy week • Lab 9 due Thursday at 5 pm L = { M,s s.docx
 
Busy week • Lab 9 due Thursday at 5 pm L = { M,s s.docx
Busy  week • Lab 9 due Thursday at 5 pm L = { M,s  s.docxBusy  week • Lab 9 due Thursday at 5 pm L = { M,s  s.docx
Busy week • Lab 9 due Thursday at 5 pm L = { M,s s.docx
 
Regular Languages
Regular LanguagesRegular Languages
Regular Languages
 
Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...
 Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S... Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...
Introduction to the Theory of Computation, Winter 2003 A. Hevia and J. Mao S...
 
Module 1 TOC.pptx
Module 1 TOC.pptxModule 1 TOC.pptx
Module 1 TOC.pptx
 
Theory of computing pdf
Theory of computing pdfTheory of computing pdf
Theory of computing pdf
 
Automata
AutomataAutomata
Automata
 
Automata
AutomataAutomata
Automata
 
L_2_apl.pptx
L_2_apl.pptxL_2_apl.pptx
L_2_apl.pptx
 
Top school in ghaziabad
Top school in ghaziabadTop school in ghaziabad
Top school in ghaziabad
 
FSM.pdf
FSM.pdfFSM.pdf
FSM.pdf
 
10 Regular VS Non Regular Language.pptx
10 Regular VS Non Regular Language.pptx10 Regular VS Non Regular Language.pptx
10 Regular VS Non Regular Language.pptx
 
Unit2 Toc.pptx
Unit2 Toc.pptxUnit2 Toc.pptx
Unit2 Toc.pptx
 
Unit i
Unit iUnit i
Unit i
 
Formal Languages and Automata Theory unit 5
Formal Languages and Automata Theory unit 5Formal Languages and Automata Theory unit 5
Formal Languages and Automata Theory unit 5
 
Presentation (5).pdf
Presentation (5).pdfPresentation (5).pdf
Presentation (5).pdf
 
Flat
FlatFlat
Flat
 
Dfa basics
Dfa basicsDfa basics
Dfa basics
 

Recently uploaded

Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
AnaAcapella
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
中 央社
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
EADTU
 

Recently uploaded (20)

Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
 
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptx
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
 
Book Review of Run For Your Life Powerpoint
Book Review of Run For Your Life PowerpointBook Review of Run For Your Life Powerpoint
Book Review of Run For Your Life Powerpoint
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 

hw4s05solns.ppt

  • 2. #1 Prove that the following is not a regular language: The set of strings of 0’s and 1’s that are of the form w w Proof by contradiction using the Pumping Lemma • The language is clearly infinite, so there exists m such that if I choose a string with |string| > m, the 3 properties will hold. • Pick string = 0m10m1. This has length > m. • So, there is an u, v, w such that string = u v w with |u v| < m, |v| > 0. – Thus, uv = 0n, v = 0k, and w = 0 m-n 1 0m 1 • The string u v v w is supposed to also be in the language. – But u v v w = 0n+k 1 0 m-n 1 0m 1, and a few minutes staring at this should convince that there is no way this could be of the form w w (Be sure you see why).
  • 3. #2. Show that the language L = {ap} p is prime is not a regular language Proof by contradiction using the Pumping Lemma • The language is clearly infinite, so there exists k such that if I choose a string with |string| > k, the 3 properties will hold. • Pick string = ap • Then we can break string into u v w such that v is not empty and |u v| < k. – Suppose |v| = m. Then |u w| = p – m. • If the language really is regular, the string u vp-m w must be in the language. – But, | u vp-m w| = p – m+ (p-m)m which can be factored into (m+1 )(p-m). – Thus this string does not have a length which is prime, and cannot be in L. This is a contradiction. Thus, L is not regular
  • 4. #3. Suppose h is the homomorphism from {0,1,2} to {a,b} defined by h(0) = a; h(1) = ab; h(2) = ba. a) What is h(21120) h(21120) = ba ab ab ba a b) If L = 01*2, what is h(L)? h(L) = a(ab)*ba c) If L = a(ba)*, what is h-1(L)? 02*U 1*0
  • 5. #4. a) Show that the question: Does L = S*? for regular language L is decidable. • First the question Does L = F is decidable: Just have to look at the dfa for L to see if there is a path from the start state to a final state. • Now look at the complement of L, L’. It is decidable whether it is empty because the complement of a regular language is regular. If L’ is empty, then L =S*; otherwise L ≠ S*. • A more interesting proof is that a language is empty (hence its complement is S*) if and only if the related dfa accepts a string whose length is less than k, the number of states (Then we have a decision procedure: just check if any strings of length 0, 1, … k-1 are accepted). You can show this using the pumping lemma!
  • 6. b) Show that the question, Given a FA M over S, does M accept a string of length < 2? is decidable This is a finite set: just check each such string to see if it leads to a final state.