home / skills / a5c-ai / babysitter / termination-analyzer
This skill helps prove termination of algorithms by automatically identifying ranking functions, well-founded orderings, and generating formal termination
npx playbooks add skill a5c-ai/babysitter --skill termination-analyzerReview the files below or copy the command above to add this skill to your agents.
---
name: termination-analyzer
description: Prove termination of algorithms and programs using ranking functions and well-founded orderings
allowed-tools:
- Bash
- Read
- Write
- Edit
- Glob
- Grep
metadata:
specialization: computer-science
domain: science
category: algorithm-analysis
phase: 6
---
# Termination Analyzer
## Purpose
Provides expert guidance on proving termination of algorithms through ranking functions, well-founded orderings, and automated analysis.
## Capabilities
- Identify ranking/variant functions automatically
- Prove well-founded orderings
- Handle mutual recursion
- Detect potential non-termination
- Generate termination certificates
- Analyze complex control flow
## Usage Guidelines
1. **Structure Analysis**: Identify recursive calls and loop structures
2. **Ranking Function**: Find or construct appropriate ranking function
3. **Ordering Proof**: Prove well-foundedness of the ordering
4. **Certificate Generation**: Generate formal termination proof
5. **Non-termination Detection**: Flag potential infinite loops
## Tools/Libraries
- AProVE
- T2
- Ultimate Automizer
- SMT solvers
This skill proves termination of algorithms and programs by synthesizing ranking functions and establishing well-founded orderings. It combines automated analysis with human-guided inspection to detect non-termination, handle mutual recursion, and produce formal termination certificates. The focus is on practical, checkable proofs that integrate with SMT solvers and termination tools.
The analyzer inspects control flow to identify loops, recursive calls, and mutual recursion patterns. It attempts to synthesize ranking (variant) functions or lexicographic combinations that strictly decrease along every call or iteration, and then proves well-foundedness of the induced ordering. When synthesis succeeds, it can emit a machine-checkable termination certificate; when it fails, it highlights counterexamples and potential infinite traces.
What kinds of ranking functions are supported?
Supports linear, polynomial, norm-based, and lexicographic ranking functions, plus user-provided measures to guide synthesis.
Can it produce machine-checkable certificates?
Yes. When a proof is found, the skill can generate a certificate compatible with SMT solvers and common termination checkers.
How does it handle mutual recursion?
It constructs a global well-founded ordering or tuple-based measures that jointly decrease across the mutually recursive calls.