123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144(******************************************************************************)(* *)(* The Alt-Ergo theorem prover *)(* Copyright (C) 2006-2013 *)(* *)(* Sylvain Conchon *)(* Evelyne Contejean *)(* *)(* Francois Bobot *)(* Mohamed Iguernelala *)(* Stephane Lescuyer *)(* Alain Mebsout *)(* *)(* CNRS - INRIA - Universite Paris Sud *)(* *)(* This file is distributed under the terms of the Apache Software *)(* License version 2.0 *)(* *)(* ------------------------------------------------------------------------ *)(* *)(* Alt-Ergo: The SMT Solver For Software Verification *)(* Copyright (C) 2013-2018 --- OCamlPro SAS *)(* *)(* This file is distributed under the terms of the Apache Software *)(* License version 2.0 *)(* *)(******************************************************************************)openOptionsopenErrors(* Define the type of increment *)typeincr_kind=Matching(* Matching step increment *)|Interval_Calculus(* Arith : Interval Calculus increment *)|Fourier(* Arith : FourierMotzkin step increment *)|Omega(* Arith : number of omega procedure on Real and Int *)|Uf(* UF step increment *)|Ac(* AC step reasoning *)|Th_assumedofint(* Increment the counter for each term assumed in the
theories environment *)letnaive_steps=ref0letsteps=ref0letmult_f=ref0letmult_m=ref0letmult_s=ref0letmult_uf=ref0letmult_b=ref0letmult_a=ref0letall_steps=Stack.create()letpush_steps()=Stack.push(!naive_steps,!steps,!mult_f,!mult_m,!mult_s,!mult_uf,!mult_b,!mult_a)all_stepsletpop_steps()=letp_naive_steps,p_steps,p_mult_f,p_mult_m,p_mult_s,p_mult_uf,p_mult_b,p_mult_a=Stack.popall_stepsinnaive_steps:=p_naive_steps;steps:=p_steps;mult_f:=p_mult_f;mult_m:=p_mult_m;mult_s:=p_mult_s;mult_uf:=p_mult_uf;mult_b:=p_mult_b;mult_a:=p_mult_a(* Multipliers are here to homogeneize the global step counter *)letincrk=beginmatchkwith|Uf->mult_uf:=!mult_uf+1;if!mult_uf=500then(steps:=!steps+1;mult_uf:=0)|Matching->mult_m:=!mult_m+1;if!mult_m=100then(steps:=!steps+1;mult_m:=0)|Omega->mult_s:=!mult_s+1;if!mult_s=2then(steps:=!steps+1;mult_s:=0)|Ac->mult_a:=!mult_a+1;if!mult_a=1then(steps:=!steps+1;mult_a:=0)|Interval_Calculus->mult_b:=!mult_b+1;if!mult_b=5then(steps:=!steps+1;mult_b:=0)|Fourier->mult_f:=!mult_f+1;if!mult_f=40then(steps:=!steps+1;mult_f:=0);|Th_assumedn->(* Since n refers to the number of terms sent to the theories no
* multiplier is needed here *)ifn<0thenrun_error(Invalid_steps_countn);naive_steps:=!naive_steps+n;end;letsteps_bound=get_steps_bound()inifsteps_bound<>-1&&((Stdlib.compare!steps((steps_bound))>0)||(Stdlib.compare!naive_steps((steps_bound))>0))thenbeginletn=if!naive_steps>0then!naive_stepselseif!steps>0then!stepselsesteps_boundinrun_error(Steps_limitn)endletreset_steps()=Stack.clearall_steps;naive_steps:=0;steps:=0;mult_f:=0;mult_m:=0;mult_s:=0;mult_uf:=0;mult_b:=0;mult_a:=0(* Return the max steps between naive and refine steps counting. Both counter
* are compute at execution. The first one count the number of terms sent to the
* theories environment, the second one count steps depending of the theories
* used *)letget_steps()=max!naive_steps!steps(** Functions useful for case-split steps *)letcs_steps_cpt=ref0letcs_steps()=!cs_steps_cptletincr_cs_steps()=Stdlib.incrcs_steps_cpt