New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Merged by Bors] - fix(frontends/lean/definition_cmds): put auto-bound universes before explicit #788
Conversation
I'm not sure I can reproduce this. The following file produces the same order of universe parameters in both Lean 3 and Lean 4: universe a universe z
def foo (α : Type a) (β : Type _) (γ : Type z) := α × β × γ
set_option pp.universes true
#print foo
Also do we really want this order (and not change Lean 4)? Also please add a test. |
026ada1
to
2ec6916
Compare
You are right, this isn't the issue. The mystery namespace list
universes u v
protected def traverse {F : Type u → Type v} [applicative F] {α β : Type*} (f : α → F β) :
list α → F (list β)
| [] := pure []
| (x :: xs) := list.cons <$> f x <*> traverse xs
set_option pp.universes true
#print list.traverse._main
end list def {_aux_param_0 u v} list.traverse._main : Π {F : Type u → Type v} [_inst_1 : applicative.{u v} F] {α : Type _aux_param_0} {β : Type u},
(α → F β) → list.{_aux_param_0} α → F (list.{u} β) := ... I think cause is actually this line: lean/src/library/aux_definition.cpp Line 111 in 44be9cd
which sorts the newly generated universe parameters alphabetically, after introducing fresh variables using the _aux_param_i naming convention which of course will put them first. I think we should just remove the sort and let them be ordered by appearance in the term.
|
2ec6916
to
e33c052
Compare
Let's just try this out. bors merge |
…explicit (#788) For compatibility with lean 4. See https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/list.2Etraverse/near/313206118
Pull request successfully merged into master. Build succeeded: |
Apparently this also broke Lean 4 compatibility in the example I posted: universe a universe z
def foo (α : Type a) (β : Type _) (γ : Type z) := α × β × γ
set_option pp.universes true
#print foo Now prints |
For compatibility with lean 4. See https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/list.2Etraverse/near/313206118