Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file simplex_cache.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123(**************************************************************************)(* *)(* Alt-Ergo: The SMT Solver For Software Verification *)(* Copyright (C) --- OCamlPro SAS *)(* *)(* This file is distributed under the terms of OCamlPro *)(* Non-Commercial Purpose License, version 1. *)(* *)(* As an exception, Alt-Ergo Club members at the Gold level can *)(* use this file under the terms of the Apache Software License *)(* version 2.0. *)(* *)(* --------------------------------------------------------------- *)(* *)(* More details can be found in the file LICENSE.md *)(* *)(**************************************************************************)openAltErgoLibopenFormatopenNumbersopenSimplexmoduleMAKE(C:sigtypetvalcompare:t->t->intvalprint:formatter->t->unitend)=structmoduleMI=Util.MImoduleMD=Map.Make(C)letppprintfmtp=MI.iter(funiq->fprintffmt"%s*L%d + "(Q.to_stringq)i)p;fprintffmt"0"letprint_sumidsum=Printer.print_dbg~flushed:false"@[<v 2>sum %d@ "id;MD.iter(funx(lp,ln,q)->Printer.print_dbg~flushed:false~header:false"%a -> (%a) + (%a) + %s = 0@ "C.printxppprintlpppprintln(Q.to_stringq))sum;Printer.print_dbg~header:false"@]"moduleSM=Map.Make(structtypet1=(Q.tMI.t*Q.tMI.t*Q.t)MD.ttypet2=Q.tMI.ttypet3=Q.tMI.ttypet=t1*t2*t3letcmp(m1,n1,q1)(m2,n2,q2)=letc=Q.compareq1q2inifc<>0thencelseletc=MI.compareQ.comparem1m2inifc<>0thencelseMI.compareQ.comparen1n2letcompare(sum1,_,lambdas1)(sum2,_,lambdas2)=letc=MD.comparecmpsum1sum2inifc<>0thencelseletc=MI.compareQ.comparelambdas1lambdas2inifc<>0then(print_sum1sum1;print_sum2sum2;Printer.print_dbg"l1 = %a"ppprintlambdas1;Printer.print_dbg"l2 = %a"ppprintlambdas2);assert(c=0);cend)let(m:(int*result*Q.tMI.t)SM.tref)=refSM.emptylet(mm:(int*result*Q.tMI.t)SM.tMD.tref)=refMD.emptyletmi_of_ll=List.fold_left(funm(i,q)->MI.addiqm)MI.emptylletmake_reprmax_cttequass_neq=letmax_ctt=mi_of_lmax_cttinlets_neq=mi_of_ls_neqinletequas=List.fold_left(funmp(x,(lp,ln,q))->letlp=mi_of_llpinletln=mi_of_llninMD.addx(lp,ln,q)mp)MD.emptyequasinmax_ctt,equas,s_neqletalready_registeredmax_cttequass_neq=letrepr=equas,max_ctt,s_neqintryletcounter,res_sim,ctt=SM.findrepr!minSome(counter,res_sim,ctt)withNot_found->Noneletregistermax_cttequass_neqcptsim_res=ifalready_registeredmax_cttequass_neq==Nonethenbeginletrepr=equas,max_ctt,s_neqinm:=SM.addrepr(cpt,sim_res,max_ctt)!mendletalready_registered_monxmax_cttequass_neq=letrepr=equas,max_ctt,s_neqintryletm=MD.findx!mminletcounter,res_sim,ctt=SM.findreprminSome(counter,res_sim,ctt)withNot_found->Noneletregister_monxmax_cttequass_neqcptsim_res=ifalready_registered_monxmax_cttequass_neq==Nonethenbeginletm=tryMD.findx!mmwithNot_found->SM.emptyinletrepr=equas,max_ctt,s_neqinmm:=MD.addx(SM.addrepr(cpt,sim_res,max_ctt)m)!mmendend