non-deterministic finite automaton
see also deterministic finite automaton
definition
Σ∗:set of all strings based off Σ
NFAM Q Σ Δ S F =(Q,Σ,Δ,S,F):finite set of states:finite alphabet:Q×Σ→P(Q):Start states,S⊆Q:Final states,F⊆Q
examples
- L(M)={abxba∣x∈Σ∗}
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 --> s1: a
s1 --> s2: b
s2 --> s2: Σ
s2 --> s3: b
s3 --> s4: a
s4 --> [*]
class s4 accepting
class s0 start
- L(M)={yx∣x=00∨x=11∧y∈Σ∗}
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
[*] --> s0
s0 --> s0: 0,1
s0 --> s1: 0
s0 --> s3: 1
s1 --> s2: 0
s3 --> s4: 1
s2 --> [*]
s4 --> [*]
class s2,s4 accepting
class s0 start
epsilon transition
stateDiagram-v2
direction LR
[*] --> s1
s1 --> s2: 1
s2 --> s3: 1
s3 --> s4: ε
s1 --> s4: ε
s1 --> s1: 0
s3 --> s3: 1
Given the following M
stateDiagram-v2
direction LR
[*] --> s1
s1 --> s2: 1
s2 --> s3: 1
s3 --> s4: ε
s1 --> s4: ε
s1 --> s1: 0
s3 --> s3: 1
L(M)={0n1m∣n≥0,m=1 ,x∈Σ∗}