123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385(**************************************************************************)(* 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). *)(* *)(**************************************************************************)(****************************************************************)(** Standard abstraction for booleans. *)moduleQuadrivalent=Lattices.QuadrivalentmoduleBitfield=Lattices.Bitfield(****************************************************************)(** {1 Forward transfer functions} *)moduletypeWITH_BOOLEAN_FORWARD=sigtypeboolean=Quadrivalent.tmoduleBoolean_Forward:Operator.BOOLEAN_FORWARDwithmoduleArity:=Operator.Forward_Arityandtypeboolean:=booleanendmoduletypeWITH_INTEGER_FORWARD=sigtypeboolean=Quadrivalent.ttypeintegermoduleInteger_Forward:Operator.INTEGER_FORWARDwithmoduleArity:=Operator.Forward_Arityandtypeboolean:=booleanandtypeinteger:=integerendmoduletypeWITH_BITVECTOR_FORWARD=sigtypeboolean=Quadrivalent.ttypebitvectormoduleBitvector_Forward:Operator.BITVECTOR_FORWARD_WITH_BIMUL_ADDwithmoduleArity:=Operator.Forward_Arityandtypeboolean:=booleanandtypebitvector:=bitvectorendmoduletypeWITH_ENUM_FORWARD=sigtypeboolean=Quadrivalent.ttypeenummoduleEnum_Forward:Operator.ENUM_FORWARDwithmoduleArity:=Operator.Forward_Arityandtypeboolean:=booleanandtypeenum:=enumendmoduletypeWITH_BLOCK_FORWARD=sigtypeboolean=Quadrivalent.ttypebitvectortypeblockmoduleBlock_Forward:Operator.BLOCK_FORWARDwithmoduleArity:=Operator.Forward_Arityandtypeboolean:=booleanandtypevalue:=bitvectorandtypeblock:=blockandtypeoffset:=bitvectorendmoduletypeWITH_MEMORY_FORWARD=sigtypeboolean=Quadrivalent.ttypebitvectortypememorytypeblockmoduleMemory_Forward:Operator.MEMORY_FORWARDwithmoduleArity:=Operator.Forward_Arityandtypeboolean:=booleanandtypeaddress:=bitvectorandtypememory:=memoryandtypeblock:=blockandtypevalue:=bitvectorendmoduletypeWITH_MEMORY_BITVECTOR_BOOLEAN_FORWARD=sigincludeWITH_MEMORY_FORWARDincludeWITH_BLOCK_FORWARDwithtypeboolean:=booleanandtypebitvector:=bitvectorandtypeblock:=blockincludeWITH_BITVECTOR_FORWARDwithtypeboolean:=booleanandtypebitvector:=bitvectorincludeWITH_BOOLEAN_FORWARDwithtypeboolean:=booleanendmoduletypeWITH_MEMORY_BITVECTOR_INTEGER_BOOLEAN_FORWARD=sigincludeWITH_MEMORY_FORWARDincludeWITH_BLOCK_FORWARDwithtypeboolean:=booleanandtypebitvector:=bitvectorandtypeblock:=blockincludeWITH_BITVECTOR_FORWARDwithtypeboolean:=booleanandtypebitvector:=bitvectorincludeWITH_INTEGER_FORWARDwithtypeboolean:=booleanincludeWITH_BOOLEAN_FORWARDwithtypeboolean:=booleanendmoduletypeWITH_FORWARD=sigincludeWITH_MEMORY_BITVECTOR_INTEGER_BOOLEAN_FORWARDend(****************************************************************)(** {1 Backward transfer functions} *)moduletypeWITH_BOOLEAN_BACKWARD=sigtypeboolean=Quadrivalent.tmoduleBoolean_Backward:Operator.BOOLEAN_BACKWARDwithmoduleArity:=Operator.Backward_Arityandtypeboolean:=boolean;;endmoduletypeWITH_INTEGER_BACKWARD=sigtypeboolean=Quadrivalent.ttypeintegermoduleInteger_Backward:Operator.INTEGER_BACKWARDwithmoduleArity:=Operator.Backward_Arityandtypeboolean:=booleanandtypeinteger:=integerendmoduletypeWITH_ENUM_BACKWARD=sigtypeboolean=Quadrivalent.ttypeenummoduleEnum_Backward:Operator.ENUM_BACKWARDwithmoduleArity:=Operator.Backward_Arityandtypeboolean:=booleanandtypeenum:=enumendmoduletypeWITH_BITVECTOR_BACKWARD=sigtypeboolean=Quadrivalent.ttypebitvectormoduleBitvector_Backward:sigincludeOperator.BITVECTOR_BACKWARDwithmoduleArity:=Operator.Backward_Arityandtypeboolean:=booleanandtypebitvector:=bitvector(** Combined operation for multiplication and addition [x -> prod*x + offset].
This operation does not overflows if only the intermediate term [prod*x] overflows. *)valbimul_add:size:Units.In_bits.t->prod:Z.t->offset:Z.t->(bitvector,bitvector)Operator.Backward_Arity.ar1endendmoduletypeWITH_BLOCK_BACKWARD=sigtypeboolean=Quadrivalent.ttypebitvectortypeblockmoduleBlock_Backward:Operator.BLOCK_BACKWARDwithmoduleArity:=Operator.Backward_Arityandtypeboolean:=booleanandtypevalue:=bitvectorandtypeblock:=blockandtypeoffset:=bitvectorendmoduletypeWITH_MEMORY_BACKWARD=sigtypeboolean=Quadrivalent.ttypebitvectortypememorytypeblockmoduleMemory_Backward:Operator.MEMORY_BACKWARDwithmoduleArity:=Operator.Backward_Arityandtypeboolean:=booleanandtypeaddress:=bitvectorandtypememory:=memoryandtypeblock:=blockandtypevalue:=bitvectorendmoduletypeWITH_MEMORY_BITVECTOR_BOOLEAN_BACKWARD=sigincludeWITH_MEMORY_BACKWARDincludeWITH_BLOCK_BACKWARDwithtypeboolean:=booleanandtypebitvector:=bitvectorandtypeblock:=blockincludeWITH_BITVECTOR_BACKWARDwithtypeboolean:=booleanandtypebitvector:=bitvectorincludeWITH_BOOLEAN_BACKWARDwithtypeboolean:=booleanend(****************************************************************)(** {1 Both backward and forward} *)moduletypeWITH_BOOLEAN_FORWARD_BACKWARD=sigtypeboolean=Quadrivalent.tincludeWITH_BOOLEAN_FORWARDwithtypeboolean:=booleanincludeWITH_BOOLEAN_BACKWARDwithtypeboolean:=booleanendmoduletypeWITH_INTEGER_FORWARD_BACKWARD=sigtypeboolean=Quadrivalent.ttypeintegerincludeWITH_INTEGER_FORWARDwithtypeboolean:=booleanandtypeinteger:=integerincludeWITH_INTEGER_BACKWARDwithtypeboolean:=booleanandtypeinteger:=integerendmoduletypeWITH_ENUM_FORWARD_BACKWARD=sigtypeboolean=Quadrivalent.ttypeenumincludeWITH_ENUM_FORWARDwithtypeboolean:=booleanandtypeenum:=enumincludeWITH_ENUM_BACKWARDwithtypeboolean:=booleanandtypeenum:=enumendmoduletypeWITH_BITVECTOR_FORWARD_BACKWARD=sigtypeboolean=Quadrivalent.ttypebitvectorincludeWITH_BITVECTOR_FORWARDwithtypeboolean:=booleanandtypebitvector:=bitvectorincludeWITH_BITVECTOR_BACKWARDwithtypeboolean:=booleanandtypebitvector:=bitvectorendmoduletypeWITH_BLOCK_FORWARD_BACKWARD=sigtypeboolean=Quadrivalent.ttypebitvectortypeblockincludeWITH_BLOCK_FORWARDwithtypeboolean:=booleanandtypebitvector:=bitvectorandtypeblock:=blockincludeWITH_BLOCK_BACKWARDwithtypeboolean:=booleanandtypebitvector:=bitvectorandtypeblock:=blockendmoduletypeWITH_MEMORY_FORWARD_BACKWARD=sigtypeboolean=Quadrivalent.ttypebitvectortypememorytypeblockincludeWITH_MEMORY_FORWARDwithtypeboolean:=booleanandtypebitvector:=bitvectorandtypememory:=memoryandtypeblock:=blockincludeWITH_MEMORY_BACKWARDwithtypeboolean:=booleanandtypebitvector:=bitvectorandtypememory:=memoryandtypeblock:=blockendmoduletypeWITH_BITVECTOR_BOOLEAN_FORWARD_BACKWARD=sigincludeWITH_BITVECTOR_FORWARD_BACKWARDincludeWITH_BOOLEAN_FORWARD_BACKWARDwithtypeboolean:=booleanendmoduletypeWITH_MEMORY_BITVECTOR_BOOLEAN_FORWARD_BACKWARD=sigincludeWITH_MEMORY_FORWARD_BACKWARD;;includeWITH_BLOCK_FORWARD_BACKWARDwithtypeboolean:=booleanandtypebitvector:=bitvectorandtypeblock:=blockincludeWITH_BITVECTOR_BOOLEAN_FORWARD_BACKWARDwithtypeboolean:=booleanandtypebitvector:=bitvectorendmoduletypeWITH_FORWARD_BACKWARD=sigincludeWITH_MEMORY_BITVECTOR_BOOLEAN_FORWARD_BACKWARDend(****************************************************************)(** {1 Base versions} *)moduletypeBOOLEAN_LATTICE=Lattices.Sig.BOOLEAN_LATTICEmoduletypeINTEGER_LATTICE=Lattices.Sig.INTEGER_LATTICEmoduletypeBITVECTOR_LATTICE=Lattices.Sig.BITVECTOR_LATTICEmoduletypeENUM_LATTICE=Lattices.Sig.ENUM_LATTICEmoduletypeMEMORY_LATTICE=sigincludeLattices.Sig.JOIN_SEMI_LATTICE_WITH_BOTTOMendmoduletypeBLOCK_LATTICE=sigincludeLattices.Sig.JOIN_SEMI_LATTICE_WITH_BOTTOMendmoduletypeBOOLEAN=sigvalname:stringincludeWITH_BOOLEAN_FORWARD_BACKWARDmoduleBoolean_Lattice:BOOLEAN_LATTICEwithtypet=booleanendmoduletypeINTEGER=sigvalname:stringincludeWITH_INTEGER_FORWARD_BACKWARDincludeWITH_BOOLEAN_FORWARD_BACKWARDwithtypeboolean:=booleanmoduleBoolean_Lattice:BOOLEAN_LATTICEwithtypet=booleanmoduleInteger_Lattice:INTEGER_LATTICEwithtypet=integerendmoduletypeENUM=sigvalname:stringincludeWITH_ENUM_FORWARD_BACKWARDincludeWITH_BOOLEAN_FORWARD_BACKWARDwithtypeboolean:=booleanmoduleBoolean_Lattice:BOOLEAN_LATTICEwithtypet=booleanmoduleEnum_Lattice:ENUM_LATTICEwithtypet=enumendmoduletypeBITVECTOR=sigvalname:stringincludeWITH_BITVECTOR_FORWARD_BACKWARDincludeWITH_BOOLEAN_FORWARD_BACKWARDwithtypeboolean:=booleanmoduleBoolean_Lattice:BOOLEAN_LATTICEwithtypet=booleanmoduleBitvector_Lattice:BITVECTOR_LATTICEwithtypet=bitvectorendmoduletypeBITVECTOR_ENUM=sigincludeBITVECTORincludeENUMwithtypeboolean:=booleanandmoduleBoolean_Lattice:=Boolean_LatticeandmoduleBoolean_Forward:=Boolean_ForwardandmoduleBoolean_Backward:=Boolean_BackwardendmoduletypeNUMERIC=sigincludeBITVECTORincludeINTEGERwithtypeboolean:=booleanandmoduleBoolean_Lattice:=Boolean_LatticeandmoduleBoolean_Forward:=Boolean_ForwardandmoduleBoolean_Backward:=Boolean_BackwardendmoduletypeNUMERIC_ENUM=sigincludeBITVECTORincludeINTEGERwithtypeboolean:=booleanandmoduleBoolean_Lattice:=Boolean_LatticeandmoduleBoolean_Forward:=Boolean_ForwardandmoduleBoolean_Backward:=Boolean_BackwardincludeENUMwithtypeboolean:=booleanandmoduleBoolean_Lattice:=Boolean_LatticeandmoduleBoolean_Forward:=Boolean_ForwardandmoduleBoolean_Backward:=Boolean_Backwardend(** Most complete version, with all datatypes. Used as a parameter for
functors. *)moduletypeALL=sigvalname:stringincludeWITH_BOOLEAN_FORWARD_BACKWARDincludeWITH_INTEGER_FORWARD_BACKWARDwithtypeboolean:=booleanincludeWITH_BITVECTOR_FORWARD_BACKWARDwithtypeboolean:=booleanincludeWITH_BLOCK_FORWARD_BACKWARDwithtypeboolean:=booleanandtypebitvector:=bitvectorincludeWITH_MEMORY_FORWARD_BACKWARDwithtypebitvector:=bitvectorandtypeboolean:=booleanandtypeblock:=blockincludeWITH_ENUM_FORWARD_BACKWARDwithtypeboolean:=booleanmoduleBoolean_Lattice:BOOLEAN_LATTICEwithtypet=booleanmoduleInteger_Lattice:INTEGER_LATTICEwithtypet=integermoduleBitvector_Lattice:BITVECTOR_LATTICEwithtypet=bitvectormoduleMemory_Lattice:MEMORY_LATTICEwithtypet=memorymoduleEnum_Lattice:ENUM_LATTICEwithtypet=enummoduleBlock_Lattice:BLOCK_LATTICEwithtypet=blockend