Skip to content

Commit be5810e

Browse files
committed
chore: golf using grind and simp (leanprover-community#36380)
The goal of this PR is to decrease the number of times lemmas are called explicitly. Any decrease in compilation time is a welcome side effect, although it is not a primary objective. Trace profiling results (differences <30 ms considered measurement noise): * `AlgebraicGeometry.Scheme.zariskiTopology_le_propQCTopology`: unchanged 🎉 * `CategoryTheory.Pretriangulated.shift_opShiftFunctorEquivalence_counitIso_inv_app`: unchanged 🎉 * `Finset.exists_subset_or_subset_of_two_mul_lt_card`: 210 ms before, 173 ms after 🎉 Profiled using `set_option trace.profiler true in`. This PR is batched under the following guidelines: * Up to ~5 changed files per PR * Up to ~25 changed declarations per PR * Up to ~100 changed lines per PR
1 parent 151b5c4 commit be5810e

3 files changed

Lines changed: 6 additions & 18 deletions

File tree

Mathlib/AlgebraicGeometry/Sites/QuasiCompact.lean

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -217,15 +217,8 @@ lemma Cover.mem_propQCTopology {S : Scheme.{u}} (𝒰 : Cover.{u} (precoverage P
217217
rwa [presieve₀_mem_qcPrecoverage_iff]
218218

219219
lemma zariskiTopology_le_propQCTopology [P.IsMultiplicative] [IsZariskiLocalAtSource P] :
220-
zariskiTopology ≤ propQCTopology P := by
221-
apply Precoverage.toGrothendieck_mono
222-
rw [le_inf_iff]
223-
refine ⟨?_, ?_⟩
224-
· apply zariskiPrecoverage_le_qcPrecoverage
225-
· rw [precoverage, precoverage]
226-
gcongr
227-
refine MorphismProperty.precoverage_monotone fun X Y h hf ↦
228-
IsZariskiLocalAtSource.of_isOpenImmersion _
220+
zariskiTopology ≤ propQCTopology P :=
221+
Precoverage.toGrothendieck_mono zariskiPrecoverage_le_propQCPrecoverage
229222

230223
end Property
231224

Mathlib/CategoryTheory/Triangulated/Opposite/Basic.lean

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,10 +334,7 @@ lemma shift_opShiftFunctorEquivalence_counitIso_inv_app
334334
shift_shiftFunctorCompIsoId_hom_app, op_comp, unop_comp, Quiver.Hom.unop_op,
335335
Functor.map_comp, Iso.inv_hom_id_app_assoc, Functor.op_obj]
336336
apply Quiver.Hom.unop_inj
337-
dsimp
338-
simp only [Category.assoc, ← Functor.map_comp_assoc, Iso.unop_hom_inv_id_app_assoc]
339-
congr 3
340-
exact (NatIso.naturality_1 (shiftFunctorCompIsoId C n (-n) (by lia)) _).symm
337+
simp
341338

342339
/-- Given objects `X` and `Y` in `Cᵒᵖ`, this is the bijection
343340
`(op (X.unop⟦n⟧) ⟶ Y) ≃ (X ⟶ Y⟦n⟧)` for any `n : ℤ`. -/

Mathlib/Data/Finset/Card.lean

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -656,11 +656,9 @@ theorem le_card_iff_exists_subset_card : n ≤ #s ↔ ∃ t ⊆ s, #t = n := by
656656

657657
theorem exists_subset_or_subset_of_two_mul_lt_card [DecidableEq α] {X Y : Finset α} {n : ℕ}
658658
(hXY : 2 * n < #(X ∪ Y)) : ∃ C : Finset α, n < #C ∧ (C ⊆ X ∨ C ⊆ Y) := by
659-
have h₁ : #(X ∩ (Y \ X)) = 0 := Finset.card_eq_zero.mpr (by grind)
660-
have h₂ : #(X ∪ Y) = #X + #(Y \ X) := by grind
661-
obtain h | h : n < #X ∨ n < #(Y \ X) := by lia
662-
· exact ⟨X, by grind⟩
663-
· exact ⟨Y \ X, by grind⟩
659+
grind =>
660+
have : #(X ∪ Y) = #X + #(Y \ X)
661+
finish
664662

665663
/-! ### Explicit description of a finset from its card -/
666664

0 commit comments

Comments
 (0)