Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013...
Transcript of Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013...
![Page 1: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/1.jpg)
Nondeterministic Automata (NFA)
∑ = {0,1}
Informal example
q0 q10,ε
0,1
1
M2:
q2 q3
0,11
![Page 2: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/2.jpg)
Nondeterministic Automata (NFA)
∑ = {0,1}
Informal example
q0 q10,ε
0,1
1
M2:
sources of nondeterminism
q2 q3
0,11
![Page 3: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/3.jpg)
Nondeterministic Automata (NFA)
∑ = {0,1}
Informal example
q0 q10,ε
0,1
1
M2:
sources of nondeterminism
q2 q3
0,11
![Page 4: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/4.jpg)
Nondeterministic Automata (NFA)
∑ = {0,1}
Informal example
q0 q10,ε
0,1
1
M2:
sources of nondeterminism
q2 q3
0,11
![Page 5: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/5.jpg)
no 1 transition
Nondeterministic Automata (NFA)
∑ = {0,1}
Informal example
q0 q10,ε
0,1
1
M2:
sources of nondeterminism
q2 q3
0,11
![Page 6: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/6.jpg)
no 1 transition
Nondeterministic Automata (NFA)
∑ = {0,1}
Informal example
q0 q10,ε
0,1
1
M2:
sources of nondeterminism
q2 q3
0,11
no 0 transition
![Page 7: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/7.jpg)
no 1 transition
Nondeterministic Automata (NFA)
∑ = {0,1}
Informal example
q0 q10,ε
0,1
1
M2:
sources of nondeterminism
q2 q3
0,11
no 0 transition
Accepts a word iff there exists an accepting run
![Page 8: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/8.jpg)
NFA
if y is not free in P and Q
A nondeterministic automaton M is a tuple M = (Q, ∑, δ, q0, F) where ! Q is a finite set of states ∑ is a finite alphabet δ: Q x ∑ε⟶ P(Q) is the transition function q0 is the initial state, q0 ∈Q F is a set of final states, F⊆Q
Definition
![Page 9: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/9.jpg)
NFA
if y is not free in P and Q
A nondeterministic automaton M is a tuple M = (Q, ∑, δ, q0, F) where ! Q is a finite set of states ∑ is a finite alphabet δ: Q x ∑ε⟶ P(Q) is the transition function q0 is the initial state, q0 ∈Q F is a set of final states, F⊆Q
Definition
∑ε = ∑ ∪ {ε}
![Page 10: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/10.jpg)
In the example M
NFA
if y is not free in P and Q
A nondeterministic automaton M is a tuple M = (Q, ∑, δ, q0, F) where ! Q is a finite set of states ∑ is a finite alphabet δ: Q x ∑ε⟶ P(Q) is the transition function q0 is the initial state, q0 ∈Q F is a set of final states, F⊆Q
Definition
∑ε = ∑ ∪ {ε}
![Page 11: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/11.jpg)
In the example M M2 = (Q, ∑, δ, q0, F) for
NFA
if y is not free in P and Q
A nondeterministic automaton M is a tuple M = (Q, ∑, δ, q0, F) where ! Q is a finite set of states ∑ is a finite alphabet δ: Q x ∑ε⟶ P(Q) is the transition function q0 is the initial state, q0 ∈Q F is a set of final states, F⊆Q
Definition
∑ε = ∑ ∪ {ε}
![Page 12: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/12.jpg)
In the example M M2 = (Q, ∑, δ, q0, F) for
NFA
if y is not free in P and Q
A nondeterministic automaton M is a tuple M = (Q, ∑, δ, q0, F) where ! Q is a finite set of states ∑ is a finite alphabet δ: Q x ∑ε⟶ P(Q) is the transition function q0 is the initial state, q0 ∈Q F is a set of final states, F⊆Q
Definition
Q = {q0, q1, q2, q3}
∑ε = ∑ ∪ {ε}
![Page 13: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/13.jpg)
In the example M M2 = (Q, ∑, δ, q0, F) for
NFA
if y is not free in P and Q
A nondeterministic automaton M is a tuple M = (Q, ∑, δ, q0, F) where ! Q is a finite set of states ∑ is a finite alphabet δ: Q x ∑ε⟶ P(Q) is the transition function q0 is the initial state, q0 ∈Q F is a set of final states, F⊆Q
Definition
Q = {q0, q1, q2, q3}
∑ = {0, 1}
∑ε = ∑ ∪ {ε}
![Page 14: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/14.jpg)
In the example M M2 = (Q, ∑, δ, q0, F) for
NFA
if y is not free in P and Q
A nondeterministic automaton M is a tuple M = (Q, ∑, δ, q0, F) where ! Q is a finite set of states ∑ is a finite alphabet δ: Q x ∑ε⟶ P(Q) is the transition function q0 is the initial state, q0 ∈Q F is a set of final states, F⊆Q
Definition
Q = {q0, q1, q2, q3}
∑ = {0, 1} F = {q3}
∑ε = ∑ ∪ {ε}
![Page 15: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/15.jpg)
In the example M M2 = (Q, ∑, δ, q0, F) for
NFA
if y is not free in P and Q
A nondeterministic automaton M is a tuple M = (Q, ∑, δ, q0, F) where ! Q is a finite set of states ∑ is a finite alphabet δ: Q x ∑ε⟶ P(Q) is the transition function q0 is the initial state, q0 ∈Q F is a set of final states, F⊆Q
Definition
Q = {q0, q1, q2, q3}
∑ = {0, 1} F = {q3}
δ(q0, 0) = {q0} δ(q0, 1) = {q0,q1} δ(q0, ε) = ∅ …..
∑ε = ∑ ∪ {ε}
![Page 16: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/16.jpg)
NFA
if y is not free in P and Q
The extended transition function
![Page 17: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/17.jpg)
NFA
if y is not free in P and Q
Given an NFA M = (Q, ∑, δ, q0, F) we can extend δ: Q x ∑ε⟶ P(Q) to ! δ*: Q x ∑*⟶ P(Q) !inductively, by: !
δ*(q, ε) = E(q) and δ*(q,wa) = E(∪q’ ∈ δ*(q,w) δ(q’, a))
The extended transition function
![Page 18: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/18.jpg)
NFA
if y is not free in P and Q
Given an NFA M = (Q, ∑, δ, q0, F) we can extend δ: Q x ∑ε⟶ P(Q) to ! δ*: Q x ∑*⟶ P(Q) !inductively, by: !
δ*(q, ε) = E(q) and δ*(q,wa) = E(∪q’ ∈ δ*(q,w) δ(q’, a))
The extended transition function
E(q) = {q’ | q’ = q ∨ ∃n∈N+.∃q0, .., qn ∈Q.q0 = q, qn = q’, qi+1 ∈δ(qi,ε), for i= 0, .., n-1}
![Page 19: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/19.jpg)
NFA
if y is not free in P and Q
Given an NFA M = (Q, ∑, δ, q0, F) we can extend δ: Q x ∑ε⟶ P(Q) to ! δ*: Q x ∑*⟶ P(Q) !inductively, by: !
δ*(q, ε) = E(q) and δ*(q,wa) = E(∪q’ ∈ δ*(q,w) δ(q’, a))
The extended transition function
E(q) = {q’ | q’ = q ∨ ∃n∈N+.∃q0, .., qn ∈Q.q0 = q, qn = q’, qi+1 ∈δ(qi,ε), for i= 0, .., n-1}
ε-closure of q, all states reachable by ε-transitions from q
![Page 20: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/20.jpg)
NFA
if y is not free in P and Q
Given an NFA M = (Q, ∑, δ, q0, F) we can extend δ: Q x ∑ε⟶ P(Q) to ! δ*: Q x ∑*⟶ P(Q) !inductively, by: !
δ*(q, ε) = E(q) and δ*(q,wa) = E(∪q’ ∈ δ*(q,w) δ(q’, a))
The extended transition function
!
E(X) = ∪x ∈ X E(x)
E(q) = {q’ | q’ = q ∨ ∃n∈N+.∃q0, .., qn ∈Q.q0 = q, qn = q’, qi+1 ∈δ(qi,ε), for i= 0, .., n-1}
ε-closure of q, all states reachable by ε-transitions from q
![Page 21: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/21.jpg)
NFA
if y is not free in P and Q
Given an NFA M = (Q, ∑, δ, q0, F) we can extend δ: Q x ∑ε⟶ P(Q) to ! δ*: Q x ∑*⟶ P(Q) !inductively, by: !
δ*(q, ε) = E(q) and δ*(q,wa) = E(∪q’ ∈ δ*(q,w) δ(q’, a))
The extended transition function
In M2, δ*(q0,0110) = {q0,q2,q3}
!
E(X) = ∪x ∈ X E(x)
E(q) = {q’ | q’ = q ∨ ∃n∈N+.∃q0, .., qn ∈Q.q0 = q, qn = q’, qi+1 ∈δ(qi,ε), for i= 0, .., n-1}
ε-closure of q, all states reachable by ε-transitions from q
![Page 22: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/22.jpg)
NFA
if y is not free in P and Q
Given an NFA M = (Q, ∑, δ, q0, F) we can extend δ: Q x ∑ε⟶ P(Q) to ! δ*: Q x ∑*⟶ P(Q) !inductively, by: !
δ*(q, ε) = E(q) and δ*(q,wa) = E(∪q’ ∈ δ*(q,w) δ(q’, a))
The extended transition function
DefinitionThe language recognised / accepted by a nondeterministic finite automaton M = (Q, ∑, δ, q0, F) is !
L(M) = {w ∈ ∑*| δ*(q0,w) ∩ F ≠ ∅}
In M2, δ*(q0,0110) = {q0,q2,q3}
!
E(X) = ∪x ∈ X E(x)
E(q) = {q’ | q’ = q ∨ ∃n∈N+.∃q0, .., qn ∈Q.q0 = q, qn = q’, qi+1 ∈δ(qi,ε), for i= 0, .., n-1}
ε-closure of q, all states reachable by ε-transitions from q
![Page 23: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/23.jpg)
NFA
if y is not free in P and Q
Given an NFA M = (Q, ∑, δ, q0, F) we can extend δ: Q x ∑ε⟶ P(Q) to ! δ*: Q x ∑*⟶ P(Q) !inductively, by: !
δ*(q, ε) = E(q) and δ*(q,wa) = E(∪q’ ∈ δ*(q,w) δ(q’, a))
The extended transition function
DefinitionThe language recognised / accepted by a nondeterministic finite automaton M = (Q, ∑, δ, q0, F) is !
L(M) = {w ∈ ∑*| δ*(q0,w) ∩ F ≠ ∅}
In M2, δ*(q0,0110) = {q0,q2,q3}
L(M2) = {u101w | u,w ∈ {0,1}*} ∪
{u11w | u,w ∈ {0,1}*}
!
E(X) = ∪x ∈ X E(x)
E(q) = {q’ | q’ = q ∨ ∃n∈N+.∃q0, .., qn ∈Q.q0 = q, qn = q’, qi+1 ∈δ(qi,ε), for i= 0, .., n-1}
ε-closure of q, all states reachable by ε-transitions from q
![Page 24: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/24.jpg)
Equivalence of automata
if y is not free in P and Q
Definition
![Page 25: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/25.jpg)
Equivalence of automata
if y is not free in P and Q
Two automata M1 and M2 are equivalent if L(M1) = L(M2)
Definition
![Page 26: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/26.jpg)
Equivalence of automata
if y is not free in P and Q
Two automata M1 and M2 are equivalent if L(M1) = L(M2)
Definition
Theorem NFA ~ DFAEvery NFA has an equivalent DFA
![Page 27: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/27.jpg)
Equivalence of automata
if y is not free in P and Q
Two automata M1 and M2 are equivalent if L(M1) = L(M2)
Definition
Theorem NFA ~ DFAEvery NFA has an equivalent DFA
Proof via the “powerset construction” / determinization
![Page 28: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/28.jpg)
Equivalence of automata
if y is not free in P and Q
Two automata M1 and M2 are equivalent if L(M1) = L(M2)
Definition
Theorem NFA ~ DFAEvery NFA has an equivalent DFA
Proof via the “powerset construction” / determinization
CorollaryA language is regular iff it is recognised by a NFA
![Page 29: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/29.jpg)
Closure under regular operations
![Page 30: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/30.jpg)
Closure under regular operations
Theorem C1
The class of regular languages is closed under union
![Page 31: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/31.jpg)
Closure under regular operations
Theorem C1
The class of regular languages is closed under union
Theorem C2
The class of regular languages is closed under complement
![Page 32: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/32.jpg)
Closure under regular operations
Theorem C1
The class of regular languages is closed under union
Theorem C3
The class of regular languages is closed under concatenation
Theorem C2
The class of regular languages is closed under complement
![Page 33: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/33.jpg)
Closure under regular operations
Theorem C1
The class of regular languages is closed under union
Theorem C3
The class of regular languages is closed under concatenation
Theorem C4
The class of regular languages is closed under Kleene star
Theorem C2
The class of regular languages is closed under complement
![Page 34: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/34.jpg)
Closure under regular operations
Theorem C1
The class of regular languages is closed under union
Theorem C3
The class of regular languages is closed under concatenation
Theorem C4
The class of regular languages is closed under Kleene star
Now we can prove these too
Theorem C2
The class of regular languages is closed under complement
![Page 35: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/35.jpg)
Regular expressions
Definition
![Page 36: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/36.jpg)
Regular expressions
Definition
finite representation of infinite languages
![Page 37: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/37.jpg)
Regular expressions
Let ∑ be an alphabet. The following are regular expressions !!1. a for a ∈ ∑ 2. ε 3. ∅ 4. (R1 ∪ R2) for R1, R2 regular expressions 5. (R1·R2) for R1, R2 regular expressions 6. (R1)* for R1 regular expression
Definition
finite representation of infinite languages
![Page 38: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/38.jpg)
Regular expressions
Let ∑ be an alphabet. The following are regular expressions !!1. a for a ∈ ∑ 2. ε 3. ∅ 4. (R1 ∪ R2) for R1, R2 regular expressions 5. (R1·R2) for R1, R2 regular expressions 6. (R1)* for R1 regular expression
Definition
inductive
finite representation of infinite languages
![Page 39: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/39.jpg)
Regular expressions
Let ∑ be an alphabet. The following are regular expressions !!1. a for a ∈ ∑ 2. ε 3. ∅ 4. (R1 ∪ R2) for R1, R2 regular expressions 5. (R1·R2) for R1, R2 regular expressions 6. (R1)* for R1 regular expression
Definition
inductiveexample: (ab ∪ a)*
finite representation of infinite languages
![Page 40: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/40.jpg)
Regular expressions
Let ∑ be an alphabet. The following are regular expressions !!1. a for a ∈ ∑ 2. ε 3. ∅ 4. (R1 ∪ R2) for R1, R2 regular expressions 5. (R1·R2) for R1, R2 regular expressions 6. (R1)* for R1 regular expression
Definition
inductiveexample: (ab ∪ a)*
corresponding languages
L(a) = {a} L(ε) = {ε} L(∅) = ∅
L(R1 ∪ R2) = L(R1) ∪ L(R2) L(R1·R2) = L(R1)·L(R2)
L(R1*) = L(R1)*
finite representation of infinite languages
![Page 41: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/41.jpg)
Equivalence of regular expressions and regular languages
if y is not free in P and Q
![Page 42: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/42.jpg)
Equivalence of regular expressions and regular languages
if y is not free in P and Q
Theorem (Kleene)A language is regular (i.e., recognised by a finite automaton) iff it is the language of a regular expression.
![Page 43: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/43.jpg)
Equivalence of regular expressions and regular languages
if y is not free in P and Q
Theorem (Kleene)A language is regular (i.e., recognised by a finite automaton) iff it is the language of a regular expression.
Proof ⇐ easy, as the constructions for
the closure properties, ⇒ not so easy, we’ll skip it for now…
![Page 44: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/44.jpg)
Nonregular languages
if y is not free in P and Q
![Page 45: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/45.jpg)
Nonregular languages
if y is not free in P and Q
Theorem (Pumping Lemma)
![Page 46: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/46.jpg)
Nonregular languages
if y is not free in P and Q
Theorem (Pumping Lemma)
every long enough word of a regular language can be pumped
![Page 47: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/47.jpg)
Nonregular languages
if y is not free in P and Q
Theorem (Pumping Lemma)If L is a regular language, then there is a number p ∈ N (the
pumping length) such that for any w ∈ L with |w| ≥ p, there exist x, y, z ∈ ∑* such that w = xyz and 1. xyiz ∈ L , for all i ∈ N 2. |y| > 0 3. |xy| ≤p
every long enough word of a regular language can be pumped
![Page 48: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/48.jpg)
Nonregular languages
if y is not free in P and Q
Theorem (Pumping Lemma)If L is a regular language, then there is a number p ∈ N (the
pumping length) such that for any w ∈ L with |w| ≥ p, there exist x, y, z ∈ ∑* such that w = xyz and 1. xyiz ∈ L , for all i ∈ N 2. |y| > 0 3. |xy| ≤p
Proof easy, using the pigeonhole principle
every long enough word of a regular language can be pumped
![Page 49: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/49.jpg)
Nonregular languages
if y is not free in P and Q
Theorem (Pumping Lemma)If L is a regular language, then there is a number p ∈ N (the
pumping length) such that for any w ∈ L with |w| ≥ p, there exist x, y, z ∈ ∑* such that w = xyz and 1. xyiz ∈ L , for all i ∈ N 2. |y| > 0 3. |xy| ≤p
Proof easy, using the pigeonhole principle
Example “corollary”L= { 0n1n | n ∈ N} is nonregular.
every long enough word of a regular language can be pumped
![Page 50: Week15-FS-2013cs.uni-salzburg.at/.../FormaleSysteme2013/Week15-FS-2013.pdfTitle Week15-FS-2013 Created Date 1/23/2014 3:41:08 PM](https://reader035.fdocuments.mx/reader035/viewer/2022071107/5fe10a89e9926428ba7fc01c/html5/thumbnails/50.jpg)
Nonregular languages
if y is not free in P and Q
Theorem (Pumping Lemma)If L is a regular language, then there is a number p ∈ N (the
pumping length) such that for any w ∈ L with |w| ≥ p, there exist x, y, z ∈ ∑* such that w = xyz and 1. xyiz ∈ L , for all i ∈ N 2. |y| > 0 3. |xy| ≤p
Proof easy, using the pigeonhole principle
Example “corollary”L= { 0n1n | n ∈ N} is nonregular.
every long enough word of a regular language can be pumped
Note the logical structure!