{
  "map_id": "tel.composition_map",
  "version": "5.0-draft",
  "book": "book5_tel",
  "series": "AI Edition",
  "invariant": "INV-TEL-003",
  "operator_binding": "TEL-Κ (Compose)",
  "description": "Defines the composition model for TEL. Composition is the mechanism by which atomic and compound TEL expressions are assembled into larger structural encodings. INV-TEL-003 (Compositionality) requires that the meaning of any compound expression be fully determined by the meanings of its sub-expressions and the applicable composition rule.",
  "compositionality_principle": {
    "formal": "∀e = compose(e_1, ..., e_n, R): eval(e) = R(eval(e_1), ..., eval(e_n))",
    "implication": "All meaning is local and explicit. There are no holistic or contextual meaning contributions that cannot be traced to a specific sub-expression and composition rule.",
    "violation_pattern": "Any reading of a compound expression that requires information not encoded in its sub-expressions or the applied composition rule violates INV-TEL-003."
  },
  "composition_types": [
    {
      "id": "CT-001",
      "label": "Binary Structural Composition",
      "operator": "⊕ | ⊗ | → | ⊢ | ⊥",
      "arity": 2,
      "description": "Combines exactly two TEL expressions under a binary compose_op. Produces a compound expression whose meaning is determined by the binary rule defined in SEM-004 through SEM-008.",
      "nesting": "Binary compositions may be nested arbitrarily. Each nesting level is parenthetically delimited.",
      "example": "((STRUCT_A → STRUCT_B) ⊕ (STRUCT_C → STRUCT_D))"
    },
    {
      "id": "CT-002",
      "label": "Transformation Composition",
      "operator": "T[ID]",
      "arity": "2 (one input expression, one output expression)",
      "description": "Declares a named transformation as a composition of an input structural expression and an output structural expression. The transformation is a first-class TEL entity stored in scope under ID.",
      "composition_rule": "The transformation composes by substitution: when #ID is referenced in a subsequent expression, its declaration is inlined and evaluated.",
      "invariant_check": "INV-TEL-004 is checked at application time: valid input must yield valid output."
    },
    {
      "id": "CT-003",
      "label": "Constraint-Scoped Composition",
      "operator": "C[ID] + ⊢",
      "arity": "1 declaration + 1 assertion site",
      "description": "Constraint declarations (C[ID]) are assembled and applied at ⊢ assertion sites within compound expressions. The constraint body is a TEL expression that acts as a structural predicate.",
      "composition_rule": "At each ⊢ site, the constraint body is composed with the left-hand structure: the left-hand structure is checked against the constraint predicate under INV-TEL-003."
    },
    {
      "id": "CT-004",
      "label": "Invariant Assertion Composition",
      "operator": "INV[ID]",
      "arity": "1 (the asserted expression)",
      "description": "An invariant assertion is a top-level composition that binds a structural assertion to a declared invariant identifier. The asserted expression must be a well-formed TEL expression.",
      "composition_rule": "The composition is: invariant ID is applied as a structural predicate to the denotation of the asserted expression.",
      "scope": "INV[…] expressions do not introduce new symbols into scope. They are evaluation events, not declarations."
    }
  ],
  "composition_ordering_rules": [
    {
      "id": "COR-001",
      "rule": "Declarations before references. T[ID] and C[ID] declarations must appear before any expression referencing #ID in the same evaluation session.",
      "violation": "Forward reference to an undeclared symbol ID constitutes a ScopeFault (EF-002)."
    },
    {
      "id": "COR-002",
      "rule": "Innermost parentheses evaluate first. Composition is inside-out. No operator has implicit precedence beyond parenthetical grouping.",
      "violation": "Relying on implicit operator precedence to determine evaluation order is a grammar violation (WF-001 in tel.syntax_map)."
    },
    {
      "id": "COR-003",
      "rule": "INV[…] assertions evaluate after all sub-expressions in the session that they depend on have been evaluated.",
      "note": "In practice: place INV[…] assertions at the end of a TEL expression block, after all structural compositions and transformation declarations."
    },
    {
      "id": "COR-004",
      "rule": "Transformations compose on the output of prior expressions. T[ID] maps a structural type to a structural type. Chaining is permitted: T[ID2]: #T1_OUTPUT → … where T1_OUTPUT is the output of a prior T[ID1] declaration.",
      "example": "T[CHAIN_STEP_2]: (#T1_OUTPUT ⊕ STRUCT_C) → (STRUCT_D)"
    }
  ],
  "cross_book_composition": {
    "description": "TEL expressions may compose structural entities from multiple AI Edition books. Cross-book composition requires that all referenced books are in the active module registry.",
    "book1_fft": "Core primitives (structure, node, relation, constraint, invariant) — always available as base vocabulary",
    "book4_opacity_revelation": "OR operators (OR-Ω, OR-Δ, OR-Ρ, OR-Λ, OR-Π) and opacity/revelation parameters (ω, δ) are valid TEL identifiers when Book 4 is loaded",
    "book3_structural_detection": "SD operators (SD-Σd and others) are valid TEL identifiers when Book 3 is loaded",
    "composition_constraint": "Cross-book compositions are structurally valid only if the inter-book dependency declared in the module registry is satisfied. Composing Book 6 entities before Book 5 is loaded violates the dependency graph."
  },
  "anti_patterns": [
    {
      "id": "AP-001",
      "label": "Implicit Context Composition",
      "description": "Assigning meaning to a TEL expression based on shared implicit context not encoded in the expression. Violates INV-TEL-003.",
      "example": "Reading (A ⊕ B) as 'A plus B in the governance context' without a C[…] or module registry entry encoding the governance scope."
    },
    {
      "id": "AP-002",
      "label": "Unbounded Scope Creep",
      "description": "Allowing T[ID] or C[ID] declarations from one session to bleed into a new session without re-declaration. Each evaluation session opens with an empty scope.",
      "correction": "Re-declare all required T[…] and C[…] entities at the start of each evaluation session."
    },
    {
      "id": "AP-003",
      "label": "Non-Parenthetical Precedence",
      "description": "Writing A ⊕ B ⊗ C and expecting a specific parse order. TEL has no implicit precedence. This expression is ill-formed.",
      "correction": "Write (A ⊕ (B ⊗ C)) or ((A ⊕ B) ⊗ C) according to the intended composition order."
    }
  ]
}
