Low-Level Requirements: Prolog Interface
|
Type
|
Level
|
MID
|
UID
|
REFS
|
Title
|
Statement
|
Rationale
|
Comment
|
BIBLIOGRAPHY
|
STATUS
|
COMPONENT
|
APPLICABILITY
|
VERIFICATION_METHODS
|
VERIFICATION_CRITERIA
|
SOURCE
|
LANGUAGE
|
VISIBILITY
|
INTERFACE
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
LLR
|
1 |
|
|
|
For each enabled supported Prolog system, the Prolog interface shall interpret its documented mathematical terms with the same numerical meaning. Conversion of supported linear expressions, constraints and generators shall preserve representable coefficient values, variable identities and relation meanings. |
Differences between Prolog foreign-language interfaces must not change the mathematics of the common binding. |
Verification covers each supported engine's mathematical term conversion contracts. Common conversion cases and engine-specific inspection verify equal mathematical meaning within supported numeric limits. Availability of an engine adapter does not imply arbitrary-size integer support or every loading mode. |
|
|
|
|
|
The common conversion cases produce equivalent mathematical objects on each tested enabled engine; cases cover signed coefficients, variable positions, relation kinds and generator kinds within that engine's documented numeric limits. |
interfaces/Prolog/Prolog_interface_sysindep.dox, mathematical term representations; interfaces/Prolog/ppl_prolog_common_defs.hh; interfaces/Prolog/ppl_prolog_common.cc. |
||||
|
LLR
|
2 |
|
|
|
The Prolog interface shall express a successful numerical query through the predicate's documented success and output bindings, and a false numerical predicate through ordinary predicate failure. Every malformed argument or native failure designated by the supported failure model shall be reported through Prolog error handling rather than being treated as a false numerical result. Native C++ exceptions raised by supported operations shall be contained at the Prolog boundary. |
Logical failure and a failure to perform a computation have different meanings to a Prolog caller. |
Verification covers predicate truth, output unification, supported error categories and native exception containment on each selected engine. Truth/error distinction tests and boundary-path inspection verify these contracts. Ordinary predicate failure does not imply that mutations of foreign objects are automatically undone; operation-specific failure and ownership postconditions must be specified under 🔗 3. Failure and resource safety. |
|
|
|
|
|
For each selected supported engine, check that true queries succeed, false numerical predicates fail normally, and supported malformed-argument and native-failure categories reach the declared Prolog error mechanism. Check output bindings for successful result-producing predicates, exception containment, and cleanup when output unification or error reporting fails. |
interfaces/Prolog/Prolog_interface_sysindep.dox, Predicate Specifications; interfaces/Prolog/Prolog_interface_sysindep_domains.dox; interfaces/Prolog/ppl_prolog_common_defs.hh, handled error categories. |
||||
|
LLR
|
3 |
|
|
Incoming link from:
4. Prolog library lifecycle
1 |
The Prolog interface shall provide construction, copying and deletion of owned native numerical objects exposed through handles, including supported domain, MIP problem and PIP problem objects. Copy construction shall create an independent object, and deletion shall release the owned object and invalidate access through its handles and dependent views. Numerical-domain and MIP problem handles shall be checked for native type and live owner identity before native access. Powerset iterator and disjunct handles shall also be checked against the current owner generation. Borrowed powerset disjuncts shall be read-only. Iterator traversal shall reject boundary violations and operations combining different owners. Stale iterator objects shall remain explicitly releasable until finalization. PIP problem and tree handles shall be checked against a live owner identity and current generation before native access. PIP mutations shall invalidate previous tree views, and malformed, stale, unknown or wrong-type domain, MIP, powerset iterator/view and PIP handles shall raise a Prolog invalid-argument exception rather than dereferencing native storage. |
Prolog term lifetime alone does not determine the lifetime of foreign numerical objects. |
Verification covers Prolog owned domain and solver object creation, copying, deletion and dependent-view invalidation. Normal-lifetime release checks, independent-copy tests and ownership inspection verify those contracts. Numerical-domain, MIP, powerset iterator/view and PIP handles require automatic rejection of stale, malformed, unknown and wrong-type inputs. Their opaque identities are independent of coefficient width and never wrap or revive after finalization/reinitialization. Calls that may normalize a powerset conservatively invalidate its views and iterators; documented stable queries preserve them. MIP problems use the shared owned-object registry and are released at finalization; mutations preserve their problem handles. Constructor and copy outputs are discarded when unification fails or raises. The former optional allocation-tracking mechanism is retired. Prolog term collection or backtracking alone does not release an owned foreign numerical object. Library lifecycle is governed separately by 🔗 4. Prolog library lifecycle. |
|
|
|
|
|
For supported domain, MIP problem and PIP problem objects, create an owned object and copy, modify one without changing the other, and delete each through its valid owned handle. Check normal-lifetime release of the corresponding native allocations. Review deletion invalidation and borrowed domain and solver views for their owner-lifetime and mutation-validity restrictions. For powersets, check borrowed-view mutation and deletion rejection, independent writable copies, aliasing inputs, both sides of swap, normalizing queries, stale views and iterators, iterator boundaries, foreign owners, reversed ranges, cursor refresh on single removal, range removal, release after owner deletion and failed output unification. Exercise registry address reuse, counter exhaustion and finalization/reinitialization. For MIP problems, exercise every predicate with deleted, malformed, unknown and wrong-type handles, both swap arguments, independent copies, failed constructor/copy output unification, finalization/reinitialization and identities beyond checked coefficient width. Confirm that clear, swap and ordinary updates preserve live problem handles. For PIP problems, exercise every mutation, both sides of swap, deletion, repeated deletion, finalization/reinitialization, and root, descendant and bottom views. Check stable repeated queries, wrong node kinds, failed output unification, native-address reuse, bounded registry storage and counter exhaustion. Coordinate these cases with the permitted library lifecycle transitions in 🔗 1. Initialization and finalization lifecycle. |
interfaces/Prolog/Prolog_interface_sysindep.dox, object handles, ownership and MIP and PIP problem construction, copying and deletion; interfaces/Prolog/Prolog_interface_sysindep_domains.dox, domain constructors, copies, deletion and iterators; interfaces/Prolog/ppl_prolog_common_defs.hh and interfaces/Prolog/ppl_prolog_common.cc, typed object ownership and problem lifetime operations; interfaces/Prolog/ppl_prolog_domain_handles.hh and interfaces/Prolog/tests/domain_handles1.cc, typed numerical-domain ownership and powerset iterator/view registry and regressions; interfaces/Prolog/ppl_prolog_pip_handles.hh, typed PIP owner and generation registry; interfaces/Prolog/tests/pip_handles1.cc and interfaces/Prolog/tests/pl_check.pl, PIP lifetime regressions. |
||||
|
LLR
|
4 |
|
|
Incoming link from:
3. Prolog object lifetime operations
1 |
Each supported Prolog adapter shall establish library initialization before supported predicate use, explicitly or automatically according to its documented loading protocol. Repeated initialization and finalization requests shall be harmless. Following finalization, only the documented lifecycle operations shall be permitted until initialization establishes a new valid period of use. |
Supported engines differ in automatic foreign-module loading hooks, while the common Prolog interface has an idempotent lifecycle distinct from the C lifecycle protocol. |
Verification covers common Prolog lifecycle predicates and each supported adapter's automatic loading hooks. Lifecycle sequence checks and adapter inspection verify the protocol. The lifecycle protocol does not require automatic diagnosis of every operation invoked outside its lifecycle preconditions. Object ownership remains governed by 🔗 3. Prolog object lifetime operations; its protocol need not match the duplicate-request errors of 🔗 1. Explicit C library lifecycle. |
|
|
|
|
|
For each selected supported engine and loading mode, review automatic initialization and finalization hooks and exercise explicit initialization, repeated initialization, finalization, repeated finalization and reinitialization. Check the documented permitted-call state transitions without treating stale foreign-object handles as newly valid after reinitialization. |
interfaces/Prolog/Prolog_interface_sysindep.dox: Initialization and Finalization and engine-dependent loading hooks; interfaces/Prolog/ppl_prolog_common.cc: common lifecycle operations; interfaces/Prolog/Prolog_interface.dox: supported adapter documentation. |