Skip to content
Discussion options

You must be logged in to vote

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.

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@ebruneton
Comment options

Answer selected by ebruneton
Comment options

You must be logged in to vote
2 replies
@jhjourdan
Comment options

@ebruneton
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants