ExactProgram values. The format is exact-oracle-v1 — a JSON schema that captures the full program structure including certification level, register layout, and every op. On deserialization, b01t re-validates the structural invariants, so a corrupted or tampered file is rejected rather than silently accepted.
exact_program_to_json
ExactProgram to a deterministic JSON string. Keys are sorted alphabetically and the output is indented with two spaces, making the format suitable for version control.
The exact program to serialize. Obtain one from
.build_exact() on a @coherent or @primitive function.exact-oracle-v1 format.
exact_program_from_json
ExactProgram from a JSON string. Validates the format version, then re-checks all structural invariants before returning.
A JSON string previously produced by
exact_program_to_json.ExactProgram.
Raises: DSLValidationError if the format version is not exact-oracle-v1, or if any structural invariant is violated.
exact_program_to_dict
ExactProgram to a plain Python dict. Use this when you want to embed the program in a larger data structure (such as a registry entry) without converting to a string first.
The exact program to serialize.
dict with the same structure as the JSON schema below.
exact_program_from_dict
ExactProgram from a plain Python dict. Validates the format version and structural invariants.
A dict previously produced by
exact_program_to_dict, or parsed from a JSON file in exact-oracle-v1 format.ExactProgram.
Raises: DSLValidationError if the format version is wrong or any invariant is violated.
JSON schema
Theexact-oracle-v1 format has the following top-level structure:
Op types
Each entry in"ops" has an "op" field that is one of:
"op" value | Description |
|---|---|
"gate" | A single gate application. Has "gate" (enum value) and "wires". |
"ancilla" | An ancilla block. Has "ancilla" (reg dict), "compute", "middle", "middle_kind", "uncompute". |
"par" | Parallel composition. Has "left" and "right" (lists of ops). |
Certification values
"certification" | Decorator |
|---|---|
"safe" | @coherent |
"primitive" | @primitive |