#sleela 2.1 // 3/constraints.sleela -- the Constitution's congrains/limits applied to Facets. // // This is the shared constraint/theory layer carried by every churn relevance // set (/1 Longs, /2 Structures, /3 Facets, /4 Areas). It encodes the governing // constraints from the repository's Constitution (see ../../README.md, "The // Constitution", and SHEET.sheet's `congrains` / `limits` / `system` sections) // and applies them to this set's magnitude -- here, a Facet's value. // // Two system invariants are always in force (conducted methods sysdepth()/ // degreemax() in the implementation): // DepthLimit : system depth <= 3024 // ComplexityDegree : connection order <= 4 // // A `Limit` (Bound / Threshold / Capacity) checks whether a Facet's value honors // its bound. Failing a Limit records that a value falls outside a stated // constraint; it changes no data. A constraint is a modelling condition to be // checked and argued with, not a claim about reality. import math; class Constraints { int depthLimit() { return 3024; } int degreeMax() { return 4; } boolean connectPermitted(int n, int degree) { if (n < 0) { return false; } if (n > depthLimit()) { return false; } if (degree > degreeMax()) { return false; } return true; } boolean withinBound(double value, double lo, double hi) { if (value < lo) { return false; } if (value > hi) { return false; } return true; } boolean belowThreshold(double value, double threshold) { return value < threshold; } boolean withinCapacity(double used, double capacity) { if (capacity < 0.0) { return false; } return used <= capacity; } // Report whether a Facet's value honors a stated Bound [lo, hi]. void checkFacet(String name, double value, double lo, double hi) { String verdict = "HOLDS"; if (!withinBound(value, lo, hi)) { verdict = "VIOLATES"; } print(" Bound[" + lo + ", " + hi + "] on " + name + " (value=" + value + "): " + verdict); } void main() { print("=== /3 constraints -- the Constitution applied to Facets ==="); print("System invariants: DepthLimit=" + depthLimit() + ", ComplexityDegree<=" + degreeMax() + "."); print(""); // A rate facet (percent) is Bounded to [0, 100]; a dimensionless // coupling like alpha is Bounded to [0, 1]. print("[limits] labor-market rate Facets must hold within [0, 100] percent"); checkFacet("quits rate (US 2024)", 2.0, 0.0, 100.0); checkFacet("job openings rate (US 2024)", 4.2, 0.0, 100.0); print(""); print("[limits] the fine-structure constant (a coupling) within [0, 1]"); checkFacet("fine-structure constant alpha", 7.2973525643 * math.pow(10.0, -3.0), 0.0, 1.0); print(""); print("[invariant] the connect rule (n<=3024, degree<=4)"); print(" connect(3024, 4) permitted : " + connectPermitted(3024, 4)); print(" connect(3025, 4) permitted : " + connectPermitted(3025, 4)); print(" connect(100, 5) permitted : " + connectPermitted(100, 5)); print(""); print("Note: a constraint is a modelling condition to be checked and"); print("argued with, not a claim about reality."); } }