Quantum and CircuitsReading edition

Python API and reproduction commands

Reading tools
Reading libraryFind statementsInspect Lean
Switch work

Saved reading

Read side by side

Verification statements describe the retained edition and its recorded evidence. This HTML presentation adds no Lean execution or proof review.

Start reading

Resources & source

Original TeX with line links · Download TeX

The wording and mathematics follow the retained manuscript. This reading format does not add a proof review or extend Lean coverage.

Skip contents and start reading

B.2 Python API and reproduction commands

The release code is intentionally compact. Its purpose is to verify the algebra and provide a reusable seed rather than to compete with optimized quantum simulators.

B.2.1 Core API

Core packet API.

from symmetry_packets import (
    weight_basis,
    residue_basis,
    symmetric_subspace_dimension,
    boson_fixed_number_dimension,
    fermion_fixed_number_dimension,
    PacketPlan,
    rz,
    xy_exchange,
    hypercube_quotient,
    circuit_leakage_bound,
    hamiltonian_leakage_bound,
)

B.2.2 Exact packet plan

Fixed-weight packet compilation.

plan = PacketPlan.fixed_weight(n=10, k=2)
packet_state = random_packet_state(plan, seed=12)
full_state = plan.embed(packet_state)

restricted_gate = plan.restrict_gate(
    xy_exchange(theta=0.2),
    qubits=(3, 4),
)
packet_state = restricted_gate @ packet_state

B.2.3 Validation

From the project root, run

PYTHONPATH=code python3 code/validate.py
PYTHONPATH=code python3 code/validate_exact.py
PYTHONPATH=code python3 code/validate_boundaries.py

The expected output reports successful formula checks and reconstruction errors near machine precision for the representative fixed-weight circuits.

B.2.4 Figure generation

All figures in the PDF are generated by

python3 code/make_figures.py

The generator writes vector PDF figures into the figures directory.

B.2.5 Build

The complete rebuild command is

./run_all.sh

It validates the Python code, regenerates figures, compiles the LaTeX source, and updates the checksums.

Source and conversion record

Source SHA-256: 23a87511bb01d6ac8a31d9dff3d3290aca01c001576115b905e5ccc8fde31b60

Unsupported prose commands stop the build. The mathematical expression sequence is checked against the source, with manuscript macros expanded for display.

Conversion records

Notation in Quantum and Circuits

Look up a symbol without leaving this chapter. Select text before opening help to search for it.

Search this work’s notation.

    Symbols can have different meanings in different passages. Read each result in its own context.

    Open the full notation index