Skip to content

Fails to prove termination when recursive calls are placed inside a loop #1832

@rikosellic

Description

@rikosellic

The following function fails to prove termination unless annotated with #[verifier::loop_isolation(false)]:

pub fn test(x: usize)
    decreases x,
{
    if x == 0 {
        return;
    }
    for i in 0..1 {
        test(x - 1);
    }
}

Is this a reasonable default behavior? It seems the user can not express explicit termination-related conditions in the loop invariant, so loop_isolation(false) is the only solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions