Under the hood
Aristotle compiles the provided C code deterministically into our proprietary Lean formal model of C execution (onward: the embedding). The proofs Aristotle writes use compositional reasoning based on separation logic. Sources are verified exactly as submitted. Aristotle never edits your C to make it easier to analyze: it does not rewrite a function, replace it with a simpler one, or stub out a dependency.Supported language and platform features
Aristotle supports integers up to 128 bits, pointers, arrays, structures, unions, dynamic allocation and deallocation, loops and recursion. Multiple C files can be combined with checked linking. Support also includes variadic functions, bit-fields, restricted variable-length arrays and selected GCC inline assembly. Floating point. Support covers binary32float, binary64 double and x87 extended-precision
long double, including arithmetic and conversions.
Libraries and input and output. Contracts cover parts of the standard C and POSIX libraries, including
allocation, strings and file I/O. Caller proofs assume these contracts; they do not verify the library or
operating-system implementations. Proof rules also cover buffered file and directory I/O.
Concurrency. Support covers thread creation and joining, mutexes, and sequentially consistent atomics.
Memory leaks. A proof can show that a program frees all the heap memory it allocates by the time main
returns. This covers executions in which main and every thread return normally, not those that end through
exit or abort. You need to explicitly ask for this feature to be enabled in your prompt, as it is not
enabled by default.
Undefined behavior that Aristotle detects
A successful Aristotle proof rules out:- accessing memory outside the allocation that a pointer comes from (its provenance), or after the lifetime of that allocation has ended, such as after it is freed;
- null dereferences, invalid frees and writes to read-only storage;
- integer division by zero, invalid shift counts, and signed arithmetic overflow (in
-fwrapvbuilds, addition, subtraction, negation and multiplication wrap instead); - conflicting accesses to an object that the C sequencing rules leave unordered, such as
i = i++, in any of the evaluation orders that C permits; - incompatible typed accesses under the effective-type (strict-aliasing) rules, which are checked by default
and not in
-fno-strict-aliasingbuilds; - reading a local variable before its first assignment, if its address is never taken;
- using an uninitialized pointer for memory access, arithmetic or a call argument, and reading an
uninitialized
_Bool.
restrict promises.
Other reads of uninitialized integer or floating-point values, for example from heap memory, an array or a
structure field, give an arbitrary value of the type, and a proof must hold for every such value.
Installation
Upload your C files in the web app, or have your AI assistant send them through the MCP server. To submit from the command line, see MCP & CLI. C verification needs no extra setup.Example workflow
This example uses a fixed-capacity ring buffer, split across a headerring_buffer.h:
ring_buffer.c:
ringbuf_spec.md alongside the sources:
.gitignore does. Add --include-ignored to upload what the ignore rules match too,
such as headers a build generates. A link to a file goes up only when the file it points to does too, and a link
to a folder never does. Include every header the sources need and nothing unrelated:
-D, -I, -fno-strict-aliasing, -ffp-contract=off, -fwrapv, etc.) or include your build script.
Also include header files, API docs, and relevant conceptual docs for your code’s non-open-source dependencies.
Also include source code and/or Linux/x86-64 binaries for all transitive non-open-source dependencies, if you want Aristotle to check whether a bug
in your code can be triggered in your setup.
aristotle submit leaves out files whose names end in .o or .so, even with --include-ignored. Other
binaries, such as static libraries (.a), executables, and versioned shared libraries like libz.so.1, follow
the ignore rules like any other file, so pass --include-ignored if an ignore rule matches them. To list what
would go up without sending anything, run the command with --dry-run in place of --wait and --destination.
Aristotle detects C verification from the .c files in the upload. The command creates a project
which you can monitor at Projects.
Without --wait the command returns immediately after creating the project; use aristotle list,
aristotle show <project-id> and aristotle download <project-id> to follow up later.
Before it begins proving, Aristotle reads your sources, builds the call graph from the functions you
named, and may ask a small batch of clarifying questions on the project page: which functions are the
verification targets, what each entry point may assume about its arguments where the code does not
check (non-null, buffer sizes, NUL termination, value ranges). Questions are phrased entirely in terms
of your own function and variable names. Aristotle may ask them while it
works, whether or not you pass --wait, and waits up to 15 minutes for each answer. With --wait at a
terminal, the CLI also shows each question as it arrives and sends your answers. Without it, the command
prints aristotle questions <project-id>, which lists the questions and lets you answer them. If a
question gets no answer in time, Aristotle carries on without it: it verifies what doesn’t need a
decision only you can make, leaves the rest unverified, and names the open question in its summary.
For a batch run nobody will answer, pass --no-questions: Aristotle then asks nothing, and treats
each open decision the same way.
For a run where all the properties are proved you will see a summary like this:
rb_push had instead computed the write
index as size_t tail = rb->head + rb->count;—you will get a message like this:
Specifying what to verify
Properties may be given in the prompt directly or in any text or Markdown file included in the project directory and referenced from the prompt. Write them in terms of your own functions, parameters and struct fields. Useful things to state explicitly:- Which functions are the targets. By default Aristotle verifies the functions you name and every helper they reach in your sources, and reports each of them separately.
- Caller preconditions the code does not check itself: which pointers are non-null, how large the buffers behind them are, which strings are NUL-terminated, which integer arguments are in range, and which buffers must not overlap. If you leave these open, Aristotle will ask, or will state the minimal obligations it needed and report them as caller obligations.
- What “correct” means for functional properties. Memory safety needs no specification beyond the preconditions; functional correctness does.
.c and .h files under the project directory. Functions
called across files within your sources are verified against a single shared specification so that the
results compose.
External libraries
Your code will call functions you did not write. Aristotle treats them as follows:-
The C standard library (glibc). Contracts for the standard headers (
string.h,stdio.h,stdlib.h,ctype.h,errno.h,unistd.h,time.hand many more) are built in and used automatically. Caller obligations they impose, such as a destination buffer being large enough forsprintfoutput, are proved at each call site or reported as obligations on your callers. A few contracts hold only under an assumption about the client program (for example that it neverfcloses a standard stream); Aristotle reports such an assumption when your code depends on it. - Other libraries. By default, Aristotle verifies the supplied code needed for your properties, including supplied library implementations. It may offer to extend verification to additional libraries and continues with the default scope while awaiting your answer. For libraries outside the verification scope, Aristotle reuses applicable contracts or derives contracts from their source code. When source is unavailable, it uses documentation and how your code calls the library. Establishing these contracts does not require your approval. The summary states the assumed behavior and every result that depends on it; the library implementations remain unverified. Obligations imposed on your code must still be proved or stated as caller preconditions.
-
Callbacks your code passes to a library (for example a
qsortcomparator) remain part of the verification scope.
Public Lean specifications
When a result includes public Lean specifications, the archive stores the contracts and supporting definitions underSpec/, alongside your submitted sources, the summary, and any counterexample
reproducers. The project’s Properties table lists each property’s status and shows a Code snippet
when a public Lean specification is available.
The archive also includes the generated function interfaces at <module>/Public.lean and seven public
support files under C2lean/. These include C2lean/Public/Integer.lean, which defines the platform’s
integer bounds used in specifications. Assumptions about the C library appear as an abstract
LibCSpecs S premise, or LibCIOSpecs S for tracked I/O. The property’s prose explains the library
guarantees and restrictions on which it relies.
To build the public specifications locally, install Lean’s elan toolchain manager and follow the
instructions in the downloaded Spec/BUILD.md. Keep the specifications, generated interfaces, and
support files together at their original paths. The instructions specify the Lean toolchain, pinned
public dependencies, Lake configuration, and commands for a fresh project. This build checks that
the published specifications compile; it does not rerun the proofs about your C implementation.
Current assumptions and limitations
Assumptions
Aristotle assumes that:- preprocessing and the translation into the embedding are faithful;
- the compiler has no bugs that affect the program, and does not optimize it based on undefined behavior that the embedding does not detect;
- glibc 2.35 and the Linux kernel behave as their assumed contracts state;
- floating-point operations round to nearest, ties to even, as in IEEE 754, and the program does not change the rounding mode (for example with
fesetround) or depend on floating-point exception flags (for example throughfetestexcept); - the compiler does not fuse separate floating-point operations, such as a multiplication and an addition, into one (compile with
-ffp-contract=off); - the compiler does not assume that a loop without side effects terminates;
- the Lean proof checker is correct, and so is native evaluation where a proof uses it.
Functions Aristotle cannot handle yet
If a function your properties reach cannot be verified yet, the summary lists it by name under “Functions we cannot handle yet”, and the properties that depend on it are not verified. Verification continues for the other properties. Functions your properties never reach do not affect the run.Compiler and platform
Aristotle verifies programs as compiled by GCC 11.4 for Linux on x86-64.Termination
Aristotle does not support reasoning about termination: functional postconditions describe what holds if a function returns.Concurrency and I/O
The proof rules for buffered file and directory I/O are not yet formally proved sound with respect to the embedding. Aristotle does not support weak-memory concurrency or device I/O throughvolatile.
Liveness and complexity
Aristotle does not support reasoning about deadlock freedom, program complexity or constant-time execution.Unsupported constructs
Aristotle does not support complex or decimal arithmetic, binary128 types (_Float128, __float128), or vector operations. It supports setjmp and longjmp only where the C standard allows a call of setjmp, and thread-local objects only in programs that run a single thread.
Integer-to-pointer casts
Pointers reconstructed from integer addresses support some equality comparisons, but do not regain permission to access an allocation. Unsupported uses include memory access, nonzero offsets, ordering or subtraction against allocation pointers,free/realloc, mutex operations and indirect calls, even after a pointer-to-integer-to-pointer round trip.