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