Skip to content

Commit

Permalink
deduplicate and rebalance
Browse files Browse the repository at this point in the history
  • Loading branch information
breandan committed Mar 24, 2024
1 parent 702998c commit ebb64c4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion latex/splash2024/splash.tex
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@
X \oplus Z &\mapsto \big[[\min(X_s \cup Z_s), \max(X_s \cup Z_s)]\big]_{s \in \Sigma}\\ X \otimes Z &\mapsto \big[[\min(X_s) + \min(Z_s), \max(X_s) + \max(Z_s)]\big]_{s \in \Sigma}
\end{align}

To obtain the full Parikh map of a length-bounded CFG, we abstractly parse the porous string and take the union of all intervals, which subsumes every repair in the Levenshtein ball. Given a specific programming language syntax, $G$, this function can be precomputed and cached for all $v: V$, and small values of $n, d: \mathbb{N}$ for the sake of efficiency, then used to retrieve the Levenshtein-$\langle v, n, d\rangle$ Parikh map for any invalid string $\err\sigma$ of length $n$ in constant time:
To obtain the full Parikh map of a length-bounded CFG, we abstractly parse the porous string and take the union of all intervals, which subsumes every repair in the Levenshtein ball. Given a specific programming language syntax, $G$, this function can be precomputed and cached for all $v: V$, and small values of $n, d: \mathbb{N}$ for the sake of efficiency, then used to retrieve the Levenshtein-$d$ Parikh$\langle v, n\rangle $ map for any invalid string $\err\sigma$ of length $n$ in constant time:

\begin{equation}
\pi(G: \mathcal{G}, v: V, n: \mathbb{N}, d: \mathbb{N}): \Pi = \bigoplus_{\mathclap{i\in [n-d, n+d]}}\pi\bigl(\Lambda^*(\{\_\}^i)\circ v\bigr)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,15 @@ val CFG.unitReachability by cache {
}

val CFG.noNonterminalStubs: CFG by cache {
// try { throw Exception() } catch (e: Exception) { e.printStackTrace() }
println("Disabling nonterminal stubs!")
filter { it.RHS.none { it.isNonterminalStubIn(this) } }.toSet().freeze()
.also { rewriteHistory.put(it, freeze().let { rewriteHistory[it]!! + listOf(it)}) }
.also { it.blocked.addAll(blocked) }
}

val CFG.noEpsilonOrNonterminalStubs: CFG by cache {
// try { throw Exception() } catch (e: Exception) { e.printStackTrace() }
println("Disabling nonterminal stubs!")
filter { it.RHS.none { it.isNonterminalStubIn(this) } }
.filter { "ε" !in it.toString() }.toSet().freeze()
Expand Down

0 comments on commit ebb64c4

Please sign in to comment.