Re-proving native_decide facts in Lean's kernel: a study of 16 public packages and a converter
Abstract
Lean's native_decide proves a decidable proposition by running compiled code and records the result as an axiom. Mathlib forbids such axioms, and lake check and Comparator in Lean 4.35 reject them, as do the independent proof checkers. NativeTrust re-proves the recorded facts in Lean's kernel, with only the standard axioms and without editing the projects that contain them. Where a definition blocks kernel evaluation and NativeTrust has a version proved equal to it (for example, a fuel-indexed form of well-founded recursion), the converter evaluates a copy that uses that version. It then proves the copy equal to the original, usually by congruence. With its default settings it converts 98.2% of 52,821 native facts in 16 public packages. The three largest packages hold 94% of these facts; outside them it converts 68.5%. Nearly every converted fact needed nothing beyond plain kernel evaluation. Two tools remove the native axioms that the kernel can prove within a budget: a single import that makes each call of the tactic try the kernel first, and a source rewriter.
In plain words
Proof assistants such as Lean check proofs with a trusted core. A popular shortcut lets Lean accept a fact by running compiled code instead, which means trusting the compiler as well. Lean's main mathematics library bans the shortcut. The tool in this paper takes facts accepted through the shortcut and re-proves them with the trusted core alone, without changing the projects that use them. In ten of sixteen public projects, it succeeds for at least 95 of every 100 such facts. The ten include Amazon's proofs about Cedar, the company's language for access permissions.