Quivers #
This module defines quivers. A quiver on a type V
of vertices assigns to every
pair a b : V
of vertices a type a ⟶ b
of arrows from a
to b
. This
is a very permissive notion of directed graph.
Implementation notes #
Currently quiver
is defined with arrow : V → V → Sort v
.
This is different from the category theory setup,
where we insist that morphisms live in some Type
.
There's some balance here: it's nice to allow Prop
to ensure there are no multiple arrows,
but it is also results in error-prone universe signatures when constraints require a Type
.
- hom : V → V → Sort ?
A quiver G
on a type V
of vertices assigns to every pair a b : V
of vertices
a type a ⟶ b
of arrows from a
to b
.
For graphs with no repeated edges, one can use quiver.{0} V
, which ensures
a ⟶ b : Prop
. For multigraphs, one can use quiver.{v+1} V
, which ensures
a ⟶ b : Type v
.
Because category
will later extend this class, we call the field hom
.
Except when constructing instances, you should rarely see this, and use the ⟶
notation instead.
A morphism of quivers. As we will later have categorical functors extend this structure,
we call it a prefunctor
.
The identity morphism between quivers.
Equations
- prefunctor.inhabited V = {default := prefunctor.id V _inst_1}
Composition of morphisms between quivers.
Vᵒᵖ
reverses the direction of all arrows of V
.
Equations
- quiver.opposite = {hom := λ (a b : Vᵒᵖ), opposite.unop b ⟶ opposite.unop a}
The opposite of an arrow in V
.
Given an arrow in Vᵒᵖ
, we can take the "unopposite" back in V
.
Equations
- quiver.empty_quiver V = {hom := λ (a b : quiver.empty V), pempty}