Search code examples
recursionalloy

How does recursion work in the Alloy Analyzer?


I see there is an option in the Alloy Analyzer to allow recursion up to a certain depth (1-3).

But what happens when a counterexample cannot be found because of the limited recursion depth?

Will there be an error or a warning, or are such counterexamples silently ignored?


Solution

  • Alloy basically does not support recursion. When it encounters recursion, it unrolls the code the max number of times. Therefore, if it cannot found a solution, it just, well, cannot find a solution. If it could only generate an error if it knew there was a potential solution, which would solve the original problem.

    This is, imho, one of the weakest spots in Alloy. Recursion is extremely important in almost all specifications.