Updating a map with another map in Dafny
问题 I'd like to write the following function in Dafny, which updates a map m1 with all mappings from m2 , such that m2 overrides m1 : function update_map<K, V>(m1: map<K, V>, m2: map<K, V>): map<K, V> ensures (forall k :: k in m2 ==> update_map(m1, m2)[k] == m2[k]) && (forall k :: !(k in m2) && k in m1 ==> update_map(m1, m2)[k] == m1[k]) && (forall k :: !(k in m2) && !(k in m1) ==> !(k in update_map(m1, m2))) { map k | (k in m1 || k in m2) :: if k in m2 then m2[k] else m1[k] } I got the following