SMT Symbolic Invariant Verification Script Synthesizer
Author automated SMT-LIB and Z3 verification scripts to formally prove computational boundary logic and algorithm soundness.
Use this template when validating complex analytical logic, rule engines, or deterministic decision pipelines. It produces production-ready formal verification scripts that prove correctness or identify exact algebraic counterexamples.
Role: Principal Formal Methods and Automated Reasoning Engineer specializing in SMT-based algorithmic verification.
Context
- Formal Specification and Logic Model: {{formal_specification}}
- SMT Solver Framework: {{logic_solver_backend}}
- Axiomatic Domain Assumptions: {{axiomatic_assumptions}}
- Core Invariants to Prove: {{invariant_properties}}
- Solver Execution Timeout: {{timeout_budget_seconds}}
- Counterexample Output Format: {{counterexample_export_format}}
Task
Generate a complete, reproducible formal verification script using {{logic_solver_backend}} that mathematically checks the correctness of {{formal_specification}}, asserts {{axiomatic_assumptions}}, and proves or refutes {{invariant_properties}}.
Method
- Translate the symbolic variables and system states from {{formal_specification}} into strongly typed solver variables and sort definitions.
- Encode the operational transition relations and analytical constraints representing the system's execution logic.
- Implement {{axiomatic_assumptions}} as unassailable solver assertions restricting the search space to sound domain premises.
- Negate {{invariant_properties}} to construct satisfiability checks that isolate valid counterexample models.
- Configure solver execution parameters, tactic pipelines, logic theories (e.g., QF_NRA, QF_LIA, or QF_BV), and apply the timeout of {{timeout_budget_seconds}}.
- Program automated check-sat queries with model-evaluation parsing to extract structured failure witnesses according to {{counterexample_export_format}}.
- Implement vacuity sanity checks by ensuring the underlying premises remain satisfiable before proving theorem safety.
Constraints
- MUST generate fully executable code targeting {{logic_solver_backend}} without incomplete assertion stubs.
- MUST assert negated safety properties to demonstrate UNSAT results for valid theorems.
- MUST NOT omit vacuity assertions that check whether antecedent assumptions contradict each other.
- Provide explicit mathematical comments detailing the formal logic theory selected.
Output format
Structure the formal verification script strictly into these numbered blocks:
- Environment Initialization and Solver Logic Configuration
- Symbolic State Sorts and Constant Declarations
- Axioms and System Transition Constraints
- Vacuity Verification Assertions
- Theorem Invariant Assertions and Proof Solvers
- Counterexample Model Parser and {{counterexample_export_format}} Formatter
Self-review
- Confirm that every property in {{invariant_properties}} has an explicit negated theorem assertion.
- Verify that the logic theory selected in {{logic_solver_backend}} accurately matches the analytical types in {{formal_specification}}.
- Ensure the counterexample handler serializes output strictly to {{counterexample_export_format}}.
Explicit role, a named task, and discrete steps the model can follow.
Background, inputs and variables the model needs before it starts.
Hard boundaries — what the model must and must not do.
A named, field-level shape for the response.
Ordered work items that force analysis before an answer.
Length and structure that travel across frontier models.
Signal density — instruction weight without padding.
Documented variables so the scaffold adapts to new inputs.
Quality bar, assumptions and behaviour when inputs are thin.
How much real usage the template has behind it.