Verification¶
Formal and functional verification utilities for SNN designs.
- Temporal property checking: verify that SNN outputs satisfy temporal logic specifications
- Equivalence checking: verify Python simulation matches Verilog RTL bit-for-bit
- Coverage metrics: track which neuron states and transitions have been exercised
Formal SNN Verification Standard¶
from sc_neurocore.verification import (
SNNVerificationEvidence,
VerificationClaimStatus,
VerificationEvidenceKind,
VerificationLevel,
assess_snn_verification_standard,
)
report = assess_snn_verification_standard(
[
SNNVerificationEvidence(
evidence_id="temporal",
level=VerificationLevel.TEMPORAL_PROPERTIES,
kind=VerificationEvidenceKind.TEMPORAL_RESULT,
status=VerificationClaimStatus.PASS,
description="bounded temporal properties",
),
]
)
assert not report.passed # external formal proof and other mandatory evidence are missing
The publication-grade profile requires bounded temporal evidence, interval probability/state bounds, implementation-equivalence evidence, and an external formal proof log. Missing evidence is reported explicitly; the standard does not claim unbounded semantic correctness without a passing external proof artefact.
sc_neurocore.verification
¶
sc_neurocore.verification -- Tier: research (experimental / research).
FormalVerifier
¶
Interval arithmetic checker for stochastic probability bounds and energy safety constraints. Not an SMT solver.
Source code in src/sc_neurocore/verification/formal_proofs.py
| Python | |
|---|---|
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |
verify_probability_bounds(input_interval, weight_interval)
staticmethod
¶
Prove that Output Probability is always in [0, 1]. Logic: Out = Input * Weight (AND gate)
Source code in src/sc_neurocore/verification/formal_proofs.py
| Python | |
|---|---|
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
verify_energy_safety(energy, cost)
staticmethod
¶
Prove that operation will not consume more energy than available.
Source code in src/sc_neurocore/verification/formal_proofs.py
| Python | |
|---|---|
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |
CodeSafetyVerifier
dataclass
¶
AST blocklist screen for auto-generated code.
Walks the AST and rejects code containing known-dangerous patterns: filesystem mutation, process spawning, network access, code execution, and unrestricted imports.
Limitations: this is a static blocklist, not a sandbox. It catches common dangerous patterns but cannot prevent all malicious code. Obfuscated calls (getattr chains, importlib indirection) may bypass it. Do not use as a security boundary without additional sandboxing.
Source code in src/sc_neurocore/verification/safety.py
| Python | |
|---|---|
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | |
verify_code_safety(source_code)
¶
Static analysis of source code for dangerous patterns.
Returns True if no blocked patterns found, False otherwise.
Source code in src/sc_neurocore/verification/safety.py
| Python | |
|---|---|
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
verify_logic_invariant(func, input_sample, expected_condition)
¶
Dynamic verification: run func and check output against condition.
Source code in src/sc_neurocore/verification/safety.py
| Python | |
|---|---|
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | |
SNNVerificationConformanceReport
dataclass
¶
Conformance report for a profile and evidence set.
Source code in src/sc_neurocore/verification/snn_standard.py
| Python | |
|---|---|
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | |
passed
property
¶
Whether all mandatory requirements passed.
missing_mandatory
property
¶
Mandatory requirement ids with missing evidence.
failed_mandatory
property
¶
Mandatory requirement ids with failing evidence.
mandatory_coverage
property
¶
Coverage ratio for mandatory requirements.
to_dict()
¶
Return a JSON-ready conformance report.
Source code in src/sc_neurocore/verification/snn_standard.py
| Python | |
|---|---|
207 208 209 210 211 212 213 214 215 216 217 218 | |
SNNVerificationEvidence
dataclass
¶
One evidence item used in a formal SNN verification claim.
Source code in src/sc_neurocore/verification/snn_standard.py
| Python | |
|---|---|
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | |
to_dict()
¶
Return a JSON-ready evidence record.
Source code in src/sc_neurocore/verification/snn_standard.py
| Python | |
|---|---|
77 78 79 80 81 82 83 84 85 86 87 | |
SNNVerificationRequirement
dataclass
¶
One mandatory or optional requirement in a standard profile.
Source code in src/sc_neurocore/verification/snn_standard.py
| Python | |
|---|---|
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
to_dict()
¶
Return a JSON-ready requirement.
Source code in src/sc_neurocore/verification/snn_standard.py
| Python | |
|---|---|
108 109 110 111 112 113 114 115 116 | |
SNNVerificationRequirementResult
dataclass
¶
Evaluation of one profile requirement.
Source code in src/sc_neurocore/verification/snn_standard.py
| Python | |
|---|---|
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
to_dict()
¶
Return a JSON-ready requirement result.
Source code in src/sc_neurocore/verification/snn_standard.py
| Python | |
|---|---|
153 154 155 156 157 158 159 | |
SNNVerificationStandard
¶
Evaluate SNN verification evidence against a standard profile.
Source code in src/sc_neurocore/verification/snn_standard.py
| Python | |
|---|---|
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | |
assess(evidence)
¶
Assess evidence against the configured profile.
Source code in src/sc_neurocore/verification/snn_standard.py
| Python | |
|---|---|
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | |
SNNVerificationStandardProfile
dataclass
¶
Named set of requirements for a formal SNN verification claim.
Source code in src/sc_neurocore/verification/snn_standard.py
| Python | |
|---|---|
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | |
to_dict()
¶
Return a JSON-ready profile.
Source code in src/sc_neurocore/verification/snn_standard.py
| Python | |
|---|---|
136 137 138 139 140 141 142 | |
VerificationClaimStatus
¶
Bases: Enum
Status of one evidence item or standard requirement.
Source code in src/sc_neurocore/verification/snn_standard.py
| Python | |
|---|---|
50 51 52 53 54 55 56 | |
VerificationEvidenceKind
¶
Bases: Enum
Kinds of evidence accepted by the standard.
Source code in src/sc_neurocore/verification/snn_standard.py
| Python | |
|---|---|
38 39 40 41 42 43 44 45 46 47 | |
VerificationLevel
¶
Bases: Enum
Evidence levels for SNN verification claims.
Source code in src/sc_neurocore/verification/snn_standard.py
| Python | |
|---|---|
28 29 30 31 32 33 34 35 | |
assess_snn_verification_standard(evidence, profile=None)
¶
Assess evidence against the default or supplied SNN verification profile.
Source code in src/sc_neurocore/verification/snn_standard.py
| Python | |
|---|---|
330 331 332 333 334 335 | |
publication_grade_snn_standard_profile()
¶
Return the default formal SNN verification standard profile.
Source code in src/sc_neurocore/verification/snn_standard.py
| Python | |
|---|---|
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | |