lean-ja / lean-ja/lean-by-example

universe level が問題になる例: Stream の doc comment

Open
#1,365 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

要調査
Dominant language
Lean
Stars
188
Forks
15
Avg merge
9h 8m
Merged PRs (30d)
6

Description

universe level が問題になることはめったにないが、たまに問題になることがある。
どういうときに問題になるのか、典型的な例を調べてまとめておきたい。

Stream の module doc に次のように書かれている。

Remark: we considered using the following alternative design

structure Stream (α : Type u) where
  stream : Type u
  next? : stream → Option (α × stream)

class ToStream (collection : Type u) (value : outParam (Type v)) where
  toStream : collection → Stream value

where Stream is not a class, and its state is encapsulated.
The key problem is that the type Stream α "lives" in a universe higher than α.
This is a problem because we want to use Streams in monadic code.

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 from the Stream module doc and read the quoted alternative Stream and ToStream definitions, then investigate the universe-level issue described there. Document typical situations where the higher universe causes problems in monadic code, using clear examples. Done means the Stream documentation explains when and why this design becomes problematic.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.