Download jacobian-formal/src/Core/Predicates.agda from Snapkitty/sov-kernel-monster: direct link, hf CLI and curl.
- Browser
- Download file 2.34 kB
-
https://huggingface.co/Snapkitty/sov-kernel-monster/resolve/main/jacobian-formal/src/Core/Predicates.agda
- Command line
-
hf download hf://Snapkitty/sov-kernel-monster/jacobian-formal/src/Core/Predicates.agda
-
curl -L -o Predicates.agda https://huggingface.co/Snapkitty/sov-kernel-monster/resolve/main/jacobian-formal/src/Core/Predicates.agda
2.34 kB
| -- Shared Loop Invariant Predicates | |
| -- Phase 2: Loop Invariant Formalization | |
| -- Status: Observable bookkeeping conditions (counters, flags, divisibility) | |
| module Core.Predicates where | |
| open import Data.Nat using (β; _β€_; _<_; _β‘_; _mod_; zero; suc) | |
| open import Data.Real using (β; _β€_; _<_; _β₯_; _+_; _*_; _-_) | |
| open import Data.Bool using (Bool; true; false) | |
| open import Relation.Binary.PropositionalEquality using (_β‘_; refl) | |
| open import Data.Vec using (Vec; _[_]; map) | |
| -- Predicate: step counter has reached target | |
| stepCounterAt : (k : β) (target : β) β Set | |
| stepCounterAt k target = k β‘ target | |
| -- Predicate: step counter is within valid range | |
| stepInRange : (k : β) (num_steps : β) β Set | |
| stepInRange k num_steps = k β€ num_steps | |
| -- Predicate: error status flag is success | |
| errorIsClear : (err : β) β Set -- 0 = BOB_SUCCESS | |
| errorIsClear err = err β‘ 0 | |
| -- Predicate: time value is valid (positive) | |
| timeIsPositive : (t : β) β Set | |
| timeIsPositive t = 0 < t | |
| -- Predicate: time step is positive | |
| dtIsPositive : (dt : β) β Set | |
| dtIsPositive dt = 0 < dt | |
| -- Predicate: step count is exact multiple of normalization period | |
| needsNormalization : (step : β) (period : β) β Set | |
| needsNormalization step period = (step mod period) β‘ 0 | |
| -- Predicate: step has NOT exceeded target | |
| canContinueLoop : (step : β) (num_steps : β) β Set | |
| canContinueLoop step num_steps = step < num_steps | |
| -- Predicate: qubit index is valid | |
| qubitIndexValid : (idx : β) (num_qubits : β) β Set | |
| qubitIndexValid idx num_qubits = idx < num_qubits | |
| -- Predicate: basis state iterator in valid range | |
| basisStateInRange : (i : β) (dim : β) β Set | |
| basisStateInRange i dim = i < dim | |
| -- Predicate: Taylor series term index | |
| taylorTermIndex : (k : β) (max_terms : β) β Set | |
| taylorTermIndex k max_terms = k β€ max_terms | |
| -- Predicate: dimension is power of 2 | |
| isPowerOfTwo : (n : β) β Set | |
| data IsPowerOfTwo : β β Set where | |
| base : IsPowerOfTwo 1 | |
| step : β {n} β IsPowerOfTwo n β IsPowerOfTwo (n * 2) | |
| -- Predicate: vector dimensionality preserved | |
| dimensionPreserved : (dimβ dimβ : β) β Set | |
| dimensionPreserved dimβ dimβ = dimβ β‘ dimβ | |
| -- Predicate: all elements processed in loop | |
| loopCompleted : (current : β) (limit : β) β Set | |
| loopCompleted current limit = current β‘ limit | |