12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667(****************************************************************************)(* *)(* 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/>. *)(* *)(****************************************************************************)(**
Bot_top - Lift operations to a top/bottom element.
*)(** {2 Types} *)type'awith_bot_top=BOT|TOP|Nbtof'a(** Adds bottom/top element to a type. *)(** {2 Operator lifting} *)letbot_top_lift1(f:'a->'b)(a:'awith_bot_top):'bwith_bot_top=matchawithBOT->BOT|TOP->TOP|Nbtx->Nbt(fx)letbot_top_lift2(f:'a->'b->'c)(a:'awith_bot_top)(b:'bwith_bot_top):'cwith_bot_top=matcha,bwithTOP,_|_,TOP->TOP|BOT,_|_,BOT->BOT|Nbtx,Nbty->Nbt(fxy)letbot_top_absorb1(f:'a->'bwith_bot_top)(a:'awith_bot_top):'bwith_bot_top=matchawithBOT->BOT|TOP->TOP|Nbtx->fxletbot_top_absorb2(f:'a->'b->'cwith_bot_top)(a:'awith_bot_top)(b:'bwith_bot_top):'cwith_bot_top=matcha,bwithTOP,_|_,TOP->TOP|BOT,_|_,BOT->BOT|Nbtx,Nbty->fxyletbot_top_neutral2(f:'a->'a->'a)(a:'awith_bot_top)(b:'awith_bot_top):'awith_bot_top=matcha,bwithTOP,_->TOP|_,TOP->TOP|BOT,_->b|_,BOT->a|Nbtx,Nbty->Nbt(fxy)letbot_top_neutral_bind2(f:'a->'a->'awith_bot_top)(a:'awith_bot_top)(b:'awith_bot_top):'awith_bot_top=matcha,bwithTOP,_->TOP|_,TOP->TOP|BOT,_->b|_,BOT->a|Nbtx,Nbty->fxyletbot_top_equal(f:'a->'b->bool)(a:'awith_bot_top)(b:'bwith_bot_top):bool=matcha,bwithBOT,BOT->true|TOP,TOP->true|Nbtx,Nbty->fxy|_->falseletbot_top_included(f:'a->'b->bool)(a:'awith_bot_top)(b:'bwith_bot_top):bool=matcha,bwithBOT,_->true|_,TOP->true|Nbtx,Nbty->fxy|_->falseletbot_top_compare(cmp:'a->'a->int)(a:'awith_bot_top)(b:'awith_bot_top):int=matcha,bwithBOT,BOT->0|BOT,_->-1|_,BOT->1|TOP,TOP->0|TOP,_->-1|_,TOP->1|Nbtx,Nbty->cmpxyletbot_top_fprintfchx=matchxwith|TOP->Format.pp_print_stringchTop.top_string|BOT->Format.pp_print_stringchBot.bot_string|Nbtx->fchx