Zulip Chat Archive
Stream: new members
Topic: Inaccessible terms and non-working TPIL example
Yakov Pechersky (Jun 05 2020 at 00:27):
I'm continuing to read TPIL, now on Inaccessible terms. The first motivating example in the document throws errors for me. MWE:
variables {α β : Type}
inductive image_of (f : α → β) : β → Type
| imf : Π a, image_of (f a)
open image_of
def inverse {f : α → β} : Π b, image_of f b → α
| .(f a) (imf .(f) a) := a
If I understand correctly, the compiler doesn't know where the a
comes from.
Reid Barton (Jun 05 2020 at 00:31):
Check whether imf
actually takes two explicit arguments f
and a
. The default rules for implicit-ness of constructors changed recently.
Bryan Gin-ge Chen (Jun 05 2020 at 00:32):
Yeah, looks like one of the recent community versions broke this example, since it works in the old web editor and in a local Lean 3.4.2 project.
Bryan Gin-ge Chen (Jun 05 2020 at 00:34):
This works (in Lean 3.15.0c):
variables {α β : Type}
inductive image_of (f : α → β) : β → Type
| imf : Π a, image_of (f a)
open image_of
def inverse {f : α → β} : Π b, image_of f b → α
| .(f a) (imf a) := a
Yakov Pechersky (Jun 05 2020 at 00:34):
I played around with it and got this working:
def inverse {f : α → β} : Π b, image_of f b → α
| b := begin
intros inf,
cases inf with a,
exact a
end
Should the TPIL document be edited?
Yakov Pechersky (Jun 05 2020 at 00:36):
I guess that's equivalent to Bryan's code.
Bryan Gin-ge Chen (Jun 05 2020 at 00:36):
Sure, I think @Jeremy Avigad is pretty receptive to PRs here.
Jeremy Avigad (Jun 05 2020 at 01:16):
Yeah, the problem is that TPIL is still running with Lean 3.4.2. @Bryan Gin-ge Chen I suppose I should update it to use the online community web editor? It shouldn't be too hard, but it will take me a few days to get to it.
Last updated: Dec 20 2023 at 11:08 UTC