Neural Formal Verification Engine — GNN proposes, Z3 disposes
Project description
_
___ ___ __ _ _ _ ___ _ _| |_
(_-</ -_) _` | || / -_) ' \ _|
/__/\___\__, |\_,_\___|_||_\__|
|_|
Neural Formal Verification Engine — GNN proposes, Z3 disposes.
Sequent is a neurosymbolic Python debugger that proves your code correct — or finds the exact counterexample that breaks it.
How it works
Python Source → AST Parser → GATv2 (10M params) → Bug Predictions
→ Z3 SMT Solver → Formal Proofs
→ Consensus Vote → Verdict + Counterexample
→ Auto-Repair → Re-Verify
- GNN proposes: A GATv2 graph neural network reads your Python AST and predicts which nodes are likely bugs
- Z3 disposes: The Z3 SMT solver formally verifies 8 property classes against your code
- Consensus: Neural predictions are merged with formal proofs — both must agree
- Auto-repair: If a bug is found, Sequent generates a fix and re-verifies it through Z3
Install
pip install sequent
Usage
# Verify a file
sequent check main.py
# Verify a specific function
sequent check main.py -f binary_search
# Auto-repair detected bugs
sequent check main.py --repair -v
# Export proof certificate
sequent check main.py --cert report.json
# JSON output for CI
sequent check main.py --json
Example
$ sequent check test_buggy.py
binary_search ✗ BUG DETECTED (42ms)
────────────────────────────────────────────────────────
GNN Buggy (87.3%) 12ms
⚑ Suspect lines: [4]
Z3 ✗ counterexample 28ms
✗ loop_invariant: Loop uses '<' instead of '<=': misses case when low == high
↳ counterexample: {"low": "n", "high": "n"}
────────────────────────────────────────────────────────
Consensus: BUG CONFIRMED: GNN detected bug and Z3 produced a formal counterexample.
safe_divide ✓ VERIFIED (18ms)
────────────────────────────────────────────────────────
Consensus: VERIFIED: Both GNN and Z3 agree — no bugs detected.
Supported bug classes
| Bug Type | Description |
|---|---|
off_by_one |
Loop bounds off by 1 (< vs <=) |
boundary_error |
Array/index out of bounds |
wrong_operator |
Incorrect comparison/arithmetic operators |
none_deref |
Missing null/None checks |
integer_overflow |
Unchecked arithmetic overflow |
missing_return |
Missing return in code path |
wrong_init |
Incorrect variable initialization |
Z3 property checks
- Comparison consistency (off-by-one in loops)
- Array index bounds (upper and lower)
- None/null safety
- Return completeness
- Division by zero / arithmetic safety
- Loop termination and invariants
- Dead code detection
Architecture
- Model: GATv2 with 8 attention heads, 256 hidden channels, 3 layers (~10M params)
- Graph: Code Property Graph (CPG) = AST + CFG + data flow
- Features: 91 AST node types + structural features (depth, subtree size, loop/conditional context)
- Edges: Parent↔child (AST) + control flow (CFG) + data flow (def → use)
- Training: Focal loss + NT-Xent contrastive loss with Z3 verification outcomes as supervision
- Dataset: 14,144 synthetic mutations from 164 seed functions, seed-level train/test split
- Metrics: 74.0% accuracy, 83.0% precision, 73.6% recall, 78.0% F1
Web playground
# Start the API server
pip install sequent[server]
python -m backend.server
# Start the frontend (development)
cd frontend && npm install && npm run dev
GitHub Action
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: pip install sequent
- run: sequent check src/ --ci --cert sequent-report.json
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sequent_verify-0.1.0.tar.gz
(77.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sequent_verify-0.1.0.tar.gz.
File metadata
- Download URL: sequent_verify-0.1.0.tar.gz
- Upload date:
- Size: 77.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d306f6b150221cd8765df263735d0f64d92cba17007242ccb6c80b25fee5859c
|
|
| MD5 |
e8196c095402a72f9f4a5f0d9bc73368
|
|
| BLAKE2b-256 |
3b1b6c2b3579efb9bd8e2c2ac52600378a242e17f80595148c264e11cf17a489
|
File details
Details for the file sequent_verify-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sequent_verify-0.1.0-py3-none-any.whl
- Upload date:
- Size: 74.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2e5dacc7ca8e45f4f80c10ef4ecb0faff3f98731a529bfd8c1dcaa7cd3ae329
|
|
| MD5 |
5db1c55e6890bfc7593ede908c9173b4
|
|
| BLAKE2b-256 |
2e337b7ff73d801c6b577f98c600095059a4f35f52f570678f2d51558c36b14b
|