diff --git a/src/main/scala/rules/Evaluator.scala b/src/main/scala/rules/Evaluator.scala index e795ac2c4..cb3fe8713 100644 --- a/src/main/scala/rules/Evaluator.scala +++ b/src/main/scala/rules/Evaluator.scala @@ -294,7 +294,17 @@ object evaluator extends EvaluationRules { val t = v1.decider.appliedFresh("letvar", v1.symbolConverter.toSort(x.typ), s1.relevantQuantifiedVariables) v1.decider.assumeDefinition(t === t0) val newFuncRec = s1.functionRecorder.recordFreshSnapshot(t.applicable.asInstanceOf[Function]) - eval(s1.copy(g = s1.g + (x.localVar, t0), functionRecorder = newFuncRec), e1, pve, v1)(Q) + val possibleTriggersBefore = if (s1.recordPossibleTriggers) s1.possibleTriggers else Map.empty + eval(s1.copy(g = s1.g + (x.localVar, t0), functionRecorder = newFuncRec), e1, pve, v1)((s2, t2, v2) => { + val newPossibleTriggers = if (s2.recordPossibleTriggers) { + val addedTriggers = s2.possibleTriggers -- possibleTriggersBefore.keys + val addedTriggersReplaced = addedTriggers.map(at => at._1.replace(x.localVar, e0) -> at._2) + s2.possibleTriggers ++ addedTriggersReplaced + } else { + s2.possibleTriggers + } + Q(s2.copy(possibleTriggers = newPossibleTriggers), t2, v2) + }) }) /* Strict evaluation of AND */ @@ -1130,7 +1140,7 @@ object evaluator extends EvaluationRules { !possibleTriggersBefore.contains(t._1) || possibleTriggersBefore(t._1) != t._2) def wrapInOld(e: ast.Exp) = { - if (label == "old") { + if (label == Verifier.PRE_STATE_LABEL) { ast.Old(e)(e.pos, e.info, e.errT) } else { ast.LabelledOld(e, label)(e.pos, e.info, e.errT)