Fixpoint get_first_None (limit:nat) (s: ENTROPY.stream): nat :=
  match limit with
    | O => O (* bogus *)
    | S limit' =>
      match s O with
        | None => O
        | Some _ => S (get_first_None limit' (fun i => s (S i)))
      end
  end
.

Lemma get_first_None_limit: forall k s i, i = get_first_None k s -> (i <= k)%nat.