This is a deterministic finite automaton simulator program. The DFA can recognize regular languages. Unlike nondeterministic finite automata you can go only one way that is why deterministic.
Deterministic Finite automaton can be described by 5 things:
M(Q, Σ, δ, q0, A)
- Q: Finite set of states
- Σ: Finite set of input symbols
- δ: Q × Σ → Q: Transition function
- q0: Initial state
- A: set of accept states
Transition example: If you read 0
symbol you go from s0
state to s1
state, formally: (s0, 0) -> s1
Deterministic automaton can have zero accepting states that mean the accepted language is the language of empty set.
If the initial state is an accepting state the automaton can recognize the empty string.
If the automaton wants to go to an undefined state it creates an exception, if you want to avoid this you should create a dead state
You need to give some information in order to start the machine such as:
- Initial state ex.:
s0
- States ex.:
s1, s2, s3
- Accepting states (optional) ex.:
s1, s2, s3
- Input string ex.:
0001
- Rules: ex.:
s0 1 s1
- State validation
- Rules validation
- Detect nondeterminism
- Transition validation
Initial state: A
State list: A, B, C
Final state: B
Rules:
- A 0 B
- A 1 C
- C 0 C
- C 1 C
- B 0 B
- B 1 B
This DFA accepts languages that start with zero and can contain 0-s, 1-s.
You need to install the following dependencies in order to run the program in your computer:
- matplotlib
- networkx
- tkinter
- customtkinter
Project dependencies after manual dependency installation in PyCharm IDE: