123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869(************************************************************************)(* * The Coq Proof Assistant / The Coq 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.SmoduleMake(M:OrderedType)=Set.Make(M)moduletypeHashedType=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