This PR fixes `getStuckMVar?` to detect stuck metavariables through auxiliary parent projections created for diamond inheritance. These coercions (e.g., `AddMonoid'.toAddZero'`) are not registered as regular projections because they construct the parent value from individual fields rather than extracting a single field. Previously, `getStuckMVar?` would give up when encountering them, preventing TC synthesis from being triggered. - Add `AuxParentProjectionInfo` environment extension to `ProjFns.lean` recording `numParams` and `fromClass` for these coercions - Register the info during structure elaboration in `mkCoercionToCopiedParent` - Consult the new extension in `getStuckMVar?` as a fallback when `getProjectionFnInfo?` returns `none` 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Kim Morrison <kim@tqft.net>
21 lines
865 B
Text
21 lines
865 B
Text
/-!
|
||
# Test for auxiliary parent projections (diamond inheritance)
|
||
|
||
`getStuckMVar?` should detect stuck metavariables through auxiliary parent projections
|
||
created for diamond inheritance. Previously, these coercions were not registered as projections,
|
||
so `getStuckMVar?` would give up and TC synthesis was never triggered.
|
||
-/
|
||
|
||
class AddZero' (M : Type u_2) extends Zero M, Add M where
|
||
|
||
class AddMonoid' (M : Type u) extends Add M, AddZero' M where
|
||
|
||
instance : AddZero' Int where
|
||
instance : AddMonoid' Int where
|
||
|
||
theorem sub_nonneg' {α : Type u} [AddMonoid' α] [Sub α] [LE α] {a b : α} :
|
||
0 ≤ a - b ↔ b ≤ a := sorry
|
||
|
||
-- This used to fail because `getStuckMVar?` could not find the stuck mvar
|
||
-- through `AddMonoid'.toAddZero'` (an auxiliary parent projection from diamond inheritance).
|
||
example (a b : Int) : 0 ≤ a - b ↔ b ≤ a := by rw [sub_nonneg']
|