verus-lang / verus

Verified Rust for low-level systems code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Commas in spec fn signatures

parno opened this issue · comments

Verus normally accepts trailing commas for recommends, but it objects when this is followed by a via clause, as in this example

spec fn add0(a: nat, b: nat) -> nat
    recommends
        a > 0,
    via add0_recommends
{
    a
}

#[via_fn]
proof fn add0_recommends(a: nat, b: nat) {
    // proof
}

because it mis-parses the via as an identifier to be included in the list of recommends expressions.

Something similar happens in this example:

spec fn rids_match(bools_start: nat) -> bool
    decreases bools_start,
    when 0 <= bools_start <= 5
{
    true
}

where the when keyword is instead parsed as an identifier expression in the list of decreases expressions.