3 releases

0.1.0 Jan 20, 2025
0.1.0-rc.1 Dec 17, 2024
0.1.0-pre.1 Jun 18, 2024
0.1.0-alpha.1 Oct 7, 2024

#722 in Rust patterns

Download history 641/week @ 2024-10-28 650/week @ 2024-11-04 437/week @ 2024-11-11 502/week @ 2024-11-18 259/week @ 2024-11-25 481/week @ 2024-12-02 358/week @ 2024-12-09 624/week @ 2024-12-16 56/week @ 2024-12-23 54/week @ 2024-12-30 461/week @ 2025-01-06 504/week @ 2025-01-13 686/week @ 2025-01-20 526/week @ 2025-01-27 857/week @ 2025-02-03 569/week @ 2025-02-10

2,646 downloads per month
Used in 7 crates (3 directly)

Apache-2.0

22KB
423 lines

hax library

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.

Examples:

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()
}

lib.rs:

Hax-specific helpers for Rust programs. Those helpers are usually no-ops when compiled normally but meaningful when compiled under hax.

Example:

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()
}

Dependencies

~0–390KB