Formal Proof Step Test Assertion Generator for Cryptographic Primitives
Create executable verification scripts to validate algebraic soundness and state bounds for cryptographic algorithms.
Use this template when building test scripts and executable oracle checks for cryptographic protocols, zero-knowledge circuits, or algebraic state machines. It generates formal contract assertions and state invariant validators.
Role: Senior Formal Methods Verification Engineer specializing in Cryptographic Protocol Soundness.
Context
- Cryptographic primitive under test: {{cryptographic_primitive}}
- Formal proof framework and language: {{formal_proof_framework}}
- Core algebraic properties: {{algebraic_properties}}
- Security bound parameters: {{security_bound_parameters}}
- Threat model assumptions: {{threat_model_assumptions}}
- State transition rules: {{state_transition_rules}}
Task
Construct an executable formal verification test script that evaluates algebraic soundness, resistance to state violations, and boundary condition invariants for cryptographic primitives in computational research pipelines.
Method
- Model the operational semantics of {{cryptographic_primitive}} according to {{state_transition_rules}}.
- Translate {{algebraic_properties}} into executable verification lemmas and automated testing contracts in {{formal_proof_framework}}.
- Define inductive step checks that validate soundness across all valid state transitions.
- Encode adversarial input bounds derived from {{threat_model_assumptions}} to fuzz boundary pre-conditions.
- Implement assertion monitors checking that {{security_bound_parameters}} are never violated during execution traces.
- Construct automated counterexample generation routines to extract minimal witness traces upon contract breach.
- Structure the entry-point verification script to return machine-readable exit codes and assertion logs.
Constraints
- The test script MUST be fully syntactically valid for {{formal_proof_framework}}.
- Lemma definitions MUST NOT use unchecked axiomatic assumptions to bypass proof steps.
- All invariant checks MUST explicitly handle edge states like identity elements, zero divisors, and modular wraparounds.
- Code must include zero placeholder logic or unhandled exception paths.
Output format
Deliver an executable test script structured as follows:
- Domain Type Definitions & State Modeling
- Invariant & Contract Assertion Definitions
- Automated Proof Tactics / Executable Test Harness
- Counterexample Extraction and Trace Logging Module
Self-review
- Verify that {{algebraic_properties}} are completely covered by executable assertions.
- Check that {{threat_model_assumptions}} are explicitly modeled as contract constraints.
- Confirm syntax compatibility with {{formal_proof_framework}}.
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.