silver icon indicating copy to clipboard operation
silver copied to clipboard

Assert needed to prove set cardinality of intersection over union

Open viper-admin opened this issue 9 years ago • 0 comments

Created by @mschwerhoff on 2016-01-13 13:17

#!text

method test01(xs: Set[Int], ys: Set[Int], z: Int) {
	inhale |xs intersection ys| == 0
	inhale |xs intersection Set(z)| == 0
	exhale |xs intersection (ys union Set(z))| == 0 // Unexpectedly fails
}

method test02(xs: Set[Int], ys: Set[Int], z: Int) {
	inhale |xs intersection ys| == 0
	inhale |xs intersection Set(z)| == 0

  // Allows proving the final exhale
	assert    xs intersection (ys union Set(z))
	       == (xs intersection ys) union (xs intersection Set(z))

	exhale |xs intersection (ys union Set(z))| == 0
}

viper-admin avatar Jan 13 '16 13:01 viper-admin