This PR adds a warning to any `def` of class type that does not also declare an appropriate reducibility. The warning check runs after elaboration (checking the actual reducibility status via `getReducibilityStatus`) rather than syntactically checking modifiers before elaboration. This is necessary to accommodate patterns like `@[to_additive (attr := implicit_reducible)]` in Mathlib, where the reducibility attribute is applied during `.afterCompilation` by another attribute, and would be missed by a purely syntactic check. --------- Co-authored-by: Paul Reichert <6992158+datokrat@users.noreply.github.com> Co-authored-by: Kim Morrison <kim@tqft.net> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
30 lines
684 B
Text
30 lines
684 B
Text
set_option warn.classDefReducibility false
|
||
|
||
set_option warn.sorry false
|
||
|
||
inductive T : Type u where
|
||
| node : T → T
|
||
|
||
open Lean.Order
|
||
|
||
class O α where
|
||
compare : α → α → Ordering
|
||
|
||
instance : PartialOrder (O α) := sorry
|
||
|
||
noncomputable instance : CCPO (O α) := sorry
|
||
|
||
def instOrdT : O T :=
|
||
{ compare := fun | .node x, .node y => (@O.compare _ instOrdT x y) }
|
||
partial_fixpoint monotonicity by sorry
|
||
|
||
structure S α where
|
||
compare : α → α → Ordering
|
||
|
||
instance : PartialOrder (S α) := sorry
|
||
|
||
noncomputable instance : CCPO (S α) := sorry
|
||
|
||
def instST : S T :=
|
||
{ compare := fun | .node x, .node y => (@S.compare _ instST x y) }
|
||
partial_fixpoint monotonicity by sorry
|