diff --git a/cp-demo/acl2/AbstractMemory.scala b/cp-demo/acl2/AbstractMemory.scala new file mode 100644 index 0000000000000000000000000000000000000000..923e2a450c044922616658831b771136b6848ab0 --- /dev/null +++ b/cp-demo/acl2/AbstractMemory.scala @@ -0,0 +1,31 @@ +import funcheck.Utils._ +import funcheck.Annotations._ + +import cp.Definitions._ + +@spec object AbstractMemory { + // - our maps are already ``canonicalized'' + + def init(): Map[Int,Int] = { + Map.empty[Int,Int] + } + + def write(memory: Map[Int,Int], address: Int, data: Int): Map[Int,Int] = { + memory.updated(address, data) + } + + def read(memory: Map[Int,Int], address: Int): Int = { + require(memory.isDefinedAt(address)) + memory(address) + } + + def writeRead(m: Map[Int,Int], a: Int, d: Int): Boolean = { + (m.updated(a, d))(a) == d + } holds + + def writeIdempotent(m: Map[Int,Int], a: Int, d: Int): Boolean = { + val m2 = m.updated(a, d) + val m3 = m2.updated(a, d) + m2 == m3 + } holds +}