-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add proof that we can interpret a preorder as a category
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
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,31 @@ | ||
module PreorderAsCategory.idr | ||
|
||
import Category | ||
|
||
-- contrib | ||
import Decidable.Order | ||
|
||
interface Preorder t po => UniquePreorder t (po : t -> t -> Type) where | ||
unique : (a, b : t) -> (f, g : po a b) -> f = g | ||
|
||
identity : Preorder t po => (a : t) -> po a a | ||
identity = reflexive | ||
|
||
compose : Preorder t po => (a, b, c : t) -> po a b -> po b c -> po a c | ||
compose = transitive | ||
|
||
identityLeft : UniquePreorder t po => (a, b : t) -> (f : po a b) -> compose a a b (identity a) f = f | ||
identityLeft a b f = unique a b (compose a a b (identity a) f) f | ||
|
||
identityRight : UniquePreorder t po => (a, b : t) -> (f : po a b) -> compose a b b f (identity b) = f | ||
identityRight a b f = unique a b (compose a b b f (identity b)) f | ||
|
||
ass : UniquePreorder t po => (a, b, c, d : t) -> (f : po a b) -> (g : po b c) -> (h : po c d) -> transitive a b d f (transitive b c d g h) = transitive a c d (transitive a b c f g) h | ||
ass a b c d f g h = unique a d (transitive a b d f (transitive b c d g h)) (transitive a c d (transitive a b c f g) h) | ||
|
||
UniquePreorder t po => Category t po where | ||
identity = identity | ||
compose {a} {b} {c} = compose a b c | ||
identityLeft {a} {b} {f} = identityLeft a b f | ||
identityRight {a} {b} {f} = identityRight a b f | ||
associativity {a} {b} {c} {d} {f} {g} {h} = ass a b c d f g h |
5af7cda
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.
If you want to hook this up to AQL I'd suggest trying to write down this category:
5af7cda
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.
That is definitely a good idea.
Maybe the project is still in an early stage to actually work on this now, I'll open an issue here so that we don't forget about this