├── .gitignore ├── AUTHORS ├── COPYING ├── Changes ├── Makefile ├── Makefile.config.model ├── README.mac ├── README.md ├── README.windows.md ├── apron.opam ├── apron ├── .cproject ├── COPYING ├── Makefile ├── README ├── ap_abstract0.c ├── ap_abstract0.h ├── ap_abstract1.c ├── ap_abstract1.h ├── ap_coeff.c ├── ap_coeff.h ├── ap_config.h ├── ap_dimension.c ├── ap_dimension.h ├── ap_disjunction.c ├── ap_disjunction.h ├── ap_environment.c ├── ap_environment.h ├── ap_expr0.h ├── ap_expr1.h ├── ap_generator0.c ├── ap_generator0.h ├── ap_generator1.c ├── ap_generator1.h ├── ap_generic.c ├── ap_generic.h ├── ap_global0.h ├── ap_global1.h ├── ap_interval.c ├── ap_interval.h ├── ap_lincons0.c ├── ap_lincons0.h ├── ap_lincons1.c ├── ap_lincons1.h ├── ap_linearize.c ├── ap_linearize.h ├── ap_linearize_aux.c ├── ap_linearize_aux.h ├── ap_linexpr0.c ├── ap_linexpr0.h ├── ap_linexpr1.c ├── ap_linexpr1.h ├── ap_manager.c ├── ap_manager.h ├── ap_policy.c ├── ap_policy.h ├── ap_reducedproduct.c ├── ap_reducedproduct.h ├── ap_scalar.c ├── ap_scalar.h ├── ap_tcons0.c ├── ap_tcons0.h ├── ap_tcons1.c ├── ap_tcons1.h ├── ap_texpr0.c ├── ap_texpr0.h ├── ap_texpr1.c ├── ap_texpr1.h ├── ap_var.c ├── ap_var.h ├── apron.texi ├── apronrationale.tex ├── lgpl.texi ├── rationale.texi └── test_texpr0.c ├── apronxx ├── COPYING ├── COPYING.GPL ├── COPYING.LGPL ├── Makefile ├── README ├── apronxx.cc ├── apronxx.hh ├── apronxx_test.cc ├── apronxx_test_result.txt ├── apxx_abstract0.hh ├── apxx_abstract0_inline.hh ├── apxx_abstract1.hh ├── apxx_abstract1_inline.hh ├── apxx_box.hh ├── apxx_box_inline.hh ├── apxx_coeff.hh ├── apxx_coeff_inline.hh ├── apxx_dimension.hh ├── apxx_dimension_inline.hh ├── apxx_environment.hh ├── apxx_environment_inline.hh ├── apxx_expr0.hh ├── apxx_expr1.hh ├── apxx_generator0.hh ├── apxx_generator0_inline.hh ├── apxx_generator1.hh ├── apxx_generator1_inline.hh ├── apxx_interval.hh ├── apxx_interval_inline.hh ├── apxx_lincons0.hh ├── apxx_lincons0_inline.hh ├── apxx_lincons1.hh ├── apxx_lincons1_inline.hh ├── apxx_linexpr0.hh ├── apxx_linexpr0_inline.hh ├── apxx_linexpr1.hh ├── apxx_linexpr1_inline.hh ├── apxx_manager.hh ├── apxx_manager_inline.hh ├── apxx_oct.hh ├── apxx_oct_inline.hh ├── apxx_polka.hh ├── apxx_polka_inline.hh ├── apxx_ppl.hh ├── apxx_ppl_inline.hh ├── apxx_ppl_product.hh ├── apxx_ppl_product_inline.hh ├── apxx_scalar.hh ├── apxx_scalar_inline.hh ├── apxx_t1p.hh ├── apxx_t1p_inline.hh ├── apxx_tcons0.hh ├── apxx_tcons0_inline.hh ├── apxx_tcons1.hh ├── apxx_tcons1_inline.hh ├── apxx_texpr0.hh ├── apxx_texpr0_inline.hh ├── apxx_texpr1.hh ├── apxx_texpr1_inline.hh ├── apxx_var.hh ├── apxx_var_inline.hh └── doc │ └── Doxyfile ├── avoct ├── COPYING ├── Makefile ├── README ├── avo.h ├── avo.idl ├── avo_closure.c ├── avo_fun.h ├── avo_hmat.c ├── avo_internal.h ├── avo_nary.c ├── avo_predicate.c ├── avo_print.c ├── avo_representation.c ├── avo_resize.c ├── avo_test.c ├── avo_transfer.c ├── mltest.ml ├── perlscript_c.pl ├── perlscript_caml.pl └── testall.sh ├── box ├── COPYING ├── Makefile ├── README ├── box.h ├── box.idl ├── box.texi ├── box_assign.c ├── box_assign.h ├── box_config.h ├── box_constructor.c ├── box_constructor.h ├── box_internal.c ├── box_internal.h ├── box_meetjoin.c ├── box_meetjoin.h ├── box_otherops.c ├── box_otherops.h ├── box_policy.c ├── box_policy.h ├── box_representation.c ├── box_representation.h ├── box_resize.c ├── box_resize.h ├── mlexample.ml └── perlscript_caml.pl ├── configure ├── examples ├── COPYING ├── Makefile ├── README ├── example1.c ├── mlexample1.ml ├── mlexample2.ml └── mlexample3.ml ├── fppol ├── COPYING ├── Makefile ├── README ├── bt.c ├── bt.h ├── bv.c ├── bv.h ├── fm.c ├── fm.h ├── fpp.h ├── fpp.idl ├── fpp_config.h ├── fpp_example.c ├── fpp_extract.c ├── fpp_extract.h ├── fpp_fun.h ├── fpp_internal.h ├── fpp_nary.c ├── fpp_predicate.c ├── fpp_print.c ├── fpp_representation.c ├── fpp_resize.c ├── fpp_transfer.c ├── fpp_user.c ├── fpp_user.h ├── fpp_weakjoin.c ├── fpp_weakjoin.h ├── fppol_domain.c ├── fppol_domain.h ├── mltest.ml ├── numitv.c ├── numitv.h ├── perlscript_c.pl ├── perlscript_caml.pl ├── quasi_linear.c ├── quasi_linear.h ├── rlp.c ├── rlp.h └── testall.sh ├── itv ├── COPYING ├── Makefile ├── README ├── itv.c ├── itv.h ├── itv_config.h ├── itv_fun.h ├── itv_linearize.c ├── itv_linearize.h ├── itv_linexpr.c ├── itv_linexpr.h ├── test.c └── test2.c ├── japron ├── COPYING ├── Makefile ├── README ├── apron │ ├── Abstract0.java │ ├── Abstract1.java │ ├── ApronException.java │ ├── Box.java │ ├── Coeff.java │ ├── Dimchange.java │ ├── Dimension.java │ ├── Dimperm.java │ ├── DoubleScalar.java │ ├── Environment.java │ ├── Generator0.java │ ├── Generator1.java │ ├── Interval.java │ ├── Lincons0.java │ ├── Lincons1.java │ ├── Linexpr0.java │ ├── Linexpr1.java │ ├── Linterm0.java │ ├── Linterm1.java │ ├── Manager.java │ ├── MpfrScalar.java │ ├── MpqScalar.java │ ├── NotImplementedException.java │ ├── Octagon.java │ ├── OutOfSpaceException.java │ ├── OverflowException.java │ ├── Polka.java │ ├── PolkaEq.java │ ├── PolkaGrid.java │ ├── PplGrid.java │ ├── PplPoly.java │ ├── Pplite.java │ ├── Scalar.java │ ├── StringVar.java │ ├── Tcons0.java │ ├── Tcons1.java │ ├── Test.java │ ├── TestPplite.java │ ├── Texpr0BinNode.java │ ├── Texpr0CstNode.java │ ├── Texpr0DimNode.java │ ├── Texpr0Intern.java │ ├── Texpr0Node.java │ ├── Texpr0UnNode.java │ ├── Texpr1BinNode.java │ ├── Texpr1CstNode.java │ ├── Texpr1Intern.java │ ├── Texpr1Node.java │ ├── Texpr1UnNode.java │ ├── Texpr1VarNode.java │ ├── TimeoutException.java │ ├── Var.java │ ├── apron_Abstract0.c │ ├── apron_Box.c │ ├── apron_Dimchange.c │ ├── apron_Dimperm.c │ ├── apron_Environment.c │ ├── apron_Lincons0.c │ ├── apron_Linexpr0.c │ ├── apron_Manager.c │ ├── apron_Octagon.c │ ├── apron_Polka.c │ ├── apron_PolkaEq.c │ ├── apron_PolkaGrid.c │ ├── apron_PplGrid.c │ ├── apron_PplPoly.c │ ├── apron_Pplite.c │ ├── apron_Texpr0Intern.c │ ├── apron_Var.c │ ├── japron.c │ ├── japron.h │ └── package-info.java └── gmp │ ├── Mpfr.java │ ├── Mpq.java │ ├── Mpz.java │ ├── MpzRef.java │ ├── RandState.java │ ├── Test.java │ ├── gmp_Mpfr.c │ ├── gmp_Mpq.c │ ├── gmp_Mpz.c │ ├── gmp_MpzRef.c │ ├── gmp_RandState.c │ ├── jgmp.c │ ├── jgmp.h │ └── package-info.java ├── mlapronidl ├── COPYING ├── META.in ├── META.ppl.in ├── META.pplite.in ├── Makefile ├── README ├── abstract0.idl ├── abstract1.idl ├── apron_caml.c ├── apron_caml.h ├── apron_lexer.mli ├── apron_lexer.mll ├── apron_parser.mly ├── coeff.idl ├── dim.idl ├── disjunction.idl ├── environment.idl ├── generator0.idl ├── generator1.idl ├── interval.idl ├── introduction.mli ├── introduction.odoc ├── lincons0.idl ├── lincons1.idl ├── linexpr0.idl ├── linexpr1.idl ├── macros.pl ├── manager.idl ├── mlapronidl.odoc ├── mlapronidl.tex ├── parser.ml ├── parser.mli ├── perlscript_c.pl ├── perlscript_caml.pl ├── policy.idl ├── scalar.idl ├── tcons0.idl ├── tcons1.idl ├── texpr0.idl ├── texpr1.idl ├── var.idl └── version.idl ├── newpolka ├── COPYING ├── Makefile ├── README ├── mlexample.ml ├── newpolka.texi ├── perlscript_caml.pl ├── pk.h ├── pk_approximate.c ├── pk_assign.c ├── pk_assign.h ├── pk_bit.c ├── pk_bit.h ├── pk_cherni.c ├── pk_cherni.h ├── pk_closure.c ├── pk_config.h ├── pk_constructor.c ├── pk_constructor.h ├── pk_expandfold.c ├── pk_extract.c ├── pk_extract.h ├── pk_internal.c ├── pk_internal.h ├── pk_matrix.c ├── pk_matrix.h ├── pk_meetjoin.c ├── pk_meetjoin.h ├── pk_project.c ├── pk_qsort.h ├── pk_representation.c ├── pk_representation.h ├── pk_resize.c ├── pk_resize.h ├── pk_satmat.c ├── pk_satmat.h ├── pk_test.c ├── pk_test.h ├── pk_user.c ├── pk_user.h ├── pk_vector.c ├── pk_vector.h ├── pk_widening.c ├── pkeq.c ├── pkeq.h ├── polka.idl ├── test.c ├── test.ml ├── test0.c ├── test1.c └── test_environment.c ├── num ├── COPYING ├── Makefile ├── README ├── bound.h ├── bound_def.h ├── essai.c ├── num.h ├── num_config.h ├── num_name.h ├── num_numflt.h ├── num_numint.h ├── num_numrat.h ├── numflt.h ├── numflt_mpfr.h ├── numflt_native.h ├── numint.h ├── numint_mpz.h ├── numint_native.h ├── numrat.h ├── numrat_mpq.h ├── numrat_native.h └── test.c ├── ocamlpack ├── octagons ├── COPYING ├── Makefile ├── README ├── mlexample.ml ├── mltest.ml ├── oct.h ├── oct.idl ├── oct_closure.c ├── oct_doc.html ├── oct_fun.h ├── oct_hmat.c ├── oct_internal.h ├── oct_nary.c ├── oct_predicate.c ├── oct_print.c ├── oct_representation.c ├── oct_resize.c ├── oct_test.c ├── oct_transfer.c ├── perlscript_c.pl ├── perlscript_caml.pl └── testall.sh ├── ppl ├── COPYING ├── Makefile ├── README ├── ap_ppl.h ├── ap_ppl.texi ├── mlexample.ml ├── perlscript_caml.pl ├── ppl.idl ├── ppl.patch ├── ppl_grid.cc ├── ppl_grid.h ├── ppl_grid.hh ├── ppl_poly.cc ├── ppl_poly.hh ├── ppl_test.c ├── ppl_user.cc └── ppl_user.hh ├── pplite ├── COPYING ├── Makefile ├── README ├── ap_pplite.h ├── ap_pplite.texi ├── ap_pplite_test.c ├── mlexample.ml ├── mlexample_adhoc.ml ├── perlscript_c.pl ├── perlscript_caml.pl ├── pplite.idl ├── pplite_poly.cc ├── pplite_poly.hh ├── pplite_user.cc └── pplite_user.hh ├── products ├── COPYING ├── Makefile ├── README ├── ap_disjpk.h ├── ap_pkgrid.c ├── ap_pkgrid.h ├── ap_pkgrid.texi ├── mlexample.ml ├── perlscript_caml.pl └── polkaGrid.idl ├── taylor1plus ├── Makefile ├── README.md ├── examples │ ├── InterL2.apron │ ├── InterQ1.apron │ ├── InterQ2.apron │ ├── ItvPoly.apron │ ├── Ln1px.apron │ ├── RunningExemple.apron │ ├── SinCos.apron │ ├── benchs │ │ ├── linear │ │ │ ├── InterL10.spl │ │ │ ├── InterL100.spl │ │ │ ├── InterL200.spl │ │ │ ├── InterL300.spl │ │ │ ├── InterL400.spl │ │ │ ├── InterL50.spl │ │ │ └── InterL500.spl │ │ ├── quadra │ │ │ ├── InterQ10.spl │ │ │ ├── InterQ100.spl │ │ │ ├── InterQ150.spl │ │ │ ├── InterQ200.spl │ │ │ ├── InterQ250.spl │ │ │ ├── InterQ300.spl │ │ │ ├── InterQ400.spl │ │ │ ├── InterQ50.spl │ │ │ └── InterQ500.spl │ │ └── stolfi │ │ │ ├── stolfi1.spl │ │ │ ├── stolfi10.spl │ │ │ ├── stolfi100.spl │ │ │ ├── stolfi11.spl │ │ │ ├── stolfi13.spl │ │ │ ├── stolfi2.spl │ │ │ ├── stolfi200.spl │ │ │ ├── stolfi3.spl │ │ │ ├── stolfi30.spl │ │ │ ├── stolfi300.spl │ │ │ ├── stolfi4.spl │ │ │ ├── stolfi40.spl │ │ │ ├── stolfi400.spl │ │ │ ├── stolfi45.spl │ │ │ ├── stolfi5.spl │ │ │ ├── stolfi50.spl │ │ │ ├── stolfi500.spl │ │ │ ├── stolfi55.spl │ │ │ ├── stolfi6.spl │ │ │ ├── stolfi7.spl │ │ │ ├── stolfi8.spl │ │ │ └── stolfi9.spl │ └── cosine.apron ├── param.csdp ├── perlscript_caml.pl ├── t1p.h ├── t1p.idl ├── t1p_assign.c ├── t1p_assign.h ├── t1p_constructor.c ├── t1p_constructor.h ├── t1p_fun.c ├── t1p_fun.h ├── t1p_internal.c ├── t1p_internal.h ├── t1p_itv_utils.c ├── t1p_itv_utils.h ├── t1p_macro_def.h ├── t1p_meetjoin.c ├── t1p_meetjoin.h ├── t1p_otherops.c ├── t1p_otherops.h ├── t1p_representation.c ├── t1p_representation.h ├── t1p_resize.c ├── t1p_resize.h ├── t1p_test.c └── t1p_test_eval_texp.c ├── test ├── COPYING ├── Makefile ├── README ├── ctest1.c ├── ctest2.c ├── ctest3.c ├── mlexample0.ml └── sorttest.c ├── vars.mk └── version.mk /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.a 3 | *.exe 4 | *.so 5 | *.class 6 | *.jar 7 | 8 | Makefile.config 9 | *.cm? 10 | *.cmx? 11 | *~ 12 | *# 13 | **/depend 14 | **/tmp 15 | apronxx/apronxx_test 16 | box/box.ml 17 | box/box.mli 18 | box/box_caml.c 19 | japron/apron/apron_*.h 20 | japron/gmp/gmp_*.h 21 | mlapronidl/abstract0.ml 22 | mlapronidl/abstract0.mli 23 | mlapronidl/abstract0_caml.c 24 | mlapronidl/abstract1.ml 25 | mlapronidl/abstract1.mli 26 | mlapronidl/abstract1_caml.c 27 | mlapronidl/apron_lexer.ml 28 | mlapronidl/apron_ocamldoc.mli 29 | mlapronidl/apron_parser.ml 30 | mlapronidl/apron_parser.mli 31 | mlapronidl/coeff.ml 32 | mlapronidl/coeff.mli 33 | mlapronidl/coeff_caml.c 34 | mlapronidl/dim.ml 35 | mlapronidl/dim.mli 36 | mlapronidl/dim_caml.c 37 | mlapronidl/disjunction.ml 38 | mlapronidl/disjunction.mli 39 | mlapronidl/disjunction_caml.c 40 | mlapronidl/environment.ml 41 | mlapronidl/environment.mli 42 | mlapronidl/environment_caml.c 43 | mlapronidl/generator0.ml 44 | mlapronidl/generator0.mli 45 | mlapronidl/generator0_caml.c 46 | mlapronidl/generator1.ml 47 | mlapronidl/generator1.mli 48 | mlapronidl/generator1_caml.c 49 | mlapronidl/interval.ml 50 | mlapronidl/interval.mli 51 | mlapronidl/interval_caml.c 52 | mlapronidl/lincons0.ml 53 | mlapronidl/lincons0.mli 54 | mlapronidl/lincons0_caml.c 55 | mlapronidl/lincons1.ml 56 | mlapronidl/lincons1.mli 57 | mlapronidl/lincons1_caml.c 58 | mlapronidl/linexpr0.ml 59 | mlapronidl/linexpr0.mli 60 | mlapronidl/linexpr0_caml.c 61 | mlapronidl/linexpr1.ml 62 | mlapronidl/linexpr1.mli 63 | mlapronidl/linexpr1_caml.c 64 | mlapronidl/manager.ml 65 | mlapronidl/manager.mli 66 | mlapronidl/manager_caml.c 67 | mlapronidl/policy.ml 68 | mlapronidl/policy.mli 69 | mlapronidl/policy_caml.c 70 | mlapronidl/scalar.ml 71 | mlapronidl/scalar.mli 72 | mlapronidl/scalar_caml.c 73 | mlapronidl/tcons0.ml 74 | mlapronidl/tcons0.mli 75 | mlapronidl/tcons0_caml.c 76 | mlapronidl/tcons1.ml 77 | mlapronidl/tcons1.mli 78 | mlapronidl/tcons1_caml.c 79 | mlapronidl/texpr0.ml 80 | mlapronidl/texpr0.mli 81 | mlapronidl/texpr0_caml.c 82 | mlapronidl/texpr1.ml 83 | mlapronidl/texpr1.mli 84 | mlapronidl/texpr1_caml.c 85 | mlapronidl/var.ml 86 | mlapronidl/var.mli 87 | mlapronidl/var_caml.c 88 | newpolka/polka.ml 89 | newpolka/polka.mli 90 | newpolka/polka_caml.c 91 | octagons/oct.ml 92 | octagons/oct.mli 93 | octagons/oct_caml.c 94 | octagons/oct* 95 | ppl/ap_ppl_caml.c 96 | ppl/ap_ppl_test 97 | ppl/ppl.ml 98 | ppl/ppl.mli 99 | products/polkaGrid.ml 100 | products/polkaGrid.mli 101 | products/polkaGrid_caml.c 102 | taylor1plus/t1p.ml 103 | taylor1plus/t1p.mli 104 | taylor1plus/t1p_caml.c 105 | 106 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | 2 | The APRON interface has been designed by the research teams involved in the 3 | APRON project (http://www.cri.ensmp.fr/apron/). 4 | 5 | The related software developpements have been conducted by the following 6 | people: 7 | 8 | Bertrand Jeannet Main author of num, mlgmpidl, apron, mlapronidl, 9 | and newpolka packages. 10 | 11 | Sebastian Pop Adaptation of the Omega library (to come). 12 | 13 | Antoine Mine Author of the Octagon Abstract Domain Library and its 14 | adaptation to APRON interface. 15 | Binding to the Parma Polyhedra Library. 16 | Author of num package. 17 | -------------------------------------------------------------------------------- /Changes: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoinemine/apron/2d0027326748b81026e2e8a711913be748b6ecca/Changes -------------------------------------------------------------------------------- /README.mac: -------------------------------------------------------------------------------- 1 | This document is no longer up to date. 2 | 3 | --------------- 4 | 5 | This document tries to explain some specific points in compiling Apron under 6 | Macintosh. It brings additional information compared to the README. 7 | 8 | Note that this is work-in-progress. 9 | 10 | PREREQUISITES 11 | ------------- 12 | 13 | - GNU sed is required, instead of standard sed. 14 | 15 | - gcc 4.0.1 is reported to cause this problem at the end of the compilation 16 | process: 17 | 18 | ld: duplicate symbol ___gmpz_abs in ... 19 | 20 | more recent versions should work properly. 21 | 22 | The following Cygwin package are required: 23 | - gcc (Devel) 24 | - make (Devel) 25 | - gmp, mpfr (Math) 26 | - doxygen (Devel) 27 | - tetex-base (Publishing) 28 | 29 | Additionally, you'll need to install manually the following 30 | 31 | - OCaml 3.09 or better, from http://caml.inria.fr/ocaml/release.fr.html 32 | (the 3.08 version, in CygWin, at the time of writing is too old) 33 | 34 | - CamlIDL, from http://caml.inria.fr/pub/old_caml_site/camlidl/ 35 | 36 | 37 | CONFIGURATION 38 | ------------- 39 | 40 | Copy Makefile.config.model into Makefile.config and edit the _PREFIX paths to 41 | suit your installation (you might want to set APRON_PREFIX, CAMLIDL_PREFIX 42 | and CAML_PREFIX to /usr/local instead of the default /usr). 43 | 44 | The following options should be disabled: 45 | - HAS_CPP (Cygwin's gcc is too old) 46 | - HAS_PPL (Apron with PPL compilation untested under Windows) 47 | - HAS_LONG_DOUBLE (long double not supported by math library under Windows) 48 | 49 | Do the same with mlgmpidl/Makefile.config.model 50 | 51 | Now, (make rebuild), make and make install in the apron top-level directory 52 | should work. 53 | -------------------------------------------------------------------------------- /README.windows.md: -------------------------------------------------------------------------------- 1 | This document explain how to compile Apron under Windows. 2 | For the moment, only compilation using the OCaml Mingw port is supported. 3 | 4 | ## Prerequisites 5 | 6 | Install an OCaml Mingw 64 bits environment by following the instructions at 7 | https://fdopen.github.io/opam-repository-mingw, and selecting 8 | a `mingw64` version of the OCaml compiler. 9 | 10 | Under Cygwin, install the following Mingw libraries: 11 | * mingw64-x86_64-gmp 12 | * mingw64-x86_64-mpfr 13 | 14 | ## Automatic installation 15 | 16 | Use Opam to install Apron: `opam install apron`. 17 | Everything should work out-of-the-box. 18 | 19 | 20 | ## Manual installation 21 | 22 | Use Opam to install Apron's dependencies: 23 | * `opam install ocamlfind camlidl mlgmpidl conf-gmp conf-mpfr`. 24 | 25 | Then launch Apron's `configure` script with the following options: 26 | * `--ext-dll dll` to specify that dynamic libraries have 27 | a `.dll` extension. 28 | * `--no-ppl` to deactivate support for the PPL, which gets automatically 29 | detected (even when non-present) 30 | * `--no-cxx` to deactivate support for the C++ API, which compilation fails 31 | under Cygwin 32 | * `--prefix /path/to/installation/` 33 | 34 | Next, make sure `perl` is in your PATH, and edit the resulting 35 | `Makefile.config`. `PERL` must be set to `perl` instead of 36 | `/usr/bin/perl`, as CamlIDL expects a Windows path instead of a Cygwin one. 37 | 38 | Finally, compile and install as usual: `make`, `make install`. 39 | -------------------------------------------------------------------------------- /apron.opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | synopsis: "APRON numerical abstract domain library" 3 | authors: [ 4 | "Bertrand Jeannet" 5 | "Antoine Miné" 6 | "https://github.com/antoinemine/apron/graphs/contributors" 7 | ] 8 | license: "LGPL-2.1-only WITH OCaml-LGPL-linking-exception" 9 | homepage: "https://antoinemine.github.io/Apron/doc/" 10 | maintainer: "Nicolas Berthier " 11 | dev-repo: "git+https://github.com/antoinemine/apron.git" 12 | bug-reports: "https://github.com/antoinemine/apron/issues" 13 | build: [ 14 | [ 15 | "sh" 16 | "./configure" 17 | "--prefix" 18 | "%{share}%/apron" 19 | "--no-ppl" {!conf-ppl:installed} 20 | "--no-ocaml-plugins" {os = "freebsd"} 21 | "--absolute-dylibs" {os = "macos"} 22 | "--ext-dll" {os = "win32"} "dll" {os = "win32"} 23 | "--debug" 24 | "--no-strip" 25 | ] 26 | [make "-j%{jobs}%"] 27 | ] 28 | install: [ 29 | [make "install"] 30 | ] 31 | depends: [ 32 | "ocaml" 33 | "ocamlfind" {build} 34 | "camlidl" 35 | "mlgmpidl" 36 | "ocamlbuild" {build} 37 | "conf-perl" 38 | ] 39 | depopts: [ 40 | "conf-ppl" 41 | ] 42 | description:""" 43 | Apron is a library to represent properties of numeric variables, such as variable bounds or linear relations between variables, and to manipulate these properties through semantic operations, such as variable assignments, tests, conjunctions, entailment. Apron is intended to be used in static program analyzers, in order to infer invariants of numeric variables, i.e., properties that hold for all executions of a program. It is based on the theory of Abstract Interpretation.""" 44 | -------------------------------------------------------------------------------- /apron/README: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | 3 | # This file is part of the APRON Library, released under LGPL license 4 | # with an exception allowing the redistribution of statically linked 5 | # executables. 6 | 7 | # Please read the COPYING file packaged in the distribution 8 | 9 | Source for APRON commoninterface files. 10 | 11 | To compile and/or to generate the doc, you need: 12 | * the GMP and MPFR libraries, for multiprecision arithmetic) 13 | * the ITV library (included) 14 | 15 | You need to generate a Makefile.config file from the 16 | Makefile.config.model in the parent directory of this file. 17 | 18 | Most useful make targets: 19 | 20 | all: 21 | C library (libapron.a libapron_debug.a, libapron.so) 22 | (note: they include libitv.a) 23 | apron.ps 24 | apron.info: 25 | apron.html: 26 | the documentation 27 | 28 | clean: 29 | distclean: 30 | 31 | Header files associated to C files and considered as modules: 32 | ap_scalar.h : scalars (numbers) 33 | ap_interval.h : intervals on scalars 34 | ap_coeff.h : coefficients (either scalars or intervals) 35 | ap_dimension.h : dimensions and related operations 36 | ap_linexpr0.h : (interval) linear expressions, level 0 37 | ap_lincons0.h : (interval) linear constraints, level 0 38 | ap_generator0.h : generators, level 0 39 | ap_texpr0.h : tree expressions, level 0 40 | ap_tcons0.h : tree constraints, level 0 41 | ap_manager.h : managers 42 | ap_policy.h : policy iterations 43 | ap_abstract0.h: : abstract values, level 0 44 | ap_var.h : variables 45 | ap_environment.h: environment binding variables to dimensions 46 | ap_linexpr1.h : (interval) linear expressions, level 1 47 | ap_lincons1.h : (interval) linear constraints, level 1 48 | ap_generator1.h : generators, level 1 49 | ap_texpr0.h : tree expressions, level 1 50 | ap_tcons0.h : tree constraints, level 1 51 | ap_abstract1.h : abstract values, level 1 52 | ap_generic.h : generic functions for library adaptors/implementors 53 | ap_linearize.h : generic functions for (quasi)linearisation of interval 54 | expressions and tree expressions. 55 | 56 | Additional header files: 57 | ap_config.h : miscellaneous stuff (booleans, ...) 58 | ap_expr0.h : expressions, constraints, .. at level 0 59 | ap_expr1.h : expressions, constraints, .. at level 1 60 | ap_global0.h : all stuff relevant for level 0 61 | ap_global1.h : all stuff relevant for level 1 62 | 63 | * When linking objects against APRON, APRON requires: 64 | libmpfr(.a) and libgmp(.a) libraries. 65 | 66 | It already include libitv(.a) 67 | -------------------------------------------------------------------------------- /apron/ap_config.h: -------------------------------------------------------------------------------- 1 | /* ************************************************************************* */ 2 | /* ap_config.h */ 3 | /* ************************************************************************* */ 4 | 5 | /* This file is part of the APRON Library, released under LGPL license 6 | with an exception allowing the redistribution of statically linked 7 | executables. 8 | 9 | Please read the COPYING file packaged in the distribution */ 10 | 11 | #ifndef _AP_CONFIG_H_ 12 | #define _AP_CONFIG_H_ 13 | 14 | #include 15 | #include 16 | 17 | #ifdef __cplusplus 18 | #define HAS_BOOL 19 | extern "C" { 20 | #endif 21 | 22 | #ifndef HAS_BOOL 23 | #define HAS_BOOL 24 | typedef char bool; 25 | static const bool false = 0; 26 | static const bool true = 1; 27 | #endif 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /apron/ap_expr0.h: -------------------------------------------------------------------------------- 1 | /* ************************************************************************* */ 2 | /* ap_expr0.h: linear expressions, constraints and generators */ 3 | /* ************************************************************************* */ 4 | 5 | /* This file is part of the APRON Library, released under LGPL license 6 | with an exception allowing the redistribution of statically linked 7 | executables. 8 | 9 | Please read the COPYING file packaged in the distribution */ 10 | 11 | #ifndef _AP_EXPR0_H_ 12 | #define _AP_EXPR0_H_ 13 | 14 | #include "ap_linexpr0.h" 15 | #include "ap_lincons0.h" 16 | #include "ap_generator0.h" 17 | #include "ap_texpr0.h" 18 | #include "ap_tcons0.h" 19 | #include "ap_linearize.h" 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /apron/ap_expr1.h: -------------------------------------------------------------------------------- 1 | /* ************************************************************************* */ 2 | /* ap_expr1.h: datatypes for dimensions, expressions and constraints */ 3 | /* ************************************************************************* */ 4 | 5 | /* This file is part of the APRON Library, released under LGPL license 6 | with an exception allowing the redistribution of statically linked 7 | executables. 8 | 9 | Please read the COPYING file packaged in the distribution */ 10 | 11 | #ifndef _AP_EXPR1_H_ 12 | #define _AP_EXPR1_H_ 13 | 14 | #include "ap_linexpr1.h" 15 | #include "ap_lincons1.h" 16 | #include "ap_generator1.h" 17 | #include "ap_texpr1.h" 18 | #include "ap_tcons1.h" 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /apron/ap_global0.h: -------------------------------------------------------------------------------- 1 | /* ********************************************************************** */ 2 | /* ap_global0.h: level 0 */ 3 | /* ********************************************************************** */ 4 | 5 | /* This file is part of the APRON Library, released under LGPL license 6 | with an exception allowing the redistribution of statically linked 7 | executables. 8 | 9 | Please read the COPYING file packaged in the distribution */ 10 | 11 | #ifndef _AP_GLOBAL0_H_ 12 | #define _AP_GLOBAL0_H_ 13 | 14 | #include "ap_config.h" 15 | #include "ap_scalar.h" 16 | #include "ap_interval.h" 17 | #include "ap_coeff.h" 18 | #include "ap_dimension.h" 19 | #include "ap_linexpr0.h" 20 | #include "ap_lincons0.h" 21 | #include "ap_generator0.h" 22 | #include "ap_texpr0.h" 23 | #include "ap_tcons0.h" 24 | #include "ap_manager.h" 25 | #include "ap_abstract0.h" 26 | #include "ap_version.h" 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /apron/ap_global1.h: -------------------------------------------------------------------------------- 1 | /* ********************************************************************** */ 2 | /* ap_global1.h: level 1 */ 3 | /* ********************************************************************** */ 4 | 5 | /* This file is part of the APRON Library, released under LGPL license 6 | with an exception allowing the redistribution of statically linked 7 | executables. 8 | 9 | Please read the COPYING file packaged in the distribution */ 10 | 11 | #ifndef _AP_GLOBAL1_H_ 12 | #define _AP_GLOBAL1_H_ 13 | 14 | #include "ap_global0.h" 15 | 16 | #include "ap_var.h" 17 | #include "ap_environment.h" 18 | #include "ap_linexpr1.h" 19 | #include "ap_lincons1.h" 20 | #include "ap_generator1.h" 21 | #include "ap_abstract1.h" 22 | #include "ap_version.h" 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /apron/ap_var.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************* */ 2 | /* ap_var.c: generic variables */ 3 | /* ************************************************************************* */ 4 | 5 | /* This file is part of the APRON Library, released under LGPL license 6 | with an exception allowing the redistribution of statically linked 7 | executables. 8 | 9 | Please read the COPYING file packaged in the distribution */ 10 | 11 | #include 12 | #include 13 | #include "ap_manager.h" 14 | #include "ap_var.h" 15 | 16 | static int var_compare_default(void* v1, void* v2){ 17 | return (v1==v2) ? 0 : strcmp((char*)v1,(char*)v2); 18 | } 19 | static int var_hash_default(void* v){ 20 | unsigned char* c; 21 | int res = 0; 22 | for (c=(unsigned char*)v; (*c)!=0; c++){ 23 | res = res * 11 + (*c); 24 | } 25 | return res; 26 | } 27 | static void* var_copy_default(void* v){ 28 | return strdup((char*)v); 29 | } 30 | static void var_free_default(void* v){ 31 | free(v); 32 | } 33 | static char* var_to_string_default(void* v){ 34 | return strdup((char*)v); 35 | } 36 | 37 | struct ap_var_operations_t ap_var_operations_default = { 38 | var_compare_default, 39 | var_hash_default, 40 | var_copy_default, 41 | var_free_default, 42 | var_to_string_default 43 | }; 44 | 45 | ap_var_operations_t* ap_var_operations = &ap_var_operations_default; 46 | -------------------------------------------------------------------------------- /apron/ap_var.h: -------------------------------------------------------------------------------- 1 | /* ********************************************************************** */ 2 | /* ap_var.h: variables (strings or user-defined) */ 3 | /* ********************************************************************** */ 4 | 5 | /* This file is part of the APRON Library, released under LGPL license 6 | with an exception allowing the redistribution of statically linked 7 | executables. 8 | 9 | Please read the COPYING file packaged in the distribution */ 10 | 11 | #ifndef _AP_VAR_H_ 12 | #define _AP_VAR_H_ 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | 19 | /* ====================================================================== */ 20 | /* Datatype */ 21 | /* ====================================================================== */ 22 | 23 | /* The abstract type ap_var_t is 24 | equipped with a total ordering function, a copy function, 25 | and a free function. 26 | 27 | The parametrization is done via a global variable pointing to an 28 | ap_var_operations_t structure. 29 | */ 30 | 31 | typedef void* ap_var_t; 32 | 33 | typedef struct ap_var_operations_t { 34 | int (*compare)(ap_var_t v1, ap_var_t v2); /* Total ordering function */ 35 | int (*hash)(ap_var_t v); /* Hash function */ 36 | ap_var_t (*copy)(ap_var_t var); /* Duplication function */ 37 | void (*free)(ap_var_t var); /* Deallocation function */ 38 | char* (*to_string)(ap_var_t var); /* Conversion to a dynamically allocated string */ 39 | } ap_var_operations_t; 40 | 41 | extern ap_var_operations_t ap_var_operations_default; 42 | /* default manager: ap_var_t are char* */ 43 | 44 | extern ap_var_operations_t* ap_var_operations; 45 | /* points to manager in use, by default ap_var_operations_default */ 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /apron/apronrationale.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoinemine/apron/2d0027326748b81026e2e8a711913be748b6ecca/apron/apronrationale.tex -------------------------------------------------------------------------------- /apronxx/apronxx.hh: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * apronxx.hh 3 | * 4 | * APRON Library / C++ class wrappers 5 | * 6 | * Copyright (C) Antoine Mine' 2007 7 | * 8 | */ 9 | /* This file is part of the APRON Library, released under LGPL license 10 | with an exception allowing the redistribution of statically linked 11 | executables. 12 | 13 | Please read the COPYING file packaged in the distribution. 14 | */ 15 | 16 | #ifndef __APRONXX_HH 17 | #define __APRONXX_HH 18 | 19 | #include "apxx_scalar.hh" 20 | #include "apxx_interval.hh" 21 | #include "apxx_coeff.hh" 22 | #include "apxx_dimension.hh" 23 | #include "apxx_manager.hh" 24 | #include "apxx_expr0.hh" 25 | #include "apxx_abstract0.hh" 26 | #include "apxx_expr1.hh" 27 | #include "apxx_abstract1.hh" 28 | 29 | #endif /* __APRONXX_HH */ 30 | -------------------------------------------------------------------------------- /apronxx/apxx_box.hh: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * apxx_box.hh 3 | * 4 | * APRON Library / C++ class wrappers 5 | * 6 | * Copyright (C) Antoine Mine' 2007 7 | * 8 | */ 9 | /* This file is part of the APRON Library, released under LGPL license 10 | with an exception allowing the redistribution of statically linked 11 | executables. 12 | 13 | Please read the COPYING file packaged in the distribution. 14 | */ 15 | 16 | #ifndef __APXX_BOX_HH 17 | #define __APXX_BOX_HH 18 | 19 | #include "apxx_manager.hh" 20 | 21 | #include "box.h" 22 | 23 | namespace apron { 24 | 25 | //! Manager factory for the Box interval-domain library. 26 | class box_manager : public manager { 27 | 28 | public: 29 | 30 | //! \brief Creates a new manager. 31 | box_manager(); 32 | 33 | //! Copy operator. 34 | manager& operator=(const manager&); 35 | }; 36 | 37 | #include "apxx_box_inline.hh" 38 | 39 | } 40 | 41 | #endif /* __APXX_BOX_HH */ 42 | -------------------------------------------------------------------------------- /apronxx/apxx_box_inline.hh: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * apxx_box_inline.hh 3 | * 4 | * APRON Library / C++ inline functions 5 | * 6 | * DO NOT INCLUDE THIS FILE DIRECTLY 7 | * 8 | * Copyright (C) Antoine Mine' 2007 9 | * 10 | */ 11 | /* This file is part of the APRON Library, released under LGPL license 12 | with an exception allowing the redistribution of statically linked 13 | executables. 14 | 15 | Please read the COPYING file packaged in the distribution. 16 | */ 17 | 18 | inline box_manager::box_manager() 19 | : manager(box_manager_alloc()) 20 | {} 21 | 22 | inline manager& box_manager::operator=(const manager& m) 23 | { 24 | return manager::operator=(m); 25 | } 26 | -------------------------------------------------------------------------------- /apronxx/apxx_expr0.hh: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * apxx_expr0.hh 3 | * 4 | * APRON Library / C++ class wrappers 5 | * 6 | * Copyright (C) Antoine Mine' 2007 7 | * 8 | */ 9 | /* This file is part of the APRON Library, released under LGPL license 10 | with an exception allowing the redistribution of statically linked 11 | executables. 12 | 13 | Please read the COPYING file packaged in the distribution. 14 | */ 15 | 16 | #ifndef __APXX_EXPR0_HH 17 | #define __APXX_EXPR0_HH 18 | 19 | #include "apxx_linexpr0.hh" 20 | #include "apxx_lincons0.hh" 21 | #include "apxx_generator0.hh" 22 | #include "apxx_texpr0.hh" 23 | #include "apxx_tcons0.hh" 24 | 25 | #endif /* __APXX_EXPR0_HH */ 26 | -------------------------------------------------------------------------------- /apronxx/apxx_expr1.hh: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * apxx_expr1.hh 3 | * 4 | * APRON Library / C++ class wrappers 5 | * 6 | * Copyright (C) Antoine Mine' 2007 7 | * 8 | */ 9 | /* This file is part of the APRON Library, released under LGPL license 10 | with an exception allowing the redistribution of statically linked 11 | executables. 12 | 13 | Please read the COPYING file packaged in the distribution. 14 | */ 15 | 16 | #ifndef __APXX_EXPR1_HH 17 | #define __APXX_EXPR1_HH 18 | 19 | #include "apxx_linexpr1.hh" 20 | #include "apxx_lincons1.hh" 21 | #include "apxx_generator1.hh" 22 | #include "apxx_texpr1.hh" 23 | #include "apxx_tcons1.hh" 24 | 25 | #endif /* __APXX_EXPR1_HH */ 26 | -------------------------------------------------------------------------------- /apronxx/apxx_oct.hh: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * apxx_oct.hh 3 | * 4 | * APRON Library / C++ class wrappers 5 | * 6 | * Copyright (C) Antoine Mine' 2007 7 | * 8 | */ 9 | /* This file is part of the APRON Library, released under LGPL license 10 | with an exception allowing the redistribution of statically linked 11 | executables. 12 | 13 | Please read the COPYING file packaged in the distribution. 14 | */ 15 | 16 | #ifndef __APXX_OCT_HH 17 | #define __APXX_OCT_HH 18 | 19 | #include "apxx_manager.hh" 20 | 21 | #include "oct.h" 22 | 23 | namespace apron { 24 | 25 | //! Manager factory for the Octagon domain library. 26 | class oct_manager : public manager { 27 | 28 | public: 29 | 30 | //! \brief Creates a new manager. 31 | oct_manager(); 32 | 33 | //! Copy operator. 34 | manager& operator=(const manager&); 35 | }; 36 | 37 | #include "apxx_oct_inline.hh" 38 | 39 | } 40 | 41 | #endif /* __APXX_OCT_HH */ 42 | -------------------------------------------------------------------------------- /apronxx/apxx_oct_inline.hh: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * apxx_oct_inline.hh 3 | * 4 | * APRON Library / C++ inline functions 5 | * 6 | * DO NOT INCLUDE THIS FILE DIRECTLY 7 | * 8 | * Copyright (C) Antoine Mine' 2007 9 | * 10 | */ 11 | /* This file is part of the APRON Library, released under LGPL license 12 | with an exception allowing the redistribution of statically linked 13 | executables. 14 | 15 | Please read the COPYING file packaged in the distribution. 16 | */ 17 | 18 | inline oct_manager::oct_manager() 19 | : manager(oct_manager_alloc()) 20 | {} 21 | 22 | inline manager& oct_manager::operator=(const manager& m) 23 | { 24 | return manager::operator=(m); 25 | } 26 | -------------------------------------------------------------------------------- /apronxx/apxx_polka.hh: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * apxx_polka.hh 3 | * 4 | * APRON Library / C++ class wrappers 5 | * 6 | * Copyright (C) Antoine Mine' 2007 7 | * 8 | */ 9 | /* This file is part of the APRON Library, released under LGPL license 10 | with an exception allowing the redistribution of statically linked 11 | executables. 12 | 13 | Please read the COPYING file packaged in the distribution. 14 | */ 15 | 16 | #ifndef __APXX_POLKA_HH 17 | #define __APXX_POLKA_HH 18 | 19 | #include "apxx_manager.hh" 20 | 21 | #include "pk.h" 22 | 23 | namespace apron { 24 | 25 | //! Manager factory for the NewPolka polyhedra library. 26 | class polka_manager : public manager { 27 | 28 | public: 29 | 30 | /*! \brief Creates a new manager. 31 | * 32 | * \arg \c strict whether to allow strict inequalities as well as non-strict inequalities. 33 | * 34 | * Note that abstract values created with strict and non-strict managers 35 | * are not compatible. 36 | */ 37 | polka_manager(bool strict = false); 38 | 39 | //! Copy operator. 40 | manager& operator=(const manager&); 41 | }; 42 | 43 | #include "apxx_polka_inline.hh" 44 | 45 | } 46 | 47 | #endif /* __APXX_POLKA_HH */ 48 | -------------------------------------------------------------------------------- /apronxx/apxx_polka_inline.hh: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * apxx_polka_inline.hh 3 | * 4 | * APRON Library / C++ inline functions 5 | * 6 | * DO NOT INCLUDE THIS FILE DIRECTLY 7 | * 8 | * Copyright (C) Antoine Mine' 2007 9 | * 10 | */ 11 | /* This file is part of the APRON Library, released under LGPL license 12 | with an exception allowing the redistribution of statically linked 13 | executables. 14 | 15 | Please read the COPYING file packaged in the distribution. 16 | */ 17 | 18 | inline polka_manager::polka_manager(bool strict) 19 | : manager(pk_manager_alloc(strict)) 20 | {} 21 | 22 | inline manager& polka_manager::operator=(const manager& m) 23 | { 24 | return manager::operator=(m); 25 | } 26 | -------------------------------------------------------------------------------- /apronxx/apxx_ppl.hh: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * apxx_ppl.hh 3 | * 4 | * APRON Library / C++ class wrappers 5 | * 6 | * Copyright (C) Antoine Mine' 2007 7 | * 8 | */ 9 | /* This file is part of the APRON Library. 10 | As it includes both APRON and PPL files, it is released under GPL license. 11 | Please read the ppl/COPYING file packaged in the distribution. 12 | */ 13 | 14 | #ifndef __APXX_PPL_HH 15 | #define __APXX_PPL_HH 16 | 17 | #include "apxx_manager.hh" 18 | 19 | #include "ap_ppl.h" 20 | 21 | namespace apron { 22 | 23 | //! Manager factory for polyhedra domain using the PPL library. 24 | class ppl_poly_manager : public manager { 25 | 26 | public: 27 | 28 | /*! \brief Creates a new manager. 29 | * 30 | * \arg \c strict whether to allow strict inequalities as well as non-strict inequalities. 31 | * 32 | * Note that abstract values created with strict and non-strict managers 33 | * are not compatible. 34 | */ 35 | ppl_poly_manager(bool strict = false); 36 | 37 | //! Copy operator. 38 | manager& operator=(const manager&); 39 | }; 40 | 41 | //! Manager factory for grid domain using the PPL library. 42 | class ppl_grid_manager : public manager { 43 | 44 | public: 45 | 46 | //! Creates a new manager. 47 | ppl_grid_manager(); 48 | 49 | //! Copy operator. 50 | manager& operator=(const manager&); 51 | }; 52 | 53 | #include "apxx_ppl_inline.hh" 54 | 55 | } 56 | 57 | #endif /* __APXX_PPL_HH */ 58 | -------------------------------------------------------------------------------- /apronxx/apxx_ppl_inline.hh: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * apxx_ppl_inline.hh 3 | * 4 | * APRON Library / C++ inline functions 5 | * 6 | * DO NOT INCLUDE THIS FILE DIRECTLY 7 | * 8 | * Copyright (C) Antoine Mine' 2007 9 | * 10 | */ 11 | /* This file is part of the APRON Library. 12 | As it includes both APRON and PPL files, it is released under GPL license. 13 | Please read the ppl/COPYING file packaged in the distribution. 14 | */ 15 | 16 | inline ppl_poly_manager::ppl_poly_manager(bool strict) 17 | : manager(ap_ppl_poly_manager_alloc(strict)) 18 | {} 19 | 20 | inline ppl_grid_manager::ppl_grid_manager() 21 | : manager(ap_ppl_grid_manager_alloc()) 22 | {} 23 | 24 | inline manager& ppl_poly_manager::operator=(const manager& m) 25 | { 26 | return manager::operator=(m); 27 | } 28 | 29 | inline manager& ppl_grid_manager::operator=(const manager& m) 30 | { 31 | return manager::operator=(m); 32 | } 33 | -------------------------------------------------------------------------------- /apronxx/apxx_ppl_product.hh: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * apxx_ppl_product.hh 3 | * 4 | * APRON Library / C++ class wrappers 5 | * 6 | * Copyright (C) Antoine Mine' 2007 7 | * 8 | */ 9 | /* This file is part of the APRON Library. 10 | As it includes both APRON and PPL files, it is released under GPL license. 11 | Please read the ppl/COPYING file packaged in the distribution. 12 | */ 13 | 14 | #ifndef __APXX_PPL_PRODUCT_HH 15 | #define __APXX_PPL_PRODUCT_HH 16 | 17 | #include "apxx_manager.hh" 18 | 19 | #include "ap_pkgrid.h" 20 | 21 | namespace apron { 22 | 23 | //! Manager factory for reduced product domain of NewPolka polyhedra and PPL grids. 24 | class pkgrid_manager : public manager { 25 | 26 | public: 27 | 28 | /*! \brief Creates a new manager. 29 | * 30 | * \arg \c manpk should be a manager for (loose or strict) polyhedra 31 | * \arg \c manpplgrid should be a manager for PPL grids 32 | * 33 | * The argument managers are copied into the new manager. 34 | */ 35 | pkgrid_manager(const polka_manager& manpk, const ppl_grid_manager& manpplgrid); 36 | 37 | /*! \brief Creates a new manager. 38 | * 39 | * \arg \c strict whether to allow strict inequalities as well as non-strict inequalities in polyhedra. 40 | * 41 | * Note that abstract values created with strict and non-strict managers 42 | * are not compatible. 43 | */ 44 | pkgrid_manager(bool strict = false); 45 | 46 | 47 | //! Copy operator. 48 | manager& operator=(const manager&); 49 | }; 50 | 51 | #include "apxx_ppl_product_inline.hh" 52 | 53 | } 54 | 55 | #endif /* __APXX_PPL_PRODUCT_HH */ 56 | -------------------------------------------------------------------------------- /apronxx/apxx_ppl_product_inline.hh: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * apxx_ppl_product_inline.hh 3 | * 4 | * APRON Library / C++ inline functions 5 | * 6 | * DO NOT INCLUDE THIS FILE DIRECTLY 7 | * 8 | * Copyright (C) Antoine Mine' 2007 9 | * 10 | */ 11 | /* This file is part of the APRON Library. 12 | As it includes both APRON and PPL files, it is released under GPL license. 13 | Please read the ppl/COPYING file packaged in the distribution. 14 | */ 15 | 16 | inline pkgrid_manager::pkgrid_manager(const polka_manager& manpk, 17 | const ppl_grid_manager& manpplgrid) 18 | : manager(ap_pkgrid_manager_alloc(const_cast(manpk.get_ap_manager_t()), 19 | const_cast(manpplgrid.get_ap_manager_t()))) 20 | {} 21 | 22 | inline pkgrid_manager::pkgrid_manager(bool strict) 23 | : manager(ap_pkgrid_manager_alloc(const_cast(polka_manager(strict).get_ap_manager_t()), 24 | const_cast(ppl_grid_manager().get_ap_manager_t()))) 25 | {} 26 | 27 | inline manager& pkgrid_manager::operator=(const manager& m) 28 | { 29 | return manager::operator=(m); 30 | } 31 | -------------------------------------------------------------------------------- /apronxx/apxx_t1p.hh: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * apxx_t1p.hh 3 | * 4 | * APRON Library / C++ class wrappers 5 | * 6 | * Copyright (C) Antoine Mine' 2007 7 | * 8 | */ 9 | /* This file is part of the APRON Library, released under LGPL license 10 | with an exception allowing the redistribution of statically linked 11 | executables. 12 | 13 | Please read the COPYING file packaged in the distribution. 14 | */ 15 | 16 | #ifndef __APXX_T1P_HH 17 | #define __APXX_T1P_HH 18 | 19 | #include "apxx_manager.hh" 20 | 21 | #include "t1p.h" 22 | 23 | namespace apron { 24 | 25 | //! Manager factory for the Taylor1plus zonotope library. 26 | class t1p_manager : public manager { 27 | 28 | public: 29 | 30 | /*! \brief Creates a new manager. 31 | * 32 | * \arg \c strict whether to allow strict inequalities as well as non-strict inequalities. 33 | * 34 | * Note that abstract values created with strict and non-strict managers 35 | * are not compatible. 36 | */ 37 | t1p_manager(); 38 | 39 | //! Copy operator. 40 | manager& operator=(const manager&); 41 | }; 42 | 43 | #include "apxx_t1p_inline.hh" 44 | 45 | } 46 | 47 | #endif /* __APXX_T1P_HH */ 48 | -------------------------------------------------------------------------------- /apronxx/apxx_t1p_inline.hh: -------------------------------------------------------------------------------- 1 | /* -*- C++ -*- 2 | * apxx_t1p_inline.hh 3 | * 4 | * APRON Library / C++ inline functions 5 | * 6 | * DO NOT INCLUDE THIS FILE DIRECTLY 7 | * 8 | * Copyright (C) Antoine Mine' 2007 9 | * 10 | */ 11 | /* This file is part of the APRON Library, released under LGPL license 12 | with an exception allowing the redistribution of statically linked 13 | executables. 14 | 15 | Please read the COPYING file packaged in the distribution. 16 | */ 17 | 18 | inline t1p_manager::t1p_manager() 19 | : manager(t1p_manager_alloc()) 20 | {} 21 | 22 | inline manager& t1p_manager::operator=(const manager& m) 23 | { 24 | return manager::operator=(m); 25 | } 26 | -------------------------------------------------------------------------------- /avoct/mltest.ml: -------------------------------------------------------------------------------- 1 | (* mltest.ml 2 | * 3 | * A very simple example 4 | * 5 | * APRON Library / Absolute Value Octagonal (AVO) Domain 6 | * 7 | * Copyright (C) Liqian Chen & Jiangchao Liu' 2014 8 | *) 9 | 10 | 11 | (* compile with: 12 | 13 | ocamlc -I ${INSTALL_DIR}/lib \ 14 | gmp.cma apron.cma avo.cma mltest.ml \ 15 | -cclib -lavoQg -cclib -lapron 16 | 17 | you can change: 18 | - INSTALL_DIR to where APRON is installed, 19 | - -lavoQg to the desired underlying numeric type, 20 | - ocamlc to ocamlopt, and replace each .cma to the corresponding .cmxa 21 | 22 | *) 23 | 24 | open Apron 25 | 26 | let m = Avo.manager_alloc () 27 | let _ = 28 | Printf.printf "name: %s\nversion: %s\n" 29 | (Manager.get_library m) (Manager.get_version m) 30 | 31 | (* TO BE CONTINUED *) 32 | -------------------------------------------------------------------------------- /avoct/perlscript_c.pl: -------------------------------------------------------------------------------- 1 | print "\n/* This file is part of the APRON Library, released under LGPL license with an exception allowing the redistribution of statically linked executables.\n Please read the COPYING file packaged in the distribution */"; 2 | while (<>) { 3 | s/extern void camlidl_apron_lincons0_ml2c\(value, ap_lincons0_t \*\)/extern void camlidl_apron_lincons0_ml2c\(value, ap_lincons0_t \*, camlidl_ctx\)/g; 4 | s/\#define camlidl_ml2c_lincons0_ap_lincons0_t\(v,c,ctx\) camlidl_apron_lincons0_ml2c\(v,c\)/\#define camlidl_ml2c_lincons0_ap_lincons0_t\(v,c,ctx\) camlidl_apron_lincons0_ml2c\(v,c,ctx\)/g; 5 | s/extern void camlidl_apron_tcons0_ml2c\(value, ap_tcons0_t \*\)/extern void camlidl_apron_tcons0_ml2c\(value, ap_tcons0_t \*, camlidl_ctx\)/g; 6 | s/\#define camlidl_ml2c_tcons0_ap_tcons0_t\(v,c,ctx\) camlidl_apron_tcons0_ml2c\(v,c\)/\#define camlidl_ml2c_tcons0_ap_tcons0_t\(v,c,ctx\) camlidl_apron_tcons0_ml2c\(v,c,ctx\)/g; 7 | s/struct ap_texpr_op_t/ap_texpr_op_t/g; 8 | s/struct ap_texpr_rtype_t/ap_texpr_rtype_t/g; 9 | s/struct ap_texpr_rdir_t/ap_texpr_rdir_t/g; 10 | print; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /avoct/perlscript_caml.pl: -------------------------------------------------------------------------------- 1 | while (<>) { 2 | s/Manager.ap_manager_ptr/t Apron.Manager.t/g; 3 | s/internal_ptr/internal/g; 4 | s/external avo_/external /g; 5 | s/Generator0.ap_generator0_array_t/Apron.Generator0.t array/g; 6 | s/Scalar.ap_scalar_ptr/Apron.Scalar.t/g; 7 | s/Scalar.ap_scalar_array_t/Apron.Scalar.t array/g; 8 | s/Abstract0.ap_abstract0_ptr/t Apron.Abstract0.t/g; 9 | s/external ap_abstract0_avo_/external /g; 10 | print; 11 | } 12 | -------------------------------------------------------------------------------- /avoct/testall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | make all || exit 4 | 5 | mv log log.old 6 | 7 | echo "Test started `date`"| tee log 8 | 9 | for i in Il Ill MPZ Ri Rll MPQ D Dl 10 | do 11 | echo "Test for $i `date`" | tee -a log 12 | ./avotest$i +120 2>&1 | tee -a log 13 | done 14 | 15 | echo "Test finished at `date`"| tee -a log 16 | 17 | grep error log 18 | -------------------------------------------------------------------------------- /box/README: -------------------------------------------------------------------------------- 1 | # This file is part of the APRON Library, released under LGPL license 2 | # with an exception allowing the redistribution of statically linked 3 | # executables. 4 | 5 | # Please read the COPYING file packaged in the distribution 6 | 7 | This package is a interval library/abstract domain that conforms to the APRON 8 | interface. It requires APRON package. 9 | 10 | It includes both the C interface and the OCaml interface to APRON. 11 | 12 | 13 | REQUIREMENTS 14 | ============ 15 | For the C interface: 16 | 17 | GMP library (tested with version 4.0 and up) 18 | NUM "library" (a set of header files) 19 | ITV library 20 | APRON library 21 | 22 | For the OCaml interface, in addition: 23 | OCaml 3.0 or up (tested with 3.09) 24 | Camlidl (tested with 1.05) 25 | MLGMPIDL package 26 | MLAPRONIDL package 27 | 28 | INSTALLATION 29 | ============ 30 | 31 | Set the file Makefile.config to your own setting. 32 | You might also have to modify the Makefile for executables 33 | 34 | 1. C Library 35 | ---------- 36 | 37 | type 'make', and then 'make install' 38 | 39 | The library is named libboxMPQ.a, libboxRll.a, libboxD.a (and 40 | libboxMPQ_debug.a, ...). 41 | 42 | MPQ, Rll, D, stands for mpq_t, rationals on long long int, and double, which 43 | indicates the underlying representation of numbers. 44 | 45 | For use via APRON, the include files to consider is box.h. 46 | 47 | When linking, libboxXXX.a requires libapron.a 48 | 49 | 2. OCaml Library 50 | ---------------- 51 | 52 | type 'make ml', and then 'make install' 53 | 54 | The C part of the library is named libboxXX_caml.a or 55 | libboxXX_caml.so/dllboxXX_caml.so (and libboxXX_caml_debug.a or ...). 56 | 57 | The OCaml part is named boxXX.cma (boxXX.cmxa) 58 | 59 | 3. Miscellaneous 60 | ---------------- 61 | 62 | 'make clean' and 'make distclean' have the usual behaviour. 63 | -------------------------------------------------------------------------------- /box/box.texi: -------------------------------------------------------------------------------- 1 | @c This file is part of the APRON Library, released under LGPL license 2 | @c with an exception allowing the redistribution of statically linked 3 | @c executables. 4 | @c Please read the COPYING file packaged in the distribution 5 | 6 | @c to be included from apron.texi 7 | 8 | The @sc{Box} interval library is aimed to be used through 9 | the APRON interface. 10 | 11 | @menu 12 | * Use of Box:: 13 | * Allocating Box managers:: 14 | @end menu 15 | 16 | @c =================================================================== 17 | @node Use of Box, Allocating Box managers,, Box 18 | @subsection Use of Box 19 | @c =================================================================== 20 | 21 | To use @sc{Box} in C, add 22 | @example 23 | #include "box.h" 24 | @end example 25 | in your source file(s) and add @samp{-I$(BOX_PREFIX)/include} in the 26 | command line in your Makefile. 27 | 28 | You should also link your object files with the @sc{Box} library to 29 | produce an executable, by adding something like 30 | @samp{-L$(APRON_PREFIX)/lib -lboxmpq -litvmpq} in the command line in 31 | your Makefile (followed by the standard @samp{-lapron -litvmpq -litvdbl 32 | -L$(MPFR_PREFIX)/lib -lmpfr -L$(GMP_PREFIX)/lib -lgmp}). 33 | 34 | There are actually several variants of the library: 35 | @table @file 36 | @item libboxllr.a 37 | The underlying representation for numbers is rationals based on 38 | @code{long long int} integers. This may cause overflows. These are 39 | currently not detected. It requires also the @file{libitvllr.a} 40 | library. 41 | @item libboxdbl.a 42 | The underlying representations for numbers is @code{double}. Overflows 43 | are not possible (we use infinite floating numbers), but currently the 44 | soundness is not ensured for all operations. It requires also the 45 | @file{libitvdbl.a} library. 46 | @item libboxmpq.a 47 | The underlying representations for rationams is @code{mpq_t}, the 48 | multi-precision rationals from the GNU GMP library. Overflows are not 49 | possible any more, but huge numbers may appear. It requires also the 50 | @file{libitvmpq.a} library. 51 | @end table 52 | 53 | Also, all library are available in debug mode 54 | (@samp{libboxmpq_debug.a}, ...). 55 | 56 | @c =================================================================== 57 | @node Allocating Box managers , , Use of Box, Box 58 | @subsection Allocating Box managers 59 | @c =================================================================== 60 | 61 | @deftypefun ap_manager_t* box_manager_alloc () 62 | Allocate a APRON manager linked to the Box library. 63 | @end deftypefun 64 | -------------------------------------------------------------------------------- /box/box_assign.h: -------------------------------------------------------------------------------- 1 | /* ********************************************************************** */ 2 | /* box_assign.h */ 3 | /* ********************************************************************** */ 4 | 5 | #ifndef _BOX_ASSIGN_H_ 6 | #define _BOX_ASSIGN_H_ 7 | 8 | #include "box.h" 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | box_t* box_assign_linexpr_array(ap_manager_t* man, 15 | bool destructive, 16 | box_t* a, 17 | ap_dim_t* tdim, 18 | ap_linexpr0_t** texpr, 19 | size_t size, 20 | box_t* dest); 21 | box_t* box_substitute_linexpr_array(ap_manager_t* man, 22 | bool destructive, 23 | box_t* a, 24 | ap_dim_t* tdim, 25 | ap_linexpr0_t** texpr, 26 | size_t size, 27 | box_t* dest); 28 | box_t* box_assign_texpr_array(ap_manager_t* man, 29 | bool destructive, 30 | box_t* a, 31 | ap_dim_t* tdim, 32 | ap_texpr0_t** texpr, 33 | size_t size, 34 | box_t* dest); 35 | box_t* box_substitute_texpr_array(ap_manager_t* man, 36 | bool destructive, 37 | box_t* a, 38 | ap_dim_t* tdim, 39 | ap_texpr0_t** texpr, 40 | size_t size, 41 | box_t* dest); 42 | 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /box/box_config.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _BOX_CONFIG_H_ 3 | #define _BOX_CONFIG_H_ 4 | 5 | #include "num.h" 6 | #include "bound.h" 7 | #include "ap_global0.h" 8 | 9 | #ifdef __cplusplus 10 | #define HAS_BOOL 11 | extern "C" { 12 | #endif 13 | 14 | #ifndef HAS_BOOL 15 | #define HAS_BOOL 16 | typedef char bool; 17 | static const bool false = 0; 18 | static const bool true = 1; 19 | #endif 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /box/box_constructor.h: -------------------------------------------------------------------------------- 1 | /* ********************************************************************** */ 2 | /* box_constructor.h: constructors */ 3 | /* ********************************************************************** */ 4 | 5 | #ifndef _BOX_CONSTRUCTOR_H_ 6 | #define _BOX_CONSTRUCTOR_H_ 7 | 8 | #include "box.h" 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | void box_bound_linexpr_internal(box_internal_t* intern, 15 | itv_t itv, 16 | box_t* a, 17 | ap_linexpr0_t* expr); 18 | box_t* box_bottom(ap_manager_t* man, size_t intdim, size_t realdim); 19 | box_t* box_top(ap_manager_t* man, size_t intdim, size_t realdim); 20 | box_t* box_of_box(ap_manager_t* man, 21 | size_t intdim, size_t realdim, 22 | ap_interval_t** tinterval); 23 | box_t* box_of_lincons_array(ap_manager_t* man, 24 | size_t intdim, size_t realdim, 25 | ap_lincons0_array_t* array); 26 | box_t* box_of_tcons_array(ap_manager_t* man, 27 | size_t intdim, size_t realdim, 28 | ap_tcons0_array_t* array); 29 | ap_dimension_t box_dimension(ap_manager_t* man, box_t* a); 30 | bool box_is_bottom(ap_manager_t* man, box_t* a); 31 | bool box_is_top(ap_manager_t* man, box_t* a); 32 | bool box_is_leq(ap_manager_t* man, box_t* a, box_t* b); 33 | bool box_is_eq(ap_manager_t* man, box_t* a, box_t* b); 34 | bool box_is_dimension_unconstrained(ap_manager_t* man, box_t* a, ap_dim_t dim); 35 | bool box_sat_interval(ap_manager_t* man, 36 | box_t* a, 37 | ap_dim_t dim, ap_interval_t* interval); 38 | bool box_sat_lincons(ap_manager_t* man, 39 | box_t* a, ap_lincons0_t* cons); 40 | bool box_sat_tcons(ap_manager_t* man, 41 | box_t* a, ap_tcons0_t* cons); 42 | ap_interval_t* box_bound_dimension(ap_manager_t* man, 43 | box_t* a, ap_dim_t dim); 44 | ap_interval_t* box_bound_linexpr(ap_manager_t* man, 45 | box_t* a, ap_linexpr0_t* expr); 46 | ap_interval_t* box_bound_texpr(ap_manager_t* man, 47 | box_t* a, ap_texpr0_t* expr); 48 | ap_lincons0_array_t box_to_lincons_array(ap_manager_t* man, box_t* a); 49 | ap_tcons0_array_t box_to_tcons_array(ap_manager_t* man, box_t* a); 50 | ap_generator0_array_t box_to_generator_array(ap_manager_t* man, box_t* a); 51 | ap_interval_t** box_to_box(ap_manager_t* man, box_t* a); 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /box/box_internal.h: -------------------------------------------------------------------------------- 1 | /* ********************************************************************** */ 2 | /* box_internal.h: abstract lattice of intervals */ 3 | /* ********************************************************************** */ 4 | 5 | #ifndef _BOX_INTERNAL_H_ 6 | #define _BOX_INTERNAL_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include "box_config.h" 12 | #include "itv.h" 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | struct box_t { 19 | itv_t* p; 20 | size_t intdim; 21 | size_t realdim; 22 | }; 23 | 24 | ap_manager_t* box_manager_alloc(void); 25 | 26 | typedef struct box_internal_t { 27 | itv_internal_t* itv; 28 | itv_t bound_linexpr_internal_itv; 29 | itv_t bound_linexpr_internal_itv2; 30 | ap_interval_t* sat_interval_interval; 31 | itv_t sat_lincons_itv; 32 | num_t sat_lincons_num; 33 | itv_t bound_linexpr_itv; 34 | itv_t meet_lincons_internal_itv; 35 | itv_t meet_lincons_internal_itv2; 36 | itv_t meet_lincons_internal_itv3; 37 | bound_t meet_lincons_internal_bound; 38 | } box_internal_t; 39 | 40 | void box_internal_init(box_internal_t* intern); 41 | void box_internal_clear(box_internal_t* intern); 42 | 43 | box_internal_t* box_internal_alloc(void); 44 | void box_internal_free(box_internal_t* intern); 45 | 46 | /* Initializes some fields of pk from manager */ 47 | static inline box_internal_t* box_init_from_manager(ap_manager_t* man, ap_funid_t funid) 48 | { 49 | box_internal_t* itv = (box_internal_t*)man->internal; 50 | return itv; 51 | } 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /box/box_meetjoin.h: -------------------------------------------------------------------------------- 1 | /* ********************************************************************** */ 2 | /* box_meetjoin.h */ 3 | /* ********************************************************************** */ 4 | 5 | #ifndef _BOX_MEETJOIN_H_ 6 | #define _BOX_MEETJOIN_H_ 7 | 8 | #include "box.h" 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | void box_add_ray(box_internal_t* intern, 15 | box_t* a, ap_generator0_t* gen); 16 | 17 | box_t* box_meet(ap_manager_t* man, bool destructive, box_t* a1, box_t* a2); 18 | box_t* box_join(ap_manager_t* man, bool destructive, box_t* a1, box_t* a2); 19 | box_t* box_meet_array(ap_manager_t* man, box_t** tab, size_t size); 20 | box_t* box_join_array(ap_manager_t* man, box_t** tab, size_t size); 21 | box_t* box_meet_lincons_array(ap_manager_t* man, 22 | bool destructive, 23 | box_t* a, 24 | ap_lincons0_array_t* array); 25 | box_t* box_meet_tcons_array(ap_manager_t* man, 26 | bool destructive, 27 | box_t* a, 28 | ap_tcons0_array_t* array); 29 | box_t* box_add_ray_array(ap_manager_t* man, 30 | bool destructive, 31 | box_t* a, ap_generator0_array_t* array); 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /box/box_otherops.h: -------------------------------------------------------------------------------- 1 | /* ********************************************************************** */ 2 | /* box_otherops.h */ 3 | /* ********************************************************************** */ 4 | 5 | #ifndef _BOX_OTHEROPS_H_ 6 | #define _BOX_OTHEROPS_H_ 7 | 8 | #include "box.h" 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | box_t* box_forget_array(ap_manager_t* man, 15 | bool destructive, 16 | box_t* a, 17 | ap_dim_t* tdim, 18 | size_t size, 19 | bool project); 20 | box_t* box_expand(ap_manager_t* man, 21 | bool destructive, 22 | box_t* a, 23 | ap_dim_t dim, 24 | size_t n); 25 | box_t* box_fold(ap_manager_t* man, 26 | bool destructive, 27 | box_t* a, 28 | ap_dim_t* tdim, 29 | size_t size); 30 | 31 | box_t* box_widening(ap_manager_t* man, 32 | box_t* a1, box_t* a2); 33 | 34 | box_t* box_closure(ap_manager_t* man, bool destructive, box_t* a); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /box/box_representation.h: -------------------------------------------------------------------------------- 1 | /* ********************************************************************** */ 2 | /* box_representation.c: general management */ 3 | /* ********************************************************************** */ 4 | 5 | #ifndef _BOX_REPRESENTATION_H_ 6 | #define _BOX_REPRESENTATION_H_ 7 | 8 | #include "box.h" 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | /* Internal functions */ 15 | box_t* box_alloc(size_t intdim, size_t realdim); 16 | void box_init(box_t* a); 17 | void box_set_bottom(box_t* a); 18 | void box_set_top(box_t* a); 19 | void box_set(box_t* a, box_t* b); 20 | 21 | /* 1. Memory */ 22 | box_t* box_copy(ap_manager_t* man, box_t* a); 23 | void box_free(ap_manager_t* man, box_t* a); 24 | size_t box_size(ap_manager_t* man, box_t* a); 25 | 26 | /* 2. Control of internal representation */ 27 | void box_minimize(ap_manager_t* man, box_t* a); 28 | void box_canonicalize(ap_manager_t* man, box_t* a); 29 | void box_approximate(ap_manager_t* man, box_t* a, int algorithm); 30 | 31 | /* 3. Printing */ 32 | void box_print(FILE* stream, 33 | ap_manager_t* man,box_t* a,char** name_of_dim); 34 | void box_dump(FILE* stream, ap_manager_t* man, box_t* a); 35 | void box_printdiff(FILE* stream, 36 | ap_manager_t* man, box_t* a, box_t* b, 37 | char** name_of_dim); 38 | 39 | /* 4. Serialization */ 40 | ap_membuf_t box_serialize_raw(ap_manager_t* man, box_t* a); 41 | box_t* box_deserialize_raw(ap_manager_t* man, void* ptr); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /box/box_resize.h: -------------------------------------------------------------------------------- 1 | /* ********************************************************************** */ 2 | /* box_resize.h */ 3 | /* ********************************************************************** */ 4 | 5 | #ifndef _BOX_RESIZE_H_ 6 | #define _BOX_RESIZE_H_ 7 | 8 | #include "box.h" 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | box_t* box_add_dimensions(ap_manager_t* man, 15 | bool destructive, box_t* a, 16 | ap_dimchange_t* dimchange, 17 | bool project); 18 | 19 | box_t* box_remove_dimensions(ap_manager_t* man, 20 | bool destructive, box_t* a, 21 | ap_dimchange_t* dimchange); 22 | 23 | box_t* box_permute_dimensions(ap_manager_t* man, 24 | bool destructive, 25 | box_t* a, 26 | ap_dimperm_t* permutation); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /box/perlscript_caml.pl: -------------------------------------------------------------------------------- 1 | while (<>) { 2 | s/Manager.ap_manager_ptr/t Apron.Manager.t/g; 3 | s/external box_/external /g; 4 | s/Policy.ap_policy_manager_ptr/t Apron.Policy.man/g; 5 | print; 6 | } 7 | -------------------------------------------------------------------------------- /examples/Makefile: -------------------------------------------------------------------------------- 1 | include ../Makefile.config 2 | include ../vars.mk 3 | 4 | ICFLAGS += \ 5 | -I$(GMP_PREFIX)/include \ 6 | -I$(MPFR_PREFIX)/include \ 7 | -I$(APRON_PREFIX)/include \ 8 | -Wall -Wstrict-prototypes -Wimplicit-function-declaration \ 9 | -std=c99 10 | # -Winline -Wconversion 11 | 12 | LCFLAGS = \ 13 | -L$(GMP_PREFIX)/lib \ 14 | -L$(MPFR_PREFIX)/lib \ 15 | -L$(APRON_PREFIX)/lib \ 16 | -L$(PPL_PREFIX)/lib \ 17 | -L$(CAMLIDL_PREFIX) 18 | 19 | OCAMLINC = \ 20 | -I $(MLGMPIDL_LIB) \ 21 | -I $(APRON_PREFIX)/lib \ 22 | -I $(CAML_PREFIX)/lib/ocaml/apron 23 | 24 | OCAMLPACKAGES = -package "apron.boxMPQ,apron.octMPQ,apron.polkaMPQ,apron.ppl,apron.polkaGrid" -linkpkg 25 | 26 | all: C ml 27 | 28 | # C examples 29 | 30 | C: example1g 31 | 32 | %g: %g.o 33 | $(CXX) $(CXXFLAGS) $(ICFLAGS) $(LCFLAGS) -o $@ $< -lap_ppl_debug -lppl -lgmpxx -lpolkaMPQ_debug -loctMPQ_debug -lboxMPQ_debug -lapron_debug -litvMPQ_debug -litvD_debug -lmpfr -lgmp 34 | 35 | %g.o: %.c 36 | $(CC) $(CFLAGS_DEBUG) $(ICFLAGS) -c -o $@ $< 37 | 38 | # OCaml examples 39 | 40 | ml: mlexample1.opt 41 | 42 | mlexample%.opt: mlexample%.cmx 43 | $(OCAMLFIND) ocamlopt $(OCAMLINC) -o $@ $< $(OCAMLPACKAGES) 44 | 45 | mlexample%.byte: mlexample%.cmo 46 | $(OCAMLFIND) ocamlc -o $@ $< $(OCAMLPACKAGES) 47 | 48 | test.opt: test.cmx 49 | $(OCAMLFIND) ocamlopt -c -o $@ $< $(OCAMLPACKAGES) 50 | 51 | %.cmo: %.ml 52 | $(OCAMLFIND) ocamlc -c -o $@ $< $(OCAMLPACKAGES) 53 | 54 | %.cmx: %.ml 55 | $(OCAMLFIND) ocamlopt -c -o $@ $< $(OCAMLPACKAGES) 56 | 57 | # 58 | 59 | clean: 60 | rm -f example1g *.cm[ioxa] *.o mlexample1 mlexample2 mlexample3 mlexample4 mlexample5 *.opt 61 | 62 | distclean: clean 63 | 64 | uninstall: 65 | 66 | dist: example1.c mlexample1.ml mlexample2.ml mlexample3.ml Makefile README 67 | (cd ..; tar zcvf examples.tgz $(^:%=examples/%)) 68 | -------------------------------------------------------------------------------- /examples/README: -------------------------------------------------------------------------------- 1 | # This file is part of the APRON Library, released under GPL 2 | # license. 3 | 4 | # Please read the COPYING file packaged in the distribution 5 | 6 | There are currently two examples, 7 | 8 | - example1.c (C, use of level 1) 9 | - mlexample1.ml, mlexample2.ml, mlexample3.ml (OCaml, level 1). 10 | 11 | For C examples, type make example1 12 | 13 | For OCaml examples, type make mlexample1 or make mlexample1.opt 14 | 15 | Look at the Makefile for making your own. 16 | 17 | The present one assumes that all APRON subpackages are installed in 18 | $APRON_PREFIX directory. 19 | -------------------------------------------------------------------------------- /examples/mlexample3.ml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoinemine/apron/2d0027326748b81026e2e8a711913be748b6ecca/examples/mlexample3.ml -------------------------------------------------------------------------------- /fppol/README: -------------------------------------------------------------------------------- 1 | # README 2 | # 3 | # Installation documentation 4 | # 5 | # APRON Library / Fppol Domain V1.0 6 | # 7 | # Copyright (C) Liqian CHEN' 2008 8 | # 9 | # Technique details see: 10 | # [Liqian Chen, Antoine Miné and Patrick Cousot. A Sound Floating-Point Polyhedra Abstract Domain. In APLAS 2008.] 11 | # 12 | # This file is part of the APRON Library, released under LGPL license. 13 | # Please read the COPYING file packaged in the distribution 14 | 15 | This package is a implementation of the fppol abstract domain that 16 | conforms to the APRON interface. 17 | It includes both a C and a OCaml interface. 18 | 19 | REQUIREMENTS 20 | ============ 21 | For the C interface: 22 | 23 | APRON library 24 | glpk 4.65 25 | 26 | For the OCaml interface, in addition: 27 | OCaml 4.0 or up (tested with 4.01) 28 | Camlidl (tested with 1.05) 29 | MLGMPIDL package 30 | MLAPRONIDL package 31 | 32 | INSTALLATION 33 | ============ 34 | 35 | Set the file Makefile.config to your own setting. 36 | You might also have to modify the Makefile for executables 37 | 38 | 1. C Library 39 | ---------- 40 | 41 | type 'make all', and then 'make install' 42 | 43 | The library is named libfppD.a, libfppDl.a (and 44 | libfppD_debug.a, libfppDl_debug.a, ...). 45 | 46 | D, Dl, stands for double, long double, which 47 | indicates the underlying representation of floating point number. 48 | 49 | For use via APRON, the include files to consider is fpp.h 50 | 51 | When linking, requires libraries required by APRON. 52 | 53 | 2. OCaml Library 54 | ---------------- 55 | 56 | type 'make ml', and then 'make install' 57 | 58 | The C part of the library is named libfppXX_caml.a or 59 | libfppXX_caml.so/dllfppXX_caml.so (and libfppXX_caml_debug.a or ...). 60 | 61 | The OCaml part is named fppXX.cma (fppXX.cmxa) 62 | 63 | 3. Miscellaneous 64 | ---------------- 65 | 'make clean' and 'make distclean' have the usual behaviour. -------------------------------------------------------------------------------- /fppol/bt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * bt.h 3 | * 4 | * Functions for bound tightenin. 5 | * 6 | * APRON Library / FPPol Domain 7 | * 8 | * Copyright (C) Liqian CHEN' 2008- 9 | * 10 | */ 11 | 12 | /* This file is part of the APRON Library, released under LGPL license 13 | with an exception allowing the redistribution of statically linked 14 | executables. 15 | 16 | Please read the COPYING file packaged in the distribution. 17 | */ 18 | 19 | #ifndef _BT_H_ 20 | #define _BT_H_ 21 | 22 | #include "fpp.h" 23 | #include "fpp_internal.h" 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | fpp_t* bt_byRLP(fpp_internal_t* pr, bool destructive, fpp_t *fpp, int *rvars, unsigned nvars); 30 | fpp_t *bt_kthvar_byRLP(fpp_internal_t* pr, bool destructive, fpp_t *fpp,int k); 31 | fpp_t *bt_kthvar_by_bound_propagation(fpp_internal_t* pr, bool destructive, fpp_t *fpp,int k); 32 | numdbl_t bt_half_kthvar_by_bound_propagation(fpp_t *fpp,unsigned k,bool upbd); 33 | fpp_t* bt_kVars_byRLP(fpp_internal_t* pr, bool destructive, fpp_t *fpp,unsigned k0,unsigned k1); 34 | fpp_t* bt_byPureRLP(fpp_internal_t* pr, bool destructive, fpp_t *fpp, int *rvars, unsigned nvars); 35 | 36 | fpp_t *bt_kthvar_byExactLP(fpp_internal_t* pr, bool destructive, fpp_t *fpp,int k); 37 | fpp_t* bt_kVars_byExactLP(fpp_internal_t* pr, bool destructive, fpp_t *fpp,unsigned k0,unsigned k1); 38 | fpp_t* bt_byExactLP(fpp_internal_t* pr, bool destructive, fpp_t *fpp, int *rvars, unsigned nvars); 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /fppol/bv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * bv.h 3 | * 4 | * Functions for Fixed-size Bit Vectors for Kohler's Rule 5 | * 6 | * APRON Library / FPPol Domain 7 | * 8 | * Copyright (C) Liqian CHEN' 2008- 9 | * 10 | */ 11 | 12 | /* This file is part of the APRON Library, released under LGPL license 13 | with an exception allowing the redistribution of statically linked 14 | executables. 15 | 16 | Please read the COPYING file packaged in the distribution. 17 | */ 18 | 19 | #ifndef _BV_H_ 20 | #define _BV_H_ 21 | 22 | #include "fpp.h" 23 | #include "fpp_internal.h" 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | typedef struct { 30 | unsigned vsize; /* size of each vector */ 31 | unsigned vchars; /* number of chars for each vector */ 32 | unsigned nvecs; /* number of vectors */ 33 | char *bits; /* memory for storage */ 34 | }bit_vectors_t; 35 | 36 | typedef struct { 37 | unsigned posI; /* index of postive constraint */ 38 | unsigned negI; /* index of negative constraint */ 39 | }fm_pair_t; 40 | 41 | void bv_free(bit_vectors_t *bv); 42 | bit_vectors_t* bv_copy(bit_vectors_t *bv); 43 | char* bv_or(bit_vectors_t *bv, char *v1,char *v2); 44 | void bv_set(bit_vectors_t *bv, unsigned k,char *v); 45 | bool bv_subset(bit_vectors_t *bv, char *v1,char *v2); 46 | fpp_t *bv_redundancy_removal_firstKs_byKohler(fpp_internal_t* pr,bool destructive, fpp_t *fpp, unsigned k,bit_vectors_t *bv); 47 | void fpp_fdump_withBV(FILE* stream, fpp_t* a,bit_vectors_t *bv); 48 | 49 | int bv_andTest(bit_vectors_t *bv, char *v1,char *v2); 50 | fpp_t *bv_redundancy_removal_firstKs_byEnvelope(fpp_internal_t* pr,bool destructive, fpp_t *fpp, unsigned k,bit_vectors_t *bv,char *nenv1bv,char *nenv2bv); 51 | fm_pair_t *bv_redundancy_removal_byKohler_lazy(fpp_internal_t* pr,unsigned k,unsigned zeroI,unsigned nelimv, fm_pair_t *fmp, bit_vectors_t *bv); 52 | void bv_fprint(FILE* stream, bit_vectors_t *bv); 53 | unsigned bv_1bits(bit_vectors_t *bv, char *v); 54 | void charprint(char c); 55 | #ifdef __cplusplus 56 | } 57 | #endif 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /fppol/fpp_extract.h: -------------------------------------------------------------------------------- 1 | /* 2 | * fpp_extract.h 3 | * 4 | * Functions for property extraction. 5 | * 6 | * APRON Library / Fppol Domain 7 | * 8 | * Copyright (C) Liqian CHEN' 2008- 9 | * 10 | */ 11 | 12 | /* This file is part of the APRON Library, released under LGPL license 13 | with an exception allowing the redistribution of statically linked 14 | executables. 15 | 16 | Please read the COPYING file packaged in the distribution. 17 | */ 18 | 19 | #ifndef _FPP_EXTRACT_H_ 20 | #define _FPP_EXTRACT_H_ 21 | 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | /* Bounding by a itv box a matrix of generators. * 28 | itv_t* matrix_to_box(pk_internal_t* pk, matrix_t* F); 29 | */ 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /fppol/fpp_user.h: -------------------------------------------------------------------------------- 1 | /* 2 | * fpp_user.h 3 | * 4 | * Functions for conversions with interface datatypes. 5 | * 6 | * APRON Library / Fppol Domain 7 | * 8 | * Copyright (C) Liqian CHEN' 2008- 9 | * 10 | */ 11 | 12 | /* This file is part of the APRON Library, released under LGPL license 13 | with an exception allowing the redistribution of statically linked 14 | executables. 15 | 16 | Please read the COPYING file packaged in the distribution. 17 | */ 18 | 19 | #ifndef __FPP_USER_H__ 20 | #define __FPP_USER_H__ 21 | 22 | #include "fpp.h" 23 | #include "fpp_internal.h" 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | ap_lincons0_t fpp_lincons0_of_vector(numdbl_t* q, size_t size); 30 | numdbl_t* fpp_bnds_to_cons(fpp_internal_t* fpp, numdbl_t* bnds, size_t dim, size_t* ncons); 31 | numdbl_t* fpp_vector_of_lincons0(ap_lincons0_t p, unsigned dimension,unsigned intdim, unsigned* n); 32 | void fpp_vector_of_linexp0(numdbl_t* q, ap_linexpr0_t* p); 33 | void fpp_init_bounds(numdbl_t* bnds, size_t dim); 34 | fpp_t* fpp_normalize(fpp_internal_t* pr,bool destructive,fpp_t* fpp); 35 | int* fpp_vars_related_to_last_kthConstraints(fpp_t* fpp1,int k, int* nvars); 36 | fpp_t* fpp_remove_kthCons(fpp_t* fpp,int k); 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /fppol/fpp_weakjoin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * join.h 3 | * 4 | * Functions for strong join & weak joins 5 | * 6 | * APRON Library / FPPol Domain 7 | * 8 | * Copyright (C) Liqian CHEN' 2008- 9 | * 10 | */ 11 | 12 | /* This file is part of the APRON Library, released under LGPL license 13 | with an exception allowing the redistribution of statically linked 14 | executables. 15 | 16 | Please read the COPYING file packaged in the distribution. 17 | */ 18 | 19 | #ifndef _JOIN_H_ 20 | #define _JOIN_H_ 21 | 22 | #include /* linear programming lib */ 23 | #include "fpp.h" 24 | #include "fpp_internal.h" 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | fpp_t *fppol_weak_join_template(fpp_internal_t* pr, fpp_t *fpp01, fpp_t *fpp02); 31 | fpp_t *fppol_weak_join_envbnds(fpp_internal_t* pr, fpp_t *fpp01, fpp_t *fpp02); 32 | fpp_t *fppol_weak_join_nenvbnds(fpp_internal_t* pr, fpp_t *fpp01, fpp_t *fpp02); 33 | numdbl_t *fppol_convex_hull_new_cons(fpp_internal_t* pr, fpp_t *fpp01, fpp_t *fpp02, numdbl_t *env, unsigned nenv, numdbl_t *chbnds, unsigned nchbnds, unsigned *nNewCons); 34 | void fppol_tighten_tmplts(fpp_internal_t* pr, fpp_t *fpp01, fpp_t *fpp02, unsigned nTmplts, numdbl_t *tmplts); 35 | fpp_t *fppol_weak_join_envTVPI(fpp_internal_t* pr, fpp_t *fpp01, fpp_t *fpp02); 36 | fpp_t *fppol_weak_join_each_overapprox(fpp_internal_t* pr, fpp_t *fpp01, fpp_t *fpp02); 37 | fpp_t *fppol_weak_joins(fpp_internal_t* pr, fpp_t *fpp01, fpp_t *fpp02); 38 | numdbl_t fppol_sparse_factor(fpp_t *fpp); 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /fppol/mltest.ml: -------------------------------------------------------------------------------- 1 | (* mltest.ml 2 | * 3 | * A very simple example 4 | * 5 | * APRON Library / Fppol Domain 6 | * 7 | * Copyright (C) Liqian CHEN' 2008 8 | *) 9 | 10 | 11 | (* compile with: 12 | 13 | ocamlc -I ${INSTALL_DIR}/lib \ 14 | gmp.cma apron.cma fpp.cma mltest.ml \ 15 | -cclib -lfppQg -cclib -lapron 16 | 17 | you can change: 18 | - INSTALL_DIR to where APRON is installed, 19 | - -lfppQg to the desired underlying numeric type, 20 | - ocamlc to ocamlopt, and replace each .cma to the corresponding .cmxa 21 | 22 | *) 23 | 24 | open Apron 25 | 26 | let m = Fpp.manager_alloc () 27 | let _ = 28 | Printf.printf "name: %s\nversion: %s\n" 29 | (Manager.get_library m) (Manager.get_version m) 30 | 31 | (* TO BE CONTINUED *) 32 | -------------------------------------------------------------------------------- /fppol/numitv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * numitv.h 3 | * 4 | * Functions for outward interval arithmetic with floating point arithmetic 5 | * 6 | * APRON Library / Fppol Domain 7 | * 8 | * Copyright (C) Liqian CHEN' 2008- 9 | * 10 | */ 11 | 12 | 13 | /* This file is part of the APRON Library, released under LGPL license 14 | with an exception allowing the redistribution of statically linked 15 | executables. 16 | 17 | Please read the COPYING file packaged in the distribution. 18 | */ 19 | 20 | #ifndef __NUMITV_H 21 | #define __NUMITV_H 22 | 23 | /* dependencies */ 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | typedef struct 30 | { 31 | numdbl_t inf; 32 | numdbl_t sup; 33 | } numitv_t; 34 | 35 | numitv_t numitv_neg(numitv_t a); 36 | numitv_t numitv_add(numitv_t a,numitv_t b); 37 | numitv_t numitv_sub(numitv_t a,numitv_t b); 38 | numitv_t numitv_mul(numitv_t a,numitv_t b); 39 | numitv_t numitv_div(numitv_t a,numitv_t b); 40 | 41 | bool numitv_is_leq(numitv_t a,numitv_t b); 42 | numitv_t numitv_singleton(numdbl_t a); 43 | void numitv_print(numitv_t a); 44 | numdbl_t numitv_width(numitv_t a); 45 | 46 | numitv_t numitv_add_number(numdbl_t a,numdbl_t b); 47 | numitv_t numitv_sub_number(numdbl_t a,numdbl_t b); 48 | numitv_t numitv_mul_number(numdbl_t a,numdbl_t b); 49 | numitv_t numitv_div_number(numdbl_t a,numdbl_t b); 50 | 51 | numitv_t numitv_lexp_range(int dim, numdbl_t *lexp_coeff, numdbl_t *bounds); 52 | 53 | 54 | numdbl_t __attribute__ ((noinline)) num_add_downward(numdbl_t a, numdbl_t b); 55 | numdbl_t __attribute__ ((noinline)) num_sub_downward(numdbl_t a, numdbl_t b); 56 | numdbl_t __attribute__ ((noinline)) num_mul_downward(numdbl_t a, numdbl_t b); 57 | numdbl_t __attribute__ ((noinline)) num_div_downward(numdbl_t a, numdbl_t b); 58 | 59 | #ifdef __cplusplus 60 | } 61 | #endif 62 | 63 | #endif /* __NUMITV_H */ 64 | -------------------------------------------------------------------------------- /fppol/perlscript_c.pl: -------------------------------------------------------------------------------- 1 | print "\n/* This file is part of the APRON Library, released under LGPL license with an exception allowing the redistribution of statically linked executables.\n Please read the COPYING file packaged in the distribution */"; 2 | while (<>) { 3 | s/extern void camlidl_apron_lincons0_ml2c\(value, ap_lincons0_t \*\)/extern void camlidl_apron_lincons0_ml2c\(value, ap_lincons0_t \*, camlidl_ctx\)/g; 4 | s/\#define camlidl_ml2c_lincons0_ap_lincons0_t\(v,c,ctx\) camlidl_apron_lincons0_ml2c\(v,c\)/\#define camlidl_ml2c_lincons0_ap_lincons0_t\(v,c,ctx\) camlidl_apron_lincons0_ml2c\(v,c,ctx\)/g; 5 | s/extern void camlidl_apron_tcons0_ml2c\(value, ap_tcons0_t \*\)/extern void camlidl_apron_tcons0_ml2c\(value, ap_tcons0_t \*, camlidl_ctx\)/g; 6 | s/\#define camlidl_ml2c_tcons0_ap_tcons0_t\(v,c,ctx\) camlidl_apron_tcons0_ml2c\(v,c\)/\#define camlidl_ml2c_tcons0_ap_tcons0_t\(v,c,ctx\) camlidl_apron_tcons0_ml2c\(v,c,ctx\)/g; 7 | s/struct ap_texpr_op_t/ap_texpr_op_t/g; 8 | s/struct ap_texpr_rtype_t/ap_texpr_rtype_t/g; 9 | s/struct ap_texpr_rdir_t/ap_texpr_rdir_t/g; 10 | print; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /fppol/perlscript_caml.pl: -------------------------------------------------------------------------------- 1 | while (<>) { 2 | s/Manager.ap_manager_ptr/t Apron.Manager.t/g; 3 | s/internal_ptr/internal/g; 4 | s/external fpp_/external /g; 5 | s/Generator0.ap_generator0_array_t/Apron.Generator0.t array/g; 6 | s/Scalar.ap_scalar_ptr/Apron.Scalar.t/g; 7 | s/Scalar.ap_scalar_array_t/Apron.Scalar.t array/g; 8 | s/Abstract0.ap_abstract0_ptr/t Apron.Abstract0.t/g; 9 | s/external ap_abstract0_fpp_/external /g; 10 | print; 11 | } 12 | -------------------------------------------------------------------------------- /fppol/quasi_linear.h: -------------------------------------------------------------------------------- 1 | /* 2 | * quasi_linear.h 3 | * 4 | * Functions for converting the interval linear form into the quasi-linearisation form. 5 | * 6 | * APRON Library / FPPol Domain 7 | * 8 | * Copyright (C) Liqian CHEN' 2008- 9 | * 10 | */ 11 | 12 | /* This file is part of the APRON Library, released under LGPL license 13 | with an exception allowing the redistribution of statically linked 14 | executables. 15 | 16 | Please read the COPYING file packaged in the distribution. 17 | */ 18 | 19 | #ifndef _QUASI_LINEAR_H_ 20 | #define _QUASI_LINEAR_H_ 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | numdbl_t *quasi_linearisation(int dim, numdbl_t *coeffs, numdbl_t *bounds, int *sat); 27 | int normalise_steep_inequality(int dim, numdbl_t *con, numdbl_t *bnds); 28 | int normalise_quasiInteger_inequality(int dim, numdbl_t *con, numdbl_t *bnds); 29 | int normalise_integer_inequality(int dim, numdbl_t *c); 30 | numdbl_t *normalise_integer_inequality_withConstant(int dim, numdbl_t *c,bool *sat); 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /fppol/testall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | make all || exit 4 | 5 | mv log log.old 6 | 7 | echo "Test started `date`"| tee log 8 | 9 | for i in Il Ill MPZ Ri Rll MPQ D Dl 10 | do 11 | echo "Test for $i `date`" | tee -a log 12 | ./fpptest$i +120 2>&1 | tee -a log 13 | done 14 | 15 | echo "Test finished at `date`"| tee -a log 16 | 17 | grep error log 18 | -------------------------------------------------------------------------------- /itv/README: -------------------------------------------------------------------------------- 1 | 2 | # This file is part of the APRON Library, released under LGPL license 3 | # with an exception allowing the redistribution of statically linked 4 | # executables. 5 | 6 | # Please read the COPYING file packaged in the distribution 7 | 8 | This package is an interval library for use for various abstract domains. 9 | It requires APRON package. 10 | 11 | REQUIREMENTS 12 | ============ 13 | For the C interface: 14 | 15 | GMP library (tested with version 4.0 and up) 16 | MPFR library (tested with version 2.2.1 and up) 17 | NUM "library" (a set of header files) 18 | APRON library 19 | 20 | INSTALLATION 21 | ============ 22 | 23 | type 'make', and then 'make install' 24 | 25 | The library is named libitvMPQ.a, libitvIll.a, libitvD.a (and 26 | libitvmpq_debug.a, ...). The library libitv.a is the union of 27 | libitv(Il,Ill,Rl,Rll,MPQ,MPQ,D,MPFR).a and is (later) automatically included 28 | in libapron.a (and libapron.so). 29 | 30 | MPQ, Rll, D, stands for mpq_t, rationals on long long int, and double, which 31 | indicates the underlying representation of numbers. 32 | 33 | The include files to consider are itv.h and itv_linexpr.h 34 | -------------------------------------------------------------------------------- /itv/itv_config.h: -------------------------------------------------------------------------------- 1 | #ifndef _ITV_CONFIG_H_ 2 | #define _ITV_CONFIG_H_ 3 | 4 | #ifdef __cplusplus 5 | #define HAS_BOOL 6 | extern "C" { 7 | #endif 8 | 9 | #ifndef HAS_BOOL 10 | #define HAS_BOOL 11 | typedef char bool; 12 | static const bool false = 0; 13 | static const bool true = 1; 14 | #endif 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /itv/itv_fun.h: -------------------------------------------------------------------------------- 1 | /* ********************************************************************** */ 2 | /* itv_fun.h: defines ITV_FUN */ 3 | /* ********************************************************************** */ 4 | 5 | #include "num_name.h" 6 | #define ITVFUN(x) NUMFUN(x) 7 | -------------------------------------------------------------------------------- /japron/README: -------------------------------------------------------------------------------- 1 | # README 2 | # 3 | # APRON Library / Java Binding 4 | # 5 | # Copyright (C) Antoine Mine' 2010- 6 | 7 | # This file is part of the APRON Library, released under LGPL license 8 | # with an exception allowing the redistribution of statically linked 9 | # executables. 10 | 11 | # Please read the COPYING file packaged in the distribution. 12 | 13 | This package provides a Java binding for the Apron library. 14 | This includes Apron API objects (expression, constraints, etc.) as well as 15 | manager factories for the numerical abstract domains included in the 16 | Apron distribution. 17 | Also included is a Java binding for the GMP and MPFR libraries used by Apron. 18 | 19 | 20 | 21 | REQUIREMENTS 22 | ############ 23 | 24 | Java 9 or above. 25 | 26 | 27 | INSTALLATION 28 | ############ 29 | 30 | In order to compile, you must set HAS_JAVA to 1 in the global Makefile.config 31 | and type "make" from the Apron main directory. 32 | You must also set-up Java-specific binary names and directories your 33 | Makefile.config. 34 | In particular, you will probably need to set the JNIINC variable to provide 35 | the -I to include jni.h. 36 | 37 | "make" builds classfiles and .jar, and .so glue C libraries 38 | 39 | "make install" installs the .so, but not classfiles nor .jar 40 | 41 | "make doc" builds some Javadoc documentation 42 | 43 | The PPL binding is optional. It is built only if HAS_PPL is 1. 44 | Currently, 45 | 46 | Currently, whether to compile a double, MPQ, or MPFR of boxes and 47 | octagons is hardcoded in the Makefile. 48 | 49 | 50 | RUNNING 51 | ####### 52 | 53 | Make sure to update your CLASSPATH to contain the path with the 54 | .class / .jar files 55 | and your LD_LIBRARY_PATH to contain the path with the .so files 56 | 57 | To run some tests, type 58 | java -ea gmp.Test 59 | java -ea apron.Test 60 | 61 | On Eclipse, make sure, in the Project menu, to: 62 | - add the apron.jar and gmp.jar files in the "Add External Jars" dialog 63 | - add the path of the .so files in the "Native Library Location" dialog 64 | 65 | 66 | 67 | DOCUMENTATION 68 | ############# 69 | 70 | For information on the API, type "make doc" and look in the doc/ subdirectory. 71 | 72 | -------------------------------------------------------------------------------- /japron/apron/ApronException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * ApronException.java 3 | * 4 | * APRON Library / Java Apron binding 5 | * 6 | * Copyright (C) Antoine Mine' 2010 7 | */ 8 | 9 | package apron; 10 | 11 | /** 12 | * Superclass of Apron-specific exceptions that can be thrown 13 | * by numerical abstract domains. 14 | * 15 | *

Apron functions can also throw standard 16 | * {@code java.lang.RuntimeException}, mainly: 17 | * {@code java.lang.IndexOutOfBoundsException}, 18 | * {@code java.lang.IllegalArgumentException}, 19 | * {@code java.lang.ArithmeticException}, 20 | * and {@code java.lang.NullPointerException}. 21 | */ 22 | public class ApronException 23 | extends Exception 24 | { 25 | 26 | /** Manager that caused the exception. */ 27 | public Manager manager; 28 | 29 | /** 30 | * Identifier of the operation that caused the exception. 31 | * 32 | * ({@link apron.Manager#FUNID_COPY}, etc.) 33 | */ 34 | public int funid; 35 | 36 | public ApronException() 37 | { 38 | super(); 39 | } 40 | 41 | public ApronException(String msg, Manager man, int fid) 42 | { 43 | super(msg); 44 | manager = man; 45 | funid = fid; 46 | } 47 | 48 | public int getFunctionID() 49 | { 50 | return funid; 51 | } 52 | 53 | public Manager getManager() 54 | { 55 | return manager; 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /japron/apron/Box.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Box.java 3 | * 4 | * APRON Library / Java Apron binding 5 | * 6 | * Copyright (C) Antoine Mine' 2010 7 | */ 8 | 9 | package apron; 10 | 11 | /** 12 | * Manager factory for the interval abstract domain. 13 | */ 14 | public class Box 15 | extends Manager 16 | { 17 | 18 | // Internals 19 | //////////// 20 | 21 | private native void init(); 22 | 23 | private static native void class_init(); 24 | 25 | static { System.loadLibrary("japron"); class_init(); } 26 | 27 | 28 | // Constructors 29 | /////////////// 30 | 31 | /** 32 | * Creates a new manager to create and manipulate boxes. 33 | */ 34 | public Box() 35 | { 36 | init(); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /japron/apron/Coeff.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Coeff.java 3 | * 4 | * APRON Library / Java Apron binding 5 | * 6 | * Copyright (C) Antoine Mine' 2010 7 | */ 8 | 9 | package apron; 10 | 11 | import java.io.*; 12 | 13 | /** 14 | * Abstract class of constant coefficients that can appear in expressions. 15 | * 16 | *

A coefficient can be either a {@link apron.Scalar} real singleton or 17 | * an {@link apron.Interval} set of real values. 18 | * The Coeff class provides methods to manipulate coefficients independently 19 | * from the underlying representation. 20 | */ 21 | abstract public class Coeff 22 | implements Cloneable, Serializable 23 | { 24 | 25 | // Constructors 26 | /////////////// 27 | 28 | /** Creates a 0 coefficient as a double Scalar. */ 29 | public static Coeff create() 30 | { return Scalar.create(); } 31 | 32 | /** Creates a copy of the coefficient, of the same kind. */ 33 | public abstract Coeff copy(); 34 | 35 | 36 | // Get functions 37 | //////////////// 38 | 39 | /** Returns a reference to the lower bound of this. */ 40 | abstract public Scalar inf(); 41 | 42 | /** Returns a reference to the upper bound of this. */ 43 | abstract public Scalar sup(); 44 | 45 | /** Returns a string representation of this. */ 46 | abstract public String toString(); 47 | 48 | /** Returns a hash of the value of this. */ 49 | abstract public int hashCode(); 50 | 51 | 52 | // Tests 53 | //////// 54 | 55 | /** Whether this represents the singleton 0. */ 56 | abstract public boolean isZero(); 57 | 58 | /** Whether this represents a singleton. */ 59 | abstract public boolean isScalar(); 60 | 61 | /** Whether this represents the singleton i. */ 62 | abstract public boolean isEqual(int i); 63 | 64 | /** Whether this equals x. */ 65 | abstract public boolean isEqual(Coeff x); 66 | 67 | /** 68 | * Compare this and x for inclusion. 69 | * 70 | * @see apron.Interval#cmp(Interval) 71 | */ 72 | abstract public int cmp(Coeff x); 73 | 74 | 75 | // Operations 76 | ////////////// 77 | 78 | /** Negates this. */ 79 | abstract public void neg(); 80 | 81 | /** Whether x is a Coeff has the same value. */ 82 | public boolean equals(Object x) 83 | { 84 | return (x instanceof Coeff) && (isEqual((Coeff)x)); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /japron/apron/Dimension.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Dimension.java 3 | * 4 | * APRON Library / Java Apron binding 5 | * 6 | * Copyright (C) Antoine Mine' 2010 7 | */ 8 | 9 | package apron; 10 | 11 | import java.io.*; 12 | 13 | /** 14 | * Class of dimension specifications for level 0 objects. 15 | * 16 | *

A level 0 object ({@link apron.Abstract0}, etc.) has a set of 17 | * integer-valued and a set of real-valued dimensions. 18 | * A Dimension objects indicates how many dimensions of each kind. 19 | * It is simply a pair of positive integers: intDim and realDim. 20 | * 21 | *

In level 0 objects, integer-valued variables are numbered 22 | * from 0 to intDim-1, and real-valued variables are numbered from 23 | * intDim to intDim+realDim-1. 24 | */ 25 | public class Dimension 26 | implements Cloneable, Serializable 27 | { 28 | 29 | /** Number of integer-valued dimensions. */ 30 | public int intDim; 31 | 32 | /** Number of real-valued dimensions. */ 33 | public int realDim; 34 | 35 | /** Constructs a new Dimension object. */ 36 | public Dimension(int intdim, int realdim) 37 | { 38 | intDim = intdim; 39 | realDim = realDim; 40 | } 41 | 42 | /** Returns a String representation of the dimension. */ 43 | public String toString() 44 | { 45 | return "( i: " + intDim + ", r: " + realDim + " )"; 46 | } 47 | 48 | /** Whether x is equal to this. */ 49 | public boolean isEqual(Dimension x) 50 | { 51 | return intDim==x.intDim && realDim==x.realDim; 52 | } 53 | 54 | /** Whether x is a Dimension and structurally equal to this. */ 55 | public boolean equals(Object x) 56 | { 57 | return (x instanceof Dimension) && (isEqual((Dimension)x)); 58 | } 59 | 60 | public int getIntegerDimension() 61 | { 62 | return intDim; 63 | } 64 | 65 | public int getRealDimension() 66 | { 67 | return realDim; 68 | } 69 | 70 | public void setIntegerDimension(int d) 71 | { 72 | intDim = d; 73 | } 74 | 75 | public void setRealDimension(int d) 76 | { 77 | realDim = d; 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /japron/apron/Linterm1.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Linterm1.java 3 | * 4 | * APRON Library / Java Apron binding 5 | * 6 | * Copyright (C) Antoine Mine' 2010 7 | */ 8 | 9 | package apron; 10 | 11 | import java.io.*; 12 | 13 | /** 14 | * Class of terms in level 1 linear expressions and constraints. 15 | * 16 | *

A Linterm1 is a pair composed of a {@link apron.Coeff} coefficient 17 | * and a variable denoted by name. 18 | * It represents a single term in a {@link apron.Linexpr1} or 19 | * {@link apron.Lincons1}. 20 | */ 21 | public class Linterm1 22 | implements Cloneable, Serializable 23 | { 24 | /** Variable name. */ 25 | public Var var; 26 | 27 | /** Variable coefficient. */ 28 | public Coeff coeff; 29 | 30 | public Linterm1(String v, Coeff c) 31 | { 32 | this(new StringVar(v), c); 33 | } 34 | /** 35 | * Creates a new linear term. 36 | * 37 | *

The coefficient is referenced, not copied. 38 | */ 39 | public Linterm1(Var v, Coeff c) 40 | { 41 | var = v; 42 | coeff = c; 43 | } 44 | 45 | /** 46 | * Creates a copy of the linear term. 47 | * 48 | *

The coefficient is copied. 49 | */ 50 | public Linterm1(Linterm1 t) 51 | { 52 | var = t.var; 53 | coeff = t.coeff.copy(); 54 | } 55 | 56 | /** 57 | * Returns a String representation of the linear term. 58 | */ 59 | public String toString() 60 | { 61 | return coeff.toString() + var; 62 | } 63 | 64 | /** Returns a copy of this. */ 65 | public Linterm1 clone() 66 | { 67 | return new Linterm1(var, coeff); 68 | } 69 | 70 | /** Whether x and this are structurally equal. */ 71 | public boolean isEqual(Linterm1 x) 72 | { 73 | return var.equals(x.var) && coeff.isEqual(x.coeff); 74 | } 75 | 76 | /** Whether x is a Linterm1 and structurally equal to this. */ 77 | public boolean equals(Object x) 78 | { 79 | return (x instanceof Linterm1) && (isEqual((Linterm1)x)); 80 | } 81 | 82 | public Var getVariable() 83 | { 84 | return var; 85 | } 86 | 87 | public Coeff getCoefficient() 88 | { 89 | return coeff; 90 | } 91 | 92 | public void setVariable(String s) 93 | { 94 | var = new StringVar(s); 95 | } 96 | 97 | public void setVariable(Var s) 98 | { 99 | var = s; 100 | } 101 | 102 | public void setCoeffcient(Coeff c) 103 | { 104 | coeff = c; 105 | } 106 | 107 | } 108 | -------------------------------------------------------------------------------- /japron/apron/NotImplementedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * NotImplementedException.java 3 | * 4 | * APRON Library / Java Apron binding 5 | * 6 | * Copyright (C) Antoine Mine' 2010 7 | */ 8 | 9 | package apron; 10 | 11 | /** 12 | * Exception thrown when calling an abstract transfer 13 | * function that is not implemented in the domain. 14 | */ 15 | public class NotImplementedException 16 | extends ApronException 17 | { 18 | 19 | public NotImplementedException() 20 | { 21 | super(); 22 | } 23 | 24 | public NotImplementedException(String msg, Manager man, int fid) 25 | { 26 | super(msg, man, fid); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /japron/apron/Octagon.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Octagon.java 3 | * 4 | * APRON Library / Java Apron binding 5 | * 6 | * Copyright (C) Antoine Mine' 2010 7 | */ 8 | 9 | package apron; 10 | 11 | /** 12 | * Manager factory for the octagon abstract domain. 13 | */ 14 | public class Octagon 15 | extends Manager 16 | { 17 | 18 | // Internals 19 | //////////// 20 | 21 | private native void init(); 22 | 23 | private static native void class_init(); 24 | 25 | static { System.loadLibrary("japron"); class_init(); } 26 | 27 | 28 | // Constructors 29 | /////////////// 30 | 31 | /** 32 | * Creates a new manager to create and manipulate octagons. 33 | */ 34 | public Octagon() 35 | { 36 | init(); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /japron/apron/OutOfSpaceException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * OutOfSpaceException.java 3 | * 4 | * APRON Library / Java Apron binding 5 | * 6 | * Copyright (C) Antoine Mine' 2010 7 | */ 8 | 9 | package apron; 10 | 11 | /** 12 | * Exception thrown by an abstract transfer function when 13 | * the maximum memory consumption is exceeded. 14 | * 15 | *

The maximum memory consumption is set by 16 | * {@link apron.Manager#setMaxObjectSize}, on a 17 | * per-function, per-manager basis. There is no limit by default. 18 | * The unit of memory consumption is unspecified (it may not be bytes). 19 | * 20 | *

This exception is not a (fatal) {@code java.lang.OutOfMemoryError}, 21 | * but merely exceeding a self-imposed limit. The function can be called again 22 | * after raising the limit. 23 | */ 24 | public class OutOfSpaceException 25 | extends ApronException 26 | { 27 | 28 | public OutOfSpaceException() 29 | { 30 | super(); 31 | } 32 | 33 | public OutOfSpaceException(String msg, Manager man, int fid) 34 | { 35 | super(msg, man, fid); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /japron/apron/OverflowException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * OverflowException.java 3 | * 4 | * APRON Library / Java Apron binding 5 | * 6 | * Copyright (C) Antoine Mine' 2010 7 | */ 8 | 9 | package apron; 10 | 11 | /** 12 | * Exception thrown by an abstract transfer function in 13 | * case of an arithmetic overflow. 14 | * 15 | *

It indicates that the expected result cannot be expressed nor 16 | * soundly approximated due to arithmetic limitations. 17 | * 18 | *

This can happen when using a domain implementation based on 19 | * machine, fixed-length types (such as machine integers). 20 | * However, this cannot happen with arbitrary-precision 21 | * types (such as GMP) or types that can always provide some 22 | * sound over approximation (such as machine or multi-precision 23 | * floating-point numbers). 24 | */ 25 | public class OverflowException 26 | extends ApronException 27 | { 28 | public OverflowException() 29 | { 30 | super(); 31 | } 32 | 33 | public OverflowException(String msg, Manager man, int fid) 34 | { 35 | super(msg, man, fid); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /japron/apron/Polka.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Polka.java 3 | * 4 | * APRON Library / Java Apron binding 5 | * 6 | * Copyright (C) Antoine Mine' 2010 7 | */ 8 | 9 | package apron; 10 | 11 | /** 12 | * Manager factory for the convex polyhedron abstract domain. 13 | */ 14 | public class Polka 15 | extends Manager 16 | { 17 | 18 | // Internals 19 | //////////// 20 | 21 | private native void init(boolean strict); 22 | 23 | private static native void class_init(); 24 | 25 | static { System.loadLibrary("japron"); class_init(); } 26 | 27 | 28 | // Constructors 29 | /////////////// 30 | 31 | /** 32 | * Creates a new manager to create and manipulate convex polyhedra. 33 | * 34 | *

If strict is true, then the domain can express strict 35 | * inequalities, i.e., non-closed convex polyhedra. 36 | * Otherwise, the domain expresses closed convex polyhedra. 37 | */ 38 | public Polka(boolean strict) 39 | { 40 | init(strict); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /japron/apron/PolkaEq.java: -------------------------------------------------------------------------------- 1 | /* 2 | * PolkaEq.java 3 | * 4 | * APRON Library / Java Apron binding 5 | * 6 | * Copyright (C) Antoine Mine' 2010 7 | */ 8 | 9 | package apron; 10 | 11 | /** 12 | * Manager factory for the linear equalities domain. 13 | */ 14 | public class PolkaEq 15 | extends Manager 16 | { 17 | 18 | // Internals 19 | //////////// 20 | 21 | private native void init(); 22 | 23 | private static native void class_init(); 24 | 25 | static { System.loadLibrary("japron"); class_init(); } 26 | 27 | 28 | // Constructors 29 | /////////////// 30 | 31 | /** 32 | * Creates a new manager to create and manipulate linear equalities. 33 | */ 34 | public PolkaEq() 35 | { 36 | init(); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /japron/apron/PolkaGrid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * PolkaGrid.java 3 | * 4 | * APRON Library / Java Apron binding 5 | * 6 | * Copyright (C) Antoine Mine' 2010 7 | */ 8 | 9 | package apron; 10 | 11 | /** 12 | * Manager factory for the reduced product of the {@link apron.Polka} 13 | * convex polyhedra and {@link apron.PplGrid} the linear congruence 14 | * equalities domains. 15 | */ 16 | public class PolkaGrid 17 | extends Manager 18 | { 19 | 20 | // Internals 21 | //////////// 22 | 23 | private native void init(boolean strict); 24 | 25 | private static native void class_init(); 26 | 27 | static { System.loadLibrary("japron"); class_init(); } 28 | 29 | 30 | // Constructors 31 | /////////////// 32 | 33 | /** 34 | * Creates a new manager to create and manipulate reduced product of 35 | * {@link apron.Polka} and {@link apron.PplGrid} linear congruence 36 | * equalities. 37 | * 38 | *

If strict is true, then the domain can express strict 39 | * linear inequalities. 40 | */ 41 | public PolkaGrid(boolean strict) 42 | { 43 | init(strict); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /japron/apron/PplGrid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * PplGrid.java 3 | * 4 | * APRON Library / Java Apron binding 5 | * 6 | * Copyright (C) Antoine Mine' 2010 7 | */ 8 | 9 | package apron; 10 | 11 | /** 12 | * Manager factory for the Parma Polyhedra Library linear 13 | * congruence equalities domain. 14 | */ 15 | public class PplGrid 16 | extends Manager 17 | { 18 | 19 | // Internals 20 | //////////// 21 | 22 | private native void init(); 23 | 24 | private static native void class_init(); 25 | 26 | static { System.loadLibrary("japron"); class_init(); } 27 | 28 | 29 | // Constructors 30 | /////////////// 31 | 32 | /** 33 | * Creates a new manager to create and manipulate linear 34 | * congruence equalities using the Parma Polyhedra Library. 35 | */ 36 | public PplGrid() 37 | { 38 | init(); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /japron/apron/PplPoly.java: -------------------------------------------------------------------------------- 1 | /* 2 | * PplPoly.java 3 | * 4 | * APRON Library / Java Apron binding 5 | * 6 | * Copyright (C) Antoine Mine' 2010 7 | */ 8 | 9 | package apron; 10 | 11 | /** 12 | * Manager factory for the Parma Polyhedra Library convex polyhedra domain. 13 | */ 14 | public class PplPoly 15 | extends Manager 16 | { 17 | 18 | // Internals 19 | //////////// 20 | 21 | private native void init(boolean strict); 22 | 23 | private static native void class_init(); 24 | 25 | static { System.loadLibrary("japron"); class_init(); } 26 | 27 | 28 | // Constructors 29 | /////////////// 30 | 31 | /** 32 | * Creates a new manager to create and manipulate convex polyhedra. 33 | * using the Parma Polyhedra Library. 34 | * 35 | *

If strict is true, then the domain can express strict 36 | * inequalities, i.e., non-closed convex polyhedra. 37 | * Otherwise, the domain expresses closed convex polyhedra. 38 | */ 39 | public PplPoly(boolean strict) 40 | { 41 | init(strict); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /japron/apron/StringVar.java: -------------------------------------------------------------------------------- 1 | /* 2 | * StringVar.java 3 | * 4 | * Implementation of a String variable 5 | * 6 | * APRON Library / Java Apron binding 7 | * 8 | */ 9 | package apron; 10 | 11 | public class StringVar implements Var 12 | { 13 | 14 | private String name; 15 | 16 | public StringVar(String name) 17 | { 18 | this.name = name; 19 | } 20 | 21 | public int compareTo(Var v) 22 | { 23 | return toString().compareTo(v.toString()); 24 | } 25 | 26 | public boolean equals(Object o) 27 | { 28 | return 29 | (o instanceof StringVar) && 30 | name.equals(((StringVar)o).name); 31 | } 32 | 33 | public int hashCode() 34 | { 35 | return name.hashCode(); 36 | } 37 | 38 | public String toString() 39 | { 40 | return name; 41 | } 42 | 43 | public Var clone() { 44 | return new StringVar(name); 45 | } 46 | 47 | public static Var[] arrayOfStrings(String []vars) 48 | { 49 | if (vars==null) { 50 | return null; 51 | } 52 | 53 | Var vvars[] = new Var[vars.length]; 54 | for(int i=0; i < vars.length; i++) { 55 | vvars[i] = new StringVar(vars[i]); 56 | } 57 | return vvars; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /japron/apron/TimeoutException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * TimeoutException.java 3 | * 4 | * APRON Library / Java Apron binding 5 | * 6 | * Copyright (C) Antoine Mine' 2010 7 | */ 8 | 9 | package apron; 10 | 11 | /** 12 | * Exception thrown by an abstract transfer function when 13 | * the timeout is exceeded. 14 | * 15 | *

The timeout is set by {@link apron.Manager#setTimeout}, on a 16 | * per-function, per-manager basis. There is no timeout by default. 17 | * 18 | *

Note: timeouts are not currently implemented. 19 | */ 20 | public class TimeoutException 21 | extends ApronException 22 | { 23 | public TimeoutException() 24 | { 25 | super(); 26 | } 27 | 28 | public TimeoutException(String msg, Manager man, int fid) 29 | { 30 | super(msg, man, fid); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /japron/apron/Var.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Var.java 3 | * 4 | * Definition of abstract Var class for level 1 variables 5 | * 6 | * APRON Library / Java Apron binding 7 | * 8 | */ 9 | package apron; 10 | 11 | import java.io.*; 12 | 13 | /** 14 | *

Abstract class for Variables for level 1. 15 | * 16 | *

Variables need to implement Comparable to ensure 17 | * a total ordering in the envirnment, and all 18 | * labels in an environment are of type Var 19 | */ 20 | public interface Var extends Comparable, Cloneable, Serializable 21 | { 22 | public Var clone(); 23 | public int compareTo(Var var); 24 | } 25 | -------------------------------------------------------------------------------- /japron/apron/apron_Box.c: -------------------------------------------------------------------------------- 1 | /* 2 | * apron_Box.c 3 | * 4 | * glue for Box.java 5 | * 6 | * APRON Library / Java Apron binding 7 | * 8 | * Copyright (C) Antoine Mine' 2010 9 | */ 10 | 11 | #include "japron.h" 12 | #include "apron_Box.h" 13 | #include "box.h" 14 | 15 | ////////////////////////////////////// 16 | 17 | /* 18 | * Class: apron_Box 19 | * Method: init 20 | * Signature: ()V 21 | */ 22 | JNIEXPORT void JNICALL Java_apron_Box_init 23 | (JNIEnv *env, jobject o) 24 | { 25 | check_nonnull(o,); 26 | ap_manager_t* m = box_manager_alloc(); 27 | if (!m) { out_of_memory("cannot create manager"); return; } 28 | japron_manager_setup(m); 29 | set_manager(o, m); 30 | } 31 | 32 | /* 33 | * Class: apron_Box 34 | * Method: class_init 35 | * Signature: ()V 36 | */ 37 | JNIEXPORT void JNICALL Java_apron_Box_class_1init 38 | (JNIEnv *env, jclass cls) 39 | { 40 | japron_cache(env); 41 | } 42 | 43 | -------------------------------------------------------------------------------- /japron/apron/apron_Lincons0.c: -------------------------------------------------------------------------------- 1 | /* 2 | * apron_Lincons0.c 3 | * 4 | * glue for Lincons0.java 5 | * 6 | * APRON Library / Java Apron binding 7 | * 8 | * Copyright (C) Antoine Mine' 2010 9 | */ 10 | 11 | #include "japron.h" 12 | #include "apron_Lincons0.h" 13 | 14 | ////////////////////////////////////// 15 | 16 | JNIEXPORT jboolean JNICALL Java_apron_Lincons0_isUnsat 17 | (JNIEnv *env, jobject o) 18 | { 19 | check_nonnull(o,0); 20 | ap_lincons0_t l; 21 | if (!japron_lincons0_init_set(env, &l, o)) return 0; 22 | bool r = ap_lincons0_is_unsat(&l); 23 | japron_lincons0_clear(&l); 24 | return r; 25 | } 26 | 27 | -------------------------------------------------------------------------------- /japron/apron/apron_Octagon.c: -------------------------------------------------------------------------------- 1 | /* 2 | * apron_Octagon.c 3 | * 4 | * glue for Octagon.java 5 | * 6 | * APRON Library / Java Apron binding 7 | * 8 | * Copyright (C) Antoine Mine' 2010 9 | */ 10 | 11 | #include "japron.h" 12 | #include "apron_Octagon.h" 13 | #include "oct.h" 14 | 15 | ////////////////////////////////////// 16 | 17 | /* 18 | * Class: apron_Octagon 19 | * Method: init 20 | * Signature: ()V 21 | */ 22 | JNIEXPORT void JNICALL Java_apron_Octagon_init 23 | (JNIEnv *env, jobject o) 24 | { 25 | check_nonnull(o,); 26 | ap_manager_t* m = oct_manager_alloc(); 27 | if (!m) { out_of_memory("cannot create manager"); return; } 28 | japron_manager_setup(m); 29 | set_manager(o, m); 30 | } 31 | 32 | /* 33 | * Class: apron_Octagon 34 | * Method: class_init 35 | * Signature: ()V 36 | */ 37 | JNIEXPORT void JNICALL Java_apron_Octagon_class_1init 38 | (JNIEnv *env, jclass cls) 39 | { 40 | japron_cache(env); 41 | } 42 | 43 | -------------------------------------------------------------------------------- /japron/apron/apron_Polka.c: -------------------------------------------------------------------------------- 1 | /* 2 | * apron_Polka.c 3 | * 4 | * glue for Polka.java 5 | * 6 | * APRON Library / Java Apron binding 7 | * 8 | * Copyright (C) Antoine Mine' 2010 9 | */ 10 | 11 | #include "japron.h" 12 | #include "apron_Polka.h" 13 | #include "pk.h" 14 | 15 | ////////////////////////////////////// 16 | 17 | /* 18 | * Class: apron_Polka 19 | * Method: init 20 | * Signature: (Z)V 21 | */ 22 | JNIEXPORT void JNICALL Java_apron_Polka_init 23 | (JNIEnv *env, jobject o, jboolean strict) 24 | { 25 | check_nonnull(o,); 26 | ap_manager_t* m = pk_manager_alloc(strict); 27 | if (!m) { out_of_memory("cannot create manager"); return; } 28 | japron_manager_setup(m); 29 | set_manager(o, m); 30 | } 31 | 32 | /* 33 | * Class: apron_Polka 34 | * Method: class_init 35 | * Signature: ()V 36 | */ 37 | JNIEXPORT void JNICALL Java_apron_Polka_class_1init 38 | (JNIEnv *env, jclass cls) 39 | { 40 | japron_cache(env); 41 | } 42 | 43 | -------------------------------------------------------------------------------- /japron/apron/apron_PolkaEq.c: -------------------------------------------------------------------------------- 1 | /* 2 | * apron_PolkaEq.c 3 | * 4 | * glue for PolkaEq.java 5 | * 6 | * APRON Library / Java Apron binding 7 | * 8 | * Copyright (C) Antoine Mine' 2010 9 | */ 10 | 11 | #include "japron.h" 12 | #include "apron_PolkaEq.h" 13 | #include "pkeq.h" 14 | 15 | ////////////////////////////////////// 16 | 17 | /* 18 | * Class: apron_PolkaEq 19 | * Method: init 20 | * Signature: ()V 21 | */ 22 | JNIEXPORT void JNICALL Java_apron_PolkaEq_init 23 | (JNIEnv *env, jobject o) 24 | { 25 | check_nonnull(o,); 26 | ap_manager_t* m = pkeq_manager_alloc(); 27 | if (!m) { out_of_memory("cannot create manager"); return; } 28 | japron_manager_setup(m); 29 | set_manager(o, m); 30 | } 31 | 32 | /* 33 | * Class: apron_PolkaEq 34 | * Method: class_init 35 | * Signature: ()V 36 | */ 37 | JNIEXPORT void JNICALL Java_apron_PolkaEq_class_1init 38 | (JNIEnv *env, jclass cls) 39 | { 40 | japron_cache(env); 41 | } 42 | 43 | -------------------------------------------------------------------------------- /japron/apron/apron_PolkaGrid.c: -------------------------------------------------------------------------------- 1 | /* 2 | * apron_PolkaGrid.c 3 | * 4 | * glue for PolkaGrid.java 5 | * 6 | * APRON Library / Java Apron binding 7 | * 8 | * Copyright (C) Antoine Mine' 2010 9 | */ 10 | 11 | #include "japron.h" 12 | #include "apron_PolkaGrid.h" 13 | #include "pk.h" 14 | #include "ap_ppl.h" 15 | #include "ap_pkgrid.h" 16 | 17 | ////////////////////////////////////// 18 | 19 | /* 20 | * Class: apron_PolkaGrid 21 | * Method: init 22 | * Signature: ()V 23 | */ 24 | JNIEXPORT void JNICALL Java_apron_PolkaGrid_init 25 | (JNIEnv *env, jobject o, jboolean strict) 26 | { 27 | check_nonnull(o,); 28 | ap_manager_t* m1 = pk_manager_alloc(strict); 29 | ap_manager_t* m2 = ap_ppl_grid_manager_alloc(); 30 | ap_manager_t* m = ap_pkgrid_manager_alloc(m1, m2); 31 | japron_manager_setup(m1); 32 | japron_manager_setup(m2); 33 | ap_manager_free(m1); 34 | ap_manager_free(m2); 35 | if (!m) { out_of_memory("cannot create manager"); return; } 36 | japron_manager_setup(m); 37 | set_manager(o, m); 38 | } 39 | 40 | /* 41 | * Class: apron_PolkaGrid 42 | * Method: class_init 43 | * Signature: ()V 44 | */ 45 | JNIEXPORT void JNICALL Java_apron_PolkaGrid_class_1init 46 | (JNIEnv *env, jclass cls) 47 | { 48 | japron_cache(env); 49 | } 50 | 51 | -------------------------------------------------------------------------------- /japron/apron/apron_PplGrid.c: -------------------------------------------------------------------------------- 1 | /* 2 | * apron_PplGrid.c 3 | * 4 | * glue for PplGrid.java 5 | * 6 | * APRON Library / Java Apron binding 7 | * 8 | * Copyright (C) Antoine Mine' 2010 9 | */ 10 | 11 | #include "japron.h" 12 | #include "apron_PplGrid.h" 13 | #include "ap_ppl.h" 14 | 15 | ////////////////////////////////////// 16 | 17 | /* 18 | * Class: apron_PplGrid 19 | * Method: init 20 | * Signature: ()V 21 | */ 22 | JNIEXPORT void JNICALL Java_apron_PplGrid_init 23 | (JNIEnv *env, jobject o) 24 | { 25 | check_nonnull(o,); 26 | ap_manager_t* m = ap_ppl_grid_manager_alloc(); 27 | if (!m) { out_of_memory("cannot create manager"); return; } 28 | japron_manager_setup(m); 29 | set_manager(o, m); 30 | } 31 | 32 | /* 33 | * Class: apron_PplGrid 34 | * Method: class_init 35 | * Signature: ()V 36 | */ 37 | JNIEXPORT void JNICALL Java_apron_PplGrid_class_1init 38 | (JNIEnv *env, jclass cls) 39 | { 40 | japron_cache(env); 41 | } 42 | 43 | -------------------------------------------------------------------------------- /japron/apron/apron_PplPoly.c: -------------------------------------------------------------------------------- 1 | /* 2 | * apron_PplPoly.c 3 | * 4 | * glue for PplPoly.java 5 | * 6 | * APRON Library / Java Apron binding 7 | * 8 | * Copyright (C) Antoine Mine' 2010 9 | */ 10 | 11 | #include "japron.h" 12 | #include "apron_PplPoly.h" 13 | #include "ap_ppl.h" 14 | 15 | ////////////////////////////////////// 16 | 17 | /* 18 | * Class: apron_PplPoly 19 | * Method: init 20 | * Signature: ()V 21 | */ 22 | JNIEXPORT void JNICALL Java_apron_PplPoly_init 23 | (JNIEnv *env, jobject o, jboolean strict) 24 | { 25 | check_nonnull(o,); 26 | ap_manager_t* m = ap_ppl_poly_manager_alloc(strict); 27 | if (!m) { out_of_memory("cannot create manager"); return; } 28 | japron_manager_setup(m); 29 | set_manager(o, m); 30 | } 31 | 32 | /* 33 | * Class: apron_PplPoly 34 | * Method: class_init 35 | * Signature: ()V 36 | */ 37 | JNIEXPORT void JNICALL Java_apron_PplPoly_class_1init 38 | (JNIEnv *env, jclass cls) 39 | { 40 | japron_cache(env); 41 | } 42 | 43 | -------------------------------------------------------------------------------- /japron/gmp/MpzRef.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MpzRef.java 3 | * 4 | * APRON Library / Java GMP/MPFR binding 5 | * 6 | * Copyright (C) Antoine Mine' 2010 7 | */ 8 | 9 | package gmp; 10 | 11 | import java.io.*; 12 | 13 | /** 14 | * Class of references to numerators and denominator of {@link gmp.Mpq} 15 | * objects. 16 | * 17 | *

A {@code mpq_t} GMP C object contains a numerator and a denominator 18 | * which are themselves {@code mpz_t} GMP C objects and can be manipulated 19 | * independently. 20 | * The MpzRef class proposes a similar interface for Java. 21 | * A MpzRef to reference the numerator or the denominator of a {@link gmp.Mpq} 22 | * object can be obtained using the {@link gmp.Mpq#numRef} and 23 | * {@link gmp.Mpq#denRef} methods. 24 | * The MpzRef can then be manipulated exactly as a {@link gmp.Mpz}, from which 25 | * it inherits all methods. 26 | * This allows manipulating {@link gmp.Mpq} numerators and denominators 27 | * in-place, without requiring any copy. 28 | * 29 | *

MpzRef cannot be serialized as it represents a reference to a part of 30 | * a larger object. 31 | */ 32 | public class MpzRef extends Mpz 33 | { 34 | /** 35 | * We keep a pointer to the parent {@link gmp.Mpq} object so that it is 36 | * not freed while a MpzRef on it is live. 37 | */ 38 | protected Object parent; 39 | 40 | /** 41 | * A MpzRef can only be constructed by a {@link gmp.Mpq} object. 42 | */ 43 | private MpzRef() { assert(false); } 44 | 45 | /** 46 | * MpzRef are not clonable. 47 | * 48 | * @throws CloneNotSupportedException 49 | */ 50 | public MpzRef clone() 51 | throws CloneNotSupportedException 52 | { 53 | throw new CloneNotSupportedException(); 54 | } 55 | 56 | /** 57 | * Overrides {@link gmp.Mpz#finalize} to prevent deallocation (deprecated). 58 | */ 59 | //protected void finalize() { } 60 | 61 | private static native void class_init(); 62 | 63 | static { System.loadLibrary("jgmp"); class_init(); } 64 | 65 | /** 66 | * A MpzRef represents a reference and cannot be serialized. 67 | */ 68 | private void writeObject(ObjectOutputStream out) 69 | throws NotSerializableException 70 | { throw new NotSerializableException(); } 71 | 72 | /** 73 | * A MpzRef represents a reference and cannot be serialized. 74 | */ 75 | private void readObject(ObjectInputStream in) 76 | throws NotSerializableException 77 | { throw new NotSerializableException(); } 78 | 79 | /** A MpzRef object represents a reference and cannot be serialized. */ 80 | private void readObjectNoData() 81 | throws NotSerializableException 82 | { throw new NotSerializableException(); } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /japron/gmp/gmp_MpzRef.c: -------------------------------------------------------------------------------- 1 | /* 2 | * gmp_MpzRef.c 3 | * 4 | * glue for MpzRef class 5 | * 6 | * APRON Library / Java GMP/MPFR binding 7 | * 8 | * Copyright (C) Antoine Mine' 2010 9 | */ 10 | 11 | #include "jgmp.h" 12 | #include "gmp_Mpq.h" 13 | 14 | /* 15 | * Class: gmp_MpzRef 16 | * Method: class_init 17 | * Signature: ()V 18 | */ 19 | JNIEXPORT void JNICALL Java_gmp_MpzRef_class_1init 20 | (JNIEnv *env, jclass cls) 21 | { 22 | jgmp_cache(env); 23 | } 24 | -------------------------------------------------------------------------------- /japron/gmp/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * package-info.java 3 | * 4 | * APRON Library / Java GMP/MPFR binding 5 | * 6 | * Copyright (C) Antoine Mine' 2010 7 | */ 8 | 9 | /** 10 | * Java binding for the GNU Multiple Precision Arithmetic Library (GMP) 11 | * and the Multiple Precision Floating-Point Reliable Library (MPFR). 12 | * 13 | *

This includes arbitrary-precision integers {@link gmp.Mpz} and 14 | * rationals {@link gmp.Mpq} (growing as needed), and multi-precision 15 | * floating-points numbers {@link gmp.Mpfr} that extend the IEEE-754 standard 16 | * to an arbitrary, user-chosen precision level. 17 | * 18 | *

Unlike Java's {@code BigIntegers}, all {@link gmp.Mpz}, {@link gmp.Mpq}, 19 | * and {@link gmp.Mpfr} objects are mutable. 20 | * 21 | *

Most arithmetic operators are in three-address mode: the this object 22 | * is the destination while the operator arguments are unchanged 23 | * (with the exception of the division and extended gcd, where extra 24 | * results are returned in the first arguments). 25 | * It is possible to pass the same object (including this) as source and 26 | * destination of an operation. However, when an operator modifies several 27 | * objects, these must be distinct. 28 | * 29 | *

The binding is based on GMP 4.3.2 and MPFR 2.4.1. 30 | * 31 | * @see http://gmplib.org/ 32 | * @see http://www.mpfr.org/ 33 | * @author Antoine Miné 34 | * @version 0.1 35 | */ 36 | package gmp; 37 | -------------------------------------------------------------------------------- /mlapronidl/META.in: -------------------------------------------------------------------------------- 1 | description = "Numerical abstract domains" 2 | version = "@VERSION@" 3 | requires = "apron.apron" 4 | package "apron" ( 5 | requires = "gmp" 6 | archive(native,debug) = "apron.d.cmxa" 7 | archive(byte) = "apron.cma" 8 | archive(native) = "apron.cmxa" 9 | ) 10 | package "boxD" ( 11 | requires = "apron.apron" 12 | archive(byte) = "boxD.cma" 13 | archive(native) = "boxD.cmxa" 14 | archive(native,debug) = "boxD.d.cmxa" 15 | ) 16 | package "boxMPQ" ( 17 | requires = "apron.apron" 18 | archive(byte) = "boxMPQ.cma" 19 | archive(native) = "boxMPQ.cmxa" 20 | archive(native,debug) = "boxMPQ.d.cmxa" 21 | ) 22 | package "boxMPFR" ( 23 | requires = "apron.apron" 24 | archive(byte) = "boxMPFR.cma" 25 | archive(native) = "boxMPFR.cmxa" 26 | archive(native,debug) = "boxMPFR.d.cmxa" 27 | ) 28 | package "octD" ( 29 | requires = "apron.apron" 30 | archive(byte) = "octD.cma" 31 | archive(native) = "octD.cmxa" 32 | archive(native,debug) = "octD.d.cmxa" 33 | ) 34 | package "octMPQ" ( 35 | requires = "apron.apron" 36 | archive(byte) = "octMPQ.cma" 37 | archive(native) = "octMPQ.cmxa" 38 | archive(native,debug) = "octMPQ.d.cmxa" 39 | ) 40 | package "polkaMPQ" ( 41 | requires = "apron.apron" 42 | archive(native,debug) = "polkaMPQ.d.cmxa" 43 | archive(byte) = "polkaMPQ.cma" 44 | archive(native) = "polkaMPQ.cmxa" 45 | ) 46 | package "polkaRll" ( 47 | requires = "apron.apron" 48 | archive(native,debug) = "polkaRll.d.cmxa" 49 | archive(byte) = "polkaRll.cma" 50 | archive(native) = "polkaRll.cmxa" 51 | ) 52 | package "t1pD" ( 53 | requires = "apron.apron" 54 | archive(native,debug) = "t1pD.d.cmxa" 55 | archive(byte) = "t1pD.cma" 56 | archive(native) = "t1pD.cmxa" 57 | ) 58 | package "t1pMPQ" ( 59 | requires = "apron.apron" 60 | archive(native,debug) = "t1pMPQ.d.cmxa" 61 | archive(byte) = "t1pMPQ.cma" 62 | archive(native) = "t1pMPQ.cmxa" 63 | ) 64 | package "t1pMPFR" ( 65 | requires = "apron.apron" 66 | archive(native,debug) = "t1pMPFR.d.cmxa" 67 | archive(byte) = "t1pMPFR.cma" 68 | archive(native) = "t1pMPFR.cmxa" 69 | ) 70 | package "avoD" ( 71 | requires = "apron.apron" 72 | archive(byte) = "avoD.cma" 73 | archive(native) = "avoD.cmxa" 74 | archive(native,debug) = "avoD.d.cmxa" 75 | ) 76 | package "avoMPQ" ( 77 | requires = "apron.apron" 78 | archive(byte) = "avoMPQ.cma" 79 | archive(native) = "avoMPQ.cmxa" 80 | archive(native,debug) = "avoMPQ.d.cmxa" 81 | ) 82 | package "fppD" ( 83 | requires = "apron.apron" 84 | archive(byte) = "fppD.cma" 85 | archive(native) = "fppD.cmxa" 86 | archive(native,debug) = "fppD.d.cmxa" 87 | ) -------------------------------------------------------------------------------- /mlapronidl/META.ppl.in: -------------------------------------------------------------------------------- 1 | package "ppl" ( 2 | requires = "apron.apron" 3 | archive(byte) = "ppl.cma" 4 | archive(native) = "ppl.cmxa" 5 | archive(native,debug) = "ppl.d.cmxa" 6 | ) 7 | package "polkaGrid" ( 8 | requires = "apron.apron apron.ppl apron.polkaMPQ" 9 | archive(byte) = "polkaGrid.cma" 10 | archive(native) = "polkaGrid.cmxa" 11 | archive(native,debug) = "polkaGrid.d.cmxa" 12 | ) 13 | -------------------------------------------------------------------------------- /mlapronidl/META.pplite.in: -------------------------------------------------------------------------------- 1 | package "pplite" ( 2 | requires = "apron.apron" 3 | archive(byte) = "pplite.cma" 4 | archive(native) = "pplite.cmxa" 5 | archive(native,debug) = "pplite.d.cmxa" 6 | ) 7 | -------------------------------------------------------------------------------- /mlapronidl/apron_lexer.mli: -------------------------------------------------------------------------------- 1 | (* This file is part of the APRON Library, released under LGPL license 2 | with an exception allowing the redistribution of statically linked 3 | executables. 4 | 5 | Please read the COPYING file packaged in the distribution *) 6 | 7 | (** Lexical analysis of expressions, constraints, generators *) 8 | 9 | exception Error of int * int 10 | val lex: Lexing.lexbuf -> Apron_parser.token 11 | -------------------------------------------------------------------------------- /mlapronidl/generator0.idl: -------------------------------------------------------------------------------- 1 | /* -*- mode: c -*- */ 2 | 3 | /* This file is part of the APRON Library, released under LGPL license 4 | with an exception allowing the redistribution of statically linked 5 | executables. 6 | 7 | Please read the COPYING file packaged in the distribution */ 8 | 9 | quote(MLI,"(** APRON Generators of level 0 *)") 10 | 11 | quote(C, "\n\ 12 | #include \n\ 13 | #include \"ap_generator0.h\"\n\ 14 | #include \"apron_caml.h\"\n\ 15 | \n\ 16 | #define LINE AP_GEN_LINE \n\ 17 | #define RAY AP_GEN_RAY \n\ 18 | #define VERTEX AP_GEN_VERTEX \n\ 19 | #define LINEMOD AP_GEN_LINEMOD \n\ 20 | #define RAYMOD AP_GEN_RAYMOD \n\ 21 | ") 22 | 23 | import "scalar.idl"; 24 | import "interval.idl"; 25 | import "coeff.idl"; 26 | import "dim.idl"; 27 | import "linexpr0.idl"; 28 | 29 | enum gentyp { 30 | LINE, 31 | RAY, 32 | VERTEX, 33 | LINEMOD, 34 | RAYMOD 35 | }; 36 | struct ap_generator0_t { 37 | [mlname(mutable_linexpr0)] ap_linexpr0_ptr linexpr0; /* constant coefficient ignored */ 38 | [mlname(mutable_typ)] enum gentyp gentyp; 39 | }; 40 | struct ap_generator0_array_t { 41 | [size_is(size)] struct ap_generator0_t* p; 42 | int size; 43 | }; 44 | 45 | quote(MLI,"\n\ 46 | (**\n\ 47 | NOTE: Generators are not totally ordered.\n\ 48 | As of 0.9.15, they do not implement the polymorphic [compare] function to avoid confusion.\n\ 49 | As a consequence, the polymorphic [=], [<=], etc. operators cannot be used.\n\ 50 | *)\n\n"); 51 | 52 | quote(MLI,"\n\ 53 | (** Making a generator. The constant coefficient of the linear expression is\n\ 54 | ignored. Modifying later the linear expression modifies correspondingly the\n\ 55 | generator and conversely. *)\n\ 56 | val make : Linexpr0.t -> typ -> t\n\ 57 | \n\ 58 | (** Copy a generator (deep copy) *)\n\ 59 | val copy : t -> t\n\ 60 | \n\ 61 | (** Convert a generator type to a string ([LIN],[RAY], or [VTX]) *)\n\ 62 | val string_of_typ : typ -> string\n\ 63 | \n\ 64 | (** Print a generator *)\n\ 65 | val print : (Dim.t -> string) -> Format.formatter -> t -> unit\n\ 66 | ") 67 | quote(ML,"\n\ 68 | let string_of_typ = function\n\ 69 | | LINE -> \"LIN\"\n\ 70 | | RAY -> \"RAY\"\n\ 71 | | VERTEX -> \"VTX\"\n\ 72 | | LINEMOD -> \"LINMOD\"\n\ 73 | | RAYMOD -> \"RAYMOD\"\n\ 74 | \n\ 75 | let print assoc fmt gen = \n\ 76 | Format.fprintf fmt \"%s:\" (string_of_typ gen.gentyp);\n\ 77 | Linexpr0.print assoc fmt gen.linexpr0;\n\ 78 | ()\n\ 79 | let make expr typ = {\n\ 80 | linexpr0 = expr; typ = typ;\n\ 81 | }\n\ 82 | let copy gen = {\n\ 83 | linexpr0 = Linexpr0.copy gen.linexpr0; typ = gen.typ;\n\ 84 | }\n\ 85 | ") 86 | -------------------------------------------------------------------------------- /mlapronidl/introduction.odoc: -------------------------------------------------------------------------------- 1 | {1 Introduction} 2 | 3 | Coefficients: 4 | - {!Scalar}, {!Interval}, {!Coeff} (either scalars or intervals) 5 | 6 | Managers and Abstract Domains: 7 | - {!Manager} 8 | - {!Box}: intervals 9 | - {!Oct}: octagons 10 | - {!Polka}: convex polyhedra and linear equalities 11 | - {!T1p}: Taylor1plus abstract domain; 12 | - {!Ppl}: interface to PPL convex polyhedra and linear congruences (currently) 13 | - {!PolkaGrid}: reduced product of convex polyhedra and linear congruences 14 | 15 | Level 1 of the interface (user-level): 16 | - {!Var}, {!Environment} 17 | - {!Linexpr1}, {!Lincons1}, {!Generator1}: linear expressions, constraints and generators; 18 | - {!Texpr1}, {!Tcons1}: general expressions and constraints; 19 | - {!Abstract1}: abstract properties 20 | - {!Parser}: converting strings to APRON expressions 21 | 22 | Level 0 of the interface: 23 | - {!Dim} 24 | - {!Linexpr0}, {!Lincons0}, {!Generator0} 25 | - {!Texpr0}, {!Tcons0} 26 | - {!Abstract0} 27 | -------------------------------------------------------------------------------- /mlapronidl/lincons0.idl: -------------------------------------------------------------------------------- 1 | /* -*- mode: c -*- */ 2 | 3 | /* This file is part of the APRON Library, released under LGPL license 4 | with an exception allowing the redistribution of statically linked 5 | executables. 6 | 7 | Please read the COPYING file packaged in the distribution */ 8 | 9 | quote(MLI,"(** APRON Linear constraints of level 0 *)") 10 | 11 | quote(C, "\n\ 12 | #include \n\ 13 | #include \"ap_lincons0.h\"\n\ 14 | #include \"apron_caml.h\"\n\ 15 | \n\ 16 | ") 17 | 18 | import "scalar.idl"; 19 | import "interval.idl"; 20 | import "coeff.idl"; 21 | import "dim.idl"; 22 | import "linexpr0.idl"; 23 | 24 | /* For ap_lincons0_t, 25 | 26 | - the conversion from ML to C may use allocation, but it is automatically freed 27 | by Camlidl mechanisms 28 | - the conversion from C to ML free after conversion the scalar field in the C structure. 29 | the C type should NOT be deallocated 30 | */ 31 | 32 | typedef [mltype("{\n mutable linexpr0 : Linexpr0.t;\n mutable typ : typ;\n}"), 33 | abstract, 34 | ml2c(camlidl_apron_lincons0_ml2c), 35 | c2ml(camlidl_apron_lincons0_c2ml)] 36 | struct ap_lincons0_t ap_lincons0_t; 37 | quote(MLMLI,"and typ =\n | EQ\n | SUPEQ\n | SUP\n | DISEQ\n | EQMOD of Scalar.t\n") 38 | 39 | struct ap_lincons0_array_t { 40 | [size_is(size)] ap_lincons0_t* p; 41 | int size; 42 | }; 43 | 44 | quote(MLI,"\n\ 45 | (** Make a linear constraint. Modifying later the linear expression\n\ 46 | modifies correspondingly the linear constraint and conversely *)\n\ 47 | val make : Linexpr0.t -> typ -> t\n\ 48 | \n\ 49 | (** Copy a linear constraint (deep copy) *)\n\ 50 | val copy : t -> t\n\ 51 | \n\ 52 | (** Convert a constraint type to a string ([=],[>=], or [>]) *)\n\ 53 | val string_of_typ : typ -> string\n\ 54 | \n\ 55 | (** Print a constraint *)\n\ 56 | val print : (Dim.t -> string) -> Format.formatter -> t -> unit\n\ 57 | ") 58 | 59 | quote(ML,"\n\ 60 | let string_of_typ = function\n\ 61 | | EQ | EQMOD _ -> \"=\"\n\ 62 | | SUPEQ -> \">=\"\n\ 63 | | SUP -> \">\"\n\ 64 | | DISEQ -> \"<>\"\n\ 65 | \n\ 66 | let print assoc fmt cons = \n\ 67 | Linexpr0.print assoc fmt cons.linexpr0;\n\ 68 | Format.fprintf fmt \"%s0\" (string_of_typ cons.typ);\n\ 69 | begin match cons.typ with\n\ 70 | | EQMOD x -> Format.fprintf fmt \" mod %a\" Scalar.print x;\n\ 71 | | _ -> ()\n\ 72 | end;\n\ 73 | ()\n\ 74 | let make expr typ = {\n\ 75 | linexpr0 = expr; typ = typ \n\ 76 | }\n\ 77 | let copy cons = {\n\ 78 | linexpr0 = Linexpr0.copy cons.linexpr0; typ = cons.typ\n\ 79 | }\n\ 80 | ") 81 | -------------------------------------------------------------------------------- /mlapronidl/macros.pl: -------------------------------------------------------------------------------- 1 | foreach (@ARGV) { 2 | open(F,"<",$_) || next; 3 | while () { 4 | s/I0_CHECK_EXC\(([^)]*)\)/if \($1->result.exn!=AP_EXC_NONE\) camlidl_apron_manager_check_exception\($1,_ctx\);/g; 5 | print; 6 | } 7 | } 8 | 9 | -------------------------------------------------------------------------------- /mlapronidl/mlapronidl.odoc: -------------------------------------------------------------------------------- 1 | {{:../index.html}Up} 2 | 3 | {!indexlist} 4 | 5 | {3 {!module: Introduction} (version 0.9.10)} 6 | 7 | {2 Coefficients} 8 | {!modules: Scalar Interval Coeff} 9 | 10 | {2 Managers and Abstract Domains} 11 | {!modules: Manager Box Oct Polka Ppl PolkaGrid T1p} 12 | 13 | {2 Level 1 of the interface (user-level)} 14 | {!modules: Var Environment Linexpr1 Lincons1 Generator1 Texpr1 Tcons1 Abstract1 Parser} 15 | 16 | {2 Level 0 of the interface} 17 | {!modules: Dim Linexpr0 Lincons0 Generator0 Texpr0 Tcons0 Abstract0} 18 | 19 | {2 MLGMPIDL modules} 20 | {!modules: Mpz Mpq Mpf Mpfr Gmp_random Mpzf Mpqf Mpfrf} 21 | -------------------------------------------------------------------------------- /mlapronidl/mlapronidl.tex: -------------------------------------------------------------------------------- 1 | \documentclass[twoside,10pt,a4paper]{report} 2 | \usepackage[latin1]{inputenc} 3 | \usepackage[T1]{fontenc} 4 | \usepackage{ae} 5 | \usepackage{fullpage} 6 | \usepackage{url} 7 | \usepackage{ocamldoc} 8 | \usepackage{makeidx} 9 | \usepackage{textcomp} 10 | \usepackage{fancyhdr} 11 | \pagestyle{fancy} 12 | \renewcommand{\headrulewidth}{0.9pt} 13 | \renewcommand{\footrulewidth}{0pt} 14 | \setlength{\headheight}{2.8ex} 15 | \setlength{\footskip}{5ex} 16 | \renewcommand{\chaptermark}[1]{ % 17 | \markboth{\MakeUppercase{\chaptername}\ \thechapter.\ #1}{}} 18 | \renewcommand{\sectionmark}[1]{} 19 | \setcounter{tocdepth}{1} 20 | \setcounter{secnumdepth}{4} 21 | \usepackage{color} 22 | \definecolor{mygreen}{rgb}{0,0.6,0} 23 | 24 | \usepackage{hyperref} 25 | 26 | \setlength{\parindent}{0em} 27 | \setlength{\parskip}{0.5ex} 28 | 29 | \makeindex 30 | 31 | \title{MLAPRONIDL: OCaml interface for APRON library} 32 | \author{Bertrand Jeannet} 33 | 34 | \begin{document} 35 | \maketitle 36 | 37 | \vspace*{0.9\textheight} 38 | 39 | The files of the APRON Library distribution, including all the files in the \textsc{MLApronIDL} subpackage, but excluding the files in the ppl, product, examples, and test subdirectories, are distributed under LGPL License with an exception allowing the redistribution of statically linked executables. 40 | The files in the ppl, product, examples, and test subdirectories are distributed under GPL License. 41 | Please read the COPYING files packaged in the distribution. 42 | 43 | Copyright (C) Bertrand Jeannet and Antoine Mine 2005-2009 for the 44 | \textsc{MLAPRONIDL} subpackage. 45 | 46 | \newpage 47 | 48 | \tableofcontents 49 | 50 | \input{Introduction.tex} 51 | 52 | \part{Coefficients} 53 | \input{Scalar.tex} 54 | \input{Interval.tex} 55 | \input{Coeff.tex} 56 | 57 | \part{Managers and Abstract Domains} 58 | \input{Manager.tex} 59 | \input{Box.tex} 60 | \input{Oct.tex} 61 | \input{Polka.tex} 62 | \input{Ppl.tex} 63 | \input{PolkaGrid.tex} 64 | \input{T1p.tex} 65 | 66 | \part{Level 1 of the interface} 67 | \input{Var.tex} 68 | \input{Environment.tex} 69 | \input{Linexpr1.tex} 70 | \input{Lincons1.tex} 71 | \input{Generator1.tex} 72 | \input{Texpr1.tex} 73 | \input{Tcons1.tex} 74 | \input{Abstract1.tex} 75 | \input{Parser.tex} 76 | 77 | \part{Level 0 of the interface} 78 | \input{Dim.tex} 79 | \input{Linexpr0.tex} 80 | \input{Lincons0.tex} 81 | \input{Generator0.tex} 82 | \input{Texpr0.tex} 83 | \input{Tcons0.tex} 84 | \input{Abstract0.tex} 85 | 86 | \part{MLGmpIDL modules} 87 | \input{Mpz.tex} 88 | \input{Mpq.tex} 89 | \input{Mpf.tex} 90 | \input{Mpfr.tex} 91 | \input{Gmp_random.tex} 92 | \input{Mpzf.tex} 93 | \input{Mpqf.tex} 94 | \input{Mpfrf.tex} 95 | 96 | \appendix 97 | \printindex 98 | \end{document} 99 | -------------------------------------------------------------------------------- /mlapronidl/perlscript_c.pl: -------------------------------------------------------------------------------- 1 | print "\n/* This file is part of the APRON Library, released under LGPL license with an exception allowing the redistribution of statically linked executables.\n Please read the COPYING file packaged in the distribution */"; 2 | while (<>) { 3 | s/extern void camlidl_apron_lincons0_ml2c\(value, ap_lincons0_t \*\)/extern void camlidl_apron_lincons0_ml2c\(value, ap_lincons0_t \*, camlidl_ctx\)/g; 4 | s/\#define camlidl_ml2c_lincons0_ap_lincons0_t\(v,c,ctx\) camlidl_apron_lincons0_ml2c\(v,c\)/\#define camlidl_ml2c_lincons0_ap_lincons0_t\(v,c,ctx\) camlidl_apron_lincons0_ml2c\(v,c,ctx\)/g; 5 | s/extern void camlidl_apron_tcons0_ml2c\(value, ap_tcons0_t \*\)/extern void camlidl_apron_tcons0_ml2c\(value, ap_tcons0_t \*, camlidl_ctx\)/g; 6 | s/\#define camlidl_ml2c_tcons0_ap_tcons0_t\(v,c,ctx\) camlidl_apron_tcons0_ml2c\(v,c\)/\#define camlidl_ml2c_tcons0_ap_tcons0_t\(v,c,ctx\) camlidl_apron_tcons0_ml2c\(v,c,ctx\)/g; 7 | s/struct ap_texpr_op_t/ap_texpr_op_t/g; 8 | s/struct ap_texpr_rtype_t/ap_texpr_rtype_t/g; 9 | s/struct ap_texpr_rdir_t/ap_texpr_rdir_t/g; 10 | print; 11 | } 12 | -------------------------------------------------------------------------------- /mlapronidl/var.idl: -------------------------------------------------------------------------------- 1 | /* -*- mode: c -*- */ 2 | 3 | /* This file is part of the APRON Library, released under LGPL license 4 | with an exception allowing the redistribution of statically linked 5 | executables. 6 | 7 | Please read the COPYING file packaged in the distribution */ 8 | 9 | quote(C, " 10 | #include \"apron_caml.h\" 11 | ") 12 | 13 | typedef [abstract, 14 | ml2c(camlidl_apron_var_ptr_ml2c), 15 | c2ml(camlidl_apron_var_ptr_c2ml)] 16 | struct apron_var_ptr ap_var_t; 17 | 18 | quote(MLMLI,"(** APRON Variables *)\n") 19 | 20 | quote(MLI,"(** Constructor *)") 21 | ap_var_t ap_var_of_string([string]char* name); 22 | 23 | quote(MLI,"(** Comparison function. Implements a total order and returns -1, 0, or 1. *)") 24 | int ap_var_compare(ap_var_t var1, ap_var_t var2) 25 | quote(call, "int r = ap_var_compare(var1, var2); _res = (r > 0) ? 1 : (r < 0) ? -1 : 0;"); 26 | 27 | quote(MLI,"(** Conversion to string *)") 28 | [string]char* ap_var_to_string(ap_var_t var) 29 | quote(call,"_res = ((apron_var_ptr)var)->name;"); 30 | 31 | quote(MLI,"(** Hash function *)") 32 | int ap_var_hash(ap_var_t var); 33 | 34 | quote(MLI," 35 | (** Printing function *) 36 | val print : Format.formatter -> t -> unit 37 | ") 38 | quote(ML," 39 | let print fmt v = Format.pp_print_string fmt (to_string v) 40 | ") 41 | 42 | quote(MLMLI," 43 | (** Initialisation of abstract type operations in C library *) 44 | external set_var_operations : unit -> unit = \"camlidl_apron_set_var_operations\""); 45 | quote(ML," 46 | let _ = set_var_operations () 47 | ") 48 | -------------------------------------------------------------------------------- /mlapronidl/version.idl: -------------------------------------------------------------------------------- 1 | /* -*- mode: c -*- */ 2 | 3 | /* This file is part of the APRON Library, released under LGPL license 4 | with an exception allowing the redistribution of statically linked 5 | executables. 6 | 7 | Please read the COPYING file packaged in the distribution */ 8 | 9 | quote(MLI,"(** APRON version *)") 10 | 11 | quote(C, "\n\ 12 | #include \"ap_version.h\"\n\ 13 | \n\ 14 | ") 15 | 16 | [string]char* version() 17 | quote(call,"_res = AP_VERSION;"); 18 | 19 | int version_major() 20 | quote(call,"_res = AP_VERSION_MAJOR;"); 21 | 22 | int version_minor() 23 | quote(call,"_res = AP_VERSION_MINOR;"); 24 | 25 | int version_micro() 26 | quote(call,"_res = AP_VERSION_MICRO;"); 27 | -------------------------------------------------------------------------------- /newpolka/README: -------------------------------------------------------------------------------- 1 | 2 | # This file is part of the APRON Library, released under LGPL license 3 | # with an exception allowing the redistribution of statically linked 4 | # executables. 5 | 6 | 7 | # Please read the COPYING file packaged in the distribution 8 | 9 | This package is a convex polyhedra library that conforms to the APRON 10 | interface. It requires APRON package. 11 | 12 | It includes both the C interface and the OCaml interface to APRON. 13 | 14 | Examples of use via the interface can be found in test0.c, test1.c, and 15 | test.ml. 16 | 17 | REQUIREMENTS 18 | ============ 19 | For the C interface: 20 | 21 | GMP library (tested with version 4.0 and up) 22 | ITV and NUM libraries 23 | APRON library 24 | 25 | For the OCaml interface, in addition: 26 | OCaml 3.0 or up (tested with 3.09) 27 | Camlidl (tested with 1.05) 28 | MLGMPIDL package 29 | MLAPRONIDL package 30 | 31 | INSTALLATION 32 | ============ 33 | 34 | Set the file Makefile.config to your own setting. 35 | You might also have to modify the Makefile for executables 36 | 37 | 1. C Library 38 | ---------- 39 | 40 | type 'make', and then 'make install' 41 | 42 | The library is named libpolkaRl.a, libpolkaRll.a or libpolkaMPQ.a (and 43 | libpolkaRl_debug.a, ...). 44 | 45 | i, l, g, stands for long int, long long int, and gmp, which 46 | indicates the underlying representation of integers. 47 | 48 | For use via APRON, the include files to consider is pk.h 49 | 50 | When linking, requires resp. libitvlr.a (i), libitvllr.a (l), libitvmpq.a (g) 51 | plus libraries required by APRON. 52 | 53 | 2. OCaml Library 54 | ---------------- 55 | 56 | type 'make ml', and then 'make install' 57 | 58 | The C part of the library is named libpolkaXX_caml.a or 59 | libpolkaXX_caml.so/dllpolkaXX_caml.so (and libpolkaXX_caml_debug.a or ...). 60 | 61 | The OCaml part is named polkaXX.cma (polkaXX.cmxa) 62 | 63 | 3. Miscellaneous 64 | ---------------- 65 | 66 | 'make clean' and 'make distclean' have the usual behaviour. 67 | -------------------------------------------------------------------------------- /newpolka/perlscript_caml.pl: -------------------------------------------------------------------------------- 1 | while (<>) { 2 | s/Manager.ap_manager_ptr/'a t Apron.Manager.t/g; 3 | s/internal_ptr/internal/g; 4 | s/external pk_/external /g; 5 | s/external manager_alloc_loose : unit -> 'a t Apron.Manager.t/external manager_alloc_loose : unit -> loose t Apron.Manager.t/g; 6 | s/external manager_alloc_strict : unit -> 'a t Apron.Manager.t/external manager_alloc_strict : unit -> strict t Apron.Manager.t/g; 7 | s/external manager_alloc_equalities : unit -> 'a t Apron.Manager.t/external manager_alloc_equalities : unit -> equalities t Apron.Manager.t/g; 8 | print; 9 | } 10 | -------------------------------------------------------------------------------- /newpolka/pk_assign.h: -------------------------------------------------------------------------------- 1 | /* ********************************************************************** */ 2 | /* pk_assign.h: Assignements and Substitutions */ 3 | /* ********************************************************************** */ 4 | 5 | /* This file is part of the APRON Library, released under LGPL license 6 | with an exception allowing the redistribution of statically linked 7 | executables. 8 | 9 | Please read the COPYING file packaged in the distribution */ 10 | 11 | #ifndef _PK_ASSIGN_H_ 12 | #define _PK_ASSIGN_H_ 13 | 14 | #include "pk_config.h" 15 | #include "pk.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | pk_t* poly_asssub_linexpr_det(bool assign, 22 | ap_manager_t* man, 23 | bool destructive, 24 | pk_t* pa, 25 | ap_dim_t dim, ap_linexpr0_t* linexpr); 26 | 27 | pk_t* poly_asssub_linexpr_array_det(bool assign, 28 | ap_manager_t* man, 29 | bool destructive, 30 | pk_t* pa, 31 | ap_dim_t* tdim, ap_linexpr0_t** texpr, 32 | size_t size); 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /newpolka/pk_bit.h: -------------------------------------------------------------------------------- 1 | /* ********************************************************************** */ 2 | /* pk_bit.h: operations on bitstrings */ 3 | /* ********************************************************************** */ 4 | 5 | /* This file is part of the APRON Library, released under LGPL license 6 | with an exception allowing the redistribution of statically linked 7 | executables. 8 | 9 | Please read the COPYING file packaged in the distribution */ 10 | 11 | /* This header file define operations on \emph{bitstrings} and 12 | \emph{bitindices}, to be used to access and modify bitstrings. */ 13 | 14 | /* The type \verb-bitstring_t- is simply an integer, which is an element 15 | of an array. 16 | 17 | An structured index of a bit in a bitfield is a pair $(w,b)$ where $w$ 18 | reference the considered integer and $b$ is a mask selecting the right 19 | bit. 20 | */ 21 | 22 | #ifndef __PK_BIT_H__ 23 | #define __PK_BIT_H__ 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | typedef unsigned int bitstring_t; 30 | typedef struct bitindex_t { 31 | size_t index; 32 | size_t word; 33 | bitstring_t bit; 34 | } bitindex_t; 35 | 36 | #define bitstring_size (sizeof(bitstring_t)*8) 37 | #define bitstring_msb (1U<<(bitstring_size-1)) 38 | 39 | /* Operations on \verb-bitindex_t- */ 40 | void bitindex_print(bitindex_t* bi); 41 | void bitindex_fprint(FILE* stream, bitindex_t* bi); 42 | bitindex_t bitindex_init(size_t col); 43 | void bitindex_inc(bitindex_t*); 44 | void bitindex_dec(bitindex_t*); 45 | size_t bitindex_size(size_t n); 46 | 47 | /* Operations on \verb-bitstring_t- */ 48 | bitstring_t* bitstring_alloc(size_t n); 49 | bitstring_t* bitstring_realloc(bitstring_t* b, size_t n); 50 | void bitstring_free(bitstring_t* b); 51 | void bitstring_clear(bitstring_t* b, size_t size); 52 | void bitstring_copy(bitstring_t* b2, bitstring_t* b1, size_t size); 53 | int bitstring_cmp(bitstring_t* r1, bitstring_t* r2, size_t size); 54 | 55 | void bitstring_print(bitstring_t* b, size_t size); 56 | void bitstring_fprint(FILE* stream, bitstring_t* b, size_t size); 57 | 58 | int bitstring_get(bitstring_t* b, bitindex_t ix); 59 | void bitstring_set(bitstring_t* b, bitindex_t ix); 60 | void bitstring_clr(bitstring_t* b, bitindex_t ix); 61 | 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /newpolka/pk_constructor.h: -------------------------------------------------------------------------------- 1 | /* ********************************************************************** */ 2 | /* pk_constructor.h: constructors and accessors */ 3 | /* ********************************************************************** */ 4 | 5 | /* This file is part of the APRON Library, released under LGPL license 6 | with an exception allowing the redistribution of statically linked 7 | executables. 8 | 9 | Please read the COPYING file packaged in the distribution */ 10 | 11 | #ifndef _PK_CONSTRUCTOR_H_ 12 | #define _PK_CONSTRUCTOR_H_ 13 | 14 | #include "pk_config.h" 15 | #include "pk_vector.h" 16 | #include "pk_satmat.h" 17 | #include "pk_matrix.h" 18 | #include "pk.h" 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | /* Fill the first (pk->dec-1) rows of the matrix with the constraints of the 25 | universe polyhedron */ 26 | void pk_matrix_fill_constraint_top(pk_internal_t* pk, pk_matrix_t* C, size_t start); 27 | 28 | /* Assign with GMP semantics the given polyhedron with the empty 29 | (resp. universe) polyhedron, of same dimensions */ 30 | void poly_set_bottom(pk_internal_t* pk, pk_t* po); 31 | void poly_set_top(pk_internal_t* pk, pk_t* po); 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /newpolka/pk_extract.h: -------------------------------------------------------------------------------- 1 | /* ********************************************************************** */ 2 | /* pk_extract.h: property extraction */ 3 | /* ********************************************************************** */ 4 | 5 | /* This file is part of the APRON Library, released under LGPL license 6 | with an exception allowing the redistribution of statically linked 7 | executables. 8 | 9 | Please read the COPYING file packaged in the distribution */ 10 | 11 | #ifndef _PK_EXTRACT_H_ 12 | #define _PK_EXTRACT_H_ 13 | 14 | #include "pk_config.h" 15 | #include "pk.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | /* Bounding by a itv box a matrix of generators. */ 22 | itv_t* pk_matrix_to_box(pk_internal_t* pk, pk_matrix_t* F); 23 | 24 | /* Bounding the value of a dimension in a matrix of generators. 25 | mode == 1: sup bound 26 | mode == -1: inf bound 27 | */ 28 | void pk_matrix_bound_dimension(pk_internal_t* pk, 29 | itv_t itv, 30 | ap_dim_t dim, 31 | pk_matrix_t* F); 32 | 33 | /* Bounding the value of a linear expression (vector) in a matrix of 34 | generators. vec is supposed to be of size F->nbcolumns. 35 | */ 36 | void pk_matrix_bound_vector(pk_internal_t* pk, 37 | itv_t itv, 38 | numint_t* vec, 39 | pk_matrix_t* F); 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /newpolka/pk_meetjoin.h: -------------------------------------------------------------------------------- 1 | /* ********************************************************************** */ 2 | /* pk_meetjoin.h: Meet and join operations */ 3 | /* ********************************************************************** */ 4 | 5 | /* This file is part of the APRON Library, released under LGPL license 6 | with an exception allowing the redistribution of statically linked 7 | executables. 8 | 9 | Please read the COPYING file packaged in the distribution */ 10 | 11 | #ifndef _PK_MEETJOIN_H_ 12 | #define _PK_MEETJOIN_H_ 13 | 14 | #include "pk_config.h" 15 | #include "pk.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | /* ********************************************************************** */ 22 | /* I. Meet/Join */ 23 | /* ********************************************************************** */ 24 | 25 | /* In all the following functions, for the structure poly_t: 26 | 27 | - If meet is true, standard meaning of everything 28 | - If meet is false, 29 | - matrices C and F, satC and satF have been exchanged, 30 | - nbeq and nbline have been exchanged 31 | - in status, nothing has changed 32 | */ 33 | 34 | /* Meet/Join of a polyhedronwith an array of constraints/generators. 35 | 36 | The polyhedron is supposed: 37 | - to have constraints, 38 | - if lazy is false, to be minimized, and to have satC 39 | - possible emptiness not detected, 40 | 41 | Matrix of constraints is supposed: 42 | - to be sorted 43 | - to be canonical too. 44 | 45 | Return true if exception 46 | */ 47 | bool poly_meet_matrix(bool meet, bool lazy, 48 | ap_manager_t* man, 49 | pk_t* po, 50 | pk_t* pa, pk_matrix_t* mat); 51 | 52 | void poly_meet_itv_lincons_array(bool lazy, 53 | ap_manager_t* man, 54 | pk_t* po, pk_t* pa, 55 | itv_lincons_array_t* array); 56 | 57 | void poly_meet(bool meet, 58 | bool lazy, 59 | ap_manager_t* man, 60 | pk_t* po, pk_t* pa, pk_t* pb); 61 | 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /newpolka/pk_resize.h: -------------------------------------------------------------------------------- 1 | /* ********************************************************************** */ 2 | /* pk_resize.h: change and permutation of dimensions */ 3 | /* ********************************************************************** */ 4 | 5 | /* This file is part of the APRON Library, released under LGPL license 6 | with an exception allowing the redistribution of statically linked 7 | executables. 8 | 9 | Please read the COPYING file packaged in the distribution */ 10 | 11 | /* This header file define operations allowing to convert polyhedra 12 | from one representation to the dual one. */ 13 | 14 | #ifndef __PK_RESIZE_H__ 15 | #define __PK_RESIZE_H__ 16 | 17 | #include "pk_config.h" 18 | #include "pk.h" 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | 25 | void vector_remove_dimensions(pk_internal_t* pk, 26 | numint_t* newq, 27 | numint_t* q, size_t size, 28 | ap_dimchange_t* dimchange); 29 | 30 | pk_matrix_t* pk_matrix_add_dimensions(pk_internal_t* pk, 31 | bool destructive, pk_matrix_t* mat, 32 | ap_dimchange_t* dimchange); 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /newpolka/pk_satmat.h: -------------------------------------------------------------------------------- 1 | /* ********************************************************************** */ 2 | /* pk_satmat.h: operations on saturation matrices */ 3 | /* ********************************************************************** */ 4 | 5 | /* This file is part of the APRON Library, released under LGPL license 6 | with an exception allowing the redistribution of statically linked 7 | executables. 8 | 9 | Please read the COPYING file packaged in the distribution */ 10 | 11 | /* This header file define operations on saturation matrices. A 12 | saturation matrix is an array of bits (or an array of bitstrings) used to 13 | memorize wether a given generator saturate a given constraint. */ 14 | 15 | /* Saturation matrices are very similar to normal matrices as defined in 16 | matrix.h, where explanations can be found. */ 17 | 18 | #ifndef __PK_SATMAT_H__ 19 | #define __PK_SATMAT_H__ 20 | 21 | #include 22 | #include "pk_bit.h" 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | typedef struct satmat_t { 29 | /* public part */ 30 | bitstring_t** p; 31 | size_t nbrows; 32 | size_t nbcolumns; 33 | /* private part */ 34 | size_t _maxrows; /* number of rows allocated */ 35 | } satmat_t; 36 | 37 | satmat_t* satmat_alloc(size_t nbrows, size_t nbcols); 38 | void satmat_resize_rows(satmat_t* sat, size_t nbrows); 39 | void satmat_resize_cols(satmat_t* sat, size_t nbcols); 40 | satmat_t* satmat_copy_resize_cols(satmat_t* sat, size_t nbcols); 41 | void satmat_free(satmat_t* sat); 42 | void satmat_clear(satmat_t* sat); 43 | satmat_t* satmat_copy(satmat_t* sat); 44 | void satmat_print(satmat_t* sat); 45 | void satmat_fprint(FILE* stream, satmat_t* sat); 46 | 47 | bitstring_t satmat_get(satmat_t* sat, size_t i, bitindex_t jx); 48 | void satmat_set(satmat_t* sat, size_t i, bitindex_t jx); 49 | void satmat_clr(satmat_t* sat, size_t i, bitindex_t jx); 50 | 51 | satmat_t* satmat_transpose(satmat_t* org, size_t nbcols); 52 | 53 | void satmat_exch_rows(satmat_t* sat, size_t l1, size_t l2); 54 | void satmat_move_rows(satmat_t* sat, size_t destrow, size_t orgrow, size_t size); 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /newpolka/pk_test.h: -------------------------------------------------------------------------------- 1 | /* ********************************************************************** */ 2 | /* pk_test.h: tests on polyhedra */ 3 | /* ********************************************************************** */ 4 | 5 | /* This file is part of the APRON Library, released under LGPL license 6 | with an exception allowing the redistribution of statically linked 7 | executables. 8 | 9 | Please read the COPYING file packaged in the distribution */ 10 | 11 | #ifndef _PK_TEST_H_ 12 | #define _PK_TEST_H_ 13 | 14 | #include "pk_config.h" 15 | #include "pk.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | /* 22 | F is suppposed to be a valid matrix of ray (i.e., corresponding 23 | to a non empty polyhedron. 24 | 25 | The epsilon component of the constraint is not taken into account. The 26 | constraint is considered as strict only if the is_strict paramater telles so. 27 | This enables to test the satisfiability of a strict constraint in non-strict 28 | mode for the library. 29 | */ 30 | bool do_generators_sat_vector(pk_internal_t* pk, 31 | pk_matrix_t* F, 32 | numint_t* tab, bool is_strict); 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /newpolka/test.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoinemine/apron/2d0027326748b81026e2e8a711913be748b6ecca/newpolka/test.c -------------------------------------------------------------------------------- /newpolka/test.ml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoinemine/apron/2d0027326748b81026e2e8a711913be748b6ecca/newpolka/test.ml -------------------------------------------------------------------------------- /newpolka/test0.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoinemine/apron/2d0027326748b81026e2e8a711913be748b6ecca/newpolka/test0.c -------------------------------------------------------------------------------- /newpolka/test1.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoinemine/apron/2d0027326748b81026e2e8a711913be748b6ecca/newpolka/test1.c -------------------------------------------------------------------------------- /num/Makefile: -------------------------------------------------------------------------------- 1 | include ../Makefile.config 2 | include ../vars.mk 3 | 4 | H_FILES = \ 5 | num_config.h \ 6 | num.h \ 7 | num_numint.h \ 8 | num_numrat.h \ 9 | num_numflt.h \ 10 | numint.h \ 11 | numint_native.h \ 12 | numint_mpz.h \ 13 | numrat.h \ 14 | numrat_native.h \ 15 | numrat_mpq.h \ 16 | numflt.h \ 17 | numflt_native.h \ 18 | numflt_mpfr.h \ 19 | num_name.h \ 20 | bound.h \ 21 | bound_def.h 22 | 23 | all: 24 | 25 | install: 26 | mkdir -p $(APRON_INCLUDE) 27 | cp $(H_FILES) $(APRON_INCLUDE) 28 | 29 | uninstall: 30 | (cd $(APRON_INCLUDE) && /bin/rm -f $(H_FILES) || exit 0) 31 | 32 | dist: $(H_FILES) Makefile README 33 | (cd ..; tar zcvf num.tgz $(^:%=num/%)) 34 | 35 | clean: 36 | rm -f testl* testmp* testdbl testldbl testmpfr 37 | 38 | distclean: clean 39 | 40 | ICFLAGS += $(APRON_ICFLAGS) $(MP_ICFLAGS) 41 | LDFLAGS += $(APRON_LIFLAGS) $(MP_LIFLAGS) -lapron -lmpfr -lgmp -lm 42 | 43 | tests: testli testlli testlr testllr testmpz testmpq testdbl testldbl testmpfr 44 | 45 | testli: test.c $(H_FILES) 46 | $(CC) -g $(CFLAGS) $(ICFLAGS) -DNUM_LONGINT -o $@ test.c $(LDFLAGS) 47 | 48 | testlli: test.c $(H_FILES) 49 | $(CC) -g $(CFLAGS) $(ICFLAGS) -DNUM_LONGLONGINT -o $@ test.c $(LDFLAGS) 50 | 51 | testlr: test.c $(H_FILES) 52 | $(CC) -g $(CFLAGS) $(ICFLAGS) -DNUM_LONGRAT -o $@ test.c $(LDFLAGS) 53 | 54 | testllr: test.c $(H_FILES) 55 | $(CC) -g $(CFLAGS) $(ICFLAGS) -DNUM_LONGLONGRAT -o $@ test.c $(LDFLAGS) 56 | 57 | testmpz: test.c $(H_FILES) 58 | $(CC) -g $(CFLAGS) $(ICFLAGS) -DNUM_MPZ -o $@ test.c $(LDFLAGS) 59 | 60 | testmpq: test.c $(H_FILES) 61 | $(CC) -g $(CFLAGS) $(ICFLAGS) -DNUM_MPQ -o $@ test.c $(LDFLAGS) 62 | 63 | testdbl: test.c $(H_FILES) 64 | $(CC) -g $(CFLAGS) $(ICFLAGS) -DNUM_DOUBLE -o $@ test.c $(LDFLAGS) 65 | 66 | testldbl: test.c $(H_FILES) 67 | $(CC) -g $(CFLAGS) $(ICFLAGS) -DNUM_LONGDOUBLE -o $@ test.c $(LDFLAGS) 68 | 69 | testmpfr: test.c $(H_FILES) 70 | $(CC) -g $(CFLAGS) $(ICFLAGS) -DNUM_MPFR -o $@ test.c $(LDFLAGS) 71 | 72 | out: tests 73 | ./testli > out.li 74 | ./testlli > out.lli 75 | ./testlr > out.lr 76 | ./testllr > out.llr 77 | ./testmpz > out.mpz 78 | ./testmpq > out.mpq 79 | ./testdbl > out.dbl 80 | ./testldbl > out.ldbl 81 | ./testmpfr > out.mpfr 82 | -------------------------------------------------------------------------------- /num/README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoinemine/apron/2d0027326748b81026e2e8a711913be748b6ecca/num/README -------------------------------------------------------------------------------- /num/essai.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | typedef int bool; 6 | #define true (int)1 7 | #define false (int)0 8 | 9 | #define NUM_LONGDOUBLE 10 | #include "num.h" 11 | #include "bound.h" 12 | 13 | int main(int argc, char**argv) 14 | { 15 | bound_t a; 16 | double b,c,d; 17 | bound_init_set_int(a,-3); 18 | 19 | b = (double)1.0/(double)0.0; 20 | c = b; 21 | d = b+c; 22 | printf ("b=%.20g\nc=%.20g\nd=%.20g\n",b,c,d); 23 | c = 0; 24 | d = b*c; 25 | printf ("b=%.20g\nc=%.20g\nd=%.20g\n",b,c,d); 26 | 27 | return 0; 28 | } 29 | 30 | -------------------------------------------------------------------------------- /num/num_config.h: -------------------------------------------------------------------------------- 1 | #ifndef _NUM_CONFIG_H_ 2 | #define _NUM_CONFIG_H_ 3 | 4 | #include "ap_config.h" 5 | 6 | #ifdef __cplusplus 7 | #define HAS_BOOL 8 | extern "C" { 9 | #endif 10 | 11 | #ifndef HAS_BOOL 12 | #define HAS_BOOL 13 | typedef char bool; 14 | static const bool false = 0; 15 | static const bool true = 1; 16 | #endif 17 | 18 | #include 19 | 20 | /* prints attempts to convert NaN and infinities to non floating-point types */ 21 | #define DEBUG_SPECIAL fprintf(stderr,"invalid floating-point in %s\n",__func__); 22 | 23 | 24 | static inline void num_store_words8(void* dst, const void* src, size_t t) 25 | { 26 | #ifdef WORDS_BIGENDIAN 27 | unsigned char *s = (unsigned char*)src+t-1, *d = (unsigned char*) dst; 28 | size_t i; 29 | for (i=0;i>24) & 0xff; 38 | *((unsigned char*)dst+1) = (src>>16) & 0xff; 39 | *((unsigned char*)dst+2) = (src>>8) & 0xff; 40 | *((unsigned char*)dst+3) = src & 0xff; 41 | } 42 | 43 | static inline unsigned num_undump_word32(const void* src) 44 | { 45 | return 46 | ((unsigned)(((const unsigned char*)src)[0])<<24)+ 47 | ((unsigned)(((const unsigned char*)src)[1])<<16)+ 48 | ((unsigned)(((const unsigned char*)src)[2])<<8)+ 49 | ((unsigned)(((const unsigned char*)src)[3])); 50 | } 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /num/num_name.h: -------------------------------------------------------------------------------- 1 | /* ********************************************************************** */ 2 | /* num_name.h: numerical type name and mangling */ 3 | /* ********************************************************************** */ 4 | 5 | /* Unlike num.h, this file can be included several times. 6 | */ 7 | 8 | #undef NUM_NAME 9 | #undef NUM_SUFFIX 10 | #undef NUMFUN3 11 | #undef NUMFUN2 12 | #undef NUMFUN 13 | 14 | /* NUMFUN(xxx) expands to xxx_mpq, or xxx_dbl, ... */ 15 | #define NUMFUN3(NAME,SUFFIX) NAME ## _ ## SUFFIX 16 | #define NUMFUN2(x,y) NUMFUN3(x,y) 17 | #define NUMFUN(x) NUMFUN2(x,NUM_SUFFIX) 18 | 19 | #if defined(NUM_LONGRAT) 20 | #define NUM_NAME "NUM_LONGRAT" 21 | #define NUM_SUFFIX Rl 22 | 23 | #elif defined(NUM_LONGLONGRAT) 24 | #define NUM_NAME "NUM_LONGLONGRAT" 25 | #define NUM_SUFFIX Rll 26 | 27 | #elif defined(NUM_MPQ) 28 | #define NUM_NAME "NUM_MPQ" 29 | #define NUM_SUFFIX MPQ 30 | 31 | #elif defined(NUM_LONGINT) 32 | #define NUM_NAME "NUM_LONGINT" 33 | #define NUM_SUFFIX Il 34 | 35 | #elif defined(NUM_LONGLONGINT) 36 | #define NUM_NAME "NUM_LONGLONGINT" 37 | #define NUM_SUFFIX Ill 38 | 39 | #elif defined(NUM_MPZ) 40 | #define NUM_NAME "NUM_MPZ" 41 | #define NUM_SUFFIX MPZ 42 | 43 | #elif defined(NUM_DOUBLE) 44 | #define NUM_NAME "NUM_DOUBLE" 45 | #define NUM_SUFFIX D 46 | 47 | #elif defined(NUM_LONGDOUBLE) 48 | #define NUM_NAME "NUM_LONGDOUBLE" 49 | #define NUM_SUFFIX Dl 50 | 51 | #elif defined(NUM_MPFR) 52 | #define NUM_NAME "NUM_MPFR" 53 | #define NUM_SUFFIX MPFR 54 | 55 | #else 56 | #error "HERE" 57 | #endif 58 | -------------------------------------------------------------------------------- /ocamlpack: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # -*- mode: sh -*- 3 | 4 | # command line (very primitive...) 5 | if test $1 != "-o"; then 6 | echo "ocamlpack: usage: ocamlpack -o outputmodule -title -intro 7 | module1 module2 ..." 8 | exit -1 9 | fi 10 | shift 11 | out=$1 12 | shift 13 | if test $1 != "-title"; then 14 | echo "ocamlpack: usage: ocamlpack -o outputmodule -title -intro 15 | module1 module2 ..." 16 | exit -1 17 | fi 18 | shift 19 | outtitle=$1 20 | shift 21 | if test $1 != "-intro"; then 22 | echo "ocamlpack: usage: ocamlpack -o outputmodule -title -intro 23 | module1 module2 ..." 24 | exit -1 25 | fi 26 | shift 27 | introfile=$1 28 | shift 29 | 30 | # prepare output 31 | /bin/rm -f $out 32 | exec 1>$out; 33 | echo "(** $outtitle *)"; 34 | echo "(**"; 35 | cat $introfile; 36 | echo "*)"; 37 | 38 | # iterate on input module, 39 | for i in $*; do 40 | name=$i 41 | # 1.A Look for the first (** *) comment, and output it 42 | awk -v name=$name ' 43 | BEGIN { 44 | start=1 45 | nb = split(name, dirname, "/") 46 | name = dirname[nb] 47 | if (RLENGTH>0) 48 | name = substr(name,RINDEX,length(name)-RINDEX) 49 | hd = toupper(substr(name,1,1)) 50 | tl = substr(name,2,length(name)-1) 51 | } 52 | { 53 | if (start==1) { 54 | match($0, /\(\*\*([ ]+)([^*]*)([ ]+)\*\)/ ) 55 | if (RLENGTH>0){ 56 | start=0 57 | title=substr($0,RSTART+4,RLENGTH-7) 58 | print "\n(** {1 Module [",hd tl "]:",title "} *)\n" 59 | print "module",hd tl,": sig" 60 | } 61 | } 62 | } 63 | END { 64 | if (start==1) { 65 | print "\n(** {1 Module [",hd tl "]} *)\n" 66 | print "module",hd tl,": sig" 67 | } 68 | } 69 | ' $i.mli; 70 | # 1.B Output the rest of name.mli to out 71 | awk -v name=$name ' 72 | { 73 | if (start==1) { 74 | match($0, /\(\*\*([ ]+)([^*]*)([ ]+)\*\)/ ) 75 | if (RLENGTH>0) 76 | start=0 77 | else 78 | print $0 79 | } 80 | else 81 | print " ",$0 82 | } 83 | END { print "end\n" } 84 | ' $i.mli; 85 | done 86 | -------------------------------------------------------------------------------- /octagons/mltest.ml: -------------------------------------------------------------------------------- 1 | (* mltest.ml 2 | * 3 | * A very simple example 4 | * 5 | * APRON Library / Octagonal Domain 6 | * 7 | * Copyright (C) Antoine Mine' 2007 8 | *) 9 | 10 | 11 | (* compile with: 12 | 13 | ocamlc -I ${INSTALL_DIR}/lib \ 14 | gmp.cma apron.cma oct.cma mltest.ml \ 15 | -cclib -loctQg -cclib -lapron 16 | 17 | you can change: 18 | - INSTALL_DIR to where APRON is installed, 19 | - -loctQg to the desired underlying numeric type, 20 | - ocamlc to ocamlopt, and replace each .cma to the corresponding .cmxa 21 | 22 | *) 23 | 24 | open Apron 25 | 26 | let m = Oct.manager_alloc () 27 | let _ = 28 | Printf.printf "name: %s\nversion: %s\n" 29 | (Manager.get_library m) (Manager.get_version m) 30 | 31 | (* TO BE CONTINUED *) 32 | -------------------------------------------------------------------------------- /octagons/perlscript_c.pl: -------------------------------------------------------------------------------- 1 | print "\n/* This file is part of the APRON Library, released under LGPL license with an exception allowing the redistribution of statically linked executables.\n Please read the COPYING file packaged in the distribution */"; 2 | while (<>) { 3 | s/extern void camlidl_apron_lincons0_ml2c\(value, ap_lincons0_t \*\)/extern void camlidl_apron_lincons0_ml2c\(value, ap_lincons0_t \*, camlidl_ctx\)/g; 4 | s/\#define camlidl_ml2c_lincons0_ap_lincons0_t\(v,c,ctx\) camlidl_apron_lincons0_ml2c\(v,c\)/\#define camlidl_ml2c_lincons0_ap_lincons0_t\(v,c,ctx\) camlidl_apron_lincons0_ml2c\(v,c,ctx\)/g; 5 | s/extern void camlidl_apron_tcons0_ml2c\(value, ap_tcons0_t \*\)/extern void camlidl_apron_tcons0_ml2c\(value, ap_tcons0_t \*, camlidl_ctx\)/g; 6 | s/\#define camlidl_ml2c_tcons0_ap_tcons0_t\(v,c,ctx\) camlidl_apron_tcons0_ml2c\(v,c\)/\#define camlidl_ml2c_tcons0_ap_tcons0_t\(v,c,ctx\) camlidl_apron_tcons0_ml2c\(v,c,ctx\)/g; 7 | s/struct ap_texpr_op_t/ap_texpr_op_t/g; 8 | s/struct ap_texpr_rtype_t/ap_texpr_rtype_t/g; 9 | s/struct ap_texpr_rdir_t/ap_texpr_rdir_t/g; 10 | print; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /octagons/perlscript_caml.pl: -------------------------------------------------------------------------------- 1 | while (<>) { 2 | s/Manager.ap_manager_ptr/t Apron.Manager.t/g; 3 | s/internal_ptr/internal/g; 4 | s/external oct_/external /g; 5 | s/Generator0.ap_generator0_array_t/Apron.Generator0.t array/g; 6 | s/Scalar.ap_scalar_ptr/Apron.Scalar.t/g; 7 | s/Scalar.ap_scalar_array_t/Apron.Scalar.t array/g; 8 | s/Abstract0.ap_abstract0_ptr/t Apron.Abstract0.t/g; 9 | s/external ap_abstract0_oct_/external /g; 10 | print; 11 | } 12 | -------------------------------------------------------------------------------- /octagons/testall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | make all || exit 4 | 5 | mv log log.old 6 | 7 | echo "Test started `date`"| tee log 8 | 9 | for i in Il Ill MPZ Ri Rll MPQ D Dl MPFR 10 | do 11 | echo "Test for $i `date`" | tee -a log 12 | ./octtest$i +120 2>&1 | tee -a log 13 | done 14 | 15 | echo "Test finished at `date`"| tee -a log 16 | 17 | grep error log 18 | -------------------------------------------------------------------------------- /ppl/README: -------------------------------------------------------------------------------- 1 | # README 2 | # 3 | # APRON Library / Parma Polyhedra Library 4 | # 5 | # Copyright (C) Antoine Mine' 2006-2009 6 | 7 | # This file is part of the APRON Library, released under GPL license. 8 | # Please read the COPYING file packaged in the distribution 9 | 10 | This package is a wrapper for the the Parma Polyhedra Library. 11 | (http://www.cs.unipr.it/ppl/) 12 | 13 | Requirements: 14 | - APRON 15 | - ITV 16 | - PPL library version 0.9 or 0.10, with GMP support 17 | - GMPXX (normally installed with GMP) 18 | - for apron_ppl_test: NewPolka APRON module 19 | 20 | If HAS_PPL is defined in ../Makefile.config, then the main APRON Makefile 21 | will automatically build and install this module. 22 | 23 | 24 | 9/2/2009 changes 25 | - the wrapper has been updated to compile PPL version 0.10 26 | - it should still compile with version 0.9 of PPL provided that you apply 27 | the provided patch 28 | 1. go to the directoy containing the ppl-0.9 directory 29 | 2. type 'patch -p0 C libary 59 | - make ml => OCaml library 60 | - make install => install C and (if compiled) OCaml libraries 61 | -------------------------------------------------------------------------------- /ppl/ap_ppl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * apron_ppl.h 3 | * 4 | * APRON Library / PPL library wrapper 5 | * 6 | * This is the (only) one .h to include to access all PPL domains. 7 | * 8 | * Copyright (C) Antoine Mine' 2006 9 | * 10 | */ 11 | 12 | /* 13 | * This file is part of the APRON Library, released under GPL license. 14 | * Please read the COPYING file packaged in the distribution. 15 | */ 16 | 17 | #ifndef __APRON_PPL_H 18 | #define __APRON_PPL_H 19 | 20 | #include "ap_global0.h" 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | 27 | 28 | ap_manager_t* ap_ppl_poly_manager_alloc(bool strict); 29 | /* (PPL::Polyhedron ) 30 | 31 | Allocate an APRON manager for convex polyhedra, linked to PPL. 32 | 33 | If the Boolean parameter is true, abstract values generated with the 34 | manager can have strict constraints (like x>0). Otherwise they are defined 35 | using only loose constraints. Managers and abstract values in strict and 36 | loose mode are incompatible. 37 | */ 38 | 39 | ap_manager_t* ap_ppl_grid_manager_alloc(void); 40 | /* (PPL::Grid) 41 | 42 | Allocate a APRON manager for grids, linked to PPL. 43 | */ 44 | 45 | 46 | 47 | /* extra functions not in APRON managers */ 48 | 49 | ap_abstract0_t* 50 | ap_abstract0_ppl_poly_widening_thresholds(ap_manager_t* man, 51 | ap_abstract0_t* a1, 52 | ap_abstract0_t* a2, 53 | ap_lincons0_array_t* array); 54 | 55 | ap_abstract0_t* 56 | ap_abstract0_ppl_grid_widening_thresholds(ap_manager_t* man, 57 | ap_abstract0_t* a1, 58 | ap_abstract0_t* a2, 59 | ap_lincons0_array_t* array); 60 | 61 | 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | 67 | #endif /* __APRON_PPL_H */ 68 | -------------------------------------------------------------------------------- /ppl/perlscript_caml.pl: -------------------------------------------------------------------------------- 1 | while (<>) { 2 | s/Manager.ap_manager_ptr/'a t Apron.Manager.t/g; 3 | s/external ap_ppl_/external /g; 4 | s/external manager_alloc_loose : unit -> 'a t Apron.Manager.t/external manager_alloc_loose : unit -> loose t Apron.Manager.t/g; 5 | s/external manager_alloc_strict : unit -> 'a t Apron.Manager.t/external manager_alloc_strict : unit -> strict t Apron.Manager.t/g; 6 | s/external manager_alloc_grid : unit -> 'a t Apron.Manager.t/external manager_alloc_grid : unit -> grid t Apron.Manager.t/g; 7 | print; 8 | } 9 | -------------------------------------------------------------------------------- /ppl/ppl.patch: -------------------------------------------------------------------------------- 1 | diff -ru ppl-0.9-org/src/Grid_Generator.defs.hh ppl-0.9/src/Grid_Generator.defs.hh 2 | --- ppl-0.9-org/src/Grid_Generator.defs.hh 2006-02-26 21:24:05.000000000 +0100 3 | +++ ppl-0.9/src/Grid_Generator.defs.hh 2007-02-14 18:31:16.000000000 +0100 4 | @@ -223,10 +223,12 @@ 5 | the notion of coefficient with the notion of coordinate: 6 | these are equivalent only when the divisor is 1. 7 | */ 8 | -class Parma_Polyhedra_Library::Grid_Generator : private Generator { 9 | +class Parma_Polyhedra_Library::Grid_Generator : protected Generator { 10 | public: 11 | // FIXME: Add wrappers of any other public Generator methods. 12 | 13 | + Coefficient_traits::const_reference coefficient(Variable v) const; 14 | + 15 | //! Returns the dimension of the vector space enclosing \p *this. 16 | dimension_type space_dimension() const; 17 | 18 | Seulement dans ppl-0.9/src: Grid_Generator.defs.hh~ 19 | diff -ru ppl-0.9-org/src/Grid_Generator.inlines.hh ppl-0.9/src/Grid_Generator.inlines.hh 20 | --- ppl-0.9-org/src/Grid_Generator.inlines.hh 2006-01-27 14:50:36.000000000 +0100 21 | +++ ppl-0.9/src/Grid_Generator.inlines.hh 2007-02-14 18:25:56.000000000 +0100 22 | @@ -27,6 +27,11 @@ 23 | 24 | namespace Parma_Polyhedra_Library { 25 | 26 | +inline Coefficient_traits::const_reference 27 | +Grid_Generator::coefficient(const Variable v) const { 28 | + return Generator::coefficient(v); 29 | +} 30 | + 31 | inline 32 | Grid_Generator::Grid_Generator(Generator g) 33 | : Generator(Generator::point()) { 34 | -------------------------------------------------------------------------------- /pplite/README: -------------------------------------------------------------------------------- 1 | # README 2 | # 3 | # APRON Library / PPLite library 4 | # 5 | # Copyright (C) Antoine Mine' 2006-2009 6 | # Copyright (C) Enea Zaffanella 2023-2024 7 | 8 | # This file is part of the APRON Library, released under GPL license. 9 | # Please read the COPYING file packaged in the distribution 10 | 11 | This package is a wrapper for the PPLite library 12 | (https://github.com/ezaffanella/PPLite) 13 | 14 | Requirements: 15 | - APRON 16 | - ITV 17 | - PPLite library version 0.12 (to be installed from sources) 18 | - Flint, MPFR, GMP 19 | - for apron_pplite_test: NewPolka APRON module 20 | 21 | If HAS_PPLITE is defined in ../Makefile.config, then the main APRON Makefile 22 | will automatically build and install this module. 23 | 24 | What is provided: 25 | - a manager to access the polyhedra domains provided by PPLite, including: 26 | Poly: standard (C or NNC) convex polyhedra domain 27 | F_Poly: Poly domain enhanced with Cartesian factoring 28 | U_Poly: Poly domain optimized for unconstrained dimensions 29 | UF_Poly: Poly domain combining F_Poly and U_Poly 30 | P_Set: powerset of convex polyhedra 31 | FP_Set: powerset of convex polyhedra with Cartesian factoring 32 | - C++ exceptions are mapped back to APRON exceptions 33 | - flag_exact and flag_best are correcty sets 34 | - all the widenings are available through the algorithm parameter 35 | - some functions not availble in PPLite are emulated 36 | - a unit testing program ap_pplite_test for regression testing; 37 | it works by comparing the result of PPLite and NewPolka 38 | on random polyhedra 39 | 40 | Limitations: 41 | - all domains are experimental but tested 42 | - partial support for PPLite's powerset of polyhedra (use of functions 43 | that are not in Apron's generic interface require explicit casts) 44 | - some functions are not implemented: fprintfdiff, (de)serialize_raw 45 | 46 | How to install: 47 | - setup in ../Makefile.config (PPLITE_PREFIX, FLINT_PREFIX) 48 | - compile and optionally install APRON with NewPolka 49 | - make => C library 50 | - make ml => OCaml library 51 | - make java => Java library 52 | - make install => install C and (if compiled) OCaml and Java libraries 53 | -------------------------------------------------------------------------------- /pplite/perlscript_c.pl: -------------------------------------------------------------------------------- 1 | print "\n/* This file is part of the APRON Library, released under LGPL license with an exception allowing the redistribution of statically linked executables.\n Please read the COPYING file packaged in the distribution */"; 2 | while (<>) { 3 | s/extern void camlidl_apron_lincons0_ml2c\(value, ap_lincons0_t \*\)/extern void camlidl_apron_lincons0_ml2c\(value, ap_lincons0_t \*, camlidl_ctx\)/g; 4 | s/\#define camlidl_ml2c_lincons0_ap_lincons0_t\(v,c,ctx\) camlidl_apron_lincons0_ml2c\(v,c\)/\#define camlidl_ml2c_lincons0_ap_lincons0_t\(v,c,ctx\) camlidl_apron_lincons0_ml2c\(v,c,ctx\)/g; 5 | s/extern void camlidl_apron_tcons0_ml2c\(value, ap_tcons0_t \*\)/extern void camlidl_apron_tcons0_ml2c\(value, ap_tcons0_t \*, camlidl_ctx\)/g; 6 | s/\#define camlidl_ml2c_tcons0_ap_tcons0_t\(v,c,ctx\) camlidl_apron_tcons0_ml2c\(v,c\)/\#define camlidl_ml2c_tcons0_ap_tcons0_t\(v,c,ctx\) camlidl_apron_tcons0_ml2c\(v,c,ctx\)/g; 7 | s/struct ap_texpr_op_t/ap_texpr_op_t/g; 8 | s/struct ap_texpr_rtype_t/ap_texpr_rtype_t/g; 9 | s/struct ap_texpr_rdir_t/ap_texpr_rdir_t/g; 10 | print; 11 | } 12 | -------------------------------------------------------------------------------- /pplite/perlscript_caml.pl: -------------------------------------------------------------------------------- 1 | while (<>) { 2 | s/Manager.ap_manager_ptr/'a t Apron.Manager.t/g; 3 | s/Abstract0.ap_abstract0_ptr/'a t Apron.Abstract0.t/g; 4 | s/ap_lincons0_t/t/g; 5 | s/Lincons0.t/Apron.Lincons0.t/g; 6 | s/ap_lincons0_array_t/t array/g; 7 | s/Lincons0.t array/Apron.Lincons0.t array/g; 8 | s/ap_tcons0_t/t/g; 9 | s/ap_tcons0_array_t/t array/g; 10 | s/external ap_pplite_/external /g; 11 | s/external ap_abstract0_pplite_/external /g; 12 | s/external manager_alloc_loose : unit -> 'a t Apron.Manager.t/external manager_alloc_loose : unit -> loose t Apron.Manager.t/g; 13 | s/external manager_alloc_strict : unit -> 'a t Apron.Manager.t/external manager_alloc_strict : unit -> strict t Apron.Manager.t/g; 14 | print; 15 | } 16 | -------------------------------------------------------------------------------- /products/README: -------------------------------------------------------------------------------- 1 | 2 | # This file is part of the APRON Library, released under LGPL 3 | # license with an exception allowing the redistribution of 4 | $ statically linked executables 5 | 6 | # Please read the COPYING file packaged in the distribution 7 | 8 | This package contains various products built upon APRON base 9 | abstract domains. It contais currently: 10 | - the reduced product of NewPolka convex polyhedra and PPL linear 11 | congruences 12 | 13 | It includes both the C interface and the OCaml interface to 14 | APRON. 15 | 16 | REQUIREMENTS 17 | ============ 18 | For the C interface: 19 | 20 | GMP library (tested with version 4.0 and up) 21 | MPFR library (tested with version 2.2.0 and up) 22 | NUM "library" (a set of header files) 23 | ITV library 24 | APRON library 25 | 26 | For the OCaml interface, in addition: 27 | OCaml 3.0 or up (tested with 3.09) 28 | Camlidl (tested with 1.05) 29 | MLGMPIDL package 30 | MLAPRONIDL package 31 | 32 | INSTALLATION 33 | ============ 34 | 35 | 1. C Library 36 | ---------- 37 | 38 | type 'make', and then 'make install' 39 | 40 | The library is named libap_pkgrid.a (and 41 | libap_pkgrid_debug.a). 42 | 43 | For use via APRON, the include files to consider is ap_pkgrid.h. 44 | 45 | 2. OCaml Library 46 | ---------------- 47 | 48 | type 'make ml', and then 'make install' 49 | 50 | The C part of the library is named libpolkaGrid_caml.a or 51 | libpolkaGrid_caml.so/dllpolkaGrid_caml.so (and libpolkaGrid_caml_debug.a or ...). 52 | 53 | The OCaml part is named polkaGrid.cma (polkaGrid.cmxa) 54 | 55 | 3. Miscellaneous 56 | ---------------- 57 | 58 | 'make clean' and 'make distclean' have the usual behaviour. 59 | -------------------------------------------------------------------------------- /products/ap_disjpk.h: -------------------------------------------------------------------------------- 1 | /* ************************************************************************* */ 2 | /* ap_disjpk.h: disjunction of NewPolka polyhedra */ 3 | /* ************************************************************************* */ 4 | 5 | /* This file is part of the APRON Library, released under LGPL license with an exception allowing the redistribution of statically linked executables. 6 | 7 | Please read the COPYING file packaged in the distribution */ 8 | 9 | #ifndef _AP_DISJPK_H_ 10 | #define _AP_DISJPK_H_ 11 | 12 | #include "ap_disjunction.h" 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | ap_manager_t* ap_disjpk_manager_alloc(ap_manager_t* manpk); 19 | ap_lincons0_array_t ap_disjpk_to_lincons_set(ap_manager_t* manager, 20 | ap_abstract0_t* abs); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /products/ap_pkgrid.h: -------------------------------------------------------------------------------- 1 | /* ************************************************************************* */ 2 | /* ap_poly_grid.h: reduced product of NewPolka polyhedra and PPL grids */ 3 | /* ************************************************************************* */ 4 | 5 | /* This file is part of the APRON Library, released under GPL license. Please 6 | read the COPYING file packaged in the distribution */ 7 | 8 | #ifndef _AP_PKGRID_H_ 9 | #define _AP_PKGRID_H_ 10 | 11 | #include "ap_reducedproduct.h" 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | ap_manager_t* ap_pkgrid_manager_alloc(ap_manager_t* manpk, ap_manager_t* manpplgrid); 18 | /* Allocates a product managaer (see ap_reducedproduct.h header file 19 | 20 | Returns NULL if manpk is not a polka manager for loose or strict 21 | polyhedra, or if manpplgrid is not a PPL manager for grids. 22 | 23 | The given managers are copied (reference count incremented) in the 24 | result. So, if the argument managers are not needed any more, they 25 | should be freed with ap_manager_free. 26 | */ 27 | void ap_pkgrid_reduce(ap_manager_t* manager, 28 | ap_reducedproduct_t* a); 29 | /* Reduction function between the two domains */ 30 | 31 | void ap_pkgrid_approximate(ap_manager_t* manager, 32 | ap_reducedproduct_t* a, 33 | int n); 34 | /* Approximation function. 35 | 36 | It consists in apply approximate to the Polka polyhedron, with the argument n. 37 | */ 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /products/ap_pkgrid.texi: -------------------------------------------------------------------------------- 1 | @c This file is part of the APRON Library, released under GPL 2 | @c license. Please read the COPYING file packaged in the distribution 3 | 4 | @c to be included from apron.texi 5 | 6 | The @sc{pkgrid} library is aimed to be used through the APRON 7 | interface. It implements the reduced product of NewPolka convex 8 | polyhedra and the PPL linear congruences abstract domains and 9 | implementations. It exploits for this the features offered by the 10 | module @file{ap_reducedproduct} contained in the @file{apron} core 11 | library. 12 | 13 | @menu 14 | * Use of pkgrid:: 15 | * Allocating pkgrid managers:: 16 | @end menu 17 | 18 | @c =================================================================== 19 | @node Use of pkgrid, Allocating pkgrid managers,, pkgrid 20 | @subsection Use of pkgrid 21 | @c =================================================================== 22 | 23 | To use @sc{pkgrid} in C, add 24 | @example 25 | #include "ap_pkgrid.h" 26 | @end example 27 | in your source file(s) and add @samp{-I$(APRON_PREFIX)/include} in the 28 | command line in your Makefile. 29 | 30 | You should also link your object files with the @sc{pkgrid} 31 | library to produce an executable, by adding something like 32 | @samp{-L$(APRON_PREFIX)/lib -lap_pkgrid} in the command line in 33 | your Makefile, followed by the flags and libraries needed for the 34 | NewPolka library (@pxref{Use of NewPolka}) and the PPL library 35 | (@pxref{Use of APRON PPL}). Be cautious: because of the use of the 36 | PPL library, you @samp{g++} (C++ compiler) instead of @samp{gcc} 37 | (C compiler) for the linking. 38 | 39 | Also, the library is available in debug mode 40 | (@samp{libap_pkgrid_debug.a}, @samp{libap_pkgrid_debug.so}). 41 | 42 | @c =================================================================== 43 | @node Allocating pkgrid managers , , Use of pkgrid, pkgrid 44 | @subsection Allocating pkgrid managers 45 | @c =================================================================== 46 | 47 | @deftypefun ap_manager_t* ap_pkgrid_manager_alloc (ap_manager_t* @var{manpk}, ap_manager_t* @var{manpplgrid}) 48 | Allocate a APRON manager linked to the pkgrid library, using the 49 | (loose or strict) polka manager @var{manpk} and the PPL grid manager 50 | @var{manpplgrid}. If one of the argulment manager is not of the right 51 | type, returns @code{NULL}. 52 | @end deftypefun 53 | 54 | Available standard options are the one offered by the generic 55 | reduced product module @file{ap_reducedproduct} contained in the 56 | @file{apron} core library (@pxref{Functions for implementors}). 57 | -------------------------------------------------------------------------------- /products/perlscript_caml.pl: -------------------------------------------------------------------------------- 1 | while (<>) { 2 | s/Manager.ap_manager_ptr/'a t Apron.Manager.t/g; 3 | s/Abstract0.ap_abstract0_ptr/'a t Apron.Abstract0.t/g; 4 | s/ap_pkgrid_manager_alloc : 'a t Apron.Manager.t -> 'a t Apron.Manager.t -> 'a t Apron.Manager.t/manager_alloc : 'a Polka.t Apron.Manager.t -> Ppl.grid Ppl.t Apron.Manager.t -> 'a t Apron.Manager.t/g; 5 | s/ap_pkgrid_manager_decompose : 'a t Apron.Manager.t -> 'a t Apron.Manager.t \* 'a t Apron.Manager.t/manager_decompose : 'a t Apron.Manager.t -> 'a Polka.t Apron.Manager.t \* Ppl.grid Ppl.t Apron.Manager.t/g; 6 | s/ap_pkgrid_decompose : 'a t Apron.Abstract0.t -> 'a t Apron.Abstract0.t \* 'a t Apron.Abstract0.t/decompose : 'a t Apron.Abstract0.t -> 'a Polka.t Apron.Abstract0.t \* Ppl.grid Ppl.t Apron.Abstract0.t/g; 7 | s/ap_pkgrid_compose : 'a t Apron.Manager.t -> 'a t Apron.Abstract0.t -> 'a t Apron.Abstract0.t -> 'a t Apron.Abstract0.t/compose : 'a t Apron.Manager.t -> 'a Polka.t Apron.Abstract0.t -> Ppl.grid Ppl.t Apron.Abstract0.t -> 'a t Apron.Abstract0.t/g; 8 | print; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /taylor1plus/README.md: -------------------------------------------------------------------------------- 1 | # Taylor1plus 2 | 3 | Taylor1plus[1] (or t1p) is an **efficient implementation** of the affine forms-based numerical abstract domain introduced by Eric Goubault and Sylvie Putot in [4]. 4 | 5 | It defines the **meet operation** of two affine sets as a *logical product* of standard zonotpes and boxes [2]. 6 | 7 | It also implements several **join operations** over such logical products. 8 | 9 | All computations are enhanced using a (classical) product with the intervals-based abstract domain. 10 | 11 | See [3] for a full account of the underlying theoretical developments (which are only partially implemented in t1p). 12 | 13 | The domain requires the [APRON][apron] library wrappers to work properly. 14 | 15 | You can can also download it as part of [APRON][apron]. 16 | Both copies are kept sync. 17 | 18 | ## References 19 | [1] Ghorbal K, Goubault E, Putot S (2009) The Zonotope Abstract Domain Taylor1+. In CAV 2009, Grenoble, France, June 26 - July 2, 2009. Proceedings. Springer, pp 627–633 20 | \[[pdf][cav2009]\] 21 | 22 | [2] Ghorbal K, Goubault E, Putot S (2010) A Logical Product Approach to Zonotope Intersection. In CAV 2010, Edinburgh, UK, July 15-19, 2010. Proceedings. Springer, pp 212–226 23 | \[[pdf][cav2010]\] 24 | 25 | [3] Ghorbal K (2011) Static Analysis of Numerical Programs: Constrained Affine Sets Abstract Domain. (Analyse Statique de Programmes Numériques: Ensembles Affines Contraints). PhD thesis, École Polytechnique, Palaiseau, France 26 | \[[pdf][thesis]\] 27 | 28 | [4] Eric Goubault and Sylvie Putot, Static Analysis of Numerical Algorithms, Proceedings of Static Analysis Symposium SAS'06, Seoul, LNCS volume 4134, pp. 18-34 29 | \[[pdf][affinedomain]\] 30 | 31 | [apron]: http://apron.cri.ensmp.fr/library/ 32 | [cav2009]: http://khalilghorbal.info/assets/pdf/papers/cav2009.pdf 33 | [cav2010]: http://khalilghorbal.info/assets/pdf/papers/cav2010.pdf 34 | [thesis]: http://khalilghorbal.info/assets/pdf/papers/thesis-KG.pdf 35 | [affinedomain]: http://www.lix.polytechnique.fr/Labo/Sylvie.Putot/Publications/sas06.pdf 36 | -------------------------------------------------------------------------------- /taylor1plus/examples/InterL2.apron: -------------------------------------------------------------------------------- 1 | /* InterL2 */ 2 | /* x = 1/10 */ 3 | 4 | var x : real, y : real; 5 | begin 6 | assume x >= -1 and x <= 1; 7 | if (x>=0) then 8 | y = 10*x; 9 | else 10 | y = 20*x; 11 | endif; 12 | assume y == 1; 13 | end 14 | 15 | -------------------------------------------------------------------------------- /taylor1plus/examples/InterQ1.apron: -------------------------------------------------------------------------------- 1 | /* InterQ1 */ 2 | /* x in [0, 1875] */ 3 | 4 | 5 | var x : real, y : real; 6 | begin 7 | x = random; 8 | assume x <= 100 and x >= 0; 9 | if (x <= 50) then 10 | y = 0.5*x; 11 | x = (x-y)*x; 12 | else 13 | y = 0.75*x; 14 | x = (x-y)*y; 15 | endif; 16 | end 17 | -------------------------------------------------------------------------------- /taylor1plus/examples/InterQ2.apron: -------------------------------------------------------------------------------- 1 | /* InterQ2 */ 2 | /* x = sqrt(1/10) */ 3 | 4 | var x : real, y : real; 5 | begin 6 | assume x >= -1 and x <= 1; 7 | if (x>=0) then 8 | y = 10*x*x; 9 | else 10 | y = -20*x*x; 11 | endif; 12 | assume y == 1; 13 | end 14 | 15 | -------------------------------------------------------------------------------- /taylor1plus/examples/ItvPoly.apron: -------------------------------------------------------------------------------- 1 | /* IntPoly3 */ 2 | /* x >= 3 */ 3 | 4 | var x : real, y : real, z:real; 5 | begin 6 | assume -5 <= z and z <= 5; 7 | assume x >= -2; 8 | y = z * x + 1; 9 | assume y == -14; 10 | end 11 | 12 | -------------------------------------------------------------------------------- /taylor1plus/examples/Ln1px.apron: -------------------------------------------------------------------------------- 1 | var x : real, y : real ; 2 | begin 3 | assume x >= 0.000000 and x <= 0.500000; 4 | if (x<=0.125000) then 5 | y = x - (x*x)/2 + (x*x*x)/3 - (x*x*x*x)/4; 6 | else 7 | if (x<=0.250000) then 8 | y = x - (x*x)/2 + (x*x*x)/3 - (x*x*x*x)/4; 9 | else 10 | if (x<=0.375000) then 11 | y = x - (x*x)/2 + (x*x*x)/3 - (x*x*x*x)/4; 12 | else 13 | y = x - (x*x)/2 + (x*x*x)/3 - (x*x*x*x)/4; 14 | endif; 15 | endif; 16 | endif; 17 | end 18 | -------------------------------------------------------------------------------- /taylor1plus/examples/RunningExemple.apron: -------------------------------------------------------------------------------- 1 | /* Running Exemple */ 2 | /* y in [0,3] */ 3 | 4 | var x : real, y : real; 5 | begin 6 | assume x <= 10 and x >= 0; 7 | y = x*x - x; 8 | if (y >= 0) then 9 | y = x/10.0; 10 | else 11 | y = x*x + 2; 12 | endif; 13 | end 14 | -------------------------------------------------------------------------------- /taylor1plus/examples/SinCos.apron: -------------------------------------------------------------------------------- 1 | var x : real, y1 : real, y2 : real, z : real, w : real; 2 | begin 3 | assume x >= 0.000000 and x <= 1.570000; 4 | if (x<=0.157000) then 5 | y1 = 0.995897*x + 0.000000; 6 | y2 = -0.078339*x + 1.000000; 7 | z = y1*y1 + y2*y2; 8 | w = 1 / z; 9 | else 10 | if (x<=0.314000) then 11 | y1 = 0.971399*x + 0.003846; 12 | y2 = -0.233090*x + 1.024296; 13 | z = y1*y1 + y2*y2; 14 | w = 1 / z; 15 | else 16 | if (x<=0.471000) then 17 | y1 = 0.923007*x + 0.019041; 18 | y2 = -0.382107*x + 1.071087; 19 | z = y1*y1 + y2*y2; 20 | w = 1 / z; 21 | else 22 | if (x<=0.628000) then 23 | y1 = 0.851910*x + 0.052528; 24 | y2 = -0.521725*x + 1.136847; 25 | z = y1*y1 + y2*y2; 26 | w = 1 / z; 27 | else 28 | if (x<=0.785000) then 29 | y1 = 0.759858*x + 0.110337; 30 | y2 = -0.648509*x + 1.216468; 31 | z = y1*y1 + y2*y2; 32 | w = 1 / z; 33 | else 34 | if (x<=0.942000) then 35 | y1 = 0.649114*x + 0.197271; 36 | y2 = -0.759341*x + 1.303471; 37 | z = y1*y1 + y2*y2; 38 | w = 1 / z; 39 | else 40 | if (x<=1.099000) then 41 | y1 = 0.522403*x + 0.316633; 42 | y2 = -0.851494*x + 1.390280; 43 | z = y1*y1 + y2*y2; 44 | w = 1 / z; 45 | else 46 | if (x<=1.256000) then 47 | y1 = 0.382842*x + 0.470010; 48 | y2 = -0.922702*x + 1.468537; 49 | z = y1*y1 + y2*y2; 50 | w = 1 / z; 51 | else 52 | if (x<=1.413000) then 53 | y1 = 0.233863*x + 0.657127; 54 | y2 = -0.971213*x + 1.529467; 55 | z = y1*y1 + y2*y2; 56 | w = 1 / z; 57 | else 58 | y1 = 0.079132*x + 0.875763; 59 | y2 = -0.995834*x + 1.564256; 60 | z = y1*y1 + y2*y2; 61 | w = 1 / z; 62 | endif; 63 | endif; 64 | endif; 65 | endif; 66 | endif; 67 | endif; 68 | endif; 69 | endif; 70 | endif; 71 | end -------------------------------------------------------------------------------- /taylor1plus/examples/benchs/linear/InterL10.spl: -------------------------------------------------------------------------------- 1 | var x : real, y : real; 2 | begin 3 | assume x >= -1 and x <= 1; 4 | if (x>=0) then 5 | y = 10*x; 6 | else 7 | if (x>=-1/10) then 8 | y = 11.000000*x; 9 | else 10 | if (x>=-2/10) then 11 | y = 12.000000*x; 12 | else 13 | if (x>=-3/10) then 14 | y = 13.000000*x; 15 | else 16 | if (x>=-4/10) then 17 | y = 14.000000*x; 18 | else 19 | if (x>=-5/10) then 20 | y = 15.000000*x; 21 | else 22 | if (x>=-6/10) then 23 | y = 16.000000*x; 24 | else 25 | if (x>=-7/10) then 26 | y = 17.000000*x; 27 | else 28 | if (x>=-8/10) then 29 | y = 18.000000*x; 30 | else 31 | if (x>=-9/10) then 32 | y = 19.000000*x; 33 | else 34 | y = 20*x; 35 | endif; 36 | endif; 37 | endif; 38 | endif; 39 | endif; 40 | endif; 41 | endif; 42 | endif; 43 | endif; 44 | endif; 45 | assume y == 1;end -------------------------------------------------------------------------------- /taylor1plus/examples/benchs/quadra/InterQ10.spl: -------------------------------------------------------------------------------- 1 | var x : real, y : real; 2 | begin 3 | assume x >= -1 and x <= 1; 4 | if (x>=0) then 5 | y = 10*x*x; 6 | else 7 | if (x>=-1/10) then 8 | y = -101.000000*x*x; 9 | else 10 | if (x>=-2/10) then 11 | y = -102.000000*x*x; 12 | else 13 | if (x>=-3/10) then 14 | y = -103.000000*x*x; 15 | else 16 | if (x>=-4/10) then 17 | y = -104.000000*x*x; 18 | else 19 | if (x>=-5/10) then 20 | y = -105.000000*x*x; 21 | else 22 | if (x>=-6/10) then 23 | y = -106.000000*x*x; 24 | else 25 | if (x>=-7/10) then 26 | y = -107.000000*x*x; 27 | else 28 | if (x>=-8/10) then 29 | y = -108.000000*x*x; 30 | else 31 | if (x>=-9/10) then 32 | y = -109.000000*x*x; 33 | else 34 | y = -110.000000*x*x; 35 | endif; 36 | endif; 37 | endif; 38 | endif; 39 | endif; 40 | endif; 41 | endif; 42 | endif; 43 | endif; 44 | endif; 45 | assume y == 1; 46 | end -------------------------------------------------------------------------------- /taylor1plus/examples/benchs/stolfi/stolfi1.spl: -------------------------------------------------------------------------------- 1 | var x:real, y:real, z:real, h:real ; 2 | begin 3 | assume x >= -2.000000 and x <= 2.000000; 4 | h = 4.000000; 5 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 6 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 7 | end -------------------------------------------------------------------------------- /taylor1plus/examples/benchs/stolfi/stolfi10.spl: -------------------------------------------------------------------------------- 1 | var x:real, y:real, z:real, h:real ; 2 | begin 3 | assume x >= -2.000000 and x <= 2.000000; 4 | h = 0.400000; 5 | if (-x<=1*h - 2) then 6 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 7 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 8 | else 9 | if (-x<=2*h - 2) then 10 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 11 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 12 | else 13 | if (-x<=3*h - 2) then 14 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 15 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 16 | else 17 | if (-x<=4*h - 2) then 18 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 19 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 20 | else 21 | if (-x<=5*h - 2) then 22 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 23 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 24 | else 25 | if (-x<=6*h - 2) then 26 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 27 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 28 | else 29 | if (-x<=7*h - 2) then 30 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 31 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 32 | else 33 | if (-x<=8*h - 2) then 34 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 35 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 36 | else 37 | if (-x<=9*h - 2) then 38 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 39 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 40 | else 41 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 42 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 43 | endif; 44 | endif; 45 | endif; 46 | endif; 47 | endif; 48 | endif; 49 | endif; 50 | endif; 51 | endif; 52 | end -------------------------------------------------------------------------------- /taylor1plus/examples/benchs/stolfi/stolfi11.spl: -------------------------------------------------------------------------------- 1 | var x:real, y:real, z:real, h:real ; 2 | begin 3 | assume x >= -2.000000 and x <= 2.000000; 4 | h = 0.363636; 5 | if (-x<=1*h - 2) then 6 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 7 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 8 | else 9 | if (-x<=2*h - 2) then 10 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 11 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 12 | else 13 | if (-x<=3*h - 2) then 14 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 15 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 16 | else 17 | if (-x<=4*h - 2) then 18 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 19 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 20 | else 21 | if (-x<=5*h - 2) then 22 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 23 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 24 | else 25 | if (-x<=6*h - 2) then 26 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 27 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 28 | else 29 | if (-x<=7*h - 2) then 30 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 31 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 32 | else 33 | if (-x<=8*h - 2) then 34 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 35 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 36 | else 37 | if (-x<=9*h - 2) then 38 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 39 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 40 | else 41 | if (-x<=10*h - 2) then 42 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 43 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 44 | else 45 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 46 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 47 | endif; 48 | endif; 49 | endif; 50 | endif; 51 | endif; 52 | endif; 53 | endif; 54 | endif; 55 | endif; 56 | endif; 57 | end -------------------------------------------------------------------------------- /taylor1plus/examples/benchs/stolfi/stolfi13.spl: -------------------------------------------------------------------------------- 1 | var x:real, y:real, z:real, h:real ; 2 | begin 3 | assume x >= -2.000000 and x <= 2.000000; 4 | h = 0.307692; 5 | if (-x<=1*h - 2) then 6 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 7 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 8 | else 9 | if (-x<=2*h - 2) then 10 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 11 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 12 | else 13 | if (-x<=3*h - 2) then 14 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 15 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 16 | else 17 | if (-x<=4*h - 2) then 18 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 19 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 20 | else 21 | if (-x<=5*h - 2) then 22 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 23 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 24 | else 25 | if (-x<=6*h - 2) then 26 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 27 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 28 | else 29 | if (-x<=7*h - 2) then 30 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 31 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 32 | else 33 | if (-x<=8*h - 2) then 34 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 35 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 36 | else 37 | if (-x<=9*h - 2) then 38 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 39 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 40 | else 41 | if (-x<=10*h - 2) then 42 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 43 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 44 | else 45 | if (-x<=11*h - 2) then 46 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 47 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 48 | else 49 | if (-x<=12*h - 2) then 50 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 51 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 52 | else 53 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 54 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 55 | endif; 56 | endif; 57 | endif; 58 | endif; 59 | endif; 60 | endif; 61 | endif; 62 | endif; 63 | endif; 64 | endif; 65 | endif; 66 | endif; 67 | end -------------------------------------------------------------------------------- /taylor1plus/examples/benchs/stolfi/stolfi2.spl: -------------------------------------------------------------------------------- 1 | var x:real, y:real, z:real, h:real ; 2 | begin 3 | assume x >= -2.000000 and x <= 2.000000; 4 | h = 2.000000; 5 | if (-x<=1*h - 2) then 6 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 7 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 8 | else 9 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 10 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 11 | endif; 12 | end -------------------------------------------------------------------------------- /taylor1plus/examples/benchs/stolfi/stolfi3.spl: -------------------------------------------------------------------------------- 1 | var x:real, y:real, z:real, h:real ; 2 | begin 3 | assume x >= -2.000000 and x <= 2.000000; 4 | h = 1.333333; 5 | if (-x<=1*h - 2) then 6 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 7 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 8 | else 9 | if (-x<=2*h - 2) then 10 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 11 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 12 | else 13 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 14 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 15 | endif; 16 | endif; 17 | end -------------------------------------------------------------------------------- /taylor1plus/examples/benchs/stolfi/stolfi4.spl: -------------------------------------------------------------------------------- 1 | var x:real, y:real, z:real, h:real ; 2 | begin 3 | assume x >= -2.000000 and x <= 2.000000; 4 | h = 1.000000; 5 | if (-x<=1*h - 2) then 6 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 7 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 8 | else 9 | if (-x<=2*h - 2) then 10 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 11 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 12 | else 13 | if (-x<=3*h - 2) then 14 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 15 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 16 | else 17 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 18 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 19 | endif; 20 | endif; 21 | endif; 22 | end -------------------------------------------------------------------------------- /taylor1plus/examples/benchs/stolfi/stolfi5.spl: -------------------------------------------------------------------------------- 1 | var x:real, y:real, z:real, h:real ; 2 | begin 3 | assume x >= -2.000000 and x <= 2.000000; 4 | h = 0.800000; 5 | if (-x<=1*h - 2) then 6 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 7 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 8 | else 9 | if (-x<=2*h - 2) then 10 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 11 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 12 | else 13 | if (-x<=3*h - 2) then 14 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 15 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 16 | else 17 | if (-x<=4*h - 2) then 18 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 19 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 20 | else 21 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 22 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 23 | endif; 24 | endif; 25 | endif; 26 | endif; 27 | end -------------------------------------------------------------------------------- /taylor1plus/examples/benchs/stolfi/stolfi6.spl: -------------------------------------------------------------------------------- 1 | var x:real, y:real, z:real, h:real ; 2 | begin 3 | assume x >= -2.000000 and x <= 2.000000; 4 | h = 0.666667; 5 | if (-x<=1*h - 2) then 6 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 7 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 8 | else 9 | if (-x<=2*h - 2) then 10 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 11 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 12 | else 13 | if (-x<=3*h - 2) then 14 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 15 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 16 | else 17 | if (-x<=4*h - 2) then 18 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 19 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 20 | else 21 | if (-x<=5*h - 2) then 22 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 23 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 24 | else 25 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 26 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 27 | endif; 28 | endif; 29 | endif; 30 | endif; 31 | endif; 32 | end -------------------------------------------------------------------------------- /taylor1plus/examples/benchs/stolfi/stolfi7.spl: -------------------------------------------------------------------------------- 1 | var x:real, y:real, z:real, h:real ; 2 | begin 3 | assume x >= -2.000000 and x <= 2.000000; 4 | h = 0.571429; 5 | if (-x<=1*h - 2) then 6 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 7 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 8 | else 9 | if (-x<=2*h - 2) then 10 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 11 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 12 | else 13 | if (-x<=3*h - 2) then 14 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 15 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 16 | else 17 | if (-x<=4*h - 2) then 18 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 19 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 20 | else 21 | if (-x<=5*h - 2) then 22 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 23 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 24 | else 25 | if (-x<=6*h - 2) then 26 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 27 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 28 | else 29 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 30 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 31 | endif; 32 | endif; 33 | endif; 34 | endif; 35 | endif; 36 | endif; 37 | end -------------------------------------------------------------------------------- /taylor1plus/examples/benchs/stolfi/stolfi8.spl: -------------------------------------------------------------------------------- 1 | var x:real, y:real, z:real, h:real ; 2 | begin 3 | assume x >= -2.000000 and x <= 2.000000; 4 | h = 0.500000; 5 | if (-x<=1*h - 2) then 6 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 7 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 8 | else 9 | if (-x<=2*h - 2) then 10 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 11 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 12 | else 13 | if (-x<=3*h - 2) then 14 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 15 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 16 | else 17 | if (-x<=4*h - 2) then 18 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 19 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 20 | else 21 | if (-x<=5*h - 2) then 22 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 23 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 24 | else 25 | if (-x<=6*h - 2) then 26 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 27 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 28 | else 29 | if (-x<=7*h - 2) then 30 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 31 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 32 | else 33 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 34 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 35 | endif; 36 | endif; 37 | endif; 38 | endif; 39 | endif; 40 | endif; 41 | endif; 42 | end -------------------------------------------------------------------------------- /taylor1plus/examples/benchs/stolfi/stolfi9.spl: -------------------------------------------------------------------------------- 1 | var x:real, y:real, z:real, h:real ; 2 | begin 3 | assume x >= -2.000000 and x <= 2.000000; 4 | h = 0.444444; 5 | if (-x<=1*h - 2) then 6 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 7 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 8 | else 9 | if (-x<=2*h - 2) then 10 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 11 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 12 | else 13 | if (-x<=3*h - 2) then 14 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 15 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 16 | else 17 | if (-x<=4*h - 2) then 18 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 19 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 20 | else 21 | if (-x<=5*h - 2) then 22 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 23 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 24 | else 25 | if (-x<=6*h - 2) then 26 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 27 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 28 | else 29 | if (-x<=7*h - 2) then 30 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 31 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 32 | else 33 | if (-x<=8*h - 2) then 34 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 35 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 36 | else 37 | y = sqrt(x*x - x + 0.5) / sqrt(x*x + 0.5) ; 38 | z = sqrt(y*y - y + 0.5) / sqrt(y*y + 0.5) ; 39 | endif; 40 | endif; 41 | endif; 42 | endif; 43 | endif; 44 | endif; 45 | endif; 46 | endif; 47 | end -------------------------------------------------------------------------------- /taylor1plus/examples/cosine.apron: -------------------------------------------------------------------------------- 1 | /* cosine */ 2 | /* y in [-1,1] */ 3 | 4 | var x : real, y : real; 5 | begin 6 | x = random; 7 | assume x>=0 and x<=180; 8 | if (x <= 45) then 9 | y = 1 - 0.006508738196*x; 10 | else 11 | if (x <= 90) then 12 | y = 1 - 0.00017644492*x*x + 0.000000588757*x*x*x; 13 | else 14 | if (x<=135) then 15 | y = 1.283184584 - 0.0062929908*x - 0.00014148386*x*x +0.000000588757*x*x*x; 16 | else 17 | y = 0.17157287528 - 0.006508738196*x; 18 | endif; 19 | endif; 20 | endif; 21 | end 22 | 23 | -------------------------------------------------------------------------------- /taylor1plus/param.csdp: -------------------------------------------------------------------------------- 1 | axtol=1.0e-8 2 | atytol=1.0e-8 3 | objtol=1.0e-16 4 | pinftol=1.0e8 5 | dinftol=1.0e8 6 | maxiter=100 7 | minstepfrac=0.90 8 | maxstepfrac=0.97 9 | minstepp=1.0e-8 10 | minstepd=1.0e-8 11 | usexzgap=0 12 | tweakgap=0 13 | affine=0 14 | printlevel=1 15 | perturbobj=0 16 | fastmode=0 17 | 18 | -------------------------------------------------------------------------------- /taylor1plus/perlscript_caml.pl: -------------------------------------------------------------------------------- 1 | while (<>) { 2 | s/Manager.ap_manager_ptr/t Apron.Manager.t/g; 3 | s/external t1p_/external /g; 4 | print; 5 | } 6 | -------------------------------------------------------------------------------- /taylor1plus/t1p.h: -------------------------------------------------------------------------------- 1 | /* 2 | APRON Library / Taylor1+ Domain (beta version) 3 | Copyright (C) 2009-2011 Khalil Ghorbal 4 | 5 | */ 6 | 7 | 8 | #ifndef _T1P_H_ 9 | #define _T1P_H_ 10 | 11 | #include "ap_global0.h" 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | //ap_manager_t* t1p_manager_alloc(ap_manager_t* manNS); 18 | ap_manager_t* t1p_manager_alloc(void); 19 | typedef struct _t1p_t t1p_t; 20 | 21 | #include "t1p_representation.h" 22 | /* ********************************************************************** */ 23 | /* 1. Manager allocation */ 24 | /* ********************************************************************** */ 25 | //ap_manager_t* t1p_manager_alloc(ap_manager_t* manNS); 26 | //ap_manager_t* t1p_manager_alloc(void); 27 | /* ********************************************************************** */ 28 | /* 1. Memory */ 29 | /* ********************************************************************** */ 30 | /* ********************************************************************** */ 31 | /* 2. Control of internal representation */ 32 | /* ********************************************************************** */ 33 | /* ********************************************************************** */ 34 | /* 3. Printing */ 35 | /* ********************************************************************** */ 36 | /* ********************************************************************** */ 37 | /* 4. Serialisation */ 38 | /* ********************************************************************** */ 39 | 40 | /****************/ 41 | /* Constructors */ 42 | /****************/ 43 | /* 1.Basic constructors */ 44 | /* 2.Accessors */ 45 | /* 3.Tests */ 46 | /* 4.Extraction of properties */ 47 | #include "t1p_constructor.h" 48 | 49 | /* Meet and Join */ 50 | /*****************/ 51 | /* 1.Meet */ 52 | /* 2.Join */ 53 | #include "t1p_meetjoin.h" 54 | 55 | /* Assign and Substitute */ 56 | /*************************/ 57 | #include "t1p_assign.h" 58 | 59 | /* Resize dimensions */ 60 | /*********************/ 61 | #include "t1p_resize.h" 62 | 63 | /* Other functions */ 64 | /*******************/ 65 | #include "t1p_otherops.h" 66 | 67 | //typedef struct _ap_abstract1_t ap_abstract1_t; 68 | //typedef struct _ap_var_t ap_var_t; 69 | //int ap_manager_t1p_get_nsym(ap_manager_t* man); 70 | //void ap_abstract1_aff_build(ap_manager_t* man, ap_abstract1_t *abstract, ap_var_t var, unsigned int index, ap_interval_t *itv, bool isunion); 71 | //void ap_abstract1_ns_meet_lincons_array(ap_manager_t* man, ap_abstract1_t* abstract1, ap_lincons0_array_t* lincons); 72 | //void ap_abstract1_ns_meet_box_array(ap_manager_t* man, ap_abstract1_t* abstract1, ap_interval_t** box, size_t size); 73 | 74 | /* retourne [0,+oo] */ 75 | /* for internal use */ 76 | /* pour test */ 77 | //ap_interval_t* t1p_create_pos(ap_manager_t* man); 78 | 79 | #ifdef __cplusplus 80 | } 81 | #endif 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /taylor1plus/t1p_assign.h: -------------------------------------------------------------------------------- 1 | /* 2 | APRON Library / Taylor1+ Domain (beta version) 3 | Copyright (C) 2009-2011 Khalil Ghorbal 4 | 5 | */ 6 | 7 | 8 | #ifndef _T1P_ASSIGN_H_ 9 | #define _T1P_ASSIGN_H_ 10 | 11 | /* 12 | #include "ap_dimension.h" 13 | #include "ap_texpr0.h" 14 | #include "ap_generic.h" 15 | */ 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | /* Assign and Substitute */ 22 | /*************************/ 23 | t1p_t* t1p_assign_linexpr_array(ap_manager_t* man, 24 | bool destructive, 25 | t1p_t* org, 26 | ap_dim_t* tdim, ap_linexpr0_t** lexpr, 27 | size_t size, 28 | t1p_t* dest); 29 | 30 | t1p_t* t1p_substitute_linexpr_array(ap_manager_t* man, 31 | bool destructive, 32 | t1p_t* org, 33 | ap_dim_t* tdim, ap_linexpr0_t** lexpr, 34 | size_t size, 35 | t1p_t* dest); 36 | 37 | t1p_t* t1p_assign_texpr_array(ap_manager_t* man, 38 | bool destructive, 39 | t1p_t* a, 40 | ap_dim_t* tdim, 41 | ap_texpr0_t** texpr, 42 | size_t size, 43 | t1p_t* dest); 44 | 45 | t1p_t* t1p_substitute_texpr_array(ap_manager_t* man, 46 | bool destructive, 47 | t1p_t* org, 48 | ap_dim_t* tdim, ap_texpr0_t** texpr, 49 | size_t size, 50 | t1p_t* dest); 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /taylor1plus/t1p_constructor.h: -------------------------------------------------------------------------------- 1 | /* 2 | APRON Library / Taylor1+ Domain (beta version) 3 | Copyright (C) 2009-2011 Khalil Ghorbal 4 | 5 | */ 6 | 7 | 8 | #ifndef _T1P_CONSTRUCTOR_H_ 9 | #define _T1P_CONSTRUCTOR_H_ 10 | 11 | /* 12 | #include "ap_dimension.h" 13 | #include "ap_lincons0.h" 14 | #include "ap_manager.h" 15 | #include "ap_interval.h" 16 | #include "ap_tcons0.h" 17 | #include "ap_generator0.h" 18 | */ 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | /****************/ 25 | /* Constructors */ 26 | /****************/ 27 | /* 1.Basic constructors */ 28 | t1p_t* t1p_bottom(ap_manager_t* man, size_t intdim, size_t realdim); 29 | t1p_t* t1p_top(ap_manager_t* man, size_t intdim, size_t realdim); 30 | t1p_t* t1p_of_box(ap_manager_t* man, size_t intdim, size_t realdim, ap_interval_t** tinterval); 31 | 32 | /* 2.Accessors */ 33 | ap_dimension_t t1p_dimension(ap_manager_t* man, t1p_t* a); 34 | 35 | /* 3.Tests */ 36 | tbool_t t1p_is_bottom(ap_manager_t* man, t1p_t* a); 37 | tbool_t t1p_is_top(ap_manager_t* man, t1p_t* a); 38 | 39 | tbool_t t1p_is_leq(ap_manager_t* man, t1p_t* a, t1p_t* b); 40 | tbool_t t1p_is_eq(ap_manager_t* man, t1p_t* a, t1p_t* b); 41 | tbool_t t1p_is_dimension_unconstrained(ap_manager_t* man, t1p_t* a, ap_dim_t dim); 42 | tbool_t t1p_sat_lincons(ap_manager_t* man, t1p_t* a, ap_lincons0_t* lincons); 43 | tbool_t t1p_sat_interval(ap_manager_t* man, t1p_t* a, ap_interval_t* interval); 44 | tbool_t t1p_sat_tcons(ap_manager_t* man, t1p_t* a, ap_tcons0_t* tcons); 45 | 46 | /* 4.Extraction of properties */ 47 | ap_interval_t* t1p_bound_texpr(ap_manager_t* man, t1p_t* a, ap_texpr0_t* expr); 48 | ap_interval_t* t1p_bound_dimension(ap_manager_t* man, t1p_t* a, ap_dim_t dim); 49 | ap_interval_t* t1p_bound_linexpr(ap_manager_t* man, t1p_t* a, ap_linexpr0_t* expr); 50 | 51 | ap_interval_t** t1p_to_box(ap_manager_t* man, t1p_t* a); 52 | ap_tcons0_array_t t1p_to_tcons_array(ap_manager_t* man, t1p_t* a); 53 | ap_lincons0_array_t t1p_to_lincons_array(ap_manager_t* man, t1p_t* a); 54 | ap_generator0_array_t t1p_to_generator_array(ap_manager_t* man, t1p_t* a); 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /taylor1plus/t1p_fun.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoinemine/apron/2d0027326748b81026e2e8a711913be748b6ecca/taylor1plus/t1p_fun.c -------------------------------------------------------------------------------- /taylor1plus/t1p_fun.h: -------------------------------------------------------------------------------- 1 | /* 2 | APRON Library / Taylor1+ Domain (beta version) 3 | Copyright (C) 2009-2011 Khalil Ghorbal 4 | 5 | */ 6 | 7 | 8 | #ifndef _T1P_FUN_H_ 9 | #define _T1P_FUN_H_ 10 | 11 | /* 12 | #include "t1p_internal.h" 13 | #include "ap_texpr0.h" 14 | #include "t1p_representation.h" 15 | */ 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | t1p_aff_t* t1p_aff_eval_ap_texpr0(t1p_internal_t* pr, ap_texpr0_t* expr, t1p_t* env); 22 | 23 | t1p_aff_t* t1p_aff_eval_node(t1p_internal_t* pr, ap_texpr0_node_t* node, t1p_t* env); 24 | 25 | t1p_aff_t* t1p_aff_eval_node_unary (t1p_internal_t* pr, ap_texpr0_node_t* node, t1p_t* env); 26 | 27 | t1p_aff_t* t1p_afexpr_eval_node_binary (t1p_internal_t* pr, ap_texpr0_node_t* node, t1p_t* env); 28 | 29 | t1p_aff_t* t1p_aff_neg(t1p_internal_t* pr, t1p_aff_t* b); 30 | void t1p_aff_neg_inplace(t1p_internal_t* pr, t1p_aff_t* b); 31 | 32 | //t1p_aff_t* t1p_aff_add(t1p_internal_t* pr, t1p_aff_t* a, t1p_aff_t* b); 33 | t1p_aff_t* t1p_aff_add(t1p_internal_t* pr, t1p_aff_t* exprA, t1p_aff_t* exprB, t1p_t* abs); 34 | 35 | t1p_aff_t* t1p_aff_sub (t1p_internal_t* pr, t1p_aff_t* a, t1p_aff_t* b, t1p_t* abs); 36 | 37 | /* 38 | void t1p_aff_sub_pi(t1p_internal_t* pr, 39 | t1p_aff_t res, 40 | t1p_aff_t exprA, 41 | t1p_aff_t exprB); 42 | 43 | void t1p_aff_sub_pi_bis(t1p_internal_t* pr, 44 | t1p_aff_t res, 45 | t1p_aff_t exprA, 46 | t1p_aff_t exprB); 47 | */ 48 | 49 | t1p_aff_t* t1p_aff_mul(t1p_internal_t* pr, t1p_aff_t* a, t1p_aff_t* b, t1p_t* env); 50 | t1p_aff_t* t1p_aff_mul_non_constrained(t1p_internal_t* pr, t1p_aff_t* exprA, t1p_aff_t* exprB, t1p_t* env); 51 | t1p_aff_t* t1p_aff_mul_constrained(t1p_internal_t* pr, t1p_aff_t* exprA, t1p_aff_t* exprB, t1p_t* env); 52 | t1p_aff_t* t1p_aff_mul_itv(t1p_internal_t* pr, t1p_aff_t* src, itv_t lambda); 53 | void t1p_aff_mul_itv_inplace(t1p_internal_t* pr, t1p_aff_t* exprA, itv_t lambda); 54 | 55 | t1p_aff_t* t1p_aff_div(t1p_internal_t* pr, t1p_aff_t* a, t1p_aff_t* b, t1p_t* env); 56 | 57 | t1p_aff_t* t1p_aff_sqrt(t1p_internal_t* pr, t1p_aff_t* a, t1p_t* env); 58 | 59 | t1p_aff_t* t1p_aff_mod(t1p_internal_t* pr, t1p_aff_t* a, t1p_aff_t* b); 60 | 61 | //void square_dep(itv_internal_t* itv, itv_t res, t1p_aaterm_t* p, t1p_aaterm_t* q); 62 | void square_dep(t1p_internal_t* pr, itv_t res, t1p_aaterm_t* p, t1p_aaterm_t* q, int* hash, unsigned int dim, itv_t* gamma); 63 | bool call_sdp(itv_internal_t* itv, itv_t res, t1p_aaterm_t* p, t1p_aaterm_t* q, size_t dim, int* hash, bool square); 64 | 65 | void buildIntervalUpperTriangle(t1p_internal_t* pr, itv_t* array, t1p_aaterm_t* p, t1p_aaterm_t* q, size_t dim, int* hash); 66 | double* buildDoubleUpperTriangle(t1p_internal_t* pr, itv_t* array, size_t dim); 67 | 68 | #ifdef __cplusplus 69 | } 70 | #endif 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /taylor1plus/t1p_internal.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoinemine/apron/2d0027326748b81026e2e8a711913be748b6ecca/taylor1plus/t1p_internal.c -------------------------------------------------------------------------------- /taylor1plus/t1p_internal.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoinemine/apron/2d0027326748b81026e2e8a711913be748b6ecca/taylor1plus/t1p_internal.h -------------------------------------------------------------------------------- /taylor1plus/t1p_itv_utils.c: -------------------------------------------------------------------------------- 1 | /* 2 | APRON Library / Taylor1+ Domain (beta version) 3 | Copyright (C) 2009-2011 Khalil Ghorbal 4 | 5 | */ 6 | 7 | 8 | #include "t1p_itv_utils.h" 9 | -------------------------------------------------------------------------------- /taylor1plus/t1p_itv_utils.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoinemine/apron/2d0027326748b81026e2e8a711913be748b6ecca/taylor1plus/t1p_itv_utils.h -------------------------------------------------------------------------------- /taylor1plus/t1p_meetjoin.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoinemine/apron/2d0027326748b81026e2e8a711913be748b6ecca/taylor1plus/t1p_meetjoin.c -------------------------------------------------------------------------------- /taylor1plus/t1p_meetjoin.h: -------------------------------------------------------------------------------- 1 | /* 2 | APRON Library / Taylor1+ Domain (beta version) 3 | Copyright (C) 2009-2011 Khalil Ghorbal 4 | 5 | */ 6 | 7 | 8 | #ifndef _T1P_MEETJOIN_H_ 9 | #define _T1P_MEETJOIN_H_ 10 | 11 | /* 12 | #include "t1p_representation.h" 13 | #include "ap_manager.h" 14 | #include "ap_tcons0.h" 15 | #include "ap_lincons0.h" 16 | #include "ap_generator0.h" 17 | #include "ap_generic.h" 18 | */ 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | /* Meet and Join */ 25 | /*****************/ 26 | /* 1.Meet */ 27 | t1p_t* t1p_meet(ap_manager_t* man, bool destructive, t1p_t* a1, t1p_t* a2); 28 | t1p_t* t1p_meet_array(ap_manager_t* man, t1p_t** tab, size_t size); 29 | t1p_t* t1p_meet_lincons_array(ap_manager_t* man, 30 | bool destructive, 31 | t1p_t* a, 32 | ap_lincons0_array_t* array); 33 | t1p_t* t1p_meet_tcons_array(ap_manager_t* man, 34 | bool destructive, 35 | t1p_t* a, 36 | ap_tcons0_array_t* array); 37 | 38 | /* 2.Join */ 39 | t1p_t* t1p_join(ap_manager_t* man, bool destructive, t1p_t* a1, t1p_t* a2); 40 | t1p_t* t1p_join_array(ap_manager_t* man, t1p_t** tab, size_t size); 41 | t1p_t* t1p_add_ray_array(ap_manager_t* man, 42 | bool destructive, 43 | t1p_t* a, ap_generator0_array_t* array); 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /taylor1plus/t1p_otherops.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoinemine/apron/2d0027326748b81026e2e8a711913be748b6ecca/taylor1plus/t1p_otherops.c -------------------------------------------------------------------------------- /taylor1plus/t1p_otherops.h: -------------------------------------------------------------------------------- 1 | /* 2 | APRON Library / Taylor1+ Domain (beta version) 3 | Copyright (C) 2009-2011 Khalil Ghorbal 4 | 5 | */ 6 | 7 | 8 | #ifndef _T1P_OTHEROPS_H_ 9 | #define _T1P_OTHEROPS_H_ 10 | 11 | #include "ap_var.h" 12 | #include "ap_abstract1.h" 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | /* Other functions */ 19 | /*******************/ 20 | 21 | int ap_manager_t1p_get_nsym(ap_manager_t* man); 22 | 23 | void ap_abstract1_aff_build(ap_manager_t* man, ap_abstract1_t * abstract, ap_var_t var, unsigned int index, ap_interval_t *itv, bool isunion); 24 | void ap_abstract1_ns_meet_lincons_array(ap_manager_t* man, ap_abstract1_t* abstract1, ap_lincons0_array_t* lincons); 25 | void ap_abstract1_ns_meet_box_array(ap_manager_t* man, ap_abstract1_t* abstract1, ap_interval_t** box, size_t size); 26 | 27 | t1p_t* t1p_forget_array(ap_manager_t* man, 28 | bool destructive, t1p_t* a, 29 | ap_dim_t* tdim, size_t size, 30 | bool project); 31 | 32 | t1p_t t1p_expand(ap_manager_t* man, 33 | bool destructive, t1p_t* a, 34 | ap_var_t var, 35 | ap_var_t* tvar, size_t size); 36 | 37 | t1p_t t1p_fold(ap_manager_t* man, 38 | bool destructive, t1p_t* a, 39 | ap_var_t* tvar, size_t size); 40 | 41 | t1p_t* t1p_widening(ap_manager_t* man, 42 | t1p_t* a1, 43 | t1p_t* a2); 44 | 45 | t1p_t t1p_closure(ap_manager_t* man, bool destructive, t1p_t* a); 46 | 47 | /* retourne [0,+oo] */ 48 | /* for internal use */ 49 | /* pour test */ 50 | ap_interval_t* t1p_create_pos(ap_manager_t* man); 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | 56 | #endif 57 | 58 | -------------------------------------------------------------------------------- /taylor1plus/t1p_representation.h: -------------------------------------------------------------------------------- 1 | /* 2 | APRON Library / Taylor1+ Domain (beta version) 3 | Copyright (C) 2009-2011 Khalil Ghorbal 4 | 5 | */ 6 | 7 | 8 | #ifndef _T1P_REPRESENTATION_H_ 9 | #define _T1P_REPRESENTATION_H_ 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | /* Taylor1+ type */ 16 | 17 | //typedef struct _t1p_t { 18 | // t1p_aff_t** paf; /* array of pointers to Taylor1+ expressions of size dims */ 19 | // size_t intdim; /* nb of integer variables */ 20 | // size_t dims; /* intdim + realdim */ 21 | // ap_dim_t* nsymcons; /* array of index of constrained noise symbols */ 22 | // ap_abstract0_t* abs; /* nsym abstract object */ 23 | //} t1p_t; 24 | 25 | t1p_t* t1p_alloc(ap_manager_t* man, size_t intdim, size_t realdim); 26 | 27 | /* Return a copy of an abstract value, on 28 | * which destructive update does not affect the initial value. */ 29 | t1p_t* t1p_copy(ap_manager_t* man, t1p_t* a); 30 | 31 | /* free all the memory used by abstract value */ 32 | void t1p_free(ap_manager_t* man, t1p_t* a); 33 | 34 | size_t t1p_size(ap_manager_t* man, t1p_t* a); 35 | 36 | /* ********************************************************************** */ 37 | /* 2. Control of internal representation */ 38 | /* ********************************************************************** */ 39 | void t1p_minimize(ap_manager_t* man, t1p_t* a); 40 | 41 | void t1p_canonicalize(ap_manager_t* man, t1p_t* a); 42 | 43 | int t1p_hash(ap_manager_t* man, t1p_t* a); 44 | 45 | void t1p_approximate(ap_manager_t* man, t1p_t* a, int algorithm); 46 | 47 | /* ********************************************************************** */ 48 | /* 3. Printing */ 49 | /* ********************************************************************** */ 50 | void t1p_fprint(FILE* stream, 51 | ap_manager_t* man, 52 | t1p_t* a, 53 | char** name_of_dim); 54 | 55 | void t1p_fprintdiff(FILE* stream, 56 | ap_manager_t* man, 57 | t1p_t* a1, t1p_t* a2, 58 | char** name_of_dim); 59 | 60 | void t1p_fdump(FILE* stream, ap_manager_t* man, t1p_t* a); 61 | 62 | /* ********************************************************************** */ 63 | /* 4. Serialisation */ 64 | /* ********************************************************************** */ 65 | void t1p_serialize_raw(ap_manager_t* man, t1p_t* a); 66 | 67 | void t1p_deserialize_raw(ap_manager_t* man, t1p_t* a); 68 | 69 | #ifdef __cplusplus 70 | } 71 | #endif 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /taylor1plus/t1p_resize.h: -------------------------------------------------------------------------------- 1 | /* 2 | APRON Library / Taylor1+ Domain (beta version) 3 | Copyright (C) 2009-2011 Khalil Ghorbal 4 | 5 | */ 6 | 7 | 8 | #ifndef _T1P_RESIZE_H_ 9 | #define _T1P_RESIZE_H_ 10 | 11 | #include "ap_dimension.h" 12 | #include "ap_manager.h" 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | /* Resize dimensions */ 19 | /*********************/ 20 | t1p_t* t1p_add_dimensions(ap_manager_t* man, 21 | bool destructive, t1p_t* a, 22 | ap_dimchange_t* dimchange, 23 | bool project); 24 | 25 | t1p_t* t1p_remove_dimensions(ap_manager_t* man, 26 | bool destructive, t1p_t* a, 27 | ap_dimchange_t* dimchange); 28 | 29 | t1p_t* t1p_permute_dimensions(ap_manager_t* man, 30 | bool destructive, 31 | t1p_t* a, 32 | ap_dimperm_t* permutation); 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /test/Makefile: -------------------------------------------------------------------------------- 1 | include ../Makefile.config 2 | include ../vars.mk 3 | 4 | ICFLAGS += \ 5 | -I$(GMP_PREFIX)/include \ 6 | -I$(MPFR_PREFIX)/include \ 7 | -I$(APRON_INCLUDE) \ 8 | -I$(PPL_PREFIX)/include 9 | 10 | LCFLAGS = \ 11 | -L$(GMP_PREFIX)/lib \ 12 | -L$(MPFR_PREFIX)/lib \ 13 | -L$(APRON_LIB) \ 14 | -L$(PPL_PREFIX)/lib \ 15 | -L$(CAMLIDL_PREFIX) 16 | 17 | OCAMLINC = \ 18 | -I $(MLGMPIDL_LIB) \ 19 | -I $(APRON_LIB) 20 | 21 | OCAMLLDFLAGS = \ 22 | -verbose -cc "g++" \ 23 | bigarray.cma gmp.cma apron.cma boxMPQ.cma polkaMPQ.cma octD.cma ppl.cma polkaGrid.cma 24 | 25 | OCAMLOPTLDFLAGS = \ 26 | -noautolink -verbose -ccopt "$(LCFLAGS)" \ 27 | bigarray.cmxa gmp.cmxa apron.cmxa boxMPQ.cmxa polkaMPQ.cmxa octD.cmxa ppl.cmxa polkaGrid.cmxa 28 | all: C 29 | 30 | # C examples 31 | .PRECIOUS: %.c %.o %_debug.o 32 | 33 | C: ctest1 34 | 35 | ctest%_debug: ctest%_debug.o 36 | $(CXX) -g $(ICFLAGS) $(LCFLAGS) -o $@ $< \ 37 | -lap_pkgrid_debug -lap_ppl_debug -lppl -lgmpxx -lpolkaMPQ_debug -loctMPQ_debug -lboxMPQ_debug -lapron_debug -lmpfr -lgmp 38 | 39 | ctest%: ctest%.o 40 | $(CXX) $(ICFLAGS) $(LCFLAGS) -o $@ $< \ 41 | -lap_pkgrid -lap_ppl -lppl -lgmpxx -lpolkaMPQ -loctMPQ -lboxMPQ -lapron -lmpfr -lgmp 42 | 43 | ctest%_debug.o: ctest%.c 44 | $(CC) $(CFLAGS_DEBUG) $(ICFLAGS) $(LCFLAGS) -c -o $@ $< 45 | ctest%.o : ctest%.c 46 | $(CC) $(CFLAGS) $(ICFLAGS) $(LCFLAGS) -c -o $@ $< 47 | 48 | # OCaml examples 49 | %.opt: %.ml 50 | $(OCAMLFIND) ocamlopt -verbose $(OCAMLOPTFLAGS) -o $@ $< -package "apron.boxMPQ,apron.octMPQ,apron.polkaMPQ,apron.t1pMPQ,apron.ppl,apron.polkaGrid,apron.disjPk" -linkpkg 51 | 52 | %.byte: %.ml 53 | $(OCAMLC) $(OCAMLFLAGS) $(OCAMLINC) $(OCAMLLDFLAGS) -o $@ $< 54 | 55 | clean: 56 | rm -f ctest1 ctest?_debug *.o *.cm[xoia] *.opt *.byte 57 | 58 | distclean: clean 59 | 60 | mostlyclean: clean 61 | 62 | dist: ctest1.c Makefile README 63 | (cd ..; tar zcvf test.tgz $(^:%=test/%)) 64 | -------------------------------------------------------------------------------- /test/README: -------------------------------------------------------------------------------- 1 | # This file is part of the APRON Library, released under GPL 2 | # license. 3 | 4 | Various testing of APRON libraries 5 | Require PPL library. 6 | -------------------------------------------------------------------------------- /test/ctest2.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoinemine/apron/2d0027326748b81026e2e8a711913be748b6ecca/test/ctest2.c -------------------------------------------------------------------------------- /test/ctest3.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoinemine/apron/2d0027326748b81026e2e8a711913be748b6ecca/test/ctest3.c -------------------------------------------------------------------------------- /test/sorttest.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "../newpolka/pk_qsort.h" 7 | 8 | int cmp_int(void* unused, int* a, int* b) { 9 | return (*a > *b) ? 1 : (*a < *b) ? -1 : 0; 10 | } 11 | 12 | MAKE_SORT(sort_int, int, cmp_int) 13 | 14 | int sum(int* a, size_t size) { 15 | int x = 0; 16 | for (size_t i = 0; i < size; i++) x += a[i]; 17 | return x; 18 | } 19 | 20 | void check_cst_array(size_t size) { 21 | int x = lrand48(); 22 | int* a = malloc(sizeof(int)*size); 23 | for (size_t i = 0; i < size; i++) 24 | a[i] = x; 25 | int s = sum(a,size); 26 | checked_sort_int(a, size, NULL); 27 | assert(s == sum(a,size)); 28 | free(a); 29 | } 30 | 31 | void check_inc_array(size_t size) { 32 | int* a = malloc(sizeof(int)*size); 33 | for (size_t i = 0; i < size; i++) 34 | a[i] = i; 35 | int s = sum(a,size); 36 | checked_sort_int(a, size, NULL); 37 | assert(s == sum(a,size)); 38 | free(a); 39 | } 40 | 41 | void check_dec_array(size_t size) { 42 | int* a = malloc(sizeof(int)*size); 43 | for (size_t i = 0; i < size; i++) 44 | a[i] = size-i; 45 | int s = sum(a,size); 46 | checked_sort_int(a, size, NULL); 47 | assert(s == sum(a,size)); 48 | free(a); 49 | } 50 | 51 | void check_rnd_array(size_t size, int max_rand) { 52 | int* a = malloc(sizeof(int)*size); 53 | for (size_t i = 0; i < size; i++) 54 | a[i] = lrand48() & max_rand; 55 | int s = sum(a,size); 56 | checked_sort_int(a, size, NULL); 57 | assert(s == sum(a,size)); 58 | free(a); 59 | } 60 | 61 | 62 | int main() { 63 | for (int i = 0; i < 1000; i++) { 64 | printf("check constant array of size %i\n",i); 65 | check_cst_array(i); 66 | } 67 | for (int i = 1; i < 1000; i++) { 68 | printf("check increasing array of size %i\n",i); 69 | check_inc_array(i); 70 | } 71 | for (int i = 1; i < 1000; i++) { 72 | printf("check decreasing array of size %i\n",i); 73 | check_dec_array(i); 74 | } 75 | for (int i = 1; i < 1000; i++) { 76 | printf("check random array of size %i\n",i); 77 | for (int j = i/2; j < i*2; j += 2) { 78 | check_rnd_array(i, j); 79 | } 80 | for (int j = 0; j < 1000; j++) { 81 | check_rnd_array(i, INT_MAX); 82 | } 83 | } 84 | for (int i = 1000; i < 1000000; i = i*4/3) { 85 | printf("check random array of size %i\n",i); 86 | for (int j = 0; j < 100; j++) { 87 | check_rnd_array(i, INT_MAX); 88 | } 89 | } 90 | return 0; 91 | } 92 | -------------------------------------------------------------------------------- /version.mk: -------------------------------------------------------------------------------- 1 | # bump here at each release 2 | VERSION_MAJOR = 0 3 | VERSION_MINOR = 9 4 | VERSION_MICRO = 15 5 | 6 | # automatically generated 7 | VERSION_STR = "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_MICRO}" 8 | --------------------------------------------------------------------------------