12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697(************************************************************************)(* * The Rocq Prover / The Rocq Development Team *)(* v * Copyright INRIA, CNRS and contributors *)(* <O___,, * (see version control and CREDITS file for authors & dates) *)(* \VV/ **************************************************************)(* // * This file is distributed under the terms of the *)(* * GNU Lesser General Public License Version 2.1 *)(* * (see LICENSE file for the text of the license) *)(************************************************************************)moduletypeOrderedType=sigtypetvalcompare:t->t->intendmoduletypeS=Set.SmoduletypeExtS=sigincludeCSig.SetSmoduleList:sigvalunion:tlist->tendendmoduleSetExt(M:Set.OrderedType):sigtypeset=Set.Make(M).tmoduleList:sigvalunion:setlist->setendend=structmoduleS=Set.Make(M)typeset=S.tmoduleList=structletunion=List.fold_leftS.unionS.emptyendendmoduleMake(M:Set.OrderedType)=structincludeSet.Make(M)includeSetExt(M)endmoduletypeHashedType=sigtypetvalhash:t->intendmoduleHashcons(M:OrderedType)(H:HashedTypewithtypet=M.t)=structmoduleSet=Make(M)typeset=Set.ttype_set=|SEmpty|SNodeofset*M.t*set*intletset_prj:set->_set=Obj.magicletset_inj:_set->set=Obj.magicletrecspinesaccu=matchset_prjswith|SEmpty->accu|SNode(l,v,r,_)->spinel((v,r)::accu)letrecumapfs=matchset_prjswith|SEmpty->set_injSEmpty|SNode(l,v,r,h)->letl'=umapflinletr'=umapfrinletv'=fvinset_inj(SNode(l',v',r',h))letreceqeqs1s2=matchs1,s2with|[],[]->true|(v1,r1)::s1,(v2,r2)::s2->v1==v2&&eqeq(spiner1s1)(spiner2s2)|_->falsemoduleHashed=structopenHashset.Combinetypet=settypeu=M.t->M.tleteqs1s2=s1==s2||eqeq(spines1[])(spines2[])lethashs=Set.fold(funvaccu->combine(H.hashv)accu)s0lethashcons=umapendincludeHashcons.Make(Hashed)end