use vstd::prelude::*; fn main() {} verus!{ fn f1_find_negative_numbers(arr: &Vec) -> (negative_list: Vec) { let mut negative_list: Vec = Vec::new(); let input_len = arr.len(); let mut index = 0; while index < arr.len() { if (arr[index] < 0) { negative_list.push(arr[index]); } index += 1; } negative_list } fn f2_contains(arr: &Vec, key: i32) -> (result: bool) { let mut i = 0; while i < arr.len() { if (arr[i] == key) { return true; } i += 1; } false } fn f2_intersection(arr1: &Vec, arr2: &Vec) -> (result: Vec) { let mut output_arr = Vec::new(); let mut index = 0; while index < arr1.len() { if (f2_contains(arr2, arr1[index]) && !f2_contains(&output_arr, arr1[index])) { output_arr.push(arr1[index]); } index += 1; } output_arr } spec fn step1(__hp0: Seq, outp: Seq) -> bool { (outp == __hp0.filter(|x: i32| x < 0)) } spec fn step2(inp: Seq, p2_key: i32, outp: bool) -> bool { (outp == (exists|i: int| 0 <= i < inp.len() && (inp[i] == p2_key))) } fn chain_driver(arr: &Vec, p2_key: i32) -> (r_final: bool) ensures exists|v1: Seq| #[trigger] step1(arr@, v1) && step2(v1, p2_key, r_final), { let x1 = f1_find_negative_numbers(arr); let x2 = f2_contains(&x1, p2_key); proof { assert(step1(arr@, x1@)); assert(step2(x1@, p2_key, x2)); } x2 } } // verus!