Property certification and counterexample API
Prefer PropertyModelWrapper.certify_properties for ordinary use. These
functions implement the same property certification workflow.
Reports distinguish whole-domain certification, unresolved cells and witnessed
violations; a negative relaxation bound alone does not establish a violation.
Certification
Explicit evaluation properties use fresh graphs and original boxes without
changing the training specifications or stored partition. Lazy property datasets
support full-box certification without refinement or complete solving; explicit
properties are required for those operations.
Check general specifications over the full declared input regions.
Each original region remains covered during optional refinement. The method computes fresh bounds and can pass unresolved cells to alpha-beta-CROWN. Separate properties construct fresh graphs and do not change training specifications or the stored partition.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wrapper
|
PropertyModelWrapper
|
Model, bound options and input specifications. |
required |
method
|
str
|
Sound bound method: IBP, CROWN-IBP, CROWN or ALPHA-CROWN. |
'CROWN'
|
refine
|
bool
|
Whether to subdivide unresolved cells within the refinement budget. |
True
|
complete
|
bool
|
Whether to invoke alpha-beta-CROWN on unresolved requirements. |
False
|
max_cells
|
int
|
Cell limit per original box; None uses the wrapper setting. |
None
|
max_depth
|
int
|
Split-depth limit; None uses the wrapper setting. |
None
|
results_path
|
str
|
Solver-artifact directory; required for complete verification. |
None
|
timeout
|
float
|
Positive solver time limit in seconds per unresolved requirement. |
60
|
properties
|
Sequence[PropertySpec]
|
Separate specifications to evaluate from their original boxes. |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
Whole-cover certified flag, per-property summaries, per-cell bounds and outcomes, method and elapsed seconds. A lazy property dataset instead returns aggregate counts and margins and requires refine=False and complete=False. |
Source code in CTRAIN/eval/properties.py
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 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 | |
Compute fresh full-box bounds for every region in a lazy property dataset.
Returns aggregate certification counts and lower margins without materialising all endpoints or consuming the dataset's random sampling stream. Detailed cell refinement and complete verification use explicit property boxes.
Source code in CTRAIN/eval/properties.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
Counterexample search
find_counterexample searches one declared box for an input that violates the
formula's Boolean semantics, including strictness and ties. It returns the
checked input as a CPU Python list, or None if no violation was found. An
unsuccessful search is not a certificate. Model modes, buffers and existing
parameter gradients are preserved.
Search an input box for a concrete violation of the output formula.
Projected gradient-sign steps minimise the satisfaction margin. Returns a violating input as a list, or None when no violation was found. The search uses inward-rounded endpoints and preserves caller modes and gradient flags.
Source code in CTRAIN/eval/properties.py
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 | |