9df295b915
Extraction.ts (3 fixes):
- Replace 2 'inStackingContext' string checks with isVariableArityPredicate()
- Replace 7-name diagnostic formatting if/else with spec-driven
getPredicateSpec() checks (isDirectional → gap message,
isSize → threshold hint, else generic)
Grammar.ts: Replace 8 hardcoded parser routing checks
(atLeast/atMost/aspectRatio/between/clippedBy/attachedToScrollContainer/
escapeClippingChainOf/inStackingContext) with SIZE_PREDICATE_NAMES and
TOPOLOGY_PREDICATE_NAMES Sets derived from spec table.
Pipeline.ts: Replace 15-entry CODE_TO_CLAUSE_KIND map with runtime
generation from PREDICATE_SPECS. Prefix derived from spec.isSize
('size.*') / validOptions.includes('axis') ('alignment.*') /
else ('relation.*'). Manual override for aspectRatio code 15.
Proofs.ts: Replace 11-case switch(kind) with 5 spec-driven if/else
branches categorized by validOptions presence (hasGap→directional,
hasAxis→alignment) + 2 specific name checks (inside overflow,
aspectRatio ratio). 11 predicate names → 0 hardcoded.
Lexer.ts: Export KEYWORDS map for conformance testing.
Conformance tests:
- Solver: every BUILTIN_PREDICATES entry matches its PREDICATE_SPECS
counterpart; every spec name (incl. aliases) has a registered
evaluator with matching descriptor (2 tests)
- DSL: every predicate name from collectAllPredicateNames() appears
in the lexer KEYWORDS table (1 test)
598 SDK + 3 conformance + 57 E2E = 658 tests pass.
imhotep-dsl
Domain-specific language for Imhotep assertions. Provides a fluent assertion API, a dense string-based DSL parser, FOL compilation/validation, canonical lowering, and property-run builders.
Key Exports
| Export | Description |
|---|---|
expect(subject) |
Fluent assertion builder |
spec(src) |
Dense DSL parser (parseSpec alias) |
compile(source) |
Compile DSL to assertion nodes |
compileDenseFOLToFormula(src) |
Compile dense FOL to solver-ready AST |
validateAssertion(node) |
Pre-flight validation without extraction |
lowerToCanonical(nodes) |
Canonical lowering for IR equivalence |
component, enumerate |
Property-run fluent builders |
forAll, exists, predicate, domain |
FOL fluent builders |