abstract-invariant-generator

Solid

Uses abstract interpretation to automatically infer loop invariants, function preconditions, and postconditions for formal verification. Generates invariants that capture program behavior and support correctness proofs in Dafny, Isabelle, Coq, and other verification systems. Use when adding formal specifications to code, generating verification conditions, inferring contracts for functions, or discovering loop invariants for proofs.

Testing & QA 160 stars 17 forks Updated today Apache-2.0

Install

View on GitHub

Quality Score: 87/100

Stars 20%
73
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# Abstract Invariant Generator ## Overview This skill uses abstract interpretation to automatically infer loop invariants, function preconditions, and postconditions. It generates formal specifications that support verification and reasoning about program correctness. ## Invariant Generation Workflow ### Step 1: Identify Specification Points Analyze the code to identify where invariants are needed: **Loop Invariants**: For each loop ```python while condition: # Need: invariant that holds before/after each iteration body ``` **Function Contracts**: For each function ```python def function(params): # Need: precondition (what must be true on entry) body # Need: postcondition (what is guaranteed on exit) ``` **Assertions**: For verification points ```python # Need: invariant that holds at this point assert property ``` ### Step 2: Perform Abstract Interpretation Use abstract domains to infer properties: **Interval Analysis**: Infer numeric ranges ```python i = 0 while i < n: # Inferred: 0 ≤ i < n i += 1 # Inferred: i = n ``` **Relational Analysis**: Infer relationships between variables ```python i = 0 j = 0 while i < n: # Inferred: i = j i += 1 j += 1 ``` **Shape Analysis**: Infer data structure properties ```python while node is not None: # Inferred: node is in the linked list node = node.next ``` ### Step 3: Generate Loop Invariants For each loop, generate an invariant that: 1. Holds before the loop (initialization...

Details

Author
ArabelaTso
Repository
ArabelaTso/Skills-4-SE
Created
6 months ago
Last Updated
today
Language
Python
License
Apache-2.0

Similar Skills

Semantically similar based on skill content — not just same category

Data & Documents Solid

abstract-state-analyzer

Performs abstract interpretation over source code to infer possible program states, variable ranges, and data properties without executing the program. Reports potential runtime errors including out-of-bounds accesses, null dereferences, type inconsistencies, division by zero, and integer overflows. Use when analyzing code for potential runtime errors, performing static analysis, checking safety properties, or verifying program behavior without execution.

160 Updated today
ArabelaTso
Data & Documents Solid

control-flow-abstraction-generator

Generate abstract Control Flow Graph (CFG) representations of programs showing loops, branches, and function calls for static analysis or verification. Use when users need to: (1) Visualize program control flow structure, (2) Generate CFGs for static analysis tools, (3) Create control flow abstractions for formal verification, (4) Analyze program paths and reachability, (5) Document program structure. Supports both function-level (intraprocedural) and program-level (interprocedural) analysis with multiple output formats (textual, DOT/Graphviz, JSON).

160 Updated today
ArabelaTso
AI & Automation Solid

abstract-domain-explorer

Applies abstract interpretation using different abstract domains (intervals, octagons, polyhedra, sign, congruence) to statically analyze program variables and infer invariants, value ranges, and relationships. Use when analyzing program properties, inferring loop invariants, detecting potential errors, or understanding variable relationships through static analysis.

160 Updated today
ArabelaTso