Deterministic Finite Automata #
This file contains the definition of a Deterministic Finite Automaton (DFA), a state machine which
determines whether a string (implemented as a list over an arbitrary alphabet) is in a regular set
in linear time.
Note that this definition allows for Automaton with infinite states, a Fintype instance must be
supplied for true DFA's.
Implementation notes #
Currently, there are two disjoint sets of simp lemmas: one for DFA.eval, and another for
DFA.evalFrom. You can switch from the former to the latter using simp [eval].
TODO #
- Should we unify these simp sets, such that
evalis rewritten toevalFromautomatically? - Should
mem_acceptsandmem_acceptsFrombe marked@[simp]?
A DFA is a set of states (σ), a transition function from state to state labelled by the
alphabet (step), a starting state (start) and a set of acceptance states (accept).
- step : σ → α → σ
A transition function from state to state labelled by the alphabet.
- start : σ
Starting state.
- accept : Set σ
Set of acceptance states.
Instances For
M.evalFrom s x evaluates M with input x starting from the state s.
Equations
- M.evalFrom s = List.foldl M.step s
Instances For
M.comap f pulls back the alphabet of M along f. In other words, it applies f to the input
before passing it to M.