CAIN-42 CAIN Studio
CAIN-42 Academy

CFVE · Module 2 of 5 · 13 min

Compiling code into logic

To verify code, translate it into the solver's language: variables become symbolic values, branches become conditional constraints, loops are bounded or summarised.

CAIN's VeriCoding gate compiles a Python subset into Z3 expressions. Unsupported constructs are rejected rather than approximated, so the gate fails closed.

Bounded verification is honest only if the bound is stated: 'no overflow for loops up to 16 iterations' is not 'no overflow'.

Key points

  • Symbolic values, conditional constraints, bounded loops.
  • Reject unsupported constructs.
  • State the bounds.

In the CAIN-42 codebase

  • vericoding-gate/expr_compiler.py — Python-subset → Z3 compiler

Practice check

Practice 1 · choose one

An unsupported construct in VeriCoding is…

Practice 2 · true or false

“A bounded proof should state its bound.”