Skip to main content

se-interpretive-kernel

PyPI Docs Site Repo Python License

CI Docs-Deploy Pre-Release Release Links Dependabot

An executable contract for the Structural Explainability (SE) interpretive kernel: when a declared identity regime over frames induces well-defined judgments about the objects an interpretation produces, and what it costs when it does not.

Install

pip install se-interpretive-kernel

Python 3.12 or newer. No runtime dependencies. The package is typed.

Quick start

Two probes read two frames. The declared regime says frames a and b are the same, and outputs are compared by equality.

from se_interpretive_kernel.artifact import Artifact
from se_interpretive_kernel.explain import explain, format_steps
from se_interpretive_kernel.generated import generated
from se_interpretive_kernel.kernel import coherent
from se_interpretive_kernel.partition import Partition
from se_interpretive_kernel.witness import find_witness

artifact = Artifact(
    frames=("a", "b"),
    outputs=("x", "y", "z"),
    probes=("p", "q"),
    table={("p", "a"): "x", ("p", "b"): "y", ("q", "a"): "y", ("q", "b"): "z"},
)
same = Partition.from_blocks(artifact.frames, [("a", "b")])
equal = Partition.discrete(artifact.outputs)

print(coherent(artifact, artifact.probes, same, equal))
# False

print(find_witness(artifact, artifact.probes, same, equal))
# Witness(frame_1='a', frame_2='b', probe='p', output_1='x', output_2='y')

print(generated(artifact, artifact.probes, same).blocks())
# (('x', 'y', 'z'),)

print(format_steps(explain(artifact, artifact.probes, same, "x", "z")))
# 1. probe 'p' reads frame 'a' as 'x' and frame 'b' as 'y'; the frame regime relates those two frames
# 2. probe 'q' reads frame 'a' as 'y' and frame 'b' as 'z'; the frame regime relates those two frames

The regime is coherent only if x, y, and z are called the same, and the derivation shows why.

Purpose

An interpretation I maps a probe and a frame to structured output. Fix a finite probe domain P and an equivalence rho on outputs. The interpretive kernel relates two frames when no probe can tell them apart:

F ~ker F'   iff   for every p in P, I(p, F) is rho-indistinguishable from I(p, F')

A declared identity regime over frames induces well-defined object-level judgments exactly when it refines the kernel, and every failure comes with a finite witness: the probe and the pair of frames on which the regime identifies what interpretation separates.

The stronger result is the threshold. For a declared regime phi, the least output equivalence under which phi is coherent is generated directly by the pairs phi forces together:

L(phi) = equivalence closure of { (I(p, F), I(p, F')) : p in P, F phi F' }

L is left adjoint to the kernel, so no search over the lattice is required. The result is a computed commitment rather than a pass or fail verdict: not "this regime is inadmissible" but "this regime is coherent only if you are willing to call these outputs the same".

The construction is domain-agnostic. Interpretation is supplied by the consuming domain and not imported.

The package reports commitments and differences. It reports whether a declared identity regime is consistent with a declared interpretation, what the regime obliges the outputs to be, and where two regimes disagree. It does not certify ground truth: when two regimes disagree, it shows where and why, and does not say which is correct.

Comparison Liftings Have Laws

Comparing structured outputs requires carrying an output equivalence up to the structures:

C : Eq(O) -> Eq(X)

The kernel construction needs C to preserve arbitrary meets. Complete meet homomorphisms of this shape are exactly the Eq(O)-valued generalized ultrametrics on X, so every one of them is given by a cost delta(x, y): the least output identification that would make two objects the same. The cost must satisfy three laws, and check_lifting_laws is the finite test that decides whether a supplied comparison has them.

Two comparisons in this package are present because they fail, and both failures are regressions that must keep failing.

  • Indexed pointwise: monotone, meet-preserving, and a lifting.
  • Quotient-image equality: monotone, but not meet-preserving, so not a lifting.
  • Optimal matching over bijections: not a lifting, because the triangle law fails.

Quotient-image equality on unordered outputs is the natural way to compare occurrence sets and does not preserve meets, so no cost represents it. Optimal matching is the natural repair and violates the triangle law, because moving the meet over alternative bijections through the join needs a distributivity the partition lattice does not have.

The surviving repair is a declared canonicalization, which fixes the index before the output regime is known. It restores every law, and it costs something: the identification it demands is no finer than the best matching would have required. That price is measured in the test suite rather than asserted.

A canonicalization is therefore a declared artifact, not an implementation detail. One that is not injective identifies distinct objects at zero cost, which declares an identity without ever appearing as a declared identity regime.

Run

uv sync

uv run pytest

Developer

Clone and copy

Open a machine terminal where you want the project:

git clone https://github.com/structural-explainability/se-interpretive-kernel

cd se-interpretive-kernel
code .

Open in VS Code and Run

In a VS Code terminal

.\sit

uv run se-interpretive-kernel --random 2000 --seed 0
# save progress
git add -A
git commit -m "update"
git push -u origin main

Planned

The boundary of the current slice is explicit.

  • outcome.py: the tagged output domain carrying end, undefined, and error, which makes length mismatch a declared comparison result rather than an exception.
  • signature.py: declared roles for each variable. A variable in the probe domain is a test condition, in the frame domain it is a thing whose sameness is at issue, and in the output domain it is observable. The same variable in three positions asks three different questions, so position is a declaration and must be validated.

Citation

CITATION.cff

Software Metadata

CodeMeta (codemeta.json)

License

MIT

Repository Manifest

SE_MANIFEST.toml

Metadata

Release files for se-interpretive-kernel 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for se-interpretive-kernel 0.1.0
File Size Uploaded Provenance Actions
se_interpretive_kernel-0.1.0.tar.gz 35.9 kB With provenance Details for se_interpretive_kernel-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for se-interpretive-kernel 0.1.0
File Interpreter ABI Platform Actions
se_interpretive_kernel-0.1.0-py3-none-any.whl Python 3 none any Details for se_interpretive_kernel-0.1.0-py3-none-any.whl

Total release size: 72.1 kB

Release files / se_interpretive_kernel-0.1.0.tar.gz

Download URL se_interpretive_kernel-0.1.0.tar.gz
Size 35.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1a019b530c3c391a336632eceb687953123535735cff6c3e31e8dd25f536d9b0
BLAKE2b-256 checksum
How to use checksums
38899f8197e80fe1ac0f48bcc433908603dcb9a2a5ff6b0145e75369d53c2a76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

Release files / se_interpretive_kernel-0.1.0-py3-none-any.whl

Download URL se_interpretive_kernel-0.1.0-py3-none-any.whl
Size 36.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ec824a7f5a8547b93d5822afb78616f731ccecf16a6701105577206b2eb6422b
BLAKE2b-256 checksum
How to use checksums
ab113e5f389749656897e4e6e84f49cf1bc6054f349bd40bc13d940d3c3225c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

Security for se-interpretive-kernel 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for se_interpretive_kernel-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page