Skip to main content

model

Attribute Macro model 

Source
#[model]
Expand description

Binds a function (or the methods of an impl block) to Lean specs.

The item is unchanged. The macro adds the functions that call the specs (requires, refines, ensures_<label>), so that rustc checks the paths of the specs and their argument types, a property-based test of each spec under #[cfg(test)] (unless check = false), and the documentation of the state of the proofs that the build script writes.

ⓘ
#[leanfran::model(
    requires = sorting::input_sorted,
    ensures(sorted = sorting::output_sorted, perm = "OutputPerm"),
)]
pub fn insert_sorted(x: i64, xs: &[i64]) -> Vec<i64> { /* .. */ }