let
remove_max (heap: heap) : data =
let
max =
remove_max' heap
in
check heap;
max