123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151(**************************************************************************)(* This file is part of the Codex semantics library. *)(* *)(* Copyright (C) 2013-2025 *)(* CEA (Commissariat à l'énergie atomique et aux énergies *)(* alternatives) *)(* *)(* 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, version 2.1. *)(* *)(* It 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. *)(* *)(* See the GNU Lesser General Public License version 2.1 *)(* for more details (enclosed in the file LICENSE). *)(* *)(**************************************************************************)moduleSig=Sva_sigmoduleNo_Log_Numeric_Enum(Log:Tracelog.S)(Sub:Sig.NUMERIC_ENUM):Sig.NUMERIC_ENUM=SubmoduleLog_Numeric_Enum(Log:Tracelog.S)(Sub:Sig.NUMERIC_ENUM):Sig.NUMERIC_ENUM=structletname=Sub.nametypeboolean=Sub.booleantypebitvector=Sub.bitvectortypeinteger=Sub.integertypeenum=Sub.enummoduleBoolean_Lattice=Sub.Boolean_LatticemoduleBitvector_Lattice=Sub.Bitvector_LatticemoduleEnum_Lattice=Sub.Enum_LatticemoduleInteger_Lattice=structincludeSub.Integer_Latticeletjoinab=Log.trace(funp->p"join %a %a"prettyaprettyb)~pp_ret:pretty(fun()->joinab)letincludes_or_widen~previousnext=Log.trace(funp->p"includes_or_widen %a %a"prettypreviousprettynext)~pp_ret:(funfmt(p,b)->Format.fprintffmt"%b,%a"pprettyb)(fun()->includes_or_widen~previousnext)endopenOperatormoduleConversion=structtypeboolean=Sub.booleantypeinteger=Sub.integertypeenum=Sub.enumtypebitvector=Sub.bitvectortype'app=Format.formatter->'a->unitletbool_printer=Sub.Boolean_Lattice.prettyletenum_printer=Sub.Enum_Lattice.prettyletinteger_printer=Sub.Integer_Lattice.prettyletbv_printer=Sub.Bitvector_Lattice.prettyendmoduleForward_Conversion=structincludeConversionmoduleArity=Forward_Arityletar0pp_retppf=Log.trace(funp->p"forward %t"pp)~pp_ret@@fun()->fletar1ppapp_retppfa=Log.trace(funp->p"forward %t %a"ppppaa)~pp_ret@@fun()->faletar2ppappbpp_retppfab=Log.trace(funp->p"forward %t %a %a"ppppaappbb)~pp_ret@@fun()->fabendmoduleBackward_Conversion=structincludeConversionmoduleArity=Backward_Arityletpp_optionppfmt=function|None->Format.fprintffmt"unchanged"|Somex->ppfmtxletpp_option_pairppappbfmt(a,b)=Format.fprintffmt"(%a,%a)"(pp_optionppa)a(pp_optionppb)bletar0pp_retppf=assertfalseletar1ppapp_retppfar=Log.trace(funp->p"backward %t %a %a"ppppaapp_retr)~pp_ret:(pp_optionppa)@@fun()->farletar2ppappbpp_retppfabr=Log.trace(funp->p"backward %t %a %a %a"ppppaappbbpp_retr)~pp_ret:(pp_option_pairppappb)@@fun()->fabrendmoduleBoolean_Forward=structincludeAutolog.Log_Boolean_Backward(Forward_Conversion)(Sub.Boolean_Forward)lettrue_=Sub.Boolean_Forward.true_letfalse_=Sub.Boolean_Forward.false_endmoduleBoolean_Backward=Autolog.Log_Boolean_Backward(Backward_Conversion)(Sub.Boolean_Backward)moduleInteger_Forward=structincludeAutolog.Log_Integer_Backward(Forward_Conversion)(Sub.Integer_Forward)letzero=Sub.Integer_Forward.zeroletone=Sub.Integer_Forward.oneleticonstz=Forward_Conversion.ar0Forward_Conversion.integer_printer(funfmt->Format.fprintffmt"iconst %s"(Z.to_stringz))(Sub.Integer_Forward.iconstz)endmoduleInteger_Backward=Autolog.Log_Integer_Backward(Backward_Conversion)(Sub.Integer_Backward)moduleBitvector_Forward=Autolog.Log_Bitvector_Forward_With_Bimul_add(Forward_Conversion)(Sub.Bitvector_Forward)moduleBitvector_Backward=Autolog.Log_Bitvector_Forward_With_Bimul_add(Backward_Conversion)(structincludeSub.Bitvector_Backwardletbiconst~size_=assertfalseend)moduleEnum_Forward=Autolog.Log_Enum_Forward(Forward_Conversion)(Sub.Enum_Forward)moduleEnum_Backward=Autolog.Log_Enum_Forward(Backward_Conversion)(structincludeSub.Enum_Backwardletenum_const~case=assertfalseend)end