Parma Polyhedra Library requirements
Internal Box cached-status assertions

Internal Box cached-status assertions

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
SW_SPEC
1
PPL-SPEC-000671

Box<ITV>::Status shall own three Boolean claims: emptiness is current, the box is empty, and the box is universe. An empty flag shall establish emptiness only when the current flag is set. A stale empty flag may coexist with a universe claim. Simultaneous current emptiness and universality shall violate the status invariant.

Default construction shall clear all three claims. Copy construction and assignment shall retain the source's claims in an independent owner; assignment shall admit self-assignment and return its target. Later mutation or destruction of either owner shall not change the other's claims. These operations shall not inspect coordinate intervals.

Calls shall use live owners and synchronized access against mutation. The owning box shall establish that its claims agree with its mathematical value. Direct flag updates may create temporary inconsistent claims; validity queries shall admit those states, but a box shall not use them as a valid status. No library/thread initialization or coefficient-constant stage shall be required for status operations alone.

A cached claim records established knowledge rather than recomputing the Cartesian product; ownership and stale-state meaning must remain explicit.

APPROVED
INTERVALS_BOXES
IF_CPP
Test, Analysis, Inspection

Check zero construction, all claim vectors, independent copies, self-assignment, source destruction and no-Init operation.

src/Box_defs.hh; src/Box_Status_idefs.hh; src/Box_Status_inlines.hh; src/Box_Status.cc; tests/boxstatusspec1.cc; tests/Box/loadstatus1.cc.

CPP
Internal

Internal nested type in Box_defs.hh / Box_Status_idefs.hh. Names belong to Parma_Polyhedra_Library; unqualified signatures apply to Box<ITV>::Status.

// Internal nested type: Box<ITV>::Status.
Status();
Status(const Status& other);
Status& operator=(const Status& other);
SW_SPEC
2
PPL-SPEC-000672
PPL-SPEC-000672
Independent cached-status bit updates and queries

The three test_* queries shall return their respective stored Boolean claims without mutation. Each set_* shall set exactly its named claim and each reset_* shall clear exactly its named claim, retaining every other claim. Updates shall not refresh emptiness, inspect coordinates or implicitly reconcile other claims.

For a mask composed of the three named flags, internal test_all(mask) shall report whether every selected flag is set; the zero mask shall return true. test_any(mask) shall report whether any selected flag is set; the zero mask shall return false. Internal set(mask) and reset(mask) shall set or clear exactly the selected flags. Prerequisites and temporary state handling shall follow 🔗 1. Box cached claims and independent status ownership.

Independent flag operations let box algorithms distinguish invalidated emptiness knowledge from an established mathematical answer.

APPROVED
INTERVALS_BOXES
IF_CPP
Test, Analysis, Inspection

Exhaust all eight flag vectors, each named update and all eight masks against independent Boolean models; include zero/all masks and preservation of unselected claims.

src/Box_defs.hh; src/Box_Status_idefs.hh; src/Box_Status_inlines.hh; src/Box_Status.cc; tests/boxstatusspec1.cc; tests/Box/loadstatus1.cc.

CPP
Internal

Internal nested type in Box_defs.hh / Box_Status_idefs.hh. Names belong to Parma_Polyhedra_Library; unqualified signatures apply to Box<ITV>::Status.

bool test_empty_up_to_date() const;
void reset_empty_up_to_date();
void set_empty_up_to_date();
bool test_empty() const;
void reset_empty();
void set_empty();
bool test_universe() const;
void reset_universe();
void set_universe();
// Private helpers; flags_t is unsigned int.
bool test_all(flags_t mask) const;
bool test_any(flags_t mask) const;
void set(flags_t mask);
void reset(flags_t mask);
SW_SPEC
3
PPL-SPEC-000673
PPL-SPEC-000673
Status consistency query and diagnostic

OK() shall return false exactly when current emptiness and universe are all asserted, and true for every other combination. It shall not refresh claims or change the status.

With assertion diagnostics enabled, the inconsistent case shall write The status asserts emptiness and universality at the same time. followed by a newline to std::cerr. Other cases shall emit no diagnostic; with diagnostics disabled, no case shall emit that diagnostic. Stream failures shall follow the stream's ordinary exception-mask rules. The checker shall admit the temporary states described in 🔗 1. Box cached claims and independent status ownership.

A stale empty bit is not a contradiction; only an established empty result conflicts with universality.

APPROVED
INTERVALS_BOXES
IF_CPP
Test, Analysis, Inspection

Exercise every conjunction, distinguish stale and current emptiness, capture the exact enabled diagnostic and prove unchanged claims in assertions/release modes.

src/Box_defs.hh; src/Box_Status_idefs.hh; src/Box_Status_inlines.hh; src/Box_Status.cc; tests/boxstatusspec1.cc; tests/Box/loadstatus1.cc.

CPP
Internal

Internal nested type in Box_defs.hh / Box_Status_idefs.hh. Names belong to Parma_Polyhedra_Library; unqualified signatures apply to Box<ITV>::Status.

bool OK() const;
SW_SPEC
4
PPL-SPEC-000674
PPL-SPEC-000674
Status ASCII export preserves cached claims

ascii_dump shall insert the three status fields in this order: EUP for current emptiness, EM for the empty flag and UN for universe. Each field shall consist of + when its claim is set or - when clear, followed by its keyword and one space. With default compatible formatting, the zero status shall therefore emit -EUP -EM -UN followed by one space. The inserted characters and strings shall follow ordinary stream formatting, including any pending width, fill and alignment settings.

The no-argument ascii_dump() shall write that representation to std::cerr. print() shall write No user level output operator defined for Box<ITV>::Status. followed by a newline to std::cerr. Export shall preserve the stored claims, including stale flags, and shall not inspect the box's coordinate payload or refresh its emptiness. Partial output and stream exceptions shall follow ordinary stream rules. Other prerequisites shall follow 🔗 1. Box cached claims and independent status ownership.

Reloadable box state must retain whether emptiness is known, independently of what the stale empty bit happens to contain.

APPROVED
INTERVALS_BOXES
IF_CPP
Test, Analysis, Inspection

Check exact signs, field order and final space for every valid status, ordinary width/fill formatting, source preservation, standard-error output routes and returning/throwing output failures.

src/Box_defs.hh; src/Box_Status_idefs.hh; src/Box_Status_inlines.hh; src/Box_Status.cc; src/globals_defs.hh; tests/boxstatusspec1.cc; tests/Box/loadstatus1.cc.

CPP
Internal

Internal nested type in Box_defs.hh / Box_Status_idefs.hh. Names belong to Parma_Polyhedra_Library; unqualified signatures apply to Box<ITV>::Status.

void ascii_dump(std::ostream& stream) const;
void ascii_dump() const;
void print() const;
SW_SPEC
5
PPL-SPEC-000675
Status ASCII loading and partial rejection state

ascii_load shall extract three fields in the order and spelling of 🔗 4. Status ASCII export preserves cached claims. Each token shall begin with + or - and contain exactly the corresponding keyword. Extraction shall follow ordinary string rules, including stream width and whitespace settings. A complete consistent triple shall replace all three claims and return true, independently of the destination's previous claims; trailing tokens shall remain available for subsequent extraction.

A missing, malformed or out-of-order token shall return false. Each successfully parsed preceding field shall already have replaced its claim; the rejected field and following claims shall retain their preceding values. A completed triple asserting current emptiness and universality shall be rejected with false. Rollback and status consistency after a failed load shall not be promised; callers shall restore a consistent status before using it as box state. Stream exceptions shall propagate under ordinary exception-mask rules, with preceding field updates retained.

The internal get_field helper shall assign its output Boolean only when it successfully matches the requested signed keyword. It shall preserve that Boolean on rejection. Other prerequisites shall follow 🔗 1. Box cached claims and independent status ownership.

Replacement loading must clear prior claims when a negative field is read; malformed prefixes need an explicit failure state and must not establish a valid contradictory certificate.

APPROVED
INTERVALS_BOXES
IF_CPP
Test, Analysis, Inspection

Round-trip every consistent triple through every prior consistent state, preserve trailing framing and check every truncated/malformed prefix. Exercise field signs, keyword mismatches, width/whitespace settings and input exceptions; assess rejection of a completed contradictory triple.

src/Box_defs.hh; src/Box_Status_idefs.hh; src/Box_Status_inlines.hh; src/Box_Status.cc; tests/boxstatusspec1.cc; tests/Box/loadstatus1.cc.

CPP
Internal

Internal nested type in Box_defs.hh / Box_Status_idefs.hh. Names belong to Parma_Polyhedra_Library; unqualified signatures apply to Box<ITV>::Status.

bool ascii_load(std::istream& stream);
namespace Implementation::Boxes {
  bool get_field(std::istream& stream, const char* keyword, bool& positive);
}