bloq_graph/verify/
error.rs1use std::collections::BTreeMap;
4
5use glam::IVec3;
6
7#[derive(Debug, thiserror::Error)]
9#[non_exhaustive]
10pub enum VerifyLogicalError {
11 #[error("{0}")]
13 Cancelled(#[from] crate::ComputationCancelled),
14 #[error("{0}")]
16 Graph(#[from] crate::BlockGraphError),
17 #[error("{0}")]
19 ZX(#[from] crate::ZXError),
20 #[error("{0}")]
22 OutputCorrection(#[from] crate::OutputCorrectionError),
23 #[error("logical boundary {0} is listed more than once")]
25 DuplicateBoundary(IVec3),
26 #[error("logical boundary {0} is not an open port")]
28 InvalidBoundary(IVec3),
29 #[error("open port {0} is absent from the logical boundary order")]
31 MissingBoundary(IVec3),
32 #[error("measurement {0:?} has no supplied branch value")]
34 MissingMeasurementValue(String),
35 #[error("external Boolean input {0:?} has no supplied branch value")]
37 MissingInputValue(String),
38 #[error("feedback target {target} has no wire on which to insert {pauli}")]
40 FeedbackTargetWithoutWire {
41 target: IVec3,
43 pauli: crate::PauliBasis,
45 },
46 #[error("measurement {0:?} has no native ZX phase representation")]
48 MeasurementPhaseUnavailable(String),
49 #[error("too many symbolic phases for QuiZX's u32 variable ids")]
51 TooManySymbols,
52 #[error(
54 "expected map has {expected_inputs} input(s) and {expected_outputs} output(s), but the Bloq map has {actual_inputs} input(s) and {actual_outputs} output(s)"
55 )]
56 BoundaryArityMismatch {
57 actual_inputs: usize,
59 actual_outputs: usize,
61 expected_inputs: usize,
63 expected_outputs: usize,
65 },
66 #[error("the caller-supplied expected ZX map is the zero map")]
68 ZeroExpectedMap,
69 #[error(
71 "sampled nonzero branch does not equal the expected ZX map up to scalar: {classical_state:?}"
72 )]
73 MapMismatch {
74 classical_state: BTreeMap<String, bool>,
76 },
77 #[error("no accepted nonzero branch was sampled in {samples} fuzz case(s)")]
79 NoVerifiedBranch {
80 samples: usize,
82 },
83 #[error("could not initialize the logical stabilizer basis")]
85 RuntimeBasisInitializationFailed {
86 #[source]
88 source: crate::RuntimeBasisError,
89 },
90 #[error("runtime basis update failed at {pos}")]
92 RuntimeBasisUpdateFailed {
93 pos: IVec3,
95 #[source]
97 source: crate::RuntimeBasisError,
98 },
99 #[error("output correction surfaces are unavailable for {0:?}")]
101 OutputSurfaceUnavailable(Vec<IVec3>),
102}