verus-lang / verus

Verified Rust for low-level systems code
MIT License
1.21k stars 70 forks source link

Verus panic in recursive lemma without decreases clause when built with `record-history` feature #975

Closed tenzinhl closed 8 months ago

tenzinhl commented 9 months ago

Bottom Line Up Front: Ran into a verus panic when running it on a recursive lemma missing a decreases clause. Here's the panic output:

note: verifying module betree::PivotBranchRefinement_v, function lib::betree::PivotBranchRefinement_v::insert_refines

error: recursive function must have a decreases clause
   --> /home/tenzinhl/research/verification/verified-betrfs/Splinter/src/betree/PivotBranchRefinement_v.rs:757:1
    |
757 | pub proof fn append_refines(pre: Node, lbl: AppendLabel)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

thread 'main' panicked at rust_verify/src/main.rs:237:13:
assertion failed: smt_function_breakdown.keys().collect::<std::collections::HashSet<_>>().difference(&smt_run_times.iter().map(|(x,\n                                _)|\n                            *x).collect::<std::collections::HashSet<_>>()).next().is_none()
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at verus/src/record_history.rs:184:14:
cannot parse rust_verify output: Error("EOF while parsing a value", line: 1, column: 0)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Notes

Building verus without --features record-history OR adding a decreases clause to the append_refines lemma both "fix" the issue (verus will no longer panic).

Environment

Verus Version (built Feb. 2nd):

tenzinhl@LAPTOP-U355A8BD ~/r/v/v/S/src (pivot-branch-refinement)> $verus --version
Verus
  Version: 0.2024.02.05.cf45c95
  Profile: release
  Platform: linux_x86_64
  Toolchain: 1.73.0-x86_64-unknown-linux-gnu

Verus was built with the record-history feature using this commandline:

vargo build --release --features record-history

How to Reproduce

Run the following command

$verus --verify-module betree::PivotBranchRefinement_v --expand-errors --multiple-errors 10 /home/tenzinhl/research/verification/verified-bet
rfs/Splinter/src/lib.rs

on the following version of the verisplinter code: https://github.com/vmware-labs/verified-betrfs/blob/0a488e9794df51f002dbb23a1cd329c62eae2c56/Splinter/src/betree/PivotBranchRefinement_v.rs#L757-L773

(Commit is tagged in repo as tenzinhl-append-refines-panics).

tenzinhl commented 9 months ago

@utaal