Skip to main content

Module model

Module model 

Source
Expand description

Rust values in the representation of Aeneas’s Lean model of Rust.

Aeneas models Rust’s integers as Std.U8 … Std.I128 (a BitVec at run time, so a Nat holding the bits), Vec<T> and &[T] as alloc.vec.Vec and Slice (a length and a ListN), [T; N] as Std.Array (a ListN), &str as Str (a Slice U8) and String as Lean’s String. Model converts a Rust value to and from that representation. #[derive(leanfran::Model)] implements it for the structs and enums of a crate, with the constructor layout Lean gives the structure or inductive type Aeneas generates.

Traits§

Model
A Rust value in the representation of its type in Aeneas’s model.

Functions§

array_n_from_model⚠
[T; N] of the elements of the borrowed ListN α N (Std.Array α N).
bits_from_model⚠
The bits held by the borrowed Nat o (below 2^128).
bits_to_model⚠
A Nat holding bits.
ctor_layout
The layout of a constructor whose fields have the Model::SCALAR_SIZEs sizes, as Lean lays it out: object fields first in their order, then the scalar fields by decreasing size. Per field: the object index or the byte offset in the scalar area; and the number of object fields and the size of the scalar area.
list_n_from_model⚠
The elements of the borrowed ListN α n.
list_n_to_model⚠
ListN α n of the elements.
result_value⚠
The value of the owned MatchResult α m (the result of Result.match): ok gives the value, fail and div are a Rust panic.
scalar_offset
Offset of a scalar field of a constructor with objs object fields.
slice_from_model⚠
The elements of the borrowed Slice α.
slice_to_model⚠
Slice α (and alloc.vec.Vec α, a structure around it) of the elements.