Check if the coin keys under the purpose key in a tree comply with the BIP 44 wallet structure, for a given set of coin types.
This is similar to bip44-compliant-addresses-for-limit-p, but instead of an address limit we have a set of coin types. We require that there is a coin key in the tree exactly for each coin type in the given set. Furthermore, we require, for each such coin key, its children account keys to be compliant with the BIP 44 wallet structure.
Following [BIP44], we require each coin key to be hardened.
Theorem:
(defthm bip44-compliant-coins-for-set-p-necc (implies (bip44-compliant-coins-for-set-p tree coins) (implies (ubyte32p coin-index) (b* ((path (list (+ *bip44-purpose* (expt 2 31)) coin-index))) (cond ((< coin-index (expt 2 31)) (not (bip32-path-in-tree-p path tree))) ((in (- coin-index (expt 2 31)) (bip44-coin-type-set-fix coins)) (and (bip32-path-in-tree-p path tree) (bip44-compliant-accounts-p tree coin-index))) (t (not (bip32-path-in-tree-p path tree))))))))
Theorem:
(defthm booleanp-of-bip44-compliant-coins-for-set-p (b* ((yes/no (bip44-compliant-coins-for-set-p tree coins))) (booleanp yes/no)) :rule-classes :rewrite)
Theorem:
(defthm bip44-compliant-coins-for-set-p-of-bip32-key-tree-fix-tree (equal (bip44-compliant-coins-for-set-p (bip32-key-tree-fix tree) coins) (bip44-compliant-coins-for-set-p tree coins)))
Theorem:
(defthm bip44-compliant-coins-for-set-p-bip32-key-tree-equiv-congruence-on-tree (implies (bip32-key-tree-equiv tree tree-equiv) (equal (bip44-compliant-coins-for-set-p tree coins) (bip44-compliant-coins-for-set-p tree-equiv coins))) :rule-classes :congruence)
Theorem:
(defthm bip44-compliant-coins-for-set-p-of-bip44-coin-type-set-fix-coins (equal (bip44-compliant-coins-for-set-p tree (bip44-coin-type-set-fix coins)) (bip44-compliant-coins-for-set-p tree coins)))
Theorem:
(defthm bip44-compliant-coins-for-set-p-bip44-coin-type-set-equiv-congruence-on-coins (implies (bip44-coin-type-set-equiv coins coins-equiv) (equal (bip44-compliant-coins-for-set-p tree coins) (bip44-compliant-coins-for-set-p tree coins-equiv))) :rule-classes :congruence)