Files never leave your device

DFA simulator

Trace a word through a deterministic finite automaton and check acceptance. Your inputs stay on your device.

Set up your task

Ready. Processing stays in this browser.

How to use DFA simulator

Trace a word through a deterministic finite automaton and check acceptance. The pre-filled problem gives you a worked starting point. Compare the response with your own working before trying the self-check below.

  1. Check the example inputs: States, Start state, Accepting states, Transitions (state symbol target), Input word.
  2. Change the inputs for your problem. Results update as you type, so finish entering the values before copying an answer.
  3. Use the working to check an intermediate value or assumption. Then change the example as suggested in the self-check and compare the result.

Supported inputs and limits

Use up to 12 named states, six single-character symbols and 100 transitions. Supply exactly one target per state and alphabet symbol.

How it works

A deterministic finite automaton is a machine with a fixed finite set of states. Reading one symbol moves it to exactly one next state. After the final input symbol, membership depends on whether that final state is marked as accepting.

The trace shows the entire run so it is possible to debug a transition table before proving a language property. A conventional complete DFA needs a transition for every state and alphabet symbol. A rejecting sink with self-loops is useful when a pattern becomes impossible after a particular prefix.

Example

Run the pre-filled example. Its first result is β€œAccepted”.

States
even odd
Start state
even
Accepting states
even
Transitions (state symbol target)
even 0 even
even 1 odd
odd 0 odd
odd 1 even
Input word
101
Accepted
even β€”1β†’ odd β€”0β†’ odd β€”1β†’ even
Final state: even

Questions about DFA simulator

How is the alphabet determined?

It is the set of symbols appearing in your transition rules. Then every listed state must have a target for each of those symbols.

What happens on an empty word?

No transition runs. The machine accepts exactly when the start state is accepting.

Try the word 111 in the example.

It ends in odd and is rejected because there are three ones. A zero would leave the state unchanged.

Related tools

Year 2: Algorithms and theory

Last updated