123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155(* This file is free software, part of Logtk. See file "license" for more details. *)moduletypeS=sigtypeelt(** Elements of the multiset *)typet(** A multiset of elements of type 'a *)valsize:t->int(** Number of distinct elements. *)valcardinal:t->Z.t(** Number of unique occurrences of elements (the multiplicity of each
element is considered) *)valempty:t(** Empty multiset *)valis_empty:t->bool(** Is the multiset empty? *)valmem:t->elt->bool(** Is the element part of the multiset? *)valfind:t->elt->Z.t(** Return the multiplicity of the element within the multiset.
Will return [Z.zero] if the element is not part of the multiset *)valsingleton:elt->tvaldoubleton:elt->elt->tvaladd:t->elt->t(** Add one occurrence of the element *)valadd_coeff:t->elt->Z.t->t(** Add several occurrences of the element *)valunion:t->t->t(** Union of multisets (max of multiplicies) *)valintersection:t->t->t(** Intersection of multisets (min of multiplicies) *)valsum:t->t->t(** Sum of multiplicies *)valdifference:t->t->t(** Difference of multisets. If [x] has a bigger multiplicity in the
second argument it won't appear in the result *)valproduct:Z.t->t->t(** Multiply all multiplicities with the given coefficient *)valfilter:(elt->Z.t->bool)->t->t(** Filter out elements that don't satisfy the predicate *)valmap:(elt->elt)->t->t(** Apply a function to all elements *)valmap_coeff:(elt->Z.t->Z.t)->t->t(** Apply a function to all coefficients. *)valfilter_map:(elt->Z.t->(elt*Z.t)option)->t->t(** More powerful mapping *)valflat_map:(elt->t)->t->t(** replace each element by a multiset in its own *)moduleSeq:sigvalof_seq:t->eltIter.t->tvalto_seq:t->eltIter.tvalof_coeffs:t->(elt*Z.t)Iter.t->tvalto_coeffs:t->(elt*Z.t)Iter.tendvaliter:(elt->unit)->t->unit(** Iterate on distinct occurrences of elements *)valfold:('a->elt->'a)->'a->t->'a(** fold on occurrences of elements *)valiter_coeffs:(elt->Z.t->unit)->t->unit(** Iterate on elements with their multiplicity *)valfold_coeffs:('a->elt->Z.t->'a)->'a->t->'a(** Fold on elements with their multiplicity *)valfor_all:(elt->bool)->t->boolvalexists:(elt->bool)->t->boolvalchoose:t->elt(** Chose one element, or
@raise Not_found if the multiset is empty *)valof_list:eltlist->t(** Multiset from list *)valof_coeffs:(elt*Z.t)list->t(** From list of elements with multiplicities. Multiplicities lower
than 0 will not count. *)valof_iarray:eltIArray.t->t(** From immutable array *)valof_array:eltarray->tvalto_list:t->(elt*Z.t)list(** List of elements with their coefficients *)valequal:t->t->bool(** Check equality of two multisets *)valcancel:t->t->t*t(** Remove common elements from the multisets. For instance,
on [{1,1,2}] and [{1,2,2,3}], [cancel] will return [({1}, {2,3})] *)(** {6 Comparisons}
In the following, the comparison function must be equality-compatible
with [E.compare]. In other words, if [E.compare x y = 0] then
[f x y = Comparison.Eq] must hold. *)valcompare:t->t->int(** Compare two multisets with the multiset extension of {!E.compare} *)valcompare_partial:(elt->elt->Comparison.t)->t->t->Comparison.t(** Compare two multisets with the multiset extension of the
given ordering. This ordering is total iff the element
ordering is. *)valis_max:(elt->elt->Comparison.t)->elt->t->bool(** Is the given element maximal (ie not dominated by any
other element) within the multiset? *)valmax:(elt->elt->Comparison.t)->t->t(** Maximal elements of the multiset, w.r.t the given ordering. *)valmax_seq:(elt->elt->Comparison.t)->t->(elt*Z.t)Iter.t(** Fold on maximal elements *)valmax_l:(elt->elt->Comparison.t)->eltlist->eltlist(** Maximal elements of a list *)valcompare_partial_l:(elt->elt->Comparison.t)->eltlist->eltlist->Comparison.t(** Compare two multisets represented as list of elements *)valpp:eltCCFormat.printer->tCCFormat.printerend