SlideShare a Scribd company logo
1 of 7
Download to read offline
Homework One Solution– CSE 355
Due: 31 January 2011
Please note that there is more than one way to answer most of
these questions. The following only represents a sample solution.
Problem 1: Linz 2.1.7(b)(c)(g), 2.2.7. and 2.2.11
2.1.7: Find dfa’s for the following languages on Σ = {a, b}
(b): L = {w : |w| mod 5 = 0}
A dfa for L is given by the following transition graph:
a,b
a,b
a,b
a,ba,b
(c): L = {w : na(w) mod 3 > 1}
A dfa for L is given by the following transition graph:
a
a
a b
b
b
1
(g): L = {w : |w| mod 3 = 0, |w| = 6}
A dfa for L is given by the following transition graph:
a,b a,b a,b a,b
a,b
a,ba,ba,b
a,b
a,b
2.2.7: Design an nfa with no more than five states for the set {ababn
: n ≥
0} ∪ {aban
: n ≥ 0}.
An nfa for the set is given by the following transition graph:
a b
b
b
a
a
λ
2.2.11: Find an nfa with foour states for L = {an
: n ≥ 0} ∪ {bn
a : n ≥ 1}.
An nfa for L is given by the following transition graph:
b
b
aλ
a
2
Problem 2: Linz 2.39 and 2.3.12
2.39: Let L be a regular language that does not contain λ. Show that there exists
an nfa without λ-transitions and with a single final state that accept L.
Since L is regular there exists a dfa, D = (Q, Σ, δ, q0, F), with an associated transition graph, GD,
such that L(D) = L. We will construct an nfa N = (Q ∪ {qf }, Σ, δ , q0, {qf }) where qf /∈ Q by
giving its transition graph GN as follows:
1. From GD, remove the final label from every final state (making them nonfinal states).
2. Add a new state qf and label it as a final state.
3. For every state qi, if there is a transition from qi to a state in F on input a ∈ Σ, then add a
transition from qi to qf on input a.
Clearly, N has a single accept state, qf , and no λ-transitions (since D is a dfa and we did not add
any λ-transitions in our construction of N). We will now show that L(N) = L. First note that
since λ /∈ L, every w ∈ L can be written as w = va for some v ∈ Σ∗ and an a ∈ Σ.
Now, w = va ∈ L iff there is a walk on GD labeled with w from q0 to qi with qi ∈ F
iff there is a walk on GD labeled with v from q0 to qj and a transition from qj to qi on input a
iff there is a walk on GN labeled with v from q0 to qj and a transition from qj to qf on input a
(since every transition in GD is a transition in GN and from step (3) in the construction of GN )
iff there is a walk on GN labeled with w from q0 to qf
iff w ∈ L(N).
Thus, w ∈ L iff w ∈ L(N). Therefore we conclude that L(N) = L and that for any regular
language that does not contain λ, there exists an nfa without λ-transitions and with a single final
state that accept L.
2.3.12: Show that if L is regular, so is LR
.
Since L is a regular language, we can construct a corresponding dfa, N, such that L(N) = L (For
every regular language, there is a corresponding dfa, by definition, and for every dfa, there is an
equivalent nfa).
By definition, LR consists of all strings in language L in reverse order. We will construct a
nfa, NR, representing LR such that L(NR) = LR. NR will contain an additional start state with
λ-transitions to the final states of N. The direction of every transition in N is reversed. Also, the
start state of N will be the final state of NR. The construction of nfa NR is as follows:
Let N = (Q, Σ, δ, qn, F)
NR = (Q ∪ {q0}, Σ, δr, qr, {qn})
Set of states of NR = set of states of N along with q0 = Q ∪ {qr}
Σ = alphabet of NR = same as N
qr = start state of NR
{qn} = set of final states of NR = start state of N
Transition function:
δr(q, a) = {q1 : δ(q1, a) = q}
δr(qr, λ) = F
3
δr(qr, a) = ∅, if a = λ
Now we will show that LR = L(NR). w ∈ LR iff wR ∈ L iff there is a walk on the transition
graph of N with label wR from qn to some qi ∈ F iff there is a walk on the transition graph of NR
from qr to qi with label λ and a walk from qi to qn with label w (Following the reverse of every
transition in the original graph) iff w ∈ L(NR).
Since LR can be represented by a nfa, it is regular (by equivalence of nfa to dfa, and dfa to
regular language).
Problem 3: Linz 2.1.8
2.1.8: A run in a string is a substring of length at least two, as long as possible
and consisting entirely of the same symbol. For instance, the string abbbaab
contains a run of b s of length three and a run of a s of length two. Find dfa’s for
the following languages on {a, b}.
(a): L = {w : w contains no runs of length less than four}.
a
b
a
aaaa
a
a
a
a
a
a
b
b
b
b
b
b
b b b b
b
4
(b): L = {w : every run of a s has length either two or three}.
b
a
b
b
bb
aaaa
(c): L = {w : there are at most two runs of a s of length three}.
a a a
a
a
a a
a
a
a
aaaa
a
a,b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
5
(d): L = {w : there are exactly two runs of a s of length 3}.
b
a a a
a
a
aaa
a
a
a a a
a
a
a,b
b
b b
b
b
b
b
b
b
b
b
b
b
b
Problem 4: Linz 2.2.22
2.2.22: Let L be a regular language on some alphabet Σ, and let Σ1 ⊂ Σ be a
smaller alphabet. Consider L1, the subset of L whose elements are made up only
of symbols from Σ1, that is,
L1 = L ∩ Σ∗
1.
Show that L1 is also regular.
Since L is a regular language, there should be a dfa, N, representing L such that L(N) = L, where
N = (Q, Σ, δ, q0, F).
Since L1 is made up of strings with alphabets from Σ1, Σ1 ⊂ Σ, and L1 is a subset of L, L1 contains
only strings that are accepted by L as well. We can construct a dfa, M, for L1 as follows:
1. From the transition graph of N, remove every transition that is labeled with some a /∈ Σ1.
Now we will show that L(M) = L1. w = a1a2 . . . an ∈ L1 iff there is a walk on the transition
graph of N with label w from q0 to some qi ∈ F and every ai ∈ Σ1 iff there is a walk on the
transition graph of M from q0 to qi with label w (it will be the exact same path as it was in N) iff
w ∈ L(M).
Since L1 can be represented by a dfa, it is regular.
6
Problem 5: Linz 2.3.3 and 2.3.8
2.3.3: Convert the following nfa into an equivalent dfa (see textbook for the
diagram).
0
1
0
0
0
0
0
0
0
1
1
1
1
1
1
1
{0,1,2}
{1,2}{0,1}
{1} {2} Φ
{0,2}{0}
2.3.8: Find an nfa without λ-transitions and with a single final state that accepts
L = {a} ∪ {bn
: n ≥ 1}.
Noting that λ /∈ L, we can use the technique given in 2.3.9 (Problem 2) and we get the nfa given
by the following transition graph:
b
b
a
b
a,b
7

More Related Content

What's hot

Minimization of DFA
Minimization of DFAMinimization of DFA
Minimization of DFAkunj desai
 
Finite automata-for-lexical-analysis
Finite automata-for-lexical-analysisFinite automata-for-lexical-analysis
Finite automata-for-lexical-analysisDattatray Gandhmal
 
Theory of Automata and formal languages unit 1
Theory of Automata and formal languages unit 1Theory of Automata and formal languages unit 1
Theory of Automata and formal languages unit 1Abhimanyu Mishra
 
NFA or Non deterministic finite automata
NFA or Non deterministic finite automataNFA or Non deterministic finite automata
NFA or Non deterministic finite automatadeepinderbedi
 
Nondeterministic Finite Automata
Nondeterministic Finite AutomataNondeterministic Finite Automata
Nondeterministic Finite AutomataAdel Al-Ofairi
 
Finite automata examples
Finite automata examplesFinite automata examples
Finite automata examplesankitamakin
 
Theory of Computation Regular Expressions, Minimisation & Pumping Lemma
Theory of Computation Regular Expressions, Minimisation & Pumping LemmaTheory of Computation Regular Expressions, Minimisation & Pumping Lemma
Theory of Computation Regular Expressions, Minimisation & Pumping LemmaRushabh2428
 
Nondeterministic Finite Automat
Nondeterministic Finite AutomatNondeterministic Finite Automat
Nondeterministic Finite AutomatAdel Al-Ofairi
 
Theory of Computation FSM Conversions and Problems
Theory of Computation FSM Conversions and ProblemsTheory of Computation FSM Conversions and Problems
Theory of Computation FSM Conversions and ProblemsRushabh2428
 
Toc(df avs nfa)avishek130650107020
Toc(df avs nfa)avishek130650107020Toc(df avs nfa)avishek130650107020
Toc(df avs nfa)avishek130650107020Avishek Sarkar
 
Automata
AutomataAutomata
AutomataGaditek
 

What's hot (20)

Minimization of DFA
Minimization of DFAMinimization of DFA
Minimization of DFA
 
DFA Minimization
DFA MinimizationDFA Minimization
DFA Minimization
 
Nfa vs dfa
Nfa vs dfaNfa vs dfa
Nfa vs dfa
 
Nfa egs
Nfa egsNfa egs
Nfa egs
 
Finite automata-for-lexical-analysis
Finite automata-for-lexical-analysisFinite automata-for-lexical-analysis
Finite automata-for-lexical-analysis
 
Theory of Automata and formal languages unit 1
Theory of Automata and formal languages unit 1Theory of Automata and formal languages unit 1
Theory of Automata and formal languages unit 1
 
Context free grammar
Context free grammarContext free grammar
Context free grammar
 
NFA or Non deterministic finite automata
NFA or Non deterministic finite automataNFA or Non deterministic finite automata
NFA or Non deterministic finite automata
 
Automata theory
Automata theoryAutomata theory
Automata theory
 
Finite automata
Finite automataFinite automata
Finite automata
 
Nondeterministic Finite Automata
Nondeterministic Finite AutomataNondeterministic Finite Automata
Nondeterministic Finite Automata
 
Finite automata examples
Finite automata examplesFinite automata examples
Finite automata examples
 
Theory of Computation Regular Expressions, Minimisation & Pumping Lemma
Theory of Computation Regular Expressions, Minimisation & Pumping LemmaTheory of Computation Regular Expressions, Minimisation & Pumping Lemma
Theory of Computation Regular Expressions, Minimisation & Pumping Lemma
 
Dfa h11
Dfa h11Dfa h11
Dfa h11
 
Nondeterministic Finite Automat
Nondeterministic Finite AutomatNondeterministic Finite Automat
Nondeterministic Finite Automat
 
Theory of Computation FSM Conversions and Problems
Theory of Computation FSM Conversions and ProblemsTheory of Computation FSM Conversions and Problems
Theory of Computation FSM Conversions and Problems
 
Toc(df avs nfa)avishek130650107020
Toc(df avs nfa)avishek130650107020Toc(df avs nfa)avishek130650107020
Toc(df avs nfa)avishek130650107020
 
Automata
AutomataAutomata
Automata
 
Nfa to-dfa
Nfa to-dfaNfa to-dfa
Nfa to-dfa
 
push down automata
push down automatapush down automata
push down automata
 

Viewers also liked

The Mediterranean Summer Xperience 2011 (AEGEE-Tarragona)
The Mediterranean Summer Xperience 2011 (AEGEE-Tarragona)The Mediterranean Summer Xperience 2011 (AEGEE-Tarragona)
The Mediterranean Summer Xperience 2011 (AEGEE-Tarragona)Raül Arlàndez
 
Towards a Security-aware Network Virtualization
Towards a Security-aware Network VirtualizationTowards a Security-aware Network Virtualization
Towards a Security-aware Network VirtualizationAchim Friedland
 
《学会提问-掌握批判性思维》
《学会提问-掌握批判性思维》《学会提问-掌握批判性思维》
《学会提问-掌握批判性思维》wangyuanzhi1
 
Bob Carlton/Jen Howver - 5 Threads Towards Threshold: What Writing, Publishi...
Bob Carlton/Jen Howver - 5 Threads Towards Threshold:  What Writing, Publishi...Bob Carlton/Jen Howver - 5 Threads Towards Threshold:  What Writing, Publishi...
Bob Carlton/Jen Howver - 5 Threads Towards Threshold: What Writing, Publishi...ECPA Events
 

Viewers also liked (7)

The Mediterranean Summer Xperience 2011 (AEGEE-Tarragona)
The Mediterranean Summer Xperience 2011 (AEGEE-Tarragona)The Mediterranean Summer Xperience 2011 (AEGEE-Tarragona)
The Mediterranean Summer Xperience 2011 (AEGEE-Tarragona)
 
Pertemuan 3
Pertemuan 3Pertemuan 3
Pertemuan 3
 
Towards a Security-aware Network Virtualization
Towards a Security-aware Network VirtualizationTowards a Security-aware Network Virtualization
Towards a Security-aware Network Virtualization
 
L aboratorio 2
L aboratorio 2L aboratorio 2
L aboratorio 2
 
《学会提问-掌握批判性思维》
《学会提问-掌握批判性思维》《学会提问-掌握批判性思维》
《学会提问-掌握批判性思维》
 
Bob Carlton/Jen Howver - 5 Threads Towards Threshold: What Writing, Publishi...
Bob Carlton/Jen Howver - 5 Threads Towards Threshold:  What Writing, Publishi...Bob Carlton/Jen Howver - 5 Threads Towards Threshold:  What Writing, Publishi...
Bob Carlton/Jen Howver - 5 Threads Towards Threshold: What Writing, Publishi...
 
Dr. Ravi Gupta
Dr. Ravi GuptaDr. Ravi Gupta
Dr. Ravi Gupta
 

Similar to Homework One Solution for CSE 355

Automata
AutomataAutomata
AutomataGaditek
 
Automata theory - Push Down Automata (PDA)
Automata theory - Push Down Automata (PDA)Automata theory - Push Down Automata (PDA)
Automata theory - Push Down Automata (PDA)Akila Krishnamoorthy
 
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...parmeet834
 
Chapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfChapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfdawod yimer
 
2. context free langauages
2. context free langauages2. context free langauages
2. context free langauagesdanhumble
 
Finite automata examples
Finite automata examplesFinite automata examples
Finite automata examplesankitamakin
 
PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...
PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...
PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...ArjunMehra32
 
Theory of Computation - Lectures 4 and 5
Theory of Computation - Lectures 4 and 5Theory of Computation - Lectures 4 and 5
Theory of Computation - Lectures 4 and 5Dr. Maamoun Ahmed
 
Resumen material MIT
Resumen material MITResumen material MIT
Resumen material MITRawel Luciano
 
6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdf6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdfshruti533256
 
RegularLanguageProperties.pptx
RegularLanguageProperties.pptxRegularLanguageProperties.pptx
RegularLanguageProperties.pptxEzhumalai p
 
POST’s CORRESPONDENCE PROBLEM
POST’s CORRESPONDENCE PROBLEMPOST’s CORRESPONDENCE PROBLEM
POST’s CORRESPONDENCE PROBLEMRajendran
 
Chapter 2 limits of DFA NDFA.ppt
Chapter 2  limits of DFA  NDFA.pptChapter 2  limits of DFA  NDFA.ppt
Chapter 2 limits of DFA NDFA.pptArwaKhallouf
 
03-FiniteAutomata.pptx
03-FiniteAutomata.pptx03-FiniteAutomata.pptx
03-FiniteAutomata.pptxssuser47f7f2
 
End semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
End semexam | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurEnd semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
End semexam | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurVivekananda Samiti
 

Similar to Homework One Solution for CSE 355 (20)

Automata
AutomataAutomata
Automata
 
Automata theory - Push Down Automata (PDA)
Automata theory - Push Down Automata (PDA)Automata theory - Push Down Automata (PDA)
Automata theory - Push Down Automata (PDA)
 
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...
 
Chapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfChapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdf
 
FLAT.pdf
FLAT.pdfFLAT.pdf
FLAT.pdf
 
2. context free langauages
2. context free langauages2. context free langauages
2. context free langauages
 
Finite automata examples
Finite automata examplesFinite automata examples
Finite automata examples
 
PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...
PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...
PPT 2.1.1(The Pumping Lemma for Regular sets, Application of the Pumping Lemm...
 
rs1.ppt
rs1.pptrs1.ppt
rs1.ppt
 
Theory of Computation - Lectures 4 and 5
Theory of Computation - Lectures 4 and 5Theory of Computation - Lectures 4 and 5
Theory of Computation - Lectures 4 and 5
 
Resumen material MIT
Resumen material MITResumen material MIT
Resumen material MIT
 
6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdf6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdf
 
RegularLanguageProperties.pptx
RegularLanguageProperties.pptxRegularLanguageProperties.pptx
RegularLanguageProperties.pptx
 
POST’s CORRESPONDENCE PROBLEM
POST’s CORRESPONDENCE PROBLEMPOST’s CORRESPONDENCE PROBLEM
POST’s CORRESPONDENCE PROBLEM
 
Chapter 2 limits of DFA NDFA.ppt
Chapter 2  limits of DFA  NDFA.pptChapter 2  limits of DFA  NDFA.ppt
Chapter 2 limits of DFA NDFA.ppt
 
5. NFA & DFA.pdf
5. NFA & DFA.pdf5. NFA & DFA.pdf
5. NFA & DFA.pdf
 
Unit2 Toc.pptx
Unit2 Toc.pptxUnit2 Toc.pptx
Unit2 Toc.pptx
 
03-FiniteAutomata.pptx
03-FiniteAutomata.pptx03-FiniteAutomata.pptx
03-FiniteAutomata.pptx
 
End semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
End semexam | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurEnd semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
End semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
 
Unit ii
Unit iiUnit ii
Unit ii
 

Recently uploaded

Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 

Recently uploaded (20)

Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

Homework One Solution for CSE 355

  • 1. Homework One Solution– CSE 355 Due: 31 January 2011 Please note that there is more than one way to answer most of these questions. The following only represents a sample solution. Problem 1: Linz 2.1.7(b)(c)(g), 2.2.7. and 2.2.11 2.1.7: Find dfa’s for the following languages on Σ = {a, b} (b): L = {w : |w| mod 5 = 0} A dfa for L is given by the following transition graph: a,b a,b a,b a,ba,b (c): L = {w : na(w) mod 3 > 1} A dfa for L is given by the following transition graph: a a a b b b 1
  • 2. (g): L = {w : |w| mod 3 = 0, |w| = 6} A dfa for L is given by the following transition graph: a,b a,b a,b a,b a,b a,ba,ba,b a,b a,b 2.2.7: Design an nfa with no more than five states for the set {ababn : n ≥ 0} ∪ {aban : n ≥ 0}. An nfa for the set is given by the following transition graph: a b b b a a λ 2.2.11: Find an nfa with foour states for L = {an : n ≥ 0} ∪ {bn a : n ≥ 1}. An nfa for L is given by the following transition graph: b b aλ a 2
  • 3. Problem 2: Linz 2.39 and 2.3.12 2.39: Let L be a regular language that does not contain λ. Show that there exists an nfa without λ-transitions and with a single final state that accept L. Since L is regular there exists a dfa, D = (Q, Σ, δ, q0, F), with an associated transition graph, GD, such that L(D) = L. We will construct an nfa N = (Q ∪ {qf }, Σ, δ , q0, {qf }) where qf /∈ Q by giving its transition graph GN as follows: 1. From GD, remove the final label from every final state (making them nonfinal states). 2. Add a new state qf and label it as a final state. 3. For every state qi, if there is a transition from qi to a state in F on input a ∈ Σ, then add a transition from qi to qf on input a. Clearly, N has a single accept state, qf , and no λ-transitions (since D is a dfa and we did not add any λ-transitions in our construction of N). We will now show that L(N) = L. First note that since λ /∈ L, every w ∈ L can be written as w = va for some v ∈ Σ∗ and an a ∈ Σ. Now, w = va ∈ L iff there is a walk on GD labeled with w from q0 to qi with qi ∈ F iff there is a walk on GD labeled with v from q0 to qj and a transition from qj to qi on input a iff there is a walk on GN labeled with v from q0 to qj and a transition from qj to qf on input a (since every transition in GD is a transition in GN and from step (3) in the construction of GN ) iff there is a walk on GN labeled with w from q0 to qf iff w ∈ L(N). Thus, w ∈ L iff w ∈ L(N). Therefore we conclude that L(N) = L and that for any regular language that does not contain λ, there exists an nfa without λ-transitions and with a single final state that accept L. 2.3.12: Show that if L is regular, so is LR . Since L is a regular language, we can construct a corresponding dfa, N, such that L(N) = L (For every regular language, there is a corresponding dfa, by definition, and for every dfa, there is an equivalent nfa). By definition, LR consists of all strings in language L in reverse order. We will construct a nfa, NR, representing LR such that L(NR) = LR. NR will contain an additional start state with λ-transitions to the final states of N. The direction of every transition in N is reversed. Also, the start state of N will be the final state of NR. The construction of nfa NR is as follows: Let N = (Q, Σ, δ, qn, F) NR = (Q ∪ {q0}, Σ, δr, qr, {qn}) Set of states of NR = set of states of N along with q0 = Q ∪ {qr} Σ = alphabet of NR = same as N qr = start state of NR {qn} = set of final states of NR = start state of N Transition function: δr(q, a) = {q1 : δ(q1, a) = q} δr(qr, λ) = F 3
  • 4. δr(qr, a) = ∅, if a = λ Now we will show that LR = L(NR). w ∈ LR iff wR ∈ L iff there is a walk on the transition graph of N with label wR from qn to some qi ∈ F iff there is a walk on the transition graph of NR from qr to qi with label λ and a walk from qi to qn with label w (Following the reverse of every transition in the original graph) iff w ∈ L(NR). Since LR can be represented by a nfa, it is regular (by equivalence of nfa to dfa, and dfa to regular language). Problem 3: Linz 2.1.8 2.1.8: A run in a string is a substring of length at least two, as long as possible and consisting entirely of the same symbol. For instance, the string abbbaab contains a run of b s of length three and a run of a s of length two. Find dfa’s for the following languages on {a, b}. (a): L = {w : w contains no runs of length less than four}. a b a aaaa a a a a a a b b b b b b b b b b b 4
  • 5. (b): L = {w : every run of a s has length either two or three}. b a b b bb aaaa (c): L = {w : there are at most two runs of a s of length three}. a a a a a a a a a a aaaa a a,b b b b b b b b b b b b b b b b b 5
  • 6. (d): L = {w : there are exactly two runs of a s of length 3}. b a a a a a aaa a a a a a a a a,b b b b b b b b b b b b b b b Problem 4: Linz 2.2.22 2.2.22: Let L be a regular language on some alphabet Σ, and let Σ1 ⊂ Σ be a smaller alphabet. Consider L1, the subset of L whose elements are made up only of symbols from Σ1, that is, L1 = L ∩ Σ∗ 1. Show that L1 is also regular. Since L is a regular language, there should be a dfa, N, representing L such that L(N) = L, where N = (Q, Σ, δ, q0, F). Since L1 is made up of strings with alphabets from Σ1, Σ1 ⊂ Σ, and L1 is a subset of L, L1 contains only strings that are accepted by L as well. We can construct a dfa, M, for L1 as follows: 1. From the transition graph of N, remove every transition that is labeled with some a /∈ Σ1. Now we will show that L(M) = L1. w = a1a2 . . . an ∈ L1 iff there is a walk on the transition graph of N with label w from q0 to some qi ∈ F and every ai ∈ Σ1 iff there is a walk on the transition graph of M from q0 to qi with label w (it will be the exact same path as it was in N) iff w ∈ L(M). Since L1 can be represented by a dfa, it is regular. 6
  • 7. Problem 5: Linz 2.3.3 and 2.3.8 2.3.3: Convert the following nfa into an equivalent dfa (see textbook for the diagram). 0 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1 {0,1,2} {1,2}{0,1} {1} {2} Φ {0,2}{0} 2.3.8: Find an nfa without λ-transitions and with a single final state that accepts L = {a} ∪ {bn : n ≥ 1}. Noting that λ /∈ L, we can use the technique given in 2.3.9 (Problem 2) and we get the nfa given by the following transition graph: b b a b a,b 7