Skip to content

Commit 930dd29

Browse files
committed
feat: Linter that checks that Prop classes are Props (#6148)
1 parent 90689c4 commit 930dd29

File tree

37 files changed

+93
-55
lines changed

37 files changed

+93
-55
lines changed

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2987,6 +2987,7 @@ import Mathlib.Tactic.Linarith.Parsing
29872987
import Mathlib.Tactic.Linarith.Preprocessing
29882988
import Mathlib.Tactic.Linarith.Verification
29892989
import Mathlib.Tactic.LinearCombination
2990+
import Mathlib.Tactic.Lint
29902991
import Mathlib.Tactic.Measurability
29912992
import Mathlib.Tactic.Measurability.Init
29922993
import Mathlib.Tactic.MkIffOfInductiveProp

Mathlib/Algebra/Homology/Exact.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ variable [HasImages W] [HasZeroMorphisms W] [HasKernels W]
355355

356356
/-- A functor reflects exact sequences if any composable pair of morphisms that is mapped to an
357357
exact pair is itself exact. -/
358-
class ReflectsExactSequences (F : V ⥤ W) where
358+
class ReflectsExactSequences (F : V ⥤ W) : Prop where
359359
reflects : ∀ {A B C : V} (f : A ⟶ B) (g : B ⟶ C), Exact (F.map f) (F.map g) → Exact f g
360360
#align category_theory.functor.reflects_exact_sequences CategoryTheory.Functor.ReflectsExactSequences
361361

Mathlib/Algebra/Jordan/Basic.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Non-commutative Jordan algebras have connections to the Vidav-Palmer theorem
7777
variable (A : Type _)
7878

7979
/-- A (non-commutative) Jordan multiplication. -/
80-
class IsJordan [Mul A] where
80+
class IsJordan [Mul A] : Prop where
8181
lmul_comm_rmul : ∀ a b : A, a * b * a = a * (b * a)
8282
lmul_lmul_comm_lmul : ∀ a b : A, a * a * (a * b) = a * (a * a * b)
8383
lmul_lmul_comm_rmul : ∀ a b : A, a * a * (b * a) = a * a * b * a
@@ -86,7 +86,7 @@ class IsJordan [Mul A] where
8686
#align is_jordan IsJordan
8787

8888
/-- A commutative Jordan multipication -/
89-
class IsCommJordan [Mul A] where
89+
class IsCommJordan [Mul A] : Prop where
9090
mul_comm : ∀ a b : A, a * b = b * a
9191
lmul_comm_rmul_rmul : ∀ a b : A, a * b * (a * a) = a * (b * (a * a))
9292
#align is_comm_jordan IsCommJordan

Mathlib/Algebra/Lie/Basic.lean

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class LieRingModule (L : Type v) (M : Type w) [LieRing L] [AddCommGroup M] exten
9090
/-- A Lie module is a module over a commutative ring, together with a linear action of a Lie
9191
algebra on this module, such that the Lie bracket acts as the commutator of endomorphisms. -/
9292
class LieModule (R : Type u) (L : Type v) (M : Type w) [CommRing R] [LieRing L] [LieAlgebra R L]
93-
[AddCommGroup M] [Module R M] [LieRingModule L M] where
93+
[AddCommGroup M] [Module R M] [LieRingModule L M] : Prop where
9494
/-- A Lie module bracket is compatible with scalar multiplication in its first argument. -/
9595
protected smul_lie : ∀ (t : R) (x : L) (m : M), ⁅t • x, m⁆ = t • ⁅x, m⁆
9696
/-- A Lie module bracket is compatible with scalar multiplication in its second argument. -/
@@ -467,9 +467,7 @@ variable (f : L₁ →ₗ⁅R⁆ L₂)
467467
/-- A Lie ring module may be pulled back along a morphism of Lie algebras.
468468
469469
See note [reducible non-instances]. -/
470-
@[reducible]
471-
def LieRingModule.compLieHom : LieRingModule L₁ M
472-
where
470+
def LieRingModule.compLieHom : LieRingModule L₁ M where
473471
bracket x m := ⁅f x, m⁆
474472
lie_add x := lie_add (f x)
475473
add_lie x y m := by simp only [LieHom.map_add, add_lie]
@@ -482,11 +480,8 @@ theorem LieRingModule.compLieHom_apply (x : L₁) (m : M) :
482480
rfl
483481
#align lie_ring_module.comp_lie_hom_apply LieRingModule.compLieHom_apply
484482

485-
/-- A Lie module may be pulled back along a morphism of Lie algebras.
486-
487-
See note [reducible non-instances]. -/
488-
@[reducible]
489-
def LieModule.compLieHom [Module R M] [LieModule R L₂ M] :
483+
/-- A Lie module may be pulled back along a morphism of Lie algebras. -/
484+
theorem LieModule.compLieHom [Module R M] [LieModule R L₂ M] :
490485
@LieModule R L₁ M _ _ _ _ _ (LieRingModule.compLieHom M f) :=
491486
{ LieRingModule.compLieHom M f with
492487
smul_lie := fun t x m => by

Mathlib/Algebra/Lie/OfAssociative.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ Lie algebra via the ring commutator.
137137
138138
See the comment at `LieRingModule.ofAssociativeModule` for why the possibility `M = A` means
139139
this cannot be a global instance. -/
140-
def LieModule.ofAssociativeModule : LieModule R A M where
140+
theorem LieModule.ofAssociativeModule : LieModule R A M where
141141
smul_lie := smul_assoc
142142
lie_smul := smul_algebra_smul_comm
143143
#align lie_module.of_associative_module LieModule.ofAssociativeModule

Mathlib/Algebra/Order/ZeroLEOne.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ variable {α : Type _}
1717
open Function
1818

1919
/-- Typeclass for expressing that the `0` of a type is less or equal to its `1`. -/
20-
class ZeroLEOneClass (α : Type _) [Zero α] [One α] [LE α] where
20+
class ZeroLEOneClass (α : Type _) [Zero α] [One α] [LE α] : Prop where
2121
/-- Zero is less than or equal to one. -/
2222
zero_le_one : (0 : α) ≤ 1
2323
#align zero_le_one_class ZeroLEOneClass

Mathlib/Algebra/Ring/Defs.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ class Distrib (R : Type _) extends Mul R, Add R where
5353
#align distrib Distrib
5454

5555
/-- A typeclass stating that multiplication is left distributive over addition. -/
56-
class LeftDistribClass (R : Type _) [Mul R] [Add R] where
56+
class LeftDistribClass (R : Type _) [Mul R] [Add R] : Prop where
5757
/-- Multiplication is left distributive over addition -/
5858
protected left_distrib : ∀ a b c : R, a * (b + c) = a * b + a * c
5959
#align left_distrib_class LeftDistribClass
6060

6161
/-- A typeclass stating that multiplication is right distributive over addition. -/
62-
class RightDistribClass (R : Type _) [Mul R] [Add R] where
62+
class RightDistribClass (R : Type _) [Mul R] [Add R] : Prop where
6363
/-- Multiplication is right distributive over addition -/
6464
protected right_distrib : ∀ a b c : R, (a + b) * c = a * c + b * c
6565
#align right_distrib_class RightDistribClass

Mathlib/Algebra/Star/CHSH.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ The physical interpretation is that `A₀` and `A₁` are a pair of boolean obse
8282
are spacelike separated from another pair `B₀` and `B₁` of boolean observables.
8383
-/
8484
--@[nolint has_nonempty_instance] Porting note: linter does not exist
85-
structure IsCHSHTuple {R} [Monoid R] [StarSemigroup R] (A₀ A₁ B₀ B₁ : R) where
85+
structure IsCHSHTuple {R} [Monoid R] [StarSemigroup R] (A₀ A₁ B₀ B₁ : R) : Prop where
8686
A₀_inv : A₀ ^ 2 = 1
8787
A₁_inv : A₁ ^ 2 = 1
8888
B₀_inv : B₀ ^ 2 = 1

Mathlib/Analysis/VonNeumannAlgebra/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ One the other hand, not picking one means that the weak-* topology
4444
and we may be unhappy with the resulting opaqueness of the definition.
4545
-/
4646
class WStarAlgebra (M : Type u) [NormedRing M] [StarRing M] [CstarRing M] [Module ℂ M]
47-
[NormedAlgebra ℂ M] [StarModule ℂ M] where
47+
[NormedAlgebra ℂ M] [StarModule ℂ M] : Prop where
4848
/-- There is a Banach space `X` whose dual is isometrically (conjugate-linearly) isomorphic
4949
to the `WStarAlgebra`. -/
5050
exists_predual :

Mathlib/CategoryTheory/Closed/Functor.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ theorem expComparison_whiskerLeft {A A' : C} (f : A' ⟶ A) :
123123
/-- The functor `F` is cartesian closed (ie preserves exponentials) if each natural transformation
124124
`exp_comparison F A` is an isomorphism
125125
-/
126-
class CartesianClosedFunctor where
126+
class CartesianClosedFunctor : Prop where
127127
comparison_iso : ∀ A, IsIso (expComparison F A)
128128
#align category_theory.cartesian_closed_functor CategoryTheory.CartesianClosedFunctor
129129

@@ -178,7 +178,7 @@ cartesian closed.
178178
TODO: Show the converse, that if `F` is cartesian closed and its left adjoint preserves binary
179179
products, then it is full and faithful.
180180
-/
181-
def cartesianClosedFunctorOfLeftAdjointPreservesBinaryProducts (h : L ⊣ F) [Full F] [Faithful F]
181+
theorem cartesianClosedFunctorOfLeftAdjointPreservesBinaryProducts (h : L ⊣ F) [Full F] [Faithful F]
182182
[PreservesLimitsOfShape (Discrete WalkingPair) L] : CartesianClosedFunctor F where
183183
comparison_iso _ := expComparison_iso_of_frobeniusMorphism_iso F h _
184184
#align category_theory.cartesian_closed_functor_of_left_adjoint_preserves_binary_products CategoryTheory.cartesianClosedFunctorOfLeftAdjointPreservesBinaryProducts

0 commit comments

Comments
 (0)