summaryrefslogtreecommitdiff
path: root/Source/Dafny/Translator.cs
diff options
context:
space:
mode:
authorGravatar Clément Pit--Claudel <clement.pitclaudel@live.com>2015-08-14 10:05:37 -0700
committerGravatar Clément Pit--Claudel <clement.pitclaudel@live.com>2015-08-14 10:05:37 -0700
commit22a997192baf246bd86031f319aac154c2ec05cb (patch)
tree3d013808d315d4898398709721186f1ebfd81bbe /Source/Dafny/Translator.cs
parent47a2b369096bb316914983c08e473cb3fddc0c25 (diff)
Implement self-loop detection
Implementing loop detection between multiple triggers is much harder, as it seems to require walking an exponentially sized graph. Self-loop detection is still a net gain compared to the current situation: we used to not detect loops in large quantifiers; not we break these apart, suppress the loops where we can in the smaller parts, and report the ones that we can't suppress. It could be that the broken-up quantifiers are mutually recursive, but these cases would have already led to a loop in the past.
Diffstat (limited to 'Source/Dafny/Translator.cs')
-rw-r--r--Source/Dafny/Translator.cs4
1 files changed, 3 insertions, 1 deletions
diff --git a/Source/Dafny/Translator.cs b/Source/Dafny/Translator.cs
index b5d89abd..14fca463 100644
--- a/Source/Dafny/Translator.cs
+++ b/Source/Dafny/Translator.cs
@@ -13107,8 +13107,10 @@ namespace Microsoft.Dafny {
return f.Formals.Zip(fexp.Args).All(formal_concrete => CanSafelySubstitute(visitor.TriggerVariables, formal_concrete.Item1, formal_concrete.Item2));
}
+ Triggers.TriggersCollector triggersCollector = new Triggers.TriggersCollector();
+
private bool CanSafelySubstitute(ISet<IVariable> protectedVariables, IVariable variable, Expression substitution) {
- return !(protectedVariables.Contains(variable) && Dafny.Triggers.TriggersCollector.IsTriggerKiller(substitution));
+ return !(protectedVariables.Contains(variable) && triggersCollector.IsTriggerKiller(substitution));
}
private class VariablesCollector: BottomUpVisitor {