SNAPKITTYWEST's picture
chore: push full sov-kernel-monster content from local build
9425aed verified
Raw
History Blame Contribute Delete
1.9 kB
-- BOB Quantum Kernel Error Status (WORM-sealed)
-- Phase 2: Loop Invariant Formalization
-- Status: Observable error codes tied to WORM logs (bookkeeping only)
module Core.ErrorCode where
open import Data.Nat using (β„•)
-- Error status codes (copied from bob_errors.f90 enum)
data ErrorCode : Set where
BOB_SUCCESS : ErrorCode -- 0 (no error)
BOB_ERROR_ALLOCATION : ErrorCode -- Memory allocation failure
BOB_ERROR_INVALID_STATE : ErrorCode -- Invalid quantum state
BOB_ERROR_INVALID_GATE : ErrorCode -- Invalid gate operation
BOB_ERROR_NOT_UNITARY : ErrorCode -- Matrix is not unitary
BOB_ERROR_INVALID_ARGUMENT : ErrorCode -- Bad argument
BOB_ERROR_DIMENSION_MISMATCH : ErrorCode -- Dimension mismatch
BOB_ERROR_OTHER : ErrorCode -- Other error
-- Decidable equality for error codes
_==β‚‘_ : ErrorCode β†’ ErrorCode β†’ Set
BOB_SUCCESS ==β‚‘ BOB_SUCCESS = Set
BOB_SUCCESS ==β‚‘ _ = βŠ₯
BOB_ERROR_ALLOCATION ==β‚‘ BOB_ERROR_ALLOCATION = Set
BOB_ERROR_ALLOCATION ==β‚‘ _ = βŠ₯
BOB_ERROR_INVALID_STATE ==β‚‘ BOB_ERROR_INVALID_STATE = Set
BOB_ERROR_INVALID_STATE ==β‚‘ _ = βŠ₯
BOB_ERROR_INVALID_GATE ==β‚‘ BOB_ERROR_INVALID_GATE = Set
BOB_ERROR_INVALID_GATE ==β‚‘ _ = βŠ₯
BOB_ERROR_NOT_UNITARY ==β‚‘ BOB_ERROR_NOT_UNITARY = Set
BOB_ERROR_NOT_UNITARY ==β‚‘ _ = βŠ₯
BOB_ERROR_INVALID_ARGUMENT ==β‚‘ BOB_ERROR_INVALID_ARGUMENT = Set
BOB_ERROR_INVALID_ARGUMENT ==β‚‘ _ = βŠ₯
BOB_ERROR_DIMENSION_MISMATCH ==β‚‘ BOB_ERROR_DIMENSION_MISMATCH = Set
BOB_ERROR_DIMENSION_MISMATCH ==β‚‘ _ = βŠ₯
BOB_ERROR_OTHER ==β‚‘ BOB_ERROR_OTHER = Set
BOB_ERROR_OTHER ==β‚‘ _ = βŠ₯
-- Predicate: no error occurred
isSuccess : ErrorCode β†’ Set
isSuccess BOB_SUCCESS = Set
isSuccess _ = βŠ₯