Quivers #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
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
.
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.
Instances of this typeclass
Instances of other typeclasses for quiver
- quiver.has_sizeof_inst
A morphism of quivers. As we will later have categorical functors extend this structure,
we call it a prefunctor
.
Instances for prefunctor
- prefunctor.has_sizeof_inst
- prefunctor.inhabited
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
.
Instances for quiver.hom.op
Given an arrow in Vᵒᵖ
, we can take the "unopposite" back in V
.
Instances for quiver.hom.unop
A type synonym for a quiver with no arrows.
Equations
- quiver.empty V = V
Instances for quiver.empty
Equations
- quiver.empty_quiver V = {hom := λ (a b : quiver.empty V), pempty}
A quiver is thin if it has no parallel arrows.
Equations
- quiver.is_thin V = ∀ (a b : V), subsingleton (a ⟶ b)