Repository navigation
[Merged by Bors] - refactor(Order/Category): concrete category refactor for basic orders - #21409
Vierkantor wants to merge 14 commits into
Conversation
PR summary 603727a8ca
|
| File | Base Count | Head Count | Change |
|---|---|---|---|
| Mathlib.Order.Category.Preord | 406 | 405 | -1 (-0.25%) |
| Mathlib.Order.Category.PartOrd | 411 | 410 | -1 (-0.24%) |
| Mathlib.Order.Category.Lat | 414 | 413 | -1 (-0.24%) |
| Mathlib.Order.Category.Semilat | 414 | 413 | -1 (-0.24%) |
| Mathlib.Order.Category.BddOrd | 415 | 414 | -1 (-0.24%) |
| Mathlib.Order.Category.DistLat | 415 | 414 | -1 (-0.24%) |
| Mathlib.Order.Category.LinOrd | 415 | 414 | -1 (-0.24%) |
| Mathlib.Order.Category.Frm | 418 | 417 | -1 (-0.24%) |
| Mathlib.Order.Category.BddLat | 423 | 422 | -1 (-0.24%) |
| Mathlib.Order.Category.BddDistLat | 425 | 424 | -1 (-0.24%) |
| Mathlib.Order.Category.HeytAlg | 427 | 426 | -1 (-0.23%) |
| Mathlib.Order.Category.BoolAlg | 431 | 430 | -1 (-0.23%) |
| Mathlib.Order.Category.FinPartOrd | 544 | 543 | -1 (-0.18%) |
| Mathlib.Order.Category.FinBddDistLat | 588 | 587 | -1 (-0.17%) |
| Mathlib.Order.Category.FinBoolAlg | 601 | 600 | -1 (-0.17%) |
| Mathlib.Algebra.Category.BoolRing | 635 | 634 | -1 (-0.16%) |
| Mathlib.Order.Category.NonemptyFinLinOrd | 643 | 642 | -1 (-0.16%) |
| Mathlib.Topology.Specialization | 774 | 773 | -1 (-0.13%) |
| Mathlib.Topology.Order.Category.AlexDisc | 775 | 774 | -1 (-0.13%) |
| Mathlib.AlgebraicTopology.SimplexCategory | 822 | 821 | -1 (-0.12%) |
| Mathlib.AlgebraicTopology.SimplicialSet.Nerve | 843 | 842 | -1 (-0.12%) |
| Mathlib.AlgebraicTopology.TopologicalSimplex | 1257 | 1256 | -1 (-0.08%) |
| Mathlib.Topology.Category.CompHaus.Frm | 1504 | 1503 | -1 (-0.07%) |
| Mathlib.Topology.Category.Locale | 1505 | 1504 | -1 (-0.07%) |
| Mathlib.Topology.Order.Category.FrameAdjunction | 1506 | 1505 | -1 (-0.07%) |
Import changes for all files
| Files | Import difference |
|---|---|
72 filesMathlib.Algebra.Category.BoolRing Mathlib.AlgebraicTopology.AlternatingFaceMapComplex Mathlib.AlgebraicTopology.CechNerve Mathlib.AlgebraicTopology.DoldKan.Decomposition Mathlib.AlgebraicTopology.DoldKan.Degeneracies Mathlib.AlgebraicTopology.DoldKan.EquivalenceAdditive Mathlib.AlgebraicTopology.DoldKan.EquivalencePseudoabelian Mathlib.AlgebraicTopology.DoldKan.Equivalence Mathlib.AlgebraicTopology.DoldKan.Faces Mathlib.AlgebraicTopology.DoldKan.FunctorGamma Mathlib.AlgebraicTopology.DoldKan.FunctorN Mathlib.AlgebraicTopology.DoldKan.GammaCompN Mathlib.AlgebraicTopology.DoldKan.Homotopies Mathlib.AlgebraicTopology.DoldKan.HomotopyEquivalence Mathlib.AlgebraicTopology.DoldKan.NCompGamma Mathlib.AlgebraicTopology.DoldKan.NReflectsIso Mathlib.AlgebraicTopology.DoldKan.Normalized Mathlib.AlgebraicTopology.DoldKan.Notations Mathlib.AlgebraicTopology.DoldKan.PInfty Mathlib.AlgebraicTopology.DoldKan.Projections Mathlib.AlgebraicTopology.DoldKan.SplitSimplicialObject Mathlib.AlgebraicTopology.ExtraDegeneracy Mathlib.AlgebraicTopology.MooreComplex Mathlib.AlgebraicTopology.Quasicategory.Basic Mathlib.AlgebraicTopology.Quasicategory.Nerve Mathlib.AlgebraicTopology.Quasicategory.StrictSegal Mathlib.AlgebraicTopology.SimplexCategory Mathlib.AlgebraicTopology.SimplicialCategory.Basic Mathlib.AlgebraicTopology.SimplicialCategory.SimplicialObject Mathlib.AlgebraicTopology.SimplicialNerve Mathlib.AlgebraicTopology.SimplicialObject.Basic Mathlib.AlgebraicTopology.SimplicialObject.Coskeletal Mathlib.AlgebraicTopology.SimplicialObject.Split Mathlib.AlgebraicTopology.SimplicialSet.Basic Mathlib.AlgebraicTopology.SimplicialSet.Boundary Mathlib.AlgebraicTopology.SimplicialSet.Coskeletal Mathlib.AlgebraicTopology.SimplicialSet.HomotopyCat Mathlib.AlgebraicTopology.SimplicialSet.Horn Mathlib.AlgebraicTopology.SimplicialSet.KanComplex Mathlib.AlgebraicTopology.SimplicialSet.Monoidal Mathlib.AlgebraicTopology.SimplicialSet.Nerve Mathlib.AlgebraicTopology.SimplicialSet.Path Mathlib.AlgebraicTopology.SimplicialSet.StdSimplex Mathlib.AlgebraicTopology.SimplicialSet.StrictSegal Mathlib.AlgebraicTopology.SingularSet Mathlib.AlgebraicTopology.TopologicalSimplex Mathlib.CategoryTheory.Idempotents.SimplicialObject Mathlib.Order.Category.BddDistLat Mathlib.Order.Category.BddLat Mathlib.Order.Category.BddOrd Mathlib.Order.Category.BoolAlg Mathlib.Order.Category.DistLat Mathlib.Order.Category.FinBddDistLat Mathlib.Order.Category.FinBoolAlg Mathlib.Order.Category.FinPartOrd Mathlib.Order.Category.Frm Mathlib.Order.Category.HeytAlg Mathlib.Order.Category.Lat Mathlib.Order.Category.LinOrd Mathlib.Order.Category.NonemptyFinLinOrd Mathlib.Order.Category.PartOrd Mathlib.Order.Category.Preord Mathlib.Order.Category.Semilat Mathlib.RepresentationTheory.GroupCohomology.Basic Mathlib.RepresentationTheory.GroupCohomology.Hilbert90 Mathlib.RepresentationTheory.GroupCohomology.LowDegree Mathlib.RepresentationTheory.GroupCohomology.Resolution Mathlib.Topology.Category.CompHaus.Frm Mathlib.Topology.Category.Locale Mathlib.Topology.Order.Category.AlexDisc Mathlib.Topology.Order.Category.FrameAdjunction Mathlib.Topology.Specialization |
-1 |
Declarations diff
+ instance (X : NonemptyFinLinOrd) : BoundedOrder X
+ instance (x : SimplexCategory) (n : ℕ) : OfNat (ToType x) n
+ instance (x : SimplexCategory) : CoeFun x.toTopObj fun _ => ToType x → ℝ≥0
+ instance (x : SimplexCategory) : Fintype (ToType x)
+ instance : Category BddDistLat.{u}
+ instance : Category BddOrd.{u}
+ instance : Category BoolAlg.{u}
+ instance : Category DistLat.{u}
+ instance : Category FinBddDistLat.{u}
+ instance : Category Frm.{u}
+ instance : Category HeytAlg.{u}
+ instance : Category Lat.{u}
+ instance : Category LinOrd.{u}
+ instance : Category PartOrd.{u}
+ instance : Category Preord.{u}
+ instance : CoeSort BoolAlg (Type _)
+ instance : CoeSort DistLat.{u} (Type u)
+ instance : CoeSort Frm (Type _)
+ instance : CoeSort HeytAlg (Type _)
+ instance : CoeSort Lat (Type _)
+ instance : CoeSort LinOrd (Type _)
+ instance : CoeSort NonemptyFinLinOrd (Type _)
+ instance : CoeSort PartOrd (Type _)
+ instance : CoeSort Preord (Type u)
+ instance : ConcreteCategory BddDistLat (BoundedLatticeHom · ·)
+ instance : ConcreteCategory BddLat (BoundedLatticeHom · ·)
+ instance : ConcreteCategory BddOrd (BoundedOrderHom · ·)
+ instance : ConcreteCategory BoolAlg (BoundedLatticeHom · ·)
+ instance : ConcreteCategory DistLat (LatticeHom · ·)
+ instance : ConcreteCategory FinBddDistLat (BoundedLatticeHom · ·)
+ instance : ConcreteCategory Frm (FrameHom · ·)
+ instance : ConcreteCategory HeytAlg (HeytingHom · ·)
+ instance : ConcreteCategory Lat (LatticeHom · ·)
+ instance : ConcreteCategory LinOrd (· →o ·)
+ instance : ConcreteCategory NonemptyFinLinOrd (· →o ·)
+ instance : ConcreteCategory PartOrd (· →o ·)
+ instance : ConcreteCategory Preord (· →o ·)
+ instance : ConcreteCategory SemilatInfCat (InfTopHom · ·)
+ instance : ConcreteCategory SemilatSupCat (SupBotHom · ·)
+ instance : ConcreteCategory SimplexCategory (fun i j => Fin (i.len + 1) →o Fin (j.len + 1))
+ instance : LargeCategory NonemptyFinLinOrd
+ toType_apply
++ concreteCategory
+++++++++++ coe_comp
+++++++++++ coe_id
+++++++++++ forget_map
+++++++++++ hom_inv_apply
+++++++++++ inv_hom_apply
+++++++++++ ofHom_apply
+++++++++++ ofHom_comp
+++++++++++ ofHom_id
++++++++++++ Hom.hom
++++++++++++ ext
+++++++++++++ hom_ofHom
+++++++++++++ ofHom_hom
++++++++++++++ Hom.Simps.hom
++++++++++++++ comp_apply
++++++++++++++ hom_comp
++++++++++++++ hom_ext
++++++++++++++ hom_id
++++++++++++++ id_apply
++++++++++++++ ofHom
+++++++++++++++++----------------- of
+++++++++------+----- coe_of
- Fin.nonemptyFiniteLinearOrder
- NonemptyFiniteLinearOrder
- PUnit.nonemptyFiniteLinearOrder
- ULift.nonemptyFiniteLinearOrder
- forget_map_apply
- instBooleanAlgebra
- instBoundedLatticeHomClass
- instance (X : BddLat) : Lattice X
- instance (X : BddOrd) : PartialOrder X
- instance (X : DistLat) : DistribLattice X
- instance (X : FinBoolAlg) : BooleanAlgebra X
- instance (X : Frm) : Frame X
- instance (X : HeytAlg) : HeytingAlgebra X
- instance (X : Lat) : Lattice X
- instance (priority := 100) NonemptyFiniteLinearOrder.toBoundedOrder (α : Type*)
- instance (x : SimplexCategory) (n : ℕ) : OfNat (HasForget.forget.obj x) n
- instance (x : SimplexCategory) : CoeFun x.toTopObj fun _ => x → ℝ≥0
- instance (x : SimplexCategory) : Fintype (HasForget.forget.obj x)
- instance (α : LinOrd) : LinearOrder α
- instance (α : NonemptyFinLinOrd) : NonemptyFiniteLinearOrder α
- instance (α : PartOrd) : PartialOrder α
- instance (α : Preord) : Preorder α
- instance (α : Type*) [NonemptyFiniteLinearOrder α] : NonemptyFiniteLinearOrder αᵒᵈ
- instance : BundledHom @LatticeHom
- instance : BundledHom @OrderHom
- instance : BundledHom.ParentProjection @DistribLattice.toLattice
- instance : BundledHom.ParentProjection @LinearOrder.toPartialOrder
- instance : BundledHom.ParentProjection @NonemptyFiniteLinearOrder.toLinearOrder
- instance : BundledHom.ParentProjection @PartialOrder.toPreorder
- instance : CoeSort BoolAlg Type*
- instance : CoeSort DistLat Type*
- instance : CoeSort Frm Type*
- instance : CoeSort HeytAlg Type*
- instance : CoeSort Lat Type*
- instance : CoeSort LinOrd Type*
- instance : CoeSort NonemptyFinLinOrd Type*
- instance : CoeSort PartOrd Type*
- instance : CoeSort Preord Type*
- instance : HasForget BddDistLat
- instance : HasForget BddLat
- instance : HasForget BoolAlg
- instance : HasForget DistLat
- instance : HasForget Frm := by
- instance : HasForget HeytAlg := by
- instance : HasForget Lat
- instance : HasForget LinOrd
- instance : HasForget NonemptyFinLinOrd
- instance : HasForget PartOrd
- instance : HasForget Preord
- instance : HasForget SemilatInfCat
- instance : HasForget SemilatSupCat
- instance : HasForget.{0} SimplexCategory
- instance : Inhabited DistLat
- instance : Inhabited Lat
- instance : Inhabited PartOrd
- instance : LargeCategory.{u} BddDistLat
- instance : LargeCategory.{u} BoolAlg
- instance : LargeCategory.{u} Lat
- instance {A B : NonemptyFinLinOrd.{u}} : FunLike (A ⟶ B) A B
- instance {A B : NonemptyFinLinOrd.{u}} : OrderHomClass (A ⟶ B) A B
- instance {X Y : HeytAlg.{u}} : FunLike (X ⟶ Y) ↑X ↑Y
- instance {X Y : HeytAlg.{u}} : HeytingHomClass (X ⟶ Y) ↑X ↑Y
-++++++++++++ Hom
-+-+ hasForgetToBddDistLat
-- bundledHom
-- largeCategory
---- hasForget
----- instFunLike
You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>
## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>The doc-module for script/declarations_diff.sh contains some details about this script.
Decrease in tech debt: (relative, absolute) = (28.00, 0.01)
| Current number | Change | Type |
|---|---|---|
| 4030 | -28 | porting notes |
Current commit 603727a8ca
Reference commit e05e225065
You can run this locally as
./scripts/technical-debt-metrics.sh pr_summary
- The
relativevalue is the weighted sum of the differences with weight given by the inverse of the current value of the statistic. - The
absolutevalue is therelativevalue divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).
|
!bench |
|
Here are the benchmark results for commit e187402. Benchmark Metric Change
======================================================================
- ~Mathlib.AlgebraicTopology.SimplicialSet.Nerve instructions 137.4%
- ~Mathlib.Order.Category.DistLat instructions 270.8%
- ~Mathlib.Order.Category.Lat instructions 172.3%
- ~Mathlib.Order.Category.LinOrd instructions 77.8%
- ~Mathlib.Order.Category.NonemptyFinLinOrd instructions 96.7% |
3 files, Instructions +1.0⬝10⁹
2 files, Instructions -2.0⬝10⁹
|
|
Most of those slowdowns are in files that grew quite a bit. Looks like |
| theorem coe_of (α : Type*) [PartialOrder α] [BoundedOrder α] : ↥(of α) = α := | ||
| lemma hom_id {X : BddOrd} : (𝟙 X : X ⟶ X).hom = BoundedOrderHom.id _ := rfl | ||
|
|
||
| /- Provided for rewriting. -/ |
There was a problem hiding this comment.
Is this meant to be a docstring?
There was a problem hiding this comment.
It's more of a comment explaining why this isn't marked as @[simp]. But we can docstringify all of these comments.
There was a problem hiding this comment.
I'm just surprised you're using single-line multi-line comments
| unfold Frm | ||
| infer_instance | ||
| @[simp] | ||
| lemma hom_comp {X Y Z : Frm} (f : X ⟶ Y) (g : Y ⟶ Z) : |
There was a problem hiding this comment.
Don't you feel like there should be automation for this now?
There was a problem hiding this comment.
Mhm, it would be helpful although I don't quite know what form that would take. It's hard to state this inside the type theory itself, since for each base morphism (that is FrameHom, not Frm.Hom) the type of comp can take a different shape. Maybe a metaprogram generating all the boilerplate?
| X.str | ||
| variable {R} in | ||
| /-- Use the `ConcreteCategory.hom` projection for `@[simps]` lemmas. -/ | ||
| def Hom.Simps.hom (X Y : Lat.{u}) (f : Hom X Y) := |
There was a problem hiding this comment.
Similarly automation here would help
Adding a |
|
I've been looking at |
|
Oh, interesting. Looking at a timeout in |
|
(by the way, this is a refactor PR, not a feat PR, right?) |
Nope, changing this doesn't seem to help much... |
|
Huh, if I turn |
|
In the process of investigation I ended up adding |
|
!bench |
|
Here are the benchmark results for commit 98ccd36. Benchmark Metric Change
======================================================================
+ ~Mathlib.AlgebraicTopology.SimplicialSet.Nerve instructions -62.8%
- ~Mathlib.Order.Category.BddDistLat instructions 52.6%
- ~Mathlib.Order.Category.BoolAlg instructions 64.0%
- ~Mathlib.Order.Category.DistLat instructions 268.7%
- ~Mathlib.Order.Category.NonemptyFinLinOrd instructions 86.0% |
2 files, Instructions +26.0⬝10⁹
4 files, Instructions +7.0⬝10⁹
2 files, Instructions +5.0⬝10⁹
3 files, Instructions +3.0⬝10⁹
2 files, Instructions +2.0⬝10⁹
3 files, Instructions +1.0⬝10⁹
|
|
The extra slowdown in |
|
!bench |
Co-authored-by: Yaël Dillies <[email protected]>
8711c27 to
8e086bf
Compare
|
bors merge |
…#21409) This PR implements `Hom` classes and `ConcreteCategory` instances for the following categories of orders: * `Preord` * `PartOrd`, `FinPartOrd` * `Lat` * `DistLat` * `LinOrd`, `NonemptyFinLinOrd` * `BddOrd` * `Frm` * `BddLat` * `BddDistLat`, `FinBddDistLat` * `BoolAlg`, `FinBoolAlg` * `HeytAlg` It also replaces `HasForget` instances with `ConcreteCategory` instances for the following categories of orders: * `SemilatSupCat`, `SemilatInfCat` * `SimplexCategory` The following order categories still need to be refactored: * `CompleteLat` * `ωCPO` Zulip thread: https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/Concrete.20category.20class.20redesign Co-authored-by: Anne Baanen <[email protected]>
|
Build failed (retrying...): |
…#21409) This PR implements `Hom` classes and `ConcreteCategory` instances for the following categories of orders: * `Preord` * `PartOrd`, `FinPartOrd` * `Lat` * `DistLat` * `LinOrd`, `NonemptyFinLinOrd` * `BddOrd` * `Frm` * `BddLat` * `BddDistLat`, `FinBddDistLat` * `BoolAlg`, `FinBoolAlg` * `HeytAlg` It also replaces `HasForget` instances with `ConcreteCategory` instances for the following categories of orders: * `SemilatSupCat`, `SemilatInfCat` * `SimplexCategory` The following order categories still need to be refactored: * `CompleteLat` * `ωCPO` Zulip thread: https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/Concrete.20category.20class.20redesign Co-authored-by: Anne Baanen <[email protected]>
|
Build failed (retrying...):
|
…#21409) This PR implements `Hom` classes and `ConcreteCategory` instances for the following categories of orders: * `Preord` * `PartOrd`, `FinPartOrd` * `Lat` * `DistLat` * `LinOrd`, `NonemptyFinLinOrd` * `BddOrd` * `Frm` * `BddLat` * `BddDistLat`, `FinBddDistLat` * `BoolAlg`, `FinBoolAlg` * `HeytAlg` It also replaces `HasForget` instances with `ConcreteCategory` instances for the following categories of orders: * `SemilatSupCat`, `SemilatInfCat` * `SimplexCategory` The following order categories still need to be refactored: * `CompleteLat` * `ωCPO` Zulip thread: https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/Concrete.20category.20class.20redesign Co-authored-by: Anne Baanen <[email protected]>
|
Build failed: |
|
Looks like the build failure was caused by relying on the definition of the |
|
bors merge |
…#21409) This PR implements `Hom` classes and `ConcreteCategory` instances for the following categories of orders: * `Preord` * `PartOrd`, `FinPartOrd` * `Lat` * `DistLat` * `LinOrd`, `NonemptyFinLinOrd` * `BddOrd` * `Frm` * `BddLat` * `BddDistLat`, `FinBddDistLat` * `BoolAlg`, `FinBoolAlg` * `HeytAlg` It also replaces `HasForget` instances with `ConcreteCategory` instances for the following categories of orders: * `SemilatSupCat`, `SemilatInfCat` * `SimplexCategory` The following order categories still need to be refactored: * `CompleteLat` * `ωCPO` Zulip thread: https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/Concrete.20category.20class.20redesign Co-authored-by: Anne Baanen <[email protected]>
|
Pull request successfully merged into master. Build succeeded: |
This PR implements
Homclasses andConcreteCategoryinstances for the following categories of orders:PreordPartOrd,FinPartOrdLatDistLatLinOrd,NonemptyFinLinOrdBddOrdFrmBddLatBddDistLat,FinBddDistLatBoolAlg,FinBoolAlgHeytAlgIt also replaces
HasForgetinstances withConcreteCategoryinstances for the following categories of orders:SemilatSupCat,SemilatInfCatSimplexCategoryThe following order categories still need to be refactored:
CompleteLatωCPOZulip thread: https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/Concrete.20category.20class.20redesign