1 """Phase 3.1 channel-native second slice: helper substrate, public runtime, correctness gate, boundaries. 3 **Helper / E01âE02 substrate:** imports private helpers from 4 ``noisy_runtime_channel_native`` for bundle shape, invariants, support-aware 5 application, and (``P31-S04-E02``) CNOT / 2-local Kraus composition vs. the 8 **Public runtime (``P31-S05-E01``):** ``execute_partitioned_density_channel_native`` 9 admits bounded mixed motifs per partition via local-support validation in 10 ``_validate_whole_partition_motif`` (no whole-workload single-qubit gate). 12 **Public positives (``P31-S05``):** integration tests assert runtime path, 13 fused-region audit fields, and density vs. sequential reference. 15 **Public boundary (``P31-S05-E02``):** negative matrix for span, noise presence, 16 and non-channel-native gates on surfaces built with 17 ``strict_phase3_support=False``. 19 **Public correctness gates:** counted 2q closure includes ``P31-S06-E01`` 20 (``phase31_microcase_2q_cnot_local_noise_pair``) and ``P31-S10-E01`` (remaining 21 strict counted microcases below) vs. sequential oracle with Frobenius/max-abs, 22 ``trace_deviation``, ``rho_is_valid``; Kraus bundle invariant checks on fused 2q 23 blocks. Non-counted ``phase31_local_support_q4_spectator_embedding_smoke`` remains 24 a larger-workload smoke. 26 **Hybrid continuity** (``phase2_xxz_hea_q4_continuity``, ``phase2_xxz_hea_q6_continuity``) 27 lives in ``test_partitioned_channel_native_phase31_hybrid_slice.py``. 29 **Still deferred:** Qiskit Aer on the frozen external slice (``P31-ADR-011``); 30 versioned ``correctness_evidence`` / ``channel_invariants`` / route-summary 31 packaging (``P31-S10-E02``, ``P31-ADR-013``); counted structured performance cases 32 (``P31-ADR-010``); Task 4 performance matrix. 34 The first-slice file ``test_partitioned_channel_native_phase31_slice.py`` remains 35 the unchanged 1q public regression anchor. 38 from __future__
import annotations
40 from pathlib
import Path
46 REPO_ROOT = Path(__file__).resolve().parents[2]
47 if str(REPO_ROOT)
not in sys.path:
48 sys.path.insert(0, str(REPO_ROOT))
51 from squander.partitioning.noisy_planner
import (
52 build_canonical_planner_surface_from_operation_specs,
53 build_partition_descriptor_set,
55 from squander.partitioning.noisy_runtime
import (
56 PHASE31_FUSION_KIND_CHANNEL_NATIVE_MOTIF,
57 PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
58 execute_partitioned_density_channel_native,
59 execute_sequential_density_reference,
61 from squander.partitioning.noisy_runtime_channel_native
import (
63 _check_kraus_bundle_invariants,
64 _compose_kraus_bundles,
65 _identity_kraus_bundle_for_support_qubit_count,
66 _kraus_bundle_phase_damping,
67 _member_to_kraus_bundle,
69 from squander.partitioning.noisy_runtime_core
import (
70 _build_partition_parameter_vector,
71 _segment_parameter_vector,
72 execute_sequential_density_reference,
74 from squander.partitioning.noisy_runtime_fusion
import (
76 _embed_single_qubit_gate,
77 _kernel_indices_for_fused_cnot,
79 from squander.partitioning.noisy_types
import (
80 NoisyPartitionDescriptor,
81 NoisyPartitionDescriptorSet,
83 from squander.partitioning.noisy_validation_errors
import NoisyRuntimeValidationError
85 PHASE3_RUNTIME_DENSITY_TOL,
86 build_density_comparison_metrics,
87 build_initial_parameters,
93 build_microcase_surface,
94 build_phase31_microcase_descriptor_set,
100 "phase31_microcase_1q_u3_local_noise_chain" 105 descriptor_set: NoisyPartitionDescriptorSet,
106 wanted_locals: tuple[int, ...] = (0, 1),
107 ) -> NoisyPartitionDescriptor:
108 for partition
in descriptor_set.partitions:
109 if partition.local_to_global_qbits == wanted_locals:
111 raise AssertionError(
112 "no partition with local_to_global_qbits == {}".format(wanted_locals)
117 return {lq: idx
for idx, lq
in enumerate(local_support)}
121 steps: list[np.ndarray],
123 descriptor_set: NoisyPartitionDescriptorSet,
124 support_qubit_count: int,
129 descriptor_set=descriptor_set,
130 runtime_path=runtime_path,
136 descriptor_set=descriptor_set,
137 runtime_path=runtime_path,
144 bundle = np.array([np.eye(4, dtype=np.complex128)])
147 descriptor_set=descriptor_set,
148 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
154 u1 = np.eye(2, dtype=np.complex128)
155 u2 = np.array([[0, 1], [1, 0]], dtype=np.complex128)
156 bundle = np.array([np.kron(u1, u2)])
159 descriptor_set=descriptor_set,
160 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
166 bundle = np.array([2.0 * np.eye(4, dtype=np.complex128)])
167 with pytest.raises(NoisyRuntimeValidationError)
as excinfo:
170 descriptor_set=descriptor_set,
171 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
173 assert excinfo.value.first_unsupported_condition ==
"channel_native_invariant_failure" 178 bell = np.zeros((4, 4), dtype=np.complex128)
179 bell[0, 0] = bell[3, 3] = bell[0, 3] = bell[3, 0] = 0.5
180 rho = DensityMatrix.from_numpy(bell)
182 rho_np = np.asarray(rho.to_numpy(), dtype=np.complex128)
183 ref_out = np.zeros((4, 4), dtype=np.complex128)
184 for k
in range(bundle.shape[0]):
186 bundle[k], total_kernel_qbits=2, kernel_target_qbit=0
188 ref_out += k_full @ rho_np @ k_full.conj().T
194 global_target_qbits=(0,),
195 descriptor_set=descriptor_set,
196 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
198 got = np.asarray(out.to_numpy(), dtype=np.complex128)
199 assert float(np.linalg.norm(got - ref_out, ord=
"fro")) <= PHASE3_RUNTIME_DENSITY_TOL
204 rng = np.random.default_rng(0)
205 psi = rng.normal(size=4) + 1j * rng.normal(size=4)
206 psi = psi / np.linalg.norm(psi)
207 rho = DensityMatrix.from_numpy(np.outer(psi, psi.conj()).astype(np.complex128))
208 bundle = np.array([np.eye(4, dtype=np.complex128)])
213 local_support=(0, 1),
214 global_target_qbits=(0, 1),
215 descriptor_set=descriptor_set,
216 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
220 np.asarray(out.to_numpy()) - np.asarray(rho.to_numpy()), ord=
"fro" 222 ) <= PHASE3_RUNTIME_DENSITY_TOL
226 """Kraus matrix for U0 on global 0 and U1 on global 1 matches product embed. 228 ``_embed_two_qubit_operator_on_globals`` uses subsystem index ``b_g0 + 2*b_g1`` 229 (g0 LSB). NumPy ``np.kron(A, B)`` places the first factor on the more 230 significant index bit, so the 4Ã4 operator is ``np.kron(U1, U0)``. 233 u0 = np.array([[0, 1], [1, 0]], dtype=np.complex128)
234 u1 = np.array([[1, 0], [0, -1]], dtype=np.complex128)
235 bundle = np.array([np.kron(u1, u0)])
236 rng = np.random.default_rng(1)
237 psi = rng.normal(size=4) + 1j * rng.normal(size=4)
238 psi = psi / np.linalg.norm(psi)
239 rho = DensityMatrix.from_numpy(np.outer(psi, psi.conj()).astype(np.complex128))
240 rho_np = np.asarray(rho.to_numpy(), dtype=np.complex128)
242 u0, total_kernel_qbits=2, kernel_target_qbit=0
244 ref_out = k_ref @ rho_np @ k_ref.conj().T
249 local_support=(0, 1),
250 global_target_qbits=(0, 1),
251 descriptor_set=descriptor_set,
252 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
254 got = np.asarray(out.to_numpy(), dtype=np.complex128)
255 assert float(np.linalg.norm(got - ref_out, ord=
"fro")) <= PHASE3_RUNTIME_DENSITY_TOL
260 bundle = np.array([np.eye(2, dtype=np.complex128)])
261 with pytest.raises(NoisyRuntimeValidationError)
as excinfo:
266 local_support=(0, 1, 2),
267 global_target_qbits=(0, 1, 2),
268 descriptor_set=descriptor_set,
269 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
271 assert excinfo.value.first_unsupported_condition ==
"channel_native_representation" 276 bundle = np.array([np.eye(4, dtype=np.complex128)])
277 with pytest.raises(NoisyRuntimeValidationError)
as excinfo:
283 global_target_qbits=(0,),
284 descriptor_set=descriptor_set,
285 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
287 assert excinfo.value.first_unsupported_condition ==
"channel_native_representation" 292 "phase31_microcase_2q_cnot_local_noise_pair" 297 for m
in partition.members
298 if ds.canonical_operation_for(m).name ==
"CNOT" 305 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
311 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
313 local_support = tuple(range(len(partition.local_to_global_qbits)))
318 local_support=local_support,
319 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
323 local_qbit_to_kernel_index=lmap,
324 local_target_qbit=cnot_member.local_target_qbit,
325 local_control_qbit=cnot_member.local_control_qbit,
330 total_kernel_qbits=2,
331 kernel_control_qbit=k_ctl,
332 kernel_target_qbit=k_tgt,
337 assert got.shape == expected.shape
339 float(np.linalg.norm(got[0] - expected[0], ord=
"fro"))
340 <= PHASE3_RUNTIME_DENSITY_TOL
346 "phase31_microcase_2q_multi_noise_entangler_chain" 354 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
360 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
362 local_support = tuple(range(len(partition.local_to_global_qbits)))
366 for m
in partition.members
367 if ds.canonical_operation_for(m).name ==
"CNOT" 369 assert len(cnot_members) == 2
370 for m
in cnot_members:
375 local_support=local_support,
376 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
379 local_qbit_to_kernel_index=lmap,
380 local_target_qbit=m.local_target_qbit,
381 local_control_qbit=m.local_control_qbit,
386 total_kernel_qbits=2,
387 kernel_control_qbit=k_ctl,
388 kernel_target_qbit=k_tgt,
394 float(np.linalg.norm(got[0] - expected[0], ord=
"fro"))
395 <= PHASE3_RUNTIME_DENSITY_TOL
401 "phase31_microcase_2q_cnot_local_noise_pair" 409 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
415 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
417 local_support = tuple(range(len(partition.local_to_global_qbits)))
418 global_targets = partition.local_to_global_qbits
424 local_support=local_support,
425 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
427 for m
in partition.members
432 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
439 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
444 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
446 rho0 = DensityMatrix(2)
451 local_support=local_support,
452 global_target_qbits=global_targets,
454 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
458 assert metrics[
"frobenius_norm_diff"] <= PHASE3_RUNTIME_DENSITY_TOL
459 assert metrics[
"max_abs_diff"] <= PHASE3_RUNTIME_DENSITY_TOL
464 "phase31_microcase_2q_cnot_local_noise_pair" 472 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
478 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
480 local_support = tuple(range(len(partition.local_to_global_qbits)))
481 global_targets = partition.local_to_global_qbits
487 local_support=local_support,
488 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
490 for m
in partition.members
495 support_qubit_count=len(local_support),
496 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
499 list(reversed(steps)),
501 support_qubit_count=len(local_support),
502 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
504 rho0 = DensityMatrix(2)
509 local_support=local_support,
510 global_target_qbits=global_targets,
512 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
518 local_support=local_support,
519 global_target_qbits=global_targets,
521 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
526 <= PHASE3_RUNTIME_DENSITY_TOL
530 np.asarray(out_ordered.to_numpy(), dtype=np.complex128)
531 - np.asarray(out_reversed.to_numpy(), dtype=np.complex128),
535 assert fro_rev > 10.0 * PHASE3_RUNTIME_DENSITY_TOL
543 "phase31_local_support_q4_spectator_embedding_smoke" 545 assert [p.local_to_global_qbits
for p
in ds.partitions] == [(0, 1), (2, 3)]
549 assert fr.candidate_kind == PHASE31_FUSION_KIND_CHANNEL_NATIVE_MOTIF
550 assert fr.partition_member_indices == (0, 1, 2, 3, 4, 5)
551 assert fr.operation_names == (
563 "phase31_microcase_2q_cnot_local_noise_pair" 569 assert result.runtime_path == PHASE31_RUNTIME_PATH_CHANNEL_NATIVE
570 assert result.fused_region_count >= 1
573 for fr
in result.fused_regions
574 if fr.candidate_kind == PHASE31_FUSION_KIND_CHANNEL_NATIVE_MOTIF
576 assert len(motif_regions) >= 1
578 assert motif_regions[0].global_target_qbits == (0, 1)
579 assert motif_regions[0].local_target_qbits == (0, 1)
582 assert metrics[
"frobenius_norm_diff"] <= PHASE3_RUNTIME_DENSITY_TOL
583 assert metrics[
"max_abs_diff"] <= PHASE3_RUNTIME_DENSITY_TOL
584 assert result.trace_deviation <= PHASE3_RUNTIME_DENSITY_TOL
585 assert result.rho_is_valid
is True 589 """Non-counted larger-workload smoke; full 4q state vs sequential oracle.""" 591 "phase31_local_support_q4_spectator_embedding_smoke" 597 assert result.runtime_path == PHASE31_RUNTIME_PATH_CHANNEL_NATIVE
598 assert result.fused_region_count == 2
601 for fr
in result.fused_regions
602 if fr.candidate_kind == PHASE31_FUSION_KIND_CHANNEL_NATIVE_MOTIF
604 assert len(motif_regions) == 2
605 by_global = {fr.global_target_qbits: fr
for fr
in motif_regions}
606 assert set(by_global) == {(0, 1), (2, 3)}
609 assert by_global[(0, 1)].local_target_qbits == (0, 1)
610 assert by_global[(2, 3)].local_target_qbits == (0, 1)
613 assert metrics[
"frobenius_norm_diff"] <= PHASE3_RUNTIME_DENSITY_TOL
614 assert metrics[
"max_abs_diff"] <= PHASE3_RUNTIME_DENSITY_TOL
615 assert result.trace_deviation <= PHASE3_RUNTIME_DENSITY_TOL
616 assert result.rho_is_valid
is True 624 "phase31_microcase_2q_cnot_local_noise_pair" 632 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
638 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
640 local_support = tuple(range(len(partition.local_to_global_qbits)))
646 local_support=local_support,
647 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
649 for m
in partition.members
654 support_qubit_count=len(local_support),
655 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
660 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
668 assert fr.candidate_kind == PHASE31_FUSION_KIND_CHANNEL_NATIVE_MOTIF
669 assert fr.global_target_qbits == (0, 1)
670 assert fr.local_target_qbits == (0, 1)
671 assert fr.operation_names == (
675 "local_depolarizing",
685 assert fr.candidate_kind == PHASE31_FUSION_KIND_CHANNEL_NATIVE_MOTIF
686 assert fr.global_target_qbits == (0, 1)
687 assert fr.local_target_qbits == (0, 1)
688 assert fr.operation_names == (
692 "local_depolarizing",
703 "phase31_microcase_2q_multi_noise_entangler_chain" 705 assert ds.workload_id ==
"phase31_microcase_2q_multi_noise_entangler_chain" 710 assert result.runtime_path == PHASE31_RUNTIME_PATH_CHANNEL_NATIVE
711 assert result.requested_runtime_path == PHASE31_RUNTIME_PATH_CHANNEL_NATIVE
712 assert result.fused_region_count >= 1
715 for fr
in result.fused_regions
716 if fr.candidate_kind == PHASE31_FUSION_KIND_CHANNEL_NATIVE_MOTIF
718 assert len(motifs) >= 1
722 assert metrics[
"frobenius_norm_diff"] <= PHASE3_RUNTIME_DENSITY_TOL
723 assert metrics[
"max_abs_diff"] <= PHASE3_RUNTIME_DENSITY_TOL
724 assert result.trace_deviation <= PHASE3_RUNTIME_DENSITY_TOL
725 assert result.rho_is_valid
is True 730 "phase31_microcase_2q_dense_same_support_motif" 732 assert ds.workload_id ==
"phase31_microcase_2q_dense_same_support_motif" 737 assert result.runtime_path == PHASE31_RUNTIME_PATH_CHANNEL_NATIVE
738 assert result.requested_runtime_path == PHASE31_RUNTIME_PATH_CHANNEL_NATIVE
739 assert result.fused_region_count >= 1
742 for fr
in result.fused_regions
743 if fr.candidate_kind == PHASE31_FUSION_KIND_CHANNEL_NATIVE_MOTIF
745 assert len(motifs) >= 1
749 assert metrics[
"frobenius_norm_diff"] <= PHASE3_RUNTIME_DENSITY_TOL
750 assert metrics[
"max_abs_diff"] <= PHASE3_RUNTIME_DENSITY_TOL
751 assert result.trace_deviation <= PHASE3_RUNTIME_DENSITY_TOL
752 assert result.rho_is_valid
is True 757 "phase31_microcase_2q_multi_noise_entangler_chain" 765 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
771 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
773 local_support = tuple(range(len(partition.local_to_global_qbits)))
779 local_support=local_support,
780 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
782 for m
in partition.members
787 support_qubit_count=len(local_support),
788 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
793 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
799 "phase31_microcase_2q_dense_same_support_motif" 807 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
813 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
815 local_support = tuple(range(len(partition.local_to_global_qbits)))
821 local_support=local_support,
822 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
824 for m
in partition.members
829 support_qubit_count=len(local_support),
830 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
835 runtime_path=PHASE31_RUNTIME_PATH_CHANNEL_NATIVE,
846 with pytest.raises(NoisyRuntimeValidationError)
as excinfo:
848 assert excinfo.value.first_unsupported_condition ==
"channel_native_qubit_span" 854 source_type=
"microcase_builder",
855 workload_id=
"second_slice_2q_unitary_only_channel_native_negative",
865 with pytest.raises(NoisyRuntimeValidationError)
as excinfo:
867 assert excinfo.value.first_unsupported_condition ==
"channel_native_noise_presence" 873 source_type=
"microcase_builder",
874 workload_id=
"second_slice_rx_on_relaxed_surface_channel_native_negative",
884 "name":
"phase_damping",
886 "source_gate_index": 0,
891 strict_phase3_support=
False,
895 with pytest.raises(NoisyRuntimeValidationError)
as excinfo:
897 assert excinfo.value.first_unsupported_condition ==
"channel_native_support_surface" 903 source_type=
"microcase_builder",
904 workload_id=
"second_slice_bit_flip_on_relaxed_surface_channel_native_negative",
911 "source_gate_index": 0,
916 strict_phase3_support=
False,
920 with pytest.raises(NoisyRuntimeValidationError)
as excinfo:
922 assert excinfo.value.first_unsupported_condition ==
"channel_native_support_surface" def test_phase31_channel_native_descriptor_order_matters_for_fusion()
def test_phase31_s10_e01_counted_2q_multi_noise_entangler_chain_matches_sequential()
def _find_partition_with_span
def _local_qbit_to_kernel_index
def _assert_multi_noise_entangler_motif_fused_region(fr)
def test_phase31_channel_native_public_rejects_partition_without_noise()
def execute_sequential_density_reference
Execute a sequential density reference.
def test_phase31_channel_native_public_rejects_unsupported_noise_on_relaxed_surface()
def _assert_dense_same_support_motif_fused_region(fr)
def test_phase31_channel_native_apply_helper_rejects_4x4_bundle_with_1q_support()
def test_phase31_channel_native_apply_helper_2q_kron_matches_product_embed()
def test_phase31_s10_e01_multi_noise_entangler_fused_kraus_bundle_satisfies_invariants()
def _kraus_bundle_phase_damping
def execute_partitioned_density_channel_native
def test_phase31_channel_native_cnot_lowering_matches_embed_cnot_oracle()
def test_phase31_channel_native_invariants_reject_non_trace_preserving_4x4()
def build_initial_parameters
def _segment_parameter_vector
def _kernel_indices_for_fused_cnot
def test_phase31_s06_e01_counted_2q_fused_kraus_bundle_satisfies_invariants()
def build_microcase_surface
def build_partition_descriptor_set
def test_phase31_channel_native_cnot_both_orientations_lower_consistently()
def _embed_single_qubit_gate
def test_phase31_channel_native_apply_helper_embeds_1q_bundle_into_2q_density()
def test_phase31_channel_native_apply_helper_identity_2q_leaves_2q_density()
def test_phase31_channel_native_public_4q_smoke_matches_sequential()
def _assert_channel_native_motif_fused_region(fr)
def test_phase31_channel_native_invariants_accept_kron_two_unitaries()
def test_phase31_channel_native_ordered_fusion_matches_sequential_on_2q_cnot_microcase()
def build_phase31_microcase_descriptor_set
def build_density_comparison_metrics
def build_canonical_planner_surface_from_operation_specs
def test_phase31_channel_native_public_2q_cnot_microcase_matches_sequential()
def test_phase31_channel_native_invariants_accept_2q_identity_bundle()
def test_phase31_channel_native_public_rejects_non_phase3_gate_on_relaxed_surface()
def _identity_kraus_bundle_for_support_qubit_count
def test_phase31_local_support_q4_smoke_partitions_two_disjoint_pairs()
def test_phase31_channel_native_apply_helper_rejects_support_above_2q()
def _build_partition_parameter_vector
def _member_to_kraus_bundle
def _compose_kraus_bundles
def _compose_kraus_step_sequence
def _descriptor_set_for_invariant_tests()
def test_phase31_s10_e01_counted_2q_dense_same_support_motif_matches_sequential()
def test_phase31_channel_native_public_rejects_motif_span_over_two_local_qubits()
def _check_kraus_bundle_invariants
def test_phase31_s10_e01_dense_same_support_motif_fused_kraus_bundle_satisfies_invariants()