Library / Observable Ledger / Observable Ledger examples
Observable Ledger examples
An exact braid record, a seeded sample, and a rejected comparison of the two methods.
- Example 1 — exact braid record
- Example 2 — seeded shots
- Example 3 — methods must not be compared as if they were the same
Example 1 — exact braid record
Lattice script
record = aether_braid().expect(["Z0", "Z0*Z1", "Y0*Y1", "X0*X1*X2"]) # within 1e-12: 0, 1, 0, 1
⟨Y0 Y1⟩ is a control. The braid built from H and CNOT does not produce that correlation. A regression that prints 1 here has applied a different circuit.
Example 2 — seeded shots
Lattice script
a = aether_braid().sample("Z0", shots=1024, seed=7)
b = aether_braid().sample("Z0", shots=1024, seed=7)
assert a.bits == b.bits
c = aether_braid().sample("Z0", shots=1024, seed=8)
assert a.bits != c.bitsExample 3 — methods must not be compared as if they were the same
Lattice script
exact = aether_braid().expect(["Z0"])
shots = aether_braid().sample("Z0", shots=256, seed=1)
Ledger.agree(exact, shots) # Mismatch fault: different methodsA helper that checks two exact records from State Register and Bond Contract on the braid is allowed. Crossing method tags is not.