Library / Getting started
Getting started
Open a three-wire register, run the Aether braid, and publish one exact ledger record.
Where the script runs
Lattice script is the notebook notation for this laboratory. It is not a package name you install from a public index, and it does not bind to another vendor’s simulator. In the Æ Hive console the same words are the API. The examples on this page are the regression the laboratory stores.
Lattice script
from lattice import Lattice
register = Lattice.open(width=3, endian="little", ceiling="64 MiB")
register.apply("H", on=0)
register.apply("CNOT", control=0, target=1)
register.apply("CNOT", control=1, target=2)
register.assert_norm(tol=1e-12)
record = register.expect(["Z0", "Z0*Z1", "X0*X1*X2"])
assert record.method == "exact"
assert record.source == "state-register"
# values within 1e-12: 0, 1, 1How to read the result
assert_norm fails the run if the Euclidean norm of the amplitude table leaves 1 by more than the tolerance. expect does not draw shots. The record carries method, source, the canonical observable list, and the values. Printing only the values drops the method, which is the mistake the record type exists to prevent.
| Field | Value |
|---|---|
| record.method | exact |
| record.source | state-register |
| record.values[0] ⟨Z0⟩ | 0 |
| record.values[1] ⟨Z0 Z1⟩ | 1 |
| record.values[2] ⟨X0 X1 X2⟩ | 1 |
When this script is the wrong product
- Width grows and you still need every amplitude: Device Span, after you have read the one-worker agreement rule.
- Width grows and entanglement across the line stays small: Bond Contract, with an ε you are willing to defend.
- The claim includes a channel: prepare the pure state, then Noise Channel, then expect on the density table.
- You need a finite sample: Observable Ledger sample, with an explicit seed. Do not round the exact record and call it a sample.