1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889(****************************************************************************)(* *)(* This file is part of MOPSA, a Modular Open Platform for Static Analysis. *)(* *)(* Copyright (C) 2017-2019 The MOPSA Project. *)(* *)(* This program is free software: you can redistribute it and/or modify *)(* it under the terms of the GNU Lesser General Public License as published *)(* by the Free Software Foundation, either version 3 of the License, or *)(* (at your option) any later version. *)(* *)(* This program is distributed in the hope that it will be useful, *)(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)(* GNU Lesser General Public License for more details. *)(* *)(* You should have received a copy of the GNU Lesser General Public License *)(* along with this program. If not, see <http://www.gnu.org/licenses/>. *)(* *)(****************************************************************************)(** Reduction operator for intervals and excluded powerset *)openMopsaopenSig.Reduction.ValuemoduleReduction=structletname="universal.numeric.reductions.intervals_excluded_powerset"letdebugfmt=Debug.debug~channel:namefmtmoduleI=Values.Intervals.Integer.ValuemoduleP=Values.Powersets.Excluded.SimplifiedValuemoduleB=ItvUtils.IntItv.B(* Reduce an interval and a powerset *)letof_interval(a:I.t):P.t=matchawith|BOT->P.bottom|Nb(B.Finitel,B.Finiteh)->P.of_boundslh|_->P.topletreduce_excluded_set(notint_set:P.Set.t)(i:I.t):P.t*I.t=matchiwith|BOT->P.bottom,BOT|_->NotInnotint_set,iletreduce_finite_set(in_set:P.Set.t)(i:I.t):P.t*I.t=matchiwith|BOT->P.bottom,BOT|Nb(B.Finitel,B.Finiteh)->letfiltered_set=P.In(P.Set.filter(funa->Z.geqal&&Z.leqah)in_set)infiltered_set,P.to_itvfiltered_set|Nb(B.MINF,B.Finiteh)->letfiltered_set=P.In(P.Set.filter(funa->Z.leqah)in_set)infiltered_set,P.to_itvfiltered_set|Nb(B.Finitel,B.PINF)->letfiltered_set=P.In(P.Set.filter(funa->Z.geqal)in_set)infiltered_set,P.to_itvfiltered_set|_->Inin_set,P.to_itv(Inin_set)letreduce_pair(x:P.t)(i:I.t):P.t*I.t=ifP.is_bottomx||I.is_bottomithenP.bottom,I.bottomelsematchx,iwith|NotIns,_->reduce_excluded_setsi|Ins,_->reduce_finite_setsiletreduce(man:'avalue_reduction_man)(v:'a):'a=leti=man.getI.idvinletp=man.getP.idvinletp',i'=reduce_pairpiinman.setI.idi'v|>man.setP.idp'endlet()=register_value_reduction(moduleReduction)