Datasets:
Download level_1/4.rs from CodeWalk/verus-proof-completion: direct link, hf CLI and curl.
- Browser
- Download file 685 Bytes
-
https://huggingface.co/datasets/CodeWalk/verus-proof-completion/resolve/main/level_1/4.rs
- Command line
-
hf download hf://datasets/CodeWalk/verus-proof-completion/level_1/4.rs
-
curl -L -o 4.rs https://huggingface.co/datasets/CodeWalk/verus-proof-completion/resolve/main/level_1/4.rs
685 Bytes
| use vstd::prelude::*; | |
| fn main() {} | |
| verus!{ | |
| fn f1_list_deep_clone(arr: &Vec<u64>) -> (copied: Vec<u64>) | |
| { | |
| let mut copied_array = Vec::with_capacity(arr.len()); | |
| let mut index = 0; | |
| while index < arr.len() | |
| { | |
| copied_array.push(arr[index]); | |
| index += 1; | |
| } | |
| copied_array | |
| } | |
| spec fn step1(__hp0: Seq<u64>, outp: Seq<u64>) -> bool { | |
| (__hp0.len() == outp.len()) | |
| && (forall|i: int| (0 <= i < __hp0.len()) ==> __hp0[i] == outp[i]) | |
| } | |
| fn chain_driver(arr: &Vec<u64>) -> (r_final: Vec<u64>) | |
| ensures | |
| step1(arr@, r_final@), | |
| { | |
| let x1 = f1_list_deep_clone(arr); | |
| proof { | |
| assert(step1(arr@, x1@)); | |
| } | |
| x1 | |
| } | |
| } // verus! | |