What is proved in flang itself
This page answers the question: how many functions and postconditions are proved in the code of the language itself. The compiler, the standard library and the examples are written in flang and checked by the same kernel as your programs.
The repository has 1747 flang files with 18260 functions. The numbers on this page are substituted when the site is built, from a full check of the repository. It takes several hours, so the numbers may lag behind the code by a few days.
Termination: 16056 functions of 18260
| What proves termination | Functions | Run-time check |
|---|---|---|
| No recursion | 15278 | no |
| Recursion on a part of the argument: a list tail, a field | 627 | no |
неотрицательное goes down by 1 | 67 | no |
число goes down by a constant | 70 | yes |
A declared measure (убывает) | 14 | yes |
In the last two rows a число goes down, that is, binary64: for a large х the expression х минус 1 equals х. So the compiler leaves a check in the code.
The remaining 2204 functions are declared without the word тотальная. Three of them are not supposed to terminate: they are the main loop of the interpreter, which runs someone else's program.
The row about the declared measure is related to a known error of the check. About it: What you are trusting.
Postconditions: 8238 of 12000
8238 postconditions of 12000 are proved for all inputs. 0 are refuted. The rest passed on tests only or have neither a proof nor tests. They are checked at run time.
What each answer means: How to read the report.
What is checked about the check itself
| What | How many |
|---|---|
| Kinds of proof steps that have a lemma in Lean 4 | 93 of 93 |
| Paths by which the second checking program accepts a record, with a theorem | 45 of 52 |
Corrupted proof records accepted by the checker program | 0 of 833 |
What stands behind each row and what these numbers do not cover: What you are trusting. The commands that produce the numbers are there too.
The compiler's own code is not checked in full
flang check stops a check that went over the step limit, with the code FLANG_RECURSION_LIMIT. On the largest files of the compiler this happens before all tests and proofs are checked. The key --step-limit N raises the limit.
Files with declared categories and processes are checked in part. The compiler says so in its output and exits with code 2.
How to check it yourself
| What | Command |
|---|---|
| The proof report of one file | flang check <file> --proof |
| The same as JSON | flang check <file> --proof --json |
| Code 0 only if everything is proved | flang check <file> --proof --strict |
| Code 0 only if the independent check repeated every proof | flang check <file> --proof --independent |
Next
- What you are trusting — what stands behind the word «доказано».
- Known limitations — what the language cannot do.
- Comparison on classic lemmas — what the kernel takes from 75 lemmas of Coq and Lean textbooks.