OpenParable
Skip to content
← Back to skills

Loop Invariant Generator

Testing & Quality
loop-invariant-generator

Loop 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

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. 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

  1. Code Analysis: Analyze loop structure and identify key properties
  2. Candidate Generation: Generate candidate invariants from code patterns
  3. Verification: Check initialization, maintenance, termination
  4. Strengthening: Refine invariants to prove desired properties
  5. Export: Generate proof obligations for theorem provers

Tools/Libraries

  • Dafny
  • Why3
  • SMT solvers (Z3, CVC5)
  • Static analysis frameworks