flang the compiler proves your program cannot hang 0.9.0 GitHub Try in the browserTry it Русский

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 terminationFunctionsRun-time check
No recursion15278no
Recursion on a part of the argument: a list tail, a field627no
неотрицательное goes down by 167no
число goes down by a constant70yes
A declared measure (убывает)14yes

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

WhatHow many
Kinds of proof steps that have a lemma in Lean 493 of 93
Paths by which the second checking program accepts a record, with a theorem45 of 52
Corrupted proof records accepted by the checker program0 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

WhatCommand
The proof report of one fileflang check <file> --proof
The same as JSONflang check <file> --proof --json
Code 0 only if everything is provedflang check <file> --proof --strict
Code 0 only if the independent check repeated every proofflang check <file> --proof --independent

Next