Check if a root and database are an MMP encoding of a finite map from byte arrays to byte arrays.
This is a declarative, non-executable definition,
which essentially characterizes the image of mmp-encode
(over finite maps that can be encoded,
i.e. such that mmp-encode returns a
The reason is the following. mmp-encode produces the minimum database that suffices to encode the map. However, it seems reasonable that there is one global database [YP:D.1] [YP:4.1], used to encode a variety of finite maps in the Ethereum state. Thus, given a root and the global database, we can say that they together encode a finite map, even though the database may be larger then needed to encode the map.
Theorem:
(defthm mmp-encoding-p-suff (implies (and (bytelist-bytelist-mapp map) (b* (((mv map-error? map-root map-database) (mmp-encode map))) (and (not map-error?) (equal map-root (byte-list-fix root)) (omap::submap map-database (database-fix database))))) (mmp-encoding-p root database)))
Theorem:
(defthm booleanp-of-mmp-encoding-p (b* ((yes/no (mmp-encoding-p root database))) (booleanp yes/no)) :rule-classes :rewrite)
Theorem:
(defthm mmp-encoding-p-of-byte-list-fix-root (equal (mmp-encoding-p (byte-list-fix root) database) (mmp-encoding-p root database)))
Theorem:
(defthm mmp-encoding-p-byte-list-equiv-congruence-on-root (implies (byte-list-equiv root root-equiv) (equal (mmp-encoding-p root database) (mmp-encoding-p root-equiv database))) :rule-classes :congruence)
Theorem:
(defthm mmp-encoding-p-of-database-fix-database (equal (mmp-encoding-p root (database-fix database)) (mmp-encoding-p root database)))
Theorem:
(defthm mmp-encoding-p-database-equiv-congruence-on-database (implies (database-equiv database database-equiv) (equal (mmp-encoding-p root database) (mmp-encoding-p root database-equiv))) :rule-classes :congruence)