Skip to content

Lemmas about private defs are not private by default #5002

@YaelDillies

Description

@YaelDillies

First, I am not sure whether this should be a RFC or a bug report. The current behavior is confusing and seemingly has no use cases, which is why I have opted for a bug report.

Prerequisites

Please put an X between the brackets as you perform the following steps:

Description

Lemmas about private definitions are not private by default. One needs to add the private keyword explicitly.

Context

I keep forgetting that this is the current behavior, so I sometimes accidentally add non-private lemmas about private definitions to Mathlib, the latest in date being leanprover-community/mathlib4#15000.

Steps to Reproduce

Consider the following MWE

private def foo : Nat := 0

theorem foo_eq_zero : foo = 0 := rfl

#print foo -- `foo` is `private`
#print foo_eq_zero -- `foo_eq_zero` is not

Expected behavior: foo_eq_zero is private
Actual behavior: foo_eq_zero is not private

Versions

4.11.0-nightly-2024-08-11

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P-highWe will work on this issuebugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions