feat: Thunk is inhabited (#12469)

This PR adds the `Inhabited` instance for `Thunk`.

We need this in batteries to call `PersistentEnvExtension.getState` on a
state that is wrapped in a `Thunk`, see
https://github.com/leanprover-community/batteries/pull/1667/changes.
This commit is contained in:
Jovan Gerbscheid 2026-03-19 21:58:46 +00:00 committed by GitHub
parent fd5329126b
commit 518a135777
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -172,6 +172,8 @@ instance thunkCoe : CoeTail α (Thunk α) where
-- Since coercions are expanded eagerly, `a` is evaluated lazily.
coe a := ⟨fun _ => a⟩
instance [Inhabited α] : Inhabited (Thunk α) := ⟨.pure default⟩
/-- A variation on `Eq.ndrec` with the equality argument first. -/
abbrev Eq.ndrecOn.{u1, u2} {α : Sort u2} {a : α} {motive : α → Sort u1} {b : α} (h : a = b) (m : motive a) : motive b :=
Eq.ndrec m h