123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778(************************************************************************)(* * 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) *)(************************************************************************)openUtilmoduleNoDupArray:sig(** Like a Parray, but the old pointers are invalidated instead of updated *)type'atvalmake:int->'atvaladd:int->'a->'at->'atvalto_array:'at->'aarrayvalpr:('a->Pp.t)->'at->Pp.tend=structtype'at='aoptionarray*boolrefletmaken=Array.makenNone,reftrueletinvalidateb=ifnot!bthenCErrors.anomalyPp.(str"Tried to reuse invalidated NoDupArray.");b:=falseletaddie(a,b)=invalidateb;beginmatcha.(i)with|None->a.(i)<-Somee|Some_->CErrors.anomalyPp.(str"Tried to add duplicate in NoDupArray.")end;a,reftrueletto_array(a,b)=invalidateb;Array.map(functionSomee->e|None->CErrors.anomalyPp.(str"Tried to cast non-full NoDupArray."))aletprpre(a,_)=Pp.(str"[|"++prvect_with_seppr_semicolon(functionNone->str"\u{2205}"(* Empty set *)|Somee->pree)a++str"|]")endtype('term,'quality,'univ)t='termNoDupArray.t*'qualityNoDupArray.t*'univNoDupArray.tletmake(m,n,p)=(NoDupArray.makem,NoDupArray.maken,NoDupArray.makep)letadd_termittqus:('t,'q,'u)t=on_pi1(NoDupArray.add(i-1)t)tqusletmaybe_add_termiottqus:('t,'q,'u)t=Option.fold_right(funi->add_termit)iotqusletadd_qualityiqtqus:('t,'q,'u)t=on_pi2(NoDupArray.addiq)tqusletmaybe_add_qualityioqtqus:('t,'q,'u)t=Option.fold_right(funi->add_qualityiq)iotqusletadd_univiutqus:('t,'q,'u)t=on_pi3(NoDupArray.addiu)tqusletmaybe_add_univioutqus:('t,'q,'u)t=Option.fold_right(funi->add_univiu)iotqusletto_arrays(ts,qs,us:_t)=(NoDupArray.to_arrayts,NoDupArray.to_arrayqs,NoDupArray.to_arrayus)letprprtprqpru(ts,qas,us)=Pp.(NoDupArray.prprtts++pr_comma()++NoDupArray.prprqqas++pr_comma()++NoDupArray.prpruus)