If you found this interesting, you may also be interested in this post about formally proving Merkle data structures