Skip to content

Commit b75e009

Browse files
feat: port Order.Category.BddDistLatCat (#5015)
Co-authored-by: Yaël Dillies <yael.dillies@gmail.com>
1 parent b5e7466 commit b75e009

File tree

2 files changed

+127
-0
lines changed

2 files changed

+127
-0
lines changed

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2270,6 +2270,7 @@ import Mathlib.Order.Bounded
22702270
import Mathlib.Order.BoundedOrder
22712271
import Mathlib.Order.Bounds.Basic
22722272
import Mathlib.Order.Bounds.OrderIso
2273+
import Mathlib.Order.Category.BddDistLatCat
22732274
import Mathlib.Order.Category.BddLatCat
22742275
import Mathlib.Order.Category.BddOrdCat
22752276
import Mathlib.Order.Category.DistLatCat
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
/-
2+
Copyright (c) 2022 Yaël Dillies. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Yaël Dillies
5+
6+
! This file was ported from Lean 3 source module order.category.BddDistLat
7+
! leanprover-community/mathlib commit e8ac6315bcfcbaf2d19a046719c3b553206dac75
8+
! Please do not edit these lines, except to modify the commit id
9+
! if you have ported upstream changes.
10+
-/
11+
import Mathlib.Order.Category.BddLatCat
12+
import Mathlib.Order.Category.DistLatCat
13+
14+
/-!
15+
# The category of bounded distributive lattices
16+
17+
This defines `BddDistLatCat`, the category of bounded distributive lattices.
18+
19+
Note that this category is sometimes called [`DistLat`](https://ncatlab.org/nlab/show/DistLat) when
20+
being a lattice is understood to entail having a bottom and a top element.
21+
-/
22+
23+
set_option linter.uppercaseLean3 false
24+
25+
universe u
26+
27+
open CategoryTheory
28+
29+
/-- The category of bounded distributive lattices with bounded lattice morphisms. -/
30+
structure BddDistLatCat where
31+
toDistLatCat : DistLatCat
32+
[isBoundedOrder : BoundedOrder toDistLatCat]
33+
#align BddDistLat BddDistLatCat
34+
35+
namespace BddDistLatCat
36+
37+
instance : CoeSort BddDistLatCat (Type _) :=
38+
fun X => X.toDistLatCat⟩
39+
40+
instance (X : BddDistLatCat) : DistribLattice X :=
41+
X.toDistLatCat.str
42+
43+
attribute [instance] BddDistLatCat.isBoundedOrder
44+
45+
/-- Construct a bundled `BddDistLatCat` from a `BoundedOrder` `DistribLattice`. -/
46+
def of (α : Type _) [DistribLattice α] [BoundedOrder α] : BddDistLatCat :=
47+
-- Porting note: was `⟨⟨α⟩⟩`
48+
-- see https://github.com/leanprover-community/mathlib4/issues/4998
49+
⟨{α := α}⟩
50+
#align BddDistLat.of BddDistLatCat.of
51+
52+
@[simp]
53+
theorem coe_of (α : Type _) [DistribLattice α] [BoundedOrder α] : ↥(of α) = α :=
54+
rfl
55+
#align BddDistLat.coe_of BddDistLatCat.coe_of
56+
57+
instance : Inhabited BddDistLatCat :=
58+
⟨of PUnit⟩
59+
60+
/-- Turn a `BddDistLatCat` into a `BddLatCat` by forgetting it is distributive. -/
61+
def toBddLat (X : BddDistLatCat) : BddLatCat :=
62+
BddLatCat.of X
63+
#align BddDistLat.to_BddLat BddDistLatCat.toBddLat
64+
65+
@[simp]
66+
theorem coe_toBddLat (X : BddDistLatCat) : ↥X.toBddLat = ↥X :=
67+
rfl
68+
#align BddDistLatCat.coe_to_BddLat BddDistLatCat.coe_toBddLat
69+
70+
instance : LargeCategory.{u} BddDistLatCat :=
71+
InducedCategory.category toBddLat
72+
73+
instance : ConcreteCategory BddDistLatCat :=
74+
InducedCategory.concreteCategory toBddLat
75+
76+
instance hasForgetToDistLat : HasForget₂ BddDistLatCat DistLatCat where
77+
forget₂ :=
78+
-- Porting note: was `⟨X⟩`
79+
-- see https://github.com/leanprover-community/mathlib4/issues/4998
80+
{ obj := fun X => { α := X }
81+
map := fun {X Y} => BoundedLatticeHom.toLatticeHom }
82+
#align BddDistLat.has_forget_to_DistLat BddDistLatCat.hasForgetToDistLat
83+
84+
instance hasForgetToBddLat : HasForget₂ BddDistLatCat BddLatCat :=
85+
InducedCategory.hasForget₂ toBddLat
86+
#align BddDistLat.has_forget_to_BddLat BddDistLatCat.hasForgetToBddLat
87+
88+
theorem forget_bddLat_latCat_eq_forget_distLatCat_latCat :
89+
forget₂ BddDistLatCat BddLatCat ⋙ forget₂ BddLatCat LatCat =
90+
forget₂ BddDistLatCat DistLatCat ⋙ forget₂ DistLatCat LatCat :=
91+
rfl
92+
#align BddDistLat.forget_BddLat_Lat_eq_forget_DistLat_Lat BddDistLatCat.forget_bddLat_latCat_eq_forget_distLatCat_latCat
93+
94+
/-- Constructs an equivalence between bounded distributive lattices from an order isomorphism
95+
between them. -/
96+
@[simps]
97+
def Iso.mk {α β : BddDistLatCat.{u}} (e : α ≃o β) : α ≅ β where
98+
hom := (e : BoundedLatticeHom α β)
99+
inv := (e.symm : BoundedLatticeHom β α)
100+
hom_inv_id := by ext; exact e.symm_apply_apply _
101+
inv_hom_id := by ext; exact e.apply_symm_apply _
102+
#align BddDistLat.iso.mk BddDistLatCat.Iso.mk
103+
104+
/-- `OrderDual` as a functor. -/
105+
@[simps]
106+
def dual : BddDistLatCat ⥤ BddDistLatCat where
107+
obj X := of Xᵒᵈ
108+
map {X Y} := BoundedLatticeHom.dual
109+
#align BddDistLat.dual BddDistLatCat.dual
110+
111+
/-- The equivalence between `BddDistLatCat` and itself induced by `OrderDual` both ways. -/
112+
@[simps functor inverse]
113+
def dualEquiv : BddDistLatCat ≌ BddDistLatCat where
114+
functor := dual
115+
inverse := dual
116+
unitIso := NatIso.ofComponents fun X => Iso.mk <| OrderIso.dualDual X
117+
counitIso := NatIso.ofComponents fun X => Iso.mk <| OrderIso.dualDual X
118+
#align BddDistLat.dual_equiv BddDistLatCat.dualEquiv
119+
120+
end BddDistLatCat
121+
122+
theorem bddDistLatCat_dual_comp_forget_to_distLatCat :
123+
BddDistLatCat.dual ⋙ forget₂ BddDistLatCat DistLatCat =
124+
forget₂ BddDistLatCat DistLatCat ⋙ DistLatCat.dual :=
125+
rfl
126+
#align BddDistLat_dual_comp_forget_to_DistLat bddDistLatCat_dual_comp_forget_to_distLatCat

0 commit comments

Comments
 (0)