definition
examples
Ex: . Creates a DFA that accepts all strings that contains at least three a’s.
Transition function:
stateDiagram-v2
direction LR
classDef accepting fill:#4CAF50,stroke:#333,stroke-width:2px
classDef start fill:#FFD700,stroke:#333,stroke-width:2px
s1: s1
s2: s2
s3: s3
s4: s4
[*] --> s1
s1 --> s1: b
s1 --> s2: a
s2 --> s2: b
s2 --> s3: a
s3 --> s3: b
s3 --> s4: a
s4 --> s4: a,b
class s4 accepting
class s1 start
if in final string then accept, otherwise reject the string
language.
Language of machine is the set of strings M accepts, such that
Assumption:
Questions
Find DFA such that the following
- ,
- ,
stateDiagram-v2
direction LR
classDef accepting fill:#4CAF50,stroke:#333,stroke-width:2px
classDef start fill:#FFD700,stroke:#333,stroke-width:2px
s0: q0
s1: q1
s2: q2
[*] --> s0
s0 --> s0: b
s0 --> s1: a
s1 --> s0: a
s1 --> s2: b
s2 --> s0: a
s2 --> s1: b
class s2 accepting
class s0 start
stateDiagram-v2
direction LR
classDef accepting fill:#4CAF50,stroke:#333,stroke-width:2px
classDef start fill:#FFD700,stroke:#333,stroke-width:2px
s0: q0
s1: q1
[*] --> s0
s0 --> s1: a,b
s1 --> s0: a,b
class s0 accepting
class s0 start
stateDiagram-v2
direction LR
classDef accepting fill:#4CAF50,stroke:#333,stroke-width:2px
classDef start fill:#FFD700,stroke:#333,stroke-width:2px
classDef dead fill:#ff6b6b,stroke:#333,stroke-width:2px
s0: q0
s1: q1
s2: q2
s3: dead
[*] --> s0
s0 --> s3: 0
s0 --> s1: 1
s1 --> s2: 0
s1 --> s3: 1
s2 --> s2: 0
s2 --> s3: 1
s3 --> s3: 0,1
class s1 accepting
class s0 start
class s3 dead
stateDiagram-v2
direction LR
classDef accepting fill:#4CAF50,stroke:#333,stroke-width:2px
classDef start fill:#FFD700,stroke:#333,stroke-width:2px
s0: q0
s1: q1
s2: q2
s3: q3
[*] --> s0
s0 --> s0: b,c
s0 --> s1: a
s1 --> s0: a,c
s1 --> s2: b
s2 --> s0: a,b
s2 --> s3: c
s3 --> s3: a,b,c
class s3 accepting
class s0 start
stateDiagram-v2
direction LR
classDef accepting fill:#4CAF50,stroke:#333,stroke-width:2px
classDef start fill:#FFD700,stroke:#333,stroke-width:2px
s0: q0
s1: q1
s2: q2
s3: q3
[*] --> s0
s0 --> s0: a,b
s0 --> s1: a
s1 --> s2: b
s1 --> s3: a
s2 --> s0: a,b
s3 --> s0: a,b
class s2 accepting
class s0 start
non-regular.
proof using Pumping Lemma
- assume the language is regular, let be the pumping length.
- Consider string
- any way of diving where and will results y contains only a’
- pumped wouldn’t be in the language q.e.d
stateDiagram-v2
direction LR
classDef accepting fill:#4CAF50,stroke:#333,stroke-width:2px
classDef start fill:#FFD700,stroke:#333,stroke-width:2px
s0: q0
s1: q1
s2: q2
s3: q3
s4: q4
s5: q5
[*] --> s0
s0 --> s0: a,b
s0 --> s1: a
s1 --> s2: a,b
s2 --> s3: a,b
s3 --> s4: a,b
s4 --> s5: a,b
s5 --> s0: a,b
class s5 accepting
class s0 start