12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394(* This file is free software, part of Logtk. See file "license" for more details. *)(** {1 Partial Ordering values} *)typet=Lt|Eq|Gt|Incomparable(** partial order *)typecomparison=tletequal:t->t->bool=Pervasives.(=)letto_string=function|Lt->"=<="|Gt->"=>="|Eq->"==="|Incomparable->"=?="letppoutc=CCFormat.stringout(to_stringc)letcombinecmp1cmp2=matchcmp1,cmp2with|Eq,Eq|Eq,Incomparable|Incomparable,Eq->Eq|Lt,Incomparable|Incomparable,Lt->Lt|Gt,Incomparable|Incomparable,Gt->Gt|Incomparable,Incomparable->Incomparable|_->invalid_arg"inconsistent comparisons"letoppcmp=matchcmpwith|Eq|Incomparable->cmp|Lt->Gt|Gt->Ltletto_totalord=matchordwith|Lt->-1|Gt->1|Eq|Incomparable->0letof_totalord=matchordwith|0->Eq|xwhenx>0->Gt|_->Ltletlexicoab=matchawith|Incomparable->b|_->atype'acomparator='a->'a->tlet(++)=lexicolet(@>>)fgxy=matchfxywith|Eq->gxy|res->restype('a,'b)combination={call:'a->'a->'b;ignore:t->'a->'a->'b;}letlastf={call=f;ignore=(funres__->res);}let(>>>)fg={call=(funxy->matchfxywith|Incomparable->g.call|res->g.ignoreres);ignore=(funres__->g.ignoreres);}letcallfxy=f.callxyletdominatesfl1l2=letrecfind_xl1y=matchl1with|[]->false|x::l1'->matchfxywith|Gt->true|_->find_xl1'yandcheck_alll2=matchl2with|[]->true|y::l2'->find_xl1y&&check_alll2'incheck_alll2;;moduletypePARTIAL_ORD=sigtypetvalpartial_cmp:t->t->comparisonend