Identifier
F:nat-countrange-eq-sumrange
Proof route
kernel-lean
External status
proved
Axiom footprint
Empty

Recorded description

`countRange f n` equals `sumRange (fun k => bool_select_nat (f k) 1 0) n` by `Eq.refl`. This is not a coincidence to be proved but a fact about the two definitions: `Nat.countRange` (`nat_prelude/totient.rs`) and `Nat.sumRange` (`nat_prelude/defs.rs`) are the SAME `Nat.rec` -- motive `fun _ => Nat`, base `zero`, step `fun j ih => add ih (g j)` -- differing only in what `g` is. WHAT THIS IS FOR: it lets a proof move between the counting world and the summing world, which is what the rectangle partition needs in order to apply Fubini to a `countRange`. WHAT IT DOES NOT CLAIM: being `Eq.refl`, it cannot be wrong the way a proved theorem can; its value is that it PINS the two definitions staying the same recursor. If someone changed `countRange`'s step to accumulate on the left, this declaration would stop being admitted.

Formal statement
theorem Nat.countRange_eq_sumRange : ((x0 : ((x0 : AxNat) -> Bool)) -> ((x1 : AxNat) -> Eq.{1} AxNat (AxNat.countRange x0 x1) (AxNat.sumRange (fun (x2 : AxNat) => Bool.rec.{1} (fun (x3 : Bool) => AxNat) AxNat.zero (AxNat.succ AxNat.zero) (x0 x2)) x1)))

Dependencies

The graph shows direct ledger edges. Follow a node to open its artifact page.

Direct dependencies appear to the left. The current fact is in the center. Facts that depend directly on it appear to the right. Current fact A rectangle of lattice points, The least residues reconcile wi
0 direct dependencies 2 direct dependents

Evidence

kernel-Nat.countRange_eq_sumRange

Kind
kernel-term
Status
checked

Supports: Nat.countRange_eq_sumRange is admitted by the trusted kernel gate with the type recorded in formal.statement.

Checker command
cargo run -q --release -p axeyum-lean-kernel --example theorem_dependency_inventory -- Nat.countRange_eq_sumRange 2>/dev/null | grep -cE '^Nat\.countRange_eq_sumRange[[:space:]]'
Evidence notes

Two independent failure modes, so the exit status depends on the finding rather than on the run completing: theorem_dependency_inventory exits non-zero when a NAMED filter matches nothing, and grep -c exits 1 printing 0 when the anchored line is absent. Run both ways for this declaration: the real name prints 1 and exits 0, a one-letter misspelling prints 0 and exits 1. Anchored with [[:space:]], never \t -- in a scripted (GNU) grep \t is a literal t. grep -c rather than grep -q, which would SIGPIPE the producer under pipefail. --release is MANDATORY: this tool builds creal/complex/cpoint, which overflow the default debug thread stack. Pass ONE name per invocation: this tool silently keeps only the FIRST name argument.

footprint-Nat.countRange_eq_sumRange

Kind
exhaustive-enumeration
Status
checked

Supports: axiom_footprint: [] -- the Nat prelude's trusted surface is empty, which bounds Nat.countRange_eq_sumRange.

Checker command
cargo run -q --release -p axeyum-lean-kernel --example nat_axiom_inventory -- --require-axiom-free nat
Evidence notes

--require-axiom-free exits non-zero when the named prelude's trusted surface (Axiom + Opaque + Quotient) is not empty, and errors rather than silently passing for a prelude the run never built. A declaration cannot depend on a trusted declaration the environment does not contain, so an empty nat surface bounds every declaration in it. This is a whole-prelude bound, not a per-declaration measurement; the per-declaration figure is the footprint column of kernel_declaration_projection, measured 0 for this row. Measured 2026-08-31: `ok: nat trusted surface = 0`.

Provenance

{
  "date": "2026-08-31",
  "curation": "curated",
  "established_by": "axeyum-lean-kernel build_nat_prelude (crates/axeyum-lean-kernel/src/nat_prelude/lattice_count.rs)",
  "source": "formal.statement, axiom_footprint and depends_on are taken verbatim from `cargo run -q --release -p axeyum-lean-kernel --example kernel_declaration_projection`, whose TSV rows are (prelude, kind, display name, axiom-footprint size, direct type declarations, direct declarations, direct theorems, Kernel::render_lean(declaration.ty())). depends_on is the direct-theorem column intersected with this ledger's registered facts. Nothing about the statement was hand transcribed; title, statement and the evidence notes were authored (lane quadratic-reciprocity, ADR-1260)."
}