Closed jeremy-rifkin closed 10 months ago
So yeah the basic issue here is that Alive does not understand recursion, nor can it reason about unbounded loops
Alive has an unroller that you can try to use, if you unroll the loop as many times as it's going to execute for real, then you should be able to verify your function for small input values. However, the unroller does not understand recursive loops, you'll need to either do that by hand or else perhaps you can get the LLVM inliner to completely unroll the recursion.
Right, recursion is not supported and won't be any time soon, sorry.
Hi, thank you both so much for the replies. It's helpful to know recursion isn't supported (I tried to look for any mention of recursion but didn't see one).
Out of curiosity have you considered doing some sort of bounded inlining for recursion?
And one last quick question, if I replace the recursive factorial with a non-recursive factorial alive2 is still not verifying: https://alive2.llvm.org/ce/z/hZ-jF2. Is this somehow still considered an unbounded loop?
Please note that Alive2 is a compiler verification tool, not a generic prover or a generic program equivalence checker. Also, Alive2 doesn't support inter-procedural optimizations, so inlining is not supported. It's not that we don't want to support it, it's just that it hasn't been done. But supporting inlining is of extremely low priority, as it's not a common source of compiler bugs.
Your example requires inter-procedural reasoning, so it's not supported.
Thank you again! I'm enrolled in a course about formal verification and I've been working on a project related to transformation verification. At the moment I'm trying to understand the capabilities and scopes of current tools.
Alive2 supports all intra-procedural optimizations of LLVM. That's it 🙂 There are some limitations in the set of IR features that is supported (as LLVM IR is huge), of course. There are other tools out there for transformation verification, but they usually target smaller languages. And often they are not bit-precise (they do proofs over rationals instead of over modular arithmetic like Alive2).
Hello, I have two implementations of a factorial function (one recursive and the other not), and src/tgt functions corresponding to the following C code calling each of the factorials
Alive2 says the functions do not verify as the source is more defined than the target https://alive2.llvm.org/ce/z/MPLtAa
I'm confused how either fact1 or fact2 are triggering UB or not returning.
Not a perfect indicator but clang seems to constant propagate them just fine if I do a test such as https://alive2.llvm.org/ce/z/58qw8Z.
Looking at just the factorial implementations alone alive2 says they are equivalent: https://alive2.llvm.org/ce/z/cHHFGs
Am I missing something here, is there an alive2 bug, or is this just a known limitation of analyzing functions with calls in alive2?