Skip to main content

key_fn_deterministic_on

Function key_fn_deterministic_on 

Source
pub open spec fn key_fn_deterministic_on<T, K, F: FnMut(&T) -> K>(f: F, s: Seq<T>) -> bool
Expand description
{
    forall |i: int, k1: K, k2: K| {
        0 <= i < s.len() && call_ensures(f, (&s[i],), k1)
            && call_ensures(f, (&s[i],), k2) ==> k1 == k2
    }
}

f returns the same key for the same element (std’s sort_by_key calls it more than once)