-
I get this error for the
This variant works well:
What is missing in the first case to make it work (in my use case I have other fields in |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Could you try: #[logic]
fn len(n: Node) -> Int {
match n {
{ next: Some(node) } => len(*node) + 1,
{ next: None } => 0,
}
} The point being, we use a very simple syntactic criterion to prove the well-formedness of structural recursion. Pattern matching is considered to generate smaller values, but not field access. The reason for this is that this is basically why Why3 does. |
Beta Was this translation helpful? Give feedback.
-
Now I want to replace the
As I expected termination cannot be proved since it is possible to create circular structures with this. Can I add a precondition expressing that there should be no cycles? Maybe with a predicate "there exists n>=0 such that node has length n"? Related question: is it possible to define a |
Beta Was this translation helpful? Give feedback.
-
Another strange case. The following can't be proved (the proof of the invariant of the result of
But if I change |
Beta Was this translation helpful? Give feedback.
Could you try:
The point being, we use a very simple syntactic criterion to prove the well-formedness of structural recursion. Pattern matching is considered to generate smaller values, but not field access. The reason for this is that this is basically why Why3 does.