3 This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
7 This is an ACSL (ANSI/ISO C Specification Language) formal verification project demonstrating array search algorithms with varying specification complexity. The project uses Frama-C with the WP plugin for automated proof verification.
11 ### Header Organization
12 The project uses a layered header architecture separating user-facing API from proof infrastructure:
14 - **`inc/types.h`** - Basic type definitions
15 - **`inc/algos.h`** - Public API with function declarations
16 - **`inc/proof/`** - Proof infrastructure (separate from user-facing API)
17 - **`existence.h`** - Element existence predicates and lemmas
18 - **`search.h`** - Logic functions with comprehensive lemmas
20 ### Selective Axiom Architecture
21 Each source file includes only the axioms it needs for optimal verification performance. This design achieves both elegant organization and fast verification by avoiding unnecessary axiom verification overhead.
25 Uses Meson build system with custom Frama-C verification tests.
30 meson compile -C build
35 # Run all verification tests
38 # Run specific test by name
39 meson test -C build [test_name]
41 # Verbose test output (shows detailed Frama-C profiling)
42 meson test -C build --verbose
45 ### Performance Analysis
46 The verbose test output provides detailed profiling information including individual proof goal timing, timeout identification, prover statistics, and total verification time. Use this for identifying performance bottlenecks.
48 ## Verification Details
51 Functions use ACSL contracts with varying levels of abstraction - from basic behavioral contracts with inline quantifiers to abstract logic functions. The choice depends on verification performance vs specification elegance trade-offs.
53 ### Frama-C Configuration
54 Tests run with comprehensive verification flags: `-wp -wp-rte -wp-prover cvc4 -verbose 2 -wp-verbose 3 -wp-debug 1 -wp-proof-trace`
56 ## Development Workflow
58 When adding new algorithms or modifying specifications:
59 1. Create source files with inline ACSL contracts
60 2. Include appropriate headers from `inc/proof/` for needed axioms
61 3. Update `meson.build` to add new test cases
62 4. Run verification tests to ensure proofs pass
63 5. Use verbose output to optimize performance if needed
64 6. Never commit unless verification succeeds
66 The architecture prioritizes both mathematical elegance and verification performance through selective axiom inclusion.