Zulip Chat Archive
Stream: new members
Topic: inferInstance Decidable for defs
Mark Aagaard (Feb 20 2025 at 01:36):
The Lean4 type classes documentation says, "Sometimes Lean can't find an instance because the class is buried under a definition". So, I have:
def p1 (b:Bool) := b = true
-- doesn't work: deriving Decidable
instance (b:Bool) : Decidable (p1 b) :=
inferInstanceAs (Decidable (b = true))
Is this the preferred method for showing decidability of p1
? I'm curious if there is a tactic based approach where I could tell Lean to "unfold the definition of p1
" rather than explicitly provide the body of p1
.
-mark
Eric Wieser (Feb 20 2025 at 01:49):
Yes, the spelling you're asking for is by unfold p1; infer_instance
Mark Aagaard (Feb 20 2025 at 01:56):
@Eric Wieser - thanks!
-mark
Last updated: May 02 2025 at 03:31 UTC