Created
April 2, 2019 08:27
-
-
Save Gorzen/c451937ebac8d3578a7ba3258a4f07e7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def lemma_leftIdentity(x: MMap[String, BigInt]): Boolean = { | |
(append(empty, x) == x) because { | |
assert(append(empty, x) == append(MMap.empty, x)) | |
assert(append(MMap.empty, x) == MMap.empty.merge(x)) | |
assert(MMap.empty.merge(x) == MMap{ k: String => | |
M.append(MMap.empty.apply(k), x.apply(k)) | |
}) | |
assert(MMap{ k: String => | |
M.append(MMap.empty.apply(k), x.apply(k)) | |
} == MMap{ k: String => | |
M.append(M.empty, x.apply(k)) | |
}) | |
assert(MMap{ k: String => | |
M.append(M.empty, x.apply(k)) | |
} == MMap{ k: String => | |
M.law_leftIdentity(x.apply(k)) | |
M.append(M.empty, x.apply(k)) | |
}) | |
assert(MMap{ k: String => | |
M.law_leftIdentity(x.apply(k)) | |
M.append(M.empty, x.apply(k)) | |
} == MMap{ k: String => | |
x.apply(k) | |
}) | |
assert(MMap{ k: String => | |
x.apply(k) | |
} == x) | |
check(append(empty, x) == x) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment