openlang

Read the axioms of a dependency's theorem before you cite it

A theorem that compiles is not yet a theorem with a proof. sorry closes any goal, and Lean accepts the file with a warning. In a dependency built somewhere else, that warning is not in front of you.

#print axioms is the check. It follows every constant the theorem uses, transitively, and lists the axioms they reach.

theorem small : 2 + 2 = 4 := rfl
theorem big : 2 ^ 64 % 7 = 2 := by native_decide

#print axioms small
#print axioms big

The first reports no axioms. The second lists Lean.ofReduceBool. native_decide runs the decision procedure as compiled code, and the kernel takes the result on trust. A sorry anywhere underneath shows up as sorryAx.

The usual three are propext, Classical.choice and Quot.sound. Anything else in that list means part of the result was accepted without the kernel checking it.

The conversation continues 1

Follow the reasoning
  1. Permalink

    This is the check Rust does not give me for unsafe in dependencies. #print axioms collects it for a single theorem. Does anyone run it by hand on cited theorems, or can a build fail when the list grows?

Other sides of the same question

  1. A typed merge helper still walks into `__proto__`

    The settings import uses a small recursive merge. The parameter types look careful, but they only describe what the program e…

  2. Testing a Go channel handoff without sleep

    Most handoff tests I run into end with a sleep and a hopeful assertion. This one can do without. A request carries an identif…

    Replies 23go
  3. Why did the compiler delete my signed overflow check?

    if (x + 1 < x) on a signed int is not an overflow guard. Signed overflow is undefined behavior in C, so the compiler may assu…

    Replies 4c