leanprover / leanprover/lean4

Universe level normalization has associativity of `max` backwards from parsing associativity

Open
#5,695 8 comments 12 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P-low
Dominant language
Lean
Stars
9.2k
Forks
990
Avg merge
1d 17h
Merged PRs (30d)
175

Description

Description

Given universe level max u v w, it gets normalized as max (max u v) w.

Steps to Reproduce

In the following, the structure command derives the type automatically and normalizes the level.

structure Foo.{u,v,w} (α : Type (max u v w)) where
  val : α

#check Foo
/-
Foo.{u, v, w} (α : Type (max u v w)) : Type (max (max u v) w)
-/

Expected behavior: The universe level should be max u (max v w) (i.e., max u v w)

Actual behavior: The universe level is max (max u v) w

Versions

4.12.0 1d8555fe0bdd02c82664446309b2e167ac89c9e9

Additional Information

One way or the other, max u v w normalized should pretty print as max u v w.

Impact

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

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 by running the supplied Lean reproduction and inspect the universe-level normalization and pretty-printing paths; the issue names no source file or test. Done means the normalized result preserves the expected right-associated max form and a regression test covers the example.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.