# Layer ownership.

> Protocol knowledge and extension points remain in the layer that owns their semantics.

- Canonical page: https://www.poulpy.dev/docs/layer-ownership/
- Poulpy version: 0.9.0
- Source revision: [`7dd13e6aa9808982f5355fb6acb70ca434de4e35`](https://github.com/poulpy-fhe/poulpy/tree/7dd13e6aa9808982f5355fb6acb70ca434de4e35)
- Documentation reviewed: 2026-10-08
- Audience: For backend and scheme implementors

For a visual introduction, see [Layered architecture and verification](https://www.poulpy.dev/architecture/).

To keep the stack well separated, lower layers MUST NOT adapt their APIs to invariants owned by a higher layer: HAL owns generic polynomial primitives, Core owns generic GLWE/GGLWE operations, and CKKS owns CKKS protocol knowledge.

As example, the known-zero-limb optimization for the second ModUp key switch belongs in CKKS's reference `ckks_encapsulated_mod_up` and not in the Core layer; a backend can decide to replace that whole operation through its CKKS OEP.
Future cross-layer optimizations should compose lower-layer primitives or add an extension point in the layer that owns the semantics.
