Skip to main content

Quantum-information substrate for the Omytea world-model system: WaveFunction · DensityMatrix · JointWaveFunction · LindbladOperator. Pure-Python stdlib.

Project description

Omytea Quantum Substrate

PyPI Python License CI

Quantum-information substrate for the Omytea world-model system. Stdlib + NumPy only — no SciPy, no Torch, no JAX, no GPU. Apache 2.0.

pip install omytea-quantum-substrate
from omytea import (
    StateHypothesis, WaveFunction, JointWaveFunction,
    OffDiagonalEntry, DensityMatrix, Position,
)
from omytea.dynamics import LindbladOperator, OperatorContext

What this is

The math core of an open-system probabilistic world model:

  • WaveFunction — per-entity sparse branch grid (diagonal of ρ_i)
  • JointWaveFunction — entity-tuple sparse branch grid (diagonal of ρ_{AB})
  • OffDiagonalEntry — sparse off-diagonal of ρ_{AB} (classical correlation between joint hypotheses)
  • DensityMatrix — open-system primary representation
  • LindbladOperator — Gorini-Kossakowski-Sudarshan-Lindblad master-equation operator for monotonic decoherence of off-diagonal coherence

Honest framing: this is quantum-information formalism applied to classical inference. We use ρ and Lindblad as a unified bookkeeping for joint distributions + their correlations + dissipation — not because the underlying system is literally quantum. The off-diagonal magnitudes carry classical-correlation information, not amplitudes of a true quantum state.

What this is for

Building world models that:

  1. Express uncertainty over multiple entities jointly (not just per-entity priors)
  2. Model how correlations between predicted entity futures decohere as horizon extends
  3. Stay calibratable via measurement updates (Brier / log-loss / reliability diagrams)
  4. Run on consumer hardware — no GPU, no NumPy, no compiled extensions

The substrate is deliberately small (~2,400 lines, 6 modules) and depends only on Python's standard library + NumPy. Plug it under your perception layer and your decision UI.

Quick example

from datetime import datetime, timezone
from omytea import (
    StateHypothesis, WaveFunction, JointWaveFunction,
    JointBranchHypothesis, OffDiagonalEntry, Position,
)
from omytea.dynamics import LindbladOperator, OperatorContext

now = datetime.now(tz=timezone.utc)

# 1. Build per-entity WaveFunctions (each has 3 future-position hypotheses)
def make_wf(entity_id: str, label: str) -> WaveFunction:
    hyps = tuple(
        StateHypothesis(
            object_id=entity_id, label=name, stream_id="demo",
            timestamp=now, position=Position(x=cx, y=0.5, space="image_norm"),
            weight=w, branch_label=name,
        )
        for name, cx, w in [
            ("continue",    0.6, 0.55),
            ("accelerate",  0.9, 0.25),
            ("decelerate",  0.3, 0.20),
        ]
    )
    return WaveFunction(
        object_id=entity_id, label=label, stream_id="demo",
        timestamp=now, hypotheses=hyps, action_arm=None,
    )

wf_a = make_wf("A", "left_to_right")
wf_b = make_wf("B", "right_to_left")

# 2. Build JointWaveFunction (Cartesian product, 3×3 = 9 joint hypotheses)
joint_hyps = []
for h_a in wf_a.hypotheses:
    for h_b in wf_b.hypotheses:
        joint_hyps.append(JointBranchHypothesis(
            branch_refs={"A": h_a.hypothesis_id, "B": h_b.hypothesis_id},
            weight=h_a.weight * h_b.weight,
        ))

# 3. Add a correlation: matching-continue pairs have +0.1 off-diagonal coherence
offdiags = []
for i, hi in enumerate(joint_hyps):
    for j, hj in enumerate(joint_hyps):
        if i >= j: continue
        # ... pair (continue, continue) vs (continue, continue) — same hypothesis pairs (skip)
        # ... or actual pair logic per your model
        pass

jwf = JointWaveFunction(
    entity_ids=("A", "B"),
    hypotheses=tuple(joint_hyps),
    off_diagonal_couplings=tuple(offdiags),
)

# 4. Evolve under Lindblad at decoherence rate γ = 0.08 for 6 ticks
lindblad = LindbladOperator(decoherence_rate=0.08)
ctx = OperatorContext(scenario_name="demo", tick=0)
current = jwf
for tick in range(6):
    current = lindblad.evolve(current, dt=1.0, ctx=ctx)

# Off-diagonal magnitudes have decayed monotonically.

See examples/basic_usage.py for a runnable version.

What this is not

  • Not a quantum-computing library. No quantum gates, no qubits, no Pauli ops. The names borrow from quantum-information formalism; the implementation is classical.
  • Not a perception or vision library. Substrate consumes detection bounding boxes; it doesn't produce them.
  • Not a vision-language interface. That's downstream — see the Personal Future Console for an end-to-end product built on this substrate.
  • Not a deep-learning library. No PyTorch / JAX / TensorFlow dep. Substrate runs in CPython 3.11+ with zero compiled extensions.

Companion product

The first end-to-end application built on this substrate:

🚀 Omytea Personal Future Console
Live demo: https://omytea-personal-console.streamlit.app

A Streamlit app that takes natural-language decision queries or short videos, runs the substrate's perception + joint-wavefunction + Lindblad evolution, and produces calibrated probability distributions over short-horizon scene futures.

Cite this work

If you use the substrate in research, please cite it via the CITATION.cff file at the repo root, or:

@software{omytea_quantum_substrate_2026,
  author = {Chen, Jiaxuan},
  title  = {Omytea Quantum Substrate: Open-System World-Model Math Core},
  year   = {2026},
  url    = {https://github.com/Adonyth/omytea-quantum-substrate},
  version = {0.1.0},
}

The companion paper Omytea Video World Console — Quantum-Operator Evolution over Streaming Belief States (draft v0.1) lives in the Personal Future Console repo at docs/papers/OMYTEA_VIDEO_CONSOLE_DRAFT.md.

License

Apache License 2.0. See LICENSE.

Contributing

Issues and pull requests welcome. The substrate is deliberately minimal — additions should preserve the pure-stdlib constraint and the typed-dataclass convention. See the consoles' CONTRIBUTING.md for the broader Omytea project's contribution guidance (same fits/doesn't-fit rules apply).

Versioning

Semantic versioning. v0.x releases may introduce breaking changes between minor versions until the API surface stabilizes. From v1.0, breaking changes will be reserved for major versions.

See CHANGELOG.md for release notes.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

omytea_quantum_substrate-0.1.1.tar.gz (43.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

omytea_quantum_substrate-0.1.1-py3-none-any.whl (44.3 kB view details)

Uploaded Python 3

File details

Details for the file omytea_quantum_substrate-0.1.1.tar.gz.

File metadata

  • Download URL: omytea_quantum_substrate-0.1.1.tar.gz
  • Upload date:
  • Size: 43.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for omytea_quantum_substrate-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c8624f0a742ace9fb8724b96085af847bd36bdede04608f7b4e4a93ac19f3d78
MD5 4fb308dcef0a1cf5d096411b1922a272
BLAKE2b-256 a8c627fedf0736863cc6c8cc3a6a3c67c927d168531de552b9dc325442b265e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for omytea_quantum_substrate-0.1.1.tar.gz:

Publisher: ci.yml on Adonyth/omytea-quantum-substrate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file omytea_quantum_substrate-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for omytea_quantum_substrate-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f3dd1d394306b945423946a58485bb0d55f4298c60e280b81a73ca067d3bda71
MD5 3e01c81af5e90693b863872e9d003d48
BLAKE2b-256 927a919a2f57f5c5ab780d6809e016ed87f82ebacaeda357c807b166391c605e

See more details on using hashes here.

Provenance

The following attestation bundles were made for omytea_quantum_substrate-0.1.1-py3-none-any.whl:

Publisher: ci.yml on Adonyth/omytea-quantum-substrate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page