@@ -1981,11 +1981,11 @@ object quantifiedChunkSupporter extends QuantifiedChunkSupport {
1981
1981
case qfc : QuantifiedFieldChunk if qfc.invs.isDefined =>
1982
1982
Left (qfc.invs.get.invertibles, qfc.quantifiedVars, qfc.condition)
1983
1983
case qfc : QuantifiedFieldChunk if qfc.singletonArguments.isDefined =>
1984
- Right (qfc.singletonArguments.get)
1984
+ Right (qfc.singletonArguments.get, qfc.condition )
1985
1985
case qpc : QuantifiedPredicateChunk if qpc.invs.isDefined =>
1986
1986
Left (qpc.invs.get.invertibles, qpc.quantifiedVars, qpc.condition)
1987
1987
case qpc : QuantifiedPredicateChunk if qpc.singletonArguments.isDefined =>
1988
- Right (qpc.singletonArguments.get)
1988
+ Right (qpc.singletonArguments.get, qpc.condition )
1989
1989
case _ => return None
1990
1990
}
1991
1991
val relevantChunks : Iterable [QuantifiedBasicChunk ] = chunks.flatMap {
@@ -1995,19 +1995,25 @@ object quantifiedChunkSupporter extends QuantifiedChunkSupport {
1995
1995
1996
1996
val (receiverTerms, quantVars, cond) = lr match {
1997
1997
case Left (tuple) => tuple
1998
- case Right (singletonArguments) =>
1998
+ case Right (( singletonArguments, cond) ) =>
1999
1999
return relevantChunks.find { ch =>
2000
2000
val chunkInfo = ch match {
2001
2001
case qfc : QuantifiedFieldChunk if qfc.singletonArguments.isDefined =>
2002
- Some (qfc.singletonArguments.get)
2002
+ Some (qfc.singletonArguments.get, qfc.condition )
2003
2003
case qpc : QuantifiedPredicateChunk if qpc.singletonArguments.isDefined =>
2004
- Some (qpc.singletonArguments.get)
2004
+ Some (qpc.singletonArguments.get, qpc.condition )
2005
2005
case _ => None
2006
2006
}
2007
2007
chunkInfo match {
2008
- case Some (cSingletonArguments) =>
2008
+ case Some ((cSingletonArguments, cCond)) =>
2009
+
2009
2010
val equalityTerm = And (singletonArguments.zip(cSingletonArguments).map { case (a, b) => a === b })
2010
- val result = v.decider.check(equalityTerm, Verifier .config.checkTimeout())
2011
+ // The conditions of two chunks with the same receivers can differ if they originate from separate branches
2012
+ // that were joined. In such cases, additional conjuncts might have been added to the conditions.
2013
+ // Hence, we need to compare the conditions for equality in addition to verifying that the receivers match.
2014
+ val equalityCond = And (cond.replace(chunk.quantifiedVars, singletonArguments),
2015
+ cCond.replace(ch.quantifiedVars, cSingletonArguments))
2016
+ val result = v.decider.check(And (equalityCond, equalityTerm), Verifier .config.checkTimeout())
2011
2017
if (result) {
2012
2018
// Learn the equality
2013
2019
val debugExp = Option .when(withExp)(DebugExp .createInstance(" Chunks alias" , true ))
0 commit comments