summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2019-06-04 14:05:44 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2019-06-04 14:05:44 +0200
commit9a02751c1e588a5bbb83bb7e543c26486d3079d5 (patch)
tree9a99664e2db9071fd2968b7d67703f884d922913
parent537ac8a2ecb64a141ec8ffc1ab053e84154c4f09 (diff)
downloadincremental-dfsts-9a02751c1e588a5bbb83bb7e543c26486d3079d5.tar
incremental-dfsts-9a02751c1e588a5bbb83bb7e543c26486d3079d5.tar.gz
incremental-dfsts-9a02751c1e588a5bbb83bb7e543c26486d3079d5.tar.bz2
incremental-dfsts-9a02751c1e588a5bbb83bb7e543c26486d3079d5.tar.xz
incremental-dfsts-9a02751c1e588a5bbb83bb7e543c26486d3079d5.zip
Finish example
-rw-r--r--edit-lens/src/Control/DFST/Lens.lhs57
1 files changed, 51 insertions, 6 deletions
diff --git a/edit-lens/src/Control/DFST/Lens.lhs b/edit-lens/src/Control/DFST/Lens.lhs
index ec81113..56f37a0 100644
--- a/edit-lens/src/Control/DFST/Lens.lhs
+++ b/edit-lens/src/Control/DFST/Lens.lhs
@@ -278,7 +278,7 @@ bfs outgoing predicate
278 w^\prime = w = 0\, 1\, \ldots\, 80\, \text{\textbackslash n}\, 81\, \ldots\, 98 278 w^\prime = w = 0\, 1\, \ldots\, 80\, \text{\textbackslash n}\, 81\, \ldots\, 98
279 \end{equation*} 279 \end{equation*}
280 280
281 Das von $e$ betroffene Intervall von $w^\prime$ ist $(80, 80)$. 281 Das von $e^\prime$ betroffene Intervall in $w^\prime$ ist $(80, 80)$.
282 282
283 Das Komplement nach Anwendung des DFST auf $w$ ist, wie in Beispiel \ref{eg:linebreakonw100} dargelegt: 283 Das Komplement nach Anwendung des DFST auf $w$ ist, wie in Beispiel \ref{eg:linebreakonw100} dargelegt:
284 284
@@ -286,21 +286,66 @@ bfs outgoing predicate
286 \text{act} & \colon Q \to \Delta^\star \times \{ \bot \} \cup Q \\ 286 \text{act} & \colon Q \to \Delta^\star \times \{ \bot \} \cup Q \\
287 0 & \mapsto (0\, 1\, \ldots\, 80\, \text{\tt \textbackslash n}\, 81\, \ldots\, 98, 19) \\ 287 0 & \mapsto (0\, 1\, \ldots\, 80\, \text{\tt \textbackslash n}\, 81\, \ldots\, 98, 19) \\
288 1 & \mapsto (0\, 1\, \ldots\, 79\, \text{\tt \textbackslash n}\, 80\, \ldots\, 98, 18) \\ 288 1 & \mapsto (0\, 1\, \ldots\, 79\, \text{\tt \textbackslash n}\, 80\, \ldots\, 98, 18) \\
289 & \vdots 289 & \vdots
290 \end{align*} 290 \end{align*}
291 291
292 Wir unterteilen $\text{act}$ an $(80, 80)$ in $\text{act}_\text{R} \circ \text{act}_e \circ \text{act}_\text{L}$: 292 Wir unterteilen $\text{act}$ an $(80, 80)$ in $\text{act}_\text{R} \circ \text{act}_{e^\prime} \circ \text{act}_\text{L}$:
293 293
294 \begin{align*} 294 \begin{align*}
295 \text{act}_\text{R} & \colon Q \to \Delta^\star \times \{ \bot \} \cup Q \\ 295 \text{act}_\text{R} & \colon Q \to \Delta^\star \times \{ \bot \} \cup Q \\
296 n & \mapsto (81\, \ldots\, 98, \min ( 80, n + 19 ) ) \\ 296 n & \mapsto (81\, \ldots\, 98, \min ( 80, n + 19 ) ) \\
297 & \\ 297 & \\
298 \text{act}_e & \colon Q \to \Delta^\star \times \{ \bot \} \cup Q \\ 298 \text{act}_{e^\prime} & \colon Q \to \Delta^\star \times \{ \bot \} \cup Q \\
299 n & \mapsto ( \text{\tt \textbackslash n}, 0 ) \\ 299 n & \mapsto ( \text{\tt \textbackslash n}, 0 ) \\
300 & \\ 300 & \\
301 \text{act}_\text{L} & \colon Q \to \Delta^\star \times \{ \bot \} \cup Q \\ 301 \text{act}_\text{L} & \colon Q \to \Delta^\star \times \{ \bot \} \cup Q \\
302 \text{other} & \mapsto (\epsilon, \bot) 302 n & \mapsto (0\, 1\, \ldots\, 80, 80) \\
303 \end{align*} 303 \end{align*}
304 304
305 % TODO 305 Wir bestimmen die Zustände des vorherigen Laufs an den Grenzen des von $e^\prime$ betroffenen Intervalls:
306
307 \begin{align*}
308 Q_\text{L} &= 80 \\
309 Q_\text{R} &= 0
310 \end{align*}
311
312 Wir wenden $e^\prime = \rho_{80}$ an auf $\restr{w^\prime}{\text{act}_{e^\prime}} \coloneqq \pi_1 \left ( \text{act}_{e^\prime}(Q_\text{L}) \right ) = \text{\tt \textbackslash n}$, das Teilwort erzeugt vom Komplement-Stück $\text{act}_{e^\prime}$:
313
314 \begin{equation*}
315 \restr{w^\prime}{\text{act}_{e^\prime}} \cdot \rho_{80} = \epsilon
316 \end{equation*}
317
318 Da der DFST aus Beispiel \ref{eg:linebreak} keine Transitionen mit mehr als einem Ausgabe-Zeichen enthält ist in diesem Fall keine explizite Umwandlung in einen FST notwendig.
319 Der Einfachheit wegen lassen wir sie aus.
320
321 Der Wort-FST für das leere Wort hat genau einen Zustand und keine Transitionen.
322 Es hat daher auch das Produkt mit dem DFST aus Beispiel \ref{eg:linebreak} keine Transitionen und nur Zustände der Form $(0, n)$ mit $n \in \{ 0, \ldots, 80 \}$.
323 Wie auch im ursprünglichen DFST sind alle Zustände akzeptierend.
324
325 Wir müssen nun bestimmen welche Zustände, unter $\text{act}_\text{R}$, zu einem akzeptierenden Zustand führen.
326 Da alle Zustände akzeptieren ist hier jeder Zustand geeignet.
327
328 Wir müssen nun (vermöge Breitensuche) den kürzesten Pfad im Produkt-FST zwischen $Q_\text{L}$ und einem der Zustände finden, der unter $\text{act}_\text{R}$ zu einem akzeptierenden Zustand im ursprünglichen transducer führt.
329 Der leere Pfad ist geeignet.
330
331 Die DFST-Wirkung (also das Komplement) des leeren Strings (die Eingabe des leeren Pfads) ist:
332 \begin{align*}
333 \text{act}_0 & \colon Q \to \Delta^\star \times \{ \bot \} \cup Q \\
334 n & \mapsto ( \epsilon, n )
335 \end{align*}
336
337 Mithilfe des Unix Standard-Diff-Algorithmus bestimmen wir $e$ als den minimalen edit, sodass gilt:
338 \begin{equation*}
339 \text{\tt \textbackslash n} \cdot e = \epsilon
340 \end{equation*}
341 Man beachte das $\text{\tt \textbackslash n}$ und $\epsilon$ hierbei die \emph{Eingaben} von $\text{act}_{e^\prime}$ bzw. $\text{act}_0$ sind.
342 Nach Behandlung der Indices ergibt sich $e = \rho_{80}$.
343
344 Als neues Komplement erhalten wir:
345
346 \begin{align*}
347 \text{act}^\prime & \colon Q \to \Delta^\star \times \{ \bot \} \cup Q \\
348 \text{act}^\prime & = \text{act}_R \circ \text{act}_0 \circ \text{act}_L \\
349 n & \mapsto (0\, 1\, \ldots\, 80\, 81\, \ldots\, 98, 80)
350 \end{align*}
306\end{eg} 351\end{eg}