-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathopenpr_V_v2_sweep2.txt
More file actions
602 lines (557 loc) · 25.9 KB
/
Copy pathopenpr_V_v2_sweep2.txt
File metadata and controls
602 lines (557 loc) · 25.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
====================================================================================================
CASE V PR #21624 (open-pr, v2 prompt, sweep2)
file: Mathlib/CategoryTheory/Pi/Monoidal.lean line: 50.0
reviewer: @b-mehta on 2025-02-14T03:02:00Z
advice_kind: signature / automation suggestion
prompt_tokens: 8019 completion_tokens: 3158
HUMAN reviewer (ground truth):
> I'm guessing that these are all explicitly written because aesop_cat can't do them? If that's correct, perhaps this is a sign that we should add ext to the set of things aesop_cat tries.
====================================================================================================
[SYSTEM]
----------------------------------------------------------------------------------------------------
You are an expert reviewer for the Lean 4 / mathlib4 mathematical library. Given a NEW code hunk from an open pull request and a set of historically retrieved (past_hunk, past_comment) pairs, your job is to identify which past reviewer feedback would also apply to the new hunk.
Compared to a naive matcher you must do TWO extra things, because the answer is often only derivable by combining evidence:
A. STRUCTURAL PATTERN EXTRACTION. Past comments often contain `suggestion` code blocks (```suggestion ... ```) or inline code-shape rewrites. These suggested code snippets ARE concrete advice, not just commentary. Treat them as first-class evidence about preferred Lean/mathlib idioms (e.g.: term-mode constructor `:= ⟨_, _, _⟩` vs `by use _; exact _`, `instance` vs `theorem` for class-membership statements, `refine ⟨..., ?_⟩` vs `use ...; constructor`, `@[simp]` / `@[to_additive]` attributes, naming conventions, docstring phrasing, etc.).
B. CROSS-CANDIDATE SYNTHESIS. The applicable advice for the new hunk may require combining evidence from multiple candidates. Example: candidate X's context tells you that an identifier in the new hunk is a `class`; candidate Y shows the term-mode `instance ... := ⟨...⟩` template for proving class membership. Together they support the conclusion: "the new theorem proving class membership should be rewritten as an `instance` with a term-mode constructor". List supporting PRs for any synthesised finding.
Reasoning protocol (do this internally before producing JSON):
1. STRUCTURAL FEATURES OF THE NEW HUNK. Identify each: tactic-mode vs term-mode? Uses `by use ...; exact ...`? Uses `use ...; constructor`? Declares an `instance` / a `theorem` / a `lemma` / a `def` / a `class`? Has `@[simp]`, `@[to_additive]`, `@[deprecated]`? Uses anonymous functions `fun x =>` vs `↦`? Has a docstring `/-- ... -/` of any specific shape?
2. PATTERN INVENTORY FROM CANDIDATES. For each candidate, note any concrete pattern shown in its suggested-code or comment (term-mode template, attribute recommendation, naming convention, idiomatic rewrite, terminology preference, etc.). Also note which candidates' past hunks define or use identifiers that appear in the new hunk (these are clues about whether something is a class, an instance, an alias, etc.).
3. APPLICABILITY CHECK. For each pattern from step 2, ask: does the new hunk's structure (step 1) instantiate the same shape that this pattern was applied to? If yes, that's a STRONG match. If two patterns combine to support a finding, list both supporting PRs.
4. STRICT REFUSAL. If after this analysis no candidate (alone or in combination) gives concrete, well-grounded advice for the specific code in the new hunk, output an empty `strong_matches` list. Do not paper over with generic advice. Generic style observations belong in `weak_observations`, clearly marked. Do not invent advice that isn't traceable to specific past PRs in the retrieval pool.
Confidence:
- "high" — at least one strong match is grounded in concrete suggested-code or explicit prose from a candidate, and the new hunk clearly fits the same shape
- "medium" — at least one strong match exists but requires synthesis or adaptation; OR a single candidate gives related but not identical advice
- "low" — only loose stylistic patterns; nothing actionable
- "none" — retrieved pool is unrelated; do not press an answer
Output JSON ONLY, matching this exact schema:
{
"summary": "<one sentence describing what we found>",
"confidence": "high"|"medium"|"low"|"none",
"strong_matches": [
{
"past_pr": <int>,
"past_file": "<string>",
"past_comment_excerpt": "<verbatim short quote from the past comment OR the relevant snippet from its suggestion block>",
"applies_because": "<one or two sentences linking past code/comment to the new hunk's structure>",
"suggested_adaptation": "<one sentence on what the reviewer might say on the new hunk>",
"supporting_past_prs": [<int>, ...]
}
],
"weak_observations": [
{
"observation": "<short string>",
"supporting_past_prs": [<int>, ...]
}
]
}
Quote short — under 40 words per excerpt. Be precise about which PR(s) support each finding via supporting_past_prs.
[USER]
----------------------------------------------------------------------------------------------------
NEW HUNK from open PR #21624 (file: Mathlib/CategoryTheory/Pi/Monoidal.lean):
```
@@ -0,0 +1,54 @@
... [10 lines above hidden]
+/-!
+# The pointwise monoidal strucutre on the product of families of monoidal categories
+
+Given a family of monoidal categories `C i`, we define a monoidal structure on
+`Π i, C i` where the tensor product is defined pointwise.
+
+-/
+
+namespace CategoryTheory
+
+namespace Pi
+
+open Category MonoidalCategory
+
+universe w₁ v₁ u₁
+
+variable {I : Type w₁} (C : I → Type u₁) [∀ i, Category.{v₁} (C i)]
+[∀ i, MonoidalCategory (C i)]
+
+/-- `Pi.monoidal C` equipps the product of an indexed family of categories with
+a pointwise monoidal structure. -/
+@[simps]
+instance monoidal : MonoidalCategory.{max w₁ v₁} (∀ i, C i) where
+ tensorObj X Y := fun i ↦ X i ⊗ Y i
+ whiskerLeft X _ _ f := fun i ↦ X i ◁ f i
+ whiskerRight f Z := fun i ↦ f i ▷ Z i
+ tensorHom f g := fun i ↦ f i ⊗ g i
+ tensorUnit := fun i ↦ 𝟙_ (C i)
+ associator X Y Z := isoMk (fun i ↦ α_ (X i) (Y i) (Z i))
+ leftUnitor X := isoMk (fun i ↦ λ_ (X i))
+ rightUnitor X := isoMk (fun i ↦ ρ_ (X i))
+ tensorHom_def _ _ := by ext i; simp only [tensorHom, tensorHom_def, comp_apply]
+ tensor_id _ _ := by ext i; aesop
+ tensor_comp _ _ _ _ := by ext i; aesop
+ whiskerLeft_id _ _ := by ext i; aesop
+ id_whiskerRight _ _ := by ext i; aesop
+ associator_naturality _ _ _ := by ext i; aesop
+ leftUnitor_naturality _ := by ext i; aesop
+ rightUnitor_naturality _ := by ext i; aesop
+ pentagon _ _ _ _ := by ext i; aesop
+ triangle _ _ := by ext i; aesop
```
RETRIEVED CANDIDATES (top-20 by hunk-embedding similarity, sorted by sim desc):
--- candidate 1 (sim=0.933, past_pr=#33183, file=Mathlib/CategoryTheory/Pi/Monoidal.lean) ---
PAST HUNK:
```
@@ -0,0 +1,167 @@
... [69 lines above hidden]
+@[simp]
+theorem right_unitor_hom_apply {X : ∀ i, C i} {i : I} :
+ (ρ_ X).hom i = (ρ_ (X i)).hom := rfl
+
+@[simp]
+theorem right_unitor_inv_apply {X : ∀ i, C i} {i : I} :
+ (ρ_ X).inv i = (ρ_ (X i)).inv := rfl
+
+@[simp]
+theorem isoApp_right_unitor {X : ∀ i, C i} {i : I} :
+ isoApp (ρ_ X) i = ρ_ (X i) := rfl
+
+/-- `Pi.monoidal C` equips the product of an indexed family of categories with
```
PAST COMMENT (from reviewer):
```suggestion
/-- `Pi.monoidalCategory C` equips the product of an indexed family of categories with
```
--- candidate 2 (sim=0.913, past_pr=#33183, file=Mathlib/CategoryTheory/Pi/Monoidal.lean) ---
PAST HUNK:
```
@@ -0,0 +1,167 @@
... [28 lines above hidden]
+
+open Category MonoidalCategory
+
+variable {I : Type w₁} {C : I → Type u₁} [∀ i, Category.{v₁} (C i)]
+[∀ i, MonoidalCategory (C i)]
+
+@[simps tensorObj tensorHom whiskerLeft whiskerRight tensorUnit]
+instance monoidalCategoryStruct : MonoidalCategoryStruct (∀ i, C i) where
+ tensorObj := fun X Y i ↦ X i ⊗ Y i
+ tensorHom f g := fun i ↦ f i ⊗ₘ g i
+ whiskerLeft X _ _ f := fun i ↦ X i ◁ f i
+ whiskerRight f Y := fun i ↦ f i ▷ Y i
+ tensorUnit := fun i ↦ 𝟙_ (C i)
```
PAST COMMENT (from reviewer):
```suggestion
tensorObj X Y i := X i ⊗ Y i
tensorHom f g i := f i ⊗ₘ g i
whiskerLeft X _ _ f i := X i ◁ f i
whiskerRight f Y i := f i ▷ Y i
tensorUnit i := 𝟙_ (C i)
```
--- candidate 3 (sim=0.762, past_pr=#33412, file=Mathlib/CategoryTheory/Pi/Monoidal.lean) ---
PAST HUNK:
```
@@ -161,6 +161,96 @@ instance monoidalClosed : MonoidalClosed (∀ i, C i) where
... [10 lines above hidden]
+
+instance [∀ i, BraidedCategory (C i)] (i : I) : (Pi.eval C i).Braided where
+
+@[simps]
+instance laxMonoidalPi' {D : Type*} [Category* D] [MonoidalCategory D] (F : ∀ i : I, D ⥤ C i)
+ [∀ i, (F i).LaxMonoidal] : (Functor.pi' F).LaxMonoidal where
+ ε := fun i ↦ Functor.LaxMonoidal.ε (F i)
+ μ X Y := fun i ↦ Functor.LaxMonoidal.μ (F i) X Y
+
+@[simps]
+instance opLaxMonoidalPi' {D : Type*} [Category* D] [MonoidalCategory D]
+ (F : ∀ i : I, D ⥤ C i)
+ [∀ i, (F i).OplaxMonoidal] : (Functor.pi' F).OplaxMonoidal where
```
PAST COMMENT (from reviewer):
```suggestion
[∀ i, (F i).OplaxMonoidal] :
(Functor.pi' F).OplaxMonoidal where
```
--- candidate 4 (sim=0.762, past_pr=#33412, file=Mathlib/CategoryTheory/Pi/Monoidal.lean) ---
PAST HUNK:
```
@@ -161,6 +161,96 @@ instance monoidalClosed : MonoidalClosed (∀ i, C i) where
... [3 lines above hidden]
+@[simps!]
+instance (i : I) : (Pi.eval C i).Monoidal where
+ ε := 𝟙 _
+ μ X Y := 𝟙 _
+ η := 𝟙 _
+ δ X Y := 𝟙 _
+
+instance [∀ i, BraidedCategory (C i)] (i : I) : (Pi.eval C i).Braided where
+
+@[simps]
+instance laxMonoidalPi' {D : Type*} [Category* D] [MonoidalCategory D] (F : ∀ i : I, D ⥤ C i)
+ [∀ i, (F i).LaxMonoidal] : (Functor.pi' F).LaxMonoidal where
```
PAST COMMENT (from reviewer):
```suggestion
[∀ i, (F i).LaxMonoidal] :
(Functor.pi' F).LaxMonoidal where
```
--- candidate 5 (sim=0.748, past_pr=#10905, file=Mathlib/CategoryTheory/Monoidal/Mon_.lean) ---
PAST HUNK:
```
@@ -497,14 +498,39 @@ instance monMonoidalStruct : MonoidalCategoryStruct (Mon_ C) :=
... [14 lines above hidden]
+
+@[simp]
+theorem whiskerLeft_hom {X Y : Mon_ C} (f : X ⟶ Y) (Z : Mon_ C) :
+ (f ▷ Z).hom = f.hom ▷ Z.X := by
+ rw [← tensorHom_id]; rfl
+
+@[simp]
+theorem whiskerRight_hom (X : Mon_ C) {Y Z : Mon_ C} (f : Y ⟶ Z) :
+ (X ◁ f).hom = X.X ◁ f.hom := by
+ rw [← id_tensorHom]; rfl
+
+@[simp]
+theorem left_unitor_hom_hom (X : Mon_ C) : (λ_ X).hom.hom = (λ_ X.X).hom := rfl
```
PAST COMMENT (from reviewer):
I would suggest this name change here (and below):
```suggestion
theorem leftUnitor_hom_hom (X : Mon_ C) : (λ_ X).hom.hom = (λ_ X.X).hom := rfl
```
(Similarly, in the bicategory setting, I believe `left_unitor` should be renamed `leftUnitor`, etc.)
--- candidate 6 (sim=0.720, past_pr=#2230, file=Mathlib/CategoryTheory/Pi/Basic.lean) ---
PAST HUNK:
```
@@ -0,0 +1,326 @@
... [157 lines above hidden]
+[_inst_2 : forall (j : J), CategoryTheory.Category.{u2, u1} (D j)] (s :
+Sum.{u3, u3} I J), CategoryTheory.Category.{u2, u1} (Sum.elim.{u3, u3, succ
+(succ u1)} I J Type.{u1} C D s) Case conversion may be inaccurate. Consider
+using '#align category_theory.pi.sum_elim_category
+CategoryTheory.Pi.sumElimCategoryₓ'. -/
+instance sumElimCategory : ∀ s : Sum I J, Category.{v₁} (Sum.elim C D s)
+ | Sum.inl i => by
+ dsimp
+ infer_instance
+ | Sum.inr j => by
+ dsimp
+ infer_instance
+#align category_theory.pi.sum_elim_category CategoryTheory.Pi.sumElimCategory
```
PAST COMMENT (from reviewer):
I agree. But note that my suggestion adds the little `ₓ` to the align statement, as the comment instructs. And please leave a porting note.
--- candidate 7 (sim=0.720, past_pr=#2230, file=Mathlib/CategoryTheory/Pi/Basic.lean) ---
PAST HUNK:
```
@@ -0,0 +1,326 @@
... [157 lines above hidden]
+[_inst_2 : forall (j : J), CategoryTheory.Category.{u2, u1} (D j)] (s :
+Sum.{u3, u3} I J), CategoryTheory.Category.{u2, u1} (Sum.elim.{u3, u3, succ
+(succ u1)} I J Type.{u1} C D s) Case conversion may be inaccurate. Consider
+using '#align category_theory.pi.sum_elim_category
+CategoryTheory.Pi.sumElimCategoryₓ'. -/
+instance sumElimCategory : ∀ s : Sum I J, Category.{v₁} (Sum.elim C D s)
+ | Sum.inl i => by
+ dsimp
+ infer_instance
+ | Sum.inr j => by
+ dsimp
+ infer_instance
+#align category_theory.pi.sum_elim_category CategoryTheory.Pi.sumElimCategory
```
PAST COMMENT (from reviewer):
```suggestion
instance sumElimCategory : ∀ s : Sum I J, Category.{v₁} (Sum.elim C D s)
| Sum.inl i => by
dsimp
infer_instance
| Sum.inr j => by
dsimp
infer_instance
#align category_theory.pi.sum_elim_category CategoryTheory.Pi.sumElimCategoryₓ -- Porting note: reordered universes
```
--- candidate 8 (sim=0.706, past_pr=#33201, file=Mathlib/CategoryTheory/Monoidal/Cartesian/FunctorCategory.lean) ---
PAST HUNK:
```
@@ -192,6 +192,28 @@ protected def RepresentableBy.tensorObj {F : Cᵒᵖ ⥤ Type v} {G : Cᵒᵖ
... [12 lines above hidden]
+ ext
+ · simp only [comp_id, id_comp, whiskerRight_app_fst]
+ apply whiskerRight_app_fst
+ · simp only [comp_id, id_comp, whiskerRight_app_snd]
+ apply whiskerRight_app_snd
+ μIso_hom_natural_right G f := by
+ ext
+ dsimp
+ ext
+ · simp only [comp_id, id_comp, whiskerLeft_app_fst]
+ apply whiskerLeft_app_fst
+ · simp only [comp_id, id_comp, whiskerLeft_app_snd]
+ apply whiskerLeft_app_snd }
```
PAST COMMENT (from reviewer):
This seems to be a (less general) duplicate of [CategoryTheory.Functor.Monoidal.whiskeringLeft](https://leanprover-community.github.io/mathlib4_docs/Mathlib/CategoryTheory/Monoidal/FunctorCategory.html#CategoryTheory.Functor.Monoidal.whiskeringLeft)
--- candidate 9 (sim=0.705, past_pr=#24679, file=Mathlib/CategoryTheory/ChosenFiniteProducts.lean) ---
PAST HUNK:
```
@@ -68,6 +67,127 @@ class ChosenFiniteProducts (C : Type u) [Category.{v} C] extends MonoidalCategor
namespace ChosenFiniteProducts
+variable {C : Type u} [Category.{v} C]
+
+section OfChosenFiniteProducts
+variable (𝒯 : LimitCone (Functor.empty.{0} C)) (ℬ : ∀ X Y : C, LimitCone (pair X Y))
+ {X₁ X₂ X₃ Y₁ Y₂ Y₃ Z₁ Z₂ : C}
+
+namespace ofChosenFiniteProducts
+
+/-- Implementation of the tensor product for `ChosenFiniteProducts.ofCartesianMonoidalCategory`. -/
+abbrev tensorObj (X Y : C) : C := (ℬ X Y).cone.pt
+
+/-- Implementation of the tensor product of morphisms for
+`ChosenFiniteProducts.ofCartesianMonoidalCategory`. -/
+abbrev tensorHom (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) : tensorObj ℬ X₁ X₂ ⟶ tensorObj ℬ Y₁ Y₂ :=
+ (BinaryFan.IsLimit.lift' (ℬ Y₁ Y₂).isLimit ((ℬ X₁ X₂).cone.π.app ⟨.left⟩ ≫ f)
+ (((ℬ X₁ X₂).cone.π.app ⟨.right⟩ : (ℬ X₁ X₂).cone.pt ⟶ X₂) ≫ g)).val
+
+lemma tensor_id (X Y : C) : tensorHom ℬ (𝟙 X) (𝟙 Y) = 𝟙 (tensorObj ℬ X Y) :=
+ (ℬ _ _).isLimit.hom_ext <| by rintro ⟨_ | _⟩ <;> simp [tensorHom]
+
... [71 more lines hidden]
```
PAST COMMENT (from reviewer):
Is there a reason why we want to keep this instead of inlining it?
--- candidate 10 (sim=0.701, past_pr=#26448, file=Mathlib/CategoryTheory/Monoidal/Category.lean) ---
PAST HUNK:
```
@@ -160,12 +160,12 @@ class MonoidalCategory (C : Type u) [𝒞 : Category.{v} C] extends MonoidalCate
/-- Tensor product of identity maps is the identity: `𝟙 X₁ ⊗ₘ 𝟙 X₂ = 𝟙 (X₁ ⊗ X₂)` -/
tensor_id : ∀ X₁ X₂ : C, 𝟙 X₁ ⊗ₘ 𝟙 X₂ = 𝟙 (X₁ ⊗ X₂) := by aesop_cat
/--
- Tensor product of compositions is composition of tensor products:
- `(f₁ ≫ g₁) ⊗ₘ (f₂ ≫ g₂) = (f₁ ⊗ₘ f₂) ≫ (g₁ ⊗ₘ g₂)`
+ Composition of tensor products is tensor product of compositions:
+ `(f₁ ⊗ₘ f₂) ≫ (g₁ ⊗ₘ g₂) = (f₁ ≫ g₁) ⊗ₘ (f₂ ≫ g₂)`
-/
- tensor_comp :
+ tensorHom_comp_tensorHom :
```
PAST COMMENT (from reviewer):
What was the rational for flipping this around vs adding the simp tag backwards?
--- candidate 11 (sim=0.700, past_pr=#19511, file=Mathlib/Algebra/Category/ModuleCat/Monoidal/Basic.lean) ---
PAST HUNK:
```
@@ -95,63 +97,36 @@ instance instMonoidalCategoryStruct : MonoidalCategoryStruct (ModuleCat.{u} R) w
tensorObj := tensorObj
whiskerLeft := whiskerLeft
whiskerRight := whiskerRight
- tensorHom f g := TensorProduct.map f g
+ tensorHom f g := asHom <| TensorProduct.map f.hom g.hom
tensorUnit := ModuleCat.of R R
associator := associator
leftUnitor := leftUnitor
rightUnitor := rightUnitor
-section
-
-/-! The `associator_naturality` and `pentagon` lemmas below are very slow to elaborate.
-
-We give them some help by expressing the lemmas first non-categorically, then using
-`convert _aux using 1` to have the elaborator work as little as possible. -/
-
-
-open TensorProduct (assoc map)
-
-private theorem associator_naturality_aux {X₁ X₂ X₃ : Type*} [AddCommMonoid X₁] [AddCommMonoid X₂]
- [AddCommMonoid X₃] [Module R X₁] [Module R X₂] [Module R X₃] {Y₁ Y₂ Y₃ : Type*}
- [AddCommMonoid Y₁] [AddCommMonoid Y₂] [AddCommMonoid Y₃] [Module R Y₁] [Module R Y₂]
... [7 more lines hidden]
```
PAST COMMENT (from reviewer):
This makes me happy :)
--- candidate 12 (sim=0.697, past_pr=#7389, file=Mathlib/CategoryTheory/GradedObject/Monoidal.lean) ---
PAST HUNK:
```
@@ -271,10 +296,351 @@ lemma associator_naturality (f₁ : X₁ ⟶ Y₁) (f₂ : X₂ ⟶ Y₂) (f₃
... [311 lines above hidden]
+ Cofan.IsColimit.desc (isColimitCofanTensor X₁ X₂ j) (fun ⟨⟨i₁, i₂⟩, hi⟩ => f i₁ i₂ hi)
+
+@[reassoc (attr := simp)]
+lemma ι_descTensor (j : I) (f : ∀ (i₁ i₂ : I) (_ : i₁ + i₂ = j), X₁ i₁ ⊗ X₂ i₂ ⟶ A)
+ (i₁ i₂ : I) (hi : i₁ + i₂ = j) :
+ ιTensorObj X₁ X₂ i₁ i₂ j hi ≫ descTensor f = f i₁ i₂ hi := by
+ apply Cofan.IsColimit.fac
+
+@[ext]
+lemma tensorObj_ext {j : I} (f g : (X₁ ⊗ X₂) j ⟶ A)
+ (h : ∀ (i₁ i₂ : I) (hi : i₁ + i₂ = j),
+ ιTensorObj X₁ X₂ i₁ i₂ j hi ≫ f = ιTensorObj X₁ X₂ i₁ i₂ j hi ≫ g) : f = g :=
+ Monoidal.tensorObj_ext f g h-/
```
PAST COMMENT (from reviewer):
Do you intend to keep this in the PR? Should it be un-commented?
--- candidate 13 (sim=0.695, past_pr=#14457, file=Mathlib/CategoryTheory/GradedObject/Monoidal.lean) ---
PAST HUNK:
```
@@ -376,6 +528,61 @@ end Triangle
... [39 lines above hidden]
+ rintro ⟨⟨_, _⟩, _⟩ ⟨⟨_, _⟩, _⟩ h
+ simpa using h
+
+instance (n : ℕ) : Finite ({ i : (ℕ × ℕ × ℕ) | i.1 + i.2.1 + i.2.2 = n }) := by
+ refine Finite.of_injective (fun ⟨⟨i₁, i₂, i₃⟩, (hi : i₁ + i₂ + i₃ = n)⟩ =>
+ (⟨⟨i₁, by omega⟩, ⟨i₂, by omega⟩, ⟨i₃, by omega⟩⟩ :
+ Fin (n + 1) × Fin (n + 1) × Fin (n + 1))) ?_
+ rintro ⟨⟨_, _, _⟩, _⟩ ⟨⟨_, _, _⟩, _⟩ h
+ simpa using h
+
+-- Note: this is stated as a lemma instead of an example, because otherwise
+-- CI would complain that importing `Mathlib.CategoryTheory.Limits.Preserves.Finite`
+-- is unnecessary.
```
PAST COMMENT (from reviewer):
So it is unnecessary, then.
I'm not going to object, but this section could become a file `GradedObject/Monoidal/Finite.lean`?
--- candidate 14 (sim=0.694, past_pr=#7277, file=Mathlib/CategoryTheory/Bicategory/End.lean) ---
PAST HUNK:
```
@@ -41,6 +41,7 @@ instance (X : C) : MonoidalCategory (EndMonoidal X) where
tensorObj f g := f ≫ g
whiskerLeft {f g h} η := f ◁ η
whiskerRight {f g} η h := η ▷ h
+ tensorHom {X₁ Y₁ X₂ Y₂} f g := (f ▷ X₂) ≫ (Y₁ ◁ g)
```
PAST COMMENT (from reviewer):
With the previous API, there was not even a chance to use the old constructor! I would suggest not merging this PR, as it goes in the other direction as @yuma-mizuno's planned refactor.
--- candidate 15 (sim=0.685, past_pr=#36613, file=Mathlib/CategoryTheory/Monoidal/Types/Basic.lean) ---
PAST HUNK:
```
@@ -120,7 +125,8 @@ theorem CartesianMonoidalCategory.lift_apply {X Y Z : Type u} {f : X ⟶ Y} {g :
of a type to the image of that type, tensored with the image of the nth Cartesian power. -/
noncomputable def MonoidalFunctor.mapPi {C : Type*} [Category* C] [MonoidalCategory C]
(F : Type _ ⥤ C) [F.Monoidal] (n : ℕ) (β : Type*) :
- F.obj (Fin (n + 1) → β) ≅ F.obj β ⊗ F.obj (Fin n → β) :=
- Functor.mapIso _ (Fin.consEquiv _).symm.toIso ≪≫ (Functor.Monoidal.μIso F β (Fin n → β)).symm
+ F.obj ((Fin (n + 1) → β)) ≅ F.obj (β) ⊗ F.obj ((Fin n → β)) :=
+ Functor.mapIso _ (Fin.consEquiv _).symm.toIso ≪≫
```
PAST COMMENT (from reviewer):
```suggestion
Functor.mapIso _ (Fin.consEquiv _).symm.toIso ≪≫ (Functor.Monoidal.μIso F β (Fin n → β)).symm
```
--- candidate 16 (sim=0.679, past_pr=#10061, file=Mathlib/CategoryTheory/Monoidal/Category.lean) ---
PAST HUNK:
```
@@ -557,8 +739,111 @@ abbrev ofTensorHom [MonoidalCategoryStruct C]
... [71 lines above hidden]
+
+@[reassoc (attr := simp)]
+theorem triangle_assoc_comp_left_inv (X Y : C) :
+ (𝟙 X ⊗ (λ_ Y).inv) ≫ (α_ X (𝟙_ C) Y).inv = (ρ_ X).inv ⊗ 𝟙 Y := by
+ simp
+#align category_theory.monoidal_category.triangle_assoc_comp_left_inv CategoryTheory.MonoidalCategory.triangle_assoc_comp_left_inv
+
+theorem rightUnitor_conjugation {X Y : C} (f : X ⟶ Y) :
+ f ⊗ 𝟙 (𝟙_ C) = (ρ_ X).hom ≫ f ≫ (ρ_ Y).inv := by
+ simp
+#align category_theory.monoidal_category.right_unitor_conjugation CategoryTheory.MonoidalCategory.rightUnitor_conjugation
+
+theorem leftUnitor_conjugation {X Y : C} (f : X ⟶ Y) :
```
PAST COMMENT (from reviewer):
These two lemmas could have the `reassoc` attribute. Otherwise, the PR looks great to me!
--- candidate 17 (sim=0.678, past_pr=#11248, file=Mathlib/CategoryTheory/ChosenFiniteProducts.lean) ---
PAST HUNK:
```
@@ -0,0 +1,126 @@
+/-
+Copyright (c) 2024 Adam Topaz All rights reserved.
+Released under Apache 2.0 license as described in the file LICENSE.
+Authors: Adam Topaz
+-/
+
+import Mathlib.CategoryTheory.Monoidal.OfChosenFiniteProducts.Symmetric
+import Mathlib.CategoryTheory.Limits.Constructions.FiniteProductsOfBinaryProducts
+
+/-!
+
```
PAST COMMENT (from reviewer):
```suggestion
```
--- candidate 18 (sim=0.674, past_pr=#31346, file=Mathlib/CategoryTheory/Monoidal/FunctorCategory.lean) ---
PAST HUNK:
```
@@ -191,14 +191,16 @@ instance functorCategorySymmetric : SymmetricCategory (C ⥤ D) where
end SymmetricCategory
@[simps]
-instance {C D E : Type*} [Category C] [Category D] [Category E] [MonoidalCategory D]
+instance whiskeringRightLaxMonoidal
```
PAST COMMENT (from reviewer):
This could be in the `Functor.LaxMonoidal` namespace as `Functor.LaxMonoidal.whiskeringRight`.
--- candidate 19 (sim=0.674, past_pr=#10195, file=Mathlib/CategoryTheory/Monoidal/Mon_.lean) ---
PAST HUNK:
```
@@ -412,7 +412,7 @@ theorem Mon_tensor_mul_one (M N : Mon_ C) :
(M.X ⊗ N.X) ◁ ((λ_ (𝟙_ C)).inv ≫ (M.one ⊗ N.one)) ≫
tensor_μ C (M.X, N.X) (M.X, N.X) ≫ (M.mul ⊗ N.mul) =
(ρ_ (M.X ⊗ N.X)).hom := by
- simp only [whiskerLeft_comp_assoc]
+ simp only [MonoidalCategory.whiskerLeft_comp_assoc]
```
PAST COMMENT (from reviewer):
Although this comment is not directly related to this PR, what do you think about renaming `CategoryTheory.whiskerLeft_comp` to `CategoryTheory.NatTrans.whiskerLeft_comp` or `CategoryTheory.Functor.whiskerLeft_comp` in another PR to avoid this kind of fixes?
--- candidate 20 (sim=0.672, past_pr=#30684, file=Mathlib/CategoryTheory/Monoidal/OfHasFiniteProducts.lean) ---
PAST HUNK:
```
@@ -65,76 +55,72 @@ attribute [local instance] monoidalOfHasFiniteProducts
... [24 lines above hidden]
-theorem tensorHom {W X Y Z : C} (f : W ⟶ X) (g : Y ⟶ Z) : f ⊗ₘ g = Limits.prod.map f g :=
- rfl
-
-@[simp]
-theorem whiskerLeft (X : C) {Y Z : C} (f : Y ⟶ Z) : X ◁ f = Limits.prod.map (𝟙 X) f :=
- rfl
-
-@[simp]
-theorem whiskerRight {X Y : C} (f : X ⟶ Y) (Z : C) : f ▷ Z = Limits.prod.map f (𝟙 Z) :=
- rfl
-
-@[simp]
+@[deprecated CartesianMonoidalCategory.leftUnitor_hom (since := "2025-10-19"), simp, reassoc]
```
PAST COMMENT (from reviewer):
```suggestion
@[deprecated CartesianMonoidalCategory.leftUnitor_hom (since := "2025-10-19"), simp]
```
Decide which candidates' comments genuinely apply to the NEW hunk. If none, say so. Output JSON only.
[ASSISTANT]
----------------------------------------------------------------------------------------------------
{
"summary": "Two prior comments apply: (1) prefer giving the final argument explicitly in structure fields instead of `:= fun i ↦ …`; (2) refer to this construction as `Pi.monoidalCategory C` in the docstring.",
"confidence": "high",
"strong_matches": [
{
"past_pr": 33183,
"past_file": "Mathlib/CategoryTheory/Pi/Monoidal.lean",
"past_comment_excerpt": "tensorObj X Y i := X i ⊗ Y i",
"applies_because": "The new instance defines fields like `tensorObj X Y := fun i ↦ …` and `tensorHom f g := fun i ↦ …`, matching the pattern the reviewer suggested rewriting with the `i` argument on the LHS.",
"suggested_adaptation": "Rewrite the field definitions as `tensorObj X Y i := …`, `tensorHom f g i := …`, `whiskerLeft … i := …`, `whiskerRight … i := …`, and `tensorUnit i := …`.",
"supporting_past_prs": [
33183
]
},
{
"past_pr": 33183,
"past_file": "Mathlib/CategoryTheory/Pi/Monoidal.lean",
"past_comment_excerpt": "/-- `Pi.monoidalCategory C` equips the product … -/",
"applies_because": "The new docstring says `/-- `Pi.monoidal C` … -/`, which matches the earlier spot the reviewer asked to say `Pi.monoidalCategory C` instead.",
"suggested_adaptation": "Change the docstring to say ``Pi.monoidalCategory C`` rather than ``Pi.monoidal C``.",
"supporting_past_prs": [
33183
]
}
],
"weak_observations": [
{
"observation": "Docstring typos: “strucutre” → “structure”; “equipps” → “equips”.",
"supporting_past_prs": []
}
]
}