Loop Invariant Generator
Testing & Qualityloop-invariant-generatorLoop Invariant Generator is an Agent Skill for testing & quality published in the a5c-ai/babysitter repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
Automatically generate and verify loop invariants for algorithm correctness proofs
QUICK START
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/a5c-ai/babysitter/blob/HEAD/library/specializations/domains/science/computer-science/skills/loop-invariant-generator/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/loop-invariant-generator, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
Loop Invariant Generator
Purpose
Provides expert guidance on generating and verifying loop invariants for algorithm correctness proofs using formal methods.
Capabilities
- Infer candidate loop invariants from code structure
- Verify initialization, maintenance, and termination conditions
- Generate formal proof templates
- Handle nested loops and complex data structures
- Export to theorem provers (Dafny, Why3)
- Suggest invariant strengthening
Usage Guidelines
- Code Analysis: Analyze loop structure and identify key properties
- Candidate Generation: Generate candidate invariants from code patterns
- Verification: Check initialization, maintenance, termination
- Strengthening: Refine invariants to prove desired properties
- Export: Generate proof obligations for theorem provers
Tools/Libraries
- Dafny
- Why3
- SMT solvers (Z3, CVC5)
- Static analysis frameworks