The failure function

Let Q be the set of states of an Aho/Corasick automaton.
Let h: Q -> Q + {fail} denote the failure function.
Let q, q' be states of Q.

The failure function of an Aho/Corasick automaton is defined as follows:

h(q) = q' iff among the states of Q, q' delivers the longest true suffix of path(q)

Example