Skip to main content

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.
ExEntry
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
ExOccupiedEntry
ExRandomState
Specifications for the behavior of std::hash::RandomState.
ExSetIter
ExVacantEntry
ExValues
Specifications for the behavior of std::collections::hash_map::Values.

Traits§

DefaultHasherAdditionalSpecFns
EntrySpecFns
Specification for an Entry. Contains the current key for the entry, and prophesies the final value after this instantiation of the entry API is complete.
ExBuildHasher
ExHasher
HashMapAdditionalSpecFns
OccupiedEntrySpecFns
Specification for an OccupiedEntry. Contains the current key and value in the entry, and prophesies the final value after this instantiation of the entry API is complete. The final value is optional, since the user might choose to remove the entry.
VacantEntrySpecFns
Specification for a VacantEntry. Contains the current key for the entry, and prophesies the final value after this instantiation of the entry API is complete. The final value is optional, since the user may or may not choose to insert a value.

Functions§

_verus_external_fn_specification_764_DefaultHasher_32__58__58__32_new⚠
_verus_external_fn_specification_765_DefaultHasher_32__58__58__32_write⚠
_verus_external_fn_specification_766_DefaultHasher_32__58__58__32_finish⚠
_verus_external_fn_specification_767_HashMap_32__58__58__32__60__32_Key_44__32_Value_44__32_S_44__32_A_32__62__32__58__58__32_iter⚠
_verus_external_fn_specification_768_HashMap_32__58__58__32__60__32_Key_44__32_Value_44__32_S_44__32_A_32__62__32__58__58__32_len⚠
_verus_external_fn_specification_769_HashMap_32__58__58__32__60__32_Key_44__32_Value_44__32_S_44__32_A_32__62__32__58__58__32_capacity⚠
_verus_external_fn_specification_770_HashMap_32__58__58__32__60__32_Key_44__32_Value_44__32_S_44__32_A_32__62__32__58__58__32_is__empty⚠
_verus_external_fn_specification_771__60__32_HashMap_32__58__58__32__60__32_K_44__32_V_44__32_S_44__32_A_44__32__62__32_as_32_Clone_32__62__32__58__58__32_clone⚠
_verus_external_fn_specification_772_HashMap_32__58__58__32__60__32_Key_44__32_Value_32__62__32__58__58__32_new⚠
_verus_external_fn_specification_773__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_774_HashMap_32__58__58__32__60__32_Key_44__32_Value_32__62__32__58__58__32_with__capacity⚠
_verus_external_fn_specification_775_HashMap_32__58__58__32__60__32_Key_44__32_Value_44__32_S_32__62__32__58__58__32_with__hasher⚠
_verus_external_fn_specification_776_HashMap_32__58__58__32__60__32_Key_44__32_Value_44__32_S_44__32_A_44__32__62__32__58__58__32_reserve⚠
_verus_external_fn_specification_777_HashMap_32__58__58__32__60__32_Key_44__32_Value_44__32_S_44__32_A_44__32__62__32__58__58__32_insert⚠
_verus_external_fn_specification_778_HashMap_32__58__58__32__60__32_Key_44__32_Value_44__32_S_44__32_A_32__62__32__58__58__32_contains__key_32__58__58__32__60__32_Q_32__62_⚠
_verus_external_fn_specification_779_HashMap_32__58__58__32__60__32_Key_44__32_Value_44__32_S_44__32_A_32__62__32__58__58__32_get_32__58__58__32__60__32_Q_32__62_⚠
_verus_external_fn_specification_780_HashMap_32__58__58__32__60__32_Key_44__32_Value_44__32_S_44__32_A_32__62__32__58__58__32_remove_32__58__58__32__60__32_Q_32__62_⚠
_verus_external_fn_specification_781_HashMap_32__58__58__32__60__32_Key_44__32_Value_44__32_S_44__32_A_32__62__32__58__58__32_clear⚠
_verus_external_fn_specification_782_HashMap_32__58__58__32__60__32_Key_44__32_Value_44__32_S_44__32_A_32__62__32__58__58__32_keys⚠
_verus_external_fn_specification_783_HashMap_32__58__58__32__60__32_Key_44__32_Value_44__32_S_44__32_A_32__62__32__58__58__32_values⚠
_verus_external_fn_specification_784_HashSet_32__58__58__32__60__32_Key_44__32_S_44__32_A_32__62__32__58__58__32_len⚠
_verus_external_fn_specification_785_HashSet_32__58__58__32__60__32_Key_44__32_S_44__32_A_32__62__32__58__58__32_is__empty⚠
_verus_external_fn_specification_786_HashSet_32__58__58__32__60__32_Key_32__62__32__58__58__32_new⚠
_verus_external_fn_specification_787__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_788_HashSet_32__58__58__32__60__32_Key_32__62__32__58__58__32_with__capacity⚠
_verus_external_fn_specification_789_HashSet_32__58__58__32__60__32_Key_44__32_S_32__62__32__58__58__32_with__hasher⚠
_verus_external_fn_specification_790_HashSet_32__58__58__32__60__32_Key_44__32_S_32__62__32__58__58__32_with__capacity__and__hasher⚠
_verus_external_fn_specification_791_HashSet_32__58__58__32__60__32_Key_44__32_S_44__32_A_44__32__62__32__58__58__32_reserve⚠
_verus_external_fn_specification_792_HashSet_32__58__58__32__60__32_Key_44__32_S_44__32_A_44__32__62__32__58__58__32_insert⚠
_verus_external_fn_specification_793_HashSet_32__58__58__32__60__32_Key_44__32_S_44__32_A_32__62__32__58__58__32_contains⚠
_verus_external_fn_specification_794_HashSet_32__58__58__32__60__32_Key_44__32_S_44__32_A_32__62__32__58__58__32_get_32__58__58__32__60__32_Q_32__62_⚠
_verus_external_fn_specification_795_HashSet_32__58__58__32__60__32_Key_44__32_S_44__32_A_32__62__32__58__58__32_remove_32__58__58__32__60__32_Q_32__62_⚠
_verus_external_fn_specification_796_HashSet_32__58__58__32__60__32_Key_44__32_S_44__32_A_32__62__32__58__58__32_clear⚠
_verus_external_fn_specification_797_HashSet_32__58__58__32__60__32_Key_44__32_S_44__32_A_32__62__32__58__58__32_iter⚠
_verus_external_fn_specification_798_HashMap_32__58__58__32__60__32_Key_44__32_Value_44__32_S_44__32_A_44__32__62__32__58__58__32_entry⚠
_verus_external_fn_specification_799_Entry_32__58__58__32_key⚠
_verus_external_fn_specification_800_Entry_32__58__58__32_or__insert⚠
_verus_external_fn_specification_801_Entry_32__58__58__32_insert__entry⚠
_verus_external_fn_specification_802_OccupiedEntry_32__58__58__32_remove__entry⚠
_verus_external_fn_specification_803_OccupiedEntry_32__58__58__32_get⚠
_verus_external_fn_specification_804_OccupiedEntry_32__58__58__32_get__mut⚠
_verus_external_fn_specification_805_OccupiedEntry_32__58__58__32_into__mut⚠
_verus_external_fn_specification_806_OccupiedEntry_32__58__58__32_insert⚠
_verus_external_fn_specification_807_OccupiedEntry_32__58__58__32_remove⚠
_verus_external_fn_specification_808_VacantEntry_32__58__58__32_into__key⚠
_verus_external_fn_specification_809_VacantEntry_32__58__58__32_insert⚠
_verus_external_fn_specification_810_VacantEntry_32__58__58__32_insert__entry⚠
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_has_resolved_entry
axiom_has_resolved_occupied_entry
axiom_has_resolved_vacant_entry
axiom_hashmap_decreases
axiom_hashmap_deepview_borrow
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_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
into_iter
into_iter_hash_keys
into_iter_keys
into_iter_values
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_len
spec_hash_set_len