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