Check if a key tree complies with the BIP 44 wallet structure.
(bip44-compliant-tree-p tree) → yes/no
We require the tree to start with the master private key (depth 0), to include the purpose key, to have compliant subtrees for any supported coins, and to not exceed depth 5.
Function:
(defun bip44-compliant-tree-p (tree) (declare (xargs :guard (bip32-key-treep tree))) (and (equal 0 (bip32-key-tree->root-depth tree)) (bip32-key-tree-priv-p tree) (bip43-key-tree-has-purpose-p tree *bip44-purpose*) (bip44-compliant-coins-p tree) (bip44-compliant-depth-p tree)))
Theorem:
(defthm booleanp-of-bip44-compliant-tree-p (b* ((yes/no (bip44-compliant-tree-p tree))) (booleanp yes/no)) :rule-classes :rewrite)
Theorem:
(defthm bip44-compliant-tree-p-of-bip32-key-tree-fix-tree (equal (bip44-compliant-tree-p (bip32-key-tree-fix tree)) (bip44-compliant-tree-p tree)))
Theorem:
(defthm bip44-compliant-tree-p-bip32-key-tree-equiv-congruence-on-tree (implies (bip32-key-tree-equiv tree tree-equiv) (equal (bip44-compliant-tree-p tree) (bip44-compliant-tree-p tree-equiv))) :rule-classes :congruence)