@@ -307,7 +307,7 @@ fun repairWithGRE(brokenStr: List<Σᐩ>, cfg: CFG): GRE? {
307307 fun nonemptyLevInt (levFSA : FSA ): Int? {
308308 val ap: List <List <List <Int >? >> = levFSA.allPairs
309309 val dp = Array (levFSA.numStates) { Array (levFSA.numStates) { BooleanArray (width) { false } } }
310- levFSA.allIndexedTxs0 (ups, bindex).forEach { (q0, nt, q1) -> dp[q0][q1][nt] = true }
310+ levFSA.allIndexedTxs2 (ups, bindex).forEach { (q0, nt, q1) -> dp[q0][q1][nt] = true }
311311 var minRad = Int .MAX_VALUE
312312 // For pairs (p,q) in topological order
313313 for (dist in 1 .. < dp.size) {
@@ -322,16 +322,16 @@ fun repairWithGRE(brokenStr: List<Σᐩ>, cfg: CFG): GRE? {
322322 for (r in appq)
323323 if (dp[p][r][B ] && dp[r][q][C ]) {
324324 dp[p][q][A ] = true
325+ if (p == 0 && A == startIdx && levFSA.isFinal[q]) {
326+ val (x, y) = levFSA.idsToCoords[q]!!
327+ / ** See final state conditions for [makeExactLevCFL] * /
328+ // The minimum radius such that this final state is included in the L - FSA
329+ minRad = minOf(minRad, (brokenStr.size - x + y).absoluteValue)
330+ if (minRad == 1) return 1
331+ }
325332 break@outerloop
326333 }
327334 }
328- if (p == 0 && A == startIdx && levFSA.isFinal[q] && dp[p][q][A ]) {
329- val (x, y) = levFSA.idsToCoords[q]!!
330- / ** See final state conditions for [makeExactLevCFL] * /
331- // The minimum radius such that this final state is included in the L - FSA
332- minRad = minOf(minRad, (brokenStr.size - x + y).absoluteValue)
333- if (minRad == 1) return 1
334- }
335335 }
336336 }
337337 }
@@ -444,7 +444,7 @@ suspend fun initiateSuspendableRepair(brokenStr: List<Σᐩ>, cfg: CFG): GRE? {
444444 val ap: List <List <List <Int >? >> = levFSA.allPairs
445445 val dp = Array (levFSA.numStates) { Array (levFSA.numStates) { BooleanArray (width) { false } } }
446446
447- levFSA.allIndexedTxs0 (ups, bindex).forEach { (q0, nt, q1) -> dp[q0][q1][nt] = true }
447+ levFSA.allIndexedTxs2 (ups, bindex).forEach { (q0, nt, q1) -> dp[q0][q1][nt] = true }
448448 var minRad: Int = Int .MAX_VALUE
449449
450450 // For pairs (p,q) in topological order
@@ -461,16 +461,16 @@ suspend fun initiateSuspendableRepair(brokenStr: List<Σᐩ>, cfg: CFG): GRE? {
461461 for (r in appq)
462462 if (dp[p][r][B ] && dp[r][q][C ]) {
463463 dp[p][q][A ] = true
464+ if (p == 0 && A == startIdx && levFSA.isFinal[q]) {
465+ val (x, y) = levFSA.idsToCoords[q]!!
466+ / ** See final state conditions for [makeExactLevCFL] * /
467+ // The minimum radius such that this final state is included in the L - FSA
468+ minRad = minOf(minRad, (brokenStr.size - x + y).absoluteValue)
469+ if (minRad == 1) return 1
470+ }
464471 break@outerloop
465472 }
466473 }
467-
468- if (p == 0 && A == startIdx && levFSA.isFinal[q] && dp[p][q][A ]) {
469- val (x, y) = levFSA.idsToCoords[q]!!
470- / ** See final state conditions for [makeExactLevCFL] * /
471- // The minimum radius such that this final state is included in the L - FSA
472- minRad = minOf(minRad, (brokenStr.size - x + y).absoluteValue)
473- }
474474 }
475475 }
476476 }
0 commit comments