Crates.io | hax-lib |
lib.rs | hax-lib |
version | 0.3.4 |
created_at | 2024-06-18 09:26:50.907485+00 |
updated_at | 2025-09-03 14:29:30.654443+00 |
description | Hax-specific helpers for Rust programs |
homepage | https://github.com/hacspec/hax |
repository | https://github.com/hacspec/hax |
max_upload_size | |
id | 1275301 |
size | 1,072,481 |
This crate contains helpers that can be used when writing Rust code that is proven through the hax toolchain.
⚠️ The code in this crate has no effect when compiled without the --cfg hax
.
fn sum(x: Vec<u32>, y: Vec<u32>) -> Vec<u32> {
hax_lib::assume!(x.len() == y.len());
hax_lib::assert!(hax_lib::forall(|i: usize| hax_lib::implies(i < x.len(), || x[i] < 4242)));
hax_lib::debug_assert!(hax_lib::exists(|i: usize| hax_lib::implies(i < x.len(), || x[i] > 123)));
x.into_iter().zip(y.into_iter()).map(|(x, y)| x + y).collect()
}