-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Displayed categories #382
Draft
Taneb
wants to merge
8
commits into
master
Choose a base branch
from
displayed-categories
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Displayed categories #382
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
23ede14
Add notion of displayed categories
Taneb b3dc386
Total category of a displayed category
Taneb 998a571
Add some HomReasoning, displayed functors
Taneb b64f433
Rename glue' to sym-glue and use it for some natural transformations
Taneb 05bd94b
More HomReasoning combinators
Taneb bffc621
Natural transformations and a load of utilities
Taneb 5644083
Merge branch 'master' into displayed-categories
Taneb d4aceda
Displayed isos, natural isomorphisms, and the displayed category of d…
Taneb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{-# OPTIONS --safe --without-K #-} | ||
|
||
open import Categories.Category.Core using (Category) | ||
open import Categories.Category.Displayed using (Displayed) | ||
|
||
module Categories.Category.Construction.Total {o ℓ e o′ ℓ′ e′} {B : Category o ℓ e} (C : Displayed B o′ ℓ′ e′) where | ||
|
||
open import Data.Product using (proj₁; proj₂; Σ-syntax; ∃-syntax; -,_) | ||
open import Level using (_⊔_) | ||
|
||
open import Categories.Functor.Core using (Functor) | ||
|
||
open Category B | ||
open Displayed C | ||
open Equiv′ | ||
|
||
Total : Set (o ⊔ o′) | ||
Total = Σ[ Carrier ∈ Obj ] Obj[ Carrier ] | ||
|
||
record Total⇒ (X Y : Total) : Set (ℓ ⊔ ℓ′) where | ||
constructor total⇒ | ||
field | ||
{arr} : proj₁ X ⇒ proj₁ Y | ||
preserves : proj₂ X ⇒[ arr ] proj₂ Y | ||
|
||
open Total⇒ public using (preserves) | ||
|
||
∫ : Category (o ⊔ o′) (ℓ ⊔ ℓ′) (e ⊔ e′) | ||
∫ = record | ||
{ Obj = Total | ||
; _⇒_ = Total⇒ | ||
; _≈_ = λ f g → ∃[ p ] preserves f ≈[ p ] preserves g | ||
; id = total⇒ id′ | ||
; _∘_ = λ f g → total⇒ (preserves f ∘′ preserves g) | ||
; assoc = -, assoc′ | ||
; sym-assoc = -, sym-assoc′ | ||
; identityˡ = -, identityˡ′ | ||
; identityʳ = -, identityʳ′ | ||
; identity² = -, identity²′ | ||
; equiv = record | ||
{ refl = -, refl′ | ||
; sym = λ p → -, sym′ (proj₂ p) | ||
; trans = λ p q → -, trans′ (proj₂ p) (proj₂ q) | ||
} | ||
; ∘-resp-≈ = λ p q → -, ∘′-resp-[]≈ (proj₂ p) (proj₂ q) | ||
} | ||
|
||
display : Functor ∫ B | ||
display = record | ||
{ F₀ = proj₁ | ||
; F₁ = Total⇒.arr | ||
; identity = Equiv.refl | ||
; homomorphism = Equiv.refl | ||
; F-resp-≈ = proj₁ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{-# OPTIONS --without-K --safe #-} | ||
|
||
open import Categories.Category | ||
|
||
module Categories.Category.Displayed {o ℓ e} (B : Category o ℓ e) where | ||
|
||
open import Data.Product | ||
open import Level | ||
|
||
open import Categories.Functor.Core | ||
open import Relation.Binary.Displayed | ||
|
||
open Category B | ||
open Equiv | ||
|
||
-- A displayed category captures the idea of placing extra structure | ||
-- over a base category. For example, the category of monoids can be | ||
-- considered as the category of setoids with extra structure on the | ||
-- objects and extra conditions on the morphisms. | ||
record Displayed o′ ℓ′ e′ : Set (o ⊔ ℓ ⊔ e ⊔ suc (o′ ⊔ ℓ′ ⊔ e′)) where | ||
infix 4 _⇒[_]_ _≈[_]_ | ||
infixr 9 _∘′_ | ||
field | ||
Obj[_] : Obj → Set o′ | ||
_⇒[_]_ : ∀ {X Y} → Obj[ X ] → X ⇒ Y → Obj[ Y ] → Set ℓ′ | ||
_≈[_]_ : ∀ {A B X Y} {f g : A ⇒ B} → X ⇒[ f ] Y → f ≈ g → X ⇒[ g ] Y → Set e′ | ||
|
||
id′ : ∀ {A} {X : Obj[ A ]} → X ⇒[ id ] X | ||
_∘′_ : ∀ {A B C X Y Z} {f : B ⇒ C} {g : A ⇒ B} | ||
→ Y ⇒[ f ] Z → X ⇒[ g ] Y → X ⇒[ f ∘ g ] Z | ||
|
||
identityʳ′ : ∀ {A B X Y} {f : A ⇒ B} → {f′ : X ⇒[ f ] Y} → f′ ∘′ id′ ≈[ identityʳ ] f′ | ||
identityˡ′ : ∀ {A B X Y} {f : A ⇒ B} → {f′ : X ⇒[ f ] Y} → id′ ∘′ f′ ≈[ identityˡ ] f′ | ||
identity²′ : ∀ {A} {X : Obj[ A ]} → id′ {X = X} ∘′ id′ ≈[ identity² ] id′ | ||
assoc′ : ∀ {A B C D W X Y Z} {f : C ⇒ D} {g : B ⇒ C} {h : A ⇒ B} | ||
→ {f′ : Y ⇒[ f ] Z} → {g′ : X ⇒[ g ] Y} → {h′ : W ⇒[ h ] X} | ||
→ (f′ ∘′ g′) ∘′ h′ ≈[ assoc ] f′ ∘′ (g′ ∘′ h′) | ||
sym-assoc′ : ∀ {A B C D W X Y Z} {f : C ⇒ D} {g : B ⇒ C} {h : A ⇒ B} | ||
→ {f′ : Y ⇒[ f ] Z} → {g′ : X ⇒[ g ] Y} → {h′ : W ⇒[ h ] X} | ||
→ f′ ∘′ (g′ ∘′ h′) ≈[ sym-assoc ] (f′ ∘′ g′) ∘′ h′ | ||
|
||
|
||
equiv′ : ∀ {A B X Y} → IsDisplayedEquivalence equiv (_≈[_]_ {A} {B} {X} {Y}) | ||
|
||
∘′-resp-[]≈ : ∀ {A B C X Y Z} {f h : B ⇒ C} {g i : A ⇒ B} | ||
{f′ : Y ⇒[ f ] Z} {h′ : Y ⇒[ h ] Z} {g′ : X ⇒[ g ] Y} {i′ : X ⇒[ i ] Y} | ||
{p : f ≈ h} {q : g ≈ i} | ||
→ f′ ≈[ p ] h′ → g′ ≈[ q ] i′ → f′ ∘′ g′ ≈[ ∘-resp-≈ p q ] h′ ∘′ i′ | ||
|
||
module Equiv′ {A B X Y} = IsDisplayedEquivalence (equiv′ {A} {B} {X} {Y}) | ||
|
||
open Equiv′ | ||
|
||
∘′-resp-[]≈ˡ : ∀ {A B C X Y Z} {f h : B ⇒ C} {g : A ⇒ B} {f′ : Y ⇒[ f ] Z} {h′ : Y ⇒[ h ] Z} {g′ : X ⇒[ g ] Y} | ||
→ {p : f ≈ h} → f′ ≈[ p ] h′ → f′ ∘′ g′ ≈[ ∘-resp-≈ˡ p ] h′ ∘′ g′ | ||
∘′-resp-[]≈ˡ pf = ∘′-resp-[]≈ pf refl′ | ||
|
||
∘′-resp-[]≈ʳ : ∀ {A B C X Y Z} {f : B ⇒ C} {g i : A ⇒ B} {f′ : Y ⇒[ f ] Z} {g′ : X ⇒[ g ] Y} {i′ : X ⇒[ i ] Y} | ||
→ {p : g ≈ i} → g′ ≈[ p ] i′ → f′ ∘′ g′ ≈[ ∘-resp-≈ʳ p ] f′ ∘′ i′ | ||
∘′-resp-[]≈ʳ pf = ∘′-resp-[]≈ refl′ pf | ||
|
||
hom-setoid′ : ∀ {A B} {X : Obj[ A ]} {Y : Obj[ B ]} → DisplayedSetoid hom-setoid _ _ | ||
JacquesCarette marked this conversation as resolved.
Show resolved
Hide resolved
|
||
hom-setoid′ {X = X} {Y = Y} = record | ||
{ Carrier′ = X ⇒[_] Y | ||
; _≈[_]_ = _≈[_]_ | ||
; isDisplayedEquivalence = equiv′ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{-# OPTIONS --without-K --safe #-} | ||
|
||
module Relation.Binary.Displayed where | ||
|
||
open import Level using (Level; suc; _⊔_) | ||
open import Relation.Binary.Bundles using (Setoid) | ||
open import Relation.Binary.Core using (Rel) | ||
open import Relation.Binary.Structures using (IsEquivalence) | ||
|
||
private | ||
variable | ||
a ℓ a′ ℓ′ : Level | ||
|
||
record IsDisplayedEquivalence | ||
{A : Set a} {_≈_ : Rel A ℓ} (isEquivalence : IsEquivalence _≈_) | ||
{A′ : A → Set a′} (_≈[_]_ : ∀ {x y} → A′ x → x ≈ y → A′ y → Set ℓ′) : Set (a ⊔ ℓ ⊔ a′ ⊔ ℓ′) | ||
where | ||
open IsEquivalence isEquivalence | ||
field | ||
refl′ : ∀ {x} {x′ : A′ x} → x′ ≈[ refl ] x′ | ||
sym′ : ∀ {x y} {x′ : A′ x} {y′ : A′ y} {p : x ≈ y} → x′ ≈[ p ] y′ → y′ ≈[ sym p ] x′ | ||
trans′ : ∀ {x y z} {x′ : A′ x} {y′ : A′ y} {z′ : A′ z} {p : x ≈ y} {q : y ≈ z} → x′ ≈[ p ] y′ → y′ ≈[ q ] z′ → x′ ≈[ trans p q ] z′ | ||
|
||
record DisplayedSetoid (B : Setoid a ℓ) a′ ℓ′ : Set (a ⊔ ℓ ⊔ suc (a′ ⊔ ℓ′)) where | ||
open Setoid B | ||
field | ||
Carrier′ : Carrier → Set a′ | ||
_≈[_]_ : ∀ {x y} → Carrier′ x → x ≈ y → Carrier′ y → Set ℓ′ | ||
isDisplayedEquivalence : IsDisplayedEquivalence isEquivalence _≈[_]_ | ||
open IsDisplayedEquivalence isDisplayedEquivalence public |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tempting to call this
proj1
, no?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a huge fan of the name
proj1
for this, personally. It feels like naming the functor after an implementation detail. That said, I'm not set ondisplay
either.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Part of my doodling is exploring how much
Displayed
is really the categorical equivalent of aSigma
type. So it's much more than an implementation detail, there is a very strong analogy at play.I'm sure there are other, better names (certainly than
proj1
). I'm not set againstdisplay
, BTW, but I do think it's worth thinking about.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This functor is normally called
π
in the literature, soproj1
is a fitting name.