`pp.all` prints private names as `_private.<module>.0.<name>`, which cannot be parsed anywhere
Prerequisites
- [x] Check that your issue is not already filed
- [x] Reduce the issue to a minimal, self-contained, reproducible test case. Avoid dependencies to Mathlib or Batteries.
- [x] Test your test case against the latest nightly release
Description
pp.all (and #print) render a private declaration by its internal name, e.g. _private.Init.Data.Array.Basic.0.Array.allDiffAux. That spelling is unparseable — the .0. component is lexed as a decimal point — so any printed term mentioning a private declaration cannot be re-elaborated, even inside the module that defines it, where the user-facing name Array.allDiffAux would resolve.
This is the single largest source of pp.all round-trip failures in core. A mechanical check (delaborate with pp.all, re-parse, re-elaborate) over every declaration in Init and Std gives:
- declaration types: 76,100 checked, 116 fail on a private name (public
casesOn/rec/instInhabited*.defaultfor structures with private constructors, mostly inStd.Async/Http/Time/Broadcast); - declaration values: 19,868 checked, 1,435 fail on a private name (7.2%) — library code calls private helpers constantly.
Steps to Reproduce
private def helper (n : Nat) : Nat := n + 1
def useIt (n : Nat) : Nat := helper n
set_option pp.all true in
#print useIt
-- def useIt : Nat → Nat :=
-- fun (n : Nat) => _private.<file>.0.helper n
-- Copying that back, in the same file:
#check fun (n : Nat) => _private.<file>.0.helper n
-- error: unexpected identifier after decimal point; consider parenthesizing the number
-- The user-facing name does resolve here:
#check fun (n : Nat) => helper n
(Substitute the actual module name for <file>; the shape is the same for Array.allDiff → _private.Init.Data.Array.Basic.0.Array.allDiffAux.)
Expected behavior: either the user-facing name (helper, Array.allDiffAux), which is what a reader wants and what re-elaborates inside the defining module, or a spelling that at least parses.
Actual behavior: _private.<module>.0.<name>, which parses nowhere.
Versions
Lean 4.35.0-nightly-2026-09-04,arm64-apple-darwin24.6.0 macOSLean 4.33.1(stable) — same
Additional Information
I realise private names are not meant to be referenced across modules, so a full round-trip is impossible in general; this is about the printed form being unusable even where the name is in scope, and about pp.all output — whose purpose is to be re-elaborable — silently failing that purpose for a large fraction of real terms. Related round-trip issues from the same sweep: #15035 (optParam locals), #15036 (enum noConfusion universes).
Investigation assisted by Claude; repros run and checked manually.
Impact
Add :+1: to issues you consider important. If others are impacted by this issue, please ask them to add :+1: to it.
Round-tripping is not currently a design goal of pp.all. This would require an RFC, and pp.all might or might not be involved in the solution.