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 --cfg hax. hax sets this cfg automatically when extracting a crate; a regular cargo build leaves it unset.
Main features
#[hax_lib::requires(...)]and#[hax_lib::ensures(...)]: pre- and postconditions on functions.#[hax_lib::attributes]: enablesrequires/ensureson trait methods and refinements on struct fields.hax_lib::loop_invariant!: loop invariants.Propand the logical operatorsforall,exists,implies: propositions beyondbool.assume!,assert!,assert_prop!: assumptions and assertions for the backends.fstar!,coq!,proverif!, ...: inline backend code.
Example
/// The addition in `sum` does not overflow.