Performs abstract interpretation to produce summarized execution traces and high-level program behavior representations. Highlights key control flow paths, variable relationships, loop invariants, function summaries, and potential runtime states using abstract domains (intervals, signs, nullness, etc.). Use when analyzing program behavior, understanding execution paths, computing loop invariants, tracking variable ranges, detecting potential runtime errors, or generating program summaries without concrete execution.
84
77%
Does it follow best practices?
Impact
94%
1.38xAverage score across 3 eval scenarios
Passed
No known issues
Optimize this skill with Tessl
npx tessl skill review --optimize ./skills/abstract-trace-summarizer/SKILL.mdThis skill performs abstract interpretation to analyze program behavior and produce summarized execution traces. It computes over-approximations of possible runtime states, tracks control flow paths, infers variable relationships, and generates high-level behavioral summaries without requiring concrete program execution.
Initial Assessment:
Abstract Domain Selection:
Choose domains based on analysis needs:
Numerical domains:
[min, max]±x ±y ≤ cNon-numerical domains:
Relational vs non-relational:
Build Control Flow Graph (CFG):
Represent program structure:
Entry → Statement₁ → Statement₂ → ... → Exit
↓ (branch)
Statement₃ → ...Identify key structures:
Path analysis:
Transfer Functions:
Model how statements affect abstract states:
Assignment: x = expr
1. Evaluate expr in current abstract state
2. Update abstract state for variable x
3. Propagate to successor statesConditional: if (condition)
1. Evaluate condition in current abstract state
2. Refine state for true branch (assume condition holds)
3. Refine state for false branch (assume condition doesn't hold)
4. Analyze both branches separatelyLoop: while (condition)
1. Compute fixpoint at loop head using widening
2. Analyze loop body with refined state
3. Optionally apply narrowing for precision
4. Extract loop invariant from fixpointFunction call: y = f(x)
1. Look up or compute function summary
2. Apply preconditions to arguments
3. Update state with postconditions
4. Handle side effectsLattice Operations:
Join (∪): Merge states from different paths
Example: [1,5] ∪ [3,8] = [1,8]
Use: At control flow merge pointsMeet (∩): Refine state with constraints
Example: [1,10] ∩ [5,15] = [5,10]
Use: When adding constraints from conditionsWidening (∇): Accelerate convergence for loops
Example: [0,n] ∇ [0,n+1] = [0,+∞]
Use: At loop heads to ensure terminationNarrowing (△): Refine widened results
Example: [0,+∞] △ [0,100] = [0,100]
Use: After widening to improve precisionData Dependencies:
Track how variables affect each other:
Relational Constraints:
For relational domains, track constraints:
Intervals: x ∈ [0,10], y ∈ [5,15]
Octagons: x - y ≤ 5, x + y ≤ 20
Polyhedra: 2x + 3y ≤ 30, x - y ≥ 0Equality Tracking:
After x = y: track that x and y have equal values
After x = y + 1: track that x = y + 1Fixpoint Computation:
1. Initialize loop head state
2. Analyze loop body
3. Compute join of entry state and back-edge state
4. Apply widening if not converged
5. Repeat until fixpoint reached
6. Optionally apply narrowingLoop Invariant:
Properties that hold at loop head:
Example: for i in range(n):
Invariant: 0 ≤ i < nLoop Bounds:
Estimate iteration counts:
for i in range(10) → 10 iterationsfor i in range(n) → n iterationswhile condition → unknown iterationsLoop Effects:
Summarize loop behavior:
Compute Function Summaries:
Preconditions: Required input states
Example: def divide(a, b)
Precondition: b ≠ 0Postconditions: Guaranteed output states
Example: def abs(x)
Postcondition: result ≥ 0Side effects: Modifications to global state
Example: def append(list, item)
Side effect: list length increases by 1Frame conditions: What remains unchanged
Example: def get_first(list)
Frame: list is not modifiedModular Analysis:
Analyze functions separately:
Generate High-Level Summary:
Execution paths:
Path 1: Entry → L1 → L2 → L5 → Exit
Condition: x > 0
Result: returns positive value
Path 2: Entry → L1 → L3 → L4 → Exit
Condition: x ≤ 0
Result: returns zero or negative valueKey control flow:
- 3 conditional branches
- 2 loops (nested)
- 5 function calls
- 1 exception handlerVariable states:
Entry: x ∈ ℤ, y ∈ ℤ
Exit: result ∈ [0, +∞]
Invariant: x + y ≤ 100Potential runtime states:
Normal termination: 85% of paths
Exception thrown: 15% of paths
Infinite loop: Not possible (proven)Structure the abstract trace summary as follows:
## Program Summary
- **Language**: [Programming language]
- **Scope**: [Function/Module/Program name]
- **Analysis Type**: [Abstract domain(s) used]
## Control Flow Structure
- **Total paths**: [Number of execution paths]
- **Loops**: [Number and nesting depth]
- **Conditionals**: [Number of branches]
- **Function calls**: [Number of calls]
## Abstract States
### Entry State
[Initial abstract state for variables]
### Key Program Points
**Location L1**: [Statement or label][Abstract state at this point]
**Location L2**: [Statement or label][Abstract state at this point]
### Exit State
[Final abstract state for variables]
## Variable Relationships
[Tracked relationships and constraints between variables]
## Loop Invariants
**Loop at L[X]**:
- **Invariant**: [Properties that hold at loop head]
- **Bound**: [Iteration count estimate]
- **Effect**: [How loop modifies state]
## Function Summaries
**Function [name]**:
- **Precondition**: [Required input conditions]
- **Postcondition**: [Guaranteed output conditions]
- **Side effects**: [Modifications to global state]
- **Complexity**: [Time/space complexity]
## Execution Paths
### Path 1: [Description]
**Condition**: [Path condition]
**Trace**: [Sequence of program points]
**Result**: [Final state or return value]
### Path 2: [Description]
**Condition**: [Path condition]
**Trace**: [Sequence of program points]
**Result**: [Final state or return value]
## Potential Runtime Behaviors
- **Normal termination**: [Conditions and states]
- **Exceptions**: [Possible exceptions and conditions]
- **Non-termination**: [Infinite loops or recursion]
- **Resource usage**: [Memory, time estimates]
## Safety Properties
- **Buffer safety**: [Array bounds checking results]
- **Null safety**: [Null pointer dereference analysis]
- **Type safety**: [Type correctness analysis]
- **Arithmetic safety**: [Overflow/underflow analysis]
## Recommendations
[Suggestions for improving code based on analysis]# Code
for i in range(n):
sum += arr[i]
# Analysis
Entry: sum = 0, i = ⊤, n ∈ [0,+∞]
Loop head: sum ∈ [0,+∞], i ∈ [0,n-1]
Loop invariant: 0 ≤ i < n, sum ≥ 0
Exit: sum ∈ [0,+∞], i = n# Code
if x > 0:
result = x
else:
result = -x
# Analysis
Entry: x ∈ ℤ
Branch 1 (x > 0): x ∈ [1,+∞], result = x ∈ [1,+∞]
Branch 2 (x ≤ 0): x ∈ [-∞,0], result = -x ∈ [0,+∞]
Join: result ∈ [0,+∞]// Code
if (obj != null) {
return obj.getValue();
}
return -1;
// Analysis
Entry: obj ∈ {null, non-null, ⊤}
Branch 1 (obj != null): obj = non-null, access SAFE
Branch 2 (obj == null): obj = null, no dereference
Result: No null pointer dereference possible# Code
for i in range(len(arr)):
arr[i] = 0
# Analysis
Entry: arr has length L ∈ [0,+∞]
Loop: i ∈ [0, L-1]
Access: arr[i] where i ∈ [0, L-1] ⊆ [0, L-1]
Result: All accesses are safeUse when:
Use when:
Use when:
Comprehensive guide to abstract interpretation concepts including abstract domains, lattice operations, transfer functions, control flow analysis, variable relationship tracking, runtime state abstraction, trace summarization techniques, and precision vs performance trade-offs.
Complete examples of abstract trace summarization for various program patterns including simple loops, conditional branches, nested loops, pointer analysis, exception flow, recursive functions, concurrent programs, array bounds checking, string analysis, and state machines.
0f00a4f
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.