Parma Polyhedra Library requirements
Low-Level Requirements: OCaml Interface

Low-Level Requirements: OCaml Interface

UID:
VERSION:
CLASSIFICATION:
PREFIX:
Type
Level
MID
UID
REFS
Title
Statement
Rationale
Comment
BIBLIOGRAPHY
STATUS
COMPONENT
APPLICABILITY
VERIFICATION_METHODS
VERIFICATION_CRITERIA
SOURCE
LANGUAGE
VISIBILITY
INTERFACE
LLR
1
PPL-LLR-000207
PPL-LLR-000207
OCaml numerical term conversion

The OCaml interface shall translate its supported linear-expression, constraint and generator values into the corresponding native mathematical objects while preserving variable identities, relation meanings and representable integral coefficients. Returned representations shall denote the native results.

Language-level representation changes must preserve the mathematical meaning of exchanged objects.

Verification covers supported OCaml/native mathematical representations and their conversions. Independent mathematical reconstruction and conversion tests verify coordinate, coefficient and relation preservation. Coverage remains limited to representations exposed by the selected interface; 🔗 2. Mathematical consistency of corresponding binding operations governs the wider facility-preservation obligation.

APPROVED
OCAML_INTERFACE
IF_OCAML
Test, Review

Conversion tests cover signed coefficients, several variable positions, equality and strict and non-strict inequalities, and supported generator kinds; reconstructed native objects and returned OCaml representations have the same mathematical interpretation.

interfaces/OCaml/ppl_ocaml_globals.mli, numerical representation types; interfaces/OCaml/ppl_ocaml_common.cc, mathematical object conversion helpers; interfaces/OCaml/tests/test1.ml.

LLR
2
PPL-LLR-000208
PPL-LLR-000208
OCaml native object reclamation

The OCaml interface shall associate each owned native numerical object exposed by the interface, including supported domain, MIP problem and PIP problem objects, with an OCaml-managed handle whose finalization releases that native object. Borrowed views shall retain their documented ownership and validity preconditions rather than acquiring an independent owned lifetime.

Owned native allocations must participate in the managed runtime's resource lifecycle.

Verification covers owned OCaml domain and solver handles, their finalizers and borrowed-view validity. Normal-lifetime checks, allocation-sensitive lifecycle checks and finalizer inspection verify cleanup and owner separation. Finalization timing is controlled by the OCaml runtime; prompt reclamation at a particular program point is not promised. Failure cleanup is governed by 🔗 3. Failure and resource safety.

APPROVED
OCAML_INTERFACE
IF_OCAML
Test, Review

Inspect finalizers for generated domain handles and MIP and PIP problem handles. Exercise their normal owned lifetimes, including repeated creation and collection of unreachable handles, and confirm that cleanup releases their native allocations without deleting a still-live independent object. For borrowed domain and solver views, including PIP solution-tree nodes, review owner-lifetime and mutation-invalidation preconditions and verify that view cleanup does not release the owner's native allocation. Coordinate these cases with the permitted library lifecycle transitions in 🔗 1. Initialization and finalization lifecycle.

interfaces/OCaml/ppl_interface_generator_ocaml_cc_code.m4, custom operations; interfaces/OCaml/ppl_interface_generator_ocaml_hh_code.m4, owned domain finalizers; interfaces/OCaml/ppl_ocaml_common.cc, owned MIP and PIP problem finalizers and borrowed tree-node wrappers.

LLR
3
PPL-LLR-000209
PPL-LLR-000209
OCaml boundary error translation

The OCaml interface shall report every native failure designated by its supported failure model through the OCaml exception mechanism, including invalid-argument, arithmetic-overflow, allocation-failure and supported timeout conditions. Native C++ exceptions raised by supported operations shall be contained at the OCaml runtime boundary rather than escaping to the caller.

OCaml callers must be able to handle library failures without depending on the native language's exception machinery.

Verification covers the OCaml failure model, host exception mapping and native exception containment. Failure-category tests and inspection of conversion and boundary cleanup provide evidence. Timeout cases apply only where the corresponding facility is supported; binding-owned timeout state is governed by 🔗 4. Binding interruption support and state changes. Resource cleanup is governed by 🔗 3. Failure and resource safety.

APPROVED
OCAML_INTERFACE
IF_OCAML
Test, Review

Exercise the supported failure categories and confirm their declared OCaml exceptions, including invalid arguments, domain and size errors, checked-coefficient overflow, allocation failure and supported interruptions. Inspect native exception containment and cleanup of resources acquired before a host-runtime error is raised.

interfaces/OCaml/ppl_ocaml_common_defs.hh, exception translation; interfaces/OCaml/ppl_ocaml_globals.ml, exception registration; interfaces/OCaml/ppl_ocaml_globals.mli, exposed exception declarations.