SlideShare a Scribd company logo
1 of 43
Deterministic Finite Automata
Definition: A deterministic finite automaton (DFA) consists of
1.a finite set of states (often denoted Q)
2.a finite set Σ of symbols (alphabet)
3.a transition function that takes as argument a state and a
symbol and returns a state (often denoted δ)
4.a start state often denoted q0
5.a set of final or accepting states (often denoted F ) We have q0
∈ Q and F ⊆ Q
1
Deterministic Finite Automata So a
DFA is mathematically represented as a 5-uple (Q, Σ, δ,
q0, F )
The transition function δ is a function in
Q × Σ → Q
Q × Σ is the set of 2-tuples (q, a) with q ∈ Q and a ∈ Σ
2
Deterministic Finite Automata
How to present a DFA? With a transition table
→q0
0
q2
1
q
0
∗q1 q1 q1
q2 q2 q1
0 1
The → indicates the start state: here q0
The ∗ indicates the final state(s) (here only one final state q1)
This defines the following transition diagram
1 0
q0 q2 q1 0,1
3
Deterministic Finite Automata
For this example
Q = {q0, q1, q2}
start state q0 F = {q1}
Σ = {0, 1}
δ is a function from Q × Σ to Q
δ : Q × Σ → Q
δ(q0, 1) = q0 δ(q0, 0) = q2
4
Example: password
When does the automaton accepts a word??
It reads the word and accepts it if it stops in an accepting state
ƒ=t ƒ=h
q0
t q1
h q2
e
ƒ=e
n
ƒ=n
q3 q4
q5
Only the word then is accepted
Here Q = {q0, q1, q2, q3, q4} Σ is the set of all
characters F = {q4}
We have a “stop” or “dead” state q5, not accepting
5
How a DFA Processes Strings
Let us build an automaton that accepts the words that contain 01
as a subword
Σ = {0, 1}
L = {x01y | x, y ∈ Σ∗
}
We use the following states A: start
B: the most recent input was 1 (but not 01 yet)
C: the most recent input was 0 (so if we get a 1 next we should go
to the accepting state D)
D: we have encountered 01 (accepting state)
6
We get the following automaton
A
1
B
0
1
0 1
0
C D 0,1
Transition table
0 1
→A C B
B.C B
C.C D
∗D D D
Q = {A,B,C,D}, Σ = {0,1}, start state A, final state(s) {D}
7
Extending the Transition Function to Strings
In the previous example, what happens if we get 011? 100? 10101?
We define δˆ(q, x) by induction
δˆ : Q × Σ∗ → Q
BASIS δˆ(q, s) = q for |x| = 0
INDUCTION suppose x = ay (y is a string, a is a symbol)
δˆ(q, ay) = δˆ(δ(q, a), y)
Notice that if x = a we have
δˆ(q, a) = δ(q, a) since a = as and δˆ(δ(q, a), s) = δ(q, a)
8
Extending the Transition Function to Strings
δˆ : Q × Σ∗
→ Q
We write q.x instead of δˆ(q, x)
We can now define mathematically the language accepted by a
given automaton Q, Σ, δ, q0, F
L = {x ∈ Σ∗ | q0.x ∈ F }
On the previous example 100 is not accepted and 10101 is accepted
9
Minimalisation
A
1 0 1
B C
0
The same language may be represented by different DFA
1
0
D 0,1
A
and
1
0 1
0
B C 0,1
10
Minimalisation
Later in the course we shall show that there is only one machine
with the minimum number of states (up to renaming of states)
Furthermore, there is a (clever) algorithm which can find this
minimal automaton given an automaton for a language
11
Example
Mn the “cyclic” automaton with n states on Σ = {1} such that
L(Mn) = {1l
| n divides l}
12
Functional representation: Version 1
Q = A|B|C and E = 0|1 and W = [E]
One function next : Q × E → Q next (A, 1) = A, next
(A, 0) = B
next (B, 1) = C, next (B, 0) = B next (C, b) = C
One function run : Q × W → Q
run (q, b : x) = run (next (q, b), x), run (q, []) = q accept x
= final (run (A, x)) where
final A = final B = False, final C = True
13
Functional representation: Version 2
E = 0|1, W = [E]
Three functions FA, FB, FC : W → Bool
FA (1 : x) = FA x,
FB (1 : x) = FC x,
FC (1 : x) = FC x,
FA (0 : x) = FB FB
(0 : x) = FB FC (0
: x) = FC
x, FA [] = False
x, FB [] = False
x, FC [] = True
We have a mutual recursive definition of 3 functions
14
Functional representation: Version 3
data Q = A | B |
C
data E = O | I
next :: Q -> E -> Q next A
I = A
next A O = B next B I = C next B O
= B next C _ = C
run :: Q -> [E] -> Q
run q (b:x) = run (next q
b) x run q [] = q
15
Functional representation: Version 3
accept :: [E] -> Bool
accept x = final (run A x)
final :: Q -> Bool final
A = False final B
= False final C =
True
16
Functional representation: Version 4
We have
Q ->
E
->
Q
~ Q x E ->
Q
~ E -> (Q -> Q)
17
Functional representation: Version 4
data Q = A | B |
C
data E = O | I
next :: E -> Q -> Q next I
A = A
next O A = B next I B = C next O B
= B next _ C = C
run :: Q -> [E] -> Q
run q (b:x) = run (next b
q) x run q [] = q
18
Functional representation: Version 4
-- run q [b1,...,bn] is
-- next bn (next b(n-1) (... (next
b1 q)...))
-- run = foldl next
19
A proof by induction
A very important result, quite intuitive, is the following.
Theorem: for any state q and any word x and y we have
q.(xy) = (q.x).y
Proof by induction on x. We prove that: for all q we have
q.(xy) = (q.x).y (notice that y is fixed)
Basis: x = s then q.(xy) = q.y = (q.x).y
Induction step: we have x = az and we assume qr
.(zy) = (qr
.z).y
for all qr
20
The other definition of δˆ
Recall that a(b(cd)) = ((ab)c)d; we have two descriptions of words
We define δˆr
(q, s) = q and
δˆr(q, xa) = δ(δˆr(q, x), a)
Theorem: We have q.x = δˆ(q, x) = δˆr(q, x) for all x
21
The other definition of δˆ
Indeed we have proved
q.s = q and q.(xy) = (q.x).y
As a special case we have q.(xa) = (q.x).a
This means that we have two functions f (x) = q.x and
g(x) = δˆr
(q, x) which satisfy
f (s) = g(s) = q and
f (xa) = f (x).a g(xa) = g(x).a
Hence f (x) = g(x) for all x that is q.x = δˆr
(q, x)
22
Automatic Theorem Proving
f (0) = h(0) = 0, g(0) = 1
f (n + 1) = g(n), g(n + 1) = f (n), h(n +
1) = 1 − h(n)
We have f (n) = h(n)
We can prove this automatically using
DFA
23
Automatic Theorem Proving
We have 8 states: Q = {0, 1} × {0, 1} × {0, 1}
We have only one action Σ = {1} and δ((a, b, c), s) = (b, a, 1 − c) The
initial state is (0, 1, 0) = (f (0), g(0), h(0))
Then we have (0, 1, 0).1n = (f (n), g(n), h(n))
We check that all accessible states satisfy a = c (that is, the
property a = c is an invariant for each transition of the automata)
24
Automatic Theorem Proving
A more complex example
f (0) = 0
f (2) = 1
f (1) = 1 f (n + 2) = f (n)+ f (n + 1) − f (n)f (n + 1)
f (3) = 0 f (4) = 1 f (5) = 1. . .
Show that f (n + 3) = f (n) by using Q = {0, 1} × {0, 1} × {0, 1} and
the transition function (a, b, c) −→ (b, c, b + c − bc) with the initial
state (0, 1, 1)
25
Product of automata How do we represent interaction
between machines? This is via the product operation
There are different kind of products
We may then have combinatorial explosion: the product of n
automata with 2 states has 2n
states!
26
Product of automata (example)
The product of
p0
A B
p0
p1 p1 and
C
p1
p0 D
p1
p0 is A, C
p0
p1
B, C
p0
p1
A, D
p1
B, D
p0
p1
p0
If we start from A, C and after the word w we are in the
state A,D we know that w contains an even number of
p0s and odd number of p1s
27
Product of automata (example)
Model of a system of users that have three states I(dle),
R(equesting) and U(sing). We have two users for k = 1 or k = 2
Each user is represented by a simple automaton
rk
ik
uk
28
Product of automata (example)
The complete system is represented by the product of these two
automata; it has 3 × 3 = 9 states
i1, i2 r1, i2 u1, i2
i1, r2 r1, r2 u1, r2
i1, u2 r1, u2 u1, u2
29
The Product Construction
Given A1 = (Q1, Σ, δ1, q1, F1) and A2 = (Q2, Σ, δ2, q2, F2) two DFAs
with the same alphabet Σ we can define the product A = A1 × A2
set of state Q = Q1 × Q2
transition function (r1, r2).a = (r1.a, r2.a) intial state q0 = (q1, q2)
accepting states F = F1 × F2
30
The Product Construction
Lemma: (r1, r2).x = (r1.x, r2.x) We prove this by induction
BASE: the statement holds for x = s
STEP: if the statement holds for y it holds for x = ya
31
The Product Construction
Theorem: L(A1 × A2) = L(A1) ∩ L(A2)
Proof: We have (q1, q2).x = (q1.x, q2.x) in F iff q1.x ∈ F1 and
q2.x ∈ F2, that is x ∈ L(A1) and x ∈ L(A2)
Example: let Mk be the “cyclic” automaton that recognizes
multiple of k, such that L(Mk) = {an | k divides n}, then M6 × M9 c
M18
Notice that 6 divides k and 9 divides k iff 18 divides k
32
Product of automata
It can be quite difficult to build automata directly for the intersection
of two regular languages
Example: build a DFA for the language that contains the subword
ab twice and an even number of a’s
33
Variation on the product
We define A1 ⊕ A2 as A1 × A2 but we change the notion of
accepting state
(r1, r2) accepting iff r1 ∈ F1 or r2 ∈ F2
Theorem: If A1 and A2 are DFAs, then
L(A1 ⊕ A2) = L(A1) ∪ L(A2)
Example: multiples of 3 or of 5 by taking M3 ⊕ M5
34
Complement
If A = (Q, Σ, δ, q0, F ) we define the complement A¯ of A as the
automaton
A¯ = (Q, Σ, δ, q0, Q − F )
Theorem: If A is a DFA, then L(A¯) = Σ∗ − L(A)
Remark: We have A ⊕ Ar
= A × Ar
35
Languages
Given an alphabet Σ
A language is simply a subset of Σ∗
Common languages, programming languages, can be seen as sets
of words
Definition: A language L ⊆ Σ∗ is regular iff there exists a
DFA
A, on the same alphabet Σ such that L = L(A)
Theorem: If L1, L2 are regular then so are
L1 ∩ L2, L1 ∪ L2, Σ∗ − L1
36
Remark: Accessible Part of a DFA
q0
0
1
1q1 q2
Consider the following DFA
0 0
q3
0
0
1
q0
it is clear that it accepts the same language as the DFA
0
q1
0
1
1
which is the accessible part of the DFA
The remaining states are not accessible from the start state and
can be removed
37
Remark: Accessible Part of a DFA
The set
Acc = {q0.x | x ∈ Σ∗
}
is the set of accessible states of the DFA (states that are accessible
from the state q0)
38
Remark: Accessible Part of a DFA
Proposition: If A = (Q, Σ, δ, q0, F ) is a DFA then and
Ar = (Q ∩ Acc, Σ, δ, q0, F ∩ Acc) is a DFA such that L(A) = L(Ar).
Proof: It is clear that Ar is well defined and that L(Ar) ⊆ L(A). If x ∈
L(A) then we have q0.x ∈ F and also q0.x ∈ Acc. Hence
q0.x ∈ F ∩ Acc and x ∈ L(Ar).
39
Automatic Theorem Proving
Take Σ = {a, b}.
Define L set of x ∈ Σ∗
such that any a in x is followed by a b Define Lr
set of x ∈ Σ∗
such that any b in x is followed by a a Then L ∩ Lr = {s}
Intuitively if x ƒ= s in L we have
. . . a . . . → . . . a . . . b . . .
if x in Lr
we have
. . . b . . . → . . . b . . . a . . .
40
Automatic Theorem Proving
We should have L ∩ Lr
= {s} since a nonempty word in L ∩ Lr
should be infinite
We can prove this automatically with automata!
L is regular: write a DFA A for L Lr
is regular: write a DFA Ar
for
L
We can then compute A × Ar and check that
L ∩ Lr
= L(A × Ar
) = {s}
41
Application: control system
We have several machines working concurrently
We need to forbid some sequence of actions. For instance, if we
have two machines MA and MB, we may want to say that MB
cannot be on when MA is on. The alphabets will contain: onA,
offA, onB, offB
Between onA, on2 there should be at least one offA The
automaton expressing this condition is
onA
p0 p1
offA
ƒ=onA,onB ƒ=onB,offA
onB offB
p3
onA
onB
p2
42
Application: control system
onA
What is interesting is that we can use the product construction to
combine several conditions
For instance, another condition maybe that onA should appear
before onB appear. One automaton representing this condition is
ƒ=onA,onB
q0 q1
onB
q2
We can take the product of the two
automata to express the two
conditions as one automaton, which
may represent the control system
43

More Related Content

What's hot

Merge sort analysis and its real time applications
Merge sort analysis and its real time applicationsMerge sort analysis and its real time applications
Merge sort analysis and its real time applicationsyazad dumasia
 
Master method
Master method Master method
Master method Rajendran
 
Regular Languages
Regular LanguagesRegular Languages
Regular Languagesparmeet834
 
Lecture 1,2
Lecture 1,2Lecture 1,2
Lecture 1,2shah zeb
 
Theory of Automata
Theory of AutomataTheory of Automata
Theory of AutomataFarooq Mian
 
Theory of automata and formal language
Theory of automata and formal languageTheory of automata and formal language
Theory of automata and formal languageRabia Khalid
 
Poset in Relations(Discrete Mathematics)
Poset in Relations(Discrete Mathematics)Poset in Relations(Discrete Mathematics)
Poset in Relations(Discrete Mathematics)Rachana Pathak
 
Theory of Automata Lesson 02
Theory of Automata Lesson 02Theory of Automata Lesson 02
Theory of Automata Lesson 02hamzamughal39
 
simple problem to convert NFA with epsilon to without epsilon
simple problem to convert NFA with epsilon to without epsilonsimple problem to convert NFA with epsilon to without epsilon
simple problem to convert NFA with epsilon to without epsilonkanikkk
 
Theory of automata and formal languages Unit 4
Theory of automata and formal languages Unit 4Theory of automata and formal languages Unit 4
Theory of automata and formal languages Unit 4Abhimanyu Mishra
 
2.8 normal forms gnf & problems
2.8 normal forms   gnf & problems2.8 normal forms   gnf & problems
2.8 normal forms gnf & problemsSampath Kumar S
 
SINGLE SOURCE SHORTEST PATH.ppt
SINGLE SOURCE SHORTEST PATH.pptSINGLE SOURCE SHORTEST PATH.ppt
SINGLE SOURCE SHORTEST PATH.pptshanthishyam
 

What's hot (20)

Merge sort analysis and its real time applications
Merge sort analysis and its real time applicationsMerge sort analysis and its real time applications
Merge sort analysis and its real time applications
 
TOC 3 | Different Operations on DFA
TOC 3 | Different Operations on DFATOC 3 | Different Operations on DFA
TOC 3 | Different Operations on DFA
 
Master method
Master method Master method
Master method
 
Regular Languages
Regular LanguagesRegular Languages
Regular Languages
 
Lecture 1,2
Lecture 1,2Lecture 1,2
Lecture 1,2
 
Theory of Automata
Theory of AutomataTheory of Automata
Theory of Automata
 
Theory of automata and formal language
Theory of automata and formal languageTheory of automata and formal language
Theory of automata and formal language
 
Generating function
Generating functionGenerating function
Generating function
 
Poset in Relations(Discrete Mathematics)
Poset in Relations(Discrete Mathematics)Poset in Relations(Discrete Mathematics)
Poset in Relations(Discrete Mathematics)
 
Crisp sets
Crisp setsCrisp sets
Crisp sets
 
Beta gamma functions
Beta gamma functionsBeta gamma functions
Beta gamma functions
 
Theory of Automata Lesson 02
Theory of Automata Lesson 02Theory of Automata Lesson 02
Theory of Automata Lesson 02
 
Automata theory
Automata theoryAutomata theory
Automata theory
 
simple problem to convert NFA with epsilon to without epsilon
simple problem to convert NFA with epsilon to without epsilonsimple problem to convert NFA with epsilon to without epsilon
simple problem to convert NFA with epsilon to without epsilon
 
Regular Grammar
Regular GrammarRegular Grammar
Regular Grammar
 
Theory of automata and formal languages Unit 4
Theory of automata and formal languages Unit 4Theory of automata and formal languages Unit 4
Theory of automata and formal languages Unit 4
 
Context free grammar
Context free grammarContext free grammar
Context free grammar
 
2.8 normal forms gnf & problems
2.8 normal forms   gnf & problems2.8 normal forms   gnf & problems
2.8 normal forms gnf & problems
 
Crisp set
Crisp setCrisp set
Crisp set
 
SINGLE SOURCE SHORTEST PATH.ppt
SINGLE SOURCE SHORTEST PATH.pptSINGLE SOURCE SHORTEST PATH.ppt
SINGLE SOURCE SHORTEST PATH.ppt
 

Similar to Dfa h11

Deterministic finite automata
Deterministic finite automata Deterministic finite automata
Deterministic finite automata Muhammad Love Kian
 
6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdf6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdfshruti533256
 
Chapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfChapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfdawod yimer
 
Mid semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Mid semexam | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurMid semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Mid semexam | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurVivekananda Samiti
 
Theoryofcomp science
Theoryofcomp scienceTheoryofcomp science
Theoryofcomp scienceRaghu nath
 
Automata theory introduction
Automata theory introductionAutomata theory introduction
Automata theory introductionNAMRATA BORKAR
 
Probability cheatsheet
Probability cheatsheetProbability cheatsheet
Probability cheatsheetSuvrat Mishra
 
Code of the multidimensional fractional pseudo-Newton method using recursive ...
Code of the multidimensional fractional pseudo-Newton method using recursive ...Code of the multidimensional fractional pseudo-Newton method using recursive ...
Code of the multidimensional fractional pseudo-Newton method using recursive ...mathsjournal
 
Code of the multidimensional fractional pseudo-Newton method using recursive ...
Code of the multidimensional fractional pseudo-Newton method using recursive ...Code of the multidimensional fractional pseudo-Newton method using recursive ...
Code of the multidimensional fractional pseudo-Newton method using recursive ...mathsjournal
 
Formal Languages and Automata Theory Unit 1
Formal Languages and Automata Theory Unit 1Formal Languages and Automata Theory Unit 1
Formal Languages and Automata Theory Unit 1Srimatre K
 
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
 
lecture 10 formal methods in software enginnering.pptx
lecture 10 formal methods in software enginnering.pptxlecture 10 formal methods in software enginnering.pptx
lecture 10 formal methods in software enginnering.pptxSohaibAlviWebster
 
Automata
AutomataAutomata
AutomataGaditek
 
Automata
AutomataAutomata
AutomataGaditek
 

Similar to Dfa h11 (20)

Teori automata lengkap
Teori automata lengkapTeori automata lengkap
Teori automata lengkap
 
Deterministic finite automata
Deterministic finite automata Deterministic finite automata
Deterministic finite automata
 
O2
O2O2
O2
 
6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdf6-Nfa & equivalence with RE.pdf
6-Nfa & equivalence with RE.pdf
 
Chapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfChapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdf
 
Mid semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Mid semexam | Theory of Computation | Akash Anand | MTH 401A | IIT KanpurMid semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
Mid semexam | Theory of Computation | Akash Anand | MTH 401A | IIT Kanpur
 
Finite automata
Finite automataFinite automata
Finite automata
 
Theoryofcomp science
Theoryofcomp scienceTheoryofcomp science
Theoryofcomp science
 
Automata theory introduction
Automata theory introductionAutomata theory introduction
Automata theory introduction
 
Probability cheatsheet
Probability cheatsheetProbability cheatsheet
Probability cheatsheet
 
Code of the multidimensional fractional pseudo-Newton method using recursive ...
Code of the multidimensional fractional pseudo-Newton method using recursive ...Code of the multidimensional fractional pseudo-Newton method using recursive ...
Code of the multidimensional fractional pseudo-Newton method using recursive ...
 
Code of the multidimensional fractional pseudo-Newton method using recursive ...
Code of the multidimensional fractional pseudo-Newton method using recursive ...Code of the multidimensional fractional pseudo-Newton method using recursive ...
Code of the multidimensional fractional pseudo-Newton method using recursive ...
 
Formal Languages and Automata Theory Unit 1
Formal Languages and Automata Theory Unit 1Formal Languages and Automata Theory Unit 1
Formal Languages and Automata Theory Unit 1
 
Probability Cheatsheet.pdf
Probability Cheatsheet.pdfProbability Cheatsheet.pdf
Probability Cheatsheet.pdf
 
Dfa
DfaDfa
Dfa
 
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
 
lecture 10 formal methods in software enginnering.pptx
lecture 10 formal methods in software enginnering.pptxlecture 10 formal methods in software enginnering.pptx
lecture 10 formal methods in software enginnering.pptx
 
Microeconomics-Help-Experts.pptx
Microeconomics-Help-Experts.pptxMicroeconomics-Help-Experts.pptx
Microeconomics-Help-Experts.pptx
 
Automata
AutomataAutomata
Automata
 
Automata
AutomataAutomata
Automata
 

More from Rajendran

Element distinctness lower bounds
Element distinctness lower boundsElement distinctness lower bounds
Element distinctness lower boundsRajendran
 
Scheduling with Startup and Holding Costs
Scheduling with Startup and Holding CostsScheduling with Startup and Holding Costs
Scheduling with Startup and Holding CostsRajendran
 
Divide and conquer surfing lower bounds
Divide and conquer  surfing lower boundsDivide and conquer  surfing lower bounds
Divide and conquer surfing lower boundsRajendran
 
Red black tree
Red black treeRed black tree
Red black treeRajendran
 
Medians and order statistics
Medians and order statisticsMedians and order statistics
Medians and order statisticsRajendran
 
Proof master theorem
Proof master theoremProof master theorem
Proof master theoremRajendran
 
Recursion tree method
Recursion tree methodRecursion tree method
Recursion tree methodRajendran
 
Recurrence theorem
Recurrence theoremRecurrence theorem
Recurrence theoremRajendran
 
Master method theorem
Master method theoremMaster method theorem
Master method theoremRajendran
 
Master method theorem
Master method theoremMaster method theorem
Master method theoremRajendran
 
Greedy algorithms
Greedy algorithmsGreedy algorithms
Greedy algorithmsRajendran
 
Longest common subsequences in Algorithm Analysis
Longest common subsequences in Algorithm AnalysisLongest common subsequences in Algorithm Analysis
Longest common subsequences in Algorithm AnalysisRajendran
 
Dynamic programming in Algorithm Analysis
Dynamic programming in Algorithm AnalysisDynamic programming in Algorithm Analysis
Dynamic programming in Algorithm AnalysisRajendran
 
Average case Analysis of Quicksort
Average case Analysis of QuicksortAverage case Analysis of Quicksort
Average case Analysis of QuicksortRajendran
 
Np completeness
Np completenessNp completeness
Np completenessRajendran
 
computer languages
computer languagescomputer languages
computer languagesRajendran
 
proving non-computability
proving non-computabilityproving non-computability
proving non-computabilityRajendran
 

More from Rajendran (20)

Element distinctness lower bounds
Element distinctness lower boundsElement distinctness lower bounds
Element distinctness lower bounds
 
Scheduling with Startup and Holding Costs
Scheduling with Startup and Holding CostsScheduling with Startup and Holding Costs
Scheduling with Startup and Holding Costs
 
Divide and conquer surfing lower bounds
Divide and conquer  surfing lower boundsDivide and conquer  surfing lower bounds
Divide and conquer surfing lower bounds
 
Red black tree
Red black treeRed black tree
Red black tree
 
Hash table
Hash tableHash table
Hash table
 
Medians and order statistics
Medians and order statisticsMedians and order statistics
Medians and order statistics
 
Proof master theorem
Proof master theoremProof master theorem
Proof master theorem
 
Recursion tree method
Recursion tree methodRecursion tree method
Recursion tree method
 
Recurrence theorem
Recurrence theoremRecurrence theorem
Recurrence theorem
 
Master method theorem
Master method theoremMaster method theorem
Master method theorem
 
Hash tables
Hash tablesHash tables
Hash tables
 
Lower bound
Lower boundLower bound
Lower bound
 
Master method theorem
Master method theoremMaster method theorem
Master method theorem
 
Greedy algorithms
Greedy algorithmsGreedy algorithms
Greedy algorithms
 
Longest common subsequences in Algorithm Analysis
Longest common subsequences in Algorithm AnalysisLongest common subsequences in Algorithm Analysis
Longest common subsequences in Algorithm Analysis
 
Dynamic programming in Algorithm Analysis
Dynamic programming in Algorithm AnalysisDynamic programming in Algorithm Analysis
Dynamic programming in Algorithm Analysis
 
Average case Analysis of Quicksort
Average case Analysis of QuicksortAverage case Analysis of Quicksort
Average case Analysis of Quicksort
 
Np completeness
Np completenessNp completeness
Np completeness
 
computer languages
computer languagescomputer languages
computer languages
 
proving non-computability
proving non-computabilityproving non-computability
proving non-computability
 

Recently uploaded

Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 

Recently uploaded (20)

Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 

Dfa h11

  • 1. Deterministic Finite Automata Definition: A deterministic finite automaton (DFA) consists of 1.a finite set of states (often denoted Q) 2.a finite set Σ of symbols (alphabet) 3.a transition function that takes as argument a state and a symbol and returns a state (often denoted δ) 4.a start state often denoted q0 5.a set of final or accepting states (often denoted F ) We have q0 ∈ Q and F ⊆ Q 1
  • 2. Deterministic Finite Automata So a DFA is mathematically represented as a 5-uple (Q, Σ, δ, q0, F ) The transition function δ is a function in Q × Σ → Q Q × Σ is the set of 2-tuples (q, a) with q ∈ Q and a ∈ Σ 2
  • 3. Deterministic Finite Automata How to present a DFA? With a transition table →q0 0 q2 1 q 0 ∗q1 q1 q1 q2 q2 q1 0 1 The → indicates the start state: here q0 The ∗ indicates the final state(s) (here only one final state q1) This defines the following transition diagram 1 0 q0 q2 q1 0,1 3
  • 4. Deterministic Finite Automata For this example Q = {q0, q1, q2} start state q0 F = {q1} Σ = {0, 1} δ is a function from Q × Σ to Q δ : Q × Σ → Q δ(q0, 1) = q0 δ(q0, 0) = q2 4
  • 5. Example: password When does the automaton accepts a word?? It reads the word and accepts it if it stops in an accepting state ƒ=t ƒ=h q0 t q1 h q2 e ƒ=e n ƒ=n q3 q4 q5 Only the word then is accepted Here Q = {q0, q1, q2, q3, q4} Σ is the set of all characters F = {q4} We have a “stop” or “dead” state q5, not accepting 5
  • 6. How a DFA Processes Strings Let us build an automaton that accepts the words that contain 01 as a subword Σ = {0, 1} L = {x01y | x, y ∈ Σ∗ } We use the following states A: start B: the most recent input was 1 (but not 01 yet) C: the most recent input was 0 (so if we get a 1 next we should go to the accepting state D) D: we have encountered 01 (accepting state) 6
  • 7. We get the following automaton A 1 B 0 1 0 1 0 C D 0,1 Transition table 0 1 →A C B B.C B C.C D ∗D D D Q = {A,B,C,D}, Σ = {0,1}, start state A, final state(s) {D} 7
  • 8. Extending the Transition Function to Strings In the previous example, what happens if we get 011? 100? 10101? We define δˆ(q, x) by induction δˆ : Q × Σ∗ → Q BASIS δˆ(q, s) = q for |x| = 0 INDUCTION suppose x = ay (y is a string, a is a symbol) δˆ(q, ay) = δˆ(δ(q, a), y) Notice that if x = a we have δˆ(q, a) = δ(q, a) since a = as and δˆ(δ(q, a), s) = δ(q, a) 8
  • 9. Extending the Transition Function to Strings δˆ : Q × Σ∗ → Q We write q.x instead of δˆ(q, x) We can now define mathematically the language accepted by a given automaton Q, Σ, δ, q0, F L = {x ∈ Σ∗ | q0.x ∈ F } On the previous example 100 is not accepted and 10101 is accepted 9
  • 10. Minimalisation A 1 0 1 B C 0 The same language may be represented by different DFA 1 0 D 0,1 A and 1 0 1 0 B C 0,1 10
  • 11. Minimalisation Later in the course we shall show that there is only one machine with the minimum number of states (up to renaming of states) Furthermore, there is a (clever) algorithm which can find this minimal automaton given an automaton for a language 11
  • 12. Example Mn the “cyclic” automaton with n states on Σ = {1} such that L(Mn) = {1l | n divides l} 12
  • 13. Functional representation: Version 1 Q = A|B|C and E = 0|1 and W = [E] One function next : Q × E → Q next (A, 1) = A, next (A, 0) = B next (B, 1) = C, next (B, 0) = B next (C, b) = C One function run : Q × W → Q run (q, b : x) = run (next (q, b), x), run (q, []) = q accept x = final (run (A, x)) where final A = final B = False, final C = True 13
  • 14. Functional representation: Version 2 E = 0|1, W = [E] Three functions FA, FB, FC : W → Bool FA (1 : x) = FA x, FB (1 : x) = FC x, FC (1 : x) = FC x, FA (0 : x) = FB FB (0 : x) = FB FC (0 : x) = FC x, FA [] = False x, FB [] = False x, FC [] = True We have a mutual recursive definition of 3 functions 14
  • 15. Functional representation: Version 3 data Q = A | B | C data E = O | I next :: Q -> E -> Q next A I = A next A O = B next B I = C next B O = B next C _ = C run :: Q -> [E] -> Q run q (b:x) = run (next q b) x run q [] = q 15
  • 16. Functional representation: Version 3 accept :: [E] -> Bool accept x = final (run A x) final :: Q -> Bool final A = False final B = False final C = True 16
  • 17. Functional representation: Version 4 We have Q -> E -> Q ~ Q x E -> Q ~ E -> (Q -> Q) 17
  • 18. Functional representation: Version 4 data Q = A | B | C data E = O | I next :: E -> Q -> Q next I A = A next O A = B next I B = C next O B = B next _ C = C run :: Q -> [E] -> Q run q (b:x) = run (next b q) x run q [] = q 18
  • 19. Functional representation: Version 4 -- run q [b1,...,bn] is -- next bn (next b(n-1) (... (next b1 q)...)) -- run = foldl next 19
  • 20. A proof by induction A very important result, quite intuitive, is the following. Theorem: for any state q and any word x and y we have q.(xy) = (q.x).y Proof by induction on x. We prove that: for all q we have q.(xy) = (q.x).y (notice that y is fixed) Basis: x = s then q.(xy) = q.y = (q.x).y Induction step: we have x = az and we assume qr .(zy) = (qr .z).y for all qr 20
  • 21. The other definition of δˆ Recall that a(b(cd)) = ((ab)c)d; we have two descriptions of words We define δˆr (q, s) = q and δˆr(q, xa) = δ(δˆr(q, x), a) Theorem: We have q.x = δˆ(q, x) = δˆr(q, x) for all x 21
  • 22. The other definition of δˆ Indeed we have proved q.s = q and q.(xy) = (q.x).y As a special case we have q.(xa) = (q.x).a This means that we have two functions f (x) = q.x and g(x) = δˆr (q, x) which satisfy f (s) = g(s) = q and f (xa) = f (x).a g(xa) = g(x).a Hence f (x) = g(x) for all x that is q.x = δˆr (q, x) 22
  • 23. Automatic Theorem Proving f (0) = h(0) = 0, g(0) = 1 f (n + 1) = g(n), g(n + 1) = f (n), h(n + 1) = 1 − h(n) We have f (n) = h(n) We can prove this automatically using DFA 23
  • 24. Automatic Theorem Proving We have 8 states: Q = {0, 1} × {0, 1} × {0, 1} We have only one action Σ = {1} and δ((a, b, c), s) = (b, a, 1 − c) The initial state is (0, 1, 0) = (f (0), g(0), h(0)) Then we have (0, 1, 0).1n = (f (n), g(n), h(n)) We check that all accessible states satisfy a = c (that is, the property a = c is an invariant for each transition of the automata) 24
  • 25. Automatic Theorem Proving A more complex example f (0) = 0 f (2) = 1 f (1) = 1 f (n + 2) = f (n)+ f (n + 1) − f (n)f (n + 1) f (3) = 0 f (4) = 1 f (5) = 1. . . Show that f (n + 3) = f (n) by using Q = {0, 1} × {0, 1} × {0, 1} and the transition function (a, b, c) −→ (b, c, b + c − bc) with the initial state (0, 1, 1) 25
  • 26. Product of automata How do we represent interaction between machines? This is via the product operation There are different kind of products We may then have combinatorial explosion: the product of n automata with 2 states has 2n states! 26
  • 27. Product of automata (example) The product of p0 A B p0 p1 p1 and C p1 p0 D p1 p0 is A, C p0 p1 B, C p0 p1 A, D p1 B, D p0 p1 p0 If we start from A, C and after the word w we are in the state A,D we know that w contains an even number of p0s and odd number of p1s 27
  • 28. Product of automata (example) Model of a system of users that have three states I(dle), R(equesting) and U(sing). We have two users for k = 1 or k = 2 Each user is represented by a simple automaton rk ik uk 28
  • 29. Product of automata (example) The complete system is represented by the product of these two automata; it has 3 × 3 = 9 states i1, i2 r1, i2 u1, i2 i1, r2 r1, r2 u1, r2 i1, u2 r1, u2 u1, u2 29
  • 30. The Product Construction Given A1 = (Q1, Σ, δ1, q1, F1) and A2 = (Q2, Σ, δ2, q2, F2) two DFAs with the same alphabet Σ we can define the product A = A1 × A2 set of state Q = Q1 × Q2 transition function (r1, r2).a = (r1.a, r2.a) intial state q0 = (q1, q2) accepting states F = F1 × F2 30
  • 31. The Product Construction Lemma: (r1, r2).x = (r1.x, r2.x) We prove this by induction BASE: the statement holds for x = s STEP: if the statement holds for y it holds for x = ya 31
  • 32. The Product Construction Theorem: L(A1 × A2) = L(A1) ∩ L(A2) Proof: We have (q1, q2).x = (q1.x, q2.x) in F iff q1.x ∈ F1 and q2.x ∈ F2, that is x ∈ L(A1) and x ∈ L(A2) Example: let Mk be the “cyclic” automaton that recognizes multiple of k, such that L(Mk) = {an | k divides n}, then M6 × M9 c M18 Notice that 6 divides k and 9 divides k iff 18 divides k 32
  • 33. Product of automata It can be quite difficult to build automata directly for the intersection of two regular languages Example: build a DFA for the language that contains the subword ab twice and an even number of a’s 33
  • 34. Variation on the product We define A1 ⊕ A2 as A1 × A2 but we change the notion of accepting state (r1, r2) accepting iff r1 ∈ F1 or r2 ∈ F2 Theorem: If A1 and A2 are DFAs, then L(A1 ⊕ A2) = L(A1) ∪ L(A2) Example: multiples of 3 or of 5 by taking M3 ⊕ M5 34
  • 35. Complement If A = (Q, Σ, δ, q0, F ) we define the complement A¯ of A as the automaton A¯ = (Q, Σ, δ, q0, Q − F ) Theorem: If A is a DFA, then L(A¯) = Σ∗ − L(A) Remark: We have A ⊕ Ar = A × Ar 35
  • 36. Languages Given an alphabet Σ A language is simply a subset of Σ∗ Common languages, programming languages, can be seen as sets of words Definition: A language L ⊆ Σ∗ is regular iff there exists a DFA A, on the same alphabet Σ such that L = L(A) Theorem: If L1, L2 are regular then so are L1 ∩ L2, L1 ∪ L2, Σ∗ − L1 36
  • 37. Remark: Accessible Part of a DFA q0 0 1 1q1 q2 Consider the following DFA 0 0 q3 0 0 1 q0 it is clear that it accepts the same language as the DFA 0 q1 0 1 1 which is the accessible part of the DFA The remaining states are not accessible from the start state and can be removed 37
  • 38. Remark: Accessible Part of a DFA The set Acc = {q0.x | x ∈ Σ∗ } is the set of accessible states of the DFA (states that are accessible from the state q0) 38
  • 39. Remark: Accessible Part of a DFA Proposition: If A = (Q, Σ, δ, q0, F ) is a DFA then and Ar = (Q ∩ Acc, Σ, δ, q0, F ∩ Acc) is a DFA such that L(A) = L(Ar). Proof: It is clear that Ar is well defined and that L(Ar) ⊆ L(A). If x ∈ L(A) then we have q0.x ∈ F and also q0.x ∈ Acc. Hence q0.x ∈ F ∩ Acc and x ∈ L(Ar). 39
  • 40. Automatic Theorem Proving Take Σ = {a, b}. Define L set of x ∈ Σ∗ such that any a in x is followed by a b Define Lr set of x ∈ Σ∗ such that any b in x is followed by a a Then L ∩ Lr = {s} Intuitively if x ƒ= s in L we have . . . a . . . → . . . a . . . b . . . if x in Lr we have . . . b . . . → . . . b . . . a . . . 40
  • 41. Automatic Theorem Proving We should have L ∩ Lr = {s} since a nonempty word in L ∩ Lr should be infinite We can prove this automatically with automata! L is regular: write a DFA A for L Lr is regular: write a DFA Ar for L We can then compute A × Ar and check that L ∩ Lr = L(A × Ar ) = {s} 41
  • 42. Application: control system We have several machines working concurrently We need to forbid some sequence of actions. For instance, if we have two machines MA and MB, we may want to say that MB cannot be on when MA is on. The alphabets will contain: onA, offA, onB, offB Between onA, on2 there should be at least one offA The automaton expressing this condition is onA p0 p1 offA ƒ=onA,onB ƒ=onB,offA onB offB p3 onA onB p2 42
  • 43. Application: control system onA What is interesting is that we can use the product construction to combine several conditions For instance, another condition maybe that onA should appear before onB appear. One automaton representing this condition is ƒ=onA,onB q0 q1 onB q2 We can take the product of the two automata to express the two conditions as one automaton, which may represent the control system 43