Fixpoint lookup_block (bs : list block) (id : block_id) : option nat :=
match bs with
| [] => None
| b :: bs' =>
if Nat.eqb (block_blockid b) id
then Some (block_payload b)
else lookup_block bs' id
end.

(* Specifications: *)
Lemma lookup_block_Some bs id v :
lookup_block bs id = Some v ->
In {| block_blockid := id; block_payload := v |} bs.
Lemma lookup_block_None bs id :
lookup_block bs id = None ->
~ exists v, In {| block_blockid := id; block_payload := v |} bs.