Zulip Chat Archive
Stream: general
Topic: Failure to synthesize definitionally true proposition
nrs (Dec 02 2024 at 19:52):
In the following code, Lean correctly infers the second argument to congrFun
but fails to infer the first argument, which is definitionally true and provable with rfl
. How come argument inference fails in this case? Is there anything we can do to help Lean infer it?
structure WType where
s : Type
p : s -> Type
def ListP : WType := ⟨Nat, (Fin .)⟩
theorem zW : Fin n = ListP.p n := congrFun _ _
Kyle Miller (Dec 02 2024 at 19:54):
Yes, you write congrFun rfl _
Kyle Miller (Dec 02 2024 at 19:55):
There's no algorithm in Lean to try filling in placeholders with arbitrary terms — placeholders only get solved for through unification.
Kyle Miller (Dec 02 2024 at 19:56):
There's no need for congrFun
here, theorem zW : Fin n = ListP.p n := rfl
suffices.
nrs (Dec 02 2024 at 19:57):
Kyle Miller said:
There's no algorithm in Lean to try filling in placeholders with arbitrary terms — placeholders only get solved for through unification.
ah I see, thank you! Are all cases of successfully inferred arguments in Lean purely due to unification?
Kyle Miller (Dec 02 2024 at 19:58):
Yes, for _
's and implicit arguments.
nrs (Dec 02 2024 at 19:58):
Kyle Miller said:
Yes, for
_
's and implicit arguments.
I see, thank you for the help!
Kyle Miller (Dec 02 2024 at 19:58):
Instance implicit arguments (from square brackets) use typeclass synthesis instead.
Last updated: May 02 2025 at 03:31 UTC