core/generate/composition/__init__.py
Shay 0711988b67 feat(composition): M1 — extract the logic is-a chain into a plan->lower->verify spine (byte-parity)
First phase of the domain-general compositional reading layer (the comprehension
coverage wall is composition — docs/analysis/comprehension-coverage-wall-map-2026-06-14.md).
M1 is a pure PARITY refactor on the flagship logic path, no new capability:

- new generate/composition/ package: LogicChainPlan (plan.py) + lower_logic_chain
  (lower_logic.py), the is-a chain lowering extracted BYTE-IDENTICALLY from
  determine.py::_verify_subsumption.
- _verify_subsumption now builds a plan -> lowers it -> routes through the UNCHANGED
  evaluate_entailment gate. The composer proposes structure; the sound ROBDD gate
  remains the sole wrong=0 firewall.
- only the logic instantiation ships; no math lowering, no join-op vocabulary
  (defer-substrate-vocab-commitment — the chain discriminates on its relational
  predicate, an explicit join-op field lands when a second op dispatches on it).

Verification: byte-identical lowering (3-reviewer adversarial panel: byte-parity PASS
char-for-char, wrong=0 PASS — the instance-of-fallacy refusal mutation-proven
load-bearing); 5 new non-vacuous lowering tests; 28 determine/transitive/consolidation
+ 163-test broad sweep (incl. gsm8k serving + ADR-0218) green; cognition eval 100%.
2026-06-14 15:42:24 -07:00

27 lines
1.5 KiB
Python

"""Compositional reading spine (plan -> lower -> verify).
The comprehension organ recognizes individual structures but cannot COMPOSE them
across a unit/structure/referent boundary — the proven coverage wall
(``docs/analysis/comprehension-coverage-wall-map-2026-06-14.md``). This package is the
fix: a deterministic stage that builds a typed composition *plan* from clause-local
sub-structures, LOWERS it into a domain's existing proof object, and routes that object
UNCHANGED through the domain's existing sound gate. The composition layer has zero
authority to commit an answer — the unchanged, from-scratch re-deriving gate is the
sole wrong=0 firewall.
The spine is intended to be domain-general (one ``lower(plan) -> proof_object`` per
domain, each over the same plan core), but **M1 ships the LOGIC instantiation only**:
it generalizes the is-a chain previously inlined in
``generate/determine/determine.py::_verify_subsumption`` into a reusable
``LogicChainPlan`` + ``lower_logic_chain``, byte-identical to the original (a parity
refactor — no new capability). The math instantiation (``lower_math_plan`` over a
``GroundedDerivation``) and additional join-ops land in later phases, one op per PR,
each behind a grounded case + a mutation test that the gate refuses a mis-licensed
edge. Discipline: CLAUDE.md (Schema-Defined Proof Obligations,
defer-substrate-vocab-commitment).
"""
from generate.composition.lower_logic import lower_logic_chain
from generate.composition.plan import LogicChainPlan
__all__ = ["LogicChainPlan", "lower_logic_chain"]