The case study of the article: a one-dimensional lattice quantum
electrodynamics (QED), the physical system model bose_hubbard) and a digital simulator model
trotter), from a shared prefix.
For each artifact the page gives the Hamiltonian and the parameter set, for
each transformation the operator substitution, the exactness, the validity
conditions and the parameter relation. It also introduces the machinery the
guides to the Heisenberg magnet and the Ising
chain assume.
The physics follows Zhou et al. [1] and Yang et al. [2]. The text uses the notation of the
article, H_QED and H_BHM.
[qsimod.usecases.schwinger][qsimod.usecases.schwinger] assembles artifacts from
[qsimod.models][qsimod.models] and transformations from
[qsimod.transformations][qsimod.transformations] into a model graph. A solid arrow is an
exact transformation and a dotted arrow an approximate one. The second digital branch
(qubit_register_staggered, trotter_staggered) is omitted from the overview.
flowchart TB
subgraph LV1["Application model · <code>models.application</code>"]
direction LR
lattice_qed["<b>lattice_qed H<sub>sys</sub></b><br/>lattice QED<br/>(Kogut–Susskind)<br/><i>Θ<sub>sys</sub> = {m, a, e}</i>"]
end
subgraph LV2["Intermediate representations · <code>models.intermediate</code>"]
quantum_link_staggered["<b>quantum_link_staggered H<sub>IR1</sub></b><br/>quantum-link model,<br/>staggered mass<br/><i>Θ<sub>IR1</sub> = {m, κ}</i>"]
quantum_link_homogeneous["<b>quantum_link_homogeneous H<sub>IR2</sub></b><br/>quantum-link model,<br/>pair coupling<br/><i>Θ<sub>IR2</sub> = {m, κ}</i>"]
effective_bosonic["<b>effective_bosonic H<sub>IR3</sub></b><br/>boson encoding<br/><i>Θ<sub>IR3</sub> = {m, κ}</i>"]
qubit_register["<b>qubit_register H<sub>IR4</sub></b><br/>qubit Hamiltonian<br/><i>Θ<sub>IR4</sub> = {m, κ}</i>"]
qubit_register_staggered["<b>qubit_register_staggered H<sub>IR4</sub><sup>st</sup></b><br/>qubit Hamiltonian,<br/>from the staggered form<br/><i>m, κ</i>"]
end
subgraph LV3["Hardware model · <code>models.hardware</code>"]
direction LR
bose_hubbard["<b>bose_hubbard H<sub>sim</sub></b><br/>tilted, staggered<br/>Bose–Hubbard chain<br/><i>Θ<sub>sim</sub> = {J, U, δ, Δ}</i>"]
trotter["<b>trotter U<sub>≈</sub></b><br/>Trotter product formula<br/><i>t, n, order</i>"]
trotter_staggered["<b>trotter_staggered U<sub>≈</sub><sup>st</sup></b><br/>Trotter product formula,<br/>from the staggered form<br/><i>t, n, order</i>"]
end
lattice_qed -. "<b>quantum-link truncation</b><br/><i>approximate, regime conditions</i>" .-> quantum_link_staggered
quantum_link_staggered ---> |"<b>particle–hole transformation</b><br/><i>exact</i>"| quantum_link_homogeneous
quantum_link_homogeneous ---> |"<b>boson encoding</b><br/><i>exact on the encoded subspace</i>"| effective_bosonic
effective_bosonic -. "<b>degenerate perturbation theory,<br/>solved for the knob settings</b><br/><i>approximate, regime conditions</i>" .-> bose_hubbard
quantum_link_homogeneous ---> |"<b>Jordan–Wigner transformation</b><br/><i>exact</i>"| qubit_register
qubit_register -. "<b>Trotterisation</b><br/><i>approximate, resource-controlled</i>" .-> trotter
quantum_link_staggered ---> |"<b>Jordan–Wigner transformation,<br/>from the staggered form</b><br/><i>exact</i>"| qubit_register_staggered
qubit_register_staggered -. "<b>Trotterisation, order 2</b><br/><i>approximate, resource-controlled</i>" .-> trotter_staggered
classDef ham fill:#e0f2ee,stroke:#009371,color:#003e2f
classDef pf fill:#fbf1d9,stroke:#c48700,color:#573c00
class lattice_qed,quantum_link_staggered,quantum_link_homogeneous,effective_bosonic,qubit_register,qubit_register_staggered,bose_hubbard ham
class trotter,trotter_staggered pf
style LV1 fill:#f2f7fa,stroke:#b1d0e5,color:#103c5a
style LV2 fill:#f2f7fa,stroke:#b1d0e5,color:#103c5a
style LV3 fill:#f2f7fa,stroke:#b1d0e5,color:#103c5a
| Node | Article | Operator name in the code | Artifact | Parameter set |
|---|---|---|---|---|
lattice_qed |
H_QED |
lattice QED in the Kogut-Susskind formulation | ||
quantum_link_staggered |
H_QLM^st |
quantum-link model with staggered mass | ||
quantum_link_homogeneous |
H_QLM |
quantum-link model after the particle-hole transformation; the branch point | ||
effective_bosonic |
H_eff |
boson encoding of |
||
bose_hubbard |
H_BHM |
analogue simulator model: tilted, staggered Bose-Hubbard chain | ||
qubit_register |
H_qubit |
qubit Hamiltonian, the Jordan-Wigner image of |
||
trotter |
U_Trotter |
digital simulator model: Trotter product formula of |
t, n, order, and m, kappa
|
|
qubit_register_staggered, trotter_staggered
|
H_qubit^st |
the second digital branch, leaving quantum_link_staggered; see the two branch points
|
| Node | Artifact kind | Matter | Gauge | Parameters | Terms | Dimension (N=3 / N=4) |
|---|---|---|---|---|---|---|
lattice_qed |
Hamiltonian | fermion | untruncated U(1) link | m, a, e, electric_gap |
9 | not realisable |
quantum_link_staggered |
Hamiltonian | fermion | spin-1/2 | m, kappa |
7 | 32 / 128 |
quantum_link_homogeneous |
Hamiltonian | fermion | spin-1/2 | m, kappa |
8 | 32 / 128 |
effective_bosonic |
Hamiltonian | boson | boson | m, kappa |
8 | 243 / 2187 |
bose_hubbard |
Hamiltonian | boson | boson | J, U, delta, Delta |
23 | 243 / 2187 |
qubit_register |
Hamiltonian | qubit | qubit | m, kappa |
8 | 32 / 128 |
qubit_register_staggered |
Hamiltonian | qubit | qubit | m, kappa |
7 | 32 / 128 |
trotter |
product formula | qubit | qubit | t, n, 2k (and m, kappa) |
— | 32 / 128 |
trotter_staggered |
product formula | qubit | qubit | t, n, 2k (and m, kappa) |
— | 32 / 128 |
Parameter names are namespaced by the artifact that owns them (bose_hubbard.J,
effective_bosonic.kappa); the fully qualified names are constants on
[ParameterNames][qsimod.usecases.schwinger.ParameterNames].
Every node is an [Artifact][qsimod.artifact.Artifact] with a structural type, a parameter set
and a binding of the parameters. A [HamiltonianModel][qsimod.artifact.HamiltonianModel]
additionally carries:
| Declaration | Content |
|---|---|
hamiltonian |
a symbolic sum of operator products |
constraint_operators |
the generators of a declared symmetry, here the Gauss operators G_l, each with a target eigenvalue |
sector |
the superselection sector in which physical states live |
local_subspace |
a declared per-site occupation subspace |
dropped_constants |
the additive constants discarded by the transformations that produced the artifact, with their values |
The structural type declares only that a symmetry exists, by name, group and locality; this is what a transformation type-checks against. The generators themselves are data on the model.
| Transformation | From | To | Exactness | Kind of approximation | Relation, forward | Relation, inverse |
|---|---|---|---|---|---|---|
| [quantum-link truncation][qsimod.transformations.truncations.quantum_link_truncation] | lattice_qed |
quantum_link_staggered |
APPROXIMATE |
regime conditions | CLOSED_FORM |
CLOSED_FORM |
| [particle-hole transformation][qsimod.transformations.basis_changes.particle_hole_transformation] | quantum_link_staggered |
quantum_link_homogeneous |
EXACT |
— | CLOSED_FORM |
CLOSED_FORM |
| [boson encoding][qsimod.transformations.encodings.hardcore_boson_encoding] | quantum_link_homogeneous |
effective_bosonic |
EXACT on the encoded subspace |
— | CLOSED_FORM |
CLOSED_FORM |
| [second-order perturbation theory][qsimod.transformations.perturbative.second_order_perturbation_theory] | effective_bosonic |
bose_hubbard |
APPROXIMATE |
regime conditions | CLOSED_FORM |
UNDER_DETERMINED |
| [Jordan-Wigner transformation][qsimod.transformations.basis_changes.jordan_wigner_to_qubits] | quantum_link_homogeneous |
qubit_register |
EXACT |
— | CLOSED_FORM |
CLOSED_FORM |
[Jordan-Wigner transformation from quantum_link_staggered][qsimod.transformations.basis_changes.jordan_wigner_to_qubits] |
quantum_link_staggered |
qubit_register_staggered |
EXACT |
— | CLOSED_FORM |
CLOSED_FORM |
| [Trotterisation][qsimod.transformations.trotterisation.suzuki_trotter] | qubit_register |
trotter |
APPROXIMATE |
resource-controlled | CLOSED_FORM |
CLOSED_FORM |
The relation of the perturbative step is derived from the hardware model to the effective theory: a closed form from the knobs to the effective parameters, and under-determined in the inverse direction, the solve for the knob settings.
A [Transformation][qsimod.transform.Transformation] is a declaration before it is a
computation. Three independent attributes are checked when it is applied:
| Attribute | Fields | Question decided |
|---|---|---|
| structural type and artifact kind | source_pattern, source_kind |
May this transformation be applied to this artifact? |
| exactness | exactness |
Is the target unitarily equivalent to the source? An EXACT transformation is checked on every application: the source Hamiltonian is rewritten in the operators of the target ([image][qsimod.transform.Transformation.image]) and compared with the target model in [normal form][qsimod.normal_form]; a mismatch raises [ExactnessError][qsimod.transform.ExactnessError]. |
| kind of approximation | approximation.kind |
Is the error bounded by regime conditions on the parameters, or controlled by a resource parameter? |
Whether the hardware can be tuned to the coefficients the operator form demands is a property of the parameter relation and is resolved by posing a solve.
from qsimod.usecases.schwinger import perturbation
step = perturbation()
print(step) # name, exactness, approximation kind
print(step.relation) # the equations
print(step.validity) # the condition names
print(step.forward_relation_kind) # CLOSED_FORM
print(step.inverse_relation_kind) # UNDER_DETERMINED
print(step.source_pattern) # what it demands
print(step.target_pattern) # what it guaranteesUse case: [theory][qsimod.usecases.schwinger.theory] · library: [kogut_susskind_gauge_theory][qsimod.models.application.kogut_susskind_gauge_theory]
$$ \hat H_\text{sys} = \frac{a}{2} \sum_l \hat E_{l,l+1}^2
- m \sum_l (-1)^l \hat\psi_l^\dagger \hat\psi_l
- \frac{i}{2a} \sum_l \left( \hat\psi_l^\dagger \hat U_{l,l+1} \hat\psi_{l+1} - \text{h.c.} \right) $$
Staggered spinless fermions
with target 0 in the bulk, -1/2 at
The parameter set is electric_gap, is used by no
term and carries the energy cost Algebra.GAUGE_LINK_U1][qsimod.structure.Algebra]), so the artifact has no
finite matrix representation, yet type-checks the transformations that follow:
from qsimod.realise import HilbertSpace
from qsimod.usecases.schwinger import theory
try:
HilbertSpace.of(theory(3).structure)
except ValueError as error:
print(error)
# cannot realise H_QED: degree(s) of freedom ['gauge'] have no finite-dimensional
# representationThe field values of a link are cut down to the two lowest, which leaves a spin-1/2 on each link:
in units of
Exactness: APPROXIMATE. The truncation is faithful if the dynamics does not populate the
discarded field values, that is if the coupling is small against the gap to the first of them.
No resource parameter reduces the error.
| Condition | Severity | Quantity | Threshold |
|---|---|---|---|
field sector within truncation |
regime | kappa/(a e^2/2) |
1.0 |
Discarded constant. Since 1/4, the electric energy becomes the constant
from qsimod.usecases.schwinger import ParameterNames as P
from qsimod.usecases.schwinger import theory, truncation
bound = theory(3).bind(
**{P.MASS_LATTICE_QED: 0.0, P.LATTICE_SPACING: 1.0, P.GAUGE_COUPLING: 1.0, P.ELECTRIC_GAP: 0.5}
)
truncated = truncation().apply(bound)
print(truncated.dropped_constants[0]) # (a/2) sum_l E^2 -> (N-1) a e^2 / 8 = 0.25Parameter relation. Taken literally, the substitution fixes the coupling at quantum_link_staggered on, quantum_link_staggered.m = lattice_qed.m: one equation for two target parameters, which leaves the composite pipeline two
residual degrees of freedom.
Use case: [staggered_quantum_link][qsimod.usecases.schwinger.staggered_quantum_link] · library: [quantum_link_model][qsimod.models.intermediate.quantum_link_model] at [STAGGERED_CONVENTION][qsimod.models.intermediate.STAGGERED_CONVENTION]
This is Eq. (S1) of [1]. lattice_qed:
from qsimod.usecases.schwinger import ParameterNames as P
from qsimod.usecases.schwinger import build_graph
graph = build_graph(3)
staggered = graph.graph.node("quantum_link_staggered").bind(
**{P.MASS_QUANTUM_LINK_STAGGERED: 0.41, P.COUPLING_QUANTUM_LINK_STAGGERED: 0.83}
)
print(staggered.is_fully_bound) # True
print(staggered.pretty()) # the Hamiltonian, with psi on the fermionic sitesOn every odd matter site occupied and empty are exchanged, and on every even link the spin is flipped:
Exactness: EXACT, a unitary change of variables, and checked on application against the
library's
Parameter relation: an identity on both parameters. The staggering leaves the constant
Use case: [homogeneous_quantum_link][qsimod.usecases.schwinger.homogeneous_quantum_link] · library: [quantum_link_model][qsimod.models.intermediate.quantum_link_model] at [HOMOGENEOUS_CONVENTION][qsimod.models.intermediate.HOMOGENEOUS_CONVENTION]
The coupling is a pair creation and annihilation term, so the total matter charge is not
conserved. The Gauss targets are zero in the bulk and +1/2 at both ends;
[sector_projector][qsimod.realise.build.sector_projector] builds the sector projector from the
declared per-operator eigenvalues, boundary included. This artifact is the branch point: the
analogue branch continues with the boson encoding, the digital branch with the Jordan-Wigner
transformation.
The two-level degrees of freedom are expressed by atom numbers: an occupied or empty matter
site by one or zero atoms, an up or down link spin by two or zero atoms. Matter site
Exactness: EXACT on the encoded subspace. The identities hold as sandwich][qsimod.realise.build.sandwich]
produces restrict][qsimod.realise.build.restrict] extracts the
1.7e-16.
Use case: [effective_bosonic][qsimod.usecases.schwinger.effective_bosonic] · library: [bosonic_pair_coupling_model][qsimod.models.intermediate.bosonic_pair_coupling_model]
$$ \hat H_\text{IR3} = \sum_{\substack{j\ \text{even} \ 0 \le j \le 2N-4}} \left[ \frac{\kappa}{2\sqrt 2}, \hat b_j \hat b_{j+2} \big(\hat b_{j+1}^\dagger\big)^2 + \text{h.c.} \right]
- \sum_{\substack{j\ \text{even} \ 0 \le j \le 2N-2}} m \hat n_j
- m \lfloor N/2 \rfloor $$
Two atoms on neighbouring matter sites jointly move onto the link site between them, and back.
The declared subspace
([local_occupation_subspace][qsimod.models.gauge.local_occupation_subspace]) admits
n in {0, 1} on matter positions and n in {0, 2} on link positions, so a realisation needs
The pair tunnelling of
$$ m = \delta - \frac{U}{2}, \qquad \kappa = \sqrt 2, J^2 \left[ \frac{1}{\delta + \Delta} + \frac{1}{\delta - \Delta}
- \frac{1}{U - \delta + \Delta} + \frac{1}{U - \delta - \Delta} \right] $$
The tilt
Parameter relation. Five solved forms for two equations:
| Solved form | Solves | Note |
|---|---|---|
effective_bosonic.m := delta - U/2 |
mass | |
effective_bosonic.kappa := sqrt(2) J^2 (...) |
coupling | |
bose_hubbard.delta := m + U/2 |
mass | at fixed U |
bose_hubbard.U := 2(delta - m) |
mass | at fixed delta |
bose_hubbard.J := sqrt(kappa / (sqrt(2) * pole sum)) |
coupling | positive branch, at fixed (U, delta, Delta) |
Validity conditions. Four domain conditions exclude the poles of the coupling formula and
six regime conditions ensure the assumptions of the expansion. A regime condition theta = 0.1; a domain failure is a pole and is
never overridable.
| Condition | Severity | Quantity | Threshold | Origin |
|---|---|---|---|---|
pole: delta != +Delta |
domain | abs(delta-Delta)/delta |
1e-3 | first pole |
pole: delta != -Delta |
domain | abs(delta+Delta)/delta |
1e-3 | second pole |
pole: U-delta != +Delta |
domain | abs(U-delta-Delta)/U |
1e-3 | third pole |
pole: U-delta != -Delta |
domain | abs(U-delta+Delta)/U |
1e-3 | fourth pole |
J << delta |
regime | J/delta |
0.1 | perturbative expansion parameter |
J << U |
regime | J/U |
0.1 | perturbative expansion parameter |
abs(m) << U (U ~= 2 delta) |
regime | abs(m)/U |
0.1 | near-degeneracy of the manifold |
Delta << delta |
regime | Delta/delta |
0.1 | the tilt must not disturb the manifold |
Delta << U |
regime | Delta/U |
0.1 | the tilt must not disturb the manifold |
kappa << Delta |
regime | kappa/Delta |
0.1 | the tilt must suppress two-site tunnelling |
A report gives, per condition, the quantity, its value, the requirement and the margin in decades of slack:
from qsimod.usecases.schwinger import ParameterNames as P, validity
report = validity().report(
{
P.TUNNELLING: 0.02,
P.INTERACTION: 1.0,
P.SUPERLATTICE: 0.52,
P.TILT: 0.048,
P.MASS_EFFECTIVE_BOSONIC: 0.02,
P.COUPLING_EFFECTIVE_BOSONIC: 0.004525,
}
)
print(report)
print(report.weakest()) # which condition is closest to failingThe declared regime is two-sided,
The framework has to run the derivation backwards, from
from qsimod.usecases.schwinger import ParameterNames as P, build_graph
graph = build_graph(3)
theory = graph.graph.node("lattice_qed").bind(
**{
P.MASS_LATTICE_QED: 0.02,
P.LATTICE_SPACING: 1.0,
P.GAUGE_COUPLING: 1.0,
P.ELECTRIC_GAP: 0.5,
}
)
target = graph.analogue.apply(theory)
print(target) # bose_hubbard <Hamiltonian> H_BHM [unbound]
print(target.free_parameters)
# ('bose_hubbard.J', 'bose_hubbard.U', 'bose_hubbard.delta', 'bose_hubbard.Delta')Use case: [superlattice][qsimod.usecases.schwinger.superlattice] · library: [tilted_bose_hubbard_chain][qsimod.models.hardware.tilted_bose_hubbard_chain]
$$ \hat H_\text{sim} = -J \sum_{j=0}^{2N-3} \left( \hat b_j^\dagger \hat b_{j+1} + \text{h.c.} \right)
- \sum_{j=0}^{2N-2} \left[ \frac{U}{2} \hat n_j (\hat n_j - 1) + \epsilon_j \hat n_j \right], \qquad \epsilon_j = (-1)^j \frac{\delta}{2} + j \Delta $$
A chain of neutral atoms in an optical superlattice. The knobs are the tunnelling
from qsimod.usecases.schwinger import device_limits
print(device_limits())
# optical superlattice simulator: bose_hubbard.J in (0, 0.25]; bose_hubbard.U in [0.05, 4];
# bose_hubbard.delta in (0, 2.5]; bose_hubbard.Delta in (0, 0.6];
# tilt within the superlattice depth: (0.5*bose_hubbard.delta - bose_hubbard.Delta) >= 0;
# tilt within the resonance gap:
# (0.5*(bose_hubbard.U - bose_hubbard.delta) - bose_hubbard.Delta) >= 0|101> and |020> on
each three-site block, is not the ground-state manifold of
The spin-1/2 of a link is already a qubit; the fermionic matter sites acquire parity strings,
which the Jordan-Wigner transformation attaches to each qubit operator. Matter sites and links
share one register of
Exactness: EXACT. The string runs over the matter sites only and each coupling joins
adjacent matter sites, so the strings collapse to a sign; a longer-range coupling would leave a
string. The sign convention is the alternating-sign map of
[qsimod.realise.build][qsimod.realise.build], so the fermionic realisation of
quantum_link_homogeneous and the qubit realisation of qubit_register are identical matrices.
The particle-hole transformation is needed by the analogue branch but not by the digital one,
so the digital branch may also leave from quantum_link_staggered, by
[to_qubits_from_staggered][qsimod.usecases.schwinger.to_qubits_from_staggered]; the two qubit
Hamiltonians are unitarily equivalent:
from qsimod.realise import HilbertSpace, build_operator, eigensystem
from qsimod.usecases.schwinger import (
ParameterNames as P,
build_graph,
to_qubits_from_staggered,
to_qubits,
particle_hole,
)
staggered = (
build_graph(4)
.graph.node("quantum_link_staggered")
.bind(**{P.MASS_QUANTUM_LINK_STAGGERED: 0.41, P.COUPLING_QUANTUM_LINK_STAGGERED: 0.83})
)
via_homogeneous = to_qubits().apply(particle_hole().apply(staggered))
via_staggered = to_qubits_from_staggered().apply(staggered)
# identical spectra to 1e-10, a numerical check of the two exact transformationsUse case: [qubit_register][qsimod.usecases.schwinger.qubit_register] · library: [k_local_qubit_model][qsimod.models.intermediate.k_local_qubit_model]
$$ \hat H_\text{IR4} = \sum_{l=0}^{N-2} \frac{\kappa}{2} \left( \hat\sigma^-{2l} \hat\sigma^+{2l+1} \hat\sigma^-_{2l+2} + \text{h.c.} \right)
- \sum_{l=0}^{N-1} m \hat n_{2l} - m \lfloor N/2 \rfloor $$
Each coupling term acts on three qubits and expands into four mutually commuting Pauli
products, qubit_register_staggered, the image of the other branch point, is
the same construction in the staggered convention.
The only transformation of the case study that changes the artifact kind: source_kind is
HAMILTONIAN and target_kind is PRODUCT_FORMULA. The simulated time, the step count and
the order are fields of the transformation:
from qsimod.usecases.schwinger import trotterisation
step = trotterisation(time=2.0, steps=16, order=2)
print(step.approximation)
# resource-controlled [resources: steps, order]; leading error O(t^(p+1) / n^p) at order pLayer decomposition.
| Layer | Terms | Property |
|---|---|---|
sum_l (m/2) sigma^z_{2l} |
diagonal; exactly exponentiable | |
| coupling on even links | pairwise disjoint support | |
| coupling on odd links | pairwise disjoint support |
The layers do not commute with each other, which the framework establishes as an exact Pauli sum; the a-priori error bound sums over the non-commuting pairs only:
from qsimod.transformations import interleaved_layers_of
from qsimod.usecases.schwinger import (
ParameterNames as P,
build_graph,
particle_hole,
to_qubits,
)
staggered = (
build_graph(4)
.graph.node("quantum_link_staggered")
.bind(**{P.MASS_QUANTUM_LINK_STAGGERED: 0.41, P.COUPLING_QUANTUM_LINK_STAGGERED: 0.83})
)
qubits = to_qubits().apply(particle_hole().apply(staggered))
layers = interleaved_layers_of(qubits)
print(layers.commutation_report())
# [H_M, H_even]: do NOT commute (8 strings)
# [H_M, H_odd]: do NOT commute (4 strings)
# [H_even, H_odd]: do NOT commute (16 strings)Exactness: APPROXIMATE, with the error
Step count. Choosing
from qsimod.solving.backends.integer import minimal_resource_setting
from qsimod.solving.stepcount import STEPS_SYMBOL, minimal_steps, resource_candidates
from qsimod.trotter import SpectralNormEstimator
estimator = SpectralNormEstimator(len(qubits.structure.sites)) # 7 qubits at N = 4
outcome = minimal_steps(layers, order=2, time=2.0, target_error=1e-3, estimator=estimator)
print(int(outcome.point[STEPS_SYMBOL]), outcome.notes["minimality"])
# 30 trotter.n = 30 satisfies the constraints and 29 does not
candidates = resource_candidates(layers, 2.0, 1e-3, orders=(1, 2, 4), estimator=estimator)
print(minimal_resource_setting(candidates))
# order 2: n=30, 840 k-local factors, depth 600, bound 9.981e-04Resources are counted in k-local unitaries and in layers acting on disjoint qubits, not in
CNOTs, since a CNOT count needs the gate set of the executable layer; see
[ResourceSummary][qsimod.trotter.schedule.ResourceSummary].
A [ProductFormulaModel][qsimod.trotter.schedule.ProductFormulaModel] is not a Hamiltonian. It
carries the qubit register, an ordered sequence of factors
from qsimod.usecases.schwinger import (
ParameterNames as P,
build_graph,
to_qubits,
particle_hole,
trotterisation,
)
from qsimod.trotter import as_product_formula
staggered = (
build_graph(50)
.graph.node("quantum_link_staggered")
.bind(**{P.MASS_QUANTUM_LINK_STAGGERED: 0.41, P.COUPLING_QUANTUM_LINK_STAGGERED: 0.83})
)
qubits = to_qubits().apply(particle_hole().apply(staggered))
formula = as_product_formula(trotterisation(time=2.0, steps=8, order=1).apply(qubits))
print(formula.resources()) # 99 qubits, factors, depth in layers, error boundHere the two branches cease to be comparable objects: ArtifactKindError][qsimod.artifact.ArtifactKindError].
An artifact with a finite structural type and every parameter bound is realised as a dense
complex128 JAX array; the bosonic cutoff is part of the request, not of the artifact:
from qsimod.realise import HilbertSpace, RealisationRequest, build_operator
from qsimod.usecases.schwinger import ParameterNames as P, superlattice
model = superlattice(3)
space = HilbertSpace.of(model.structure, RealisationRequest(boson_cutoff=2))
print(space) # dimension 243 (3x3x3x3x3), n_max=2
print(space.label(space.index_of((1, 0, 1, 0, 1)))) # |1 0 1 0 1>
operator = build_operator(
model.hamiltonian,
space,
{
P.TUNNELLING: 0.02,
P.INTERACTION: 1.0,
P.SUPERLATTICE: 0.52,
P.TILT: 0.048,
},
)Register site 0 is the leftmost tensor factor; see
[HilbertSpace][qsimod.realise.hilbert.HilbertSpace] for the basis conventions. Time evolution
is computed exactly by eigendecomposition ([qsimod.realise.evolve][qsimod.realise.evolve]).
This is how the exact transformations are shown to be unitarily equivalent to numerical
precision, and every Hamiltonian that declares Gauss's law to commute with its generators.
Transformations compose into a [Pipeline][qsimod.pipeline.Pipeline], itself a
Transformation, and the composition is type-checked without any artifact in hand:
from qsimod.pipeline import CompositionError, Pipeline
from qsimod.usecases.schwinger import encoding, truncation
try:
Pipeline.of([encoding(), truncation()])
except CompositionError as error:
print(error)
print([gap.aspect for gap in error.gaps])
# cannot compose 'Jordan-Wigner + hardcore-boson encoding' with 'spin-1/2 quantum-link
# truncation': dof[matter].algebra: requires fermion, found boson; ...| Composite attribute | Rule |
|---|---|
| structural types | unified pairwise, at composition time |
| exactness | EXACT if and only if every transformation is exact |
| kinds of approximation | the set of the transformations' kinds; the analogue branch is {regime-limited}, the digital branch {regime-limited, resource-controlled} |
| validity condition | the conjunction of the transformations' conditions |
| parameter relation | the union of the transformations' equations, with the intermediate parameters left free |
The composed relation is one solver problem over the whole pipeline, because a parameter left free by one transformation may be fixed by a later one:
from qsimod.usecases.schwinger import ParameterNames as P, build_graph
graph = build_graph(3)
targets = {
P.MASS_LATTICE_QED: 0.02,
P.COUPLING_QUANTUM_LINK_STAGGERED: 0.004525,
P.ELECTRIC_GAP: 0.5,
}
classification = graph.analogue.classify_relation(frozenset(targets))
print(classification)
# UNDER_DETERMINED: 7 equation(s), 9 unknown(s) (...); 2 residual degree(s) of freedomNine unknowns, the four knobs and five intermediate parameters, against seven equations leave two residual degrees of freedom, so a single knob setting needs two further conditions or an objective.
The knob settings are found in the inverse direction of the derivation, by a constrained solve:
from qsimod.usecases.schwinger import ParameterNames as P, device_limits, build_graph
from qsimod.solving import realise_parameters
graph = build_graph(3)
targets = {
P.MASS_LATTICE_QED: 0.02,
P.COUPLING_QUANTUM_LINK_STAGGERED: 0.004525,
P.ELECTRIC_GAP: 0.5,
}
knobs = [P.TUNNELLING, P.INTERACTION, P.SUPERLATTICE, P.TILT]
result = realise_parameters(
graph.analogue,
targets=targets,
unknowns=knobs,
admissible_set=device_limits(),
)
print(result) # status, point, per-equation residuals, objective, every marginThe backend runs SciPy's SLSQP over the admissible ranges, with the parameter relations as
equality constraints, the domain and regime conditions as inequality constraints, and analytic
gradients through JAX. The result carries a [SolveStatus][qsimod.solving.result.SolveStatus]:
EXACT_SOLUTION, APPROXIMATE_SOLUTION with a per-parameter residual, INFEASIBLE with the
binding constraint named, proved by interval arithmetic before any search runs, or UNSOLVED.
An under-determined system is resolved by an objective, by default the maximisation of the
weakest validity margin:
from qsimod.scalar import Symbol
from qsimod.solving import minimise
frugal = realise_parameters(
graph.analogue,
targets=targets,
unknowns=knobs,
admissible_set=device_limits(),
objective=minimise(Symbol(P.INTERACTION), name="minimise U"),
)
print(result.point[P.INTERACTION], frugal.point[P.INTERACTION]) # 4.0 0.865Where the relation is a closed form in the requested direction, no optimiser is constructed.
[error_report][qsimod.pipeline.Pipeline.error_report] reports the errors of a pipeline on
separate axes: the structural approximations, the residual of the solve, the regime margins,
and the error of a resource-controlled transformation against its cost.
| Transformation | Constant | Treatment |
|---|---|---|
| quantum-link truncation | (a/2) sum_l E^2 -> (N-1) a e^2 / 8 |
dropped; recorded with its value on the target artifact (HamiltonianModel.dropped_constants) |
| particle-hole transformation | - m * floor(N/2) from the mass staggering |
retained as an identity term |
| boson encoding, Jordan-Wigner transformations | — | inherited unchanged |
| Trotterisation | — | the identity string of the mass layer becomes a global phase |
Pipeline.dropped_constants() lists the transformations of a pipeline that discard a constant.
New theories and hardware models are added through
[ModelTransformation][qsimod.transformations.base.ModelTransformation]: a subclass implements
the method that builds its target artifact, and
[target_sites][qsimod.transform.Transformation.target_sites] if the register size changes.
Its validity conditions are declared with [conjunction][qsimod.validity.conjunction] and are
picked up by the solving layer, and the new artifact and transformation take part in the model
graph through graph.add_node and graph.add_edge. tests/test_extensibility.py adds a third
hardware model, a transverse-field Ising chain, and a second physical system model from outside
the package, and is the worked example of the extension points.
- Z.-Y. Zhou, G.-X. Su, J. C. Halimeh, R. Ott, H. Sun, P. Hauke, B. Yang, Z.-S. Yuan, J. Berges and J.-W. Pan, Thermalization dynamics of a gauge theory on a quantum simulator, Science 377, 311-314 (2022). doi:10.1126/science.abl6277
- B. Yang, H. Sun, R. Ott, H.-Y. Wang, T. V. Zache, J. C. Halimeh, Z.-S. Yuan, P. Hauke and J.-W. Pan, Observation of gauge invariance in a 71-site Bose-Hubbard quantum simulator, Nature 587, 392-396 (2020). doi:10.1038/s41586-020-2910-8