the property of recursive function #2643
Unanswered
dreamqin68
asked this question in
Q&A
Replies: 1 comment 3 replies
-
How do you think it should obviously hold? Dafny is not convinced. There are several things that makes it hard to reason: Everything non-trivial involving recursivity is not straightforward for Dafny. In your case, you want to prove:
which means that you want to prove that the sum is invariant when you rotate the list. Think about it for a moment. It probably works down the road because addition is commutative. If you had "-" instead of "+", then obviously it would not work. So there is probably some work to do. So here is advice:
|
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi All,
I wrote a
function
that sums a sequence and found that the function does not satisfy that the sum of the whole sequence is equal to the sum of the parts.The output shows
assert temp3Value == temp2Value
might not hold.I think this should be obviously hold. Where did I make a mistake?
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions