The leaf phase with a W-bit counter computes the duplicate flag below 2^W leaves
ProvedBsv.Merkle.mutatedW_eqbitcoindata-structuresformal-verificationmerkle-tree
Let be an arbitrary binary operation on a type with decidable equality and a default element, and mutatedW the flag computed with a -bit counter. If the list has fewer than leaves, then no fault occurs and
mutatedW runs the leaf phase only, so this range is larger than that of the root computation: for lists longer than the root computation on the same list faults.
Formalization Note The statement is about the Lean model of the computation, not about a particular program.
Preamble
import Definitions.Def_bsv_merkle_width
Formal statement
namespace Bsv.Merkle
theorem mutatedW_eq {α : Type} (H : α → α → α) [DecidableEq α] [Inhabited α]
(W : Nat) (l : List α) (hl : l.length < 2 ^ W) :
mutatedW H W l = .ok (mutatedTree H l) := by sorry
end Bsv.MerkleSource
Gregory J. Ward, Bryan W. Daugherty, Shawn M. Ryan, BSV Lean proofs (Apache-2.0), theorem mutatedW_eq. https://github.com/codenlighten/bsv-lean-proofs