Skip to content

Commit

Permalink
Factor out subfunction to find mutually recursive functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jad-hamza committed Jun 11, 2020
1 parent cfe61d7 commit 088ab0c
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions core/src/main/scala/stainless/termination/MeasureInference.scala
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,18 @@ trait MeasureInference
}
}

def mutuallyRecursiveWithoutMeasure(id: Identifier): Option[Identifier] = {
symbols.dependencies(id).find(id2 =>
symbols.lookupFunction(id2).exists(fd2 =>
symbols.dependencies(id2).contains(id) &&
!fd2.measure(symbols).isEmpty
)
)
}

def needsMeasure(fd: FunDef): Boolean = {
if (symbols.isRecursive(fd.id) && fd.measure(symbols).isEmpty) {
symbols.dependencies(fd.id).find(id =>
symbols.lookupFunction(id).exists(fd2 =>
symbols.dependencies(fd2.id).contains(fd.id) &&
!fd2.measure(symbols).isEmpty
)
) match {
mutuallyRecursiveWithoutMeasure(fd.id) match {
case None =>
true
case Some(id) =>
Expand Down

0 comments on commit 088ab0c

Please sign in to comment.