acsl-annotation-assistant

Solid

Create ACSL (ANSI/ISO C Specification Language) formal annotations for C/C++ programs. Use this skill when working with formal verification, adding function contracts (requires/ensures), loop invariants, assertions, memory safety annotations, or any ACSL specifications. Supports Frama-C verification and generates comprehensive formal specifications for C/C++ code.

AI & Automation 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

# ACSL Annotation Assistant Generate comprehensive ACSL (ANSI/ISO C Specification Language) annotations for C/C++ programs to support formal verification with tools like Frama-C. ## Core Capabilities ### 1. Function Contracts Add complete function specifications with preconditions and postconditions: ```c /*@ requires \valid(array + (0..n-1)); requires n > 0; ensures \result >= 0 && \result < n; ensures \forall integer i; 0 <= i < n ==> array[\result] >= array[i]; assigns \nothing; */ int find_max_index(int *array, int n); ``` ### 2. Loop Annotations Generate loop invariants, variants, and assigns clauses: ```c /*@ loop invariant 0 <= i <= n; loop invariant \forall integer k; 0 <= k < i ==> sum == \sum(0, k, array); loop assigns i, sum; loop variant n - i; */ for (i = 0; i < n; i++) { sum += array[i]; } ``` ### 3. Memory Safety Specifications Add pointer validity and separation annotations: ```c /*@ requires \valid(dest + (0..n-1)); requires \valid_read(src + (0..n-1)); requires \separated(dest + (0..n-1), src + (0..n-1)); ensures \forall integer i; 0 <= i < n ==> dest[i] == \old(src[i]); assigns dest[0..n-1]; */ void memcpy_safe(char *dest, const char *src, size_t n); ``` ### 4. Assertions and Assumptions Insert runtime and verification assertions: ```c //@ assert 0 <= index && index < array_length; //@ assume divisor != 0; ``` ### 5. Axiomatic Definitions and Predicates Define reusable logical predicates and axioms: ```c /*@ ...

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