Expand description
This module re-exports the most commonly used items from Vest.
use vest_lib::prelude::*; would include the Verus prelude, Vest’s executable,
specification and proof traits, as well as its format combinators.
In addition, some basic length and bytes-view broadcast lemmas are enabled automatically when
vest_lib is imported.
Re-exports§
pub use crate::core::exec::ByteLen;pub use crate::core::exec::InputBuf;pub use crate::core::exec::InputSlice;pub use crate::core::exec::OutputBuf;pub use crate::core::exec::OutputSlice;pub use crate::core::exec::PResult;pub use crate::core::exec::ParseError;pub use crate::core::exec::ParseErrorKind;pub use crate::core::exec::Parser;pub use crate::core::exec::PreSerializeError;pub use crate::core::exec::Prepare;pub use crate::core::exec::Serializer;pub use crate::core::exec::SerializerExt;pub use crate::combinators::star::spec::lemma_star_static_byte_len;pub use crate::combinators::*;pub use crate::core::proof::*;pub use crate::core::spec::*;
Macros§
- atomic_
with_ ghost_ helper - calc_
proc_ macro - decreases_
to - decreases_to!(b => a) means that height(a) < height(b), so that b can decrease to a in decreases clauses. decreases_to!(b1, …, bn => a1, …, am) can compare lexicographically ordered values, which can be useful when making assertions about decreases clauses. Notes:
- decreases_
to_ internal - fndecl
- imap
- Create a map using syntax like
imap![key1 => val1, key2 => val, ...]. - iset
- map
- Create a map using syntax like
map![key1 => val1, key2 => val, ...]. - proof
- Add a verus proof block.
- proof_
decl - proof_decl add extra stmts that are used only for verification. For example, declare a ghost/tracked variable. To avoid confusion, let stmts without ghost/tracked is not supported. Non-local stmts inside proof_decl! are treated similar to those in proof!
- proof_
with - proof_with add ghost input/output to the next function call. In stable rust, we cannot add attribute-based macro to expr/statement. Using proof_with! to tell #[verus_spec] to add ghost input/output. Using proof_with outside of #[verus_spec] does not have any side effects.
- seq
- Creates a
Seqcontaining the given elements. - set
- struct_
with_ invariants - verus
- verus_
erase_ ghost - verus_
exec_ expr - verus_
exec_ expr_ erase_ ghost - verus_
exec_ expr_ keep_ ghost - verus_
exec_ inv_ macro_ exprs - verus_
exec_ macro_ exprs - verus_
ghost_ inv_ macro_ exprs - verus_
impl - Like verus!, but for use inside a (non-trait) impl
- verus_
keep_ ghost - verus_
proof_ expr - verus_
proof_ macro_ explicit_ exprs verus_proof_macro_explicit_exprs!(f!(tts))applies verus syntax to transformttsintotts', then returnsf!(tts'), only applying the transform to any of the exprs within it that are explicitly prefixed with@@, leaving the rest as-is. Contrast this to [verus_proof_macro_exprs] which is likely what you want to try first to see if it satisfies your needs.- verus_
proof_ macro_ exprs - verus_proof_macro_exprs!(f!(exprs)) applies verus syntax to transform exprs into exprs’, then returns f!(exprs’), where exprs is a sequence of expressions separated by “,”, “;”, and/or “=>”.
- verus_
trait_ impl - Like verus!, but for use inside a trait impl
- with_
triggers
Structs§
- Dummy
Capture - FnProof
- FnProof is the type of proof closures; the syntax proof_fn is used to wrap FnProof
- FnSpec
- Ghost
- IMap
IMap<K, V>is an abstract map type for specifications.- ISet
ISet<A>is a set type for specifications.- Map
Map<K, V>is an abstract map type for specifications. To use a “map” in compiled code, use anexectype like HashMap that has aMap<K, V>as its specification type.- NoCopy
- Proof
FnConfirm - Seq
Seq<A>is a sequence type for specifications. To use a “sequence” in compiled code, use anexectype likevec::Vecthat hasSeq<A>as its specification type.- Set
Set<A>is a finite set type for specifications.- Spec
Chain - Tracked
- int
- nat
- real
Constants§
Traits§
- Array
Additional Exec Fns - Array
Additional Spec Fns - Boolean
- Chainable
- Count
Token - Interface for VerusSync tokens created for a field marked with the
countstrategy. - Decimal
- Deep
View - Element
Token - Interface for VerusSync tokens created for a field marked with the
set,persistent_setormultisetstrategies. - FnWith
Requires Ensures - Ieee
Float - Ieee
Float Cast - Integer
- KeyValue
Token - Interface for VerusSync tokens created for a field marked with the
maporpersistent_mapstrategies. - Maybe
Uninit Additional Spec Fns - Monotonic
Count Token - Interface for VerusSync tokens created for a field marked with the
persistent_countstrategy. - Option
Additional Fns - ProofFn
- Proof
FnMut - Proof
FnOnce - Proof
FnReq Ens - Proof
FnReq EnsDef - Result
Additional Spec Fns - Simple
Token - Interface for VerusSync tokens created for a field marked with the
boolorpersistent_boolstrategy. - Slice
Additional Spec Fns - SpecAdd
- Spec
BitAnd - Spec
BitOr - Spec
BitXor - SpecEq
- Spec
Euclidean Mod - Spec
Euclidean OrReal Div - SpecMul
- SpecNeg
- SpecOrd
- SpecShl
- SpecShr
- SpecSub
- StrSlice
Exec Fns - String
Exec Fns - String
Exec FnsIs Ascii - Structural
- derive(Structural) means that exec-mode == and ghost == always yield the same result. derive(Structural) is only allowed when all the fields of a type are also Structural. derive(StructuralEq) means derive(Structural) and also implement PartialEqSpec, setting eq_spec to == and obeys_eq_spec to true.
- Value
Token - Interface for VerusSync tokens created for a field marked with the
variable,optionorpersistent_optionstrategies. - VecAdditional
Exec Fns - VecAdditional
Spec Fns - View
- Types used in executable code can implement View to provide a mathematical abstraction of the type. For example, Vec implements a view method that returns a Seq. For base types like bool and u8, the view V of the type is the type itself. Types only used in ghost code, such as int, nat, and Seq, do not need to implement View.
Functions§
- add
- admit
- affirm
- after_
borrow - arbitrary
- In spec, all types are inhabited
- arch_
word_ bits - array_
index - assert_
- assert_
bit_ vector - assert_
bitvector_ by - assert_
by - assert_
by_ compute - assert_
by_ compute_ only - assert_
forall_ by - assert_
nonlinear_ by - assume_
- atomic_
call_ loop - atomic_
spec - basic_
lemmas - call_
ensures - call_
requires - choose
- choose_
tuple - cloned
- Predicate indicating
bis “a clone” ofa; i.e.,bcould be the result of callinga.clone()or is equal toa. - closure_
to_ fn_ spec - constrain_
type - decreases
- decreases_
by - decreases_
when - default_
ensures - Mark an ensures clause in a trait as applying just to the default implementation, not the trait declaration in general
- dummy_
capture_ consume - dummy_
capture_ new - ensures
- equal
- erased_
ghost_ value - Needed for the THIR-based erasure (rustc_mir_build_additional_files)
- exists
- ext_
equal - ext_
equal_ deep - extra_
dependency - f32_
to_ bits - f64_
to_ bits - final_
- forall
- get_
future_ output_ type - get_
union_ field - get_
variant_ field - ghost_
exec - global_
size_ of - has_
resolved - Directives and spec functions related to &mut references
- has_
resolved_ unsized - imply
- inline_
air_ stmt - inv_
mask_ any - inv_
mask_ list - inv_
mask_ list_ compl - inv_
mask_ none - inv_
mask_ set - invariant
- invariant_
except_ break - is_
smaller_ than - is_
smaller_ than_ lexicographic - is_
smaller_ than_ recursive_ function_ field - is_
variant - lemma_
byte_ array_ view - lemma_
byte_ slice_ view - lemma_
identity_ vec_ view - mul
- mut_
ref_ current - mut_
ref_ future - mut_
ref_ tracked - mutable_
reference_ tie - no_
method_ body - no_
unwind - no_
unwind_ when - old
- opens_
invariant_ mask - parser_
lemmas - proof_
from_ false - recommends
- recommends_
by - requires
- returns
- reveal_
byteslit - reveal_
hide_ - reveal_
hide_ internal_ path_ - reveal_
strlit - shadow_
ghost_ value - shr_
ref_ struct_ wrap - signed_
max - signed_
min - spec_
affirm - A tool to check one’s reasoning while writing complex spec functions.
Not intended to be used as a mechanism for instantiating quantifiers,
spec_affirmshould be removed from spec functions once they are complete. - spec_
cast_ float - spec_
cast_ integer - spec_
cast_ real - spec_
chained_ cmp - spec_
chained_ eq - spec_
chained_ ge - spec_
chained_ gt - spec_
chained_ le - spec_
chained_ lt - spec_
chained_ value - spec_eq
- spec_
literal_ decimal - spec_
literal_ int - spec_
literal_ integer - spec_
literal_ nat - strslice_
get_ char - strslice_
len - strslice_
new_ strlit - sub
- tracked_
exec - tracked_
exec_ borrow - two_
phase_ mutable_ reference_ tie - unreached
- unsigned_
max - use_
type_ invariant - verus_
erasure_ get_ first - with_
triggers
Type Aliases§
- Instance
Id - Unique identifier for every VerusSync instance.
Every “Token” and “Instance” object has an
InstanceId. These ID values must agree to perform any token operation.
Attribute Macros§
- is_
variant - Add
is_<VARIANT>andget_<VARIANT>functions to an enum - is_
variant_ no_ deprecation_ warning - Add
is_<VARIANT>andget_<VARIANT>functions to an enum - verus_
enum_ synthesize - verus_
spec - verus_
verify