-
7. Access through supported language interfaces PPL-HLR-000007 PPL shall expose its numerical facilities through its C++ interface and expose selected facilities through the supported C, Java, OCaml and Prolog interfaces. Each interface shall preserve the declared semantics of the facilities it exposes.
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.
-
1. OCaml mathematical representation exchange PPL-SPEC-001692 For well-formed values of the exposed algebraic types, conversion to native objects shall preserve zero-based variable identities, signed integral Z.t coefficients within the configured native range, affine expression meaning, equality and strict/non-strict inequality meaning, and generator kind. Returned values shall denote the native result; syntactic tree shape and normalization need not be preserved.
Conversion of finite acyclic expressions to native objects shall preserve operator grouping and apply the configured coefficient rules at each node. Native stack usage shall be independent of expression depth. The expression values used during traversal shall remain valid under the OCaml runtime's lifetime and collection rules.
A point or closure point with expression coordinates ai and nonzero divisor d denotes coordinates ai ⁄ d. Lines and rays denote the native direction described by the expression. Grid generators and congruences shall preserve their native rational-divisor and integral-modulus meanings. Native validity and operation-specific topology and arithmetic preconditions apply. A Z.t may be immediate or heap allocated; the binding shall use its value rather than assume either memory layout.
-
4. OCaml operation-option correspondence PPL-SPEC-001731 For well-typed public OCaml values, conversion of operation options shall select the native choice with the same documented meaning: empty/universe, bounded integer width (8, 16, 32, 64 or 128 bits), unsigned or two's-complement signed representation, wrapping/undefined/impossible overflow, minimization or maximization, and polynomial/simplex/unrestricted complexity. MIP pricing and PIP cutting/pivot names and values shall select their corresponding native control parameters. These options retain the native operation's mathematical preconditions and exactness or approximation guarantees. Values forged outside the public OCaml type definitions are outside this conversion contract; supported boundary failures follow 🔗 3. OCaml native exception translation.
-
7. Access through supported language interfaces PPL-HLR-000007 PPL shall expose its numerical facilities through its C++ interface and expose selected facilities through the supported C, Java, OCaml and Prolog interfaces. Each interface shall preserve the declared semantics of the facilities it exposes.
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.
-
2. OCaml managed native ownership PPL-SPEC-001693 Owned domain, MIP and PIP problem handles shall register a custom finalizer which releases the owned native object exactly once when the OCaml runtime finalizes the handle. Independent copies shall own independent allocations. A marked borrowed native pointer shall not be deleted by its wrapper finalizer.
Factories shall allocate managed native owners before constructing native objects or owned conversion temporaries. Native slots shall contain null or their owned pointer before they can be observed by a finalizer or client. Native-only construction may defer the null-slot write to its failure path before exception translation or any further managed allocation. No subsequent OCaml allocation shall be needed to publish a newly owned native pointer. C++ failures during construction or multi-result computation shall leave no unowned native allocation; partially initialized managed owners shall be safe to finalize.
Borrowed powerset iterators and read-only disjuncts shall keep their owner in GC-scanned storage and check its generation before native access. PIP tree views shall keep their problem owner reachable and reject generation-invalid access. View collection shall not delete the owner's native allocation. Clients shall respect the library lifecycle and operation-specific view invalidation rules. No collection time or prompt finalization is promised.
-
7. Access through supported language interfaces PPL-HLR-000007 PPL shall expose its numerical facilities through its C++ interface and expose selected facilities through the supported C, Java, OCaml and Prolog interfaces. Each interface shall preserve the declared semantics of the facilities it exposes.
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.
-
Incoming link from: 4. OCaml operation-option correspondence1
3. OCaml native exception translation PPL-SPEC-001694 Native exceptions raised by supported OCaml numerical entry points shall be contained. bad_alloc shall raise Out_of_memory and invalid_argument shall raise Invalid_argument. Native overflow, domain, length, logic and runtime errors shall raise the corresponding declared PPL_arithmetic_overflow, PPL_domain_error, PPL_length_error, PPL_logic_error and PPL_internal_error exceptions with diagnostics. Other standard exceptions shall raise PPL_unknown_standard_exception; unexpected native exceptions shall raise PPL_unexpected_error. Supported timeout exceptions shall reset the triggering binding-owned timer and raise PPL_timeout_exception.
Native handlers and scoped native resources shall finish cleanup before the host exception is raised. If native unwinding leaves local root records from exited frames, the bridge shall restore the prior root chain before any runtime allocation. Diagnostic creation shall preserve the exception type and message when allocation succeeds. Allocation failure during translation shall be reported through the OCaml runtime after native cleanup. Raising an exception does not promise rollback beyond an operation's contract. Well-typed host representations, lifecycle, range and synchronization preconditions apply.