Skip to main content

hash_set_remove_ensures

Function hash_set_remove_ensures 

Source
pub open spec fn hash_set_remove_ensures<Key: Borrow<Q> + Hash + Eq, S: BuildHasher, A: Allocator, Q: Hash + Eq + ?Sized>(
    old_m: &HashSet<Key, S, A>,
    final_m: &HashSet<Key, S, A>,
    k: &Q,
    result: bool,
) -> bool
Expand description
{
    ({
        &&& obeys_key_model::<Key>()
        &&& obeys_key_model::<Q>()
        &&& builds_valid_hashers::<S>()
        &&& <Key as BorrowSpec<Q>>::obeys_borrow_spec()
        &&& hash_set_inv(old_m)

    })
        ==> {
            &&& hash_set_inv(final_m)
            &&& if result {
                exists |key: Key| {
                    &&& #[trigger] old_m@.contains(key)
                    &&& k.eq_spec(<Key as BorrowSpec<Q>>::borrow_spec(&key))
                    &&& final_m@ == old_m@.remove(key)

                }
            } else {
                &&& forall |key: Key| (
                    #[trigger] old_m@.contains(key)
                        ==> !k.eq_spec(<Key as BorrowSpec<Q>>::borrow_spec(&key))
                )
                &&& final_m@ == old_m@

            }

        }
}