123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102(**************************************************************************)(* *)(* This file is part of WP plug-in of Frama-C. *)(* *)(* Copyright (C) 2007-2023 *)(* CEA (Commissariat a l'energie atomique et aux energies *)(* 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 licenses/LGPLv2.1). *)(* *)(**************************************************************************)openLangopenTacticalopenConditions(* -------------------------------------------------------------------------- *)(* --- Cut Tactical --- *)(* -------------------------------------------------------------------------- *)letfclause,pclause=Tactical.composer~id:"clause"~title:"Clause"~descr:"Clause to Cut with"~filter:F.is_prop()typemode=CASES|MODUSletfmode,pmode=Tactical.selector~id:"case"~title:"Mode"~descr:"Select How the Clause is Used"~default:MODUS~options:Tactical.[{title="Case Analysis";descr="";vid="CASES";value=CASES};{title="Modus Ponens";descr="";vid="MODUS";value=MODUS};]()classcut=object(self)inheritTactical.make~id:"Wp.cut"~title:"Cut"~descr:"Use Intermerdiate Hypothesis"~params:[pmode;pclause]methodselectfeedbacksel=letmode=matchselwith|Clause(Goalp)whenp!=F.p_false->feedback#update_field~enabled:falsefmode;CASES|_->feedback#update_field~enabled:truefmode;self#get_fieldfmodeinletcut=self#get_fieldfclauseinifTactical.is_emptycutthenNot_configuredelsematchmodewith|MODUS->feedback#set_descr"Prove then Insert the Clause";letclause=F.p_bool(Tactical.selectedcut)inletstep=Conditions.step~descr:"Cut"(Haveclause)inletat=Tactical.atselinApplicablebeginfunsequent->letassume=Conditions.insert?atstepsequentin["Clause",(fstsequent,clause);"Assume",(fstassume,sndsequent)]end|CASES->feedback#set_descr"Proof by Case in the Clause";letpositive=F.p_bool(Tactical.selectedcut)inletnegative=F.p_notpositiveinApplicablebeginfun(hs,goal)->["Positive",(hs,F.p_implypositivegoal);"Negative",(hs,F.p_implynegativegoal)]endendlettactical=Tactical.export(newcut)letstrategy?(priority=1.0)?(modus=true)selection=Strategy.{priority;tactical;selection;arguments=[argfmode(ifmodusthenMODUSelseCASES)];}