Skip to content
Snippets Groups Projects
Commit c2f832d1 authored by Viktor Kuncak's avatar Viktor Kuncak
Browse files

more examples and a bug

parent b4ad80f9
No related branches found
No related tags found
No related merge requests found
import scala.collection.immutable.Set
import scala.collection.immutable.Multiset
object MultisetOperations {
def disjointUnion2(a: Multiset[Int], b: Multiset[Int]) : Multiset[Int] = {
a +++ b
} ensuring(res => res.toSet == (a.toSet ++ b.toSet))
}
import scala.collection.immutable.Set
import scala.collection.immutable.Multiset
object MultisetOperations {
/*
def disjointUnion1(a: Multiset[Int], b: Multiset[Int]) : Multiset[Int] = {
a +++ b
} ensuring(res => res.size == a.size + b.size)
def preservedUnderToSet1(a: Multiset[Int], b: Multiset[Int]) : Multiset[Int] = {
a ++ b
} ensuring(res => res.toSet == a.toSet ++ b.toSet)
def preservedUnderToSet2(a: Multiset[Int], b: Multiset[Int]) : Multiset[Int] = {
a ** b
} ensuring(res => res.toSet == a.toSet ** b.toSet)
*/
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment