Module hash

Module hash 

Source
Expand description

This code adds specifications for the standard-library types std::collections::HashMap and std::collections::HashSet.

Most of the specification only applies if you use HashMap<Key, Value> or HashSet<Key>. If you use some custom build hasher, e.g., withHashMap<Key, Value, CustomBuildHasher>, the specification won’t specify much.

Likewise, the specification is only meaningful when the Key obeys our hash table model, i.e., (1) Key::hash is deterministic, (2) any two Keys are identical if and only if the executable == operator considers them equal, and (3) Key::clone produces a result equal to its input. We have an axiom that all primitive types and Boxes thereof obey this model. But if you want to use some other key type MyKey, you need to explicitly state your assumption that it does so with assume(vstd::std_specs::hash::obeys_key_model::<MyKey>());. In the future, we plan to devise a way for you to prove that it does so, so that you don’t have to make such an assumption.

By default, the Verus standard library brings useful axioms about the behavior of HashMap and HashSet into the ambient reasoning context by broadcasting the group vstd::std_specs::hash::group_hash_axioms.

Structs§

ExDefaultHasher
Specifications for the behavior of std::collections::hash_map::DefaultHasher.
ExHashMap
Specifications for the behavior of std::collections::HashMap.
ExHashSet
Specifications for the behavior of std::collections::HashSet.
ExKeys
Specifications for the behavior of std::collections::hash_map::Keys.
ExMapIter
ExRandomState
Specifications for the behavior of std::hash::RandomState.
ExSetIter
ExValues
Specifications for the behavior of std::collections::hash_map::Values.
KeysGhostIterator
MapIterGhostIterator
SetIterGhostIterator
ValuesGhostIterator

Traits§

DefaultHasherAdditionalSpecFns
ExBuildHasher
ExHasher
HashMapAdditionalSpecFns

Functions§

_verus_external_fn_specification_380_DefaultHasher_32__58__58__32_new
_verus_external_fn_specification_381_DefaultHasher_32__58__58__32_write
_verus_external_fn_specification_382_DefaultHasher_32__58__58__32_finish
_verus_external_fn_specification_383_Keys_32__58__58__32__60__32__39_a_44__32_Key_44__32_Value_32__62__32__58__58__32_next
_verus_external_fn_specification_384_Values_32__58__58__32__60__32__39_a_44__32_Key_44__32_Value_32__62__32__58__58__32_next
_verus_external_fn_specification_385_hash__map_32__58__58__32_Iter_32__58__58__32__60__32__39_a_44__32_Key_44__32_Value_32__62__32__58__58__32_next
_verus_external_fn_specification_386_HashMap_32__58__58__32__60__32_Key_44__32_Value_44__32_S_32__62__32__58__58__32_iter
_verus_external_fn_specification_387_HashMap_32__58__58__32__60__32_Key_44__32_Value_44__32_S_32__62__32__58__58__32_len
_verus_external_fn_specification_388_HashMap_32__58__58__32__60__32_Key_44__32_Value_44__32_S_32__62__32__58__58__32_is__empty
_verus_external_fn_specification_389__60__32_HashMap_32__58__58__32__60__32_K_44__32_V_44__32_S_32__62__32_as_32_Clone_32__62__32__58__58__32_clone
_verus_external_fn_specification_390_HashMap_32__58__58__32__60__32_Key_44__32_Value_32__62__32__58__58__32_new
_verus_external_fn_specification_391__60__32_HashMap_32__60__32_K_44__32_V_44__32_S_44__32__62__32_as_32_core_32__58__58__32_default_32__58__58__32_Default_32__62__32__58__58__32_default
_verus_external_fn_specification_392_HashMap_32__58__58__32__60__32_Key_44__32_Value_32__62__32__58__58__32_with__capacity
_verus_external_fn_specification_393_HashMap_32__58__58__32__60__32_Key_44__32_Value_44__32_S_44__32__62__32__58__58__32_reserve
_verus_external_fn_specification_394_HashMap_32__58__58__32__60__32_Key_44__32_Value_44__32_S_32__62__32__58__58__32_insert
_verus_external_fn_specification_395_HashMap_32__58__58__32__60__32_Key_44__32_Value_44__32_S_32__62__32__58__58__32_contains__key_32__58__58__32__60__32_Q_32__62_
_verus_external_fn_specification_396_HashMap_32__58__58__32__60__32_Key_44__32_Value_44__32_S_32__62__32__58__58__32_get_32__58__58__32__60__32_Q_32__62_
_verus_external_fn_specification_397_HashMap_32__58__58__32__60__32_Key_44__32_Value_44__32_S_32__62__32__58__58__32_remove_32__58__58__32__60__32_Q_32__62_
_verus_external_fn_specification_398_HashMap_32__58__58__32__60__32_Key_44__32_Value_44__32_S_32__62__32__58__58__32_clear
_verus_external_fn_specification_399_HashMap_32__58__58__32__60__32_Key_44__32_Value_44__32_S_32__62__32__58__58__32_keys
_verus_external_fn_specification_400_HashMap_32__58__58__32__60__32_Key_44__32_Value_44__32_S_32__62__32__58__58__32_values
_verus_external_fn_specification_401_hash__set_32__58__58__32_Iter_32__58__58__32__60__32__39_a_44__32_Key_32__62__32__58__58__32_next
_verus_external_fn_specification_402_HashSet_32__58__58__32__60__32_Key_44__32_S_32__62__32__58__58__32_len
_verus_external_fn_specification_403_HashSet_32__58__58__32__60__32_Key_44__32_S_32__62__32__58__58__32_is__empty
_verus_external_fn_specification_404_HashSet_32__58__58__32__60__32_Key_32__62__32__58__58__32_new
_verus_external_fn_specification_405__60__32_HashSet_32__60__32_T_44__32_S_44__32__62__32_as_32_core_32__58__58__32_default_32__58__58__32_Default_32__62__32__58__58__32_default
_verus_external_fn_specification_406_HashSet_32__58__58__32__60__32_Key_32__62__32__58__58__32_with__capacity
_verus_external_fn_specification_407_HashSet_32__58__58__32__60__32_Key_44__32_S_32__62__32__58__58__32_reserve
_verus_external_fn_specification_408_HashSet_32__58__58__32__60__32_Key_44__32_S_32__62__32__58__58__32_insert
_verus_external_fn_specification_409_HashSet_32__58__58__32__60__32_Key_44__32_S_32__62__32__58__58__32_contains
_verus_external_fn_specification_410_HashSet_32__58__58__32__60__32_Key_44__32_S_32__62__32__58__58__32_get_32__58__58__32__60__32_Q_32__62_
_verus_external_fn_specification_411_HashSet_32__58__58__32__60__32_Key_44__32_S_32__62__32__58__58__32_remove_32__58__58__32__60__32_Q_32__62_
_verus_external_fn_specification_412_HashSet_32__58__58__32__60__32_Key_44__32_S_32__62__32__58__58__32_clear
_verus_external_fn_specification_413_HashSet_32__58__58__32__60__32_Key_44__32_S_32__62__32__58__58__32_iter
axiom_bool_obeys_hash_table_key_model
axiom_box_bool_obeys_hash_table_key_model
axiom_box_integer_type_obeys_hash_table_key_model
axiom_box_key_removed
axiom_contains_box
axiom_contains_deref_key
axiom_deref_key_removed
axiom_hashmap_decreases
axiom_hashmap_deepview_borrow
axiom_hashmap_view_finite_dom
axiom_hashset_decreases
axiom_i8_obeys_hash_table_key_model
axiom_i16_obeys_hash_table_key_model
axiom_i32_obeys_hash_table_key_model
axiom_i64_obeys_hash_table_key_model
axiom_i128_obeys_hash_table_key_model
axiom_isize_obeys_hash_table_key_model
axiom_maps_box_key_to_value
axiom_maps_deref_key_to_value
axiom_random_state_builds_valid_hashers
axiom_set_box_key_removed
axiom_set_box_key_to_value
axiom_set_contains_box
axiom_set_contains_deref_key
axiom_set_deref_key_removed
axiom_set_deref_key_to_value
axiom_spec_hash_map_iter
axiom_spec_hash_map_len
axiom_spec_hash_set_len
axiom_u8_obeys_hash_table_key_model
axiom_u16_obeys_hash_table_key_model
axiom_u32_obeys_hash_table_key_model
axiom_u64_obeys_hash_table_key_model
axiom_u128_obeys_hash_table_key_model
axiom_usize_obeys_hash_table_key_model
borrowed_key_removed
builds_valid_hashers
contains_borrowed_key
group_hash_axioms
hash_map_deep_view_impl
lemma_hashmap_deepview_dom
lemma_hashmap_deepview_properties
lemma_hashmap_deepview_values
maps_borrowed_key_to_value
obeys_key_model
set_contains_borrowed_key
sets_borrowed_key_to_key
sets_differ_by_borrowed_key
spec_hash_map_iter
spec_hash_map_len
spec_hash_set_len