Datasets:
Download level_1/39.rs from CodeWalk/verus-proof-completion: direct link, hf CLI and curl.
- Browser
- Download file 706 Bytes
-
https://huggingface.co/datasets/CodeWalk/verus-proof-completion/resolve/main/level_1/39.rs
- Command line
-
hf download hf://datasets/CodeWalk/verus-proof-completion/level_1/39.rs
-
curl -L -o 39.rs https://huggingface.co/datasets/CodeWalk/verus-proof-completion/resolve/main/level_1/39.rs
706 Bytes
| use vstd::prelude::*; | |
| fn main() {} | |
| verus!{ | |
| fn f1_find_odd_numbers(arr: &Vec<u32>) -> (odd_numbers: Vec<u32>) | |
| { | |
| let mut odd_numbers: Vec<u32> = Vec::new(); | |
| let input_len = arr.len(); | |
| let mut index = 0; | |
| while index < arr.len() | |
| { | |
| if (arr[index] % 2 != 0) { | |
| odd_numbers.push(arr[index]); | |
| } | |
| index += 1; | |
| } | |
| odd_numbers | |
| } | |
| spec fn step1(__hp0: Seq<u32>, outp: Seq<u32>) -> bool { | |
| (outp == __hp0.filter(|x: u32| x % 2 != 0)) | |
| } | |
| fn chain_driver(arr: &Vec<u32>) -> (r_final: Vec<u32>) | |
| ensures | |
| step1(arr@, r_final@), | |
| { | |
| let x1 = f1_find_odd_numbers(arr); | |
| proof { | |
| assert(step1(arr@, x1@)); | |
| } | |
| x1 | |
| } | |
| } // verus! | |