Skip to main content

💾 Storage_generated.v

Proofs

Gitlab , OCaml

Require Import CoqOfOCaml.CoqOfOCaml.
Require Import CoqOfOCaml.Settings.

This file is automatically generated, do not edit it by hand

Require Import TezosOfOCaml.Environment.V7.
Require TezosOfOCaml.Proto_alpha.Storage.

Require TezosOfOCaml.Proto_alpha.Simulations.Raw_context.

(* abreviations to avoid implicits inference errors *)
Notation of_functors_index := Raw_context.of_functors_index.
Notation of_description_index := Raw_context.of_description_index.
Notation of_lazy_storage_kind_id_index :=
  Raw_context.of_lazy_storage_kind_id_index.

Module Block_round.
  Module Helpers.
    Definition get (ctxt : Raw_context.t) :=
      ctxt
        .(Raw_context.Block_round).
    Arguments get _ /.

    Definition set (ctxt : Raw_context.t) value :=
      let ctxt' := ctxt <| Raw_context.Block_round := value |> in
      (Raw_context.to_t ctxt').
    Arguments set _ _ /.

    Definition name := ["block_round"].
  End Helpers.

  Axiom get : (ctxt : Raw_context.t),
    Storage.Block_round
      .(Storage.Simple_single_data_storage.get)
      (Raw_context.to_t ctxt) =
    match Helpers.get ctxt with
    | Some xPervasives.Ok x
    | None

        Raw_context.storage_error_value
          (Raw_context.Missing_key Helpers.name Raw_context.Get)
    end.

  Axiom update : (ctxt : Raw_context.t) value,
   Storage.Block_round
      .(Storage.Simple_single_data_storage.update)
      (Raw_context.to_t ctxt) value =
    match Helpers.get ctxt with
    | Some _
        return? Helpers.set ctxt (Some value)
    | None

        Raw_context.storage_error_value
          (Raw_context.Existing_key Helpers.name)
    end.

  Axiom init_value : (ctxt : Raw_context.t) value,
   Storage.Block_round
      .(Storage.Simple_single_data_storage.init_value)
      (Raw_context.to_t ctxt) value =
    match Helpers.get ctxt with
    | None
        return? Helpers.set ctxt (Some value)
    | Some _

        Raw_context.storage_error_value
          (Raw_context.Existing_key Helpers.name)
    end.

  #[global] Hint Rewrite get update init_value : storage_db.
  #[global] Opaque Storage.Block_round.
End Block_round.

Module Tenderbake.
  Module First_level_of_protocol.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Tenderbake_First_level_of_protocol).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Tenderbake_First_level_of_protocol := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition name := ["first_level_of_protocol"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t),
      Storage.Tenderbake.First_level_of_protocol
        .(Storage_sigs.Single_data_storage.mem)
        (Raw_context.to_t ctxt) =
       match Helpers.get ctxt with
        | Some _true
        | Nonefalse

        end.

    Axiom get : (ctxt : Raw_context.t),
      Storage.Tenderbake.First_level_of_protocol
        .(Storage_sigs.Single_data_storage.get)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some xPervasives.Ok x
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t),
      Storage.Tenderbake.First_level_of_protocol
        .(Storage_sigs.Single_data_storage.find)
        (Raw_context.to_t ctxt) =
      return? Helpers.get ctxt.

    Axiom init_value : (ctxt : Raw_context.t) value,
      Storage.Tenderbake.First_level_of_protocol
        .(Storage_sigs.Single_data_storage.init_value)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | None
          return? Helpers.set ctxt (Some value)
      | Some _

          Raw_context.storage_error_value
            (Raw_context.Existing_key Helpers.name)
      end.

    Axiom update : (ctxt : Raw_context.t) value,
      Storage.Tenderbake.First_level_of_protocol
        .(Storage_sigs.Single_data_storage.update)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt (Some value)
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context._Set)
      end.

    Axiom add : (ctxt : Raw_context.t) value,
      Storage.Tenderbake.First_level_of_protocol
        .(Storage_sigs.Single_data_storage.add)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt (Some value)
      | None ⇒ (Raw_context.to_t ctxt)
      end.

    Axiom add_or_remove : (ctxt : Raw_context.t) value,
      Storage.Tenderbake.First_level_of_protocol
        .(Storage_sigs.Single_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) value =
        Helpers.set ctxt value.

    Axiom remove_existing : (ctxt : Raw_context.t),
      Storage.Tenderbake.First_level_of_protocol
        .(Storage_sigs.Single_data_storage.remove_existing)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt None
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : (ctxt : Raw_context.t),
      Storage.Tenderbake.First_level_of_protocol
        .(Storage_sigs.Single_data_storage.remove)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt None
      | NoneRaw_context.to_t ctxt
      end.

    #[global] Hint Rewrite mem get find init_value update add
      add_or_remove remove_existing remove : storage_db.
    #[global] Opaque Storage.Tenderbake.First_level_of_protocol.
  End First_level_of_protocol.

  Module Endorsement_branch.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Tenderbake_Endorsement_branch).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Tenderbake_Endorsement_branch := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition name := ["endorsement_branch"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t),
      Storage.Tenderbake.Endorsement_branch
        .(Storage_sigs.Single_data_storage.mem)
        (Raw_context.to_t ctxt) =
       match Helpers.get ctxt with
        | Some _true
        | Nonefalse

        end.

    Axiom get : (ctxt : Raw_context.t),
      Storage.Tenderbake.Endorsement_branch
        .(Storage_sigs.Single_data_storage.get)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some xPervasives.Ok x
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t),
      Storage.Tenderbake.Endorsement_branch
        .(Storage_sigs.Single_data_storage.find)
        (Raw_context.to_t ctxt) =
      return? Helpers.get ctxt.

    Axiom init_value : (ctxt : Raw_context.t) value,
      Storage.Tenderbake.Endorsement_branch
        .(Storage_sigs.Single_data_storage.init_value)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | None
          return? Helpers.set ctxt (Some value)
      | Some _

          Raw_context.storage_error_value
            (Raw_context.Existing_key Helpers.name)
      end.

    Axiom update : (ctxt : Raw_context.t) value,
      Storage.Tenderbake.Endorsement_branch
        .(Storage_sigs.Single_data_storage.update)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt (Some value)
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context._Set)
      end.

    Axiom add : (ctxt : Raw_context.t) value,
      Storage.Tenderbake.Endorsement_branch
        .(Storage_sigs.Single_data_storage.add)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt (Some value)
      | None ⇒ (Raw_context.to_t ctxt)
      end.

    Axiom add_or_remove : (ctxt : Raw_context.t) value,
      Storage.Tenderbake.Endorsement_branch
        .(Storage_sigs.Single_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) value =
        Helpers.set ctxt value.

    Axiom remove_existing : (ctxt : Raw_context.t),
      Storage.Tenderbake.Endorsement_branch
        .(Storage_sigs.Single_data_storage.remove_existing)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt None
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : (ctxt : Raw_context.t),
      Storage.Tenderbake.Endorsement_branch
        .(Storage_sigs.Single_data_storage.remove)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt None
      | NoneRaw_context.to_t ctxt
      end.

    #[global] Hint Rewrite mem get find init_value update add
      add_or_remove remove_existing remove : storage_db.
    #[global] Opaque Storage.Tenderbake.Endorsement_branch.
  End Endorsement_branch.

  Module Grand_parent_branch.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Tenderbake_Grand_parent_branch).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Tenderbake_Grand_parent_branch := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition name := ["grand_parent_branch"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t),
      Storage.Tenderbake.Grand_parent_branch
        .(Storage_sigs.Single_data_storage.mem)
        (Raw_context.to_t ctxt) =
       match Helpers.get ctxt with
        | Some _true
        | Nonefalse

        end.

    Axiom get : (ctxt : Raw_context.t),
      Storage.Tenderbake.Grand_parent_branch
        .(Storage_sigs.Single_data_storage.get)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some xPervasives.Ok x
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t),
      Storage.Tenderbake.Grand_parent_branch
        .(Storage_sigs.Single_data_storage.find)
        (Raw_context.to_t ctxt) =
      return? Helpers.get ctxt.

    Axiom init_value : (ctxt : Raw_context.t) value,
      Storage.Tenderbake.Grand_parent_branch
        .(Storage_sigs.Single_data_storage.init_value)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | None
          return? Helpers.set ctxt (Some value)
      | Some _

          Raw_context.storage_error_value
            (Raw_context.Existing_key Helpers.name)
      end.

    Axiom update : (ctxt : Raw_context.t) value,
      Storage.Tenderbake.Grand_parent_branch
        .(Storage_sigs.Single_data_storage.update)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt (Some value)
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context._Set)
      end.

    Axiom add : (ctxt : Raw_context.t) value,
      Storage.Tenderbake.Grand_parent_branch
        .(Storage_sigs.Single_data_storage.add)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt (Some value)
      | None ⇒ (Raw_context.to_t ctxt)
      end.

    Axiom add_or_remove : (ctxt : Raw_context.t) value,
      Storage.Tenderbake.Grand_parent_branch
        .(Storage_sigs.Single_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) value =
        Helpers.set ctxt value.

    Axiom remove_existing : (ctxt : Raw_context.t),
      Storage.Tenderbake.Grand_parent_branch
        .(Storage_sigs.Single_data_storage.remove_existing)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt None
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : (ctxt : Raw_context.t),
      Storage.Tenderbake.Grand_parent_branch
        .(Storage_sigs.Single_data_storage.remove)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt None
      | NoneRaw_context.to_t ctxt
      end.

    #[global] Hint Rewrite mem get find init_value update add
      add_or_remove remove_existing remove : storage_db.
    #[global] Opaque Storage.Tenderbake.Grand_parent_branch.
  End Grand_parent_branch.
End Tenderbake.

Module Contract.
  Module Global_counter.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Contract_Global_counter).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Contract_Global_counter := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition name := ["global_counter"].
    End Helpers.

    Axiom get : (ctxt : Raw_context.t),
      Storage.Contract.Global_counter
        .(Storage.Simple_single_data_storage.get)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some xPervasives.Ok x
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom update : (ctxt : Raw_context.t) value,
     Storage.Contract.Global_counter
        .(Storage.Simple_single_data_storage.update)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _
          return? Helpers.set ctxt (Some value)
      | None

          Raw_context.storage_error_value
            (Raw_context.Existing_key Helpers.name)
      end.

    Axiom init_value : (ctxt : Raw_context.t) value,
     Storage.Contract.Global_counter
        .(Storage.Simple_single_data_storage.init_value)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | None
          return? Helpers.set ctxt (Some value)
      | Some _

          Raw_context.storage_error_value
            (Raw_context.Existing_key Helpers.name)
      end.

    #[global] Hint Rewrite get update init_value : storage_db.
    #[global] Opaque Storage.Contract.Global_counter.
  End Global_counter.

  Module Spendable_balance.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Contract_Spendable_balance).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Contract_Spendable_balance := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Contract_repr.Index).
      Arguments S /.

      Definition name := ["balance"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Contract.Spendable_balance
        .(Storage_sigs.Indexed_data_storage_with_local_context.mem)
        (Raw_context.to_t ctxt) k =
      (Helpers.S).(Map.S.mem) k
        (Helpers.get ctxt).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Contract.Spendable_balance
        .(Storage_sigs.Indexed_data_storage_with_local_context.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok v
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Contract.Spendable_balance
        .(Storage_sigs.Indexed_data_storage_with_local_context.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Some v)
      | Nonereturn? None
      end.

    Axiom update : (ctxt : Raw_context.t) k v,
      Storage.Contract.Spendable_balance
        .(Storage_sigs.Indexed_data_storage_with_local_context.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then
        return? Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v,
      Storage.Contract.Spendable_balance
        .(Storage_sigs.Indexed_data_storage_with_local_context.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)).

    Axiom add : (ctxt : Raw_context.t) k v,
      Storage.Contract.Spendable_balance
        .(Storage_sigs.Indexed_data_storage_with_local_context.add)
        (Raw_context.to_t ctxt) k v =
      Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
        (Helpers.get ctxt)).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v,
      Storage.Contract.Spendable_balance
        .(Storage_sigs.Indexed_data_storage_with_local_context.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      match v with
      | Some v'
          Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            (Helpers.get ctxt))
      | None
          Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            (Helpers.get ctxt))
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k,
      Storage.Contract.Spendable_balance
        .(Storage_sigs.Indexed_data_storage_with_local_context.remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k,
      Storage.Contract.Spendable_balance
        .(Storage_sigs.Indexed_data_storage_with_local_context.remove)
        (Raw_context.to_t ctxt) k =
      Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)).

    Axiom clear : (ctxt : Raw_context.t),
      Storage.Contract.Spendable_balance
        .(Storage_sigs.Indexed_data_storage_with_local_context.clear)
        (Raw_context.to_t ctxt) =
      return? Helpers.set ctxt ((Helpers.S).(Map.S.empty)).

    Axiom keys : (ctxt : Raw_context.t),
      Storage.Contract.Spendable_balance
        .(Storage_sigs.Indexed_data_storage_with_local_context.keys)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    Axiom bindings : (ctxt : Raw_context.t),
      Storage.Contract.Spendable_balance
        .(Storage_sigs.Indexed_data_storage_with_local_context.bindings)
        (Raw_context.to_t ctxt) =
      return? (Helpers.S).(Map.S.bindings) (Helpers.get ctxt).

    Axiom fold : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ _ a M? a),
      Storage.Contract.Spendable_balance
        .(Storage_sigs.Indexed_data_storage_with_local_context.fold)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold) (fun k v acclet? acc := acc in f k v acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    Axiom fold_keys : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ a M? a),
      Storage.Contract.Spendable_balance
        .(Storage_sigs.Indexed_data_storage_with_local_context.fold_keys)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold)
        (fun k _ acclet? acc := acc in f k acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove clear keys bindings
       @fold @fold_keys : storage_db.
    #[global] Opaque Storage.Contract.Spendable_balance.
  End Spendable_balance.

  Module Missed_endorsements.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Contract_Missed_endorsements).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Contract_Missed_endorsements := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Contract_repr.Index).
      Arguments S /.

      Definition name := ["missed_endorsements"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Contract.Missed_endorsements
        .(Storage_sigs.Indexed_data_storage.mem)
        (Raw_context.to_t ctxt) k =
      (Helpers.S).(Map.S.mem) k
        (Helpers.get ctxt).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Contract.Missed_endorsements
        .(Storage_sigs.Indexed_data_storage.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok v
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Contract.Missed_endorsements
        .(Storage_sigs.Indexed_data_storage.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Some v)
      | Nonereturn? None
      end.

    Axiom update : (ctxt : Raw_context.t) k v,
      Storage.Contract.Missed_endorsements
        .(Storage_sigs.Indexed_data_storage.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then

        return? Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v,
      Storage.Contract.Missed_endorsements
        .(Storage_sigs.Indexed_data_storage.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)).

    Axiom add : (ctxt : Raw_context.t) k v,
      Storage.Contract.Missed_endorsements
        .(Storage_sigs.Indexed_data_storage.add)
        (Raw_context.to_t ctxt) k v =
      Helpers.set ctxt ((Helpers.S).(Map.S.add) k v

        (Helpers.get ctxt)).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v,
      Storage.Contract.Missed_endorsements
        .(Storage_sigs.Indexed_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      match v with
      | Some v'

          Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            (Helpers.get ctxt))
      | None

          Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            (Helpers.get ctxt))
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k,
      Storage.Contract.Missed_endorsements
        .(Storage_sigs.Indexed_data_storage.remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k,
      Storage.Contract.Missed_endorsements
        .(Storage_sigs.Indexed_data_storage.remove)
        (Raw_context.to_t ctxt) k =
      Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)).

    Axiom clear : (ctxt : Raw_context.t),
      Storage.Contract.Missed_endorsements
        .(Storage_sigs.Indexed_data_storage.clear)
        (Raw_context.to_t ctxt) =
      return? Helpers.set ctxt ((Helpers.S).(Map.S.empty)).

    Axiom keys : (ctxt : Raw_context.t),
      Storage.Contract.Missed_endorsements
        .(Storage_sigs.Indexed_data_storage.keys)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    Axiom bindings : (ctxt : Raw_context.t),
      Storage.Contract.Missed_endorsements
        .(Storage_sigs.Indexed_data_storage.bindings)
        (Raw_context.to_t ctxt) =
      return? (Helpers.S).(Map.S.bindings) (Helpers.get ctxt).

    Axiom fold : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ _ a M? a),
      Storage.Contract.Missed_endorsements
        .(Storage_sigs.Indexed_data_storage.fold)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold) (fun k v acclet? acc := acc in f k v acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    Axiom fold_keys : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ a M? a),
      Storage.Contract.Missed_endorsements
        .(Storage_sigs.Indexed_data_storage.fold_keys)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold)
        (fun k _ acclet? acc := acc in f k acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove clear keys bindings
       @fold @fold_keys : storage_db.
    #[global] Opaque Storage.Contract.Missed_endorsements.
  End Missed_endorsements.

  Module Manager.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Contract_Manager).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Contract_Manager := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Contract_repr.Index).
      Arguments S /.

      Definition name := ["manager"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Contract.Manager
        .(Storage_sigs.Indexed_data_storage_with_local_context.mem)
        (Raw_context.to_t ctxt) k =
      (Helpers.S).(Map.S.mem) k
        (Helpers.get ctxt).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Contract.Manager
        .(Storage_sigs.Indexed_data_storage_with_local_context.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok v
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Contract.Manager
        .(Storage_sigs.Indexed_data_storage_with_local_context.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Some v)
      | Nonereturn? None
      end.

    Axiom update : (ctxt : Raw_context.t) k v,
      Storage.Contract.Manager
        .(Storage_sigs.Indexed_data_storage_with_local_context.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then
        return? Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v,
      Storage.Contract.Manager
        .(Storage_sigs.Indexed_data_storage_with_local_context.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)).

    Axiom add : (ctxt : Raw_context.t) k v,
      Storage.Contract.Manager
        .(Storage_sigs.Indexed_data_storage_with_local_context.add)
        (Raw_context.to_t ctxt) k v =
      Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
        (Helpers.get ctxt)).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v,
      Storage.Contract.Manager
        .(Storage_sigs.Indexed_data_storage_with_local_context.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      match v with
      | Some v'
          Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            (Helpers.get ctxt))
      | None
          Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            (Helpers.get ctxt))
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k,
      Storage.Contract.Manager
        .(Storage_sigs.Indexed_data_storage_with_local_context.remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k,
      Storage.Contract.Manager
        .(Storage_sigs.Indexed_data_storage_with_local_context.remove)
        (Raw_context.to_t ctxt) k =
      Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)).

    Axiom clear : (ctxt : Raw_context.t),
      Storage.Contract.Manager
        .(Storage_sigs.Indexed_data_storage_with_local_context.clear)
        (Raw_context.to_t ctxt) =
      return? Helpers.set ctxt ((Helpers.S).(Map.S.empty)).

    Axiom keys : (ctxt : Raw_context.t),
      Storage.Contract.Manager
        .(Storage_sigs.Indexed_data_storage_with_local_context.keys)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    Axiom bindings : (ctxt : Raw_context.t),
      Storage.Contract.Manager
        .(Storage_sigs.Indexed_data_storage_with_local_context.bindings)
        (Raw_context.to_t ctxt) =
      return? (Helpers.S).(Map.S.bindings) (Helpers.get ctxt).

    Axiom fold : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ _ a M? a),
      Storage.Contract.Manager
        .(Storage_sigs.Indexed_data_storage_with_local_context.fold)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold) (fun k v acclet? acc := acc in f k v acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    Axiom fold_keys : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ a M? a),
      Storage.Contract.Manager
        .(Storage_sigs.Indexed_data_storage_with_local_context.fold_keys)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold)
        (fun k _ acclet? acc := acc in f k acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove clear keys bindings
       @fold @fold_keys : storage_db.
    #[global] Opaque Storage.Contract.Manager.
  End Manager.

  Module Consensus_key.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Contract_Consensus_key).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Contract_Consensus_key := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Contract_repr.Index).
      Arguments S /.

      Definition name := ["consensus_keys";"active"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Contract.Consensus_key
        .(Storage_sigs.Indexed_data_storage.mem)
        (Raw_context.to_t ctxt) k =
      (Helpers.S).(Map.S.mem) k
        (Helpers.get ctxt).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Contract.Consensus_key
        .(Storage_sigs.Indexed_data_storage.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok v
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Contract.Consensus_key
        .(Storage_sigs.Indexed_data_storage.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Some v)
      | Nonereturn? None
      end.

    Axiom update : (ctxt : Raw_context.t) k v,
      Storage.Contract.Consensus_key
        .(Storage_sigs.Indexed_data_storage.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then

        return? Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v,
      Storage.Contract.Consensus_key
        .(Storage_sigs.Indexed_data_storage.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)).

    Axiom add : (ctxt : Raw_context.t) k v,
      Storage.Contract.Consensus_key
        .(Storage_sigs.Indexed_data_storage.add)
        (Raw_context.to_t ctxt) k v =
      Helpers.set ctxt ((Helpers.S).(Map.S.add) k v

        (Helpers.get ctxt)).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v,
      Storage.Contract.Consensus_key
        .(Storage_sigs.Indexed_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      match v with
      | Some v'

          Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            (Helpers.get ctxt))
      | None

          Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            (Helpers.get ctxt))
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k,
      Storage.Contract.Consensus_key
        .(Storage_sigs.Indexed_data_storage.remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k,
      Storage.Contract.Consensus_key
        .(Storage_sigs.Indexed_data_storage.remove)
        (Raw_context.to_t ctxt) k =
      Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)).

    Axiom clear : (ctxt : Raw_context.t),
      Storage.Contract.Consensus_key
        .(Storage_sigs.Indexed_data_storage.clear)
        (Raw_context.to_t ctxt) =
      return? Helpers.set ctxt ((Helpers.S).(Map.S.empty)).

    Axiom keys : (ctxt : Raw_context.t),
      Storage.Contract.Consensus_key
        .(Storage_sigs.Indexed_data_storage.keys)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    Axiom bindings : (ctxt : Raw_context.t),
      Storage.Contract.Consensus_key
        .(Storage_sigs.Indexed_data_storage.bindings)
        (Raw_context.to_t ctxt) =
      return? (Helpers.S).(Map.S.bindings) (Helpers.get ctxt).

    Axiom fold : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ _ a M? a),
      Storage.Contract.Consensus_key
        .(Storage_sigs.Indexed_data_storage.fold)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold) (fun k v acclet? acc := acc in f k v acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    Axiom fold_keys : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ a M? a),
      Storage.Contract.Consensus_key
        .(Storage_sigs.Indexed_data_storage.fold_keys)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold)
        (fun k _ acclet? acc := acc in f k acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove clear keys bindings
       @fold @fold_keys : storage_db.
    #[global] Opaque Storage.Contract.Consensus_key.
  End Consensus_key.

  Module Pending_consensus_keys.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Contract_Pending_consensus_keys).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Contract_Pending_consensus_keys := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition Map :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Contract_repr.Index).
      Arguments Map /.

      Definition Submap :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Cycle_repr.Index).
      Arguments Submap /.

      Definition name := ["consensus_key";"pendings"].
    End Helpers.

    Axiom mem : ctxt key subkey,
      Storage.Contract.Pending_consensus_keys
          .(Storage_sigs.Indexed_data_storage.mem)

          (Raw_context.to_t ctxt, key) subkey =

      let map := (Helpers.Map).(Map.S.find)
        key (Helpers.get ctxt) in
      match map with

      | Some map

        (Helpers.Submap).(Map.S.mem) subkey map
      | Nonefalse
      end.

    Axiom get : ctxt subkey key,
      Storage.Contract.Pending_consensus_keys
        .(Storage_sigs.Indexed_data_storage.get)
       (Raw_context.to_t ctxt, key)
       subkey =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Get) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
          let value := (Helpers.Submap).(Map.S.find) subkey submap' in
          match value with
          | Some value'return? value'
          | Noneerror
          end
      | Noneerror
      end.

    Axiom find : ctxt subkey key,
      Storage.Contract.Pending_consensus_keys
        .(Storage_sigs.Indexed_data_storage.find)
       (Raw_context.to_t ctxt, key)
       subkey =
     return? (
     let× map := (Helpers.Map).(Map.S.find)
       key
      (Helpers.get ctxt) in
     let× value := (Helpers.Submap).(Map.S.find) subkey map in
     return× value).

    Axiom update : ctxt subkey key value,
      Storage.Contract.Pending_consensus_keys
        .(Storage_sigs.Indexed_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then

          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? Helpers.set ctxt map'
        else error
      | Noneerror
      end.

    Axiom init_value : ctxt subkey key value,
      Storage.Contract.Pending_consensus_keys
        .(Storage_sigs.Indexed_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then error
        else
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? Helpers.set ctxt map'
      | None
        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? Helpers.set ctxt map'

      end.

    Axiom add : ctxt key subkey value,
      Storage.Contract.Pending_consensus_keys
        .(Storage_sigs.Indexed_data_storage.add)
      (Raw_context.to_t ctxt, key) subkey value =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        let submap'' :=
          (Helpers.Submap).(Map.S.add) subkey value submap' in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        Helpers.set ctxt map'
      | None

        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        Helpers.set ctxt map'
      end.

    Axiom add_or_remove : ctxt key subkey value_opt,
      Storage.Contract.Pending_consensus_keys
        .(Storage_sigs.Indexed_data_storage.add_or_remove)
      (Raw_context.to_t ctxt, key) subkey value_opt =
      match value_opt with
      | Some value
        (* add the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          Helpers.set ctxt map'
        | None

          let submap'' :=
            (Helpers.Submap).(Map.S.singleton) subkey value in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          Helpers.set ctxt map'
        end
      | None
        (* remove the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          Helpers.set ctxt map'

        | NoneRaw_context.to_t ctxt
        end
      end.

    Axiom remove_existing : ctxt key subkey,
      Storage.Contract.Pending_consensus_keys
        .(Storage_sigs.Indexed_data_storage.remove_existing)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          if (Helpers.Submap).(Map.S.mem) subkey submap'
          then
            let submap'' :=
              (Helpers.Submap).(Map.S.remove) subkey submap' in
            let map' := (Helpers.Map).(Map.S.add) key submap'' map in
            return? Helpers.set ctxt map'
          else
            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context.Del)
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : ctxt key subkey,
      Storage.Contract.Pending_consensus_keys
        .(Storage_sigs.Indexed_data_storage.remove)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          Helpers.set ctxt map'
      | NoneRaw_context.to_t ctxt
      end.

    Axiom clear : (ctxt : Raw_context.t) key,
      Storage.Contract.Pending_consensus_keys
        .(Storage_sigs.Indexed_data_storage.clear)
        (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      let empty := (Helpers.Submap).(Map.S.empty) in
      let map' := (Helpers.Map).(Map.S.add) key empty map in
      return? Helpers.set ctxt map'.

    Axiom keys : ctxt key,
      Storage.Contract.Pending_consensus_keys
        .(Storage_sigs.Indexed_data_storage.keys)
           (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'return? List.map fst ((Helpers.Submap).(Map.S.bindings)
          submap')
      | Nonereturn? []
      end.

    Axiom bindings : ctxt key,
      Storage.Contract.Pending_consensus_keys
        .(Storage_sigs.Indexed_data_storage.bindings)
           (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'return? (Helpers.Submap).(Map.S.bindings) submap'
      | Nonereturn? []
      end.

    Axiom fold : {a : Set} ctxt key variant init f,
      Storage.Contract.Pending_consensus_keys
        .(Storage_sigs.Indexed_data_storage.fold)
           (Raw_context.to_t ctxt, key)
           variant
           init
           f =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
          let f' k v acc :=
            let? acc := acc in
            f k v acc in
          (Helpers.Submap).(Map.S.fold) f' init (Pervasives.Ok submap')
      | Nonereturn? init
      end.

    Axiom fold_keys : {a : Set} ctxt key variant init f,
      Storage.Contract.Pending_consensus_keys
        .(Storage_sigs.Indexed_data_storage.fold_keys)
           (Raw_context.to_t ctxt, key)
           variant
           init
           f =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
          let f' k acc :=
            let? acc := acc in
            f k acc in
          (Helpers.Submap).(Map.S.fold)

            (fun k _ accf' k acc) init (Pervasives.Ok submap')
      | Nonereturn? init
      end.

    #[global] Hint Rewrite mem get find init_value update add
      add_or_remove remove_existing remove @fold @fold_keys keys
      bindings clear : storage_db.
    #[global] Opaque Storage.Contract.Pending_consensus_keys.
  End Pending_consensus_keys.

  Module Delegate.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Contract_Delegate).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Contract_Delegate := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Contract_repr.Index).
      Arguments S /.

      Definition name := ["delegate"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Contract.Delegate
        .(Storage_sigs.Indexed_data_storage.mem)
        (Raw_context.to_t ctxt) k =
      (Helpers.S).(Map.S.mem) k
        (Helpers.get ctxt).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Contract.Delegate
        .(Storage_sigs.Indexed_data_storage.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok v
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Contract.Delegate
        .(Storage_sigs.Indexed_data_storage.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Some v)
      | Nonereturn? None
      end.

    Axiom update : (ctxt : Raw_context.t) k v,
      Storage.Contract.Delegate
        .(Storage_sigs.Indexed_data_storage.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then

        return? Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v,
      Storage.Contract.Delegate
        .(Storage_sigs.Indexed_data_storage.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)).

    Axiom add : (ctxt : Raw_context.t) k v,
      Storage.Contract.Delegate
        .(Storage_sigs.Indexed_data_storage.add)
        (Raw_context.to_t ctxt) k v =
      Helpers.set ctxt ((Helpers.S).(Map.S.add) k v

        (Helpers.get ctxt)).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v,
      Storage.Contract.Delegate
        .(Storage_sigs.Indexed_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      match v with
      | Some v'

          Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            (Helpers.get ctxt))
      | None

          Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            (Helpers.get ctxt))
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k,
      Storage.Contract.Delegate
        .(Storage_sigs.Indexed_data_storage.remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k,
      Storage.Contract.Delegate
        .(Storage_sigs.Indexed_data_storage.remove)
        (Raw_context.to_t ctxt) k =
      Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)).

    Axiom clear : (ctxt : Raw_context.t),
      Storage.Contract.Delegate
        .(Storage_sigs.Indexed_data_storage.clear)
        (Raw_context.to_t ctxt) =
      return? Helpers.set ctxt ((Helpers.S).(Map.S.empty)).

    Axiom keys : (ctxt : Raw_context.t),
      Storage.Contract.Delegate
        .(Storage_sigs.Indexed_data_storage.keys)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    Axiom bindings : (ctxt : Raw_context.t),
      Storage.Contract.Delegate
        .(Storage_sigs.Indexed_data_storage.bindings)
        (Raw_context.to_t ctxt) =
      return? (Helpers.S).(Map.S.bindings) (Helpers.get ctxt).

    Axiom fold : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ _ a M? a),
      Storage.Contract.Delegate
        .(Storage_sigs.Indexed_data_storage.fold)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold) (fun k v acclet? acc := acc in f k v acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    Axiom fold_keys : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ a M? a),
      Storage.Contract.Delegate
        .(Storage_sigs.Indexed_data_storage.fold_keys)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold)
        (fun k _ acclet? acc := acc in f k acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove clear keys bindings
       @fold @fold_keys : storage_db.
    #[global] Opaque Storage.Contract.Delegate.
  End Delegate.

  Module Inactive_delegate.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Contract_Inactive_delegate).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Contract_Inactive_delegate := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_set._Set
          (of_description_index Contract_repr.Index).
      Arguments S /.
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) elt,
      Storage.Contract.Inactive_delegate
        .(Storage_sigs.Data_set_storage.mem)
        (Raw_context.to_t ctxt) elt =
      Helpers.S.(_Set.S.mem) elt (Helpers.get ctxt).

    Axiom add : (ctxt : Raw_context.t) elt,
      Storage.Contract.Inactive_delegate
        .(Storage_sigs.Data_set_storage.add)
        (Raw_context.to_t ctxt) elt =
      Helpers.set ctxt (Helpers.S.(_Set.S.add) elt (Helpers.get ctxt)).

    Axiom remove : (ctxt : Raw_context.t) elt,
      Storage.Contract.Inactive_delegate
        .(Storage_sigs.Data_set_storage.remove)
        (Raw_context.to_t ctxt) elt =
      Helpers.set ctxt (Helpers.S.(_Set.S.remove) elt
        (Helpers.get ctxt)).

    Axiom elements : (ctxt : Raw_context.t),
      Storage.Contract.Inactive_delegate
        .(Storage_sigs.Data_set_storage.elements)
        (Raw_context.to_t ctxt) =
      return? Helpers.S.(_Set.S.elements) (Helpers.get ctxt).

    Axiom fold : {a : Set} (ctxt : Raw_context.t) variant (x : a)
      (f : _ a M? a),
      Storage.Contract.Inactive_delegate
         .(Storage_sigs.Data_set_storage.fold)
         (Raw_context.to_t ctxt) variant x f =
      Helpers.S.(_Set.S.fold)
        (fun elt acclet? acc := acc in f elt acc) (Helpers.get ctxt)
        (Pervasives.Ok x).

    Axiom clear : (ctxt : Raw_context.t),
      Storage.Contract.Inactive_delegate
        .(Storage_sigs.Data_set_storage.clear)
        (Raw_context.to_t ctxt) =
      return? Helpers.set ctxt (Helpers.S.(_Set.S.empty)).

    #[global] Hint Rewrite mem add remove elements @fold clear

     : storage_db.
    #[global] Opaque Storage.Contract.Inactive_delegate.
  End Inactive_delegate.

  Module Delegate_last_cycle_before_deactivation.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Contract_Delegate_last_cycle_before_deactivation).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Contract_Delegate_last_cycle_before_deactivation := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Contract_repr.Index).
      Arguments S /.

      Definition name := ["delegate_desactivation"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Contract.Delegate_last_cycle_before_deactivation
        .(Storage_sigs.Indexed_data_storage.mem)
        (Raw_context.to_t ctxt) k =
      (Helpers.S).(Map.S.mem) k
        (Helpers.get ctxt).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Contract.Delegate_last_cycle_before_deactivation
        .(Storage_sigs.Indexed_data_storage.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok v
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Contract.Delegate_last_cycle_before_deactivation
        .(Storage_sigs.Indexed_data_storage.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Some v)
      | Nonereturn? None
      end.

    Axiom update : (ctxt : Raw_context.t) k v,
      Storage.Contract.Delegate_last_cycle_before_deactivation
        .(Storage_sigs.Indexed_data_storage.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then

        return? Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v,
      Storage.Contract.Delegate_last_cycle_before_deactivation
        .(Storage_sigs.Indexed_data_storage.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)).

    Axiom add : (ctxt : Raw_context.t) k v,
      Storage.Contract.Delegate_last_cycle_before_deactivation
        .(Storage_sigs.Indexed_data_storage.add)
        (Raw_context.to_t ctxt) k v =
      Helpers.set ctxt ((Helpers.S).(Map.S.add) k v

        (Helpers.get ctxt)).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v,
      Storage.Contract.Delegate_last_cycle_before_deactivation
        .(Storage_sigs.Indexed_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      match v with
      | Some v'

          Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            (Helpers.get ctxt))
      | None

          Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            (Helpers.get ctxt))
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k,
      Storage.Contract.Delegate_last_cycle_before_deactivation
        .(Storage_sigs.Indexed_data_storage.remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k,
      Storage.Contract.Delegate_last_cycle_before_deactivation
        .(Storage_sigs.Indexed_data_storage.remove)
        (Raw_context.to_t ctxt) k =
      Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)).

    Axiom clear : (ctxt : Raw_context.t),
      Storage.Contract.Delegate_last_cycle_before_deactivation
        .(Storage_sigs.Indexed_data_storage.clear)
        (Raw_context.to_t ctxt) =
      return? Helpers.set ctxt ((Helpers.S).(Map.S.empty)).

    Axiom keys : (ctxt : Raw_context.t),
      Storage.Contract.Delegate_last_cycle_before_deactivation
        .(Storage_sigs.Indexed_data_storage.keys)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    Axiom bindings : (ctxt : Raw_context.t),
      Storage.Contract.Delegate_last_cycle_before_deactivation
        .(Storage_sigs.Indexed_data_storage.bindings)
        (Raw_context.to_t ctxt) =
      return? (Helpers.S).(Map.S.bindings) (Helpers.get ctxt).

    Axiom fold : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ _ a M? a),
      Storage.Contract.Delegate_last_cycle_before_deactivation
        .(Storage_sigs.Indexed_data_storage.fold)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold) (fun k v acclet? acc := acc in f k v acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    Axiom fold_keys : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ a M? a),
      Storage.Contract.Delegate_last_cycle_before_deactivation
        .(Storage_sigs.Indexed_data_storage.fold_keys)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold)
        (fun k _ acclet? acc := acc in f k acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove clear keys bindings
       @fold @fold_keys : storage_db.
    #[global] Opaque Storage.Contract.Delegate_last_cycle_before_deactivation.
  End Delegate_last_cycle_before_deactivation.

  Module Delegated.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Contract_Delegated).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Contract_Delegated := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition Map :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Contract_repr.Index).
      Arguments Map /.

      Definition Subset :=
        Storage_sigs.Indexed_set._Set
          (of_description_index Contract_repr.Index).
      Arguments Subset /.

      Definition name := ["delegated"].
    End Helpers.

    Axiom mem : ctxt key subkey,
      Storage.Contract.Delegated
        .(Storage_sigs.Data_set_storage.mem)

        (Raw_context.to_t ctxt, key) subkey =

      let map := (Helpers.Map).(Map.S.find)
        key (Helpers.get ctxt) in
      match map with

      | Some map

        (Helpers.Subset).(_Set.S.mem) subkey map
      | Nonefalse
      end.

    Axiom add : ctxt key subkey,
      Storage.Contract.Delegated
        .(Storage_sigs.Data_set_storage.add)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        let submap'' :=
          (Helpers.Subset).(_Set.S.add) subkey submap' in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        Helpers.set ctxt map'
      | None

        let submap'' :=
          (Helpers.Subset).(_Set.S.singleton) subkey in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        Helpers.set ctxt map'
      end.

    Axiom remove : ctxt key subkey,
      Storage.Contract.Delegated
        .(Storage_sigs.Data_set_storage.remove)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          let submap'' :=
            (Helpers.Subset).(_Set.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          Helpers.set ctxt map'
      | NoneRaw_context.to_t ctxt
      end.

    Axiom elements : ctxt key,
      Storage.Contract.Delegated
        .(Storage_sigs.Data_set_storage.elements)
           (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'return? (Helpers.Subset).(_Set.S.elements) submap'
      | Nonereturn? []
      end.

    Axiom fold : {a : Set} ctxt key variant init f,
      Storage.Contract.Delegated
        .(Storage_sigs.Data_set_storage.fold)
           (Raw_context.to_t ctxt, key)
           variant
           init
           f =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
          let f' elm acc :=
            let? acc := acc in
            f elm acc in
          (Helpers.Subset).(_Set.S.fold) f' init
            (Pervasives.Ok submap')
      | Nonereturn? init
      end.

    Axiom clear : (ctxt : Raw_context.t) key,
      Storage.Contract.Delegated
        .(Storage_sigs.Data_set_storage.clear)
        (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      let empty := (Helpers.Subset).(_Set.S.empty) in
      let map' := (Helpers.Map).(Map.S.add) key empty map in
      return? Helpers.set ctxt map'.

    #[global] Hint Rewrite mem add remove elements @fold clear
      : storage_db.
    #[global] Opaque Storage.Contract.Delegated.
  End Delegated.

  Module Counter.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Contract_Counter).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Contract_Counter := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Contract_repr.Index).
      Arguments S /.

      Definition name := ["counter"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Contract.Counter
        .(Storage_sigs.Indexed_data_storage_with_local_context.mem)
        (Raw_context.to_t ctxt) k =
      (Helpers.S).(Map.S.mem) k
        (Helpers.get ctxt).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Contract.Counter
        .(Storage_sigs.Indexed_data_storage_with_local_context.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok v
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Contract.Counter
        .(Storage_sigs.Indexed_data_storage_with_local_context.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Some v)
      | Nonereturn? None
      end.

    Axiom update : (ctxt : Raw_context.t) k v,
      Storage.Contract.Counter
        .(Storage_sigs.Indexed_data_storage_with_local_context.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then
        return? Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v,
      Storage.Contract.Counter
        .(Storage_sigs.Indexed_data_storage_with_local_context.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)).

    Axiom add : (ctxt : Raw_context.t) k v,
      Storage.Contract.Counter
        .(Storage_sigs.Indexed_data_storage_with_local_context.add)
        (Raw_context.to_t ctxt) k v =
      Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
        (Helpers.get ctxt)).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v,
      Storage.Contract.Counter
        .(Storage_sigs.Indexed_data_storage_with_local_context.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      match v with
      | Some v'
          Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            (Helpers.get ctxt))
      | None
          Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            (Helpers.get ctxt))
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k,
      Storage.Contract.Counter
        .(Storage_sigs.Indexed_data_storage_with_local_context.remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k,
      Storage.Contract.Counter
        .(Storage_sigs.Indexed_data_storage_with_local_context.remove)
        (Raw_context.to_t ctxt) k =
      Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)).

    Axiom clear : (ctxt : Raw_context.t),
      Storage.Contract.Counter
        .(Storage_sigs.Indexed_data_storage_with_local_context.clear)
        (Raw_context.to_t ctxt) =
      return? Helpers.set ctxt ((Helpers.S).(Map.S.empty)).

    Axiom keys : (ctxt : Raw_context.t),
      Storage.Contract.Counter
        .(Storage_sigs.Indexed_data_storage_with_local_context.keys)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    Axiom bindings : (ctxt : Raw_context.t),
      Storage.Contract.Counter
        .(Storage_sigs.Indexed_data_storage_with_local_context.bindings)
        (Raw_context.to_t ctxt) =
      return? (Helpers.S).(Map.S.bindings) (Helpers.get ctxt).

    Axiom fold : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ _ a M? a),
      Storage.Contract.Counter
        .(Storage_sigs.Indexed_data_storage_with_local_context.fold)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold) (fun k v acclet? acc := acc in f k v acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    Axiom fold_keys : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ a M? a),
      Storage.Contract.Counter
        .(Storage_sigs.Indexed_data_storage_with_local_context.fold_keys)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold)
        (fun k _ acclet? acc := acc in f k acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove clear keys bindings
       @fold @fold_keys : storage_db.
    #[global] Opaque Storage.Contract.Counter.
  End Counter.

  Module Code.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Contract_Code).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Contract_Code := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Contract_repr.Index).
      Arguments S /.

      Definition name := ["code"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Contract.Code
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.mem)
        (Raw_context.to_t ctxt) k =
      return? (Raw_context.to_t ctxt, (Helpers.S).(Map.S.mem) k
         (Helpers.get ctxt)).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Contract.Code
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok (Raw_context.to_t ctxt, v)
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Contract.Code
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Raw_context.to_t ctxt, (Some v))
      | Nonereturn? (Raw_context.to_t ctxt, None)
      end.

    Axiom update : (ctxt : Raw_context.t) k v size,
      Storage.Contract.Code
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then

        let ctxt := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt)) in
        return? (ctxt, size)
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v size,
      Storage.Contract.Code
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? (Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)), size).

    Axiom add : (ctxt : Raw_context.t) k v size,
      Storage.Contract.Code
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add)
        (Raw_context.to_t ctxt) k v =
     let storage := (Helpers.get ctxt) in
     let bound := (Helpers.S).(Map.S.mem) k storage in
     let storage' := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v storage) in
       return? (storage', size, bound).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v size,
      Storage.Contract.Code
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      let storage := Helpers.get ctxt in
      let mem := (Helpers.S).(Map.S.mem) k storage in
      match v with
      | Some v'
          let ctxt' := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            storage) in
          return? (ctxt', size, mem)
      | None

          let ctxt' := Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            storage) in
          return? (ctxt', size, mem)
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k size,
      Storage.Contract.Code
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? (Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)), size)
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k size,
      Storage.Contract.Code
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .remove)
        (Raw_context.to_t ctxt) k =
      let storage := Helpers.get ctxt in
      let mem := (Helpers.S).(Map.S.mem) k storage in
      return? (Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        storage), size, mem).

    Axiom keys_unaccounted : (ctxt : Raw_context.t),
      Storage.Contract.Code
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .keys_unaccounted)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove keys_unaccounted

       : storage_db.
    #[global] Opaque Storage.Contract.Code.
  End Code.

  Module Storage.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Contract_Storage).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Contract_Storage := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Contract_repr.Index).
      Arguments S /.

      Definition name := ["storage"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Contract.Storage
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.mem)
        (Raw_context.to_t ctxt) k =
      return? (Raw_context.to_t ctxt, (Helpers.S).(Map.S.mem) k
         (Helpers.get ctxt)).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Contract.Storage
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok (Raw_context.to_t ctxt, v)
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Contract.Storage
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Raw_context.to_t ctxt, (Some v))
      | Nonereturn? (Raw_context.to_t ctxt, None)
      end.

    Axiom update : (ctxt : Raw_context.t) k v size,
      Storage.Contract.Storage
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then

        let ctxt := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt)) in
        return? (ctxt, size)
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v size,
      Storage.Contract.Storage
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? (Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)), size).

    Axiom add : (ctxt : Raw_context.t) k v size,
      Storage.Contract.Storage
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add)
        (Raw_context.to_t ctxt) k v =
     let storage := (Helpers.get ctxt) in
     let bound := (Helpers.S).(Map.S.mem) k storage in
     let storage' := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v storage) in
       return? (storage', size, bound).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v size,
      Storage.Contract.Storage
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      let storage := Helpers.get ctxt in
      let mem := (Helpers.S).(Map.S.mem) k storage in
      match v with
      | Some v'
          let ctxt' := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            storage) in
          return? (ctxt', size, mem)
      | None

          let ctxt' := Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            storage) in
          return? (ctxt', size, mem)
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k size,
      Storage.Contract.Storage
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? (Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)), size)
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k size,
      Storage.Contract.Storage
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .remove)
        (Raw_context.to_t ctxt) k =
      let storage := Helpers.get ctxt in
      let mem := (Helpers.S).(Map.S.mem) k storage in
      return? (Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        storage), size, mem).

    Axiom keys_unaccounted : (ctxt : Raw_context.t),
      Storage.Contract.Storage
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .keys_unaccounted)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove keys_unaccounted

       : storage_db.
    #[global] Opaque Storage.Contract.Storage.
  End Storage.

  Module Paid_storage_space.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Contract_Paid_storage_space).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Contract_Paid_storage_space := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Contract_repr.Index).
      Arguments S /.

      Definition name := ["paid_bytes"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Contract.Paid_storage_space
        .(Storage_sigs.Indexed_data_storage.mem)
        (Raw_context.to_t ctxt) k =
      (Helpers.S).(Map.S.mem) k
        (Helpers.get ctxt).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Contract.Paid_storage_space
        .(Storage_sigs.Indexed_data_storage.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok v
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Contract.Paid_storage_space
        .(Storage_sigs.Indexed_data_storage.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Some v)
      | Nonereturn? None
      end.

    Axiom update : (ctxt : Raw_context.t) k v,
      Storage.Contract.Paid_storage_space
        .(Storage_sigs.Indexed_data_storage.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then

        return? Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v,
      Storage.Contract.Paid_storage_space
        .(Storage_sigs.Indexed_data_storage.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)).

    Axiom add : (ctxt : Raw_context.t) k v,
      Storage.Contract.Paid_storage_space
        .(Storage_sigs.Indexed_data_storage.add)
        (Raw_context.to_t ctxt) k v =
      Helpers.set ctxt ((Helpers.S).(Map.S.add) k v

        (Helpers.get ctxt)).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v,
      Storage.Contract.Paid_storage_space
        .(Storage_sigs.Indexed_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      match v with
      | Some v'

          Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            (Helpers.get ctxt))
      | None

          Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            (Helpers.get ctxt))
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k,
      Storage.Contract.Paid_storage_space
        .(Storage_sigs.Indexed_data_storage.remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k,
      Storage.Contract.Paid_storage_space
        .(Storage_sigs.Indexed_data_storage.remove)
        (Raw_context.to_t ctxt) k =
      Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)).

    Axiom clear : (ctxt : Raw_context.t),
      Storage.Contract.Paid_storage_space
        .(Storage_sigs.Indexed_data_storage.clear)
        (Raw_context.to_t ctxt) =
      return? Helpers.set ctxt ((Helpers.S).(Map.S.empty)).

    Axiom keys : (ctxt : Raw_context.t),
      Storage.Contract.Paid_storage_space
        .(Storage_sigs.Indexed_data_storage.keys)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    Axiom bindings : (ctxt : Raw_context.t),
      Storage.Contract.Paid_storage_space
        .(Storage_sigs.Indexed_data_storage.bindings)
        (Raw_context.to_t ctxt) =
      return? (Helpers.S).(Map.S.bindings) (Helpers.get ctxt).

    Axiom fold : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ _ a M? a),
      Storage.Contract.Paid_storage_space
        .(Storage_sigs.Indexed_data_storage.fold)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold) (fun k v acclet? acc := acc in f k v acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    Axiom fold_keys : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ a M? a),
      Storage.Contract.Paid_storage_space
        .(Storage_sigs.Indexed_data_storage.fold_keys)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold)
        (fun k _ acclet? acc := acc in f k acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove clear keys bindings
       @fold @fold_keys : storage_db.
    #[global] Opaque Storage.Contract.Paid_storage_space.
  End Paid_storage_space.

  Module Used_storage_space.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Contract_Used_storage_space).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Contract_Used_storage_space := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Contract_repr.Index).
      Arguments S /.

      Definition name := ["used_bytes"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Contract.Used_storage_space
        .(Storage_sigs.Indexed_data_storage.mem)
        (Raw_context.to_t ctxt) k =
      (Helpers.S).(Map.S.mem) k
        (Helpers.get ctxt).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Contract.Used_storage_space
        .(Storage_sigs.Indexed_data_storage.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok v
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Contract.Used_storage_space
        .(Storage_sigs.Indexed_data_storage.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Some v)
      | Nonereturn? None
      end.

    Axiom update : (ctxt : Raw_context.t) k v,
      Storage.Contract.Used_storage_space
        .(Storage_sigs.Indexed_data_storage.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then

        return? Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v,
      Storage.Contract.Used_storage_space
        .(Storage_sigs.Indexed_data_storage.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)).

    Axiom add : (ctxt : Raw_context.t) k v,
      Storage.Contract.Used_storage_space
        .(Storage_sigs.Indexed_data_storage.add)
        (Raw_context.to_t ctxt) k v =
      Helpers.set ctxt ((Helpers.S).(Map.S.add) k v

        (Helpers.get ctxt)).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v,
      Storage.Contract.Used_storage_space
        .(Storage_sigs.Indexed_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      match v with
      | Some v'

          Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            (Helpers.get ctxt))
      | None

          Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            (Helpers.get ctxt))
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k,
      Storage.Contract.Used_storage_space
        .(Storage_sigs.Indexed_data_storage.remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k,
      Storage.Contract.Used_storage_space
        .(Storage_sigs.Indexed_data_storage.remove)
        (Raw_context.to_t ctxt) k =
      Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)).

    Axiom clear : (ctxt : Raw_context.t),
      Storage.Contract.Used_storage_space
        .(Storage_sigs.Indexed_data_storage.clear)
        (Raw_context.to_t ctxt) =
      return? Helpers.set ctxt ((Helpers.S).(Map.S.empty)).

    Axiom keys : (ctxt : Raw_context.t),
      Storage.Contract.Used_storage_space
        .(Storage_sigs.Indexed_data_storage.keys)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    Axiom bindings : (ctxt : Raw_context.t),
      Storage.Contract.Used_storage_space
        .(Storage_sigs.Indexed_data_storage.bindings)
        (Raw_context.to_t ctxt) =
      return? (Helpers.S).(Map.S.bindings) (Helpers.get ctxt).

    Axiom fold : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ _ a M? a),
      Storage.Contract.Used_storage_space
        .(Storage_sigs.Indexed_data_storage.fold)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold) (fun k v acclet? acc := acc in f k v acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    Axiom fold_keys : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ a M? a),
      Storage.Contract.Used_storage_space
        .(Storage_sigs.Indexed_data_storage.fold_keys)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold)
        (fun k _ acclet? acc := acc in f k acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove clear keys bindings
       @fold @fold_keys : storage_db.
    #[global] Opaque Storage.Contract.Used_storage_space.
  End Used_storage_space.

  Module Frozen_deposits.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Contract_Frozen_deposits).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Contract_Frozen_deposits := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Contract_repr.Index).
      Arguments S /.

      Definition name := ["frozen_deposits"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Contract.Frozen_deposits
        .(Storage_sigs.Indexed_data_storage.mem)
        (Raw_context.to_t ctxt) k =
      (Helpers.S).(Map.S.mem) k
        (Helpers.get ctxt).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Contract.Frozen_deposits
        .(Storage_sigs.Indexed_data_storage.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok v
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Contract.Frozen_deposits
        .(Storage_sigs.Indexed_data_storage.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Some v)
      | Nonereturn? None
      end.

    Axiom update : (ctxt : Raw_context.t) k v,
      Storage.Contract.Frozen_deposits
        .(Storage_sigs.Indexed_data_storage.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then

        return? Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v,
      Storage.Contract.Frozen_deposits
        .(Storage_sigs.Indexed_data_storage.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)).

    Axiom add : (ctxt : Raw_context.t) k v,
      Storage.Contract.Frozen_deposits
        .(Storage_sigs.Indexed_data_storage.add)
        (Raw_context.to_t ctxt) k v =
      Helpers.set ctxt ((Helpers.S).(Map.S.add) k v

        (Helpers.get ctxt)).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v,
      Storage.Contract.Frozen_deposits
        .(Storage_sigs.Indexed_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      match v with
      | Some v'

          Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            (Helpers.get ctxt))
      | None

          Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            (Helpers.get ctxt))
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k,
      Storage.Contract.Frozen_deposits
        .(Storage_sigs.Indexed_data_storage.remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k,
      Storage.Contract.Frozen_deposits
        .(Storage_sigs.Indexed_data_storage.remove)
        (Raw_context.to_t ctxt) k =
      Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)).

    Axiom clear : (ctxt : Raw_context.t),
      Storage.Contract.Frozen_deposits
        .(Storage_sigs.Indexed_data_storage.clear)
        (Raw_context.to_t ctxt) =
      return? Helpers.set ctxt ((Helpers.S).(Map.S.empty)).

    Axiom keys : (ctxt : Raw_context.t),
      Storage.Contract.Frozen_deposits
        .(Storage_sigs.Indexed_data_storage.keys)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    Axiom bindings : (ctxt : Raw_context.t),
      Storage.Contract.Frozen_deposits
        .(Storage_sigs.Indexed_data_storage.bindings)
        (Raw_context.to_t ctxt) =
      return? (Helpers.S).(Map.S.bindings) (Helpers.get ctxt).

    Axiom fold : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ _ a M? a),
      Storage.Contract.Frozen_deposits
        .(Storage_sigs.Indexed_data_storage.fold)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold) (fun k v acclet? acc := acc in f k v acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    Axiom fold_keys : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ a M? a),
      Storage.Contract.Frozen_deposits
        .(Storage_sigs.Indexed_data_storage.fold_keys)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold)
        (fun k _ acclet? acc := acc in f k acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove clear keys bindings
       @fold @fold_keys : storage_db.
    #[global] Opaque Storage.Contract.Frozen_deposits.
  End Frozen_deposits.

  Module Frozen_bonds.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Contract_Frozen_bonds).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Contract_Frozen_bonds := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition Map :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Contract_repr.Index).
      Arguments Map /.

      Definition Submap :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Bond_id_repr.Index).
      Arguments Submap /.

      Definition name := ["frozen_bonds"].
    End Helpers.

    Axiom mem : ctxt key subkey,
      Storage.Contract.Frozen_bonds
          .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
             .mem)

          (Raw_context.to_t ctxt, key) subkey =

      let map := (Helpers.Map).(Map.S.find)
        key (Helpers.get ctxt) in
      match map with

      | Some map

        return? (Raw_context.to_t ctxt,

          (Helpers.Submap).(Map.S.mem) subkey map)
      | Nonereturn? (Raw_context.to_t ctxt, false)
      end.

    Axiom get : ctxt subkey key,
      Storage.Contract.Frozen_bonds
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.get)
       (Raw_context.to_t ctxt, key)
       subkey =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Get) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
          let value := (Helpers.Submap).(Map.S.find) subkey submap' in
          match value with
          | Some value'return? (Raw_context.to_t ctxt, value')
          | Noneerror
          end
      | Noneerror
      end.

    Axiom find : ctxt subkey key,
      Storage.Contract.Frozen_bonds
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.find)
       (Raw_context.to_t ctxt, key)
       subkey =
     return? (Raw_context.to_t ctxt,
     let× map := (Helpers.Map).(Map.S.find)
       key
      (Helpers.get ctxt) in
     let× value := (Helpers.Submap).(Map.S.find) subkey map in
     return× value).

    Axiom update : ctxt subkey key value size,
      Storage.Contract.Frozen_bonds
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then

          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size)
        else error
      | Noneerror
      end.

    Axiom init_value : ctxt subkey key value size,
      Storage.Contract.Frozen_bonds
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then error
        else
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size)
      | None
        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size)
      end.

    Axiom add : ctxt key subkey value size,
      Storage.Contract.Frozen_bonds
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add)
      (Raw_context.to_t ctxt, key) subkey value =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
        let submap'' :=
          (Helpers.Submap).(Map.S.add) subkey value submap' in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size, mem)
      | None

        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size, false)
      end.

    Axiom add_or_remove : ctxt key subkey value_opt size,
      Storage.Contract.Frozen_bonds
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add_or_remove)
      (Raw_context.to_t ctxt, key) subkey value_opt =
      match value_opt with
      | Some value
        (* add the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
        | None

          let submap'' :=
            (Helpers.Submap).(Map.S.singleton) subkey value in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, false)
        end
      | None
        (* remove the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
        | None

            return? (Raw_context.to_t ctxt, size, false)
        end
      end.

    Axiom remove_existing : ctxt key subkey size,
      Storage.Contract.Frozen_bonds
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.remove_existing)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          if (Helpers.Submap).(Map.S.mem) subkey submap'
          then
            let submap'' :=
              (Helpers.Submap).(Map.S.remove) subkey submap' in
            let map' := (Helpers.Map).(Map.S.add) key submap'' map in
            return? (Helpers.set ctxt map', size)
          else
            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context.Del)
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : ctxt key subkey size,
      Storage.Contract.Frozen_bonds
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.remove)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
      | Nonereturn? (Raw_context.to_t ctxt, size, false)
      end.

    Axiom keys_unaccounted : ctxt key,
      Storage.Contract.Frozen_bonds
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.keys_unaccounted)
           (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'return? List.map fst ((Helpers.Submap).(Map.S.bindings)
          submap')
      | Nonereturn? []
      end.

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove keys_unaccounted

       : storage_db.
    #[global] Opaque Storage.Contract.Frozen_bonds.
  End Frozen_bonds.

  Module Total_frozen_bonds.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Contract_Total_frozen_bonds).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Contract_Total_frozen_bonds := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Contract_repr.Index).
      Arguments S /.

      Definition name := ["total_frozen_bonds"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Contract.Total_frozen_bonds
        .(Storage_sigs.Indexed_data_storage.mem)
        (Raw_context.to_t ctxt) k =
      (Helpers.S).(Map.S.mem) k
        (Helpers.get ctxt).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Contract.Total_frozen_bonds
        .(Storage_sigs.Indexed_data_storage.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok v
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Contract.Total_frozen_bonds
        .(Storage_sigs.Indexed_data_storage.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Some v)
      | Nonereturn? None
      end.

    Axiom update : (ctxt : Raw_context.t) k v,
      Storage.Contract.Total_frozen_bonds
        .(Storage_sigs.Indexed_data_storage.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then

        return? Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v,
      Storage.Contract.Total_frozen_bonds
        .(Storage_sigs.Indexed_data_storage.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)).

    Axiom add : (ctxt : Raw_context.t) k v,
      Storage.Contract.Total_frozen_bonds
        .(Storage_sigs.Indexed_data_storage.add)
        (Raw_context.to_t ctxt) k v =
      Helpers.set ctxt ((Helpers.S).(Map.S.add) k v

        (Helpers.get ctxt)).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v,
      Storage.Contract.Total_frozen_bonds
        .(Storage_sigs.Indexed_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      match v with
      | Some v'

          Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            (Helpers.get ctxt))
      | None

          Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            (Helpers.get ctxt))
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k,
      Storage.Contract.Total_frozen_bonds
        .(Storage_sigs.Indexed_data_storage.remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k,
      Storage.Contract.Total_frozen_bonds
        .(Storage_sigs.Indexed_data_storage.remove)
        (Raw_context.to_t ctxt) k =
      Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)).

    Axiom clear : (ctxt : Raw_context.t),
      Storage.Contract.Total_frozen_bonds
        .(Storage_sigs.Indexed_data_storage.clear)
        (Raw_context.to_t ctxt) =
      return? Helpers.set ctxt ((Helpers.S).(Map.S.empty)).

    Axiom keys : (ctxt : Raw_context.t),
      Storage.Contract.Total_frozen_bonds
        .(Storage_sigs.Indexed_data_storage.keys)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    Axiom bindings : (ctxt : Raw_context.t),
      Storage.Contract.Total_frozen_bonds
        .(Storage_sigs.Indexed_data_storage.bindings)
        (Raw_context.to_t ctxt) =
      return? (Helpers.S).(Map.S.bindings) (Helpers.get ctxt).

    Axiom fold : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ _ a M? a),
      Storage.Contract.Total_frozen_bonds
        .(Storage_sigs.Indexed_data_storage.fold)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold) (fun k v acclet? acc := acc in f k v acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    Axiom fold_keys : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ a M? a),
      Storage.Contract.Total_frozen_bonds
        .(Storage_sigs.Indexed_data_storage.fold_keys)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold)
        (fun k _ acclet? acc := acc in f k acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove clear keys bindings
       @fold @fold_keys : storage_db.
    #[global] Opaque Storage.Contract.Total_frozen_bonds.
  End Total_frozen_bonds.
End Contract.

Module Global_constants.
  Module Map.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Global_constants_Map).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Global_constants_Map := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          Script_expr_hash.Path_encoding_Make_hex_include.
      Arguments S /.

      Definition name := ["global_constant"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Global_constants.Map
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.mem)
        (Raw_context.to_t ctxt) k =
      return? (Raw_context.to_t ctxt, (Helpers.S).(Map.S.mem) k
         (Helpers.get ctxt)).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Global_constants.Map
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok (Raw_context.to_t ctxt, v)
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Global_constants.Map
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Raw_context.to_t ctxt, (Some v))
      | Nonereturn? (Raw_context.to_t ctxt, None)
      end.

    Axiom update : (ctxt : Raw_context.t) k v size,
      Storage.Global_constants.Map
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then

        let ctxt := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt)) in
        return? (ctxt, size)
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v size,
      Storage.Global_constants.Map
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? (Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)), size).

    Axiom add : (ctxt : Raw_context.t) k v size,
      Storage.Global_constants.Map
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add)
        (Raw_context.to_t ctxt) k v =
     let storage := (Helpers.get ctxt) in
     let bound := (Helpers.S).(Map.S.mem) k storage in
     let storage' := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v storage) in
       return? (storage', size, bound).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v size,
      Storage.Global_constants.Map
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      let storage := Helpers.get ctxt in
      let mem := (Helpers.S).(Map.S.mem) k storage in
      match v with
      | Some v'
          let ctxt' := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            storage) in
          return? (ctxt', size, mem)
      | None

          let ctxt' := Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            storage) in
          return? (ctxt', size, mem)
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k size,
      Storage.Global_constants.Map
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? (Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)), size)
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k size,
      Storage.Global_constants.Map
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .remove)
        (Raw_context.to_t ctxt) k =
      let storage := Helpers.get ctxt in
      let mem := (Helpers.S).(Map.S.mem) k storage in
      return? (Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        storage), size, mem).

    Axiom keys_unaccounted : (ctxt : Raw_context.t),
      Storage.Global_constants.Map
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .keys_unaccounted)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove keys_unaccounted

       : storage_db.
    #[global] Opaque Storage.Global_constants.Map.
  End Map.
End Global_constants.

Module Big_map.
  Module Next.
    Module Storage.
      Module Helpers.
        Definition get (ctxt : Raw_context.t) :=
          ctxt
            .(Raw_context.Big_map_Next_Storage).
        Arguments get _ /.

        Definition set (ctxt : Raw_context.t) value :=
          let ctxt' := ctxt <| Raw_context.Big_map_Next_Storage := value |> in
          (Raw_context.to_t ctxt').
        Arguments set _ _ /.

        Definition name := ["next"].
      End Helpers.

      Axiom mem : (ctxt : Raw_context.t),
        Storage.Big_map.Next.Storage
          .(Storage_sigs.Single_data_storage.mem)
          (Raw_context.to_t ctxt) =
         match Helpers.get ctxt with
          | Some _true
          | Nonefalse

          end.

      Axiom get : (ctxt : Raw_context.t),
        Storage.Big_map.Next.Storage
          .(Storage_sigs.Single_data_storage.get)
          (Raw_context.to_t ctxt) =
        match Helpers.get ctxt with
        | Some xPervasives.Ok x
        | None

            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context.Get)
        end.

      Axiom find : (ctxt : Raw_context.t),
        Storage.Big_map.Next.Storage
          .(Storage_sigs.Single_data_storage.find)
          (Raw_context.to_t ctxt) =
        return? Helpers.get ctxt.

      Axiom init_value : (ctxt : Raw_context.t) value,
        Storage.Big_map.Next.Storage
          .(Storage_sigs.Single_data_storage.init_value)
          (Raw_context.to_t ctxt) value =
        match Helpers.get ctxt with
        | None
            return? Helpers.set ctxt (Some value)
        | Some _

            Raw_context.storage_error_value
              (Raw_context.Existing_key Helpers.name)
        end.

      Axiom update : (ctxt : Raw_context.t) value,
        Storage.Big_map.Next.Storage
          .(Storage_sigs.Single_data_storage.update)
          (Raw_context.to_t ctxt) value =
        match Helpers.get ctxt with
        | Some _return? Helpers.set ctxt (Some value)
        | None

            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context._Set)
        end.

      Axiom add : (ctxt : Raw_context.t) value,
        Storage.Big_map.Next.Storage
          .(Storage_sigs.Single_data_storage.add)
          (Raw_context.to_t ctxt) value =
        match Helpers.get ctxt with
        | Some _Helpers.set ctxt (Some value)
        | None ⇒ (Raw_context.to_t ctxt)
        end.

      Axiom add_or_remove : (ctxt : Raw_context.t) value,
        Storage.Big_map.Next.Storage
          .(Storage_sigs.Single_data_storage.add_or_remove)
          (Raw_context.to_t ctxt) value =
          Helpers.set ctxt value.

      Axiom remove_existing : (ctxt : Raw_context.t),
        Storage.Big_map.Next.Storage
          .(Storage_sigs.Single_data_storage.remove_existing)
          (Raw_context.to_t ctxt) =
        match Helpers.get ctxt with
        | Some _return? Helpers.set ctxt None
        | None
            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context.Del)
        end.

      Axiom remove : (ctxt : Raw_context.t),
        Storage.Big_map.Next.Storage
          .(Storage_sigs.Single_data_storage.remove)
          (Raw_context.to_t ctxt) =
        match Helpers.get ctxt with
        | Some _Helpers.set ctxt None
        | NoneRaw_context.to_t ctxt
        end.

      #[global] Hint Rewrite mem get find init_value update add
        add_or_remove remove_existing remove : storage_db.
      #[global] Opaque Storage.Big_map.Next.Storage.
    End Storage.
  End Next.

  Module Total_bytes.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Big_map_Total_bytes).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Big_map_Total_bytes := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_lazy_storage_kind_id_index Storage.Big_map.Index).
      Arguments S /.

      Definition name := ["total_bytes"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Big_map.Total_bytes
        .(Storage_sigs.Indexed_data_storage_with_local_context.mem)
        (Raw_context.to_t ctxt) k =
      (Helpers.S).(Map.S.mem) k
        (Helpers.get ctxt).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Big_map.Total_bytes
        .(Storage_sigs.Indexed_data_storage_with_local_context.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok v
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Big_map.Total_bytes
        .(Storage_sigs.Indexed_data_storage_with_local_context.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Some v)
      | Nonereturn? None
      end.

    Axiom update : (ctxt : Raw_context.t) k v,
      Storage.Big_map.Total_bytes
        .(Storage_sigs.Indexed_data_storage_with_local_context.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then
        return? Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v,
      Storage.Big_map.Total_bytes
        .(Storage_sigs.Indexed_data_storage_with_local_context.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)).

    Axiom add : (ctxt : Raw_context.t) k v,
      Storage.Big_map.Total_bytes
        .(Storage_sigs.Indexed_data_storage_with_local_context.add)
        (Raw_context.to_t ctxt) k v =
      Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
        (Helpers.get ctxt)).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v,
      Storage.Big_map.Total_bytes
        .(Storage_sigs.Indexed_data_storage_with_local_context.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      match v with
      | Some v'
          Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            (Helpers.get ctxt))
      | None
          Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            (Helpers.get ctxt))
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k,
      Storage.Big_map.Total_bytes
        .(Storage_sigs.Indexed_data_storage_with_local_context.remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k,
      Storage.Big_map.Total_bytes
        .(Storage_sigs.Indexed_data_storage_with_local_context.remove)
        (Raw_context.to_t ctxt) k =
      Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)).

    Axiom clear : (ctxt : Raw_context.t),
      Storage.Big_map.Total_bytes
        .(Storage_sigs.Indexed_data_storage_with_local_context.clear)
        (Raw_context.to_t ctxt) =
      return? Helpers.set ctxt ((Helpers.S).(Map.S.empty)).

    Axiom keys : (ctxt : Raw_context.t),
      Storage.Big_map.Total_bytes
        .(Storage_sigs.Indexed_data_storage_with_local_context.keys)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    Axiom bindings : (ctxt : Raw_context.t),
      Storage.Big_map.Total_bytes
        .(Storage_sigs.Indexed_data_storage_with_local_context.bindings)
        (Raw_context.to_t ctxt) =
      return? (Helpers.S).(Map.S.bindings) (Helpers.get ctxt).

    Axiom fold : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ _ a M? a),
      Storage.Big_map.Total_bytes
        .(Storage_sigs.Indexed_data_storage_with_local_context.fold)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold) (fun k v acclet? acc := acc in f k v acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    Axiom fold_keys : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ a M? a),
      Storage.Big_map.Total_bytes
        .(Storage_sigs.Indexed_data_storage_with_local_context.fold_keys)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold)
        (fun k _ acclet? acc := acc in f k acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove clear keys bindings
       @fold @fold_keys : storage_db.
    #[global] Opaque Storage.Big_map.Total_bytes.
  End Total_bytes.

  Module Key_type.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Big_map_Key_type).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Big_map_Key_type := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_lazy_storage_kind_id_index Storage.Big_map.Index).
      Arguments S /.

      Definition name := ["key_type"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Big_map.Key_type
        .(Storage_sigs.Indexed_data_storage.mem)
        (Raw_context.to_t ctxt) k =
      (Helpers.S).(Map.S.mem) k
        (Helpers.get ctxt).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Big_map.Key_type
        .(Storage_sigs.Indexed_data_storage.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok v
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Big_map.Key_type
        .(Storage_sigs.Indexed_data_storage.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Some v)
      | Nonereturn? None
      end.

    Axiom update : (ctxt : Raw_context.t) k v,
      Storage.Big_map.Key_type
        .(Storage_sigs.Indexed_data_storage.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then

        return? Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v,
      Storage.Big_map.Key_type
        .(Storage_sigs.Indexed_data_storage.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)).

    Axiom add : (ctxt : Raw_context.t) k v,
      Storage.Big_map.Key_type
        .(Storage_sigs.Indexed_data_storage.add)
        (Raw_context.to_t ctxt) k v =
      Helpers.set ctxt ((Helpers.S).(Map.S.add) k v

        (Helpers.get ctxt)).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v,
      Storage.Big_map.Key_type
        .(Storage_sigs.Indexed_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      match v with
      | Some v'

          Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            (Helpers.get ctxt))
      | None

          Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            (Helpers.get ctxt))
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k,
      Storage.Big_map.Key_type
        .(Storage_sigs.Indexed_data_storage.remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k,
      Storage.Big_map.Key_type
        .(Storage_sigs.Indexed_data_storage.remove)
        (Raw_context.to_t ctxt) k =
      Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)).

    Axiom clear : (ctxt : Raw_context.t),
      Storage.Big_map.Key_type
        .(Storage_sigs.Indexed_data_storage.clear)
        (Raw_context.to_t ctxt) =
      return? Helpers.set ctxt ((Helpers.S).(Map.S.empty)).

    Axiom keys : (ctxt : Raw_context.t),
      Storage.Big_map.Key_type
        .(Storage_sigs.Indexed_data_storage.keys)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    Axiom bindings : (ctxt : Raw_context.t),
      Storage.Big_map.Key_type
        .(Storage_sigs.Indexed_data_storage.bindings)
        (Raw_context.to_t ctxt) =
      return? (Helpers.S).(Map.S.bindings) (Helpers.get ctxt).

    Axiom fold : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ _ a M? a),
      Storage.Big_map.Key_type
        .(Storage_sigs.Indexed_data_storage.fold)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold) (fun k v acclet? acc := acc in f k v acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    Axiom fold_keys : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ a M? a),
      Storage.Big_map.Key_type
        .(Storage_sigs.Indexed_data_storage.fold_keys)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold)
        (fun k _ acclet? acc := acc in f k acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove clear keys bindings
       @fold @fold_keys : storage_db.
    #[global] Opaque Storage.Big_map.Key_type.
  End Key_type.

  Module Value_type.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Big_map_Value_type).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Big_map_Value_type := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_lazy_storage_kind_id_index Storage.Big_map.Index).
      Arguments S /.

      Definition name := ["value_type"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Big_map.Value_type
        .(Storage_sigs.Indexed_data_storage.mem)
        (Raw_context.to_t ctxt) k =
      (Helpers.S).(Map.S.mem) k
        (Helpers.get ctxt).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Big_map.Value_type
        .(Storage_sigs.Indexed_data_storage.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok v
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Big_map.Value_type
        .(Storage_sigs.Indexed_data_storage.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Some v)
      | Nonereturn? None
      end.

    Axiom update : (ctxt : Raw_context.t) k v,
      Storage.Big_map.Value_type
        .(Storage_sigs.Indexed_data_storage.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then

        return? Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v,
      Storage.Big_map.Value_type
        .(Storage_sigs.Indexed_data_storage.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)).

    Axiom add : (ctxt : Raw_context.t) k v,
      Storage.Big_map.Value_type
        .(Storage_sigs.Indexed_data_storage.add)
        (Raw_context.to_t ctxt) k v =
      Helpers.set ctxt ((Helpers.S).(Map.S.add) k v

        (Helpers.get ctxt)).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v,
      Storage.Big_map.Value_type
        .(Storage_sigs.Indexed_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      match v with
      | Some v'

          Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            (Helpers.get ctxt))
      | None

          Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            (Helpers.get ctxt))
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k,
      Storage.Big_map.Value_type
        .(Storage_sigs.Indexed_data_storage.remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k,
      Storage.Big_map.Value_type
        .(Storage_sigs.Indexed_data_storage.remove)
        (Raw_context.to_t ctxt) k =
      Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)).

    Axiom clear : (ctxt : Raw_context.t),
      Storage.Big_map.Value_type
        .(Storage_sigs.Indexed_data_storage.clear)
        (Raw_context.to_t ctxt) =
      return? Helpers.set ctxt ((Helpers.S).(Map.S.empty)).

    Axiom keys : (ctxt : Raw_context.t),
      Storage.Big_map.Value_type
        .(Storage_sigs.Indexed_data_storage.keys)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    Axiom bindings : (ctxt : Raw_context.t),
      Storage.Big_map.Value_type
        .(Storage_sigs.Indexed_data_storage.bindings)
        (Raw_context.to_t ctxt) =
      return? (Helpers.S).(Map.S.bindings) (Helpers.get ctxt).

    Axiom fold : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ _ a M? a),
      Storage.Big_map.Value_type
        .(Storage_sigs.Indexed_data_storage.fold)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold) (fun k v acclet? acc := acc in f k v acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    Axiom fold_keys : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ a M? a),
      Storage.Big_map.Value_type
        .(Storage_sigs.Indexed_data_storage.fold_keys)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold)
        (fun k _ acclet? acc := acc in f k acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove clear keys bindings
       @fold @fold_keys : storage_db.
    #[global] Opaque Storage.Big_map.Value_type.
  End Value_type.

  Module Contents.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Big_map_Contents).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Big_map_Contents := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition Map :=
        Storage_sigs.Indexed_map.Map
          (of_lazy_storage_kind_id_index Storage.Big_map.Index).
      Arguments Map /.

      Definition Submap :=
        Storage_sigs.Indexed_map.Map
          Script_expr_hash.Path_encoding_Make_hex_include.
      Arguments Submap /.

      Definition name := ["contents"].
    End Helpers.

    Axiom mem : ctxt key subkey,
      Storage.Big_map.Contents
          .(Storage_sigs.Indexed_carbonated_data_storage.mem)

          (Raw_context.to_t ctxt, key) subkey =

      let map := (Helpers.Map).(Map.S.find)
        key (Helpers.get ctxt) in
      match map with

      | Some map

        return? (Raw_context.to_t ctxt, (Helpers.Submap).(Map.S.mem) subkey map)
      | Nonereturn? (Raw_context.to_t ctxt, false)
      end.

    Axiom get : ctxt subkey key,
      Storage.Big_map.Contents
        .(Storage_sigs.Indexed_carbonated_data_storage.get)
       (Raw_context.to_t ctxt, key)
       subkey =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Get) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
          let value := (Helpers.Submap).(Map.S.find) subkey submap' in
          match value with
          | Some value'return? (Raw_context.to_t ctxt, value')
          | Noneerror
          end
      | Noneerror
      end.

    Axiom find : ctxt subkey key,
      Storage.Big_map.Contents
        .(Storage_sigs.Indexed_carbonated_data_storage.find)
       (Raw_context.to_t ctxt, key)
       subkey =
     return? (Raw_context.to_t ctxt,
     let× map := (Helpers.Map).(Map.S.find)
       key
      (Helpers.get ctxt) in
     let× value := (Helpers.Submap).(Map.S.find) subkey map in
     return× value).

    Axiom update : ctxt subkey key value i,
      Storage.Big_map.Contents
        .(Storage_sigs.Indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then

          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', i)
        else error
      | Noneerror
      end.

    Axiom init_value : ctxt subkey key value i,
      Storage.Big_map.Contents
        .(Storage_sigs.Indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then error
        else
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', i)
      | None
        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', i)
      end.

    Axiom add : ctxt key subkey value i,
      Storage.Big_map.Contents
        .(Storage_sigs.Indexed_carbonated_data_storage.add)
      (Raw_context.to_t ctxt, key) subkey value =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        let submap'' :=
          (Helpers.Submap).(Map.S.add) subkey value submap' in
        let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', i, mem)
      | None

        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', i, false)
      end.

    Axiom add_or_remove : ctxt key subkey value_opt i,
      Storage.Big_map.Contents
        .(Storage_sigs.Indexed_carbonated_data_storage.add_or_remove)
      (Raw_context.to_t ctxt, key) subkey value_opt =
      match value_opt with
      | Some value
        (* add the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', i, mem)
        | None

          let submap'' :=
            (Helpers.Submap).(Map.S.singleton) subkey value in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', i, false)
        end
      | None
        (* remove the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          return? (Helpers.set ctxt map', i, mem)
        | Nonereturn? (Raw_context.to_t ctxt, i, false)
        end
      end.

    Axiom remove_existing : ctxt key subkey i,
      Storage.Big_map.Contents
        .(Storage_sigs.Indexed_carbonated_data_storage.remove_existing)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          if (Helpers.Submap).(Map.S.mem) subkey submap'
          then
            let submap'' :=
              (Helpers.Submap).(Map.S.remove) subkey submap' in
            let map' := (Helpers.Map).(Map.S.add) key submap'' map in
            return? (Helpers.set ctxt map', i)
          else
            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context.Del)
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : ctxt key subkey i,
      Storage.Big_map.Contents
        .(Storage_sigs.Indexed_carbonated_data_storage.remove)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', i, mem)
      | Nonereturn? (Raw_context.to_t ctxt, i, false)
      end.

    Axiom list_key_values : ctxt key offset length,
      Storage.Big_map.Contents
        .(Storage_sigs.Indexed_carbonated_data_storage.list_key_values) offset length
           (Raw_context.to_t ctxt, key) =
      let map := (Helpers.Map).(Map.S.find) key (Helpers.get ctxt) in
      match map with
      | Some submap
        return? (Raw_context.to_t ctxt, (Helpers.Submap).(Map.S.bindings) submap)
      | Nonereturn? (Raw_context.to_t ctxt, [])
      end.

    #[global] Hint Rewrite mem get find init_value update add
      add_or_remove remove_existing remove list_key_values : storage_db.
    #[global] Opaque Storage.Big_map.Contents.
  End Contents.
End Big_map.

Module Sapling.
  Module Next.
    Module Storage.
      Module Helpers.
        Definition get (ctxt : Raw_context.t) :=
          ctxt
            .(Raw_context.Sapling_Next_Storage).
        Arguments get _ /.

        Definition set (ctxt : Raw_context.t) value :=
          let ctxt' := ctxt <| Raw_context.Sapling_Next_Storage := value |> in
          (Raw_context.to_t ctxt').
        Arguments set _ _ /.

        Definition name := ["next"].
      End Helpers.

      Axiom mem : (ctxt : Raw_context.t),
        Storage.Sapling.Next.Storage
          .(Storage_sigs.Single_data_storage.mem)
          (Raw_context.to_t ctxt) =
         match Helpers.get ctxt with
          | Some _true
          | Nonefalse

          end.

      Axiom get : (ctxt : Raw_context.t),
        Storage.Sapling.Next.Storage
          .(Storage_sigs.Single_data_storage.get)
          (Raw_context.to_t ctxt) =
        match Helpers.get ctxt with
        | Some xPervasives.Ok x
        | None

            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context.Get)
        end.

      Axiom find : (ctxt : Raw_context.t),
        Storage.Sapling.Next.Storage
          .(Storage_sigs.Single_data_storage.find)
          (Raw_context.to_t ctxt) =
        return? Helpers.get ctxt.

      Axiom init_value : (ctxt : Raw_context.t) value,
        Storage.Sapling.Next.Storage
          .(Storage_sigs.Single_data_storage.init_value)
          (Raw_context.to_t ctxt) value =
        match Helpers.get ctxt with
        | None
            return? Helpers.set ctxt (Some value)
        | Some _

            Raw_context.storage_error_value
              (Raw_context.Existing_key Helpers.name)
        end.

      Axiom update : (ctxt : Raw_context.t) value,
        Storage.Sapling.Next.Storage
          .(Storage_sigs.Single_data_storage.update)
          (Raw_context.to_t ctxt) value =
        match Helpers.get ctxt with
        | Some _return? Helpers.set ctxt (Some value)
        | None

            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context._Set)
        end.

      Axiom add : (ctxt : Raw_context.t) value,
        Storage.Sapling.Next.Storage
          .(Storage_sigs.Single_data_storage.add)
          (Raw_context.to_t ctxt) value =
        match Helpers.get ctxt with
        | Some _Helpers.set ctxt (Some value)
        | None ⇒ (Raw_context.to_t ctxt)
        end.

      Axiom add_or_remove : (ctxt : Raw_context.t) value,
        Storage.Sapling.Next.Storage
          .(Storage_sigs.Single_data_storage.add_or_remove)
          (Raw_context.to_t ctxt) value =
          Helpers.set ctxt value.

      Axiom remove_existing : (ctxt : Raw_context.t),
        Storage.Sapling.Next.Storage
          .(Storage_sigs.Single_data_storage.remove_existing)
          (Raw_context.to_t ctxt) =
        match Helpers.get ctxt with
        | Some _return? Helpers.set ctxt None
        | None
            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context.Del)
        end.

      Axiom remove : (ctxt : Raw_context.t),
        Storage.Sapling.Next.Storage
          .(Storage_sigs.Single_data_storage.remove)
          (Raw_context.to_t ctxt) =
        match Helpers.get ctxt with
        | Some _Helpers.set ctxt None
        | NoneRaw_context.to_t ctxt
        end.

      #[global] Hint Rewrite mem get find init_value update add
        add_or_remove remove_existing remove : storage_db.
      #[global] Opaque Storage.Sapling.Next.Storage.
    End Storage.
  End Next.

  Module Total_bytes.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Sapling_Total_bytes).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Sapling_Total_bytes := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_lazy_storage_kind_id_index Storage.Sapling.Index).
      Arguments S /.

      Definition name := ["total_bytes"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Sapling.Total_bytes
        .(Storage_sigs.Indexed_data_storage_with_local_context.mem)
        (Raw_context.to_t ctxt) k =
      (Helpers.S).(Map.S.mem) k
        (Helpers.get ctxt).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Sapling.Total_bytes
        .(Storage_sigs.Indexed_data_storage_with_local_context.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok v
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Sapling.Total_bytes
        .(Storage_sigs.Indexed_data_storage_with_local_context.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Some v)
      | Nonereturn? None
      end.

    Axiom update : (ctxt : Raw_context.t) k v,
      Storage.Sapling.Total_bytes
        .(Storage_sigs.Indexed_data_storage_with_local_context.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then
        return? Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v,
      Storage.Sapling.Total_bytes
        .(Storage_sigs.Indexed_data_storage_with_local_context.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)).

    Axiom add : (ctxt : Raw_context.t) k v,
      Storage.Sapling.Total_bytes
        .(Storage_sigs.Indexed_data_storage_with_local_context.add)
        (Raw_context.to_t ctxt) k v =
      Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
        (Helpers.get ctxt)).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v,
      Storage.Sapling.Total_bytes
        .(Storage_sigs.Indexed_data_storage_with_local_context.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      match v with
      | Some v'
          Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            (Helpers.get ctxt))
      | None
          Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            (Helpers.get ctxt))
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k,
      Storage.Sapling.Total_bytes
        .(Storage_sigs.Indexed_data_storage_with_local_context.remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k,
      Storage.Sapling.Total_bytes
        .(Storage_sigs.Indexed_data_storage_with_local_context.remove)
        (Raw_context.to_t ctxt) k =
      Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)).

    Axiom clear : (ctxt : Raw_context.t),
      Storage.Sapling.Total_bytes
        .(Storage_sigs.Indexed_data_storage_with_local_context.clear)
        (Raw_context.to_t ctxt) =
      return? Helpers.set ctxt ((Helpers.S).(Map.S.empty)).

    Axiom keys : (ctxt : Raw_context.t),
      Storage.Sapling.Total_bytes
        .(Storage_sigs.Indexed_data_storage_with_local_context.keys)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    Axiom bindings : (ctxt : Raw_context.t),
      Storage.Sapling.Total_bytes
        .(Storage_sigs.Indexed_data_storage_with_local_context.bindings)
        (Raw_context.to_t ctxt) =
      return? (Helpers.S).(Map.S.bindings) (Helpers.get ctxt).

    Axiom fold : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ _ a M? a),
      Storage.Sapling.Total_bytes
        .(Storage_sigs.Indexed_data_storage_with_local_context.fold)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold) (fun k v acclet? acc := acc in f k v acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    Axiom fold_keys : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ a M? a),
      Storage.Sapling.Total_bytes
        .(Storage_sigs.Indexed_data_storage_with_local_context.fold_keys)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold)
        (fun k _ acclet? acc := acc in f k acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove clear keys bindings
       @fold @fold_keys : storage_db.
    #[global] Opaque Storage.Sapling.Total_bytes.
  End Total_bytes.

  Module Commitments_size.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Sapling_Commitments_size).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Sapling_Commitments_size := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition Map :=
        Storage_sigs.Indexed_map.Map
          (of_lazy_storage_kind_id_index Storage.Sapling.Index).
      Arguments Map /.

      Definition name := ["commitment_size"].
    End Helpers.

    Axiom mem : ctxt key,
      Storage.Sapling.Commitments_size
          .(Storage_sigs.Single_data_storage.mem)

          (Raw_context.to_t ctxt, key) =

      (Helpers.Map).(Map.S.mem) key (Helpers.get ctxt).

    Axiom get : ctxt key,
      Storage.Sapling.Commitments_size
        .(Storage_sigs.Single_data_storage.get)
       (Raw_context.to_t ctxt, key) =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Get) in
      let map := (Helpers.get ctxt) in
      let x := (Helpers.Map).(Map.S.find) key map in
      match x with
      | Some value'return? value'
      | Noneerror
      end.

    Axiom find : ctxt key,
      Storage.Sapling.Commitments_size
        .(Storage_sigs.Single_data_storage.find)
       (Raw_context.to_t ctxt, key) =
     return? (
     let× value := (Helpers.Map).(Map.S.find)
       key
      (Helpers.get ctxt) in
     return× value).

    Axiom update : ctxt key value,
      Storage.Sapling.Commitments_size
        .(Storage_sigs.Single_data_storage.update)
       (Raw_context.to_t ctxt, key) value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      if (Helpers.Map).(Map.S.mem) key map
        then

          let map' := (Helpers.Map).(Map.S.add) key value map in
          return? Helpers.set ctxt map'
      else error.

    Axiom init_value : ctxt key value,
      Storage.Sapling.Commitments_size
        .(Storage_sigs.Single_data_storage.update)
       (Raw_context.to_t ctxt, key) value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      if (Helpers.Map).(Map.S.mem) key map
        then error
        else
          let map' := (Helpers.Map).(Map.S.add) key value map in
          return? Helpers.set ctxt map'.

    Axiom add : ctxt key value,
      Storage.Sapling.Commitments_size
        .(Storage_sigs.Single_data_storage.add)
      (Raw_context.to_t ctxt, key) value =
      let map := (Helpers.get ctxt) in
      let map' := (Helpers.Map).(Map.S.add) key value map in
      Helpers.set ctxt map'.

    Axiom add_or_remove : ctxt key value_opt,
      Storage.Sapling.Commitments_size
        .(Storage_sigs.Single_data_storage.add_or_remove)
      (Raw_context.to_t ctxt, key) value_opt =
      match value_opt with
      | Some value
        (* add the value *)
        let map := (Helpers.get ctxt) in
        let map' := (Helpers.Map).(Map.S.add) key value map in
          Helpers.set ctxt map'
      | None
        (* remove the value *)
        let map := (Helpers.get ctxt) in
        let map' := (Helpers.Map).(Map.S.remove) key map in
        Helpers.set ctxt map'
      end.

    Axiom remove_existing : ctxt key,
      Storage.Sapling.Commitments_size
        .(Storage_sigs.Single_data_storage.remove_existing)
      (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      if (Helpers.Map).(Map.S.mem) key map
      then
        let map' := (Helpers.Map).(Map.S.remove) key map in
        return? Helpers.set ctxt map'
      else
        Raw_context.storage_error_value
          (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : ctxt key,
      Storage.Sapling.Commitments_size
        .(Storage_sigs.Single_data_storage.remove)
      (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      let map' := (Helpers.Map).(Map.S.remove) key map in
      Helpers.set ctxt map'.

    #[global] Hint Rewrite mem get find init_value update add
      add_or_remove remove_existing remove : storage_db.
    #[global] Opaque Storage.Sapling.Commitments_size.
  End Commitments_size.

  Module Memo_size.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Sapling_Memo_size).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Sapling_Memo_size := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition Map :=
        Storage_sigs.Indexed_map.Map
          (of_lazy_storage_kind_id_index Storage.Sapling.Index).
      Arguments Map /.

      Definition name := ["memo_size"].
    End Helpers.

    Axiom mem : ctxt key,
      Storage.Sapling.Memo_size
          .(Storage_sigs.Single_data_storage.mem)

          (Raw_context.to_t ctxt, key) =

      (Helpers.Map).(Map.S.mem) key (Helpers.get ctxt).

    Axiom get : ctxt key,
      Storage.Sapling.Memo_size
        .(Storage_sigs.Single_data_storage.get)
       (Raw_context.to_t ctxt, key) =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Get) in
      let map := (Helpers.get ctxt) in
      let x := (Helpers.Map).(Map.S.find) key map in
      match x with
      | Some value'return? value'
      | Noneerror
      end.

    Axiom find : ctxt key,
      Storage.Sapling.Memo_size
        .(Storage_sigs.Single_data_storage.find)
       (Raw_context.to_t ctxt, key) =
     return? (
     let× value := (Helpers.Map).(Map.S.find)
       key
      (Helpers.get ctxt) in
     return× value).

    Axiom update : ctxt key value,
      Storage.Sapling.Memo_size
        .(Storage_sigs.Single_data_storage.update)
       (Raw_context.to_t ctxt, key) value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      if (Helpers.Map).(Map.S.mem) key map
        then

          let map' := (Helpers.Map).(Map.S.add) key value map in
          return? Helpers.set ctxt map'
      else error.

    Axiom init_value : ctxt key value,
      Storage.Sapling.Memo_size
        .(Storage_sigs.Single_data_storage.update)
       (Raw_context.to_t ctxt, key) value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      if (Helpers.Map).(Map.S.mem) key map
        then error
        else
          let map' := (Helpers.Map).(Map.S.add) key value map in
          return? Helpers.set ctxt map'.

    Axiom add : ctxt key value,
      Storage.Sapling.Memo_size
        .(Storage_sigs.Single_data_storage.add)
      (Raw_context.to_t ctxt, key) value =
      let map := (Helpers.get ctxt) in
      let map' := (Helpers.Map).(Map.S.add) key value map in
      Helpers.set ctxt map'.

    Axiom add_or_remove : ctxt key value_opt,
      Storage.Sapling.Memo_size
        .(Storage_sigs.Single_data_storage.add_or_remove)
      (Raw_context.to_t ctxt, key) value_opt =
      match value_opt with
      | Some value
        (* add the value *)
        let map := (Helpers.get ctxt) in
        let map' := (Helpers.Map).(Map.S.add) key value map in
          Helpers.set ctxt map'
      | None
        (* remove the value *)
        let map := (Helpers.get ctxt) in
        let map' := (Helpers.Map).(Map.S.remove) key map in
        Helpers.set ctxt map'
      end.

    Axiom remove_existing : ctxt key,
      Storage.Sapling.Memo_size
        .(Storage_sigs.Single_data_storage.remove_existing)
      (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      if (Helpers.Map).(Map.S.mem) key map
      then
        let map' := (Helpers.Map).(Map.S.remove) key map in
        return? Helpers.set ctxt map'
      else
        Raw_context.storage_error_value
          (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : ctxt key,
      Storage.Sapling.Memo_size
        .(Storage_sigs.Single_data_storage.remove)
      (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      let map' := (Helpers.Map).(Map.S.remove) key map in
      Helpers.set ctxt map'.

    #[global] Hint Rewrite mem get find init_value update add
      add_or_remove remove_existing remove : storage_db.
    #[global] Opaque Storage.Sapling.Memo_size.
  End Memo_size.

  Module Commitments.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Sapling_Commitments).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Sapling_Commitments := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition Map :=
        Storage_sigs.Indexed_map.Map
          (of_functors_index Raw_context.Sapling_Commitments_Index).
      Arguments Map /.

      Definition Submap :=
        Storage_sigs.Indexed_map.Map
          (of_lazy_storage_kind_id_index Storage.Sapling.Index).
      Arguments Submap /.

      Definition name := ["commitments"].
    End Helpers.

    Axiom mem : ctxt key subkey,
      Storage.Sapling.Commitments
          .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
             .mem)

          (Raw_context.to_t ctxt, key) subkey =

      let map := (Helpers.Map).(Map.S.find)
        key (Helpers.get ctxt) in
      match map with

      | Some map

        return? (Raw_context.to_t ctxt,

          (Helpers.Submap).(Map.S.mem) subkey map)
      | Nonereturn? (Raw_context.to_t ctxt, false)
      end.

    Axiom get : ctxt subkey key,
      Storage.Sapling.Commitments
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.get)
       (Raw_context.to_t ctxt, key)
       subkey =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Get) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
          let value := (Helpers.Submap).(Map.S.find) subkey submap' in
          match value with
          | Some value'return? (Raw_context.to_t ctxt, value')
          | Noneerror
          end
      | Noneerror
      end.

    Axiom find : ctxt subkey key,
      Storage.Sapling.Commitments
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.find)
       (Raw_context.to_t ctxt, key)
       subkey =
     return? (Raw_context.to_t ctxt,
     let× map := (Helpers.Map).(Map.S.find)
       key
      (Helpers.get ctxt) in
     let× value := (Helpers.Submap).(Map.S.find) subkey map in
     return× value).

    Axiom update : ctxt subkey key value size,
      Storage.Sapling.Commitments
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then

          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size)
        else error
      | Noneerror
      end.

    Axiom init_value : ctxt subkey key value size,
      Storage.Sapling.Commitments
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then error
        else
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size)
      | None
        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size)
      end.

    Axiom add : ctxt key subkey value size,
      Storage.Sapling.Commitments
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add)
      (Raw_context.to_t ctxt, key) subkey value =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
        let submap'' :=
          (Helpers.Submap).(Map.S.add) subkey value submap' in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size, mem)
      | None

        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size, false)
      end.

    Axiom add_or_remove : ctxt key subkey value_opt size,
      Storage.Sapling.Commitments
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add_or_remove)
      (Raw_context.to_t ctxt, key) subkey value_opt =
      match value_opt with
      | Some value
        (* add the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
        | None

          let submap'' :=
            (Helpers.Submap).(Map.S.singleton) subkey value in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, false)
        end
      | None
        (* remove the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
        | None

            return? (Raw_context.to_t ctxt, size, false)
        end
      end.

    Axiom remove_existing : ctxt key subkey size,
      Storage.Sapling.Commitments
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.remove_existing)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          if (Helpers.Submap).(Map.S.mem) subkey submap'
          then
            let submap'' :=
              (Helpers.Submap).(Map.S.remove) subkey submap' in
            let map' := (Helpers.Map).(Map.S.add) key submap'' map in
            return? (Helpers.set ctxt map', size)
          else
            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context.Del)
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : ctxt key subkey size,
      Storage.Sapling.Commitments
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.remove)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
      | Nonereturn? (Raw_context.to_t ctxt, size, false)
      end.

    Axiom keys_unaccounted : ctxt key,
      Storage.Sapling.Commitments
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.keys_unaccounted)
           (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'return? List.map fst ((Helpers.Submap).(Map.S.bindings)
          submap')
      | Nonereturn? []
      end.

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove keys_unaccounted

       : storage_db.
    #[global] Opaque Storage.Sapling.Commitments.
  End Commitments.

  Module Ciphertexts.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Sapling_Ciphertexts).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Sapling_Ciphertexts := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition Map :=
        Storage_sigs.Indexed_map.Map
          (of_functors_index Raw_context.Sapling_Ciphertexts_Index).
      Arguments Map /.

      Definition Submap :=
        Storage_sigs.Indexed_map.Map
          (of_lazy_storage_kind_id_index Storage.Sapling.Index).
      Arguments Submap /.

      Definition name := ["ciphertexts"].
    End Helpers.

    Axiom mem : ctxt key subkey,
      Storage.Sapling.Ciphertexts
          .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
             .mem)

          (Raw_context.to_t ctxt, key) subkey =

      let map := (Helpers.Map).(Map.S.find)
        key (Helpers.get ctxt) in
      match map with

      | Some map

        return? (Raw_context.to_t ctxt,

          (Helpers.Submap).(Map.S.mem) subkey map)
      | Nonereturn? (Raw_context.to_t ctxt, false)
      end.

    Axiom get : ctxt subkey key,
      Storage.Sapling.Ciphertexts
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.get)
       (Raw_context.to_t ctxt, key)
       subkey =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Get) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
          let value := (Helpers.Submap).(Map.S.find) subkey submap' in
          match value with
          | Some value'return? (Raw_context.to_t ctxt, value')
          | Noneerror
          end
      | Noneerror
      end.

    Axiom find : ctxt subkey key,
      Storage.Sapling.Ciphertexts
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.find)
       (Raw_context.to_t ctxt, key)
       subkey =
     return? (Raw_context.to_t ctxt,
     let× map := (Helpers.Map).(Map.S.find)
       key
      (Helpers.get ctxt) in
     let× value := (Helpers.Submap).(Map.S.find) subkey map in
     return× value).

    Axiom update : ctxt subkey key value size,
      Storage.Sapling.Ciphertexts
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then

          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size)
        else error
      | Noneerror
      end.

    Axiom init_value : ctxt subkey key value size,
      Storage.Sapling.Ciphertexts
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then error
        else
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size)
      | None
        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size)
      end.

    Axiom add : ctxt key subkey value size,
      Storage.Sapling.Ciphertexts
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add)
      (Raw_context.to_t ctxt, key) subkey value =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
        let submap'' :=
          (Helpers.Submap).(Map.S.add) subkey value submap' in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size, mem)
      | None

        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size, false)
      end.

    Axiom add_or_remove : ctxt key subkey value_opt size,
      Storage.Sapling.Ciphertexts
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add_or_remove)
      (Raw_context.to_t ctxt, key) subkey value_opt =
      match value_opt with
      | Some value
        (* add the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
        | None

          let submap'' :=
            (Helpers.Submap).(Map.S.singleton) subkey value in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, false)
        end
      | None
        (* remove the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
        | None

            return? (Raw_context.to_t ctxt, size, false)
        end
      end.

    Axiom remove_existing : ctxt key subkey size,
      Storage.Sapling.Ciphertexts
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.remove_existing)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          if (Helpers.Submap).(Map.S.mem) subkey submap'
          then
            let submap'' :=
              (Helpers.Submap).(Map.S.remove) subkey submap' in
            let map' := (Helpers.Map).(Map.S.add) key submap'' map in
            return? (Helpers.set ctxt map', size)
          else
            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context.Del)
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : ctxt key subkey size,
      Storage.Sapling.Ciphertexts
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.remove)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
      | Nonereturn? (Raw_context.to_t ctxt, size, false)
      end.

    Axiom keys_unaccounted : ctxt key,
      Storage.Sapling.Ciphertexts
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.keys_unaccounted)
           (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'return? List.map fst ((Helpers.Submap).(Map.S.bindings)
          submap')
      | Nonereturn? []
      end.

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove keys_unaccounted

       : storage_db.
    #[global] Opaque Storage.Sapling.Ciphertexts.
  End Ciphertexts.

  Module Nullifiers_size.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Sapling_Nullifiers_size).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Sapling_Nullifiers_size := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition Map :=
        Storage_sigs.Indexed_map.Map
          (of_lazy_storage_kind_id_index Storage.Sapling.Index).
      Arguments Map /.

      Definition name := ["nullifiers_size"].
    End Helpers.

    Axiom mem : ctxt key,
      Storage.Sapling.Nullifiers_size
          .(Storage_sigs.Single_data_storage.mem)

          (Raw_context.to_t ctxt, key) =

      (Helpers.Map).(Map.S.mem) key (Helpers.get ctxt).

    Axiom get : ctxt key,
      Storage.Sapling.Nullifiers_size
        .(Storage_sigs.Single_data_storage.get)
       (Raw_context.to_t ctxt, key) =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Get) in
      let map := (Helpers.get ctxt) in
      let x := (Helpers.Map).(Map.S.find) key map in
      match x with
      | Some value'return? value'
      | Noneerror
      end.

    Axiom find : ctxt key,
      Storage.Sapling.Nullifiers_size
        .(Storage_sigs.Single_data_storage.find)
       (Raw_context.to_t ctxt, key) =
     return? (
     let× value := (Helpers.Map).(Map.S.find)
       key
      (Helpers.get ctxt) in
     return× value).

    Axiom update : ctxt key value,
      Storage.Sapling.Nullifiers_size
        .(Storage_sigs.Single_data_storage.update)
       (Raw_context.to_t ctxt, key) value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      if (Helpers.Map).(Map.S.mem) key map
        then

          let map' := (Helpers.Map).(Map.S.add) key value map in
          return? Helpers.set ctxt map'
      else error.

    Axiom init_value : ctxt key value,
      Storage.Sapling.Nullifiers_size
        .(Storage_sigs.Single_data_storage.update)
       (Raw_context.to_t ctxt, key) value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      if (Helpers.Map).(Map.S.mem) key map
        then error
        else
          let map' := (Helpers.Map).(Map.S.add) key value map in
          return? Helpers.set ctxt map'.

    Axiom add : ctxt key value,
      Storage.Sapling.Nullifiers_size
        .(Storage_sigs.Single_data_storage.add)
      (Raw_context.to_t ctxt, key) value =
      let map := (Helpers.get ctxt) in
      let map' := (Helpers.Map).(Map.S.add) key value map in
      Helpers.set ctxt map'.

    Axiom add_or_remove : ctxt key value_opt,
      Storage.Sapling.Nullifiers_size
        .(Storage_sigs.Single_data_storage.add_or_remove)
      (Raw_context.to_t ctxt, key) value_opt =
      match value_opt with
      | Some value
        (* add the value *)
        let map := (Helpers.get ctxt) in
        let map' := (Helpers.Map).(Map.S.add) key value map in
          Helpers.set ctxt map'
      | None
        (* remove the value *)
        let map := (Helpers.get ctxt) in
        let map' := (Helpers.Map).(Map.S.remove) key map in
        Helpers.set ctxt map'
      end.

    Axiom remove_existing : ctxt key,
      Storage.Sapling.Nullifiers_size
        .(Storage_sigs.Single_data_storage.remove_existing)
      (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      if (Helpers.Map).(Map.S.mem) key map
      then
        let map' := (Helpers.Map).(Map.S.remove) key map in
        return? Helpers.set ctxt map'
      else
        Raw_context.storage_error_value
          (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : ctxt key,
      Storage.Sapling.Nullifiers_size
        .(Storage_sigs.Single_data_storage.remove)
      (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      let map' := (Helpers.Map).(Map.S.remove) key map in
      Helpers.set ctxt map'.

    #[global] Hint Rewrite mem get find init_value update add
      add_or_remove remove_existing remove : storage_db.
    #[global] Opaque Storage.Sapling.Nullifiers_size.
  End Nullifiers_size.

  Module Nullifiers_ordered.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Sapling_Nullifiers_ordered).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Sapling_Nullifiers_ordered := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition Map :=
        Storage_sigs.Indexed_map.Map
          (of_functors_index Raw_context.Sapling_Nullifier_Index).
      Arguments Map /.

      Definition Submap :=
        Storage_sigs.Indexed_map.Map
          (of_lazy_storage_kind_id_index Storage.Sapling.Index).
      Arguments Submap /.

      Definition name := ["nullifiers_ordered"].
    End Helpers.

    Axiom mem : ctxt key subkey,
      Storage.Sapling.Nullifiers_ordered
          .(Storage_sigs.Non_iterable_indexed_data_storage.mem)

          (Raw_context.to_t ctxt, key) subkey =

      let map := (Helpers.Map).(Map.S.find)
        key (Helpers.get ctxt) in
      match map with

      | Some map

        (Helpers.Submap).(Map.S.mem) subkey map
      | Nonefalse
      end.

    Axiom get : ctxt subkey key,
      Storage.Sapling.Nullifiers_ordered
        .(Storage_sigs.Non_iterable_indexed_data_storage.get)
       (Raw_context.to_t ctxt, key)
       subkey =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Get) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
          let value := (Helpers.Submap).(Map.S.find) subkey submap' in
          match value with
          | Some value'return? value'
          | Noneerror
          end
      | Noneerror
      end.

    Axiom find : ctxt subkey key,
      Storage.Sapling.Nullifiers_ordered
        .(Storage_sigs.Non_iterable_indexed_data_storage.find)
       (Raw_context.to_t ctxt, key)
       subkey =
     return? (
     let× map := (Helpers.Map).(Map.S.find)
       key
      (Helpers.get ctxt) in
     let× value := (Helpers.Submap).(Map.S.find) subkey map in
     return× value).

    Axiom update : ctxt subkey key value,
      Storage.Sapling.Nullifiers_ordered
        .(Storage_sigs.Non_iterable_indexed_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then

          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? Helpers.set ctxt map'
        else error
      | Noneerror
      end.

    Axiom init_value : ctxt subkey key value,
      Storage.Sapling.Nullifiers_ordered
        .(Storage_sigs.Non_iterable_indexed_data_storage.init_value)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then error
        else
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? Helpers.set ctxt map'
      | None
        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? Helpers.set ctxt map'

      end.

    Axiom add : ctxt key subkey value,
      Storage.Sapling.Nullifiers_ordered
        .(Storage_sigs.Non_iterable_indexed_data_storage.add)
      (Raw_context.to_t ctxt, key) subkey value =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        let submap'' :=
          (Helpers.Submap).(Map.S.add) subkey value submap' in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        Helpers.set ctxt map'
      | None

        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        Helpers.set ctxt map'
      end.

    Axiom add_or_remove : ctxt key subkey value_opt,
      Storage.Sapling.Nullifiers_ordered
        .(Storage_sigs.Non_iterable_indexed_data_storage.add_or_remove)
      (Raw_context.to_t ctxt, key) subkey value_opt =
      match value_opt with
      | Some value
        (* add the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          Helpers.set ctxt map'
        | None

          let submap'' :=
            (Helpers.Submap).(Map.S.singleton) subkey value in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          Helpers.set ctxt map'
        end
      | None
        (* remove the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          Helpers.set ctxt map'

        | NoneRaw_context.to_t ctxt
        end
      end.

    Axiom remove_existing : ctxt key subkey,
      Storage.Sapling.Nullifiers_ordered
        .(Storage_sigs.Non_iterable_indexed_data_storage.remove_existing)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          if (Helpers.Submap).(Map.S.mem) subkey submap'
          then
            let submap'' :=
              (Helpers.Submap).(Map.S.remove) subkey submap' in
            let map' := (Helpers.Map).(Map.S.add) key submap'' map in
            return? Helpers.set ctxt map'
          else
            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context.Del)
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : ctxt key subkey,
      Storage.Sapling.Nullifiers_ordered
        .(Storage_sigs.Non_iterable_indexed_data_storage.remove)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          Helpers.set ctxt map'
      | NoneRaw_context.to_t ctxt
      end.

    #[global] Hint Rewrite mem get find init_value update add
      add_or_remove remove_existing remove : storage_db.
  End Nullifiers_ordered.

  Module Nullifiers_hashed.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Sapling_Nullifiers_hashed).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Sapling_Nullifiers_hashed := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition Map :=
        Storage_sigs.Indexed_map.Map
          (of_lazy_storage_kind_id_index Storage.Sapling.Index).
      Arguments Map /.

      Definition Subset :=
        Storage_sigs.Indexed_set._Set
          (of_functors_index Raw_context.Sapling_Nullifiers_hashed_Index).
      Arguments Subset /.

      Definition name := ["nullifiers_hashed"].
    End Helpers.

    Axiom mem : ctxt key subkey,
      Storage.Sapling.Nullifiers_hashed
        .(Storage_sigs.Carbonated_data_set_storage.mem)

        (Raw_context.to_t ctxt, key) subkey =

      let map := (Helpers.Map).(Map.S.find)
        key (Helpers.get ctxt) in
      match map with

      | Some map

        return? (Raw_context.to_t ctxt, (Helpers.Subset).(_Set.S.mem) subkey map)
      | Nonereturn? (Raw_context.to_t ctxt, false)
      end.

    Axiom add : ctxt key subkey i,
      Storage.Sapling.Nullifiers_hashed
        .(Storage_sigs.Carbonated_data_set_storage.add)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        let submap'' :=
          (Helpers.Subset).(_Set.S.add) subkey submap' in
        let mem := (Helpers.Subset).(_Set.S.mem) subkey submap' in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', i, mem)
      | None

        let submap'' :=
          (Helpers.Subset).(_Set.S.singleton) subkey in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', i, false)
      end.

    Axiom remove : ctxt key subkey i,
      Storage.Sapling.Nullifiers_hashed
        .(Storage_sigs.Carbonated_data_set_storage.remove)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          let submap'' :=
            (Helpers.Subset).(_Set.S.remove) subkey submap' in
          let mem := (Helpers.Subset).(_Set.S.mem) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', i, mem)
      | Nonereturn? (Raw_context.to_t ctxt, i, false)
      end.

    Axiom init_value : ctxt subkey key i,
      Storage.Sapling.Nullifiers_hashed
        .(Storage_sigs.Carbonated_data_set_storage.init_value)
       (Raw_context.to_t ctxt, key) subkey =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Subset).(_Set.S.mem) subkey submap'
        then error
        else
          let submap'' :=
            (Helpers.Subset).(_Set.S.add) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', i)
      | None
        let submap'' :=
          (Helpers.Subset).(_Set.S.singleton) subkey in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', i)
      end.

    Axiom fold_keys_unaccounted : ctxt key variant init f,
      Storage.Sapling.Nullifiers_hashed
        .(Storage_sigs.Carbonated_data_set_storage.fold_keys_unaccounted)
           (Raw_context.to_t ctxt, key)
        variant init f =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
          return? (Helpers.Subset).(_Set.S.fold) f
             init submap'
      | Nonereturn? init
      end.

    #[global] Hint Rewrite mem add remove init_value fold_keys_unaccounted : storage_db.
    #[global] Opaque Storage.Sapling.Nullifiers_hashed.
  End Nullifiers_hashed.

  Module Roots.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Sapling_Roots).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Sapling_Roots := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition Map :=
        Storage_sigs.Indexed_map.Map
          (of_functors_index Raw_context.Sapling_Roots_Index).
      Arguments Map /.

      Definition Submap :=
        Storage_sigs.Indexed_map.Map
          (of_lazy_storage_kind_id_index Storage.Sapling.Index).
      Arguments Submap /.

      Definition name := ["roots"].
    End Helpers.

    Axiom mem : ctxt key subkey,
      Storage.Sapling.Roots
          .(Storage_sigs.Non_iterable_indexed_data_storage.mem)

          (Raw_context.to_t ctxt, key) subkey =

      let map := (Helpers.Map).(Map.S.find)
        key (Helpers.get ctxt) in
      match map with

      | Some map

        (Helpers.Submap).(Map.S.mem) subkey map
      | Nonefalse
      end.

    Axiom get : ctxt subkey key,
      Storage.Sapling.Roots
        .(Storage_sigs.Non_iterable_indexed_data_storage.get)
       (Raw_context.to_t ctxt, key)
       subkey =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Get) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
          let value := (Helpers.Submap).(Map.S.find) subkey submap' in
          match value with
          | Some value'return? value'
          | Noneerror
          end
      | Noneerror
      end.

    Axiom find : ctxt subkey key,
      Storage.Sapling.Roots
        .(Storage_sigs.Non_iterable_indexed_data_storage.find)
       (Raw_context.to_t ctxt, key)
       subkey =
     return? (
     let× map := (Helpers.Map).(Map.S.find)
       key
      (Helpers.get ctxt) in
     let× value := (Helpers.Submap).(Map.S.find) subkey map in
     return× value).

    Axiom update : ctxt subkey key value,
      Storage.Sapling.Roots
        .(Storage_sigs.Non_iterable_indexed_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then

          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? Helpers.set ctxt map'
        else error
      | Noneerror
      end.

    Axiom init_value : ctxt subkey key value,
      Storage.Sapling.Roots
        .(Storage_sigs.Non_iterable_indexed_data_storage.init_value)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then error
        else
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? Helpers.set ctxt map'
      | None
        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? Helpers.set ctxt map'

      end.

    Axiom add : ctxt key subkey value,
      Storage.Sapling.Roots
        .(Storage_sigs.Non_iterable_indexed_data_storage.add)
      (Raw_context.to_t ctxt, key) subkey value =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        let submap'' :=
          (Helpers.Submap).(Map.S.add) subkey value submap' in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        Helpers.set ctxt map'
      | None

        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        Helpers.set ctxt map'
      end.

    Axiom add_or_remove : ctxt key subkey value_opt,
      Storage.Sapling.Roots
        .(Storage_sigs.Non_iterable_indexed_data_storage.add_or_remove)
      (Raw_context.to_t ctxt, key) subkey value_opt =
      match value_opt with
      | Some value
        (* add the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          Helpers.set ctxt map'
        | None

          let submap'' :=
            (Helpers.Submap).(Map.S.singleton) subkey value in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          Helpers.set ctxt map'
        end
      | None
        (* remove the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          Helpers.set ctxt map'

        | NoneRaw_context.to_t ctxt
        end
      end.

    Axiom remove_existing : ctxt key subkey,
      Storage.Sapling.Roots
        .(Storage_sigs.Non_iterable_indexed_data_storage.remove_existing)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          if (Helpers.Submap).(Map.S.mem) subkey submap'
          then
            let submap'' :=
              (Helpers.Submap).(Map.S.remove) subkey submap' in
            let map' := (Helpers.Map).(Map.S.add) key submap'' map in
            return? Helpers.set ctxt map'
          else
            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context.Del)
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : ctxt key subkey,
      Storage.Sapling.Roots
        .(Storage_sigs.Non_iterable_indexed_data_storage.remove)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          Helpers.set ctxt map'
      | NoneRaw_context.to_t ctxt
      end.

    #[global] Hint Rewrite mem get find init_value update add
      add_or_remove remove_existing remove : storage_db.
  End Roots.

  Module Roots_pos.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Sapling_Roots_pos).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Sapling_Roots_pos := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition Map :=
        Storage_sigs.Indexed_map.Map
          (of_lazy_storage_kind_id_index Storage.Sapling.Index).
      Arguments Map /.

      Definition name := ["roots_pos"].
    End Helpers.

    Axiom mem : ctxt key,
      Storage.Sapling.Roots_pos
          .(Storage_sigs.Single_data_storage.mem)

          (Raw_context.to_t ctxt, key) =

      (Helpers.Map).(Map.S.mem) key (Helpers.get ctxt).

    Axiom get : ctxt key,
      Storage.Sapling.Roots_pos
        .(Storage_sigs.Single_data_storage.get)
       (Raw_context.to_t ctxt, key) =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Get) in
      let map := (Helpers.get ctxt) in
      let x := (Helpers.Map).(Map.S.find) key map in
      match x with
      | Some value'return? value'
      | Noneerror
      end.

    Axiom find : ctxt key,
      Storage.Sapling.Roots_pos
        .(Storage_sigs.Single_data_storage.find)
       (Raw_context.to_t ctxt, key) =
     return? (
     let× value := (Helpers.Map).(Map.S.find)
       key
      (Helpers.get ctxt) in
     return× value).

    Axiom update : ctxt key value,
      Storage.Sapling.Roots_pos
        .(Storage_sigs.Single_data_storage.update)
       (Raw_context.to_t ctxt, key) value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      if (Helpers.Map).(Map.S.mem) key map
        then

          let map' := (Helpers.Map).(Map.S.add) key value map in
          return? Helpers.set ctxt map'
      else error.

    Axiom init_value : ctxt key value,
      Storage.Sapling.Roots_pos
        .(Storage_sigs.Single_data_storage.update)
       (Raw_context.to_t ctxt, key) value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      if (Helpers.Map).(Map.S.mem) key map
        then error
        else
          let map' := (Helpers.Map).(Map.S.add) key value map in
          return? Helpers.set ctxt map'.

    Axiom add : ctxt key value,
      Storage.Sapling.Roots_pos
        .(Storage_sigs.Single_data_storage.add)
      (Raw_context.to_t ctxt, key) value =
      let map := (Helpers.get ctxt) in
      let map' := (Helpers.Map).(Map.S.add) key value map in
      Helpers.set ctxt map'.

    Axiom add_or_remove : ctxt key value_opt,
      Storage.Sapling.Roots_pos
        .(Storage_sigs.Single_data_storage.add_or_remove)
      (Raw_context.to_t ctxt, key) value_opt =
      match value_opt with
      | Some value
        (* add the value *)
        let map := (Helpers.get ctxt) in
        let map' := (Helpers.Map).(Map.S.add) key value map in
          Helpers.set ctxt map'
      | None
        (* remove the value *)
        let map := (Helpers.get ctxt) in
        let map' := (Helpers.Map).(Map.S.remove) key map in
        Helpers.set ctxt map'
      end.

    Axiom remove_existing : ctxt key,
      Storage.Sapling.Roots_pos
        .(Storage_sigs.Single_data_storage.remove_existing)
      (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      if (Helpers.Map).(Map.S.mem) key map
      then
        let map' := (Helpers.Map).(Map.S.remove) key map in
        return? Helpers.set ctxt map'
      else
        Raw_context.storage_error_value
          (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : ctxt key,
      Storage.Sapling.Roots_pos
        .(Storage_sigs.Single_data_storage.remove)
      (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      let map' := (Helpers.Map).(Map.S.remove) key map in
      Helpers.set ctxt map'.

    #[global] Hint Rewrite mem get find init_value update add
      add_or_remove remove_existing remove : storage_db.
    #[global] Opaque Storage.Sapling.Roots_pos.
  End Roots_pos.

  Module Roots_level.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Sapling_Roots_level).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Sapling_Roots_level := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition Map :=
        Storage_sigs.Indexed_map.Map
          (of_lazy_storage_kind_id_index Storage.Sapling.Index).
      Arguments Map /.

      Definition name := ["roots_level"].
    End Helpers.

    Axiom mem : ctxt key,
      Storage.Sapling.Roots_level
          .(Storage_sigs.Single_data_storage.mem)

          (Raw_context.to_t ctxt, key) =

      (Helpers.Map).(Map.S.mem) key (Helpers.get ctxt).

    Axiom get : ctxt key,
      Storage.Sapling.Roots_level
        .(Storage_sigs.Single_data_storage.get)
       (Raw_context.to_t ctxt, key) =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Get) in
      let map := (Helpers.get ctxt) in
      let x := (Helpers.Map).(Map.S.find) key map in
      match x with
      | Some value'return? value'
      | Noneerror
      end.

    Axiom find : ctxt key,
      Storage.Sapling.Roots_level
        .(Storage_sigs.Single_data_storage.find)
       (Raw_context.to_t ctxt, key) =
     return? (
     let× value := (Helpers.Map).(Map.S.find)
       key
      (Helpers.get ctxt) in
     return× value).

    Axiom update : ctxt key value,
      Storage.Sapling.Roots_level
        .(Storage_sigs.Single_data_storage.update)
       (Raw_context.to_t ctxt, key) value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      if (Helpers.Map).(Map.S.mem) key map
        then

          let map' := (Helpers.Map).(Map.S.add) key value map in
          return? Helpers.set ctxt map'
      else error.

    Axiom init_value : ctxt key value,
      Storage.Sapling.Roots_level
        .(Storage_sigs.Single_data_storage.update)
       (Raw_context.to_t ctxt, key) value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      if (Helpers.Map).(Map.S.mem) key map
        then error
        else
          let map' := (Helpers.Map).(Map.S.add) key value map in
          return? Helpers.set ctxt map'.

    Axiom add : ctxt key value,
      Storage.Sapling.Roots_level
        .(Storage_sigs.Single_data_storage.add)
      (Raw_context.to_t ctxt, key) value =
      let map := (Helpers.get ctxt) in
      let map' := (Helpers.Map).(Map.S.add) key value map in
      Helpers.set ctxt map'.

    Axiom add_or_remove : ctxt key value_opt,
      Storage.Sapling.Roots_level
        .(Storage_sigs.Single_data_storage.add_or_remove)
      (Raw_context.to_t ctxt, key) value_opt =
      match value_opt with
      | Some value
        (* add the value *)
        let map := (Helpers.get ctxt) in
        let map' := (Helpers.Map).(Map.S.add) key value map in
          Helpers.set ctxt map'
      | None
        (* remove the value *)
        let map := (Helpers.get ctxt) in
        let map' := (Helpers.Map).(Map.S.remove) key map in
        Helpers.set ctxt map'
      end.

    Axiom remove_existing : ctxt key,
      Storage.Sapling.Roots_level
        .(Storage_sigs.Single_data_storage.remove_existing)
      (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      if (Helpers.Map).(Map.S.mem) key map
      then
        let map' := (Helpers.Map).(Map.S.remove) key map in
        return? Helpers.set ctxt map'
      else
        Raw_context.storage_error_value
          (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : ctxt key,
      Storage.Sapling.Roots_level
        .(Storage_sigs.Single_data_storage.remove)
      (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      let map' := (Helpers.Map).(Map.S.remove) key map in
      Helpers.set ctxt map'.

    #[global] Hint Rewrite mem get find init_value update add
      add_or_remove remove_existing remove : storage_db.
    #[global] Opaque Storage.Sapling.Roots_level.
  End Roots_level.
End Sapling.

Module Delegates.
  Module Helpers.
    Definition get (ctxt : Raw_context.t) :=
      ctxt
        .(Raw_context.Delegates).
    Arguments get _ /.

    Definition set (ctxt : Raw_context.t) value :=
      let ctxt' := ctxt <| Raw_context.Delegates := value |> in
      (Raw_context.to_t ctxt').
    Arguments set _ _ /.

    Definition S :=
      Storage_sigs.Indexed_set._Set
        (of_functors_index Storage.Public_key_hash_index).
    Arguments S /.
  End Helpers.

  Axiom mem : (ctxt : Raw_context.t) elt,
    Storage.Delegates
      .(Storage_sigs.Data_set_storage.mem)
      (Raw_context.to_t ctxt) elt =
    Helpers.S.(_Set.S.mem) elt (Helpers.get ctxt).

  Axiom add : (ctxt : Raw_context.t) elt,
    Storage.Delegates
      .(Storage_sigs.Data_set_storage.add)
      (Raw_context.to_t ctxt) elt =
    Helpers.set ctxt (Helpers.S.(_Set.S.add) elt (Helpers.get ctxt)).

  Axiom remove : (ctxt : Raw_context.t) elt,
    Storage.Delegates
      .(Storage_sigs.Data_set_storage.remove)
      (Raw_context.to_t ctxt) elt =
    Helpers.set ctxt (Helpers.S.(_Set.S.remove) elt
      (Helpers.get ctxt)).

  Axiom elements : (ctxt : Raw_context.t),
    Storage.Delegates
      .(Storage_sigs.Data_set_storage.elements)
      (Raw_context.to_t ctxt) =
    return? Helpers.S.(_Set.S.elements) (Helpers.get ctxt).

  Axiom fold : {a : Set} (ctxt : Raw_context.t) variant (x : a)
    (f : _ a M? a),
    Storage.Delegates
       .(Storage_sigs.Data_set_storage.fold)
       (Raw_context.to_t ctxt) variant x f =
    Helpers.S.(_Set.S.fold)
      (fun elt acclet? acc := acc in f elt acc) (Helpers.get ctxt)
      (Pervasives.Ok x).

  Axiom clear : (ctxt : Raw_context.t),
    Storage.Delegates
      .(Storage_sigs.Data_set_storage.clear)
      (Raw_context.to_t ctxt) =
    return? Helpers.set ctxt (Helpers.S.(_Set.S.empty)).

  #[global] Hint Rewrite mem add remove elements @fold clear

   : storage_db.
  #[global] Opaque Storage.Delegates.
End Delegates.

Module Consensus_keys.
  Module Helpers.
    Definition get (ctxt : Raw_context.t) :=
      ctxt
        .(Raw_context.Consensus_keys).
    Arguments get _ /.

    Definition set (ctxt : Raw_context.t) value :=
      let ctxt' := ctxt <| Raw_context.Consensus_keys := value |> in
      (Raw_context.to_t ctxt').
    Arguments set _ _ /.

    Definition S :=
      Storage_sigs.Indexed_set._Set
        (of_functors_index Storage.Public_key_hash_index).
    Arguments S /.
  End Helpers.

  Axiom mem : (ctxt : Raw_context.t) elt,
    Storage.Consensus_keys
      .(Storage_sigs.Data_set_storage.mem)
      (Raw_context.to_t ctxt) elt =
    Helpers.S.(_Set.S.mem) elt (Helpers.get ctxt).

  Axiom add : (ctxt : Raw_context.t) elt,
    Storage.Consensus_keys
      .(Storage_sigs.Data_set_storage.add)
      (Raw_context.to_t ctxt) elt =
    Helpers.set ctxt (Helpers.S.(_Set.S.add) elt (Helpers.get ctxt)).

  Axiom remove : (ctxt : Raw_context.t) elt,
    Storage.Consensus_keys
      .(Storage_sigs.Data_set_storage.remove)
      (Raw_context.to_t ctxt) elt =
    Helpers.set ctxt (Helpers.S.(_Set.S.remove) elt
      (Helpers.get ctxt)).

  Axiom elements : (ctxt : Raw_context.t),
    Storage.Consensus_keys
      .(Storage_sigs.Data_set_storage.elements)
      (Raw_context.to_t ctxt) =
    return? Helpers.S.(_Set.S.elements) (Helpers.get ctxt).

  Axiom fold : {a : Set} (ctxt : Raw_context.t) variant (x : a)
    (f : _ a M? a),
    Storage.Consensus_keys
       .(Storage_sigs.Data_set_storage.fold)
       (Raw_context.to_t ctxt) variant x f =
    Helpers.S.(_Set.S.fold)
      (fun elt acclet? acc := acc in f elt acc) (Helpers.get ctxt)
      (Pervasives.Ok x).

  Axiom clear : (ctxt : Raw_context.t),
    Storage.Consensus_keys
      .(Storage_sigs.Data_set_storage.clear)
      (Raw_context.to_t ctxt) =
    return? Helpers.set ctxt (Helpers.S.(_Set.S.empty)).

  #[global] Hint Rewrite mem add remove elements @fold clear

   : storage_db.
  #[global] Opaque Storage.Consensus_keys.
End Consensus_keys.

Module Cycle.
  Module Slashed_deposits.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Cycle_Slashed_deposits).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Cycle_Slashed_deposits := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition Map :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Cycle_repr.Index).
      Arguments Map /.

      Definition Submap :=
        Storage_sigs.Indexed_map.Map
          (of_functors_index (Storage_functors.Pair (Storage.Make_index Raw_level_repr.Index) Storage.Public_key_hash_index)).
      Arguments Submap /.

      Definition name := ["slashed_deposits"].
    End Helpers.

    Axiom mem : ctxt key subkey,
      Storage.Cycle.Slashed_deposits
          .(Storage_sigs.Indexed_data_storage.mem)

          (Raw_context.to_t ctxt, key) subkey =

      let map := (Helpers.Map).(Map.S.find)
        key (Helpers.get ctxt) in
      match map with

      | Some map

        (Helpers.Submap).(Map.S.mem) subkey map
      | Nonefalse
      end.

    Axiom get : ctxt subkey key,
      Storage.Cycle.Slashed_deposits
        .(Storage_sigs.Indexed_data_storage.get)
       (Raw_context.to_t ctxt, key)
       subkey =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Get) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
          let value := (Helpers.Submap).(Map.S.find) subkey submap' in
          match value with
          | Some value'return? value'
          | Noneerror
          end
      | Noneerror
      end.

    Axiom find : ctxt subkey key,
      Storage.Cycle.Slashed_deposits
        .(Storage_sigs.Indexed_data_storage.find)
       (Raw_context.to_t ctxt, key)
       subkey =
     return? (
     let× map := (Helpers.Map).(Map.S.find)
       key
      (Helpers.get ctxt) in
     let× value := (Helpers.Submap).(Map.S.find) subkey map in
     return× value).

    Axiom update : ctxt subkey key value,
      Storage.Cycle.Slashed_deposits
        .(Storage_sigs.Indexed_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then

          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? Helpers.set ctxt map'
        else error
      | Noneerror
      end.

    Axiom init_value : ctxt subkey key value,
      Storage.Cycle.Slashed_deposits
        .(Storage_sigs.Indexed_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then error
        else
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? Helpers.set ctxt map'
      | None
        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? Helpers.set ctxt map'

      end.

    Axiom add : ctxt key subkey value,
      Storage.Cycle.Slashed_deposits
        .(Storage_sigs.Indexed_data_storage.add)
      (Raw_context.to_t ctxt, key) subkey value =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        let submap'' :=
          (Helpers.Submap).(Map.S.add) subkey value submap' in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        Helpers.set ctxt map'
      | None

        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        Helpers.set ctxt map'
      end.

    Axiom add_or_remove : ctxt key subkey value_opt,
      Storage.Cycle.Slashed_deposits
        .(Storage_sigs.Indexed_data_storage.add_or_remove)
      (Raw_context.to_t ctxt, key) subkey value_opt =
      match value_opt with
      | Some value
        (* add the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          Helpers.set ctxt map'
        | None

          let submap'' :=
            (Helpers.Submap).(Map.S.singleton) subkey value in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          Helpers.set ctxt map'
        end
      | None
        (* remove the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          Helpers.set ctxt map'

        | NoneRaw_context.to_t ctxt
        end
      end.

    Axiom remove_existing : ctxt key subkey,
      Storage.Cycle.Slashed_deposits
        .(Storage_sigs.Indexed_data_storage.remove_existing)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          if (Helpers.Submap).(Map.S.mem) subkey submap'
          then
            let submap'' :=
              (Helpers.Submap).(Map.S.remove) subkey submap' in
            let map' := (Helpers.Map).(Map.S.add) key submap'' map in
            return? Helpers.set ctxt map'
          else
            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context.Del)
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : ctxt key subkey,
      Storage.Cycle.Slashed_deposits
        .(Storage_sigs.Indexed_data_storage.remove)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          Helpers.set ctxt map'
      | NoneRaw_context.to_t ctxt
      end.

    Axiom clear : (ctxt : Raw_context.t) key,
      Storage.Cycle.Slashed_deposits
        .(Storage_sigs.Indexed_data_storage.clear)
        (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      let empty := (Helpers.Submap).(Map.S.empty) in
      let map' := (Helpers.Map).(Map.S.add) key empty map in
      return? Helpers.set ctxt map'.

    Axiom keys : ctxt key,
      Storage.Cycle.Slashed_deposits
        .(Storage_sigs.Indexed_data_storage.keys)
           (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'return? List.map fst ((Helpers.Submap).(Map.S.bindings)
          submap')
      | Nonereturn? []
      end.

    Axiom bindings : ctxt key,
      Storage.Cycle.Slashed_deposits
        .(Storage_sigs.Indexed_data_storage.bindings)
           (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'return? (Helpers.Submap).(Map.S.bindings) submap'
      | Nonereturn? []
      end.

    Axiom fold : {a : Set} ctxt key variant init f,
      Storage.Cycle.Slashed_deposits
        .(Storage_sigs.Indexed_data_storage.fold)
           (Raw_context.to_t ctxt, key)
           variant
           init
           f =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
          let f' k v acc :=
            let? acc := acc in
            f k v acc in
          (Helpers.Submap).(Map.S.fold) f' init (Pervasives.Ok submap')
      | Nonereturn? init
      end.

    Axiom fold_keys : {a : Set} ctxt key variant init f,
      Storage.Cycle.Slashed_deposits
        .(Storage_sigs.Indexed_data_storage.fold_keys)
           (Raw_context.to_t ctxt, key)
           variant
           init
           f =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
          let f' k acc :=
            let? acc := acc in
            f k acc in
          (Helpers.Submap).(Map.S.fold)

            (fun k _ accf' k acc) init (Pervasives.Ok submap')
      | Nonereturn? init
      end.

    #[global] Hint Rewrite mem get find init_value update add
      add_or_remove remove_existing remove @fold @fold_keys keys
      bindings clear : storage_db.
    #[global] Opaque Storage.Cycle.Slashed_deposits.
  End Slashed_deposits.

  Module Selected_stake_distribution.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Cycle_Selected_stake_distribution).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Cycle_Selected_stake_distribution := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Cycle_repr.Index).
      Arguments S /.

      Definition name := ["selected_stake_distribution"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Cycle.Selected_stake_distribution
        .(Storage_sigs.Indexed_data_storage_with_local_context.mem)
        (Raw_context.to_t ctxt) k =
      (Helpers.S).(Map.S.mem) k
        (Helpers.get ctxt).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Cycle.Selected_stake_distribution
        .(Storage_sigs.Indexed_data_storage_with_local_context.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok v
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Cycle.Selected_stake_distribution
        .(Storage_sigs.Indexed_data_storage_with_local_context.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Some v)
      | Nonereturn? None
      end.

    Axiom update : (ctxt : Raw_context.t) k v,
      Storage.Cycle.Selected_stake_distribution
        .(Storage_sigs.Indexed_data_storage_with_local_context.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then
        return? Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v,
      Storage.Cycle.Selected_stake_distribution
        .(Storage_sigs.Indexed_data_storage_with_local_context.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)).

    Axiom add : (ctxt : Raw_context.t) k v,
      Storage.Cycle.Selected_stake_distribution
        .(Storage_sigs.Indexed_data_storage_with_local_context.add)
        (Raw_context.to_t ctxt) k v =
      Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
        (Helpers.get ctxt)).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v,
      Storage.Cycle.Selected_stake_distribution
        .(Storage_sigs.Indexed_data_storage_with_local_context.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      match v with
      | Some v'
          Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            (Helpers.get ctxt))
      | None
          Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            (Helpers.get ctxt))
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k,
      Storage.Cycle.Selected_stake_distribution
        .(Storage_sigs.Indexed_data_storage_with_local_context.remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k,
      Storage.Cycle.Selected_stake_distribution
        .(Storage_sigs.Indexed_data_storage_with_local_context.remove)
        (Raw_context.to_t ctxt) k =
      Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)).

    Axiom clear : (ctxt : Raw_context.t),
      Storage.Cycle.Selected_stake_distribution
        .(Storage_sigs.Indexed_data_storage_with_local_context.clear)
        (Raw_context.to_t ctxt) =
      return? Helpers.set ctxt ((Helpers.S).(Map.S.empty)).

    Axiom keys : (ctxt : Raw_context.t),
      Storage.Cycle.Selected_stake_distribution
        .(Storage_sigs.Indexed_data_storage_with_local_context.keys)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    Axiom bindings : (ctxt : Raw_context.t),
      Storage.Cycle.Selected_stake_distribution
        .(Storage_sigs.Indexed_data_storage_with_local_context.bindings)
        (Raw_context.to_t ctxt) =
      return? (Helpers.S).(Map.S.bindings) (Helpers.get ctxt).

    Axiom fold : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ _ a M? a),
      Storage.Cycle.Selected_stake_distribution
        .(Storage_sigs.Indexed_data_storage_with_local_context.fold)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold) (fun k v acclet? acc := acc in f k v acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    Axiom fold_keys : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ a M? a),
      Storage.Cycle.Selected_stake_distribution
        .(Storage_sigs.Indexed_data_storage_with_local_context.fold_keys)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold)
        (fun k _ acclet? acc := acc in f k acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove clear keys bindings
       @fold @fold_keys : storage_db.
    #[global] Opaque Storage.Cycle.Selected_stake_distribution.
  End Selected_stake_distribution.

  Module Total_active_stake.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Cycle_Total_active_stake).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Cycle_Total_active_stake := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Cycle_repr.Index).
      Arguments S /.

      Definition name := ["total_active_stake"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Cycle.Total_active_stake
        .(Storage_sigs.Indexed_data_storage.mem)
        (Raw_context.to_t ctxt) k =
      (Helpers.S).(Map.S.mem) k
        (Helpers.get ctxt).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Cycle.Total_active_stake
        .(Storage_sigs.Indexed_data_storage.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok v
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Cycle.Total_active_stake
        .(Storage_sigs.Indexed_data_storage.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Some v)
      | Nonereturn? None
      end.

    Axiom update : (ctxt : Raw_context.t) k v,
      Storage.Cycle.Total_active_stake
        .(Storage_sigs.Indexed_data_storage.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then

        return? Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v,
      Storage.Cycle.Total_active_stake
        .(Storage_sigs.Indexed_data_storage.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)).

    Axiom add : (ctxt : Raw_context.t) k v,
      Storage.Cycle.Total_active_stake
        .(Storage_sigs.Indexed_data_storage.add)
        (Raw_context.to_t ctxt) k v =
      Helpers.set ctxt ((Helpers.S).(Map.S.add) k v

        (Helpers.get ctxt)).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v,
      Storage.Cycle.Total_active_stake
        .(Storage_sigs.Indexed_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      match v with
      | Some v'

          Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            (Helpers.get ctxt))
      | None

          Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            (Helpers.get ctxt))
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k,
      Storage.Cycle.Total_active_stake
        .(Storage_sigs.Indexed_data_storage.remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k,
      Storage.Cycle.Total_active_stake
        .(Storage_sigs.Indexed_data_storage.remove)
        (Raw_context.to_t ctxt) k =
      Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)).

    Axiom clear : (ctxt : Raw_context.t),
      Storage.Cycle.Total_active_stake
        .(Storage_sigs.Indexed_data_storage.clear)
        (Raw_context.to_t ctxt) =
      return? Helpers.set ctxt ((Helpers.S).(Map.S.empty)).

    Axiom keys : (ctxt : Raw_context.t),
      Storage.Cycle.Total_active_stake
        .(Storage_sigs.Indexed_data_storage.keys)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    Axiom bindings : (ctxt : Raw_context.t),
      Storage.Cycle.Total_active_stake
        .(Storage_sigs.Indexed_data_storage.bindings)
        (Raw_context.to_t ctxt) =
      return? (Helpers.S).(Map.S.bindings) (Helpers.get ctxt).

    Axiom fold : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ _ a M? a),
      Storage.Cycle.Total_active_stake
        .(Storage_sigs.Indexed_data_storage.fold)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold) (fun k v acclet? acc := acc in f k v acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    Axiom fold_keys : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ a M? a),
      Storage.Cycle.Total_active_stake
        .(Storage_sigs.Indexed_data_storage.fold_keys)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold)
        (fun k _ acclet? acc := acc in f k acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove clear keys bindings
       @fold @fold_keys : storage_db.
    #[global] Opaque Storage.Cycle.Total_active_stake.
  End Total_active_stake.

  Module Delegate_sampler_state.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Cycle_Delegate_sampler_state).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Cycle_Delegate_sampler_state := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Cycle_repr.Index).
      Arguments S /.

      Definition name := ["delegate_sampler_state"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Cycle.Delegate_sampler_state
        .(Storage_sigs.Indexed_data_storage.mem)
        (Raw_context.to_t ctxt) k =
      (Helpers.S).(Map.S.mem) k
        (Helpers.get ctxt).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Cycle.Delegate_sampler_state
        .(Storage_sigs.Indexed_data_storage.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok v
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Cycle.Delegate_sampler_state
        .(Storage_sigs.Indexed_data_storage.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Some v)
      | Nonereturn? None
      end.

    Axiom update : (ctxt : Raw_context.t) k v,
      Storage.Cycle.Delegate_sampler_state
        .(Storage_sigs.Indexed_data_storage.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then

        return? Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v,
      Storage.Cycle.Delegate_sampler_state
        .(Storage_sigs.Indexed_data_storage.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)).

    Axiom add : (ctxt : Raw_context.t) k v,
      Storage.Cycle.Delegate_sampler_state
        .(Storage_sigs.Indexed_data_storage.add)
        (Raw_context.to_t ctxt) k v =
      Helpers.set ctxt ((Helpers.S).(Map.S.add) k v

        (Helpers.get ctxt)).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v,
      Storage.Cycle.Delegate_sampler_state
        .(Storage_sigs.Indexed_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      match v with
      | Some v'

          Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            (Helpers.get ctxt))
      | None

          Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            (Helpers.get ctxt))
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k,
      Storage.Cycle.Delegate_sampler_state
        .(Storage_sigs.Indexed_data_storage.remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k,
      Storage.Cycle.Delegate_sampler_state
        .(Storage_sigs.Indexed_data_storage.remove)
        (Raw_context.to_t ctxt) k =
      Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)).

    Axiom clear : (ctxt : Raw_context.t),
      Storage.Cycle.Delegate_sampler_state
        .(Storage_sigs.Indexed_data_storage.clear)
        (Raw_context.to_t ctxt) =
      return? Helpers.set ctxt ((Helpers.S).(Map.S.empty)).

    Axiom keys : (ctxt : Raw_context.t),
      Storage.Cycle.Delegate_sampler_state
        .(Storage_sigs.Indexed_data_storage.keys)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    Axiom bindings : (ctxt : Raw_context.t),
      Storage.Cycle.Delegate_sampler_state
        .(Storage_sigs.Indexed_data_storage.bindings)
        (Raw_context.to_t ctxt) =
      return? (Helpers.S).(Map.S.bindings) (Helpers.get ctxt).

    Axiom fold : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ _ a M? a),
      Storage.Cycle.Delegate_sampler_state
        .(Storage_sigs.Indexed_data_storage.fold)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold) (fun k v acclet? acc := acc in f k v acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    Axiom fold_keys : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ a M? a),
      Storage.Cycle.Delegate_sampler_state
        .(Storage_sigs.Indexed_data_storage.fold_keys)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold)
        (fun k _ acclet? acc := acc in f k acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove clear keys bindings
       @fold @fold_keys : storage_db.
    #[global] Opaque Storage.Cycle.Delegate_sampler_state.
  End Delegate_sampler_state.

  Module Nonce.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Cycle_Nonce).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Cycle_Nonce := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition Map :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Raw_level_repr.Index).
      Arguments Map /.

      Definition Submap :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Cycle_repr.Index).
      Arguments Submap /.

      Definition name := ["nonces"].
    End Helpers.

    Axiom mem : ctxt key subkey,
      Storage.Cycle.Nonce
          .(Storage_sigs.Indexed_data_storage.mem)

          (Raw_context.to_t ctxt, key) subkey =

      let map := (Helpers.Map).(Map.S.find)
        key (Helpers.get ctxt) in
      match map with

      | Some map

        (Helpers.Submap).(Map.S.mem) subkey map
      | Nonefalse
      end.

    Axiom get : ctxt subkey key,
      Storage.Cycle.Nonce
        .(Storage_sigs.Indexed_data_storage.get)
       (Raw_context.to_t ctxt, key)
       subkey =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Get) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
          let value := (Helpers.Submap).(Map.S.find) subkey submap' in
          match value with
          | Some value'return? value'
          | Noneerror
          end
      | Noneerror
      end.

    Axiom find : ctxt subkey key,
      Storage.Cycle.Nonce
        .(Storage_sigs.Indexed_data_storage.find)
       (Raw_context.to_t ctxt, key)
       subkey =
     return? (
     let× map := (Helpers.Map).(Map.S.find)
       key
      (Helpers.get ctxt) in
     let× value := (Helpers.Submap).(Map.S.find) subkey map in
     return× value).

    Axiom update : ctxt subkey key value,
      Storage.Cycle.Nonce
        .(Storage_sigs.Indexed_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then

          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? Helpers.set ctxt map'
        else error
      | Noneerror
      end.

    Axiom init_value : ctxt subkey key value,
      Storage.Cycle.Nonce
        .(Storage_sigs.Indexed_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then error
        else
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? Helpers.set ctxt map'
      | None
        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? Helpers.set ctxt map'

      end.

    Axiom add : ctxt key subkey value,
      Storage.Cycle.Nonce
        .(Storage_sigs.Indexed_data_storage.add)
      (Raw_context.to_t ctxt, key) subkey value =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        let submap'' :=
          (Helpers.Submap).(Map.S.add) subkey value submap' in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        Helpers.set ctxt map'
      | None

        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        Helpers.set ctxt map'
      end.

    Axiom add_or_remove : ctxt key subkey value_opt,
      Storage.Cycle.Nonce
        .(Storage_sigs.Indexed_data_storage.add_or_remove)
      (Raw_context.to_t ctxt, key) subkey value_opt =
      match value_opt with
      | Some value
        (* add the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          Helpers.set ctxt map'
        | None

          let submap'' :=
            (Helpers.Submap).(Map.S.singleton) subkey value in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          Helpers.set ctxt map'
        end
      | None
        (* remove the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          Helpers.set ctxt map'

        | NoneRaw_context.to_t ctxt
        end
      end.

    Axiom remove_existing : ctxt key subkey,
      Storage.Cycle.Nonce
        .(Storage_sigs.Indexed_data_storage.remove_existing)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          if (Helpers.Submap).(Map.S.mem) subkey submap'
          then
            let submap'' :=
              (Helpers.Submap).(Map.S.remove) subkey submap' in
            let map' := (Helpers.Map).(Map.S.add) key submap'' map in
            return? Helpers.set ctxt map'
          else
            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context.Del)
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : ctxt key subkey,
      Storage.Cycle.Nonce
        .(Storage_sigs.Indexed_data_storage.remove)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          Helpers.set ctxt map'
      | NoneRaw_context.to_t ctxt
      end.

    Axiom clear : (ctxt : Raw_context.t) key,
      Storage.Cycle.Nonce
        .(Storage_sigs.Indexed_data_storage.clear)
        (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      let empty := (Helpers.Submap).(Map.S.empty) in
      let map' := (Helpers.Map).(Map.S.add) key empty map in
      return? Helpers.set ctxt map'.

    Axiom keys : ctxt key,
      Storage.Cycle.Nonce
        .(Storage_sigs.Indexed_data_storage.keys)
           (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'return? List.map fst ((Helpers.Submap).(Map.S.bindings)
          submap')
      | Nonereturn? []
      end.

    Axiom bindings : ctxt key,
      Storage.Cycle.Nonce
        .(Storage_sigs.Indexed_data_storage.bindings)
           (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'return? (Helpers.Submap).(Map.S.bindings) submap'
      | Nonereturn? []
      end.

    Axiom fold : {a : Set} ctxt key variant init f,
      Storage.Cycle.Nonce
        .(Storage_sigs.Indexed_data_storage.fold)
           (Raw_context.to_t ctxt, key)
           variant
           init
           f =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
          let f' k v acc :=
            let? acc := acc in
            f k v acc in
          (Helpers.Submap).(Map.S.fold) f' init (Pervasives.Ok submap')
      | Nonereturn? init
      end.

    Axiom fold_keys : {a : Set} ctxt key variant init f,
      Storage.Cycle.Nonce
        .(Storage_sigs.Indexed_data_storage.fold_keys)
           (Raw_context.to_t ctxt, key)
           variant
           init
           f =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
          let f' k acc :=
            let? acc := acc in
            f k acc in
          (Helpers.Submap).(Map.S.fold)

            (fun k _ accf' k acc) init (Pervasives.Ok submap')
      | Nonereturn? init
      end.

    #[global] Hint Rewrite mem get find init_value update add
      add_or_remove remove_existing remove @fold @fold_keys keys
      bindings clear : storage_db.
    #[global] Opaque Storage.Cycle.Nonce.
  End Nonce.

  Module Seed.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Cycle_Seed).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Cycle_Seed := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Cycle_repr.Index).
      Arguments S /.

      Definition name := ["random_seed"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Cycle.Seed
        .(Storage_sigs.Indexed_data_storage_with_local_context.mem)
        (Raw_context.to_t ctxt) k =
      (Helpers.S).(Map.S.mem) k
        (Helpers.get ctxt).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Cycle.Seed
        .(Storage_sigs.Indexed_data_storage_with_local_context.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok v
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Cycle.Seed
        .(Storage_sigs.Indexed_data_storage_with_local_context.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Some v)
      | Nonereturn? None
      end.

    Axiom update : (ctxt : Raw_context.t) k v,
      Storage.Cycle.Seed
        .(Storage_sigs.Indexed_data_storage_with_local_context.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then
        return? Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v,
      Storage.Cycle.Seed
        .(Storage_sigs.Indexed_data_storage_with_local_context.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)).

    Axiom add : (ctxt : Raw_context.t) k v,
      Storage.Cycle.Seed
        .(Storage_sigs.Indexed_data_storage_with_local_context.add)
        (Raw_context.to_t ctxt) k v =
      Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
        (Helpers.get ctxt)).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v,
      Storage.Cycle.Seed
        .(Storage_sigs.Indexed_data_storage_with_local_context.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      match v with
      | Some v'
          Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            (Helpers.get ctxt))
      | None
          Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            (Helpers.get ctxt))
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k,
      Storage.Cycle.Seed
        .(Storage_sigs.Indexed_data_storage_with_local_context.remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k,
      Storage.Cycle.Seed
        .(Storage_sigs.Indexed_data_storage_with_local_context.remove)
        (Raw_context.to_t ctxt) k =
      Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)).

    Axiom clear : (ctxt : Raw_context.t),
      Storage.Cycle.Seed
        .(Storage_sigs.Indexed_data_storage_with_local_context.clear)
        (Raw_context.to_t ctxt) =
      return? Helpers.set ctxt ((Helpers.S).(Map.S.empty)).

    Axiom keys : (ctxt : Raw_context.t),
      Storage.Cycle.Seed
        .(Storage_sigs.Indexed_data_storage_with_local_context.keys)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    Axiom bindings : (ctxt : Raw_context.t),
      Storage.Cycle.Seed
        .(Storage_sigs.Indexed_data_storage_with_local_context.bindings)
        (Raw_context.to_t ctxt) =
      return? (Helpers.S).(Map.S.bindings) (Helpers.get ctxt).

    Axiom fold : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ _ a M? a),
      Storage.Cycle.Seed
        .(Storage_sigs.Indexed_data_storage_with_local_context.fold)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold) (fun k v acclet? acc := acc in f k v acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    Axiom fold_keys : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ a M? a),
      Storage.Cycle.Seed
        .(Storage_sigs.Indexed_data_storage_with_local_context.fold_keys)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold)
        (fun k _ acclet? acc := acc in f k acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove clear keys bindings
       @fold @fold_keys : storage_db.
    #[global] Opaque Storage.Cycle.Seed.
  End Seed.
End Cycle.

Module Stake.
  Module Staking_balance.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Stake_Staking_balance).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Stake_Staking_balance := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_functors_index Storage.Public_key_hash_index).
      Arguments S /.

      Definition name := ["staking_balance"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Stake.Staking_balance
        .(Storage_sigs.Indexed_data_snapshotable_storage.mem)

        (Raw_context.to_t ctxt) k =
      (Helpers.S).(Map.S.mem) k
        (Helpers.get ctxt).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Stake.Staking_balance
        .(Storage_sigs.Indexed_data_snapshotable_storage.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok v
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Stake.Staking_balance
        .(Storage_sigs.Indexed_data_snapshotable_storage.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Some v)
      | Nonereturn? None
      end.

    Axiom update : (ctxt : Raw_context.t) k v,
      Storage.Stake.Staking_balance
        .(Storage_sigs.Indexed_data_snapshotable_storage.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then

        return? Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v,
      Storage.Stake.Staking_balance
        .(Storage_sigs.Indexed_data_snapshotable_storage.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)).

    Axiom add : (ctxt : Raw_context.t) k v,
      Storage.Stake.Staking_balance
        .(Storage_sigs.Indexed_data_snapshotable_storage.add)
        (Raw_context.to_t ctxt) k v =
      Helpers.set ctxt ((Helpers.S).(Map.S.add) k v

        (Helpers.get ctxt)).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v,
      Storage.Stake.Staking_balance
        .(Storage_sigs.Indexed_data_snapshotable_storage.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      match v with
      | Some v'

          Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            (Helpers.get ctxt))
      | None

          Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            (Helpers.get ctxt))
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k,
      Storage.Stake.Staking_balance
        .(Storage_sigs.Indexed_data_snapshotable_storage.remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k,
      Storage.Stake.Staking_balance
        .(Storage_sigs.Indexed_data_snapshotable_storage.remove)
        (Raw_context.to_t ctxt) k =
      Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)).

    Axiom clear : (ctxt : Raw_context.t),
      Storage.Stake.Staking_balance
        .(Storage_sigs.Indexed_data_snapshotable_storage.clear)
        (Raw_context.to_t ctxt) =
      return? Helpers.set ctxt ((Helpers.S).(Map.S.empty)).

    Axiom keys : (ctxt : Raw_context.t),
      Storage.Stake.Staking_balance
        .(Storage_sigs.Indexed_data_snapshotable_storage.keys)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    Axiom bindings : (ctxt : Raw_context.t),
      Storage.Stake.Staking_balance
        .(Storage_sigs.Indexed_data_snapshotable_storage.bindings)
        (Raw_context.to_t ctxt) =
      return? (Helpers.S).(Map.S.bindings) (Helpers.get ctxt).

    Axiom fold : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ _ a M? a),
      Storage.Stake.Staking_balance
        .(Storage_sigs.Indexed_data_snapshotable_storage.fold)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold) (fun k v acclet? acc := acc in f k v acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    Axiom fold_keys : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ a M? a),
      Storage.Stake.Staking_balance
        .(Storage_sigs.Indexed_data_snapshotable_storage.fold_keys)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold)
        (fun k _ acclet? acc := acc in f k acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove clear keys bindings
       @fold @fold_keys : storage_db.
    #[global] Opaque Storage.Stake.Staking_balance.
  End Staking_balance.

  Module Active_delegates_with_minimal_stake.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Stake_Active_delegates_with_minimal_stake).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Stake_Active_delegates_with_minimal_stake := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_functors_index Storage.Public_key_hash_index).
      Arguments S /.

      Definition name := ["active_delegate_with_one_roll"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Stake.Active_delegates_with_minimal_stake
        .(Storage_sigs.Indexed_data_snapshotable_storage.mem)

        (Raw_context.to_t ctxt) k =
      (Helpers.S).(Map.S.mem) k
        (Helpers.get ctxt).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Stake.Active_delegates_with_minimal_stake
        .(Storage_sigs.Indexed_data_snapshotable_storage.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok v
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Stake.Active_delegates_with_minimal_stake
        .(Storage_sigs.Indexed_data_snapshotable_storage.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Some v)
      | Nonereturn? None
      end.

    Axiom update : (ctxt : Raw_context.t) k v,
      Storage.Stake.Active_delegates_with_minimal_stake
        .(Storage_sigs.Indexed_data_snapshotable_storage.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then

        return? Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v,
      Storage.Stake.Active_delegates_with_minimal_stake
        .(Storage_sigs.Indexed_data_snapshotable_storage.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)).

    Axiom add : (ctxt : Raw_context.t) k v,
      Storage.Stake.Active_delegates_with_minimal_stake
        .(Storage_sigs.Indexed_data_snapshotable_storage.add)
        (Raw_context.to_t ctxt) k v =
      Helpers.set ctxt ((Helpers.S).(Map.S.add) k v

        (Helpers.get ctxt)).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v,
      Storage.Stake.Active_delegates_with_minimal_stake
        .(Storage_sigs.Indexed_data_snapshotable_storage.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      match v with
      | Some v'

          Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            (Helpers.get ctxt))
      | None

          Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            (Helpers.get ctxt))
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k,
      Storage.Stake.Active_delegates_with_minimal_stake
        .(Storage_sigs.Indexed_data_snapshotable_storage.remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k,
      Storage.Stake.Active_delegates_with_minimal_stake
        .(Storage_sigs.Indexed_data_snapshotable_storage.remove)
        (Raw_context.to_t ctxt) k =
      Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)).

    Axiom clear : (ctxt : Raw_context.t),
      Storage.Stake.Active_delegates_with_minimal_stake
        .(Storage_sigs.Indexed_data_snapshotable_storage.clear)
        (Raw_context.to_t ctxt) =
      return? Helpers.set ctxt ((Helpers.S).(Map.S.empty)).

    Axiom keys : (ctxt : Raw_context.t),
      Storage.Stake.Active_delegates_with_minimal_stake
        .(Storage_sigs.Indexed_data_snapshotable_storage.keys)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    Axiom bindings : (ctxt : Raw_context.t),
      Storage.Stake.Active_delegates_with_minimal_stake
        .(Storage_sigs.Indexed_data_snapshotable_storage.bindings)
        (Raw_context.to_t ctxt) =
      return? (Helpers.S).(Map.S.bindings) (Helpers.get ctxt).

    Axiom fold : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ _ a M? a),
      Storage.Stake.Active_delegates_with_minimal_stake
        .(Storage_sigs.Indexed_data_snapshotable_storage.fold)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold) (fun k v acclet? acc := acc in f k v acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    Axiom fold_keys : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ a M? a),
      Storage.Stake.Active_delegates_with_minimal_stake
        .(Storage_sigs.Indexed_data_snapshotable_storage.fold_keys)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold)
        (fun k _ acclet? acc := acc in f k acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove clear keys bindings
       @fold @fold_keys : storage_db.
    #[global] Opaque Storage.Stake.Active_delegates_with_minimal_stake.
  End Active_delegates_with_minimal_stake.

  Module Last_snapshot.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Stake_Last_snapshot).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Stake_Last_snapshot := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition name := ["last_snapshot"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t),
      Storage.Stake.Last_snapshot
        .(Storage_sigs.Single_data_storage.mem)
        (Raw_context.to_t ctxt) =
       match Helpers.get ctxt with
        | Some _true
        | Nonefalse

        end.

    Axiom get : (ctxt : Raw_context.t),
      Storage.Stake.Last_snapshot
        .(Storage_sigs.Single_data_storage.get)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some xPervasives.Ok x
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t),
      Storage.Stake.Last_snapshot
        .(Storage_sigs.Single_data_storage.find)
        (Raw_context.to_t ctxt) =
      return? Helpers.get ctxt.

    Axiom init_value : (ctxt : Raw_context.t) value,
      Storage.Stake.Last_snapshot
        .(Storage_sigs.Single_data_storage.init_value)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | None
          return? Helpers.set ctxt (Some value)
      | Some _

          Raw_context.storage_error_value
            (Raw_context.Existing_key Helpers.name)
      end.

    Axiom update : (ctxt : Raw_context.t) value,
      Storage.Stake.Last_snapshot
        .(Storage_sigs.Single_data_storage.update)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt (Some value)
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context._Set)
      end.

    Axiom add : (ctxt : Raw_context.t) value,
      Storage.Stake.Last_snapshot
        .(Storage_sigs.Single_data_storage.add)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt (Some value)
      | None ⇒ (Raw_context.to_t ctxt)
      end.

    Axiom add_or_remove : (ctxt : Raw_context.t) value,
      Storage.Stake.Last_snapshot
        .(Storage_sigs.Single_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) value =
        Helpers.set ctxt value.

    Axiom remove_existing : (ctxt : Raw_context.t),
      Storage.Stake.Last_snapshot
        .(Storage_sigs.Single_data_storage.remove_existing)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt None
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : (ctxt : Raw_context.t),
      Storage.Stake.Last_snapshot
        .(Storage_sigs.Single_data_storage.remove)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt None
      | NoneRaw_context.to_t ctxt
      end.

    #[global] Hint Rewrite mem get find init_value update add
      add_or_remove remove_existing remove : storage_db.
    #[global] Opaque Storage.Stake.Last_snapshot.
  End Last_snapshot.
End Stake.

Module Vote.
  Module Pred_period_kind.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Vote_Pred_period_kind).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Vote_Pred_period_kind := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition name := ["pred_period_kind"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t),
      Storage.Vote.Pred_period_kind
        .(Storage_sigs.Single_data_storage.mem)
        (Raw_context.to_t ctxt) =
       match Helpers.get ctxt with
        | Some _true
        | Nonefalse

        end.

    Axiom get : (ctxt : Raw_context.t),
      Storage.Vote.Pred_period_kind
        .(Storage_sigs.Single_data_storage.get)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some xPervasives.Ok x
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t),
      Storage.Vote.Pred_period_kind
        .(Storage_sigs.Single_data_storage.find)
        (Raw_context.to_t ctxt) =
      return? Helpers.get ctxt.

    Axiom init_value : (ctxt : Raw_context.t) value,
      Storage.Vote.Pred_period_kind
        .(Storage_sigs.Single_data_storage.init_value)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | None
          return? Helpers.set ctxt (Some value)
      | Some _

          Raw_context.storage_error_value
            (Raw_context.Existing_key Helpers.name)
      end.

    Axiom update : (ctxt : Raw_context.t) value,
      Storage.Vote.Pred_period_kind
        .(Storage_sigs.Single_data_storage.update)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt (Some value)
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context._Set)
      end.

    Axiom add : (ctxt : Raw_context.t) value,
      Storage.Vote.Pred_period_kind
        .(Storage_sigs.Single_data_storage.add)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt (Some value)
      | None ⇒ (Raw_context.to_t ctxt)
      end.

    Axiom add_or_remove : (ctxt : Raw_context.t) value,
      Storage.Vote.Pred_period_kind
        .(Storage_sigs.Single_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) value =
        Helpers.set ctxt value.

    Axiom remove_existing : (ctxt : Raw_context.t),
      Storage.Vote.Pred_period_kind
        .(Storage_sigs.Single_data_storage.remove_existing)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt None
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : (ctxt : Raw_context.t),
      Storage.Vote.Pred_period_kind
        .(Storage_sigs.Single_data_storage.remove)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt None
      | NoneRaw_context.to_t ctxt
      end.

    #[global] Hint Rewrite mem get find init_value update add
      add_or_remove remove_existing remove : storage_db.
    #[global] Opaque Storage.Vote.Pred_period_kind.
  End Pred_period_kind.

  Module Current_period.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Vote_Current_period).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Vote_Current_period := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition name := ["current_period"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t),
      Storage.Vote.Current_period
        .(Storage_sigs.Single_data_storage.mem)
        (Raw_context.to_t ctxt) =
       match Helpers.get ctxt with
        | Some _true
        | Nonefalse

        end.

    Axiom get : (ctxt : Raw_context.t),
      Storage.Vote.Current_period
        .(Storage_sigs.Single_data_storage.get)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some xPervasives.Ok x
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t),
      Storage.Vote.Current_period
        .(Storage_sigs.Single_data_storage.find)
        (Raw_context.to_t ctxt) =
      return? Helpers.get ctxt.

    Axiom init_value : (ctxt : Raw_context.t) value,
      Storage.Vote.Current_period
        .(Storage_sigs.Single_data_storage.init_value)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | None
          return? Helpers.set ctxt (Some value)
      | Some _

          Raw_context.storage_error_value
            (Raw_context.Existing_key Helpers.name)
      end.

    Axiom update : (ctxt : Raw_context.t) value,
      Storage.Vote.Current_period
        .(Storage_sigs.Single_data_storage.update)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt (Some value)
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context._Set)
      end.

    Axiom add : (ctxt : Raw_context.t) value,
      Storage.Vote.Current_period
        .(Storage_sigs.Single_data_storage.add)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt (Some value)
      | None ⇒ (Raw_context.to_t ctxt)
      end.

    Axiom add_or_remove : (ctxt : Raw_context.t) value,
      Storage.Vote.Current_period
        .(Storage_sigs.Single_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) value =
        Helpers.set ctxt value.

    Axiom remove_existing : (ctxt : Raw_context.t),
      Storage.Vote.Current_period
        .(Storage_sigs.Single_data_storage.remove_existing)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt None
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : (ctxt : Raw_context.t),
      Storage.Vote.Current_period
        .(Storage_sigs.Single_data_storage.remove)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt None
      | NoneRaw_context.to_t ctxt
      end.

    #[global] Hint Rewrite mem get find init_value update add
      add_or_remove remove_existing remove : storage_db.
    #[global] Opaque Storage.Vote.Current_period.
  End Current_period.

  Module Participation_ema.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Vote_Participation_ema).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Vote_Participation_ema := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition name := ["participation_ema"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t),
      Storage.Vote.Participation_ema
        .(Storage_sigs.Single_data_storage.mem)
        (Raw_context.to_t ctxt) =
       match Helpers.get ctxt with
        | Some _true
        | Nonefalse

        end.

    Axiom get : (ctxt : Raw_context.t),
      Storage.Vote.Participation_ema
        .(Storage_sigs.Single_data_storage.get)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some xPervasives.Ok x
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t),
      Storage.Vote.Participation_ema
        .(Storage_sigs.Single_data_storage.find)
        (Raw_context.to_t ctxt) =
      return? Helpers.get ctxt.

    Axiom init_value : (ctxt : Raw_context.t) value,
      Storage.Vote.Participation_ema
        .(Storage_sigs.Single_data_storage.init_value)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | None
          return? Helpers.set ctxt (Some value)
      | Some _

          Raw_context.storage_error_value
            (Raw_context.Existing_key Helpers.name)
      end.

    Axiom update : (ctxt : Raw_context.t) value,
      Storage.Vote.Participation_ema
        .(Storage_sigs.Single_data_storage.update)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt (Some value)
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context._Set)
      end.

    Axiom add : (ctxt : Raw_context.t) value,
      Storage.Vote.Participation_ema
        .(Storage_sigs.Single_data_storage.add)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt (Some value)
      | None ⇒ (Raw_context.to_t ctxt)
      end.

    Axiom add_or_remove : (ctxt : Raw_context.t) value,
      Storage.Vote.Participation_ema
        .(Storage_sigs.Single_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) value =
        Helpers.set ctxt value.

    Axiom remove_existing : (ctxt : Raw_context.t),
      Storage.Vote.Participation_ema
        .(Storage_sigs.Single_data_storage.remove_existing)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt None
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : (ctxt : Raw_context.t),
      Storage.Vote.Participation_ema
        .(Storage_sigs.Single_data_storage.remove)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt None
      | NoneRaw_context.to_t ctxt
      end.

    #[global] Hint Rewrite mem get find init_value update add
      add_or_remove remove_existing remove : storage_db.
    #[global] Opaque Storage.Vote.Participation_ema.
  End Participation_ema.

  Module Current_proposal.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Vote_Current_proposal).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Vote_Current_proposal := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition name := ["current_proposal"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t),
      Storage.Vote.Current_proposal
        .(Storage_sigs.Single_data_storage.mem)
        (Raw_context.to_t ctxt) =
       match Helpers.get ctxt with
        | Some _true
        | Nonefalse

        end.

    Axiom get : (ctxt : Raw_context.t),
      Storage.Vote.Current_proposal
        .(Storage_sigs.Single_data_storage.get)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some xPervasives.Ok x
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t),
      Storage.Vote.Current_proposal
        .(Storage_sigs.Single_data_storage.find)
        (Raw_context.to_t ctxt) =
      return? Helpers.get ctxt.

    Axiom init_value : (ctxt : Raw_context.t) value,
      Storage.Vote.Current_proposal
        .(Storage_sigs.Single_data_storage.init_value)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | None
          return? Helpers.set ctxt (Some value)
      | Some _

          Raw_context.storage_error_value
            (Raw_context.Existing_key Helpers.name)
      end.

    Axiom update : (ctxt : Raw_context.t) value,
      Storage.Vote.Current_proposal
        .(Storage_sigs.Single_data_storage.update)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt (Some value)
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context._Set)
      end.

    Axiom add : (ctxt : Raw_context.t) value,
      Storage.Vote.Current_proposal
        .(Storage_sigs.Single_data_storage.add)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt (Some value)
      | None ⇒ (Raw_context.to_t ctxt)
      end.

    Axiom add_or_remove : (ctxt : Raw_context.t) value,
      Storage.Vote.Current_proposal
        .(Storage_sigs.Single_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) value =
        Helpers.set ctxt value.

    Axiom remove_existing : (ctxt : Raw_context.t),
      Storage.Vote.Current_proposal
        .(Storage_sigs.Single_data_storage.remove_existing)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt None
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : (ctxt : Raw_context.t),
      Storage.Vote.Current_proposal
        .(Storage_sigs.Single_data_storage.remove)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt None
      | NoneRaw_context.to_t ctxt
      end.

    #[global] Hint Rewrite mem get find init_value update add
      add_or_remove remove_existing remove : storage_db.
    #[global] Opaque Storage.Vote.Current_proposal.
  End Current_proposal.

  Module Voting_power_in_listings.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Vote_Voting_power_in_listings).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Vote_Voting_power_in_listings := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition name := ["voting_power_in_listings"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t),
      Storage.Vote.Voting_power_in_listings
        .(Storage_sigs.Single_data_storage.mem)
        (Raw_context.to_t ctxt) =
       match Helpers.get ctxt with
        | Some _true
        | Nonefalse

        end.

    Axiom get : (ctxt : Raw_context.t),
      Storage.Vote.Voting_power_in_listings
        .(Storage_sigs.Single_data_storage.get)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some xPervasives.Ok x
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t),
      Storage.Vote.Voting_power_in_listings
        .(Storage_sigs.Single_data_storage.find)
        (Raw_context.to_t ctxt) =
      return? Helpers.get ctxt.

    Axiom init_value : (ctxt : Raw_context.t) value,
      Storage.Vote.Voting_power_in_listings
        .(Storage_sigs.Single_data_storage.init_value)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | None
          return? Helpers.set ctxt (Some value)
      | Some _

          Raw_context.storage_error_value
            (Raw_context.Existing_key Helpers.name)
      end.

    Axiom update : (ctxt : Raw_context.t) value,
      Storage.Vote.Voting_power_in_listings
        .(Storage_sigs.Single_data_storage.update)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt (Some value)
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context._Set)
      end.

    Axiom add : (ctxt : Raw_context.t) value,
      Storage.Vote.Voting_power_in_listings
        .(Storage_sigs.Single_data_storage.add)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt (Some value)
      | None ⇒ (Raw_context.to_t ctxt)
      end.

    Axiom add_or_remove : (ctxt : Raw_context.t) value,
      Storage.Vote.Voting_power_in_listings
        .(Storage_sigs.Single_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) value =
        Helpers.set ctxt value.

    Axiom remove_existing : (ctxt : Raw_context.t),
      Storage.Vote.Voting_power_in_listings
        .(Storage_sigs.Single_data_storage.remove_existing)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt None
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : (ctxt : Raw_context.t),
      Storage.Vote.Voting_power_in_listings
        .(Storage_sigs.Single_data_storage.remove)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt None
      | NoneRaw_context.to_t ctxt
      end.

    #[global] Hint Rewrite mem get find init_value update add
      add_or_remove remove_existing remove : storage_db.
    #[global] Opaque Storage.Vote.Voting_power_in_listings.
  End Voting_power_in_listings.

  Module Listings.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Vote_Listings).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Vote_Listings := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_functors_index Storage.Public_key_hash_index).
      Arguments S /.

      Definition name := ["listings"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Vote.Listings
        .(Storage_sigs.Indexed_data_storage.mem)
        (Raw_context.to_t ctxt) k =
      (Helpers.S).(Map.S.mem) k
        (Helpers.get ctxt).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Vote.Listings
        .(Storage_sigs.Indexed_data_storage.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok v
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Vote.Listings
        .(Storage_sigs.Indexed_data_storage.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Some v)
      | Nonereturn? None
      end.

    Axiom update : (ctxt : Raw_context.t) k v,
      Storage.Vote.Listings
        .(Storage_sigs.Indexed_data_storage.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then

        return? Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v,
      Storage.Vote.Listings
        .(Storage_sigs.Indexed_data_storage.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)).

    Axiom add : (ctxt : Raw_context.t) k v,
      Storage.Vote.Listings
        .(Storage_sigs.Indexed_data_storage.add)
        (Raw_context.to_t ctxt) k v =
      Helpers.set ctxt ((Helpers.S).(Map.S.add) k v

        (Helpers.get ctxt)).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v,
      Storage.Vote.Listings
        .(Storage_sigs.Indexed_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      match v with
      | Some v'

          Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            (Helpers.get ctxt))
      | None

          Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            (Helpers.get ctxt))
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k,
      Storage.Vote.Listings
        .(Storage_sigs.Indexed_data_storage.remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k,
      Storage.Vote.Listings
        .(Storage_sigs.Indexed_data_storage.remove)
        (Raw_context.to_t ctxt) k =
      Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)).

    Axiom clear : (ctxt : Raw_context.t),
      Storage.Vote.Listings
        .(Storage_sigs.Indexed_data_storage.clear)
        (Raw_context.to_t ctxt) =
      return? Helpers.set ctxt ((Helpers.S).(Map.S.empty)).

    Axiom keys : (ctxt : Raw_context.t),
      Storage.Vote.Listings
        .(Storage_sigs.Indexed_data_storage.keys)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    Axiom bindings : (ctxt : Raw_context.t),
      Storage.Vote.Listings
        .(Storage_sigs.Indexed_data_storage.bindings)
        (Raw_context.to_t ctxt) =
      return? (Helpers.S).(Map.S.bindings) (Helpers.get ctxt).

    Axiom fold : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ _ a M? a),
      Storage.Vote.Listings
        .(Storage_sigs.Indexed_data_storage.fold)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold) (fun k v acclet? acc := acc in f k v acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    Axiom fold_keys : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ a M? a),
      Storage.Vote.Listings
        .(Storage_sigs.Indexed_data_storage.fold_keys)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold)
        (fun k _ acclet? acc := acc in f k acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove clear keys bindings
       @fold @fold_keys : storage_db.
    #[global] Opaque Storage.Vote.Listings.
  End Listings.

  Module Proposals.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Vote_Proposals).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Vote_Proposals := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_set._Set
          (of_functors_index Raw_context.Voting_Proposals_Index).
      Arguments S /.
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) elt,
      Storage.Vote.Proposals
        .(Storage_sigs.Data_set_storage.mem)
        (Raw_context.to_t ctxt) elt =
      Helpers.S.(_Set.S.mem) elt (Helpers.get ctxt).

    Axiom add : (ctxt : Raw_context.t) elt,
      Storage.Vote.Proposals
        .(Storage_sigs.Data_set_storage.add)
        (Raw_context.to_t ctxt) elt =
      Helpers.set ctxt (Helpers.S.(_Set.S.add) elt (Helpers.get ctxt)).

    Axiom remove : (ctxt : Raw_context.t) elt,
      Storage.Vote.Proposals
        .(Storage_sigs.Data_set_storage.remove)
        (Raw_context.to_t ctxt) elt =
      Helpers.set ctxt (Helpers.S.(_Set.S.remove) elt
        (Helpers.get ctxt)).

    Axiom elements : (ctxt : Raw_context.t),
      Storage.Vote.Proposals
        .(Storage_sigs.Data_set_storage.elements)
        (Raw_context.to_t ctxt) =
      return? Helpers.S.(_Set.S.elements) (Helpers.get ctxt).

    Axiom fold : {a : Set} (ctxt : Raw_context.t) variant (x : a)
      (f : _ a M? a),
      Storage.Vote.Proposals
         .(Storage_sigs.Data_set_storage.fold)
         (Raw_context.to_t ctxt) variant x f =
      Helpers.S.(_Set.S.fold)
        (fun elt acclet? acc := acc in f elt acc) (Helpers.get ctxt)
        (Pervasives.Ok x).

    Axiom clear : (ctxt : Raw_context.t),
      Storage.Vote.Proposals
        .(Storage_sigs.Data_set_storage.clear)
        (Raw_context.to_t ctxt) =
      return? Helpers.set ctxt (Helpers.S.(_Set.S.empty)).

    #[global] Hint Rewrite mem add remove elements @fold clear

     : storage_db.
    #[global] Opaque Storage.Vote.Proposals.
  End Proposals.

  Module Proposals_count.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Vote_Proposals_count).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Vote_Proposals_count := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_functors_index Storage.Public_key_hash_index).
      Arguments S /.

      Definition name := ["proposals_count"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Vote.Proposals_count
        .(Storage_sigs.Indexed_data_storage.mem)
        (Raw_context.to_t ctxt) k =
      (Helpers.S).(Map.S.mem) k
        (Helpers.get ctxt).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Vote.Proposals_count
        .(Storage_sigs.Indexed_data_storage.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok v
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Vote.Proposals_count
        .(Storage_sigs.Indexed_data_storage.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Some v)
      | Nonereturn? None
      end.

    Axiom update : (ctxt : Raw_context.t) k v,
      Storage.Vote.Proposals_count
        .(Storage_sigs.Indexed_data_storage.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then

        return? Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v,
      Storage.Vote.Proposals_count
        .(Storage_sigs.Indexed_data_storage.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)).

    Axiom add : (ctxt : Raw_context.t) k v,
      Storage.Vote.Proposals_count
        .(Storage_sigs.Indexed_data_storage.add)
        (Raw_context.to_t ctxt) k v =
      Helpers.set ctxt ((Helpers.S).(Map.S.add) k v

        (Helpers.get ctxt)).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v,
      Storage.Vote.Proposals_count
        .(Storage_sigs.Indexed_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      match v with
      | Some v'

          Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            (Helpers.get ctxt))
      | None

          Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            (Helpers.get ctxt))
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k,
      Storage.Vote.Proposals_count
        .(Storage_sigs.Indexed_data_storage.remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k,
      Storage.Vote.Proposals_count
        .(Storage_sigs.Indexed_data_storage.remove)
        (Raw_context.to_t ctxt) k =
      Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)).

    Axiom clear : (ctxt : Raw_context.t),
      Storage.Vote.Proposals_count
        .(Storage_sigs.Indexed_data_storage.clear)
        (Raw_context.to_t ctxt) =
      return? Helpers.set ctxt ((Helpers.S).(Map.S.empty)).

    Axiom keys : (ctxt : Raw_context.t),
      Storage.Vote.Proposals_count
        .(Storage_sigs.Indexed_data_storage.keys)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    Axiom bindings : (ctxt : Raw_context.t),
      Storage.Vote.Proposals_count
        .(Storage_sigs.Indexed_data_storage.bindings)
        (Raw_context.to_t ctxt) =
      return? (Helpers.S).(Map.S.bindings) (Helpers.get ctxt).

    Axiom fold : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ _ a M? a),
      Storage.Vote.Proposals_count
        .(Storage_sigs.Indexed_data_storage.fold)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold) (fun k v acclet? acc := acc in f k v acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    Axiom fold_keys : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ a M? a),
      Storage.Vote.Proposals_count
        .(Storage_sigs.Indexed_data_storage.fold_keys)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold)
        (fun k _ acclet? acc := acc in f k acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove clear keys bindings
       @fold @fold_keys : storage_db.
    #[global] Opaque Storage.Vote.Proposals_count.
  End Proposals_count.

  Module Ballots.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Vote_Ballots).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Vote_Ballots := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_functors_index Storage.Public_key_hash_index).
      Arguments S /.

      Definition name := ["ballots"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Vote.Ballots
        .(Storage_sigs.Indexed_data_storage.mem)
        (Raw_context.to_t ctxt) k =
      (Helpers.S).(Map.S.mem) k
        (Helpers.get ctxt).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Vote.Ballots
        .(Storage_sigs.Indexed_data_storage.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok v
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Vote.Ballots
        .(Storage_sigs.Indexed_data_storage.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Some v)
      | Nonereturn? None
      end.

    Axiom update : (ctxt : Raw_context.t) k v,
      Storage.Vote.Ballots
        .(Storage_sigs.Indexed_data_storage.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then

        return? Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v,
      Storage.Vote.Ballots
        .(Storage_sigs.Indexed_data_storage.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)).

    Axiom add : (ctxt : Raw_context.t) k v,
      Storage.Vote.Ballots
        .(Storage_sigs.Indexed_data_storage.add)
        (Raw_context.to_t ctxt) k v =
      Helpers.set ctxt ((Helpers.S).(Map.S.add) k v

        (Helpers.get ctxt)).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v,
      Storage.Vote.Ballots
        .(Storage_sigs.Indexed_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      match v with
      | Some v'

          Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            (Helpers.get ctxt))
      | None

          Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            (Helpers.get ctxt))
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k,
      Storage.Vote.Ballots
        .(Storage_sigs.Indexed_data_storage.remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k,
      Storage.Vote.Ballots
        .(Storage_sigs.Indexed_data_storage.remove)
        (Raw_context.to_t ctxt) k =
      Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)).

    Axiom clear : (ctxt : Raw_context.t),
      Storage.Vote.Ballots
        .(Storage_sigs.Indexed_data_storage.clear)
        (Raw_context.to_t ctxt) =
      return? Helpers.set ctxt ((Helpers.S).(Map.S.empty)).

    Axiom keys : (ctxt : Raw_context.t),
      Storage.Vote.Ballots
        .(Storage_sigs.Indexed_data_storage.keys)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    Axiom bindings : (ctxt : Raw_context.t),
      Storage.Vote.Ballots
        .(Storage_sigs.Indexed_data_storage.bindings)
        (Raw_context.to_t ctxt) =
      return? (Helpers.S).(Map.S.bindings) (Helpers.get ctxt).

    Axiom fold : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ _ a M? a),
      Storage.Vote.Ballots
        .(Storage_sigs.Indexed_data_storage.fold)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold) (fun k v acclet? acc := acc in f k v acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    Axiom fold_keys : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ a M? a),
      Storage.Vote.Ballots
        .(Storage_sigs.Indexed_data_storage.fold_keys)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold)
        (fun k _ acclet? acc := acc in f k acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove clear keys bindings
       @fold @fold_keys : storage_db.
    #[global] Opaque Storage.Vote.Ballots.
  End Ballots.
End Vote.

Module Seed_status.
  Module Helpers.
    Definition get (ctxt : Raw_context.t) :=
      ctxt
        .(Raw_context.Seed_status).
    Arguments get _ /.

    Definition set (ctxt : Raw_context.t) value :=
      let ctxt' := ctxt <| Raw_context.Seed_status := value |> in
      (Raw_context.to_t ctxt').
    Arguments set _ _ /.

    Definition name := ["seed_status"].
  End Helpers.

  Axiom mem : (ctxt : Raw_context.t),
    Storage.Seed_status
      .(Storage_sigs.Single_data_storage.mem)
      (Raw_context.to_t ctxt) =
     match Helpers.get ctxt with
      | Some _true
      | Nonefalse

      end.

  Axiom get : (ctxt : Raw_context.t),
    Storage.Seed_status
      .(Storage_sigs.Single_data_storage.get)
      (Raw_context.to_t ctxt) =
    match Helpers.get ctxt with
    | Some xPervasives.Ok x
    | None

        Raw_context.storage_error_value
          (Raw_context.Missing_key Helpers.name Raw_context.Get)
    end.

  Axiom find : (ctxt : Raw_context.t),
    Storage.Seed_status
      .(Storage_sigs.Single_data_storage.find)
      (Raw_context.to_t ctxt) =
    return? Helpers.get ctxt.

  Axiom init_value : (ctxt : Raw_context.t) value,
    Storage.Seed_status
      .(Storage_sigs.Single_data_storage.init_value)
      (Raw_context.to_t ctxt) value =
    match Helpers.get ctxt with
    | None
        return? Helpers.set ctxt (Some value)
    | Some _

        Raw_context.storage_error_value
          (Raw_context.Existing_key Helpers.name)
    end.

  Axiom update : (ctxt : Raw_context.t) value,
    Storage.Seed_status
      .(Storage_sigs.Single_data_storage.update)
      (Raw_context.to_t ctxt) value =
    match Helpers.get ctxt with
    | Some _return? Helpers.set ctxt (Some value)
    | None

        Raw_context.storage_error_value
          (Raw_context.Missing_key Helpers.name Raw_context._Set)
    end.

  Axiom add : (ctxt : Raw_context.t) value,
    Storage.Seed_status
      .(Storage_sigs.Single_data_storage.add)
      (Raw_context.to_t ctxt) value =
    match Helpers.get ctxt with
    | Some _Helpers.set ctxt (Some value)
    | None ⇒ (Raw_context.to_t ctxt)
    end.

  Axiom add_or_remove : (ctxt : Raw_context.t) value,
    Storage.Seed_status
      .(Storage_sigs.Single_data_storage.add_or_remove)
      (Raw_context.to_t ctxt) value =
      Helpers.set ctxt value.

  Axiom remove_existing : (ctxt : Raw_context.t),
    Storage.Seed_status
      .(Storage_sigs.Single_data_storage.remove_existing)
      (Raw_context.to_t ctxt) =
    match Helpers.get ctxt with
    | Some _return? Helpers.set ctxt None
    | None
        Raw_context.storage_error_value
          (Raw_context.Missing_key Helpers.name Raw_context.Del)
    end.

  Axiom remove : (ctxt : Raw_context.t),
    Storage.Seed_status
      .(Storage_sigs.Single_data_storage.remove)
      (Raw_context.to_t ctxt) =
    match Helpers.get ctxt with
    | Some _Helpers.set ctxt None
    | NoneRaw_context.to_t ctxt
    end.

  #[global] Hint Rewrite mem get find init_value update add
    add_or_remove remove_existing remove : storage_db.
  #[global] Opaque Storage.Seed_status.
End Seed_status.

Module Seed.
  (* @TODO Skipped Nonce : Custom storage module *)

  Module VDF_setup.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Seed_VDF_setup).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Seed_VDF_setup := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition name := ["vdf_challenge"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t),
      Storage.Seed.VDF_setup
        .(Storage_sigs.Single_data_storage.mem)
        (Raw_context.to_t ctxt) =
       match Helpers.get ctxt with
        | Some _true
        | Nonefalse

        end.

    Axiom get : (ctxt : Raw_context.t),
      Storage.Seed.VDF_setup
        .(Storage_sigs.Single_data_storage.get)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some xPervasives.Ok x
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t),
      Storage.Seed.VDF_setup
        .(Storage_sigs.Single_data_storage.find)
        (Raw_context.to_t ctxt) =
      return? Helpers.get ctxt.

    Axiom init_value : (ctxt : Raw_context.t) value,
      Storage.Seed.VDF_setup
        .(Storage_sigs.Single_data_storage.init_value)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | None
          return? Helpers.set ctxt (Some value)
      | Some _

          Raw_context.storage_error_value
            (Raw_context.Existing_key Helpers.name)
      end.

    Axiom update : (ctxt : Raw_context.t) value,
      Storage.Seed.VDF_setup
        .(Storage_sigs.Single_data_storage.update)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt (Some value)
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context._Set)
      end.

    Axiom add : (ctxt : Raw_context.t) value,
      Storage.Seed.VDF_setup
        .(Storage_sigs.Single_data_storage.add)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt (Some value)
      | None ⇒ (Raw_context.to_t ctxt)
      end.

    Axiom add_or_remove : (ctxt : Raw_context.t) value,
      Storage.Seed.VDF_setup
        .(Storage_sigs.Single_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) value =
        Helpers.set ctxt value.

    Axiom remove_existing : (ctxt : Raw_context.t),
      Storage.Seed.VDF_setup
        .(Storage_sigs.Single_data_storage.remove_existing)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt None
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : (ctxt : Raw_context.t),
      Storage.Seed.VDF_setup
        .(Storage_sigs.Single_data_storage.remove)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt None
      | NoneRaw_context.to_t ctxt
      end.

    #[global] Hint Rewrite mem get find init_value update add
      add_or_remove remove_existing remove : storage_db.
    #[global] Opaque Storage.Seed.VDF_setup.
  End VDF_setup.
End Seed.

Module Commitments.
  Module Helpers.
    Definition get (ctxt : Raw_context.t) :=
      ctxt
        .(Raw_context.Commitments).
    Arguments get _ /.

    Definition set (ctxt : Raw_context.t) value :=
      let ctxt' := ctxt <| Raw_context.Commitments := value |> in
      (Raw_context.to_t ctxt').
    Arguments set _ _ /.

    Definition S :=
      Storage_sigs.Indexed_map.Map
        (of_description_index Blinded_public_key_hash.Index).
    Arguments S /.

    Definition name := ["commitments"].
  End Helpers.

  Axiom mem : (ctxt : Raw_context.t) k,
    Storage.Commitments
      .(Storage_sigs.Indexed_data_storage.mem)
      (Raw_context.to_t ctxt) k =
    (Helpers.S).(Map.S.mem) k
      (Helpers.get ctxt).

  Axiom get : (ctxt : Raw_context.t) k,
    Storage.Commitments
      .(Storage_sigs.Indexed_data_storage.get)
      (Raw_context.to_t ctxt) k =
    let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
    match x with
    | Some vPervasives.Ok v
    | None

        Raw_context.storage_error_value
          (Raw_context.Missing_key Helpers.name Raw_context.Get)
    end.

  Axiom find : (ctxt : Raw_context.t) k,
    Storage.Commitments
      .(Storage_sigs.Indexed_data_storage.find)
      (Raw_context.to_t ctxt) k =
    let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
    match x with
    | Some vreturn? (Some v)
    | Nonereturn? None
    end.

  Axiom update : (ctxt : Raw_context.t) k v,
    Storage.Commitments
      .(Storage_sigs.Indexed_data_storage.update)
      (Raw_context.to_t ctxt) k v =
    if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
    then

      return? Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
        (Helpers.get ctxt))
    else Raw_context.storage_error_value
      (Raw_context.Missing_key Helpers.name Raw_context._Set).

  Axiom init_value : (ctxt : Raw_context.t) k v,
    Storage.Commitments
      .(Storage_sigs.Indexed_data_storage.init_value)
      (Raw_context.to_t ctxt) k v =
    if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
    then Raw_context.storage_error_value
      (Raw_context.Missing_key Helpers.name Raw_context._Set)
    else return? Helpers.set ctxt ((Helpers.S).(Map.S.add)
      k v (Helpers.get ctxt)).

  Axiom add : (ctxt : Raw_context.t) k v,
    Storage.Commitments
      .(Storage_sigs.Indexed_data_storage.add)
      (Raw_context.to_t ctxt) k v =
    Helpers.set ctxt ((Helpers.S).(Map.S.add) k v

      (Helpers.get ctxt)).

  Axiom add_or_remove : (ctxt : Raw_context.t) k v,
    Storage.Commitments
      .(Storage_sigs.Indexed_data_storage.add_or_remove)
      (Raw_context.to_t ctxt) k v =
    match v with
    | Some v'

        Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
          (Helpers.get ctxt))
    | None

        Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
          (Helpers.get ctxt))
    end.

  Axiom remove_existing : (ctxt : Raw_context.t) k,
    Storage.Commitments
      .(Storage_sigs.Indexed_data_storage.remove_existing)
      (Raw_context.to_t ctxt) k =
    if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
    then return? Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
      (Helpers.get ctxt))
    else Raw_context.storage_error_value
      (Raw_context.Missing_key Helpers.name Raw_context.Del).

  Axiom remove : (ctxt : Raw_context.t) k,
    Storage.Commitments
      .(Storage_sigs.Indexed_data_storage.remove)
      (Raw_context.to_t ctxt) k =
    Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
      (Helpers.get ctxt)).

  Axiom clear : (ctxt : Raw_context.t),
    Storage.Commitments
      .(Storage_sigs.Indexed_data_storage.clear)
      (Raw_context.to_t ctxt) =
    return? Helpers.set ctxt ((Helpers.S).(Map.S.empty)).

  Axiom keys : (ctxt : Raw_context.t),
    Storage.Commitments
      .(Storage_sigs.Indexed_data_storage.keys)
      (Raw_context.to_t ctxt) =
    return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

  Axiom bindings : (ctxt : Raw_context.t),
    Storage.Commitments
      .(Storage_sigs.Indexed_data_storage.bindings)
      (Raw_context.to_t ctxt) =
    return? (Helpers.S).(Map.S.bindings) (Helpers.get ctxt).

  Axiom fold : {a : Set} (ctxt : Raw_context.t) variant
    (x : a) (f : _ _ a M? a),
    Storage.Commitments
      .(Storage_sigs.Indexed_data_storage.fold)
      (Raw_context.to_t ctxt) variant x f =
    (Helpers.S).(Map.S.fold) (fun k v acclet? acc := acc in f k v acc)
      (Helpers.get ctxt) (Pervasives.Ok x).

  Axiom fold_keys : {a : Set} (ctxt : Raw_context.t) variant
    (x : a) (f : _ a M? a),
    Storage.Commitments
      .(Storage_sigs.Indexed_data_storage.fold_keys)
      (Raw_context.to_t ctxt) variant x f =
    (Helpers.S).(Map.S.fold)
      (fun k _ acclet? acc := acc in f k acc)
      (Helpers.get ctxt) (Pervasives.Ok x).

  #[global] Hint Rewrite mem get find update init_value add
     add_or_remove remove_existing remove clear keys bindings
     @fold @fold_keys : storage_db.
  #[global] Opaque Storage.Commitments.
End Commitments.

Module Ramp_up.
  Module Rewards.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Ramp_up_Rewards).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Ramp_up_Rewards := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Cycle_repr.Index).
      Arguments S /.

      Definition name := ["ramp_up";"rewards"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Ramp_up.Rewards
        .(Storage_sigs.Indexed_data_storage.mem)
        (Raw_context.to_t ctxt) k =
      (Helpers.S).(Map.S.mem) k
        (Helpers.get ctxt).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Ramp_up.Rewards
        .(Storage_sigs.Indexed_data_storage.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok v
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Ramp_up.Rewards
        .(Storage_sigs.Indexed_data_storage.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Some v)
      | Nonereturn? None
      end.

    Axiom update : (ctxt : Raw_context.t) k v,
      Storage.Ramp_up.Rewards
        .(Storage_sigs.Indexed_data_storage.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then

        return? Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v,
      Storage.Ramp_up.Rewards
        .(Storage_sigs.Indexed_data_storage.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)).

    Axiom add : (ctxt : Raw_context.t) k v,
      Storage.Ramp_up.Rewards
        .(Storage_sigs.Indexed_data_storage.add)
        (Raw_context.to_t ctxt) k v =
      Helpers.set ctxt ((Helpers.S).(Map.S.add) k v

        (Helpers.get ctxt)).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v,
      Storage.Ramp_up.Rewards
        .(Storage_sigs.Indexed_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      match v with
      | Some v'

          Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            (Helpers.get ctxt))
      | None

          Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            (Helpers.get ctxt))
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k,
      Storage.Ramp_up.Rewards
        .(Storage_sigs.Indexed_data_storage.remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt))
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k,
      Storage.Ramp_up.Rewards
        .(Storage_sigs.Indexed_data_storage.remove)
        (Raw_context.to_t ctxt) k =
      Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)).

    Axiom clear : (ctxt : Raw_context.t),
      Storage.Ramp_up.Rewards
        .(Storage_sigs.Indexed_data_storage.clear)
        (Raw_context.to_t ctxt) =
      return? Helpers.set ctxt ((Helpers.S).(Map.S.empty)).

    Axiom keys : (ctxt : Raw_context.t),
      Storage.Ramp_up.Rewards
        .(Storage_sigs.Indexed_data_storage.keys)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    Axiom bindings : (ctxt : Raw_context.t),
      Storage.Ramp_up.Rewards
        .(Storage_sigs.Indexed_data_storage.bindings)
        (Raw_context.to_t ctxt) =
      return? (Helpers.S).(Map.S.bindings) (Helpers.get ctxt).

    Axiom fold : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ _ a M? a),
      Storage.Ramp_up.Rewards
        .(Storage_sigs.Indexed_data_storage.fold)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold) (fun k v acclet? acc := acc in f k v acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    Axiom fold_keys : {a : Set} (ctxt : Raw_context.t) variant
      (x : a) (f : _ a M? a),
      Storage.Ramp_up.Rewards
        .(Storage_sigs.Indexed_data_storage.fold_keys)
        (Raw_context.to_t ctxt) variant x f =
      (Helpers.S).(Map.S.fold)
        (fun k _ acclet? acc := acc in f k acc)
        (Helpers.get ctxt) (Pervasives.Ok x).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove clear keys bindings
       @fold @fold_keys : storage_db.
    #[global] Opaque Storage.Ramp_up.Rewards.
  End Rewards.
End Ramp_up.

Module Pending_migration.
  Module Balance_updates.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Pending_migration_Balance_updates).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Pending_migration_Balance_updates := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition name := ["pending_migration_balance_updates"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t),
      Storage.Pending_migration.Balance_updates
        .(Storage_sigs.Single_data_storage.mem)
        (Raw_context.to_t ctxt) =
       match Helpers.get ctxt with
        | Some _true
        | Nonefalse

        end.

    Axiom get : (ctxt : Raw_context.t),
      Storage.Pending_migration.Balance_updates
        .(Storage_sigs.Single_data_storage.get)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some xPervasives.Ok x
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t),
      Storage.Pending_migration.Balance_updates
        .(Storage_sigs.Single_data_storage.find)
        (Raw_context.to_t ctxt) =
      return? Helpers.get ctxt.

    Axiom init_value : (ctxt : Raw_context.t) value,
      Storage.Pending_migration.Balance_updates
        .(Storage_sigs.Single_data_storage.init_value)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | None
          return? Helpers.set ctxt (Some value)
      | Some _

          Raw_context.storage_error_value
            (Raw_context.Existing_key Helpers.name)
      end.

    Axiom update : (ctxt : Raw_context.t) value,
      Storage.Pending_migration.Balance_updates
        .(Storage_sigs.Single_data_storage.update)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt (Some value)
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context._Set)
      end.

    Axiom add : (ctxt : Raw_context.t) value,
      Storage.Pending_migration.Balance_updates
        .(Storage_sigs.Single_data_storage.add)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt (Some value)
      | None ⇒ (Raw_context.to_t ctxt)
      end.

    Axiom add_or_remove : (ctxt : Raw_context.t) value,
      Storage.Pending_migration.Balance_updates
        .(Storage_sigs.Single_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) value =
        Helpers.set ctxt value.

    Axiom remove_existing : (ctxt : Raw_context.t),
      Storage.Pending_migration.Balance_updates
        .(Storage_sigs.Single_data_storage.remove_existing)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt None
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : (ctxt : Raw_context.t),
      Storage.Pending_migration.Balance_updates
        .(Storage_sigs.Single_data_storage.remove)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt None
      | NoneRaw_context.to_t ctxt
      end.

    #[global] Hint Rewrite mem get find init_value update add
      add_or_remove remove_existing remove : storage_db.
    #[global] Opaque Storage.Pending_migration.Balance_updates.
  End Balance_updates.

  Module Operation_results.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Pending_migration_Operation_results).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Pending_migration_Operation_results := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition name := ["pending_migration_operation_results"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t),
      Storage.Pending_migration.Operation_results
        .(Storage_sigs.Single_data_storage.mem)
        (Raw_context.to_t ctxt) =
       match Helpers.get ctxt with
        | Some _true
        | Nonefalse

        end.

    Axiom get : (ctxt : Raw_context.t),
      Storage.Pending_migration.Operation_results
        .(Storage_sigs.Single_data_storage.get)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some xPervasives.Ok x
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t),
      Storage.Pending_migration.Operation_results
        .(Storage_sigs.Single_data_storage.find)
        (Raw_context.to_t ctxt) =
      return? Helpers.get ctxt.

    Axiom init_value : (ctxt : Raw_context.t) value,
      Storage.Pending_migration.Operation_results
        .(Storage_sigs.Single_data_storage.init_value)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | None
          return? Helpers.set ctxt (Some value)
      | Some _

          Raw_context.storage_error_value
            (Raw_context.Existing_key Helpers.name)
      end.

    Axiom update : (ctxt : Raw_context.t) value,
      Storage.Pending_migration.Operation_results
        .(Storage_sigs.Single_data_storage.update)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt (Some value)
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context._Set)
      end.

    Axiom add : (ctxt : Raw_context.t) value,
      Storage.Pending_migration.Operation_results
        .(Storage_sigs.Single_data_storage.add)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt (Some value)
      | None ⇒ (Raw_context.to_t ctxt)
      end.

    Axiom add_or_remove : (ctxt : Raw_context.t) value,
      Storage.Pending_migration.Operation_results
        .(Storage_sigs.Single_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) value =
        Helpers.set ctxt value.

    Axiom remove_existing : (ctxt : Raw_context.t),
      Storage.Pending_migration.Operation_results
        .(Storage_sigs.Single_data_storage.remove_existing)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt None
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : (ctxt : Raw_context.t),
      Storage.Pending_migration.Operation_results
        .(Storage_sigs.Single_data_storage.remove)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt None
      | NoneRaw_context.to_t ctxt
      end.

    #[global] Hint Rewrite mem get find init_value update add
      add_or_remove remove_existing remove : storage_db.
    #[global] Opaque Storage.Pending_migration.Operation_results.
  End Operation_results.
End Pending_migration.

Module Liquidity_baking.
  Module Toggle_ema.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Liquidity_baking_Toggle_ema).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Liquidity_baking_Toggle_ema := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition name := ["liquidity_baking_escape_ema"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t),
      Storage.Liquidity_baking.Toggle_ema
        .(Storage_sigs.Single_data_storage.mem)
        (Raw_context.to_t ctxt) =
       match Helpers.get ctxt with
        | Some _true
        | Nonefalse

        end.

    Axiom get : (ctxt : Raw_context.t),
      Storage.Liquidity_baking.Toggle_ema
        .(Storage_sigs.Single_data_storage.get)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some xPervasives.Ok x
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t),
      Storage.Liquidity_baking.Toggle_ema
        .(Storage_sigs.Single_data_storage.find)
        (Raw_context.to_t ctxt) =
      return? Helpers.get ctxt.

    Axiom init_value : (ctxt : Raw_context.t) value,
      Storage.Liquidity_baking.Toggle_ema
        .(Storage_sigs.Single_data_storage.init_value)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | None
          return? Helpers.set ctxt (Some value)
      | Some _

          Raw_context.storage_error_value
            (Raw_context.Existing_key Helpers.name)
      end.

    Axiom update : (ctxt : Raw_context.t) value,
      Storage.Liquidity_baking.Toggle_ema
        .(Storage_sigs.Single_data_storage.update)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt (Some value)
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context._Set)
      end.

    Axiom add : (ctxt : Raw_context.t) value,
      Storage.Liquidity_baking.Toggle_ema
        .(Storage_sigs.Single_data_storage.add)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt (Some value)
      | None ⇒ (Raw_context.to_t ctxt)
      end.

    Axiom add_or_remove : (ctxt : Raw_context.t) value,
      Storage.Liquidity_baking.Toggle_ema
        .(Storage_sigs.Single_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) value =
        Helpers.set ctxt value.

    Axiom remove_existing : (ctxt : Raw_context.t),
      Storage.Liquidity_baking.Toggle_ema
        .(Storage_sigs.Single_data_storage.remove_existing)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt None
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : (ctxt : Raw_context.t),
      Storage.Liquidity_baking.Toggle_ema
        .(Storage_sigs.Single_data_storage.remove)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt None
      | NoneRaw_context.to_t ctxt
      end.

    #[global] Hint Rewrite mem get find init_value update add
      add_or_remove remove_existing remove : storage_db.
    #[global] Opaque Storage.Liquidity_baking.Toggle_ema.
  End Toggle_ema.

  Module Cpmm_address.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Liquidity_baking_Cpmm_address).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Liquidity_baking_Cpmm_address := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition name := ["liquidity_baking_cpmm_address"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t),
      Storage.Liquidity_baking.Cpmm_address
        .(Storage_sigs.Single_data_storage.mem)
        (Raw_context.to_t ctxt) =
       match Helpers.get ctxt with
        | Some _true
        | Nonefalse

        end.

    Axiom get : (ctxt : Raw_context.t),
      Storage.Liquidity_baking.Cpmm_address
        .(Storage_sigs.Single_data_storage.get)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some xPervasives.Ok x
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t),
      Storage.Liquidity_baking.Cpmm_address
        .(Storage_sigs.Single_data_storage.find)
        (Raw_context.to_t ctxt) =
      return? Helpers.get ctxt.

    Axiom init_value : (ctxt : Raw_context.t) value,
      Storage.Liquidity_baking.Cpmm_address
        .(Storage_sigs.Single_data_storage.init_value)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | None
          return? Helpers.set ctxt (Some value)
      | Some _

          Raw_context.storage_error_value
            (Raw_context.Existing_key Helpers.name)
      end.

    Axiom update : (ctxt : Raw_context.t) value,
      Storage.Liquidity_baking.Cpmm_address
        .(Storage_sigs.Single_data_storage.update)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt (Some value)
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context._Set)
      end.

    Axiom add : (ctxt : Raw_context.t) value,
      Storage.Liquidity_baking.Cpmm_address
        .(Storage_sigs.Single_data_storage.add)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt (Some value)
      | None ⇒ (Raw_context.to_t ctxt)
      end.

    Axiom add_or_remove : (ctxt : Raw_context.t) value,
      Storage.Liquidity_baking.Cpmm_address
        .(Storage_sigs.Single_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) value =
        Helpers.set ctxt value.

    Axiom remove_existing : (ctxt : Raw_context.t),
      Storage.Liquidity_baking.Cpmm_address
        .(Storage_sigs.Single_data_storage.remove_existing)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt None
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : (ctxt : Raw_context.t),
      Storage.Liquidity_baking.Cpmm_address
        .(Storage_sigs.Single_data_storage.remove)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt None
      | NoneRaw_context.to_t ctxt
      end.

    #[global] Hint Rewrite mem get find init_value update add
      add_or_remove remove_existing remove : storage_db.
    #[global] Opaque Storage.Liquidity_baking.Cpmm_address.
  End Cpmm_address.
End Liquidity_baking.

Module Ticket_balance.
  Module Paid_storage_space.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Ticket_balance_Paid_storage_space).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Ticket_balance_Paid_storage_space := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition name := ["paid_bytes"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t),
      Storage.Ticket_balance.Paid_storage_space
        .(Storage_sigs.Single_data_storage.mem)
        (Raw_context.to_t ctxt) =
       match Helpers.get ctxt with
        | Some _true
        | Nonefalse

        end.

    Axiom get : (ctxt : Raw_context.t),
      Storage.Ticket_balance.Paid_storage_space
        .(Storage_sigs.Single_data_storage.get)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some xPervasives.Ok x
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t),
      Storage.Ticket_balance.Paid_storage_space
        .(Storage_sigs.Single_data_storage.find)
        (Raw_context.to_t ctxt) =
      return? Helpers.get ctxt.

    Axiom init_value : (ctxt : Raw_context.t) value,
      Storage.Ticket_balance.Paid_storage_space
        .(Storage_sigs.Single_data_storage.init_value)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | None
          return? Helpers.set ctxt (Some value)
      | Some _

          Raw_context.storage_error_value
            (Raw_context.Existing_key Helpers.name)
      end.

    Axiom update : (ctxt : Raw_context.t) value,
      Storage.Ticket_balance.Paid_storage_space
        .(Storage_sigs.Single_data_storage.update)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt (Some value)
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context._Set)
      end.

    Axiom add : (ctxt : Raw_context.t) value,
      Storage.Ticket_balance.Paid_storage_space
        .(Storage_sigs.Single_data_storage.add)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt (Some value)
      | None ⇒ (Raw_context.to_t ctxt)
      end.

    Axiom add_or_remove : (ctxt : Raw_context.t) value,
      Storage.Ticket_balance.Paid_storage_space
        .(Storage_sigs.Single_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) value =
        Helpers.set ctxt value.

    Axiom remove_existing : (ctxt : Raw_context.t),
      Storage.Ticket_balance.Paid_storage_space
        .(Storage_sigs.Single_data_storage.remove_existing)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt None
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : (ctxt : Raw_context.t),
      Storage.Ticket_balance.Paid_storage_space
        .(Storage_sigs.Single_data_storage.remove)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt None
      | NoneRaw_context.to_t ctxt
      end.

    #[global] Hint Rewrite mem get find init_value update add
      add_or_remove remove_existing remove : storage_db.
    #[global] Opaque Storage.Ticket_balance.Paid_storage_space.
  End Paid_storage_space.

  Module Used_storage_space.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Ticket_balance_Used_storage_space).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Ticket_balance_Used_storage_space := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition name := ["used_bytes"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t),
      Storage.Ticket_balance.Used_storage_space
        .(Storage_sigs.Single_data_storage.mem)
        (Raw_context.to_t ctxt) =
       match Helpers.get ctxt with
        | Some _true
        | Nonefalse

        end.

    Axiom get : (ctxt : Raw_context.t),
      Storage.Ticket_balance.Used_storage_space
        .(Storage_sigs.Single_data_storage.get)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some xPervasives.Ok x
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t),
      Storage.Ticket_balance.Used_storage_space
        .(Storage_sigs.Single_data_storage.find)
        (Raw_context.to_t ctxt) =
      return? Helpers.get ctxt.

    Axiom init_value : (ctxt : Raw_context.t) value,
      Storage.Ticket_balance.Used_storage_space
        .(Storage_sigs.Single_data_storage.init_value)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | None
          return? Helpers.set ctxt (Some value)
      | Some _

          Raw_context.storage_error_value
            (Raw_context.Existing_key Helpers.name)
      end.

    Axiom update : (ctxt : Raw_context.t) value,
      Storage.Ticket_balance.Used_storage_space
        .(Storage_sigs.Single_data_storage.update)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt (Some value)
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context._Set)
      end.

    Axiom add : (ctxt : Raw_context.t) value,
      Storage.Ticket_balance.Used_storage_space
        .(Storage_sigs.Single_data_storage.add)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt (Some value)
      | None ⇒ (Raw_context.to_t ctxt)
      end.

    Axiom add_or_remove : (ctxt : Raw_context.t) value,
      Storage.Ticket_balance.Used_storage_space
        .(Storage_sigs.Single_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) value =
        Helpers.set ctxt value.

    Axiom remove_existing : (ctxt : Raw_context.t),
      Storage.Ticket_balance.Used_storage_space
        .(Storage_sigs.Single_data_storage.remove_existing)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt None
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : (ctxt : Raw_context.t),
      Storage.Ticket_balance.Used_storage_space
        .(Storage_sigs.Single_data_storage.remove)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt None
      | NoneRaw_context.to_t ctxt
      end.

    #[global] Hint Rewrite mem get find init_value update add
      add_or_remove remove_existing remove : storage_db.
    #[global] Opaque Storage.Ticket_balance.Used_storage_space.
  End Used_storage_space.

  Module Table.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Ticket_balance_Table).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Ticket_balance_Table := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_functors_index Storage.Ticket_balance.Index).
      Arguments S /.

      Definition name := ["table"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Ticket_balance.Table
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.mem)
        (Raw_context.to_t ctxt) k =
      return? (Raw_context.to_t ctxt, (Helpers.S).(Map.S.mem) k
         (Helpers.get ctxt)).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Ticket_balance.Table
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok (Raw_context.to_t ctxt, v)
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Ticket_balance.Table
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Raw_context.to_t ctxt, (Some v))
      | Nonereturn? (Raw_context.to_t ctxt, None)
      end.

    Axiom update : (ctxt : Raw_context.t) k v size,
      Storage.Ticket_balance.Table
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then

        let ctxt := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt)) in
        return? (ctxt, size)
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v size,
      Storage.Ticket_balance.Table
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? (Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)), size).

    Axiom add : (ctxt : Raw_context.t) k v size,
      Storage.Ticket_balance.Table
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add)
        (Raw_context.to_t ctxt) k v =
     let storage := (Helpers.get ctxt) in
     let bound := (Helpers.S).(Map.S.mem) k storage in
     let storage' := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v storage) in
       return? (storage', size, bound).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v size,
      Storage.Ticket_balance.Table
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      let storage := Helpers.get ctxt in
      let mem := (Helpers.S).(Map.S.mem) k storage in
      match v with
      | Some v'
          let ctxt' := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            storage) in
          return? (ctxt', size, mem)
      | None

          let ctxt' := Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            storage) in
          return? (ctxt', size, mem)
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k size,
      Storage.Ticket_balance.Table
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? (Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)), size)
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k size,
      Storage.Ticket_balance.Table
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .remove)
        (Raw_context.to_t ctxt) k =
      let storage := Helpers.get ctxt in
      let mem := (Helpers.S).(Map.S.mem) k storage in
      return? (Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        storage), size, mem).

    Axiom keys_unaccounted : (ctxt : Raw_context.t),
      Storage.Ticket_balance.Table
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .keys_unaccounted)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove keys_unaccounted

       : storage_db.
    #[global] Opaque Storage.Ticket_balance.Table.
  End Table.
End Ticket_balance.

Module Tx_rollup.
  Module State.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Tx_rollup_State).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Tx_rollup_State := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Tx_rollup_repr.Index).
      Arguments S /.

      Definition name := ["tx_rollup"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Tx_rollup.State
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.mem)
        (Raw_context.to_t ctxt) k =
      return? (Raw_context.to_t ctxt, (Helpers.S).(Map.S.mem) k
         (Helpers.get ctxt)).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Tx_rollup.State
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok (Raw_context.to_t ctxt, v)
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Tx_rollup.State
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Raw_context.to_t ctxt, (Some v))
      | Nonereturn? (Raw_context.to_t ctxt, None)
      end.

    Axiom update : (ctxt : Raw_context.t) k v size,
      Storage.Tx_rollup.State
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then

        let ctxt := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt)) in
        return? (ctxt, size)
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v size,
      Storage.Tx_rollup.State
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? (Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)), size).

    Axiom add : (ctxt : Raw_context.t) k v size,
      Storage.Tx_rollup.State
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add)
        (Raw_context.to_t ctxt) k v =
     let storage := (Helpers.get ctxt) in
     let bound := (Helpers.S).(Map.S.mem) k storage in
     let storage' := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v storage) in
       return? (storage', size, bound).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v size,
      Storage.Tx_rollup.State
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      let storage := Helpers.get ctxt in
      let mem := (Helpers.S).(Map.S.mem) k storage in
      match v with
      | Some v'
          let ctxt' := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            storage) in
          return? (ctxt', size, mem)
      | None

          let ctxt' := Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            storage) in
          return? (ctxt', size, mem)
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k size,
      Storage.Tx_rollup.State
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? (Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)), size)
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k size,
      Storage.Tx_rollup.State
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .remove)
        (Raw_context.to_t ctxt) k =
      let storage := Helpers.get ctxt in
      let mem := (Helpers.S).(Map.S.mem) k storage in
      return? (Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        storage), size, mem).

    Axiom keys_unaccounted : (ctxt : Raw_context.t),
      Storage.Tx_rollup.State
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .keys_unaccounted)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove keys_unaccounted

       : storage_db.
    #[global] Opaque Storage.Tx_rollup.State.
  End State.

  Module Inbox.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Tx_rollup_Inbox).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Tx_rollup_Inbox := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition Map :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Tx_rollup_repr.Index).
      Arguments Map /.

      Definition Submap :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Tx_rollup_level_repr.Index).
      Arguments Submap /.

      Definition name := ["inbox"].
    End Helpers.

    Axiom mem : ctxt key subkey,
      Storage.Tx_rollup.Inbox
          .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
             .mem)

          (Raw_context.to_t ctxt, key) subkey =

      let map := (Helpers.Map).(Map.S.find)
        key (Helpers.get ctxt) in
      match map with

      | Some map

        return? (Raw_context.to_t ctxt,

          (Helpers.Submap).(Map.S.mem) subkey map)
      | Nonereturn? (Raw_context.to_t ctxt, false)
      end.

    Axiom get : ctxt subkey key,
      Storage.Tx_rollup.Inbox
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.get)
       (Raw_context.to_t ctxt, key)
       subkey =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Get) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
          let value := (Helpers.Submap).(Map.S.find) subkey submap' in
          match value with
          | Some value'return? (Raw_context.to_t ctxt, value')
          | Noneerror
          end
      | Noneerror
      end.

    Axiom find : ctxt subkey key,
      Storage.Tx_rollup.Inbox
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.find)
       (Raw_context.to_t ctxt, key)
       subkey =
     return? (Raw_context.to_t ctxt,
     let× map := (Helpers.Map).(Map.S.find)
       key
      (Helpers.get ctxt) in
     let× value := (Helpers.Submap).(Map.S.find) subkey map in
     return× value).

    Axiom update : ctxt subkey key value size,
      Storage.Tx_rollup.Inbox
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then

          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size)
        else error
      | Noneerror
      end.

    Axiom init_value : ctxt subkey key value size,
      Storage.Tx_rollup.Inbox
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then error
        else
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size)
      | None
        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size)
      end.

    Axiom add : ctxt key subkey value size,
      Storage.Tx_rollup.Inbox
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add)
      (Raw_context.to_t ctxt, key) subkey value =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
        let submap'' :=
          (Helpers.Submap).(Map.S.add) subkey value submap' in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size, mem)
      | None

        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size, false)
      end.

    Axiom add_or_remove : ctxt key subkey value_opt size,
      Storage.Tx_rollup.Inbox
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add_or_remove)
      (Raw_context.to_t ctxt, key) subkey value_opt =
      match value_opt with
      | Some value
        (* add the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
        | None

          let submap'' :=
            (Helpers.Submap).(Map.S.singleton) subkey value in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, false)
        end
      | None
        (* remove the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
        | None

            return? (Raw_context.to_t ctxt, size, false)
        end
      end.

    Axiom remove_existing : ctxt key subkey size,
      Storage.Tx_rollup.Inbox
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.remove_existing)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          if (Helpers.Submap).(Map.S.mem) subkey submap'
          then
            let submap'' :=
              (Helpers.Submap).(Map.S.remove) subkey submap' in
            let map' := (Helpers.Map).(Map.S.add) key submap'' map in
            return? (Helpers.set ctxt map', size)
          else
            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context.Del)
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : ctxt key subkey size,
      Storage.Tx_rollup.Inbox
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.remove)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
      | Nonereturn? (Raw_context.to_t ctxt, size, false)
      end.

    Axiom keys_unaccounted : ctxt key,
      Storage.Tx_rollup.Inbox
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.keys_unaccounted)
           (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'return? List.map fst ((Helpers.Submap).(Map.S.bindings)
          submap')
      | Nonereturn? []
      end.

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove keys_unaccounted

       : storage_db.
    #[global] Opaque Storage.Tx_rollup.Inbox.
  End Inbox.

  Module Revealed_withdrawals.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Tx_rollup_Revealed_withdrawals).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Tx_rollup_Revealed_withdrawals := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition Map :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Tx_rollup_repr.Index).
      Arguments Map /.

      Definition Submap :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Tx_rollup_level_repr.Index).
      Arguments Submap /.

      Definition name := ["withdrawals"].
    End Helpers.

    Axiom mem : ctxt key subkey,
      Storage.Tx_rollup.Revealed_withdrawals
          .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
             .mem)

          (Raw_context.to_t ctxt, key) subkey =

      let map := (Helpers.Map).(Map.S.find)
        key (Helpers.get ctxt) in
      match map with

      | Some map

        return? (Raw_context.to_t ctxt,

          (Helpers.Submap).(Map.S.mem) subkey map)
      | Nonereturn? (Raw_context.to_t ctxt, false)
      end.

    Axiom get : ctxt subkey key,
      Storage.Tx_rollup.Revealed_withdrawals
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.get)
       (Raw_context.to_t ctxt, key)
       subkey =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Get) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
          let value := (Helpers.Submap).(Map.S.find) subkey submap' in
          match value with
          | Some value'return? (Raw_context.to_t ctxt, value')
          | Noneerror
          end
      | Noneerror
      end.

    Axiom find : ctxt subkey key,
      Storage.Tx_rollup.Revealed_withdrawals
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.find)
       (Raw_context.to_t ctxt, key)
       subkey =
     return? (Raw_context.to_t ctxt,
     let× map := (Helpers.Map).(Map.S.find)
       key
      (Helpers.get ctxt) in
     let× value := (Helpers.Submap).(Map.S.find) subkey map in
     return× value).

    Axiom update : ctxt subkey key value size,
      Storage.Tx_rollup.Revealed_withdrawals
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then

          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size)
        else error
      | Noneerror
      end.

    Axiom init_value : ctxt subkey key value size,
      Storage.Tx_rollup.Revealed_withdrawals
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then error
        else
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size)
      | None
        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size)
      end.

    Axiom add : ctxt key subkey value size,
      Storage.Tx_rollup.Revealed_withdrawals
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add)
      (Raw_context.to_t ctxt, key) subkey value =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
        let submap'' :=
          (Helpers.Submap).(Map.S.add) subkey value submap' in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size, mem)
      | None

        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size, false)
      end.

    Axiom add_or_remove : ctxt key subkey value_opt size,
      Storage.Tx_rollup.Revealed_withdrawals
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add_or_remove)
      (Raw_context.to_t ctxt, key) subkey value_opt =
      match value_opt with
      | Some value
        (* add the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
        | None

          let submap'' :=
            (Helpers.Submap).(Map.S.singleton) subkey value in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, false)
        end
      | None
        (* remove the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
        | None

            return? (Raw_context.to_t ctxt, size, false)
        end
      end.

    Axiom remove_existing : ctxt key subkey size,
      Storage.Tx_rollup.Revealed_withdrawals
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.remove_existing)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          if (Helpers.Submap).(Map.S.mem) subkey submap'
          then
            let submap'' :=
              (Helpers.Submap).(Map.S.remove) subkey submap' in
            let map' := (Helpers.Map).(Map.S.add) key submap'' map in
            return? (Helpers.set ctxt map', size)
          else
            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context.Del)
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : ctxt key subkey size,
      Storage.Tx_rollup.Revealed_withdrawals
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.remove)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
      | Nonereturn? (Raw_context.to_t ctxt, size, false)
      end.

    Axiom keys_unaccounted : ctxt key,
      Storage.Tx_rollup.Revealed_withdrawals
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.keys_unaccounted)
           (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'return? List.map fst ((Helpers.Submap).(Map.S.bindings)
          submap')
      | Nonereturn? []
      end.

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove keys_unaccounted

       : storage_db.
    #[global] Opaque Storage.Tx_rollup.Revealed_withdrawals.
  End Revealed_withdrawals.

  Module Commitment.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Tx_rollup_Commitment).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Tx_rollup_Commitment := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition Map :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Tx_rollup_repr.Index).
      Arguments Map /.

      Definition Submap :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Tx_rollup_level_repr.Index).
      Arguments Submap /.

      Definition name := ["commitment"].
    End Helpers.

    Axiom mem : ctxt key subkey,
      Storage.Tx_rollup.Commitment
          .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
             .mem)

          (Raw_context.to_t ctxt, key) subkey =

      let map := (Helpers.Map).(Map.S.find)
        key (Helpers.get ctxt) in
      match map with

      | Some map

        return? (Raw_context.to_t ctxt,

          (Helpers.Submap).(Map.S.mem) subkey map)
      | Nonereturn? (Raw_context.to_t ctxt, false)
      end.

    Axiom get : ctxt subkey key,
      Storage.Tx_rollup.Commitment
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.get)
       (Raw_context.to_t ctxt, key)
       subkey =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Get) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
          let value := (Helpers.Submap).(Map.S.find) subkey submap' in
          match value with
          | Some value'return? (Raw_context.to_t ctxt, value')
          | Noneerror
          end
      | Noneerror
      end.

    Axiom find : ctxt subkey key,
      Storage.Tx_rollup.Commitment
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.find)
       (Raw_context.to_t ctxt, key)
       subkey =
     return? (Raw_context.to_t ctxt,
     let× map := (Helpers.Map).(Map.S.find)
       key
      (Helpers.get ctxt) in
     let× value := (Helpers.Submap).(Map.S.find) subkey map in
     return× value).

    Axiom update : ctxt subkey key value size,
      Storage.Tx_rollup.Commitment
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then

          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size)
        else error
      | Noneerror
      end.

    Axiom init_value : ctxt subkey key value size,
      Storage.Tx_rollup.Commitment
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then error
        else
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size)
      | None
        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size)
      end.

    Axiom add : ctxt key subkey value size,
      Storage.Tx_rollup.Commitment
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add)
      (Raw_context.to_t ctxt, key) subkey value =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
        let submap'' :=
          (Helpers.Submap).(Map.S.add) subkey value submap' in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size, mem)
      | None

        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size, false)
      end.

    Axiom add_or_remove : ctxt key subkey value_opt size,
      Storage.Tx_rollup.Commitment
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add_or_remove)
      (Raw_context.to_t ctxt, key) subkey value_opt =
      match value_opt with
      | Some value
        (* add the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
        | None

          let submap'' :=
            (Helpers.Submap).(Map.S.singleton) subkey value in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, false)
        end
      | None
        (* remove the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
        | None

            return? (Raw_context.to_t ctxt, size, false)
        end
      end.

    Axiom remove_existing : ctxt key subkey size,
      Storage.Tx_rollup.Commitment
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.remove_existing)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          if (Helpers.Submap).(Map.S.mem) subkey submap'
          then
            let submap'' :=
              (Helpers.Submap).(Map.S.remove) subkey submap' in
            let map' := (Helpers.Map).(Map.S.add) key submap'' map in
            return? (Helpers.set ctxt map', size)
          else
            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context.Del)
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : ctxt key subkey size,
      Storage.Tx_rollup.Commitment
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.remove)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
      | Nonereturn? (Raw_context.to_t ctxt, size, false)
      end.

    Axiom keys_unaccounted : ctxt key,
      Storage.Tx_rollup.Commitment
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.keys_unaccounted)
           (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'return? List.map fst ((Helpers.Submap).(Map.S.bindings)
          submap')
      | Nonereturn? []
      end.

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove keys_unaccounted

       : storage_db.
    #[global] Opaque Storage.Tx_rollup.Commitment.
  End Commitment.

  Module Commitment_bond.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Tx_rollup_Commitment_bond).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Tx_rollup_Commitment_bond := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition Map :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Tx_rollup_repr.Index).
      Arguments Map /.

      Definition Submap :=
        Storage_sigs.Indexed_map.Map
          (of_functors_index Storage.Public_key_hash_index).
      Arguments Submap /.

      Definition name := ["commitment"].
    End Helpers.

    Axiom mem : ctxt key subkey,
      Storage.Tx_rollup.Commitment_bond
          .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
             .mem)

          (Raw_context.to_t ctxt, key) subkey =

      let map := (Helpers.Map).(Map.S.find)
        key (Helpers.get ctxt) in
      match map with

      | Some map

        return? (Raw_context.to_t ctxt,

          (Helpers.Submap).(Map.S.mem) subkey map)
      | Nonereturn? (Raw_context.to_t ctxt, false)
      end.

    Axiom get : ctxt subkey key,
      Storage.Tx_rollup.Commitment_bond
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.get)
       (Raw_context.to_t ctxt, key)
       subkey =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Get) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
          let value := (Helpers.Submap).(Map.S.find) subkey submap' in
          match value with
          | Some value'return? (Raw_context.to_t ctxt, value')
          | Noneerror
          end
      | Noneerror
      end.

    Axiom find : ctxt subkey key,
      Storage.Tx_rollup.Commitment_bond
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.find)
       (Raw_context.to_t ctxt, key)
       subkey =
     return? (Raw_context.to_t ctxt,
     let× map := (Helpers.Map).(Map.S.find)
       key
      (Helpers.get ctxt) in
     let× value := (Helpers.Submap).(Map.S.find) subkey map in
     return× value).

    Axiom update : ctxt subkey key value size,
      Storage.Tx_rollup.Commitment_bond
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then

          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size)
        else error
      | Noneerror
      end.

    Axiom init_value : ctxt subkey key value size,
      Storage.Tx_rollup.Commitment_bond
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then error
        else
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size)
      | None
        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size)
      end.

    Axiom add : ctxt key subkey value size,
      Storage.Tx_rollup.Commitment_bond
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add)
      (Raw_context.to_t ctxt, key) subkey value =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
        let submap'' :=
          (Helpers.Submap).(Map.S.add) subkey value submap' in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size, mem)
      | None

        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size, false)
      end.

    Axiom add_or_remove : ctxt key subkey value_opt size,
      Storage.Tx_rollup.Commitment_bond
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add_or_remove)
      (Raw_context.to_t ctxt, key) subkey value_opt =
      match value_opt with
      | Some value
        (* add the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
        | None

          let submap'' :=
            (Helpers.Submap).(Map.S.singleton) subkey value in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, false)
        end
      | None
        (* remove the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
        | None

            return? (Raw_context.to_t ctxt, size, false)
        end
      end.

    Axiom remove_existing : ctxt key subkey size,
      Storage.Tx_rollup.Commitment_bond
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.remove_existing)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          if (Helpers.Submap).(Map.S.mem) subkey submap'
          then
            let submap'' :=
              (Helpers.Submap).(Map.S.remove) subkey submap' in
            let map' := (Helpers.Map).(Map.S.add) key submap'' map in
            return? (Helpers.set ctxt map', size)
          else
            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context.Del)
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : ctxt key subkey size,
      Storage.Tx_rollup.Commitment_bond
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.remove)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
      | Nonereturn? (Raw_context.to_t ctxt, size, false)
      end.

    Axiom keys_unaccounted : ctxt key,
      Storage.Tx_rollup.Commitment_bond
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.keys_unaccounted)
           (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'return? List.map fst ((Helpers.Submap).(Map.S.bindings)
          submap')
      | Nonereturn? []
      end.

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove keys_unaccounted

       : storage_db.
    #[global] Opaque Storage.Tx_rollup.Commitment_bond.
  End Commitment_bond.
End Tx_rollup.

Module Sc_rollup.
  Module PVM_kind.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Sc_rollup_PVM_kind).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Sc_rollup_PVM_kind := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Sc_rollup_repr.Index).
      Arguments S /.

      Definition name := ["kind"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Sc_rollup.PVM_kind
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.mem)
        (Raw_context.to_t ctxt) k =
      return? (Raw_context.to_t ctxt, (Helpers.S).(Map.S.mem) k
         (Helpers.get ctxt)).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Sc_rollup.PVM_kind
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok (Raw_context.to_t ctxt, v)
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Sc_rollup.PVM_kind
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Raw_context.to_t ctxt, (Some v))
      | Nonereturn? (Raw_context.to_t ctxt, None)
      end.

    Axiom update : (ctxt : Raw_context.t) k v size,
      Storage.Sc_rollup.PVM_kind
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then

        let ctxt := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt)) in
        return? (ctxt, size)
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v size,
      Storage.Sc_rollup.PVM_kind
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? (Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)), size).

    Axiom add : (ctxt : Raw_context.t) k v size,
      Storage.Sc_rollup.PVM_kind
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add)
        (Raw_context.to_t ctxt) k v =
     let storage := (Helpers.get ctxt) in
     let bound := (Helpers.S).(Map.S.mem) k storage in
     let storage' := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v storage) in
       return? (storage', size, bound).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v size,
      Storage.Sc_rollup.PVM_kind
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      let storage := Helpers.get ctxt in
      let mem := (Helpers.S).(Map.S.mem) k storage in
      match v with
      | Some v'
          let ctxt' := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            storage) in
          return? (ctxt', size, mem)
      | None

          let ctxt' := Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            storage) in
          return? (ctxt', size, mem)
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k size,
      Storage.Sc_rollup.PVM_kind
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? (Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)), size)
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k size,
      Storage.Sc_rollup.PVM_kind
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .remove)
        (Raw_context.to_t ctxt) k =
      let storage := Helpers.get ctxt in
      let mem := (Helpers.S).(Map.S.mem) k storage in
      return? (Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        storage), size, mem).

    Axiom keys_unaccounted : (ctxt : Raw_context.t),
      Storage.Sc_rollup.PVM_kind
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .keys_unaccounted)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove keys_unaccounted

       : storage_db.
    #[global] Opaque Storage.Sc_rollup.PVM_kind.
  End PVM_kind.

  Module Parameters_type.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Sc_rollup_Parameters_type).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Sc_rollup_Parameters_type := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Sc_rollup_repr.Index).
      Arguments S /.

      Definition name := ["parameters_type"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Sc_rollup.Parameters_type
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.mem)
        (Raw_context.to_t ctxt) k =
      return? (Raw_context.to_t ctxt, (Helpers.S).(Map.S.mem) k
         (Helpers.get ctxt)).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Sc_rollup.Parameters_type
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok (Raw_context.to_t ctxt, v)
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Sc_rollup.Parameters_type
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Raw_context.to_t ctxt, (Some v))
      | Nonereturn? (Raw_context.to_t ctxt, None)
      end.

    Axiom update : (ctxt : Raw_context.t) k v size,
      Storage.Sc_rollup.Parameters_type
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then

        let ctxt := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt)) in
        return? (ctxt, size)
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v size,
      Storage.Sc_rollup.Parameters_type
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? (Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)), size).

    Axiom add : (ctxt : Raw_context.t) k v size,
      Storage.Sc_rollup.Parameters_type
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add)
        (Raw_context.to_t ctxt) k v =
     let storage := (Helpers.get ctxt) in
     let bound := (Helpers.S).(Map.S.mem) k storage in
     let storage' := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v storage) in
       return? (storage', size, bound).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v size,
      Storage.Sc_rollup.Parameters_type
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      let storage := Helpers.get ctxt in
      let mem := (Helpers.S).(Map.S.mem) k storage in
      match v with
      | Some v'
          let ctxt' := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            storage) in
          return? (ctxt', size, mem)
      | None

          let ctxt' := Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            storage) in
          return? (ctxt', size, mem)
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k size,
      Storage.Sc_rollup.Parameters_type
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? (Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)), size)
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k size,
      Storage.Sc_rollup.Parameters_type
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .remove)
        (Raw_context.to_t ctxt) k =
      let storage := Helpers.get ctxt in
      let mem := (Helpers.S).(Map.S.mem) k storage in
      return? (Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        storage), size, mem).

    Axiom keys_unaccounted : (ctxt : Raw_context.t),
      Storage.Sc_rollup.Parameters_type
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .keys_unaccounted)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove keys_unaccounted

       : storage_db.
    #[global] Opaque Storage.Sc_rollup.Parameters_type.
  End Parameters_type.

  Module Genesis_info.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Sc_rollup_Genesis_info).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Sc_rollup_Genesis_info := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Sc_rollup_repr.Index).
      Arguments S /.

      Definition name := ["genesis_info"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Sc_rollup.Genesis_info
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.mem)
        (Raw_context.to_t ctxt) k =
      return? (Raw_context.to_t ctxt, (Helpers.S).(Map.S.mem) k
         (Helpers.get ctxt)).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Sc_rollup.Genesis_info
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok (Raw_context.to_t ctxt, v)
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Sc_rollup.Genesis_info
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Raw_context.to_t ctxt, (Some v))
      | Nonereturn? (Raw_context.to_t ctxt, None)
      end.

    Axiom update : (ctxt : Raw_context.t) k v size,
      Storage.Sc_rollup.Genesis_info
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then

        let ctxt := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt)) in
        return? (ctxt, size)
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v size,
      Storage.Sc_rollup.Genesis_info
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? (Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)), size).

    Axiom add : (ctxt : Raw_context.t) k v size,
      Storage.Sc_rollup.Genesis_info
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add)
        (Raw_context.to_t ctxt) k v =
     let storage := (Helpers.get ctxt) in
     let bound := (Helpers.S).(Map.S.mem) k storage in
     let storage' := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v storage) in
       return? (storage', size, bound).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v size,
      Storage.Sc_rollup.Genesis_info
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      let storage := Helpers.get ctxt in
      let mem := (Helpers.S).(Map.S.mem) k storage in
      match v with
      | Some v'
          let ctxt' := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            storage) in
          return? (ctxt', size, mem)
      | None

          let ctxt' := Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            storage) in
          return? (ctxt', size, mem)
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k size,
      Storage.Sc_rollup.Genesis_info
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? (Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)), size)
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k size,
      Storage.Sc_rollup.Genesis_info
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .remove)
        (Raw_context.to_t ctxt) k =
      let storage := Helpers.get ctxt in
      let mem := (Helpers.S).(Map.S.mem) k storage in
      return? (Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        storage), size, mem).

    Axiom keys_unaccounted : (ctxt : Raw_context.t),
      Storage.Sc_rollup.Genesis_info
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .keys_unaccounted)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove keys_unaccounted

       : storage_db.
    #[global] Opaque Storage.Sc_rollup.Genesis_info.
  End Genesis_info.

  Module Inbox.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Sc_rollup_Inbox).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Sc_rollup_Inbox := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition name := ["sc_rollup_inbox"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t),
      Storage.Sc_rollup.Inbox
        .(Storage_sigs.Single_data_storage.mem)
        (Raw_context.to_t ctxt) =
       match Helpers.get ctxt with
        | Some _true
        | Nonefalse

        end.

    Axiom get : (ctxt : Raw_context.t),
      Storage.Sc_rollup.Inbox
        .(Storage_sigs.Single_data_storage.get)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some xPervasives.Ok x
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t),
      Storage.Sc_rollup.Inbox
        .(Storage_sigs.Single_data_storage.find)
        (Raw_context.to_t ctxt) =
      return? Helpers.get ctxt.

    Axiom init_value : (ctxt : Raw_context.t) value,
      Storage.Sc_rollup.Inbox
        .(Storage_sigs.Single_data_storage.init_value)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | None
          return? Helpers.set ctxt (Some value)
      | Some _

          Raw_context.storage_error_value
            (Raw_context.Existing_key Helpers.name)
      end.

    Axiom update : (ctxt : Raw_context.t) value,
      Storage.Sc_rollup.Inbox
        .(Storage_sigs.Single_data_storage.update)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt (Some value)
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context._Set)
      end.

    Axiom add : (ctxt : Raw_context.t) value,
      Storage.Sc_rollup.Inbox
        .(Storage_sigs.Single_data_storage.add)
        (Raw_context.to_t ctxt) value =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt (Some value)
      | None ⇒ (Raw_context.to_t ctxt)
      end.

    Axiom add_or_remove : (ctxt : Raw_context.t) value,
      Storage.Sc_rollup.Inbox
        .(Storage_sigs.Single_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) value =
        Helpers.set ctxt value.

    Axiom remove_existing : (ctxt : Raw_context.t),
      Storage.Sc_rollup.Inbox
        .(Storage_sigs.Single_data_storage.remove_existing)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _return? Helpers.set ctxt None
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : (ctxt : Raw_context.t),
      Storage.Sc_rollup.Inbox
        .(Storage_sigs.Single_data_storage.remove)
        (Raw_context.to_t ctxt) =
      match Helpers.get ctxt with
      | Some _Helpers.set ctxt None
      | NoneRaw_context.to_t ctxt
      end.

    #[global] Hint Rewrite mem get find init_value update add
      add_or_remove remove_existing remove : storage_db.
    #[global] Opaque Storage.Sc_rollup.Inbox.
  End Inbox.

  Module Last_cemented_commitment.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Sc_rollup_Last_cemented_commitment).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Sc_rollup_Last_cemented_commitment := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Sc_rollup_repr.Index).
      Arguments S /.

      Definition name := ["last_cemented_commitment"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Sc_rollup.Last_cemented_commitment
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.mem)
        (Raw_context.to_t ctxt) k =
      return? (Raw_context.to_t ctxt, (Helpers.S).(Map.S.mem) k
         (Helpers.get ctxt)).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Sc_rollup.Last_cemented_commitment
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok (Raw_context.to_t ctxt, v)
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Sc_rollup.Last_cemented_commitment
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Raw_context.to_t ctxt, (Some v))
      | Nonereturn? (Raw_context.to_t ctxt, None)
      end.

    Axiom update : (ctxt : Raw_context.t) k v size,
      Storage.Sc_rollup.Last_cemented_commitment
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then

        let ctxt := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt)) in
        return? (ctxt, size)
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v size,
      Storage.Sc_rollup.Last_cemented_commitment
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? (Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)), size).

    Axiom add : (ctxt : Raw_context.t) k v size,
      Storage.Sc_rollup.Last_cemented_commitment
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add)
        (Raw_context.to_t ctxt) k v =
     let storage := (Helpers.get ctxt) in
     let bound := (Helpers.S).(Map.S.mem) k storage in
     let storage' := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v storage) in
       return? (storage', size, bound).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v size,
      Storage.Sc_rollup.Last_cemented_commitment
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      let storage := Helpers.get ctxt in
      let mem := (Helpers.S).(Map.S.mem) k storage in
      match v with
      | Some v'
          let ctxt' := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            storage) in
          return? (ctxt', size, mem)
      | None

          let ctxt' := Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            storage) in
          return? (ctxt', size, mem)
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k size,
      Storage.Sc_rollup.Last_cemented_commitment
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? (Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)), size)
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k size,
      Storage.Sc_rollup.Last_cemented_commitment
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .remove)
        (Raw_context.to_t ctxt) k =
      let storage := Helpers.get ctxt in
      let mem := (Helpers.S).(Map.S.mem) k storage in
      return? (Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        storage), size, mem).

    Axiom keys_unaccounted : (ctxt : Raw_context.t),
      Storage.Sc_rollup.Last_cemented_commitment
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .keys_unaccounted)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove keys_unaccounted

       : storage_db.
    #[global] Opaque Storage.Sc_rollup.Last_cemented_commitment.
  End Last_cemented_commitment.

  Module Stakers.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Sc_rollup_Stakers).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Sc_rollup_Stakers := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition Map :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Sc_rollup_repr.Index).
      Arguments Map /.

      Definition Submap :=
        Storage_sigs.Indexed_map.Map
          (of_functors_index Storage.Public_key_hash_index).
      Arguments Submap /.

      Definition name := ["stakers"].
    End Helpers.

    Axiom mem : ctxt key subkey,
      Storage.Sc_rollup.Stakers
          .(Storage_sigs.Indexed_carbonated_data_storage.mem)

          (Raw_context.to_t ctxt, key) subkey =

      let map := (Helpers.Map).(Map.S.find)
        key (Helpers.get ctxt) in
      match map with

      | Some map

        return? (Raw_context.to_t ctxt, (Helpers.Submap).(Map.S.mem) subkey map)
      | Nonereturn? (Raw_context.to_t ctxt, false)
      end.

    Axiom get : ctxt subkey key,
      Storage.Sc_rollup.Stakers
        .(Storage_sigs.Indexed_carbonated_data_storage.get)
       (Raw_context.to_t ctxt, key)
       subkey =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Get) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
          let value := (Helpers.Submap).(Map.S.find) subkey submap' in
          match value with
          | Some value'return? (Raw_context.to_t ctxt, value')
          | Noneerror
          end
      | Noneerror
      end.

    Axiom find : ctxt subkey key,
      Storage.Sc_rollup.Stakers
        .(Storage_sigs.Indexed_carbonated_data_storage.find)
       (Raw_context.to_t ctxt, key)
       subkey =
     return? (Raw_context.to_t ctxt,
     let× map := (Helpers.Map).(Map.S.find)
       key
      (Helpers.get ctxt) in
     let× value := (Helpers.Submap).(Map.S.find) subkey map in
     return× value).

    Axiom update : ctxt subkey key value i,
      Storage.Sc_rollup.Stakers
        .(Storage_sigs.Indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then

          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', i)
        else error
      | Noneerror
      end.

    Axiom init_value : ctxt subkey key value i,
      Storage.Sc_rollup.Stakers
        .(Storage_sigs.Indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then error
        else
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', i)
      | None
        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', i)
      end.

    Axiom add : ctxt key subkey value i,
      Storage.Sc_rollup.Stakers
        .(Storage_sigs.Indexed_carbonated_data_storage.add)
      (Raw_context.to_t ctxt, key) subkey value =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        let submap'' :=
          (Helpers.Submap).(Map.S.add) subkey value submap' in
        let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', i, mem)
      | None

        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', i, false)
      end.

    Axiom add_or_remove : ctxt key subkey value_opt i,
      Storage.Sc_rollup.Stakers
        .(Storage_sigs.Indexed_carbonated_data_storage.add_or_remove)
      (Raw_context.to_t ctxt, key) subkey value_opt =
      match value_opt with
      | Some value
        (* add the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', i, mem)
        | None

          let submap'' :=
            (Helpers.Submap).(Map.S.singleton) subkey value in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', i, false)
        end
      | None
        (* remove the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          return? (Helpers.set ctxt map', i, mem)
        | Nonereturn? (Raw_context.to_t ctxt, i, false)
        end
      end.

    Axiom remove_existing : ctxt key subkey i,
      Storage.Sc_rollup.Stakers
        .(Storage_sigs.Indexed_carbonated_data_storage.remove_existing)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          if (Helpers.Submap).(Map.S.mem) subkey submap'
          then
            let submap'' :=
              (Helpers.Submap).(Map.S.remove) subkey submap' in
            let map' := (Helpers.Map).(Map.S.add) key submap'' map in
            return? (Helpers.set ctxt map', i)
          else
            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context.Del)
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : ctxt key subkey i,
      Storage.Sc_rollup.Stakers
        .(Storage_sigs.Indexed_carbonated_data_storage.remove)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', i, mem)
      | Nonereturn? (Raw_context.to_t ctxt, i, false)
      end.

    Axiom list_key_values : ctxt key offset length,
      Storage.Sc_rollup.Stakers
        .(Storage_sigs.Indexed_carbonated_data_storage.list_key_values) offset length
           (Raw_context.to_t ctxt, key) =
      let map := (Helpers.Map).(Map.S.find) key (Helpers.get ctxt) in
      match map with
      | Some submap
        return? (Raw_context.to_t ctxt, (Helpers.Submap).(Map.S.bindings) submap)
      | Nonereturn? (Raw_context.to_t ctxt, [])
      end.

    #[global] Hint Rewrite mem get find init_value update add
      add_or_remove remove_existing remove list_key_values : storage_db.
    #[global] Opaque Storage.Sc_rollup.Stakers.
  End Stakers.

  Module Staker_count.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Sc_rollup_Staker_count).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Sc_rollup_Staker_count := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Sc_rollup_repr.Index).
      Arguments S /.

      Definition name := ["staker_count"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Sc_rollup.Staker_count
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.mem)
        (Raw_context.to_t ctxt) k =
      return? (Raw_context.to_t ctxt, (Helpers.S).(Map.S.mem) k
         (Helpers.get ctxt)).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Sc_rollup.Staker_count
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok (Raw_context.to_t ctxt, v)
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Sc_rollup.Staker_count
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Raw_context.to_t ctxt, (Some v))
      | Nonereturn? (Raw_context.to_t ctxt, None)
      end.

    Axiom update : (ctxt : Raw_context.t) k v size,
      Storage.Sc_rollup.Staker_count
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then

        let ctxt := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt)) in
        return? (ctxt, size)
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v size,
      Storage.Sc_rollup.Staker_count
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? (Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)), size).

    Axiom add : (ctxt : Raw_context.t) k v size,
      Storage.Sc_rollup.Staker_count
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add)
        (Raw_context.to_t ctxt) k v =
     let storage := (Helpers.get ctxt) in
     let bound := (Helpers.S).(Map.S.mem) k storage in
     let storage' := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v storage) in
       return? (storage', size, bound).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v size,
      Storage.Sc_rollup.Staker_count
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      let storage := Helpers.get ctxt in
      let mem := (Helpers.S).(Map.S.mem) k storage in
      match v with
      | Some v'
          let ctxt' := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            storage) in
          return? (ctxt', size, mem)
      | None

          let ctxt' := Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            storage) in
          return? (ctxt', size, mem)
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k size,
      Storage.Sc_rollup.Staker_count
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? (Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)), size)
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k size,
      Storage.Sc_rollup.Staker_count
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .remove)
        (Raw_context.to_t ctxt) k =
      let storage := Helpers.get ctxt in
      let mem := (Helpers.S).(Map.S.mem) k storage in
      return? (Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        storage), size, mem).

    Axiom keys_unaccounted : (ctxt : Raw_context.t),
      Storage.Sc_rollup.Staker_count
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .keys_unaccounted)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove keys_unaccounted

       : storage_db.
    #[global] Opaque Storage.Sc_rollup.Staker_count.
  End Staker_count.

  Module Commitments.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Sc_rollup_Commitments).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Sc_rollup_Commitments := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition Map :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Sc_rollup_repr.Index).
      Arguments Map /.

      Definition Submap :=
        Storage_sigs.Indexed_map.Map
          Sc_rollup_commitment_repr.Hash.Path_encoding_Make_hex_include.
      Arguments Submap /.

      Definition name := ["commitments"].
    End Helpers.

    Axiom mem : ctxt key subkey,
      Storage.Sc_rollup.Commitments
          .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
             .mem)

          (Raw_context.to_t ctxt, key) subkey =

      let map := (Helpers.Map).(Map.S.find)
        key (Helpers.get ctxt) in
      match map with

      | Some map

        return? (Raw_context.to_t ctxt,

          (Helpers.Submap).(Map.S.mem) subkey map)
      | Nonereturn? (Raw_context.to_t ctxt, false)
      end.

    Axiom get : ctxt subkey key,
      Storage.Sc_rollup.Commitments
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.get)
       (Raw_context.to_t ctxt, key)
       subkey =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Get) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
          let value := (Helpers.Submap).(Map.S.find) subkey submap' in
          match value with
          | Some value'return? (Raw_context.to_t ctxt, value')
          | Noneerror
          end
      | Noneerror
      end.

    Axiom find : ctxt subkey key,
      Storage.Sc_rollup.Commitments
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.find)
       (Raw_context.to_t ctxt, key)
       subkey =
     return? (Raw_context.to_t ctxt,
     let× map := (Helpers.Map).(Map.S.find)
       key
      (Helpers.get ctxt) in
     let× value := (Helpers.Submap).(Map.S.find) subkey map in
     return× value).

    Axiom update : ctxt subkey key value size,
      Storage.Sc_rollup.Commitments
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then

          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size)
        else error
      | Noneerror
      end.

    Axiom init_value : ctxt subkey key value size,
      Storage.Sc_rollup.Commitments
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then error
        else
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size)
      | None
        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size)
      end.

    Axiom add : ctxt key subkey value size,
      Storage.Sc_rollup.Commitments
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add)
      (Raw_context.to_t ctxt, key) subkey value =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
        let submap'' :=
          (Helpers.Submap).(Map.S.add) subkey value submap' in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size, mem)
      | None

        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size, false)
      end.

    Axiom add_or_remove : ctxt key subkey value_opt size,
      Storage.Sc_rollup.Commitments
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add_or_remove)
      (Raw_context.to_t ctxt, key) subkey value_opt =
      match value_opt with
      | Some value
        (* add the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
        | None

          let submap'' :=
            (Helpers.Submap).(Map.S.singleton) subkey value in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, false)
        end
      | None
        (* remove the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
        | None

            return? (Raw_context.to_t ctxt, size, false)
        end
      end.

    Axiom remove_existing : ctxt key subkey size,
      Storage.Sc_rollup.Commitments
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.remove_existing)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          if (Helpers.Submap).(Map.S.mem) subkey submap'
          then
            let submap'' :=
              (Helpers.Submap).(Map.S.remove) subkey submap' in
            let map' := (Helpers.Map).(Map.S.add) key submap'' map in
            return? (Helpers.set ctxt map', size)
          else
            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context.Del)
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : ctxt key subkey size,
      Storage.Sc_rollup.Commitments
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.remove)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
      | Nonereturn? (Raw_context.to_t ctxt, size, false)
      end.

    Axiom keys_unaccounted : ctxt key,
      Storage.Sc_rollup.Commitments
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.keys_unaccounted)
           (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'return? List.map fst ((Helpers.Submap).(Map.S.bindings)
          submap')
      | Nonereturn? []
      end.

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove keys_unaccounted

       : storage_db.
    #[global] Opaque Storage.Sc_rollup.Commitments.
  End Commitments.

  Module Commitment_stake_count.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Sc_rollup_Commitment_stake_count).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Sc_rollup_Commitment_stake_count := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition Map :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Sc_rollup_repr.Index).
      Arguments Map /.

      Definition Submap :=
        Storage_sigs.Indexed_map.Map
          Sc_rollup_commitment_repr.Hash.Path_encoding_Make_hex_include.
      Arguments Submap /.

      Definition name := ["commitment_stake_count"].
    End Helpers.

    Axiom mem : ctxt key subkey,
      Storage.Sc_rollup.Commitment_stake_count
          .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
             .mem)

          (Raw_context.to_t ctxt, key) subkey =

      let map := (Helpers.Map).(Map.S.find)
        key (Helpers.get ctxt) in
      match map with

      | Some map

        return? (Raw_context.to_t ctxt,

          (Helpers.Submap).(Map.S.mem) subkey map)
      | Nonereturn? (Raw_context.to_t ctxt, false)
      end.

    Axiom get : ctxt subkey key,
      Storage.Sc_rollup.Commitment_stake_count
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.get)
       (Raw_context.to_t ctxt, key)
       subkey =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Get) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
          let value := (Helpers.Submap).(Map.S.find) subkey submap' in
          match value with
          | Some value'return? (Raw_context.to_t ctxt, value')
          | Noneerror
          end
      | Noneerror
      end.

    Axiom find : ctxt subkey key,
      Storage.Sc_rollup.Commitment_stake_count
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.find)
       (Raw_context.to_t ctxt, key)
       subkey =
     return? (Raw_context.to_t ctxt,
     let× map := (Helpers.Map).(Map.S.find)
       key
      (Helpers.get ctxt) in
     let× value := (Helpers.Submap).(Map.S.find) subkey map in
     return× value).

    Axiom update : ctxt subkey key value size,
      Storage.Sc_rollup.Commitment_stake_count
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then

          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size)
        else error
      | Noneerror
      end.

    Axiom init_value : ctxt subkey key value size,
      Storage.Sc_rollup.Commitment_stake_count
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then error
        else
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size)
      | None
        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size)
      end.

    Axiom add : ctxt key subkey value size,
      Storage.Sc_rollup.Commitment_stake_count
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add)
      (Raw_context.to_t ctxt, key) subkey value =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
        let submap'' :=
          (Helpers.Submap).(Map.S.add) subkey value submap' in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size, mem)
      | None

        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size, false)
      end.

    Axiom add_or_remove : ctxt key subkey value_opt size,
      Storage.Sc_rollup.Commitment_stake_count
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add_or_remove)
      (Raw_context.to_t ctxt, key) subkey value_opt =
      match value_opt with
      | Some value
        (* add the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
        | None

          let submap'' :=
            (Helpers.Submap).(Map.S.singleton) subkey value in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, false)
        end
      | None
        (* remove the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
        | None

            return? (Raw_context.to_t ctxt, size, false)
        end
      end.

    Axiom remove_existing : ctxt key subkey size,
      Storage.Sc_rollup.Commitment_stake_count
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.remove_existing)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          if (Helpers.Submap).(Map.S.mem) subkey submap'
          then
            let submap'' :=
              (Helpers.Submap).(Map.S.remove) subkey submap' in
            let map' := (Helpers.Map).(Map.S.add) key submap'' map in
            return? (Helpers.set ctxt map', size)
          else
            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context.Del)
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : ctxt key subkey size,
      Storage.Sc_rollup.Commitment_stake_count
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.remove)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
      | Nonereturn? (Raw_context.to_t ctxt, size, false)
      end.

    Axiom keys_unaccounted : ctxt key,
      Storage.Sc_rollup.Commitment_stake_count
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.keys_unaccounted)
           (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'return? List.map fst ((Helpers.Submap).(Map.S.bindings)
          submap')
      | Nonereturn? []
      end.

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove keys_unaccounted

       : storage_db.
    #[global] Opaque Storage.Sc_rollup.Commitment_stake_count.
  End Commitment_stake_count.

  Module Commitment_first_publication_level.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Sc_rollup_Commitment_first_publication_level).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Sc_rollup_Commitment_first_publication_level := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition Map :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Sc_rollup_repr.Index).
      Arguments Map /.

      Definition Submap :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Raw_level_repr.Index).
      Arguments Submap /.

      Definition name := ["commitment_first_publication_level"].
    End Helpers.

    Axiom mem : ctxt key subkey,
      Storage.Sc_rollup.Commitment_first_publication_level
          .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
             .mem)

          (Raw_context.to_t ctxt, key) subkey =

      let map := (Helpers.Map).(Map.S.find)
        key (Helpers.get ctxt) in
      match map with

      | Some map

        return? (Raw_context.to_t ctxt,

          (Helpers.Submap).(Map.S.mem) subkey map)
      | Nonereturn? (Raw_context.to_t ctxt, false)
      end.

    Axiom get : ctxt subkey key,
      Storage.Sc_rollup.Commitment_first_publication_level
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.get)
       (Raw_context.to_t ctxt, key)
       subkey =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Get) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
          let value := (Helpers.Submap).(Map.S.find) subkey submap' in
          match value with
          | Some value'return? (Raw_context.to_t ctxt, value')
          | Noneerror
          end
      | Noneerror
      end.

    Axiom find : ctxt subkey key,
      Storage.Sc_rollup.Commitment_first_publication_level
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.find)
       (Raw_context.to_t ctxt, key)
       subkey =
     return? (Raw_context.to_t ctxt,
     let× map := (Helpers.Map).(Map.S.find)
       key
      (Helpers.get ctxt) in
     let× value := (Helpers.Submap).(Map.S.find) subkey map in
     return× value).

    Axiom update : ctxt subkey key value size,
      Storage.Sc_rollup.Commitment_first_publication_level
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then

          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size)
        else error
      | Noneerror
      end.

    Axiom init_value : ctxt subkey key value size,
      Storage.Sc_rollup.Commitment_first_publication_level
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then error
        else
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size)
      | None
        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size)
      end.

    Axiom add : ctxt key subkey value size,
      Storage.Sc_rollup.Commitment_first_publication_level
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add)
      (Raw_context.to_t ctxt, key) subkey value =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
        let submap'' :=
          (Helpers.Submap).(Map.S.add) subkey value submap' in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size, mem)
      | None

        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size, false)
      end.

    Axiom add_or_remove : ctxt key subkey value_opt size,
      Storage.Sc_rollup.Commitment_first_publication_level
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add_or_remove)
      (Raw_context.to_t ctxt, key) subkey value_opt =
      match value_opt with
      | Some value
        (* add the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
        | None

          let submap'' :=
            (Helpers.Submap).(Map.S.singleton) subkey value in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, false)
        end
      | None
        (* remove the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
        | None

            return? (Raw_context.to_t ctxt, size, false)
        end
      end.

    Axiom remove_existing : ctxt key subkey size,
      Storage.Sc_rollup.Commitment_first_publication_level
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.remove_existing)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          if (Helpers.Submap).(Map.S.mem) subkey submap'
          then
            let submap'' :=
              (Helpers.Submap).(Map.S.remove) subkey submap' in
            let map' := (Helpers.Map).(Map.S.add) key submap'' map in
            return? (Helpers.set ctxt map', size)
          else
            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context.Del)
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : ctxt key subkey size,
      Storage.Sc_rollup.Commitment_first_publication_level
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.remove)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
      | Nonereturn? (Raw_context.to_t ctxt, size, false)
      end.

    Axiom keys_unaccounted : ctxt key,
      Storage.Sc_rollup.Commitment_first_publication_level
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.keys_unaccounted)
           (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'return? List.map fst ((Helpers.Submap).(Map.S.bindings)
          submap')
      | Nonereturn? []
      end.

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove keys_unaccounted

       : storage_db.
    #[global] Opaque Storage.Sc_rollup.Commitment_first_publication_level.
  End Commitment_first_publication_level.

  Module Commitment_added.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Sc_rollup_Commitment_added).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Sc_rollup_Commitment_added := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition Map :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Sc_rollup_repr.Index).
      Arguments Map /.

      Definition Submap :=
        Storage_sigs.Indexed_map.Map
          Sc_rollup_commitment_repr.Hash.Path_encoding_Make_hex_include.
      Arguments Submap /.

      Definition name := ["commitment_added"].
    End Helpers.

    Axiom mem : ctxt key subkey,
      Storage.Sc_rollup.Commitment_added
          .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
             .mem)

          (Raw_context.to_t ctxt, key) subkey =

      let map := (Helpers.Map).(Map.S.find)
        key (Helpers.get ctxt) in
      match map with

      | Some map

        return? (Raw_context.to_t ctxt,

          (Helpers.Submap).(Map.S.mem) subkey map)
      | Nonereturn? (Raw_context.to_t ctxt, false)
      end.

    Axiom get : ctxt subkey key,
      Storage.Sc_rollup.Commitment_added
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.get)
       (Raw_context.to_t ctxt, key)
       subkey =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Get) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
          let value := (Helpers.Submap).(Map.S.find) subkey submap' in
          match value with
          | Some value'return? (Raw_context.to_t ctxt, value')
          | Noneerror
          end
      | Noneerror
      end.

    Axiom find : ctxt subkey key,
      Storage.Sc_rollup.Commitment_added
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.find)
       (Raw_context.to_t ctxt, key)
       subkey =
     return? (Raw_context.to_t ctxt,
     let× map := (Helpers.Map).(Map.S.find)
       key
      (Helpers.get ctxt) in
     let× value := (Helpers.Submap).(Map.S.find) subkey map in
     return× value).

    Axiom update : ctxt subkey key value size,
      Storage.Sc_rollup.Commitment_added
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then

          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size)
        else error
      | Noneerror
      end.

    Axiom init_value : ctxt subkey key value size,
      Storage.Sc_rollup.Commitment_added
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then error
        else
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size)
      | None
        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size)
      end.

    Axiom add : ctxt key subkey value size,
      Storage.Sc_rollup.Commitment_added
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add)
      (Raw_context.to_t ctxt, key) subkey value =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
        let submap'' :=
          (Helpers.Submap).(Map.S.add) subkey value submap' in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size, mem)
      | None

        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size, false)
      end.

    Axiom add_or_remove : ctxt key subkey value_opt size,
      Storage.Sc_rollup.Commitment_added
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add_or_remove)
      (Raw_context.to_t ctxt, key) subkey value_opt =
      match value_opt with
      | Some value
        (* add the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
        | None

          let submap'' :=
            (Helpers.Submap).(Map.S.singleton) subkey value in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, false)
        end
      | None
        (* remove the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
        | None

            return? (Raw_context.to_t ctxt, size, false)
        end
      end.

    Axiom remove_existing : ctxt key subkey size,
      Storage.Sc_rollup.Commitment_added
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.remove_existing)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          if (Helpers.Submap).(Map.S.mem) subkey submap'
          then
            let submap'' :=
              (Helpers.Submap).(Map.S.remove) subkey submap' in
            let map' := (Helpers.Map).(Map.S.add) key submap'' map in
            return? (Helpers.set ctxt map', size)
          else
            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context.Del)
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : ctxt key subkey size,
      Storage.Sc_rollup.Commitment_added
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.remove)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
      | Nonereturn? (Raw_context.to_t ctxt, size, false)
      end.

    Axiom keys_unaccounted : ctxt key,
      Storage.Sc_rollup.Commitment_added
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.keys_unaccounted)
           (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'return? List.map fst ((Helpers.Submap).(Map.S.bindings)
          submap')
      | Nonereturn? []
      end.

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove keys_unaccounted

       : storage_db.
    #[global] Opaque Storage.Sc_rollup.Commitment_added.
  End Commitment_added.

  Module Game_versioned.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Sc_rollup_Game_versioned).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Sc_rollup_Game_versioned := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition Map :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Sc_rollup_repr.Index).
      Arguments Map /.

      Definition Submap :=
        Storage_sigs.Indexed_map.Map
          (of_functors_index Raw_context.Sc_rollup_Game_versioned_and_timeout_Index).
      Arguments Submap /.

      Definition name := ["game_versioned"].
    End Helpers.

    Axiom mem : ctxt key subkey,
      Storage.Sc_rollup.Game_versioned
          .(Storage_sigs.Indexed_carbonated_data_storage.mem)

          (Raw_context.to_t ctxt, key) subkey =

      let map := (Helpers.Map).(Map.S.find)
        key (Helpers.get ctxt) in
      match map with

      | Some map

        return? (Raw_context.to_t ctxt, (Helpers.Submap).(Map.S.mem) subkey map)
      | Nonereturn? (Raw_context.to_t ctxt, false)
      end.

    Axiom get : ctxt subkey key,
      Storage.Sc_rollup.Game_versioned
        .(Storage_sigs.Indexed_carbonated_data_storage.get)
       (Raw_context.to_t ctxt, key)
       subkey =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Get) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
          let value := (Helpers.Submap).(Map.S.find) subkey submap' in
          match value with
          | Some value'return? (Raw_context.to_t ctxt, value')
          | Noneerror
          end
      | Noneerror
      end.

    Axiom find : ctxt subkey key,
      Storage.Sc_rollup.Game_versioned
        .(Storage_sigs.Indexed_carbonated_data_storage.find)
       (Raw_context.to_t ctxt, key)
       subkey =
     return? (Raw_context.to_t ctxt,
     let× map := (Helpers.Map).(Map.S.find)
       key
      (Helpers.get ctxt) in
     let× value := (Helpers.Submap).(Map.S.find) subkey map in
     return× value).

    Axiom update : ctxt subkey key value i,
      Storage.Sc_rollup.Game_versioned
        .(Storage_sigs.Indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then

          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', i)
        else error
      | Noneerror
      end.

    Axiom init_value : ctxt subkey key value i,
      Storage.Sc_rollup.Game_versioned
        .(Storage_sigs.Indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then error
        else
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', i)
      | None
        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', i)
      end.

    Axiom add : ctxt key subkey value i,
      Storage.Sc_rollup.Game_versioned
        .(Storage_sigs.Indexed_carbonated_data_storage.add)
      (Raw_context.to_t ctxt, key) subkey value =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        let submap'' :=
          (Helpers.Submap).(Map.S.add) subkey value submap' in
        let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', i, mem)
      | None

        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', i, false)
      end.

    Axiom add_or_remove : ctxt key subkey value_opt i,
      Storage.Sc_rollup.Game_versioned
        .(Storage_sigs.Indexed_carbonated_data_storage.add_or_remove)
      (Raw_context.to_t ctxt, key) subkey value_opt =
      match value_opt with
      | Some value
        (* add the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', i, mem)
        | None

          let submap'' :=
            (Helpers.Submap).(Map.S.singleton) subkey value in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', i, false)
        end
      | None
        (* remove the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          return? (Helpers.set ctxt map', i, mem)
        | Nonereturn? (Raw_context.to_t ctxt, i, false)
        end
      end.

    Axiom remove_existing : ctxt key subkey i,
      Storage.Sc_rollup.Game_versioned
        .(Storage_sigs.Indexed_carbonated_data_storage.remove_existing)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          if (Helpers.Submap).(Map.S.mem) subkey submap'
          then
            let submap'' :=
              (Helpers.Submap).(Map.S.remove) subkey submap' in
            let map' := (Helpers.Map).(Map.S.add) key submap'' map in
            return? (Helpers.set ctxt map', i)
          else
            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context.Del)
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : ctxt key subkey i,
      Storage.Sc_rollup.Game_versioned
        .(Storage_sigs.Indexed_carbonated_data_storage.remove)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', i, mem)
      | Nonereturn? (Raw_context.to_t ctxt, i, false)
      end.

    Axiom list_key_values : ctxt key offset length,
      Storage.Sc_rollup.Game_versioned
        .(Storage_sigs.Indexed_carbonated_data_storage.list_key_values) offset length
           (Raw_context.to_t ctxt, key) =
      let map := (Helpers.Map).(Map.S.find) key (Helpers.get ctxt) in
      match map with
      | Some submap
        return? (Raw_context.to_t ctxt, (Helpers.Submap).(Map.S.bindings) submap)
      | Nonereturn? (Raw_context.to_t ctxt, [])
      end.

    #[global] Hint Rewrite mem get find init_value update add
      add_or_remove remove_existing remove list_key_values : storage_db.
    #[global] Opaque Storage.Sc_rollup.Game_versioned.
  End Game_versioned.

  Module Game.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Sc_rollup_Game).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Sc_rollup_Game := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition Map :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Sc_rollup_repr.Index).
      Arguments Map /.

      Definition Submap :=
        Storage_sigs.Indexed_map.Map
          (of_functors_index Raw_context.Sc_rollup_Game_versioned_and_timeout_Index).
      Arguments Submap /.

      Definition name := ["game"].
    End Helpers.

    Axiom mem : ctxt key subkey,
      Storage.Sc_rollup.Game
          .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
             .mem)

          (Raw_context.to_t ctxt, key) subkey =

      let map := (Helpers.Map).(Map.S.find)
        key (Helpers.get ctxt) in
      match map with

      | Some map

        return? (Raw_context.to_t ctxt,

          (Helpers.Submap).(Map.S.mem) subkey map)
      | Nonereturn? (Raw_context.to_t ctxt, false)
      end.

    Axiom get : ctxt subkey key,
      Storage.Sc_rollup.Game
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.get)
       (Raw_context.to_t ctxt, key)
       subkey =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Get) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
          let value := (Helpers.Submap).(Map.S.find) subkey submap' in
          match value with
          | Some value'return? (Raw_context.to_t ctxt, value')
          | Noneerror
          end
      | Noneerror
      end.

    Axiom find : ctxt subkey key,
      Storage.Sc_rollup.Game
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.find)
       (Raw_context.to_t ctxt, key)
       subkey =
     return? (Raw_context.to_t ctxt,
     let× map := (Helpers.Map).(Map.S.find)
       key
      (Helpers.get ctxt) in
     let× value := (Helpers.Submap).(Map.S.find) subkey map in
     return× value).

    Axiom update : ctxt subkey key value size,
      Storage.Sc_rollup.Game
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then

          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size)
        else error
      | Noneerror
      end.

    Axiom init_value : ctxt subkey key value size,
      Storage.Sc_rollup.Game
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then error
        else
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size)
      | None
        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size)
      end.

    Axiom add : ctxt key subkey value size,
      Storage.Sc_rollup.Game
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add)
      (Raw_context.to_t ctxt, key) subkey value =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
        let submap'' :=
          (Helpers.Submap).(Map.S.add) subkey value submap' in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size, mem)
      | None

        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size, false)
      end.

    Axiom add_or_remove : ctxt key subkey value_opt size,
      Storage.Sc_rollup.Game
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add_or_remove)
      (Raw_context.to_t ctxt, key) subkey value_opt =
      match value_opt with
      | Some value
        (* add the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
        | None

          let submap'' :=
            (Helpers.Submap).(Map.S.singleton) subkey value in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, false)
        end
      | None
        (* remove the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
        | None

            return? (Raw_context.to_t ctxt, size, false)
        end
      end.

    Axiom remove_existing : ctxt key subkey size,
      Storage.Sc_rollup.Game
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.remove_existing)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          if (Helpers.Submap).(Map.S.mem) subkey submap'
          then
            let submap'' :=
              (Helpers.Submap).(Map.S.remove) subkey submap' in
            let map' := (Helpers.Map).(Map.S.add) key submap'' map in
            return? (Helpers.set ctxt map', size)
          else
            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context.Del)
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : ctxt key subkey size,
      Storage.Sc_rollup.Game
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.remove)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
      | Nonereturn? (Raw_context.to_t ctxt, size, false)
      end.

    Axiom keys_unaccounted : ctxt key,
      Storage.Sc_rollup.Game
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.keys_unaccounted)
           (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'return? List.map fst ((Helpers.Submap).(Map.S.bindings)
          submap')
      | Nonereturn? []
      end.

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove keys_unaccounted

       : storage_db.
    #[global] Opaque Storage.Sc_rollup.Game.
  End Game.

  Module Game_timeout.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Sc_rollup_Game_timeout).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Sc_rollup_Game_timeout := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition Map :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Sc_rollup_repr.Index).
      Arguments Map /.

      Definition Submap :=
        Storage_sigs.Indexed_map.Map
          (of_functors_index Raw_context.Sc_rollup_Game_versioned_and_timeout_Index).
      Arguments Submap /.

      Definition name := ["game_timeout"].
    End Helpers.

    Axiom mem : ctxt key subkey,
      Storage.Sc_rollup.Game_timeout
          .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
             .mem)

          (Raw_context.to_t ctxt, key) subkey =

      let map := (Helpers.Map).(Map.S.find)
        key (Helpers.get ctxt) in
      match map with

      | Some map

        return? (Raw_context.to_t ctxt,

          (Helpers.Submap).(Map.S.mem) subkey map)
      | Nonereturn? (Raw_context.to_t ctxt, false)
      end.

    Axiom get : ctxt subkey key,
      Storage.Sc_rollup.Game_timeout
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.get)
       (Raw_context.to_t ctxt, key)
       subkey =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Get) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
          let value := (Helpers.Submap).(Map.S.find) subkey submap' in
          match value with
          | Some value'return? (Raw_context.to_t ctxt, value')
          | Noneerror
          end
      | Noneerror
      end.

    Axiom find : ctxt subkey key,
      Storage.Sc_rollup.Game_timeout
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.find)
       (Raw_context.to_t ctxt, key)
       subkey =
     return? (Raw_context.to_t ctxt,
     let× map := (Helpers.Map).(Map.S.find)
       key
      (Helpers.get ctxt) in
     let× value := (Helpers.Submap).(Map.S.find) subkey map in
     return× value).

    Axiom update : ctxt subkey key value size,
      Storage.Sc_rollup.Game_timeout
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then

          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size)
        else error
      | Noneerror
      end.

    Axiom init_value : ctxt subkey key value size,
      Storage.Sc_rollup.Game_timeout
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then error
        else
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size)
      | None
        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size)
      end.

    Axiom add : ctxt key subkey value size,
      Storage.Sc_rollup.Game_timeout
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add)
      (Raw_context.to_t ctxt, key) subkey value =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
        let submap'' :=
          (Helpers.Submap).(Map.S.add) subkey value submap' in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size, mem)
      | None

        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size, false)
      end.

    Axiom add_or_remove : ctxt key subkey value_opt size,
      Storage.Sc_rollup.Game_timeout
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add_or_remove)
      (Raw_context.to_t ctxt, key) subkey value_opt =
      match value_opt with
      | Some value
        (* add the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
        | None

          let submap'' :=
            (Helpers.Submap).(Map.S.singleton) subkey value in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, false)
        end
      | None
        (* remove the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
        | None

            return? (Raw_context.to_t ctxt, size, false)
        end
      end.

    Axiom remove_existing : ctxt key subkey size,
      Storage.Sc_rollup.Game_timeout
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.remove_existing)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          if (Helpers.Submap).(Map.S.mem) subkey submap'
          then
            let submap'' :=
              (Helpers.Submap).(Map.S.remove) subkey submap' in
            let map' := (Helpers.Map).(Map.S.add) key submap'' map in
            return? (Helpers.set ctxt map', size)
          else
            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context.Del)
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : ctxt key subkey size,
      Storage.Sc_rollup.Game_timeout
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.remove)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
      | Nonereturn? (Raw_context.to_t ctxt, size, false)
      end.

    Axiom keys_unaccounted : ctxt key,
      Storage.Sc_rollup.Game_timeout
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.keys_unaccounted)
           (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'return? List.map fst ((Helpers.Submap).(Map.S.bindings)
          submap')
      | Nonereturn? []
      end.

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove keys_unaccounted

       : storage_db.
    #[global] Opaque Storage.Sc_rollup.Game_timeout.
  End Game_timeout.

  Module Opponent.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Sc_rollup_Opponent).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Sc_rollup_Opponent := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition Map :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Sc_rollup_repr.Index).
      Arguments Map /.

      Definition Submap :=
        Storage_sigs.Indexed_map.Map
          (of_functors_index Storage.Public_key_hash_index).
      Arguments Submap /.

      Definition name := ["opponent"].
    End Helpers.

    Axiom mem : ctxt key subkey,
      Storage.Sc_rollup.Opponent
          .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
             .mem)

          (Raw_context.to_t ctxt, key) subkey =

      let map := (Helpers.Map).(Map.S.find)
        key (Helpers.get ctxt) in
      match map with

      | Some map

        return? (Raw_context.to_t ctxt,

          (Helpers.Submap).(Map.S.mem) subkey map)
      | Nonereturn? (Raw_context.to_t ctxt, false)
      end.

    Axiom get : ctxt subkey key,
      Storage.Sc_rollup.Opponent
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.get)
       (Raw_context.to_t ctxt, key)
       subkey =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Get) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
          let value := (Helpers.Submap).(Map.S.find) subkey submap' in
          match value with
          | Some value'return? (Raw_context.to_t ctxt, value')
          | Noneerror
          end
      | Noneerror
      end.

    Axiom find : ctxt subkey key,
      Storage.Sc_rollup.Opponent
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.find)
       (Raw_context.to_t ctxt, key)
       subkey =
     return? (Raw_context.to_t ctxt,
     let× map := (Helpers.Map).(Map.S.find)
       key
      (Helpers.get ctxt) in
     let× value := (Helpers.Submap).(Map.S.find) subkey map in
     return× value).

    Axiom update : ctxt subkey key value size,
      Storage.Sc_rollup.Opponent
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then

          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size)
        else error
      | Noneerror
      end.

    Axiom init_value : ctxt subkey key value size,
      Storage.Sc_rollup.Opponent
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then error
        else
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size)
      | None
        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size)
      end.

    Axiom add : ctxt key subkey value size,
      Storage.Sc_rollup.Opponent
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add)
      (Raw_context.to_t ctxt, key) subkey value =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
        let submap'' :=
          (Helpers.Submap).(Map.S.add) subkey value submap' in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size, mem)
      | None

        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size, false)
      end.

    Axiom add_or_remove : ctxt key subkey value_opt size,
      Storage.Sc_rollup.Opponent
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add_or_remove)
      (Raw_context.to_t ctxt, key) subkey value_opt =
      match value_opt with
      | Some value
        (* add the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
        | None

          let submap'' :=
            (Helpers.Submap).(Map.S.singleton) subkey value in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, false)
        end
      | None
        (* remove the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
        | None

            return? (Raw_context.to_t ctxt, size, false)
        end
      end.

    Axiom remove_existing : ctxt key subkey size,
      Storage.Sc_rollup.Opponent
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.remove_existing)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          if (Helpers.Submap).(Map.S.mem) subkey submap'
          then
            let submap'' :=
              (Helpers.Submap).(Map.S.remove) subkey submap' in
            let map' := (Helpers.Map).(Map.S.add) key submap'' map in
            return? (Helpers.set ctxt map', size)
          else
            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context.Del)
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : ctxt key subkey size,
      Storage.Sc_rollup.Opponent
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.remove)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
      | Nonereturn? (Raw_context.to_t ctxt, size, false)
      end.

    Axiom keys_unaccounted : ctxt key,
      Storage.Sc_rollup.Opponent
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.keys_unaccounted)
           (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'return? List.map fst ((Helpers.Submap).(Map.S.bindings)
          submap')
      | Nonereturn? []
      end.

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove keys_unaccounted

       : storage_db.
    #[global] Opaque Storage.Sc_rollup.Opponent.
  End Opponent.

  Module Applied_outbox_messages.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Sc_rollup_Applied_outbox_messages).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Sc_rollup_Applied_outbox_messages := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition Map :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Sc_rollup_repr.Index).
      Arguments Map /.

      Definition Submap :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Storage.Sc_rollup.Level_index).
      Arguments Submap /.

      Definition name := ["applied_outbox_messages"].
    End Helpers.

    Axiom mem : ctxt key subkey,
      Storage.Sc_rollup.Applied_outbox_messages
          .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
             .mem)

          (Raw_context.to_t ctxt, key) subkey =

      let map := (Helpers.Map).(Map.S.find)
        key (Helpers.get ctxt) in
      match map with

      | Some map

        return? (Raw_context.to_t ctxt,

          (Helpers.Submap).(Map.S.mem) subkey map)
      | Nonereturn? (Raw_context.to_t ctxt, false)
      end.

    Axiom get : ctxt subkey key,
      Storage.Sc_rollup.Applied_outbox_messages
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.get)
       (Raw_context.to_t ctxt, key)
       subkey =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Get) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
          let value := (Helpers.Submap).(Map.S.find) subkey submap' in
          match value with
          | Some value'return? (Raw_context.to_t ctxt, value')
          | Noneerror
          end
      | Noneerror
      end.

    Axiom find : ctxt subkey key,
      Storage.Sc_rollup.Applied_outbox_messages
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.find)
       (Raw_context.to_t ctxt, key)
       subkey =
     return? (Raw_context.to_t ctxt,
     let× map := (Helpers.Map).(Map.S.find)
       key
      (Helpers.get ctxt) in
     let× value := (Helpers.Submap).(Map.S.find) subkey map in
     return× value).

    Axiom update : ctxt subkey key value size,
      Storage.Sc_rollup.Applied_outbox_messages
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then

          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size)
        else error
      | Noneerror
      end.

    Axiom init_value : ctxt subkey key value size,
      Storage.Sc_rollup.Applied_outbox_messages
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then error
        else
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size)
      | None
        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size)
      end.

    Axiom add : ctxt key subkey value size,
      Storage.Sc_rollup.Applied_outbox_messages
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add)
      (Raw_context.to_t ctxt, key) subkey value =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
        let submap'' :=
          (Helpers.Submap).(Map.S.add) subkey value submap' in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size, mem)
      | None

        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size, false)
      end.

    Axiom add_or_remove : ctxt key subkey value_opt size,
      Storage.Sc_rollup.Applied_outbox_messages
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add_or_remove)
      (Raw_context.to_t ctxt, key) subkey value_opt =
      match value_opt with
      | Some value
        (* add the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
        | None

          let submap'' :=
            (Helpers.Submap).(Map.S.singleton) subkey value in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, false)
        end
      | None
        (* remove the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
        | None

            return? (Raw_context.to_t ctxt, size, false)
        end
      end.

    Axiom remove_existing : ctxt key subkey size,
      Storage.Sc_rollup.Applied_outbox_messages
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.remove_existing)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          if (Helpers.Submap).(Map.S.mem) subkey submap'
          then
            let submap'' :=
              (Helpers.Submap).(Map.S.remove) subkey submap' in
            let map' := (Helpers.Map).(Map.S.add) key submap'' map in
            return? (Helpers.set ctxt map', size)
          else
            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context.Del)
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : ctxt key subkey size,
      Storage.Sc_rollup.Applied_outbox_messages
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.remove)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
      | Nonereturn? (Raw_context.to_t ctxt, size, false)
      end.

    Axiom keys_unaccounted : ctxt key,
      Storage.Sc_rollup.Applied_outbox_messages
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.keys_unaccounted)
           (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'return? List.map fst ((Helpers.Submap).(Map.S.bindings)
          submap')
      | Nonereturn? []
      end.

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove keys_unaccounted

       : storage_db.
    #[global] Opaque Storage.Sc_rollup.Applied_outbox_messages.
  End Applied_outbox_messages.
End Sc_rollup.

Module Dal.
  Module Slot.
    Module Headers.
      Module Helpers.
        Definition get (ctxt : Raw_context.t) :=
          ctxt
            .(Raw_context.Dal_Slot_Headers).
        Arguments get _ /.

        Definition set (ctxt : Raw_context.t) value :=
          let ctxt' := ctxt <| Raw_context.Dal_Slot_Headers := value |> in
          (Raw_context.to_t ctxt').
        Arguments set _ _ /.

        Definition S :=
          Storage_sigs.Indexed_map.Map
            (of_description_index Raw_level_repr.Index).
        Arguments S /.

        Definition name := ["slot_headers"].
      End Helpers.

      Axiom mem : (ctxt : Raw_context.t) k,
        Storage.Dal.Slot.Headers
          .(Storage_sigs.Non_iterable_indexed_data_storage.mem)
          (Raw_context.to_t ctxt) k =
        (Helpers.S).(Map.S.mem) k
          (Helpers.get ctxt).

      Axiom get : (ctxt : Raw_context.t) k,
        Storage.Dal.Slot.Headers
          .(Storage_sigs.Non_iterable_indexed_data_storage.get)
          (Raw_context.to_t ctxt) k =
        let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
        match x with
        | Some vPervasives.Ok v
        | None

            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context.Get)
        end.

      Axiom find : (ctxt : Raw_context.t) k,
        Storage.Dal.Slot.Headers
          .(Storage_sigs.Non_iterable_indexed_data_storage.find)
          (Raw_context.to_t ctxt) k =
        let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
        match x with
        | Some vreturn? (Some v)
        | Nonereturn? None
        end.

      Axiom update : (ctxt : Raw_context.t) k v,
        Storage.Dal.Slot.Headers
          .(Storage_sigs.Non_iterable_indexed_data_storage.update)
          (Raw_context.to_t ctxt) k v =
        if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
        then

          return? Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
            (Helpers.get ctxt))
        else Raw_context.storage_error_value
          (Raw_context.Missing_key Helpers.name Raw_context._Set).

      Axiom init_value : (ctxt : Raw_context.t) k v,
        Storage.Dal.Slot.Headers
          .(Storage_sigs.Non_iterable_indexed_data_storage.init_value)
          (Raw_context.to_t ctxt) k v =
        if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
        then Raw_context.storage_error_value
          (Raw_context.Missing_key Helpers.name Raw_context._Set)
        else return? Helpers.set ctxt ((Helpers.S).(Map.S.add)
          k v (Helpers.get ctxt)).

      Axiom add : (ctxt : Raw_context.t) k v,
        Storage.Dal.Slot.Headers
          .(Storage_sigs.Non_iterable_indexed_data_storage.add)
          (Raw_context.to_t ctxt) k v =
        Helpers.set ctxt ((Helpers.S).(Map.S.add) k v

          (Helpers.get ctxt)).

      Axiom add_or_remove : (ctxt : Raw_context.t) k v,
        Storage.Dal.Slot.Headers
          .(Storage_sigs.Non_iterable_indexed_data_storage.add_or_remove)
          (Raw_context.to_t ctxt) k v =
        match v with
        | Some v'

            Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
              (Helpers.get ctxt))
        | None

            Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
              (Helpers.get ctxt))
        end.

      Axiom remove_existing : (ctxt : Raw_context.t) k,
        Storage.Dal.Slot.Headers
          .(Storage_sigs.Non_iterable_indexed_data_storage.remove_existing)
          (Raw_context.to_t ctxt) k =
        if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
        then return? Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
          (Helpers.get ctxt))
        else Raw_context.storage_error_value
          (Raw_context.Missing_key Helpers.name Raw_context.Del).

      Axiom remove : (ctxt : Raw_context.t) k,
        Storage.Dal.Slot.Headers
          .(Storage_sigs.Non_iterable_indexed_data_storage.remove)
          (Raw_context.to_t ctxt) k =
        Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
          (Helpers.get ctxt)).

      #[global] Hint Rewrite mem get find update init_value add
         add_or_remove remove_existing remove : storage_db.
      #[global] Opaque Storage.Dal.Slot.Headers.
    End Headers.

    Module History.
      Module Helpers.
        Definition get (ctxt : Raw_context.t) :=
          ctxt
            .(Raw_context.Dal_Slot_History).
        Arguments get _ /.

        Definition set (ctxt : Raw_context.t) value :=
          let ctxt' := ctxt <| Raw_context.Dal_Slot_History := value |> in
          (Raw_context.to_t ctxt').
        Arguments set _ _ /.

        Definition name := ["slot_headers_history"].
      End Helpers.

      Axiom mem : (ctxt : Raw_context.t),
        Storage.Dal.Slot.History
          .(Storage_sigs.Single_data_storage.mem)
          (Raw_context.to_t ctxt) =
         match Helpers.get ctxt with
          | Some _true
          | Nonefalse

          end.

      Axiom get : (ctxt : Raw_context.t),
        Storage.Dal.Slot.History
          .(Storage_sigs.Single_data_storage.get)
          (Raw_context.to_t ctxt) =
        match Helpers.get ctxt with
        | Some xPervasives.Ok x
        | None

            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context.Get)
        end.

      Axiom find : (ctxt : Raw_context.t),
        Storage.Dal.Slot.History
          .(Storage_sigs.Single_data_storage.find)
          (Raw_context.to_t ctxt) =
        return? Helpers.get ctxt.

      Axiom init_value : (ctxt : Raw_context.t) value,
        Storage.Dal.Slot.History
          .(Storage_sigs.Single_data_storage.init_value)
          (Raw_context.to_t ctxt) value =
        match Helpers.get ctxt with
        | None
            return? Helpers.set ctxt (Some value)
        | Some _

            Raw_context.storage_error_value
              (Raw_context.Existing_key Helpers.name)
        end.

      Axiom update : (ctxt : Raw_context.t) value,
        Storage.Dal.Slot.History
          .(Storage_sigs.Single_data_storage.update)
          (Raw_context.to_t ctxt) value =
        match Helpers.get ctxt with
        | Some _return? Helpers.set ctxt (Some value)
        | None

            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context._Set)
        end.

      Axiom add : (ctxt : Raw_context.t) value,
        Storage.Dal.Slot.History
          .(Storage_sigs.Single_data_storage.add)
          (Raw_context.to_t ctxt) value =
        match Helpers.get ctxt with
        | Some _Helpers.set ctxt (Some value)
        | None ⇒ (Raw_context.to_t ctxt)
        end.

      Axiom add_or_remove : (ctxt : Raw_context.t) value,
        Storage.Dal.Slot.History
          .(Storage_sigs.Single_data_storage.add_or_remove)
          (Raw_context.to_t ctxt) value =
          Helpers.set ctxt value.

      Axiom remove_existing : (ctxt : Raw_context.t),
        Storage.Dal.Slot.History
          .(Storage_sigs.Single_data_storage.remove_existing)
          (Raw_context.to_t ctxt) =
        match Helpers.get ctxt with
        | Some _return? Helpers.set ctxt None
        | None
            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context.Del)
        end.

      Axiom remove : (ctxt : Raw_context.t),
        Storage.Dal.Slot.History
          .(Storage_sigs.Single_data_storage.remove)
          (Raw_context.to_t ctxt) =
        match Helpers.get ctxt with
        | Some _Helpers.set ctxt None
        | NoneRaw_context.to_t ctxt
        end.

      #[global] Hint Rewrite mem get find init_value update add
        add_or_remove remove_existing remove : storage_db.
      #[global] Opaque Storage.Dal.Slot.History.
    End History.
  End Slot.
End Dal.

Module Zk_rollup.
  Module Account.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Zk_rollup_Account).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Zk_rollup_Account := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Zk_rollup_repr.Index).
      Arguments S /.

      Definition name := ["account"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Zk_rollup.Account
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.mem)
        (Raw_context.to_t ctxt) k =
      return? (Raw_context.to_t ctxt, (Helpers.S).(Map.S.mem) k
         (Helpers.get ctxt)).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Zk_rollup.Account
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok (Raw_context.to_t ctxt, v)
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Zk_rollup.Account
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Raw_context.to_t ctxt, (Some v))
      | Nonereturn? (Raw_context.to_t ctxt, None)
      end.

    Axiom update : (ctxt : Raw_context.t) k v size,
      Storage.Zk_rollup.Account
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then

        let ctxt := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt)) in
        return? (ctxt, size)
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v size,
      Storage.Zk_rollup.Account
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? (Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)), size).

    Axiom add : (ctxt : Raw_context.t) k v size,
      Storage.Zk_rollup.Account
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add)
        (Raw_context.to_t ctxt) k v =
     let storage := (Helpers.get ctxt) in
     let bound := (Helpers.S).(Map.S.mem) k storage in
     let storage' := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v storage) in
       return? (storage', size, bound).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v size,
      Storage.Zk_rollup.Account
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      let storage := Helpers.get ctxt in
      let mem := (Helpers.S).(Map.S.mem) k storage in
      match v with
      | Some v'
          let ctxt' := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            storage) in
          return? (ctxt', size, mem)
      | None

          let ctxt' := Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            storage) in
          return? (ctxt', size, mem)
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k size,
      Storage.Zk_rollup.Account
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? (Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)), size)
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k size,
      Storage.Zk_rollup.Account
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .remove)
        (Raw_context.to_t ctxt) k =
      let storage := Helpers.get ctxt in
      let mem := (Helpers.S).(Map.S.mem) k storage in
      return? (Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        storage), size, mem).

    Axiom keys_unaccounted : (ctxt : Raw_context.t),
      Storage.Zk_rollup.Account
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .keys_unaccounted)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove keys_unaccounted

       : storage_db.
    #[global] Opaque Storage.Zk_rollup.Account.
  End Account.

  Module Pending_list.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Zk_rollup_Pending_list).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Zk_rollup_Pending_list := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition S :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Zk_rollup_repr.Index).
      Arguments S /.

      Definition name := ["pending_list"].
    End Helpers.

    Axiom mem : (ctxt : Raw_context.t) k,
      Storage.Zk_rollup.Pending_list
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.mem)
        (Raw_context.to_t ctxt) k =
      return? (Raw_context.to_t ctxt, (Helpers.S).(Map.S.mem) k
         (Helpers.get ctxt)).

    Axiom get : (ctxt : Raw_context.t) k,
      Storage.Zk_rollup.Pending_list
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.get)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vPervasives.Ok (Raw_context.to_t ctxt, v)
      | None

          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Get)
      end.

    Axiom find : (ctxt : Raw_context.t) k,
      Storage.Zk_rollup.Pending_list
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.find)
        (Raw_context.to_t ctxt) k =
      let x := (Helpers.S).(Map.S.find) k (Helpers.get ctxt) in
      match x with
      | Some vreturn? (Raw_context.to_t ctxt, (Some v))
      | Nonereturn? (Raw_context.to_t ctxt, None)
      end.

    Axiom update : (ctxt : Raw_context.t) k v size,
      Storage.Zk_rollup.Pending_list
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then

        let ctxt := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v
          (Helpers.get ctxt)) in
        return? (ctxt, size)
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set).

    Axiom init_value : (ctxt : Raw_context.t) k v size,
      Storage.Zk_rollup.Pending_list
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.init_value)
        (Raw_context.to_t ctxt) k v =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set)
      else return? (Helpers.set ctxt ((Helpers.S).(Map.S.add)
        k v (Helpers.get ctxt)), size).

    Axiom add : (ctxt : Raw_context.t) k v size,
      Storage.Zk_rollup.Pending_list
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add)
        (Raw_context.to_t ctxt) k v =
     let storage := (Helpers.get ctxt) in
     let bound := (Helpers.S).(Map.S.mem) k storage in
     let storage' := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v storage) in
       return? (storage', size, bound).

    Axiom add_or_remove : (ctxt : Raw_context.t) k v size,
      Storage.Zk_rollup.Pending_list
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add_or_remove)
        (Raw_context.to_t ctxt) k v =
      let storage := Helpers.get ctxt in
      let mem := (Helpers.S).(Map.S.mem) k storage in
      match v with
      | Some v'
          let ctxt' := Helpers.set ctxt ((Helpers.S).(Map.S.add) k v'
            storage) in
          return? (ctxt', size, mem)
      | None

          let ctxt' := Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
            storage) in
          return? (ctxt', size, mem)
      end.

    Axiom remove_existing : (ctxt : Raw_context.t) k size,
      Storage.Zk_rollup.Pending_list
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .remove_existing)
        (Raw_context.to_t ctxt) k =
      if (Helpers.S).(Map.S.mem) k (Helpers.get ctxt)
      then return? (Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        (Helpers.get ctxt)), size)
      else Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Del).

    Axiom remove : (ctxt : Raw_context.t) k size,
      Storage.Zk_rollup.Pending_list
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .remove)
        (Raw_context.to_t ctxt) k =
      let storage := Helpers.get ctxt in
      let mem := (Helpers.S).(Map.S.mem) k storage in
      return? (Helpers.set ctxt ((Helpers.S).(Map.S.remove) k
        storage), size, mem).

    Axiom keys_unaccounted : (ctxt : Raw_context.t),
      Storage.Zk_rollup.Pending_list
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
           .keys_unaccounted)
        (Raw_context.to_t ctxt) =
      return? List.map fst ((Helpers.S).(Map.S.bindings) (Helpers.get ctxt)).

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove keys_unaccounted

       : storage_db.
    #[global] Opaque Storage.Zk_rollup.Pending_list.
  End Pending_list.

  Module Pending_operation.
    Module Helpers.
      Definition get (ctxt : Raw_context.t) :=
        ctxt
          .(Raw_context.Zk_rollup_Pending_operation).
      Arguments get _ /.

      Definition set (ctxt : Raw_context.t) value :=
        let ctxt' := ctxt <| Raw_context.Zk_rollup_Pending_operation := value |> in
        (Raw_context.to_t ctxt').
      Arguments set _ _ /.

      Definition Map :=
        Storage_sigs.Indexed_map.Map
          (of_description_index Zk_rollup_repr.Index).
      Arguments Map /.

      Definition Submap :=
        Storage_sigs.Indexed_map.Map
          (of_functors_index Raw_context.Zk_rollup_Pending_operation_Index).
      Arguments Submap /.

      Definition name := ["pending_operations"].
    End Helpers.

    Axiom mem : ctxt key subkey,
      Storage.Zk_rollup.Pending_operation
          .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage
             .mem)

          (Raw_context.to_t ctxt, key) subkey =

      let map := (Helpers.Map).(Map.S.find)
        key (Helpers.get ctxt) in
      match map with

      | Some map

        return? (Raw_context.to_t ctxt,

          (Helpers.Submap).(Map.S.mem) subkey map)
      | Nonereturn? (Raw_context.to_t ctxt, false)
      end.

    Axiom get : ctxt subkey key,
      Storage.Zk_rollup.Pending_operation
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.get)
       (Raw_context.to_t ctxt, key)
       subkey =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context.Get) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
          let value := (Helpers.Submap).(Map.S.find) subkey submap' in
          match value with
          | Some value'return? (Raw_context.to_t ctxt, value')
          | Noneerror
          end
      | Noneerror
      end.

    Axiom find : ctxt subkey key,
      Storage.Zk_rollup.Pending_operation
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.find)
       (Raw_context.to_t ctxt, key)
       subkey =
     return? (Raw_context.to_t ctxt,
     let× map := (Helpers.Map).(Map.S.find)
       key
      (Helpers.get ctxt) in
     let× value := (Helpers.Submap).(Map.S.find) subkey map in
     return× value).

    Axiom update : ctxt subkey key value size,
      Storage.Zk_rollup.Pending_operation
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then

          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size)
        else error
      | Noneerror
      end.

    Axiom init_value : ctxt subkey key value size,
      Storage.Zk_rollup.Pending_operation
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.update)
       (Raw_context.to_t ctxt, key) subkey value =
      let error := Raw_context.storage_error_value
        (Raw_context.Missing_key Helpers.name Raw_context._Set) in
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        if (Helpers.Submap).(Map.S.mem) subkey submap'
        then error
        else
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size)
      | None
        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size)
      end.

    Axiom add : ctxt key subkey value size,
      Storage.Zk_rollup.Pending_operation
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add)
      (Raw_context.to_t ctxt, key) subkey value =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'
        let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
        let submap'' :=
          (Helpers.Submap).(Map.S.add) subkey value submap' in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size, mem)
      | None

        let submap'' :=
          (Helpers.Submap).(Map.S.singleton) subkey value in
        let map' := (Helpers.Map).(Map.S.add) key submap'' map in
        return? (Helpers.set ctxt map', size, false)
      end.

    Axiom add_or_remove : ctxt key subkey value_opt size,
      Storage.Zk_rollup.Pending_operation
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.add_or_remove)
      (Raw_context.to_t ctxt, key) subkey value_opt =
      match value_opt with
      | Some value
        (* add the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.add) subkey value submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
        | None

          let submap'' :=
            (Helpers.Submap).(Map.S.singleton) subkey value in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, false)
        end
      | None
        (* remove the value *)
        let map := (Helpers.get ctxt) in
        let submap := (Helpers.Map).(Map.S.find) key map in
        match submap with
        | Some submap'
          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
        | None

            return? (Raw_context.to_t ctxt, size, false)
        end
      end.

    Axiom remove_existing : ctxt key subkey size,
      Storage.Zk_rollup.Pending_operation
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.remove_existing)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          if (Helpers.Submap).(Map.S.mem) subkey submap'
          then
            let submap'' :=
              (Helpers.Submap).(Map.S.remove) subkey submap' in
            let map' := (Helpers.Map).(Map.S.add) key submap'' map in
            return? (Helpers.set ctxt map', size)
          else
            Raw_context.storage_error_value
              (Raw_context.Missing_key Helpers.name Raw_context.Del)
      | None
          Raw_context.storage_error_value
            (Raw_context.Missing_key Helpers.name Raw_context.Del)
      end.

    Axiom remove : ctxt key subkey size,
      Storage.Zk_rollup.Pending_operation
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.remove)
      (Raw_context.to_t ctxt, key) subkey =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with

      | Some submap'

          let mem := (Helpers.Submap).(Map.S.mem) subkey submap' in
          let submap'' :=
            (Helpers.Submap).(Map.S.remove) subkey submap' in
          let map' := (Helpers.Map).(Map.S.add) key submap'' map in
          return? (Helpers.set ctxt map', size, mem)
      | Nonereturn? (Raw_context.to_t ctxt, size, false)
      end.

    Axiom keys_unaccounted : ctxt key,
      Storage.Zk_rollup.Pending_operation
        .(Storage_sigs.Non_iterable_indexed_carbonated_data_storage.keys_unaccounted)
           (Raw_context.to_t ctxt, key) =
      let map := (Helpers.get ctxt) in
      let submap := (Helpers.Map).(Map.S.find) key map in
      match submap with
      | Some submap'return? List.map fst ((Helpers.Submap).(Map.S.bindings)
          submap')
      | Nonereturn? []
      end.

    #[global] Hint Rewrite mem get find update init_value add
       add_or_remove remove_existing remove keys_unaccounted

       : storage_db.
    #[global] Opaque Storage.Zk_rollup.Pending_operation.
  End Pending_operation.
End Zk_rollup.