123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960(**************************************************************************)(* 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). *)(* *)(**************************************************************************)(* Product with intersection semantics: elements are in the
intersections of the concretizations. *)openLattice_sig;;moduleProd2(L1:JOIN_SEMI_LATTICE)(L2:JOIN_SEMI_LATTICE):JOIN_SEMI_LATTICEwithtypet=L1.t*L2.t=structincludeDatatype_sig.Prod2(L1)(L2);;letincludes(a1,a2)(b1,b2)=L1.includesa1b1&&L2.includesa2b2letwiden~previous:(a1,a2)(b1,b2)=(L1.widen~previous:a1b1),(L2.widen~previous:a2b2)letincludes_or_widen~previousnext=ifincludespreviousnextthen(true,previous)else(false,widen~previousnext);;letjoin(a1,a2)(b1,b2)=(L1.joina1b1,L2.joina2b2)endmoduleProd2_With_Bottom(L1:JOIN_SEMI_LATTICE_WITH_BOTTOM)(L2:JOIN_SEMI_LATTICE_WITH_BOTTOM)=structincludeDatatype_sig.Prod2(L1)(L2);;letincludes(a1,a2)(b1,b2)=L1.includesa1b1&&L2.includesa2b2letwiden~previous:(a1,a2)(b1,b2)=(L1.widen~previous:a1b1),(L2.widen~previous:a2b2)letincludes_or_widen~previousnext=ifincludespreviousnextthen(true,next)else(false,widen~previousnext);;letjoin(a1,a2)(b1,b2)=(L1.joina1b1,L2.joina2b2)letbottom()=L1.bottom(),L2.bottom()letis_bottom(a,b)=L1.is_bottoma||L2.is_bottombendmoduleProd2_With_Inter_Bottom(L1:JOIN_SEMI_LATTICE_WITH_INTER_BOTTOM)(L2:JOIN_SEMI_LATTICE_WITH_INTER_BOTTOM)=structincludeProd2_With_Bottom(L1)(L2);;letinter(a1,a2)(b1,b2)=(L1.intera1b1,L2.intera2b2)end