Datasets:
Download level_1/35.rs from CodeWalk/verus-proof-completion: direct link, hf CLI and curl.
- Browser
- Download file 680 Bytes
-
https://huggingface.co/datasets/CodeWalk/verus-proof-completion/resolve/main/level_1/35.rs
- Command line
-
hf download hf://datasets/CodeWalk/verus-proof-completion/level_1/35.rs
-
curl -L -o 35.rs https://huggingface.co/datasets/CodeWalk/verus-proof-completion/resolve/main/level_1/35.rs
680 Bytes
| use vstd::prelude::*; | |
| fn main() {} | |
| verus!{ | |
| spec fn f1_is_even(n: u32) -> bool { | |
| (n % 2) == 0 | |
| } | |
| fn f1_is_product_even(arr: &Vec<u32>) -> (result: bool) | |
| { | |
| let mut index = 0; | |
| while index < arr.len() | |
| { | |
| if (arr[index] % 2 == 0) { | |
| return true; | |
| } | |
| index += 1; | |
| } | |
| false | |
| } | |
| spec fn step1(__hp0: Seq<u32>, outp: bool) -> bool { | |
| (outp <==> (exists|k: int| 0 <= k < __hp0.len() && f1_is_even( __hp0[k]))) | |
| } | |
| fn chain_driver(arr: &Vec<u32>) -> (r_final: bool) | |
| ensures | |
| step1(arr@, r_final), | |
| { | |
| let x1 = f1_is_product_even(arr); | |
| proof { | |
| assert(step1(arr@, x1)); | |
| } | |
| x1 | |
| } | |
| } // verus! | |