Skip to content

Commit c893906

Browse files
quick fix to sllambda PrefixFinder bug
1 parent 2d5915c commit c893906

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

src/main/java/de/learnlib/ralib/ceanalysis/PrefixFinder.java

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,10 @@ public Result analyzeCounterExample(Word<PSymbolInstance> ce) {
107107
RegisterValuation runValuation = run.getValuation(i-1);
108108
ParameterizedSymbol action = symbol.getBaseSymbol();
109109

110-
Expression<Boolean> gHyp = run.getGuard(i, consts);
110+
// Expression<Boolean> gHyp = run.getGuard(i, consts);
111111

112112
for (ShortPrefix u : hyp.getLeaf(loc).getShortPrefixes()) {
113+
Expression<Boolean> gHyp = getHypGuard(run, i, u);
113114
RegisterValuation uValuation = hyp.getRun(u).getValuation(u.size());
114115
SymbolicSuffix v = restrBuilder.constructRestrictedSuffix(run.getPrefix(i-1), run.getSuffix(i-1), u, runValuation, uValuation);
115116
SymbolicSuffix uv = restrBuilder.concretize(v,
@@ -126,9 +127,9 @@ public Result analyzeCounterExample(Word<PSymbolInstance> ce) {
126127
for (Expression<Boolean> gSul : branching.guardSet()) {
127128
for (Mapping<DataValue, DataValue> renaming : uToRunExtendedRenamings) {
128129
renaming.putAll(uToRunRenaming);
129-
gSul = conjunctionWithRestriction(gSul, uv, u, hyp.getRun(u).getValuation(u.size()).keySet(), consts);
130-
if (isGuardSatisfied(gSul, renaming, symbol)) {
131-
Optional<Result> res = checkTransition(run, i, u, action, gHyp, gSul);
130+
Expression<Boolean> gSulConj = conjunctionWithRestriction(gSul, uv, u, hyp.getRun(u).getValuation(u.size()).keySet(), consts);
131+
if (isGuardSatisfied(gSulConj, renaming, symbol)) {
132+
Optional<Result> res = checkTransition(run, i, u, action, gHyp, gSulConj);
132133
if (res.isEmpty()) {
133134
res = checkLocation(run, i, u, action);
134135
}
@@ -473,4 +474,19 @@ private boolean isGuardSatisfied(Expression<Boolean> guard, Mapping<DataValue, D
473474

474475
return solver.isSatisfiable(guardRenamed, mapping);
475476
}
477+
478+
private Expression<Boolean> getHypGuard(RARun run, int i, Word<PSymbolInstance> u) {
479+
RegisterValuation runVal = run.getValuation(i - 1);
480+
RegisterValuation uVal = hyp.getRun(u).getValuation(u.size());
481+
Mapping<DataValue, DataValue> renaming = new Mapping<>();
482+
for (Map.Entry<Register, DataValue> runValEntry : runVal.entrySet()) {
483+
DataValue replace = runValEntry.getValue();
484+
DataValue by = uVal.get(runValEntry.getKey());
485+
renaming.put(replace, by);
486+
}
487+
488+
ReplacingValuesVisitor rvv = new ReplacingValuesVisitor();
489+
Expression<Boolean> guard = run.getGuard(i, consts);
490+
return rvv.apply(guard, renaming);
491+
}
476492
}

0 commit comments

Comments
 (0)