sig
  type arity = Usual | Unary | Unary_refinement
  type direction = Direct | Op
  module RuleModeIdSet :
    sig
      type elt = int * arity * direction
      type t
      val empty : t
      val is_empty : t -> bool
      val singleton : elt -> t
      val is_singleton : t -> bool
      val add : elt -> t -> t
      val add_with_logs :
        ('parameters, 'error, elt -> t -> 'error * t) SetMap.with_log_wrap
      val remove : elt -> t -> t
      val add_while_testing_freshness :
        ('parameters, 'error, elt -> t -> 'error * bool * t)
        SetMap.with_log_wrap
      val remove_while_testing_existence :
        ('parameters, 'error, elt -> t -> 'error * bool * t)
        SetMap.with_log_wrap
      val remove_with_logs :
        ('parameters, 'error, elt -> t -> 'error * t) SetMap.with_log_wrap
      val split : elt -> t -> t * bool * t
      val union : t -> t -> t
      val disjoint_union : t -> t -> t option
      val inter : t -> t -> t
      val minus : t -> t -> t
      val diff : t -> t -> t
      val minus_with_logs :
        ('parameters, 'error, t -> t -> 'error * t) SetMap.with_log_wrap
      val union_with_logs :
        ('parameters, 'error, t -> t -> 'error * t) SetMap.with_log_wrap
      val disjoint_union_with_logs :
        ('parameters, 'error, t -> t -> 'error * t) SetMap.with_log_wrap
      val inter_with_logs :
        ('parameters, 'error, t -> t -> 'error * t) SetMap.with_log_wrap
      val diff_with_logs :
        ('parameters, 'error, t -> t -> 'error * t) SetMap.with_log_wrap
      val size : t -> int
      val mem : elt -> t -> bool
      val exists : (elt -> bool) -> t -> bool
      val filter : (elt -> bool) -> t -> t
      val filter_with_logs :
        ('parameters, 'error, (elt -> bool) -> t -> 'error * t)
        SetMap.with_log_wrap
      val for_all : (elt -> bool) -> t -> bool
      val partition : (elt -> bool) -> t -> t * t
      val partition_with_logs :
        ('parameters, 'error, (elt -> bool) -> t -> 'error * t * t)
        SetMap.with_log_wrap
      val compare : t -> t -> int
      val equal : t -> t -> bool
      val subset : t -> t -> bool
      val iter : (elt -> unit) -> t -> unit
      val fold : (elt -> '-> 'a) -> t -> '-> 'a
      val fold_inv : (elt -> '-> 'a) -> t -> '-> 'a
      val elements : t -> elt list
      val print : Format.formatter -> t -> unit
      val choose : t -> elt option
      val random : Random.State.t -> t -> elt option
      val min_elt : t -> elt option
      val max_elt : t -> elt option
    end
  module RuleModeMap :
    sig
      type elt = arity * direction
      type set
      type +'a t
      val empty : 'a t
      val is_empty : 'a t -> bool
      val size : 'a t -> int
      val root : 'a t -> (elt * 'a) option
      val max_key : 'a t -> elt option
      val add : elt -> '-> 'a t -> 'a t
      val remove : elt -> 'a t -> 'a t
      val add_while_testing_freshness :
        ('parameters, 'error, elt -> '-> 'a t -> 'error * bool * 'a t)
        SetMap.with_log_wrap
      val remove_while_testing_existence :
        ('parameters, 'error, elt -> 'a t -> 'error * bool * 'a t)
        SetMap.with_log_wrap
      val pop : elt -> 'a t -> 'a option * 'a t
      val merge : 'a t -> 'a t -> 'a t
      val min_elt : 'a t -> (elt * 'a) option
      val find_option : elt -> 'a t -> 'a option
      val find_default : '-> elt -> 'a t -> 'a
      val find_option_with_logs :
        ('parameters, 'error, elt -> 'a t -> 'error * 'a option)
        SetMap.with_log_wrap
      val find_default_with_logs :
        ('parameters, 'error, '-> elt -> 'a t -> 'error * 'a)
        SetMap.with_log_wrap
      val mem : elt -> 'a t -> bool
      val diff : 'a t -> 'a t -> 'a t * 'a t
      val union : 'a t -> 'a t -> 'a t
      val update : 'a t -> 'a t -> 'a t
      val diff_pred : ('-> '-> bool) -> 'a t -> 'a t -> 'a t * 'a t
      val add_with_logs :
        ('parameters, 'error, elt -> '-> 'a t -> 'error * 'a t)
        SetMap.with_log_wrap
      val remove_with_logs :
        ('parameters, 'error, elt -> 'a t -> 'error * 'a t)
        SetMap.with_log_wrap
      val join_with_logs :
        ('parameters, 'error, 'a t -> elt -> '-> 'a t -> 'error * 'a t)
        SetMap.with_log_wrap
      val split_with_logs :
        ('parameters, 'error,
         elt -> 'a t -> 'error * ('a t * 'a option * 'a t))
        SetMap.with_log_wrap
      val update_with_logs :
        ('parameters, 'error, 'a t -> 'a t -> 'error * 'a t)
        SetMap.with_log_wrap
      val map2_with_logs :
        ('parameters, 'error,
         ('parameters -> 'error -> '-> 'error * 'c) ->
         ('parameters -> 'error -> '-> 'error * 'c) ->
         ('parameters -> 'error -> '-> '-> 'error * 'c) ->
         'a t -> 'b t -> 'error * 'c t)
        SetMap.with_log_wrap
      val map2z_with_logs :
        ('parameters, 'error,
         ('parameters -> 'error -> '-> '-> 'error * 'a) ->
         'a t -> 'a t -> 'error * 'a t)
        SetMap.with_log_wrap
      val fold2z_with_logs :
        ('parameters, 'error,
         ('parameters -> 'error -> elt -> '-> '-> '-> 'error * 'c) ->
         'a t -> 'b t -> '-> 'error * 'c)
        SetMap.with_log_wrap
      val fold2_with_logs :
        ('parameters, 'error,
         ('parameters -> 'error -> elt -> '-> '-> 'error * 'c) ->
         ('parameters -> 'error -> elt -> '-> '-> 'error * 'c) ->
         ('parameters -> 'error -> elt -> '-> '-> '-> 'error * 'c) ->
         'a t -> 'b t -> '-> 'error * 'c)
        SetMap.with_log_wrap
      val fold2_sparse_with_logs :
        ('parameters, 'error,
         ('parameters -> 'error -> elt -> '-> '-> '-> 'error * 'c) ->
         'a t -> 'b t -> '-> 'error * 'c)
        SetMap.with_log_wrap
      val iter2_sparse_with_logs :
        ('parameters, 'error,
         ('parameters -> 'error -> elt -> '-> '-> 'error) ->
         'a t -> 'b t -> 'error)
        SetMap.with_log_wrap
      val diff_with_logs :
        ('parameters, 'error, 'a t -> 'a t -> 'error * 'a t * 'a t)
        SetMap.with_log_wrap
      val diff_pred_with_logs :
        ('parameters, 'error,
         ('-> '-> bool) -> 'a t -> 'a t -> 'error * 'a t * 'a t)
        SetMap.with_log_wrap
      val merge_with_logs :
        ('parameters, 'error, 'a t -> 'a t -> 'error * 'a t)
        SetMap.with_log_wrap
      val union_with_logs :
        ('parameters, 'error, 'a t -> 'a t -> 'error * 'a t)
        SetMap.with_log_wrap
      val fold_restriction_with_logs :
        ('parameters, 'error,
         (elt -> '-> 'error * '-> 'error * 'b) ->
         set -> 'a t -> '-> 'error * 'b)
        SetMap.with_log_wrap
      val fold_restriction_with_missing_associations_with_logs :
        ('parameters, 'error,
         (elt -> '-> 'error * '-> 'error * 'b) ->
         (elt -> 'error * '-> 'error * 'b) ->
         set -> 'a t -> '-> 'error * 'b)
        SetMap.with_log_wrap
      val iter : (elt -> '-> unit) -> 'a t -> unit
      val fold : (elt -> '-> '-> 'b) -> 'a t -> '-> 'b
      val fold_with_interruption :
        (elt -> '-> '-> ('b, 'c) Stop.stop) ->
        'a t -> '-> ('b, 'c) Stop.stop
      val monadic_fold2 :
        'parameters ->
        'method_handler ->
        ('parameters ->
         'method_handler -> elt -> '-> '-> '-> 'method_handler * 'c) ->
        ('parameters ->
         'method_handler -> elt -> '-> '-> 'method_handler * 'c) ->
        ('parameters ->
         'method_handler -> elt -> '-> '-> 'method_handler * 'c) ->
        'a t -> 'b t -> '-> 'method_handler * 'c
      val monadic_fold2_sparse :
        'parameters ->
        'method_handler ->
        ('parameters ->
         'method_handler -> elt -> '-> '-> '-> 'method_handler * 'c) ->
        'a t -> 'b t -> '-> 'method_handler * 'c
      val monadic_iter2_sparse :
        'parameters ->
        'method_handler ->
        ('parameters -> 'method_handler -> elt -> '-> '-> 'method_handler) ->
        'a t -> 'b t -> 'method_handler
      val monadic_fold_restriction :
        'parameters ->
        'method_handler ->
        ('parameters ->
         'method_handler -> elt -> '-> '-> 'method_handler * 'b) ->
        set -> 'a t -> '-> 'method_handler * 'b
      val mapi : (elt -> '-> 'b) -> 'a t -> 'b t
      val map : ('-> 'b) -> 'a t -> 'b t
      val map2 : ('-> '-> 'a) -> 'a t -> 'a t -> 'a t
      val for_all : (elt -> '-> bool) -> 'a t -> bool
      val filter_one : (elt -> '-> bool) -> 'a t -> (elt * 'a) option
      val compare : ('-> '-> int) -> 'a t -> 'a t -> int
      val equal : ('-> '-> bool) -> 'a t -> 'a t -> bool
      val bindings : 'a t -> (elt * 'a) list
      val print :
        (Format.formatter -> '-> unit) -> Format.formatter -> 'a t -> unit
      val of_json :
        ?lab_key:string ->
        ?lab_value:string ->
        ?error_msg:string ->
        (Yojson.Basic.json -> elt) ->
        (Yojson.Basic.json -> 'value) -> Yojson.Basic.json -> 'value t
      val to_json :
        ?lab_key:string ->
        ?lab_value:string ->
        (elt -> Yojson.Basic.json) ->
        ('value -> Yojson.Basic.json) -> 'value t -> Yojson.Basic.json
    end
  val sum_map :
    ('-> '-> 'a) ->
    'Rule_modes.RuleModeMap.t ->
    'Rule_modes.RuleModeMap.t -> 'Rule_modes.RuleModeMap.t
end