|
| 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.FinBoolAlg |
| 7 | +! leanprover-community/mathlib commit 937b1c59c58710ef8ed91f8727ef402d49d621a2 |
| 8 | +! Please do not edit these lines, except to modify the commit id |
| 9 | +! if you have ported upstream changes. |
| 10 | +-/ |
| 11 | +import Mathlib.Data.Fintype.Powerset |
| 12 | +import Mathlib.Order.Category.BoolAlgCat |
| 13 | +import Mathlib.Order.Category.FinBddDistLatCat |
| 14 | +import Mathlib.Order.Hom.CompleteLattice |
| 15 | +import Mathlib.Tactic.ApplyFun |
| 16 | + |
| 17 | +/-! |
| 18 | +# The category of finite boolean algebras |
| 19 | +
|
| 20 | +This file defines `FinBoolAlgCat`, the category of finite boolean algebras. |
| 21 | +
|
| 22 | +## TODO |
| 23 | +
|
| 24 | +Birkhoff's representation for finite Boolean algebras. |
| 25 | +
|
| 26 | +``` |
| 27 | +FintypeCat_to_FinBoolAlgCat_op.left_op ⋙ FinBoolAlgCat.dual ≅ |
| 28 | +FintypeCat_to_FinBoolAlgCat_op.left_op |
| 29 | +``` |
| 30 | +
|
| 31 | +`FinBoolAlgCat` is essentially small. |
| 32 | +-/ |
| 33 | + |
| 34 | +set_option linter.uppercaseLean3 false |
| 35 | + |
| 36 | +universe u |
| 37 | + |
| 38 | +open CategoryTheory OrderDual Opposite |
| 39 | + |
| 40 | +/-- The category of finite boolean algebras with bounded lattice morphisms. -/ |
| 41 | +structure FinBoolAlgCat where |
| 42 | + toBoolAlgCat : BoolAlgCat |
| 43 | + [isFintype : Fintype toBoolAlgCat] |
| 44 | +#align FinBoolAlg FinBoolAlgCat |
| 45 | + |
| 46 | +namespace FinBoolAlgCat |
| 47 | + |
| 48 | +instance : CoeSort FinBoolAlgCat (Type _) := |
| 49 | + ⟨fun X => X.toBoolAlgCat⟩ |
| 50 | + |
| 51 | +instance (X : FinBoolAlgCat) : BooleanAlgebra X := |
| 52 | + X.toBoolAlgCat.str |
| 53 | + |
| 54 | +attribute [instance] FinBoolAlgCat.isFintype |
| 55 | + |
| 56 | +-- Porting note: linter says this is a syntactic tautology now |
| 57 | +-- @[simp] |
| 58 | +-- theorem coe_toBoolAlgCat (X : FinBoolAlgCat) : ↥X.toBoolAlgCat = ↥X := |
| 59 | +-- rfl |
| 60 | +-- #align FinBoolAlg.coe_to_BoolAlg FinBoolAlgCat.coe_toBoolAlgCat |
| 61 | +#noalign FinBoolAlg.coe_to_BoolAlg |
| 62 | + |
| 63 | +/-- Construct a bundled `FinBoolAlgCat` from `BooleanAlgebra` + `Fintype`. -/ |
| 64 | +def of (α : Type _) [BooleanAlgebra α] [Fintype α] : FinBoolAlgCat := |
| 65 | + ⟨{α := α}⟩ |
| 66 | +#align FinBoolAlg.of FinBoolAlgCat.of |
| 67 | + |
| 68 | +@[simp] |
| 69 | +theorem coe_of (α : Type _) [BooleanAlgebra α] [Fintype α] : ↥(of α) = α := |
| 70 | + rfl |
| 71 | +#align FinBoolAlg.coe_of FinBoolAlgCat.coe_of |
| 72 | + |
| 73 | +instance : Inhabited FinBoolAlgCat := |
| 74 | + ⟨of PUnit⟩ |
| 75 | + |
| 76 | +instance largeCategory : LargeCategory FinBoolAlgCat := |
| 77 | + InducedCategory.category FinBoolAlgCat.toBoolAlgCat |
| 78 | +#align FinBoolAlg.large_category FinBoolAlgCat.largeCategory |
| 79 | + |
| 80 | +instance concreteCategory : ConcreteCategory FinBoolAlgCat := |
| 81 | + InducedCategory.concreteCategory FinBoolAlgCat.toBoolAlgCat |
| 82 | +#align FinBoolAlg.concrete_category FinBoolAlgCat.concreteCategory |
| 83 | + |
| 84 | +-- Porting note: added |
| 85 | +-- TODO: in all of the earlier bundled order categories, |
| 86 | +-- we should be constructing instances analogous to this, |
| 87 | +-- rather than directly coercions to functions. |
| 88 | +instance instBoundedLatticeHomClass {X Y : FinBoolAlgCat} : BoundedLatticeHomClass (X ⟶ Y) X Y := |
| 89 | + BoundedLatticeHom.instBoundedLatticeHomClass |
| 90 | + |
| 91 | +instance hasForgetToBoolAlg : HasForget₂ FinBoolAlgCat BoolAlgCat := |
| 92 | + InducedCategory.hasForget₂ FinBoolAlgCat.toBoolAlgCat |
| 93 | +#align FinBoolAlg.has_forget_to_BoolAlg FinBoolAlgCat.hasForgetToBoolAlg |
| 94 | + |
| 95 | +instance hasForgetToFinBddDistLat : HasForget₂ FinBoolAlgCat FinBddDistLatCat where |
| 96 | + forget₂ := |
| 97 | + { obj := fun X => FinBddDistLatCat.of X |
| 98 | + map := fun {X Y} f => f } |
| 99 | + forget_comp := rfl |
| 100 | +#align FinBoolAlg.has_forget_to_FinBddDistLat FinBoolAlgCat.hasForgetToFinBddDistLat |
| 101 | + |
| 102 | +instance forgetToBoolAlgFull : Full (forget₂ FinBoolAlgCat BoolAlgCat) := |
| 103 | + InducedCategory.full _ |
| 104 | +#align FinBoolAlg.forget_to_BoolAlg_full FinBoolAlgCat.forgetToBoolAlgFull |
| 105 | + |
| 106 | +instance forgetToBoolAlgFaithful : Faithful (forget₂ FinBoolAlgCat BoolAlgCat) := |
| 107 | + InducedCategory.faithful _ |
| 108 | +#align FinBoolAlg.forget_to_BoolAlg_faithful FinBoolAlgCat.forgetToBoolAlgFaithful |
| 109 | + |
| 110 | +@[simps] |
| 111 | +instance hasForgetToFinPartOrd : HasForget₂ FinBoolAlgCat FinPartOrd |
| 112 | + where forget₂ := |
| 113 | + { obj := fun X => FinPartOrd.of X |
| 114 | + map := fun {X Y} f => show OrderHom X Y from ↑(show BoundedLatticeHom X Y from f) } |
| 115 | +#align FinBoolAlg.has_forget_to_FinPartOrd FinBoolAlgCat.hasForgetToFinPartOrd |
| 116 | + |
| 117 | +instance forgetToFinPartOrdFaithful : Faithful (forget₂ FinBoolAlgCat FinPartOrd) := |
| 118 | + -- Porting note: original code |
| 119 | + -- ⟨fun {X Y} f g h => |
| 120 | + -- haveI := congr_arg (coeFn : _ → X → Y) h |
| 121 | + -- FunLike.coe_injective this⟩ |
| 122 | + -- Porting note: the coercions to functions for the various bundled order categories |
| 123 | + -- are quite inconsistent. We need to go back through and make all these files uniform. |
| 124 | + ⟨fun {X Y} f g h => by |
| 125 | + dsimp at * |
| 126 | + apply FunLike.coe_injective |
| 127 | + dsimp |
| 128 | + ext x |
| 129 | + apply_fun (fun f => f x) at h |
| 130 | + exact h ⟩ |
| 131 | +#align FinBoolAlg.forget_to_FinPartOrd_faithful FinBoolAlgCat.forgetToFinPartOrdFaithful |
| 132 | + |
| 133 | +/-- Constructs an equivalence between finite Boolean algebras from an order isomorphism between |
| 134 | +them. -/ |
| 135 | +@[simps] |
| 136 | +def Iso.mk {α β : FinBoolAlgCat.{u}} (e : α ≃o β) : α ≅ β where |
| 137 | + hom := (e : BoundedLatticeHom α β) |
| 138 | + inv := (e.symm : BoundedLatticeHom β α) |
| 139 | + hom_inv_id := by ext; exact e.symm_apply_apply _ |
| 140 | + inv_hom_id := by ext; exact e.apply_symm_apply _ |
| 141 | +#align FinBoolAlg.iso.mk FinBoolAlgCat.Iso.mk |
| 142 | + |
| 143 | +/-- `OrderDual` as a functor. -/ |
| 144 | +@[simps] |
| 145 | +def dual : FinBoolAlgCat ⥤ FinBoolAlgCat where |
| 146 | + obj X := of Xᵒᵈ |
| 147 | + map {X Y} := BoundedLatticeHom.dual |
| 148 | +#align FinBoolAlg.dual FinBoolAlgCat.dual |
| 149 | + |
| 150 | +/-- The equivalence between `FinBoolAlgCat` and itself induced by `OrderDual` both ways. -/ |
| 151 | +@[simps functor inverse] |
| 152 | +def dualEquiv : FinBoolAlgCat ≌ FinBoolAlgCat where |
| 153 | + functor := dual |
| 154 | + inverse := dual |
| 155 | + unitIso := NatIso.ofComponents fun X => Iso.mk <| OrderIso.dualDual X |
| 156 | + counitIso := NatIso.ofComponents fun X => Iso.mk <| OrderIso.dualDual X |
| 157 | +#align FinBoolAlg.dual_equiv FinBoolAlgCat.dualEquiv |
| 158 | + |
| 159 | +end FinBoolAlgCat |
| 160 | + |
| 161 | +theorem finBoolAlgCat_dual_comp_forget_to_finBddDistLatCat : |
| 162 | + FinBoolAlgCat.dual ⋙ forget₂ FinBoolAlgCat FinBddDistLatCat = |
| 163 | + forget₂ FinBoolAlgCat FinBddDistLatCat ⋙ FinBddDistLatCat.dual := |
| 164 | + rfl |
| 165 | +#align FinBoolAlg_dual_comp_forget_to_FinBddDistLat finBoolAlgCat_dual_comp_forget_to_finBddDistLatCat |
| 166 | + |
| 167 | +/-- The powerset functor. `Set` as a functor. -/ |
| 168 | +@[simps] |
| 169 | +def fintypeToFinBoolAlgCatOp : FintypeCat ⥤ FinBoolAlgCatᵒᵖ where |
| 170 | + obj X := op <| FinBoolAlgCat.of (Set X) |
| 171 | + map {X Y} f := |
| 172 | + Quiver.Hom.op <| (CompleteLatticeHom.setPreimage f : BoundedLatticeHom (Set Y) (Set X)) |
| 173 | +#align Fintype_to_FinBoolAlg_op fintypeToFinBoolAlgCatOp |
0 commit comments