Causal-Indefiniteness Metric#

This module implements a computational metric for quantifying causal indefiniteness based on the trace distance to classically ordered (causally separable) reference processes, as introduced in the paper Pre-Temporal Model of Quantum Causal Order

The implementation is intentionally minimal and framework-agnostic. All objects are represented as square complex matrices, allowing the metric to be applied not only to process matrices in the strict process-matrix formalism, but also to abstract operators or effective representations used in numerical simulations, diagnostics, or learning frameworks.

Conceptual definition#

Causal indefiniteness is quantified by measuring how far a given operator W lies from the convex set of processes that admit a definite causal order. This distance defines a continuous scale:

  • λ(W) = 0 indicates a causally separable (classically ordered) process.

  • λ(W) > 0 indicates the presence of genuinely indefinite causal structure.

  • Intermediate values correspond to partial or weakening causal indefiniteness.

The metric is designed to behave continuously and monotonically under physical decoherence and coarse-graining operations.

Computable form implemented here#

Rather than minimizing over the full convex set of causally separable processes, this module implements the computable instantiation used in the paper for the bipartite, two-order scenario.

Two definite-order reference matrices are assumed:

  • W_AB representing the order \(A \prec B\)

  • W_BA representing the order \(B \prec A\)

From these, a one-parameter family of classically ordered reference processes is constructed:

\[V(q) = \frac{1}{2} \left[ q \, W_{AB} + (1 - q) \, W_{BA} \right], \qquad q \in [0, 1]\]

The causal-indefiniteness measure is then computed as the minimum trace distance between W and this reference family:

\[\lambda(W) = \min_{q} \, D\!\left(W, V(q)\right)\]

where the trace distance is defined as

\[D(A, B) = \frac{1}{2} \left\| A - B \right\|_{1}\]

This formulation captures the transition between indefinite and definite causal structure in a numerically stable and interpretable way.

Numerical and structural assumptions#

  • All input matrices are assumed to be square and of equal shape.

  • Inputs are expected to be Hermitian or approximately Hermitian. Optional symmetrization is provided to suppress numerical artifacts.

  • No specific tensor-product structure is assumed. Any required embedding (e.g., control systems or ancillary spaces) must be handled by the caller.

  • The minimization over q is performed using a deterministic grid search, favoring robustness and reproducibility over asymptotic optimality.

Intended use#

This metric is designed as a computational primitive rather than a full causal-separability solver. Typical use cases include:

  • Monitoring the decay of causal indefiniteness under noise or decoherence

  • Characterizing intermediate (pre-temporal) causal regimes

  • Providing a scalar diagnostic for simulations, optimization loops, or hybrid quantum-classical workflows

  • Serving as a plug-in metric within larger numerical or learning frameworks

Public interface#

  • trace_distance: Trace distance between two (approximately) Hermitian matrices

  • reference_process: Construction of the convex reference process \(V(q)\)

  • lambda_w_trace: Computation of the causal-indefiniteness measure \(\lambda(W)\)

qmlhc.metrics.causal_indefiniteness.lambda_w_trace(W, W_AB, W_BA, *, q_grid=81, symmetrize=True, half_factor=True)[source]#

Compute the causal-indefiniteness measure \(\lambda(W)\) via trace distance.

This matches the manuscript’s computable instantiation:

  • \(\lambda(W) = \min_{q \in [0,1]} D\!\left(W, V(q)\right)\).

  • \(V(q) = \frac{1}{2}\left[q\,W_{AB} + (1-q)\,W_{BA}\right]\) (when half_factor=True).

  • \(D(A,B) = \frac{1}{2}\left\|A - B\right\|_{1}\).

The minimization is performed by a deterministic grid search over \(q \in [0, 1]\). For most practical uses (monitoring, diagnostics, regularization), this provides robust and deterministic behavior.

Parameters:
  • W (ndarray) – Target process/operator matrix.

  • W_AB (ndarray) – Definite-order reference branch (\(A \prec B\)), embedded in W’s matrix space.

  • W_BA (ndarray) – Definite-order reference branch (\(B \prec A\)), embedded in W’s matrix space.

  • q_grid (int) – Number of grid points for \(q \in [0,1]\). Typical resolutions are in the 50–80 range; the default 81 provides a convenient inclusive grid.

  • symmetrize (bool) – If True, symmetrize \((W - V(q))\) before eigendecomposition.

  • half_factor (bool) – If True, use the manuscript convention \(V(q) = \frac{1}{2}\left[q\,W_{AB} + (1-q)\,W_{BA}\right]\).

Returns:

The minimized trace distance \(\lambda(W)\).

Return type:

float

qmlhc.metrics.causal_indefiniteness.reference_process(q, W_AB, W_BA, *, half_factor=True)[source]#

Build the paper’s convex reference process V(q).

V(q) = 1/2 [ q * W_AB + (1-q) * W_BA ].

Parameters:
  • q (float) – Mixing parameter in [0,1].

  • W_AB (ndarray) – Definite-order reference branch for A≺B, embedded in the same space as W.

  • W_BA (ndarray) – Definite-order reference branch for B≺A, embedded in the same space as W.

  • half_factor (bool) – Whether to include the explicit 1/2 factor used in the manuscript.

Returns:

Reference matrix V(q).

Return type:

np.ndarray

qmlhc.metrics.causal_indefiniteness.trace_distance(A, B, *, symmetrize=True)[source]#

Trace distance D(A,B) = 1/2 ||A - B||_1.

This function is intended for Hermitian (or nearly Hermitian) inputs, which is the standard case for process/Choi operators.

Parameters:
  • A (ndarray) – Square matrices with the same shape.

  • B (ndarray) – Square matrices with the same shape.

  • symmetrize (bool) – If True, symmetrize (A-B) prior to computing eigenvalues.

Returns:

Trace distance D(A,B).

Return type:

float

qmlhc.metrics.causal_indefiniteness.trace_norm_hermitian(X, *, symmetrize=True)[source]#

Compute the trace norm \(\|X\|_{1}\) for an (approximately) Hermitian matrix.

For Hermitian \(X\), the trace norm equals the sum of the absolute values of its eigenvalues.

Parameters:
  • X (ndarray) – Square matrix.

  • symmetrize (bool) – If True, replace \(X\) with \((X + X^{\dagger}) / 2\) before eigendecomposition to remove tiny numerical non-Hermiticity.

Returns:

The trace norm \(\|X\|_{1}\).

Return type:

float