Блог пользователя nor

Автор nor, 16 месяцев назад, По-английски
  • Проголосовать: нравится
  • +171
  • Проголосовать: не нравится

»
16 месяцев назад, # |
Rev. 8   Проголосовать: нравится +19 Проголосовать: не нравится

Statement: Given a DFA $$$D$$$, find a regular expression that accepts the same language as $$$D$$$.

While Kleene's algorithm can be used here, it's generally quite impractical. Consider the DFA from the linked article:

The example in the article has nearly 30 steps involving manually simplifying very long expressions such as

$$$ ((a|b)b^*a | \varepsilon) ((a|b)b^*a | \varepsilon)^* ((a|b)b^*a | \varepsilon)| (a | b) b^* a | \varepsilon = ((a | b) b^* a)^* $$$

One alternative approach to constructing regex from DFA is by solving the linear system:

$$$ \begin{cases} q_0 = a q_0 | b q_1 \\ q_1 = \varepsilon | b q_1 | a q_2 \\ q_2 = (a|b)q_1 \end{cases} $$$

By expressing variables $$$q_0$$$, $$$q_1$$$ and $$$q_2$$$ through one another, we eventually arrive at the equation $$$x = a|bx$$$, where $$$a$$$ and $$$b$$$ are regex. Then, the minimum solution $$$x$$$ is found by iterating this equation (also known as Arden's rule):

$$$ x = a | ba | b^2 x = a | ba | b^2 a | b^3 a | \dots = (\varepsilon | b | b^2 | b^3 | \dots) a = b^* a. $$$

This is similar to how the equation $$$x=a+bx$$$ in real numbers is solved by

$$$ x = \left(\frac{1}{1-b}\right)a = (1+b+b^2+b^3+\dots)a. $$$

So, by substitution we find

$$$ q_1 = \varepsilon | bq_1 | a(a|b)q_1 = \varepsilon | (b|aa|ab)q_1 = (b|aa|ab)^*, $$$

from which we get

$$$ q_0 = a q_0 | b(b|aa|ab)^* = a^*b(b|aa|ab)^*. $$$

So, regex for all states are

$$$ \begin{cases} q_0 = a^*b(b|aa|ab)^*, \\ q_1 = (b|aa|ab)^*, \\ q_2 = (a|b) (b|aa|ab)^*. \end{cases} $$$

Of course, it's still exponential growth in the worst case, but at least it's not as fast as with Kleene's method.

  • »
    »
    16 месяцев назад, # ^ |
    Rev. 2   Проголосовать: нравится +28 Проголосовать: не нравится

    Thanks for the comment! It is indeed similar to the approach in one of the papers mentioned in the TL;DR too.

    A natural generalization is Gaussian elimination, and algorithms similar to it are mentioned for semirings after transforming these problems into systems of linear equations in those papers.

»
16 месяцев назад, # |
  Проголосовать: нравится +26 Проголосовать: не нравится

Could somebody please finally write a blog post about $$$O(n^{3-\varepsilon})$$$ algorithm for APSP...

  • »
    »
    16 месяцев назад, # ^ |
      Проголосовать: нравится +3 Проголосовать: не нравится

    Are there any? Some googling gives this article, and its best is

    $$$ O\left(\frac{n^3}{2^{\Omega(\log n)^{1/2}}}\right). $$$

    Apparently, no $$$O(n^{3-\varepsilon})$$$ was known in 2014 for APSP, and I can't easily find any updates?

  • »
    »
    16 месяцев назад, # ^ |
    Rev. 2   Проголосовать: нравится +19 Проголосовать: не нравится

    It might be surprising for some people to know that there is an $$$O(n^{2 + o(1)})$$$ (probabilistic) algorithm for all pairs min cut — so APMC is probably easier than APSP. I was planning on writing a blog for it, but haven't gotten the time to complete it — the paper is here.

»
16 месяцев назад, # |
  Проголосовать: нравится +36 Проголосовать: не нравится

The most useful thing I know about Floyd-Warshall is described in this blog by bukefala