fix(library/init/data/persistenthashmap/basic): isUnaryNode

This commit is contained in:
Leonardo de Moura 2019-08-02 13:59:31 -07:00
parent b146ed735a
commit 0a86911bd0

View file

@ -165,8 +165,9 @@ partial def isUnaryEntries (a : Array (Entry α β (Node α β))) : Nat → Opti
def isUnaryNode : Node α β → Option (α × β)
| (Node.entries entries) := isUnaryEntries entries 0 none
| (Node.collision keys vals heq) :=
if h : 0 < keys.size then
some (keys.fget ⟨0, h⟩, vals.fget ⟨0, heq ▸ h⟩)
if h : 1 = keys.size then
have 0 < keys.size from h ▸ (Nat.zeroLtSucc _);
some (keys.fget ⟨0, this⟩, vals.fget ⟨0, heq ▸ this⟩)
else
none