Skip to content

Commit ca397b7

Browse files
committed
chore: robustifying for debug.byAsSorry (part 3) (#15120)
cf #14993 and #15119
1 parent a54cd21 commit ca397b7

File tree

15 files changed

+52
-29
lines changed

15 files changed

+52
-29
lines changed

Mathlib/Algebra/Associated/Basic.lean

+1-1
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ theorem mul_eq_one_iff {x y : Associates α} : x * y = 1 ↔ x = 1 ∧ y = 1 :=
845845
(Quotient.inductionOn₂ x y fun a b h =>
846846
have : a * b ~ᵤ 1 := Quotient.exact h
847847
⟨Quotient.sound <| associated_one_of_associated_mul_one this,
848-
Quotient.sound <| associated_one_of_associated_mul_one <| by rwa [mul_comm] at this⟩)
848+
Quotient.sound <| associated_one_of_associated_mul_one (b := a) (by rwa [mul_comm])⟩)
849849
(by simp (config := { contextual := true }))
850850

851851
theorem units_eq_one (u : (Associates α)ˣ) : u = 1 :=

Mathlib/Algebra/Field/Basic.lean

+2
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,9 @@ noncomputable abbrev DivisionRing.ofIsUnitOrEqZero [Ring R] (h : ∀ a : R, IsUn
228228
toRing := ‹Ring R›
229229
__ := groupWithZeroOfIsUnitOrEqZero h
230230
nnqsmul := _
231+
nnqsmul_def := fun q a => rfl
231232
qsmul := _
233+
qsmul_def := fun q a => rfl
232234

233235
/-- Constructs a `Field` structure on a `CommRing` consisting only of units and 0. -/
234236
-- See note [reducible non-instances]

Mathlib/Algebra/Field/Opposite.lean

+4
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@ instance instDivisionSemiring [DivisionSemiring α] : DivisionSemiring αᵐᵒ
3434
__ := instSemiring
3535
__ := instGroupWithZero
3636
nnqsmul := _
37+
nnqsmul_def := fun q a => rfl
3738
nnratCast_def q := unop_injective $ by rw [unop_nnratCast, unop_div, unop_natCast, unop_natCast,
3839
NNRat.cast_def, div_eq_mul_inv, Nat.cast_comm]
3940

4041
instance instDivisionRing [DivisionRing α] : DivisionRing αᵐᵒᵖ where
4142
__ := instRing
4243
__ := instDivisionSemiring
4344
qsmul := _
45+
qsmul_def := fun q a => rfl
4446
ratCast_def q := unop_injective <| by rw [unop_ratCast, Rat.cast_def, unop_div,
4547
unop_natCast, unop_intCast, Int.commute_cast, div_eq_mul_inv]
4648

@@ -60,13 +62,15 @@ instance instDivisionSemiring [DivisionSemiring α] : DivisionSemiring αᵃᵒ
6062
__ := instSemiring
6163
__ := instGroupWithZero
6264
nnqsmul := _
65+
nnqsmul_def := fun q a => rfl
6366
nnratCast_def q := unop_injective $ by rw [unop_nnratCast, unop_div, unop_natCast, unop_natCast,
6467
NNRat.cast_def, div_eq_mul_inv]
6568

6669
instance instDivisionRing [DivisionRing α] : DivisionRing αᵃᵒᵖ where
6770
__ := instRing
6871
__ := instDivisionSemiring
6972
qsmul := _
73+
qsmul_def := fun q a => rfl
7074
ratCast_def q := unop_injective <| by rw [unop_ratCast, Rat.cast_def, unop_div, unop_natCast,
7175
unop_intCast, div_eq_mul_inv]
7276

Mathlib/Algebra/Group/Submonoid/Operations.lean

+4-2
Original file line numberDiff line numberDiff line change
@@ -297,13 +297,15 @@ theorem map_id (S : Submonoid M) : S.map (MonoidHom.id M) = S :=
297297

298298
section GaloisCoinsertion
299299

300-
variable {ι : Type*} {f : F} (hf : Function.Injective f)
300+
variable {ι : Type*} {f : F}
301301

302302
/-- `map f` and `comap f` form a `GaloisCoinsertion` when `f` is injective. -/
303303
@[to_additive " `map f` and `comap f` form a `GaloisCoinsertion` when `f` is injective. "]
304-
def gciMapComap : GaloisCoinsertion (map f) (comap f) :=
304+
def gciMapComap (hf : Function.Injective f) : GaloisCoinsertion (map f) (comap f) :=
305305
(gc_map_comap f).toGaloisCoinsertion fun S x => by simp [mem_comap, mem_map, hf.eq_iff]
306306

307+
variable (hf : Function.Injective f)
308+
307309
@[to_additive]
308310
theorem comap_map_eq_of_injective (S : Submonoid M) : (S.map f).comap f = S :=
309311
(gciMapComap hf).u_l_eq _

Mathlib/Algebra/Order/Group/OrderIso.lean

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ variable (α)
3535
@[to_additive (attr := simps!) "`x ↦ -x` as an order-reversing equivalence."]
3636
def OrderIso.inv : α ≃o αᵒᵈ where
3737
toEquiv := (Equiv.inv α).trans OrderDual.toDual
38-
map_rel_iff' {_ _} := @inv_le_inv_iff α _ _ _ _ _ _
38+
map_rel_iff' {_ _} := inv_le_inv_iff (α := α)
3939

4040
end
4141

@@ -55,7 +55,7 @@ theorem le_inv' : a ≤ b⁻¹ ↔ b ≤ a⁻¹ :=
5555
@[to_additive (attr := simps!) "`x ↦ a - x` as an order-reversing equivalence."]
5656
def OrderIso.divLeft (a : α) : α ≃o αᵒᵈ where
5757
toEquiv := (Equiv.divLeft a).trans OrderDual.toDual
58-
map_rel_iff' {_ _} := @div_le_div_iff_left α _ _ _ _ _ _ _
58+
map_rel_iff' {_ _} := div_le_div_iff_left (α := α) _
5959

6060
end TypeclassesLeftRightLE
6161

Mathlib/Algebra/Order/Hom/Monoid.lean

+7-3
Original file line numberDiff line numberDiff line change
@@ -182,15 +182,18 @@ end OrderedZero
182182
section OrderedAddCommGroup
183183

184184
variable [OrderedAddCommGroup α] [OrderedAddCommMonoid β] [i : FunLike F α β]
185-
variable [iamhc : AddMonoidHomClass F α β] (f : F)
185+
variable (f : F)
186186

187-
theorem monotone_iff_map_nonneg : Monotone (f : α → β) ↔ ∀ a, 0 ≤ a → 0 ≤ f a :=
187+
theorem monotone_iff_map_nonneg [iamhc : AddMonoidHomClass F α β] :
188+
Monotone (f : α → β) ↔ ∀ a, 0 ≤ a → 0 ≤ f a :=
188189
fun h a => by
189190
rw [← map_zero f]
190191
apply h, fun h a b hl => by
191192
rw [← sub_add_cancel b a, map_add f]
192193
exact le_add_of_nonneg_left (h _ <| sub_nonneg.2 hl)⟩
193194

195+
variable [iamhc : AddMonoidHomClass F α β]
196+
194197
theorem antitone_iff_map_nonpos : Antitone (f : α → β) ↔ ∀ a, 0 ≤ a → f a ≤ 0 :=
195198
monotone_toDual_comp_iff.symm.trans <| monotone_iff_map_nonneg (β := βᵒᵈ) (iamhc := iamhc) _
196199

@@ -202,7 +205,8 @@ theorem antitone_iff_map_nonneg : Antitone (f : α → β) ↔ ∀ a ≤ 0, 0
202205

203206
variable [CovariantClass β β (· + ·) (· < ·)]
204207

205-
theorem strictMono_iff_map_pos : StrictMono (f : α → β) ↔ ∀ a, 0 < a → 0 < f a := by
208+
theorem strictMono_iff_map_pos [iamhc : AddMonoidHomClass F α β] :
209+
StrictMono (f : α → β) ↔ ∀ a, 0 < a → 0 < f a := by
206210
refine ⟨fun h a => ?_, fun h a b hl => ?_⟩
207211
· rw [← map_zero f]
208212
apply h

Mathlib/CategoryTheory/Category/GaloisConnection.lean

+4-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ def GaloisConnection.adjunction {l : X → Y} {u : Y → X} (gc : GaloisConnecti
2828
gc.monotone_l.functor ⊣ gc.monotone_u.functor :=
2929
CategoryTheory.Adjunction.mkOfHomEquiv
3030
{ homEquiv := fun X Y =>
31-
fun f => CategoryTheory.homOfLE (gc.le_u f.le),
32-
fun f => CategoryTheory.homOfLE (gc.l_le f.le), _, _⟩ }
31+
{ toFun := fun f => CategoryTheory.homOfLE (gc.le_u f.le)
32+
invFun := fun f => CategoryTheory.homOfLE (gc.l_le f.le)
33+
left_inv := by aesop_cat
34+
right_inv := by aesop_cat } }
3335

3436
end
3537

Mathlib/CategoryTheory/ComposableArrows.lean

+6-4
Original file line numberDiff line numberDiff line change
@@ -481,14 +481,13 @@ abbrev δlast (F : ComposableArrows C (n + 1)) := δlastFunctor.obj F
481481
section
482482

483483
variable {F G : ComposableArrows C (n + 1)}
484-
(α : F.obj' 0 ⟶ G.obj' 0)
485-
(β : F.δ₀ ⟶ G.δ₀)
486-
(w : F.map' 0 1 ≫ app' β 0 = α ≫ G.map' 0 1)
484+
487485

488486
/-- Inductive construction of morphisms in `ComposableArrows C (n + 1)`: in order to construct
489487
a morphism `F ⟶ G`, it suffices to provide `α : F.obj' 0 ⟶ G.obj' 0` and `β : F.δ₀ ⟶ G.δ₀`
490488
such that `F.map' 0 1 ≫ app' β 0 = α ≫ G.map' 0 1`. -/
491-
def homMkSucc : F ⟶ G :=
489+
def homMkSucc (α : F.obj' 0 ⟶ G.obj' 0) (β : F.δ₀ ⟶ G.δ₀)
490+
(w : F.map' 0 1 ≫ app' β 0 = α ≫ G.map' 0 1) : F ⟶ G :=
492491
homMk
493492
(fun i => match i with
494493
| ⟨0, _⟩ => α
@@ -498,6 +497,9 @@ def homMkSucc : F ⟶ G :=
498497
· exact w
499498
· exact naturality' β i (i + 1))
500499

500+
variable (α : F.obj' 0 ⟶ G.obj' 0) (β : F.δ₀ ⟶ G.δ₀)
501+
(w : F.map' 0 1 ≫ app' β 0 = α ≫ G.map' 0 1)
502+
501503
@[simp]
502504
lemma homMkSucc_app_zero : (homMkSucc α β w).app 0 = α := rfl
503505

Mathlib/CategoryTheory/Core.lean

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ variable {C} {G : Type u₂} [Groupoid.{v₂} G]
7272
/-- A functor from a groupoid to a category C factors through the core of C. -/
7373
def functorToCore (F : G ⥤ C) : G ⥤ Core C where
7474
obj X := F.obj X
75-
map f := F.map f, F.map (Groupoid.inv f), _, _⟩
75+
map f := { hom := F.map f, inv := F.map (Groupoid.inv f) }
7676

7777
/-- We can functorially associate to any functor from a groupoid to the core of a category `C`,
7878
a functor from the groupoid to `C`, simply by composing with the embedding `Core C ⥤ C`.

Mathlib/CategoryTheory/FiberedCategory/HomLift.lean

+5-3
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,16 @@ protected lemma id {p : 𝒳 ⥤ 𝒮} {R : 𝒮} {a : 𝒳} (ha : p.obj a = R)
7171

7272
section
7373

74-
variable {R S : 𝒮} {a b : 𝒳} (f : R ⟶ S) (φ : a ⟶ b) [p.IsHomLift f φ]
74+
variable {R S : 𝒮} {a b : 𝒳}
7575

76-
lemma domain_eq : p.obj a = R := by
76+
lemma domain_eq (f : R ⟶ S) (φ : a ⟶ b) [p.IsHomLift f φ] : p.obj a = R := by
7777
subst_hom_lift p f φ; rfl
7878

79-
lemma codomain_eq : p.obj b = S := by
79+
lemma codomain_eq (f : R ⟶ S) (φ : a ⟶ b) [p.IsHomLift f φ] : p.obj b = S := by
8080
subst_hom_lift p f φ; rfl
8181

82+
variable (f : R ⟶ S) (φ : a ⟶ b) [p.IsHomLift f φ]
83+
8284
lemma fac : f = eqToHom (domain_eq p f φ).symm ≫ p.map φ ≫ eqToHom (codomain_eq p f φ) := by
8385
subst_hom_lift p f φ; simp
8486

Mathlib/CategoryTheory/LiftingProperties/Adjunction.lean

+10-5
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,18 @@ namespace CommSq
3030
section
3131

3232
variable {A B : C} {X Y : D} {i : A ⟶ B} {p : X ⟶ Y} {u : G.obj A ⟶ X} {v : G.obj B ⟶ Y}
33-
(sq : CommSq u (G.map i) p v) (adj : G ⊣ F)
3433

3534
/-- When we have an adjunction `G ⊣ F`, any commutative square where the left
3635
map is of the form `G.map i` and the right map is `p` has an "adjoint" commutative
3736
square whose left map is `i` and whose right map is `F.map p`. -/
38-
theorem right_adjoint : CommSq (adj.homEquiv _ _ u) i (F.map p) (adj.homEquiv _ _ v) :=
37+
theorem right_adjoint (sq : CommSq u (G.map i) p v) (adj : G ⊣ F) :
38+
CommSq (adj.homEquiv _ _ u) i (F.map p) (adj.homEquiv _ _ v) :=
3939
by
4040
simp only [Adjunction.homEquiv_unit, assoc, ← F.map_comp, sq.w]
4141
rw [F.map_comp, Adjunction.unit_naturality_assoc]⟩
4242

43+
variable (sq : CommSq u (G.map i) p v) (adj : G ⊣ F)
44+
4345
/-- The liftings of a commutative are in bijection with the liftings of its (right)
4446
adjoint square. -/
4547
def rightAdjointLiftStructEquiv : sq.LiftStruct ≃ (sq.right_adjoint adj).LiftStruct where
@@ -72,19 +74,22 @@ end
7274
section
7375

7476
variable {A B : C} {X Y : D} {i : A ⟶ B} {p : X ⟶ Y} {u : A ⟶ F.obj X} {v : B ⟶ F.obj Y}
75-
(sq : CommSq u i (F.map p) v) (adj : G ⊣ F)
7677

7778
/-- When we have an adjunction `G ⊣ F`, any commutative square where the left
7879
map is of the form `i` and the right map is `F.map p` has an "adjoint" commutative
7980
square whose left map is `G.map i` and whose right map is `p`. -/
80-
theorem left_adjoint : CommSq ((adj.homEquiv _ _).symm u) (G.map i) p ((adj.homEquiv _ _).symm v) :=
81+
theorem left_adjoint (sq : CommSq u i (F.map p) v) (adj : G ⊣ F) :
82+
CommSq ((adj.homEquiv _ _).symm u) (G.map i) p ((adj.homEquiv _ _).symm v) :=
8183
by
8284
simp only [Adjunction.homEquiv_counit, assoc, ← G.map_comp_assoc, ← sq.w]
8385
rw [G.map_comp, assoc, Adjunction.counit_naturality]⟩
8486

87+
variable (sq : CommSq u i (F.map p) v) (adj : G ⊣ F)
88+
8589
/-- The liftings of a commutative are in bijection with the liftings of its (left)
8690
adjoint square. -/
87-
def leftAdjointLiftStructEquiv : sq.LiftStruct ≃ (sq.left_adjoint adj).LiftStruct where
91+
def leftAdjointLiftStructEquiv :
92+
sq.LiftStruct ≃ (sq.left_adjoint adj).LiftStruct where
8893
toFun l :=
8994
{ l := (adj.homEquiv _ _).symm l.l
9095
fac_left := by rw [← adj.homEquiv_naturality_left_symm, l.fac_left]

Mathlib/Control/LawfulFix.lean

+1-2
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,8 @@ theorem fix_le {X : (a : _) → Part <| β a} (hX : f X ≤ X) : Part.fix f ≤
158158
· apply hX
159159

160160
variable {f}
161-
variable (hc : Continuous f)
162161

163-
theorem fix_eq : Part.fix f = f (Part.fix f) := by
162+
theorem fix_eq (hc : Continuous f) : Part.fix f = f (Part.fix f) := by
164163
rw [fix_eq_ωSup f, hc]
165164
apply le_antisymm
166165
· apply ωSup_le_ωSup_of_le _

Mathlib/Data/Fintype/Card.lean

+3-2
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,8 @@ theorem card_lt_of_injective_of_not_mem (f : α → β) (h : Function.Injective
431431
calc
432432
card α = (univ.map ⟨f, h⟩).card := (card_map _).symm
433433
_ < card β :=
434-
Finset.card_lt_univ_of_not_mem <| by rwa [← mem_coe, coe_map, coe_univ, Set.image_univ]
434+
Finset.card_lt_univ_of_not_mem (x := b) <| by
435+
rwa [← mem_coe, coe_map, coe_univ, Set.image_univ]
435436

436437
theorem card_lt_of_injective_not_surjective (f : α → β) (h : Function.Injective f)
437438
(h' : ¬Function.Surjective f) : card α < card β :=
@@ -755,7 +756,7 @@ theorem Fintype.card_subtype_le [Fintype α] (p : α → Prop) [DecidablePred p]
755756

756757
theorem Fintype.card_subtype_lt [Fintype α] {p : α → Prop} [DecidablePred p] {x : α} (hx : ¬p x) :
757758
Fintype.card { x // p x } < Fintype.card α :=
758-
Fintype.card_lt_of_injective_of_not_mem (↑) Subtype.coe_injective <| by
759+
Fintype.card_lt_of_injective_of_not_mem (b := x) (↑) Subtype.coe_injective <| by
759760
rwa [Subtype.range_coe_subtype]
760761

761762
theorem Fintype.card_subtype [Fintype α] (p : α → Prop) [DecidablePred p] :

Mathlib/Deprecated/Group.lean

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ end IsMonoidHom
161161
homomorphism."]
162162
theorem IsMulHom.to_isMonoidHom [MulOneClass α] [Group β] {f : α → β} (hf : IsMulHom f) :
163163
IsMonoidHom f :=
164-
{ map_one := mul_right_eq_self.1 <| by rw [← hf.map_mul, one_mul]
164+
{ map_one := (mul_right_eq_self (a := f 1)).1 <| by rw [← hf.map_mul, one_mul]
165165
map_mul := hf.map_mul }
166166

167167
namespace IsMonoidHom

Mathlib/Order/Irreducible.lean

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ variable [WellFoundedGT α]
185185
elements. This is the order-theoretic analogue of prime factorisation. -/
186186
theorem exists_infIrred_decomposition (a : α) :
187187
∃ s : Finset α, s.inf id = a ∧ ∀ ⦃b⦄, b ∈ s → InfIrred b :=
188-
@exists_supIrred_decomposition αᵒᵈ _ _ _ _
188+
exists_supIrred_decomposition (α := αᵒᵈ) _
189189

190190
end SemilatticeInf
191191

0 commit comments

Comments
 (0)