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>
56 lines
1.5 KiB
Text
56 lines
1.5 KiB
Text
set_option warn.classDefReducibility false
|
||
|
||
variable {α : Type _} (r : α → α → Prop) (π : α → α)
|
||
|
||
inductive rel : α → α → Prop
|
||
| of {x y} : r x y → rel x y
|
||
| compat {x y} : rel x y → rel (π x) (π y)
|
||
| refl (x) : rel x x
|
||
| symm {x y} : rel x y → rel y x
|
||
| trans {x y z} : rel x y → rel y z → rel x z
|
||
|
||
def thing : Setoid α := ⟨rel r π, ⟨rel.refl, rel.symm, rel.trans⟩⟩
|
||
|
||
def β := Quotient (thing r π)
|
||
|
||
variable {γ : Type _}
|
||
|
||
abbrev Quotient.mk'' {s : Setoid α} (a : α) : Quotient s :=
|
||
Quotient.mk s a
|
||
|
||
def δ0 : β r π → β r π :=
|
||
Quotient.lift
|
||
(s := thing r π)
|
||
(Quotient.mk'' $ π ·)
|
||
fun x y h => Quotient.sound (by exact rel.compat h)
|
||
|
||
def δ1 : β r π → β r π :=
|
||
Quotient.lift
|
||
(s := thing r π)
|
||
(Quotient.mk'' $ π ·)
|
||
fun x y h => Quotient.sound (rel.compat h)
|
||
|
||
def δ2 : β r π → β r π :=
|
||
Quotient.lift
|
||
(s := thing r π)
|
||
(Quotient.mk'' $ π ·)
|
||
(by exact fun x y h => Quotient.sound (rel.compat h))
|
||
|
||
def Quotient.lift' {α β} {s : Setoid α} (f : α → β) (h : (a b : α) → a ≈ b → f a = f b) (q : Quotient s) : β :=
|
||
Quotient.lift f h q
|
||
|
||
def δ3 : β r π → β r π :=
|
||
Quotient.lift'
|
||
(Quotient.mk'' $ π ·)
|
||
fun x y h => Quotient.sound (rel.compat h)
|
||
|
||
def δ4 : β r π → β r π :=
|
||
@Quotient.lift _ _
|
||
(thing r π)
|
||
(Quotient.mk'' $ π ·)
|
||
(fun x y h => Quotient.sound (rel.compat h))
|
||
|
||
def δ5 : β r π → β r π :=
|
||
@Quotient.lift' _ _ _
|
||
(Quotient.mk'' $ π ·)
|
||
(fun x y h => Quotient.sound (rel.compat h))
|