leanprover / leanprover/reference-manual

Declaration modifiers don't mention the public visibility

Open Beginner friendly
#896 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Lean
Stars
129
Forks
67
Avg merge
1d 15h
Merged PRs (30d)
16

Description

The Modifiers section of the Definitions chapter does not mention the public visibility:
https://github.com/leanprover/reference-manual/blob/986f6e92210cd96ede07c8a78317b0b998130eb2/Manual/Defs.lean#L51

Later in that section, it suggests that public is the default visibility:
https://github.com/leanprover/reference-manual/blob/986f6e92210cd96ede07c8a78317b0b998130eb2/Manual/Defs.lean#L83

That second case probably assumes outside a module, but since it already mentions modules, this is confusing. In particular after having read the previous chapter about Modules:
https://github.com/leanprover/reference-manual/blob/986f6e92210cd96ede07c8a78317b0b998130eb2/Manual/SourceFiles.lean#L348

Create a lake library project with lake new foo lib, then add module at the top of Foo/Basic.lean and def test := hello at the bottom of Foo.lean (removing comments), resulting in the following file contents:

% cat Foo.lean
import Foo.Basic
def test := hello
% cat Foo/Basic.lean 
module
def hello := "world"
% lake build
error: Foo.lean:2:12: Unknown identifier `hello`

Adding the public modifier to hello fixes the build:

% sed -i 's/^def/public def/' Foo/Basic.lean
% lake build
Build completed successfully (4 jobs).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Modifiers section in Manual/Defs.lean around lines 51 and 83, then compare its wording with the module behavior described in Manual/SourceFiles.lean around line 348. Reproduce the provided lake project and build commands to confirm the visibility distinction. Done means the Definitions chapter clearly documents public visibility and its interaction with modules.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.