Library MonadVM.Bloom

File generated by rocq-of-ocaml
Require Import RocqOfOCaml.RocqOfOCaml.
Require Import RocqOfOCaml.Settings.

Require MonadVM.Byte_string.
Require MonadVM.Crypto.

Require Import MonadVM.Support.Variants.
Require MonadVM.Support.CryptoBlake2.
Require Import RocqOfOCaml.Opaque.
Local Ltac _rocq_witness_type typ :=
  let typ := eval hnf in typ in
  lazymatch typ with
  | list ?a ⇒ let a := _rocq_witness_type a in constr:(list a)
  | option ?a ⇒ let a := _rocq_witness_type a in constr:(option a)
  | prod ?a ?b ⇒ let a := _rocq_witness_type a in
      let b := _rocq_witness_type b in constr:(prod a b)
  | sum ?a ?b ⇒ let a := _rocq_witness_type a in
      let b := _rocq_witness_type b in constr:(sum a b)
  | ?a → ?b ⇒ let a := _rocq_witness_type a in
      let b := _rocq_witness_type b in constr:(a → b)
  | _ ⇒ typ
  end.
Inclusion of the module MonadVM.Byte_string.B256
Definition byte_width :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.byte_width).

Module Impl.
  Definition t :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Impl).(MonadVM.Byte_string.Fixed.Impl.Impl_signature.t).

  Definition of_bytes :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Impl).(MonadVM.Byte_string.Fixed.Impl.Impl_signature.of_bytes).

  Definition init :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Impl).(MonadVM.Byte_string.Fixed.Impl.Impl_signature.init).
End Impl.

Definition Impl :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Impl).

Definition t :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.t).

Definition of_bytes :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.of_bytes).

Definition init :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.init).

Definition make :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.make).

Definition zeros :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.zeros).

Definition ones :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.ones).

Definition of_bytes_exn :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.of_bytes_exn).

Definition to_bytes :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.to_bytes).

Definition to_seq :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.to_seq).

Definition fold_left {A : Set} : (A → ascii → A) → A → t → A :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.fold_left).

Definition fold_right {A : Set} : (ascii → A → A) → t → A → A :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.fold_right).

Definition starts_with :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.starts_with).

Definition op_pointdollarlparenrparen :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.op_pointdollarlparenrparen).

Definition map :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.map).

Definition mapi :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.mapi).

Definition iter :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.iter).

Definition iteri :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.iteri).

Definition for_all :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.for_all).

Definition _exists :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._exists).

Definition reverse :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.reverse).

Definition sub :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.sub).

Definition sub_with_zero_padding :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.sub_with_zero_padding).

Definition to_hex_string :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.to_hex_string).

Definition to_short_hex_string :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.to_short_hex_string).

Definition of_hex_string :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.of_hex_string).

Definition op_tildeat :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.op_tildeat).

Definition comparison_op :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.comparison_op).

Definition op_lt :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.op_lt).

Definition op_lteq :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.op_lteq).

Definition op_eq :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.op_eq).

Definition op_gteq :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.op_gteq).

Definition op_gt :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.op_gt).

Definition op_ltgt :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.op_ltgt).

Definition equal :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.equal).

Definition compare :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.compare).

Definition max :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.max).

Definition min :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.min).

Module _Set.
  Definition elt :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.elt).

  Definition t :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.t).

  Definition empty :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.empty).

  Definition add :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.add).

  Definition singleton :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.singleton).

  Definition remove :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.remove).

  Definition union :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.union).

  Definition inter :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.inter).

  Definition disjoint :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.disjoint).

  Definition diff :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.diff).

  Definition cardinal :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.cardinal).

  Definition elements :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.elements).

  Definition min_elt
    (_rocq_fallback_arg_0 :
      ltac:(let typ := constr:(ltac:(first [unshelve refine ((elt)%type
      )]; first [match goal with |- ?g ⇒ let sort := type of g in lazymatch sort with Set ⇒ fail | _ ⇒ shelve end end | eassumption | typeclasses eauto | RocqOfOCaml.Opaque.opaque_inhabit 64%nat])) in let typ := _rocq_witness_type typ in exact typ))
    :=
    (MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.min_elt)
      (H := RocqOfOCaml.Opaque.legacy_witness _rocq_fallback_arg_0)).

  Definition min_elt_opt :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.min_elt_opt).

  Definition max_elt
    (_rocq_fallback_arg_0 :
      ltac:(let typ := constr:(ltac:(first [unshelve refine ((elt)%type
      )]; first [match goal with |- ?g ⇒ let sort := type of g in lazymatch sort with Set ⇒ fail | _ ⇒ shelve end end | eassumption | typeclasses eauto | RocqOfOCaml.Opaque.opaque_inhabit 64%nat])) in let typ := _rocq_witness_type typ in exact typ))
    :=
    (MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.max_elt)
      (H := RocqOfOCaml.Opaque.legacy_witness _rocq_fallback_arg_0)).

  Definition max_elt_opt :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.max_elt_opt).

  Definition choose
    (_rocq_fallback_arg_0 :
      ltac:(let typ := constr:(ltac:(first [unshelve refine ((elt)%type
      )]; first [match goal with |- ?g ⇒ let sort := type of g in lazymatch sort with Set ⇒ fail | _ ⇒ shelve end end | eassumption | typeclasses eauto | RocqOfOCaml.Opaque.opaque_inhabit 64%nat])) in let typ := _rocq_witness_type typ in exact typ))
    :=
    (MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.choose)
      (H := RocqOfOCaml.Opaque.legacy_witness _rocq_fallback_arg_0)).

  Definition choose_opt :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.choose_opt).

  Definition find
    (_rocq_fallback_arg_0 :
      ltac:(let typ := constr:(ltac:(first [unshelve refine ((elt)%type
      )]; first [match goal with |- ?g ⇒ let sort := type of g in lazymatch sort with Set ⇒ fail | _ ⇒ shelve end end | eassumption | typeclasses eauto | RocqOfOCaml.Opaque.opaque_inhabit 64%nat])) in let typ := _rocq_witness_type typ in exact typ))
    :=
    (MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.find)
      (H := RocqOfOCaml.Opaque.legacy_witness _rocq_fallback_arg_0)).

  Definition find_opt :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.find_opt).

  Definition find_first
    (_rocq_fallback_arg_0 :
      ltac:(let typ := constr:(ltac:(first [unshelve refine ((elt)%type
      )]; first [match goal with |- ?g ⇒ let sort := type of g in lazymatch sort with Set ⇒ fail | _ ⇒ shelve end end | eassumption | typeclasses eauto | RocqOfOCaml.Opaque.opaque_inhabit 64%nat])) in let typ := _rocq_witness_type typ in exact typ))
    :=
    (MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.find_first)
      (H := RocqOfOCaml.Opaque.legacy_witness _rocq_fallback_arg_0)).

  Definition find_first_opt :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.find_first_opt).

  Definition find_last
    (_rocq_fallback_arg_0 :
      ltac:(let typ := constr:(ltac:(first [unshelve refine ((elt)%type
      )]; first [match goal with |- ?g ⇒ let sort := type of g in lazymatch sort with Set ⇒ fail | _ ⇒ shelve end end | eassumption | typeclasses eauto | RocqOfOCaml.Opaque.opaque_inhabit 64%nat])) in let typ := _rocq_witness_type typ in exact typ))
    :=
    (MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.find_last)
      (H := RocqOfOCaml.Opaque.legacy_witness _rocq_fallback_arg_0)).

  Definition find_last_opt :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.find_last_opt).

  Definition iter :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.iter).

  Definition fold {acc : Set} : (elt → acc → acc) → t → acc → acc :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.fold).

  Definition map :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.map).

  Definition filter :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.filter).

  Definition filter_map :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.filter_map).

  Definition partition :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.partition).

  Definition split :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.split).

  Definition is_empty :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.is_empty).

  Definition is_singleton :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.is_singleton).

  Definition mem :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.mem).

  Definition equal :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.equal).

  Definition compare :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.compare).

  Definition subset :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.subset).

  Definition for_all :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.for_all).

  Definition _exists :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S._exists).

  Definition to_list :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.to_list).

  Definition of_list :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.of_list).

  Definition to_seq_from :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.to_seq_from).

  Definition to_seq :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.to_seq).

  Definition to_rev_seq :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.to_rev_seq).

  Definition add_seq :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.add_seq).

  Definition of_seq :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.of_seq).
End _Set.

Definition _Set :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).

Module Map.
  Definition key :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.key).

  Definition t (a : Set) :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.t)
      a.

  Definition empty {a : Set} : t a :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.empty).

  Definition add {a : Set} : key → a → t a → t a :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.add).

  Definition add_to_list {a : Set} : key → a → t (list a) → t (list a) :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.add_to_list).

  Definition update {a : Set} : key → (option a → option a) → t a → t a :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.update).

  Definition singleton {a : Set} : key → a → t a :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.singleton).

  Definition remove {a : Set} : key → t a → t a :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.remove).

  Definition merge {a b c : Set} :
    (key → option a → option b → option c) → t a → t b → t c :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.merge).

  Definition union {a : Set} : (key → a → a → option a) → t a → t a → t a
    :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.union).

  Definition cardinal {a : Set} : t a → int :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.cardinal).

  Definition bindings {a : Set} : t a → list (key × a) :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.bindings).

  Definition min_binding {a : Set}
    (_rocq_fallback_arg_0 :
      ltac:(let typ := constr:(ltac:(first [unshelve refine ((key × a)%type
      )]; first [match goal with |- ?g ⇒ let sort := type of g in lazymatch sort with Set ⇒ fail | _ ⇒ shelve end end | eassumption | typeclasses eauto | RocqOfOCaml.Opaque.opaque_inhabit 64%nat])) in let typ := _rocq_witness_type typ in exact typ))
    : t a → key × a :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.min_binding)
      (_rocq_fallback_arg_0).

  Definition min_binding_opt {a : Set} : t a → option (key × a) :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.min_binding_opt).

  Definition max_binding {a : Set}
    (_rocq_fallback_arg_0 :
      ltac:(let typ := constr:(ltac:(first [unshelve refine ((key × a)%type
      )]; first [match goal with |- ?g ⇒ let sort := type of g in lazymatch sort with Set ⇒ fail | _ ⇒ shelve end end | eassumption | typeclasses eauto | RocqOfOCaml.Opaque.opaque_inhabit 64%nat])) in let typ := _rocq_witness_type typ in exact typ))
    : t a → key × a :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.max_binding)
      (_rocq_fallback_arg_0).

  Definition max_binding_opt {a : Set} : t a → option (key × a) :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.max_binding_opt).

  Definition choose {a : Set}
    (_rocq_fallback_arg_0 :
      ltac:(let typ := constr:(ltac:(first [unshelve refine ((key × a)%type
      )]; first [match goal with |- ?g ⇒ let sort := type of g in lazymatch sort with Set ⇒ fail | _ ⇒ shelve end end | eassumption | typeclasses eauto | RocqOfOCaml.Opaque.opaque_inhabit 64%nat])) in let typ := _rocq_witness_type typ in exact typ))
    : t a → key × a :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.choose)
      (_rocq_fallback_arg_0).

  Definition choose_opt {a : Set} : t a → option (key × a) :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.choose_opt).

  Definition find {a : Set}
    (_rocq_fallback_arg_0 :
      ltac:(let typ := constr:(ltac:(first [unshelve refine ((a)%type
      )]; first [match goal with |- ?g ⇒ let sort := type of g in lazymatch sort with Set ⇒ fail | _ ⇒ shelve end end | eassumption | typeclasses eauto | RocqOfOCaml.Opaque.opaque_inhabit 64%nat])) in let typ := _rocq_witness_type typ in exact typ))
    : key → t a → a :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.find)
      (_rocq_fallback_arg_0).

  Definition find_opt {a : Set} : key → t a → option a :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.find_opt).

  Definition find_first {a : Set}
    (_rocq_fallback_arg_0 :
      ltac:(let typ := constr:(ltac:(first [unshelve refine ((key × a)%type
      )]; first [match goal with |- ?g ⇒ let sort := type of g in lazymatch sort with Set ⇒ fail | _ ⇒ shelve end end | eassumption | typeclasses eauto | RocqOfOCaml.Opaque.opaque_inhabit 64%nat])) in let typ := _rocq_witness_type typ in exact typ))
    : (key → bool) → t a → key × a :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.find_first)
      (_rocq_fallback_arg_0).

  Definition find_first_opt {a : Set} : (key → bool) → t a → option (key × a)
    :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.find_first_opt).

  Definition find_last {a : Set}
    (_rocq_fallback_arg_0 :
      ltac:(let typ := constr:(ltac:(first [unshelve refine ((key × a)%type
      )]; first [match goal with |- ?g ⇒ let sort := type of g in lazymatch sort with Set ⇒ fail | _ ⇒ shelve end end | eassumption | typeclasses eauto | RocqOfOCaml.Opaque.opaque_inhabit 64%nat])) in let typ := _rocq_witness_type typ in exact typ))
    : (key → bool) → t a → key × a :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.find_last)
      (_rocq_fallback_arg_0).

  Definition find_last_opt {a : Set} : (key → bool) → t a → option (key × a)
    :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.find_last_opt).

  Definition iter {a : Set} : (key → a → unit) → t a → unit :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.iter).

  Definition fold {a acc : Set} : (key → a → acc → acc) → t a → acc → acc
    :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.fold).

  Definition map {a b : Set} : (a → b) → t a → t b :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.map).

  Definition mapi {a b : Set} : (key → a → b) → t a → t b :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.mapi).

  Definition filter {a : Set} : (key → a → bool) → t a → t a :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.filter).

  Definition filter_map {a b : Set} : (key → a → option b) → t a → t b :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.filter_map).

  Definition partition {a : Set} : (key → a → bool) → t a → t a × t a :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.partition).

  Definition split {a : Set} : key → t a → t a × option a × t a :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.split).

  Definition is_empty {a : Set} : t a → bool :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.is_empty).

  Definition is_singleton {a : Set} : t a → bool :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.is_singleton).

  Definition mem {a : Set} : key → t a → bool :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.mem).

  Definition equal {a : Set} : (a → a → bool) → t a → t a → bool :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.equal).

  Definition compare {a : Set} : (a → a → int) → t a → t a → int :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.compare).

  Definition for_all {a : Set} : (key → a → bool) → t a → bool :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.for_all).

  Definition _exists {a : Set} : (key → a → bool) → t a → bool :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature._exists).

  Definition to_list {a : Set} : t a → list (key × a) :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.to_list).

  Definition of_list {a : Set} : list (key × a) → t a :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.of_list).

  Definition to_seq {a : Set} : t a → RocqOfOCaml.OCamlSeq.t (key × a) :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.to_seq).

  Definition to_rev_seq {a : Set} : t a → RocqOfOCaml.OCamlSeq.t (key × a) :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.to_rev_seq).

  Definition to_seq_from {a : Set} :
    key → t a → RocqOfOCaml.OCamlSeq.t (key × a) :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.to_seq_from).

  Definition add_seq {a : Set} : RocqOfOCaml.OCamlSeq.t (key × a) → t a → t a
    :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.add_seq).

  Definition of_seq {a : Set} : RocqOfOCaml.OCamlSeq.t (key × a) → t a :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.of_seq).

  Definition _at {v : Set} : key → Lens.t (t v) (option v) :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature._at).

  Definition keys {a : Set} :
    t a →
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result._Set).(RocqOfOCaml.OCamlSet.S.t)
    :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.keys).

  Definition difference {a d : Set} :
    (option a → option a → option d) → t a → t a → t d :=
    MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).(MonadVM.Byte_string.Fixed.Map.Map_signature.difference).
End Map.

Definition Map :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.Map).

Definition lift_bytewise :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.lift_bytewise).

Definition logand :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.logand).

Definition logxor :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.logxor).

Definition lognot :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.lognot).

Definition intersection :=
  MonadVM.Byte_string.B256.(MonadVM.Byte_string.Fixed.Fixed_result.intersection).

logor b1 b2 computes the bitwise OR of b1 and b2.
Definition logor (b1 : string) (b2 : string) : string :=
  init
    (fun (i_value : int) ⇒
      RocqOfOCaml.OCamlChar.unsafe_chr
        (RocqOfOCaml.OCamlInt.logor
          (RocqOfOCaml.OCamlChar.code (op_pointdollarlparenrparen b1 i_value))
          (RocqOfOCaml.OCamlChar.code (op_pointdollarlparenrparen b2 i_value)))).

union bs returns the bitwise OR of all the logs in the sequence bs, or zero if it is empty.
set_bit b i returns b with its i-th bit set to 1. i must be in the range \[0], [2048]).
Definition _rocq_fallback_set_bit_0 (bit_index : int) :
  ltac:(let typ := constr:(ltac:(first [unshelve refine ((int)%type
  )]; first [match goal with |- ?g ⇒ let sort := type of g in lazymatch sort with Set ⇒ fail | _ ⇒ shelve end end | eassumption | typeclasses eauto | RocqOfOCaml.Opaque.opaque_inhabit 64%nat])) in let typ := _rocq_witness_type typ in exact typ).
Proof. unshelve (RocqOfOCaml.Opaque.opaque_inhabit 64%nat). all: RocqOfOCaml.Opaque.opaque_inhabit 64%nat. Qed.

Definition set_bit (bloom : string) (bit_index : int) : string :=
  let byte_index :=
    (RocqOfOCaml.OCamlInt.div
      (H := RocqOfOCaml.Opaque.legacy_witness (_rocq_fallback_set_bit_0 bit_index)))
      bit_index 8 in
  let bit_index :=
    (RocqOfOCaml.OCamlInt.rem
      (H := RocqOfOCaml.Opaque.legacy_witness (_rocq_fallback_set_bit_0 bit_index)))
      bit_index 8 in
  init
    (fun (i_value : int) ⇒
      if Z.eqb i_value byte_index then
        RocqOfOCaml.OCamlChar.unsafe_chr
          (RocqOfOCaml.OCamlInt.logor
            (RocqOfOCaml.OCamlChar.code
              (op_pointdollarlparenrparen bloom i_value))
            (RocqOfOCaml.OCamlInt.shift_right_logical 128 bit_index))
      else
        op_pointdollarlparenrparen bloom i_value).

test_bit b i returns true if the i-th bit of b is set. i must be in the range \[0], [2048]).
Definition test_bit (bloom : string) (bit_index : int) : bool :=
  let byte_index :=
    (RocqOfOCaml.OCamlInt.div
      (H := RocqOfOCaml.Opaque.legacy_witness (_rocq_fallback_set_bit_0 bit_index)))
      bit_index 8 in
  let bit_index :=
    (RocqOfOCaml.OCamlInt.rem
      (H := RocqOfOCaml.Opaque.legacy_witness (_rocq_fallback_set_bit_0 bit_index)))
      bit_index 8 in
  RocqOfOCaml.OCamlInt.not_equal
    (RocqOfOCaml.OCamlInt.logand
      (RocqOfOCaml.OCamlChar.code (op_pointdollarlparenrparen bloom byte_index))
      (RocqOfOCaml.OCamlInt.shift_left 1 bit_index)) 0.

Digest an arbitrary byte-string into a Bloom filter by computing M\{3:2048\} in YP (31), YP (32), YP (33), YP (34).
Definition hash_bytes (bytes_value : MonadVM.Byte_string.Bytes.t) : string :=
  let of_bit_indices (indices : list int) : string :=
    RocqOfOCaml.OCamlList.fold_left set_bit zeros indices in
  let byte_pair_at (bytes_value : string) (index : int) : int :=
    let b0 :=
      MonadVM.Byte_string.B32.(MonadVM.Byte_string.Fixed.Fixed_result.op_pointdollarlparenrparen)
        bytes_value index in
    let b1 :=
      MonadVM.Byte_string.B32.(MonadVM.Byte_string.Fixed.Fixed_result.op_pointdollarlparenrparen)
        bytes_value (RocqOfOCaml.OCamlInt.add index 1) in
    RocqOfOCaml.OCamlInt.add
      (RocqOfOCaml.OCamlInt.shift_left (RocqOfOCaml.OCamlChar.code b0) 8)
      (RocqOfOCaml.OCamlChar.code b1) in
  let hashed_bytes := MonadVM.Crypto.keccak_256 bytes_value in
  of_bit_indices
    (RocqOfOCaml.OCamlList.map
      (fun (i_value : int) ⇒
        let bp := byte_pair_at hashed_bytes i_value in
        RocqOfOCaml.OCamlInt.sub 2047 (RocqOfOCaml.OCamlInt.logand bp 2047))
      (Datatypes.cons 0 (Datatypes.cons 2 (Datatypes.cons 4 nil)))).