Zulip Chat Archive
Stream: lean4
Topic: Wait this is valid?
Sofia (Apr 21 2022 at 04:33):
Uhh.. Stumbled upon this between ideas while representing some data.. Noticed Lean didn't complain. How is this valid?
inductive Foo : List Foo -> Type
| x : Foo []
Wojciech Nawrocki (Apr 21 2022 at 04:40):
It looks like an unfortunate interaction with the autoImplicit
feature. Try #check Foo.mk (Foo := Nat)
:)
And
set_option autoImplicit false in
inductive Foo : List Foo → Type
| x : Foo []
Sofia (Apr 21 2022 at 06:11):
Ah ! That explains it. Thanks.
Jakob von Raumer (Apr 21 2022 at 09:46):
Would be good if the syntax highlighting distinguished the two
Sofia (Apr 21 2022 at 09:56):
Or injected a verbosity layer, like some editors do with type hints. Ex. let x := 1
-> let x : Nat := 1
where the : Nat
annotation is grayed out because it isn't really in the code, it was merely inferred and displayed as if it were. Don't know if any editors which do this allow you to make that code, to lock in the type, but that'd be nice too.
Siddhartha Gadgil (Apr 21 2022 at 10:38):
In scala
on VS code (with `metals) the inferred types are shown and can be added, so the editor clearly supports this.
Last updated: Dec 20 2023 at 11:08 UTC