Skip to content

Commit

Permalink
fix(*): mark some classes as Prop (#18015)
Browse files Browse the repository at this point in the history
  • Loading branch information
urkud committed Dec 29, 2022
1 parent 422e70f commit 986c4d5
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 45 deletions.
2 changes: 1 addition & 1 deletion archive/100-theorems-list/30_ballot_problem.lean
Expand Up @@ -277,7 +277,7 @@ private def measureable_space_list_int : measurable_space (list ℤ) := ⊤

local attribute [instance] measureable_space_list_int

private def measurable_singleton_class_list_int : measurable_singleton_class (list ℤ) :=
private lemma measurable_singleton_class_list_int : measurable_singleton_class (list ℤ) :=
{ measurable_set_singleton := λ s, trivial }

local attribute [instance] measurable_singleton_class_list_int
Expand Down
6 changes: 3 additions & 3 deletions src/algebra/hom/freiman.lean
Expand Up @@ -72,7 +72,7 @@ notation (name := freiman_hom) A ` →*[`:25 n:25 `] `:0 β:0 := freiman_hom A
/-- `add_freiman_hom_class F s β n` states that `F` is a type of `n`-ary sums-preserving morphisms.
You should extend this class when you extend `add_freiman_hom`. -/
class add_freiman_hom_class (F : Type*) (A : out_param $ set α) (β : out_param $ Type*)
[add_comm_monoid α] [add_comm_monoid β] (n : ℕ) [fun_like F α (λ _, β)] :=
[add_comm_monoid α] [add_comm_monoid β] (n : ℕ) [fun_like F α (λ _, β)] : Prop :=
(map_sum_eq_map_sum' (f : F) {s t : multiset α} (hsA : ∀ ⦃x⦄, x ∈ s → x ∈ A)
(htA : ∀ ⦃x⦄, x ∈ t → x ∈ A) (hs : s.card = n) (ht : t.card = n) (h : s.sum = t.sum) :
(s.map f).sum = (t.map f).sum)
Expand All @@ -83,7 +83,7 @@ You should extend this class when you extend `freiman_hom`. -/
"`add_freiman_hom_class F A β n` states that `F` is a type of `n`-ary sums-preserving morphisms.
You should extend this class when you extend `add_freiman_hom`."]
class freiman_hom_class (F : Type*) (A : out_param $ set α) (β : out_param $ Type*) [comm_monoid α]
[comm_monoid β] (n : ℕ) [fun_like F α (λ _, β)] :=
[comm_monoid β] (n : ℕ) [fun_like F α (λ _, β)] : Prop :=
(map_prod_eq_map_prod' (f : F) {s t : multiset α} (hsA : ∀ ⦃x⦄, x ∈ s → x ∈ A)
(htA : ∀ ⦃x⦄, x ∈ t → x ∈ A) (hs : s.card = n) (ht : t.card = n) (h : s.prod = t.prod) :
(s.map f).prod = (t.map f).prod)
Expand Down Expand Up @@ -369,7 +369,7 @@ def freiman_hom.to_freiman_hom (h : m ≤ n) (f : A →*[n] β) : A →*[m] β :
/-- A `n`-Freiman homomorphism is also a `m`-Freiman homomorphism for any `m ≤ n`. -/
@[to_additive add_freiman_hom.add_freiman_hom_class_of_le "An additive `n`-Freiman homomorphism is
also an additive `m`-Freiman homomorphism for any `m ≤ n`."]
def freiman_hom.freiman_hom_class_of_le [freiman_hom_class F A β n] (h : m ≤ n) :
lemma freiman_hom.freiman_hom_class_of_le [freiman_hom_class F A β n] (h : m ≤ n) :
freiman_hom_class F A β m :=
{ map_prod_eq_map_prod' := λ f s t hsA htA hs ht hst,
map_prod_eq_map_prod_of_le f hsA htA hs ht hst h }
Expand Down
8 changes: 4 additions & 4 deletions src/algebraic_geometry/projective_spectrum/scheme.lean
Expand Up @@ -196,8 +196,8 @@ begin
rw set.not_disjoint_iff_nonempty_inter,
refine ⟨f^N * f^M, eq1.symm ▸ mul_mem_right _ _
(sum_mem _ (λ i hi, mul_mem_left _ _ _)), ⟨N+M, by rw pow_add⟩⟩,
generalize_proofs h,
exact (classical.some_spec h).1,
generalize_proofs h₁ h₂,
exact (classical.some_spec h).1,
end

variable (f)
Expand Down Expand Up @@ -236,7 +236,7 @@ def to_fun (x : Proj.T| (pbo f)) : (Spec.T (A⁰_ f)) :=
{ exact false.elim (x.2 (x.1.is_prime.mem_of_pow_mem M rid2)), },
{ rw [mul_comm _ (f^N), eq1],
refine mul_mem_right _ _ (mul_mem_right _ _ (sum_mem _ (λ i hi, mul_mem_left _ _ _))),
generalize_proofs h, exact (classical.some_spec h).1 },
generalize_proofs h₁ h₂, exact (classical.some_spec h).1 },
end

/-
Expand Down Expand Up @@ -283,7 +283,7 @@ begin
{ exact y.2 (y.1.is_prime.mem_of_pow_mem M H3), },
{ rw [mul_comm _ (f^N), eq1],
refine mul_mem_right _ _ (mul_mem_right _ _ (sum_mem _ (λ i hi, mul_mem_left _ _ _))),
generalize_proofs h, exact (classical.some_spec h).1, }, },
generalize_proofs h₁ h₂, exact (classical.some_spec h).1, }, },
end

end to_Spec
Expand Down
4 changes: 2 additions & 2 deletions src/category_theory/monoidal/linear.lean
Expand Up @@ -25,7 +25,7 @@ variables [monoidal_category C] [monoidal_preadditive C]
/--
A category is `monoidal_linear R` if tensoring is `R`-linear in both factors.
-/
class monoidal_linear :=
class monoidal_linear : Prop :=
(tensor_smul' : ∀ {W X Y Z : C} (f : W ⟶ X) (r : R) (g : Y ⟶ Z),
f ⊗ (r • g) = r • (f ⊗ g) . obviously)
(smul_tensor' : ∀ {W X Y Z : C} (r : R) (f : W ⟶ X) (g : Y ⟶ Z),
Expand All @@ -44,7 +44,7 @@ instance tensoring_right_linear (X : C) : ((tensoring_right C).obj X).linear R :

/-- A faithful linear monoidal functor to a linear monoidal category
ensures that the domain is linear monoidal. -/
def monoidal_linear_of_faithful
lemma monoidal_linear_of_faithful
{D : Type*} [category D] [preadditive D] [linear R D]
[monoidal_category D] [monoidal_preadditive D]
(F : monoidal_functor D C) [faithful F.to_functor]
Expand Down
4 changes: 2 additions & 2 deletions src/category_theory/monoidal/preadditive.lean
Expand Up @@ -29,7 +29,7 @@ A category is `monoidal_preadditive` if tensoring is additive in both factors.
Note we don't `extend preadditive C` here, as `abelian C` already extends it,
and we'll need to have both typeclasses sometimes.
-/
class monoidal_preadditive :=
class monoidal_preadditive : Prop :=
(tensor_zero' : ∀ {W X Y Z : C} (f : W ⟶ X), f ⊗ (0 : Y ⟶ Z) = 0 . obviously)
(zero_tensor' : ∀ {W X Y Z : C} (f : Y ⟶ Z), (0 : W ⟶ X) ⊗ f = 0 . obviously)
(tensor_add' : ∀ {W X Y Z : C} (f : W ⟶ X) (g h : Y ⟶ Z), f ⊗ (g + h) = f ⊗ g + f ⊗ h . obviously)
Expand All @@ -52,7 +52,7 @@ instance tensoring_right_additive (X : C) : ((tensoring_right C).obj X).additive

/-- A faithful additive monoidal functor to a monoidal preadditive category
ensures that the domain is monoidal preadditive. -/
def monoidal_preadditive_of_faithful {D : Type*} [category D] [preadditive D] [monoidal_category D]
lemma monoidal_preadditive_of_faithful {D} [category D] [preadditive D] [monoidal_category D]
(F : monoidal_functor D C) [faithful F.to_functor] [F.to_functor.additive] :
monoidal_preadditive D :=
{ tensor_zero' := by { intros, apply F.to_functor.map_injective, simp [F.map_tensor], },
Expand Down
2 changes: 1 addition & 1 deletion src/field_theory/subfield.lean
Expand Up @@ -66,7 +66,7 @@ variables {K : Type u} {L : Type v} {M : Type w} [field K] [field L] [field M]

/-- `subfield_class S K` states `S` is a type of subsets `s ⊆ K` closed under field operations. -/
class subfield_class (S : Type*) (K : out_param $ Type*) [field K] [set_like S K]
extends subring_class S K, inv_mem_class S K.
extends subring_class S K, inv_mem_class S K : Prop

namespace subfield_class

Expand Down
18 changes: 5 additions & 13 deletions src/group_theory/subgroup/basic.lean
Expand Up @@ -95,39 +95,31 @@ variables {A : Type*} [add_group A]
section subgroup_class

/-- `inv_mem_class S G` states `S` is a type of subsets `s ⊆ G` closed under inverses. -/
class inv_mem_class (S G : Type*) [has_inv G] [set_like S G] :=
class inv_mem_class (S G : Type*) [has_inv G] [set_like S G] : Prop :=
(inv_mem : ∀ {s : S} {x}, x ∈ s → x⁻¹ ∈ s)

export inv_mem_class (inv_mem)

/-- `neg_mem_class S G` states `S` is a type of subsets `s ⊆ G` closed under negation. -/
class neg_mem_class (S G : Type*) [has_neg G] [set_like S G] :=
class neg_mem_class (S G : Type*) [has_neg G] [set_like S G] : Prop :=
(neg_mem : ∀ {s : S} {x}, x ∈ s → -x ∈ s)

export neg_mem_class (neg_mem)

/-- `subgroup_class S G` states `S` is a type of subsets `s ⊆ G` that are subgroups of `G`. -/
class subgroup_class (S G : Type*) [div_inv_monoid G] [set_like S G]
extends submonoid_class S G :=
(inv_mem : ∀ {s : S} {x}, x ∈ s → x⁻¹ ∈ s)
extends submonoid_class S G, inv_mem_class S G : Prop

/-- `add_subgroup_class S G` states `S` is a type of subsets `s ⊆ G` that are
additive subgroups of `G`. -/
class add_subgroup_class (S G : Type*) [sub_neg_monoid G] [set_like S G]
extends add_submonoid_class S G :=
(neg_mem : ∀ {s : S} {x}, x ∈ s → -x ∈ s)
extends add_submonoid_class S G, neg_mem_class S G : Prop

attribute [to_additive] inv_mem_class subgroup_class

variables (M S : Type*) [div_inv_monoid M] [set_like S M] [hSM : subgroup_class S M]
variables {M S : Type*} [div_inv_monoid M] [set_like S M] [hSM : subgroup_class S M] {H K : S}
include hSM

@[to_additive, priority 100] -- See note [lower instance priority]
instance subgroup_class.to_inv_mem_class : inv_mem_class S M :=
{ .. hSM }

variables {S M} {H K : S}

/-- A subgroup is closed under division. -/
@[to_additive "An additive subgroup is closed under subtraction."]
theorem div_mem {x y : M} (hx : x ∈ H) (hy : y ∈ H) : x / y ∈ H :=
Expand Down
15 changes: 4 additions & 11 deletions src/group_theory/submonoid/basic.lean
Expand Up @@ -60,13 +60,13 @@ variables [mul_one_class M] {s : set M}
variables [add_zero_class A] {t : set A}

/-- `one_mem_class S M` says `S` is a type of subsets `s ≤ M`, such that `1 ∈ s` for all `s`. -/
class one_mem_class (S : Type*) (M : out_param $ Type*) [has_one M] [set_like S M] :=
class one_mem_class (S : Type*) (M : out_param $ Type*) [has_one M] [set_like S M] : Prop :=
(one_mem : ∀ (s : S), (1 : M) ∈ s)

export one_mem_class (one_mem)

/-- `zero_mem_class S M` says `S` is a type of subsets `s ≤ M`, such that `0 ∈ s` for all `s`. -/
class zero_mem_class (S : Type*) (M : out_param $ Type*) [has_zero M] [set_like S M] :=
class zero_mem_class (S : Type*) (M : out_param $ Type*) [has_zero M] [set_like S M] : Prop :=
(zero_mem : ∀ (s : S), (0 : M) ∈ s)

export zero_mem_class (zero_mem)
Expand All @@ -90,8 +90,7 @@ add_decl_doc submonoid.to_subsemigroup
/-- `submonoid_class S M` says `S` is a type of subsets `s ≤ M` that contain `1`
and are closed under `(*)` -/
class submonoid_class (S : Type*) (M : out_param $ Type*) [mul_one_class M] [set_like S M]
extends mul_mem_class S M :=
(one_mem : ∀ (s : S), (1 : M) ∈ s)
extends mul_mem_class S M, one_mem_class S M : Prop

section

Expand All @@ -112,16 +111,10 @@ add_decl_doc add_submonoid.to_add_subsemigroup
/-- `add_submonoid_class S M` says `S` is a type of subsets `s ≤ M` that contain `0`
and are closed under `(+)` -/
class add_submonoid_class (S : Type*) (M : out_param $ Type*) [add_zero_class M] [set_like S M]
extends add_mem_class S M :=
(zero_mem : ∀ (s : S), (0 : M) ∈ s)
extends add_mem_class S M, zero_mem_class S M : Prop

attribute [to_additive] submonoid submonoid_class

@[to_additive, priority 100] -- See note [lower instance priority]
instance submonoid_class.to_one_mem_class (S : Type*) (M : out_param $ Type*) [mul_one_class M]
[set_like S M] [h : submonoid_class S M] : one_mem_class S M :=
{ ..h }

@[to_additive]
lemma pow_mem {M} [monoid M] {A : Type*} [set_like A M] [submonoid_class A M] {S : A} {x : M}
(hx : x ∈ S) : ∀ (n : ℕ), x ^ n ∈ S
Expand Down
4 changes: 2 additions & 2 deletions src/group_theory/subsemigroup/basic.lean
Expand Up @@ -54,13 +54,13 @@ variables [has_mul M] {s : set M}
variables [has_add A] {t : set A}

/-- `mul_mem_class S M` says `S` is a type of subsets `s ≤ M` that are closed under `(*)` -/
class mul_mem_class (S : Type*) (M : out_param $ Type*) [has_mul M] [set_like S M] :=
class mul_mem_class (S : Type*) (M : out_param $ Type*) [has_mul M] [set_like S M] : Prop :=
(mul_mem : ∀ {s : S} {a b : M}, a ∈ s → b ∈ s → a * b ∈ s)

export mul_mem_class (mul_mem)

/-- `add_mem_class S M` says `S` is a type of subsets `s ≤ M` that are closed under `(+)` -/
class add_mem_class (S : Type*) (M : out_param $ Type*) [has_add M] [set_like S M] :=
class add_mem_class (S : Type*) (M : out_param $ Type*) [has_add M] [set_like S M] : Prop :=
(add_mem : ∀ {s : S} {a b : M}, a ∈ s → b ∈ s → a + b ∈ s)

export add_mem_class (add_mem)
Expand Down
3 changes: 1 addition & 2 deletions src/ring_theory/subring/basic.lean
Expand Up @@ -72,8 +72,7 @@ section subring_class
/-- `subring_class S R` states that `S` is a type of subsets `s ⊆ R` that
are both a multiplicative submonoid and an additive subgroup. -/
class subring_class (S : Type*) (R : out_param $ Type u) [ring R] [set_like S R]
extends subsemiring_class S R :=
(neg_mem : ∀ {s : S} {a : R}, a ∈ s → -a ∈ s)
extends subsemiring_class S R, neg_mem_class S R : Prop

@[priority 100] -- See note [lower instance priority]
instance subring_class.add_subgroup_class (S : Type*) (R : out_param $ Type u) [set_like S R]
Expand Down
6 changes: 2 additions & 4 deletions src/ring_theory/subsemiring/basic.lean
Expand Up @@ -31,7 +31,7 @@ section add_submonoid_with_one_class
and are closed under `(+)` -/
class add_submonoid_with_one_class (S : Type*) (R : out_param $ Type*)
[add_monoid_with_one R] [set_like S R]
extends add_submonoid_class S R, one_mem_class S R
extends add_submonoid_class S R, one_mem_class S R : Prop

variables {S R : Type*} [add_monoid_with_one R] [set_like S R] (s : S)

Expand All @@ -56,9 +56,7 @@ section subsemiring_class
/-- `subsemiring_class S R` states that `S` is a type of subsets `s ⊆ R` that
are both a multiplicative and an additive submonoid. -/
class subsemiring_class (S : Type*) (R : out_param $ Type u) [non_assoc_semiring R] [set_like S R]
extends submonoid_class S R :=
(add_mem : ∀ {s : S} {a b : R}, a ∈ s → b ∈ s → a + b ∈ s)
(zero_mem : ∀ (s : S), (0 : R) ∈ s)
extends submonoid_class S R, add_submonoid_class S R : Prop

@[priority 100] -- See note [lower instance priority]
instance subsemiring_class.add_submonoid_with_one_class (S : Type*) (R : out_param $ Type u)
Expand Down

0 comments on commit 986c4d5

Please sign in to comment.