Built with
doc-gen4 , running Lean4.
Bubbles (
) indicate interactive fragments: hover for details, tap to reveal contents.
Use
Ctrl+β Ctrl+β to navigate,
Ctrl+π±οΈ to focus.
On Mac, use
Cmd instead of
Ctrl .
/-
Copyright (c) 2021 David WΓ€rn,. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David WΓ€rn, Scott Morrison
Ported by: JoΓ«l Riou
! This file was ported from Lean 3 source module combinatorics.quiver.path
! leanprover-community/mathlib commit 18a5306c091183ac90884daa9373fa3b178e8607
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
import Mathlib.Combinatorics.Quiver.Basic
import Mathlib.Logic.Lemmas
/-!
# Paths in quivers
Given a quiver `V`, we define the type of paths from `a : V` to `b : V` as an inductive
family. We define composition of paths and the action of prefunctors on paths.
-/
open Function
universe v vβ vβ u uβ uβ
namespace Quiver
/-- `Path a b` is the type of paths from `a` to `b` through the arrows of `G`. -/
inductive Path : {V : Type u} β [inst : Quiver V ] β V β V β Sort (max(u+1)v) Path { V : Type u } [ Quiver .{v} V ] ( a : V ) : V β Sort max (u + 1) v : Type (max(u+1)v)Sort Sort max (u + 1) v : Type (max(u+1)v) Sort max (u + 1) v : Type (max(u+1)v)max Sort max (u + 1) v : Type (max(u+1)v) (u + 1) v
| nil : Path : {V : Type u} β [inst : Quiver V ] β V β V β Sort (max(u+1)v) Path a a
| cons : β { b c : V }, Path : {V : Type u} β [inst : Quiver V ] β V β V β Sort (max(u+1)v) Path a b β ( b βΆ c ) β Path : {V : Type u} β [inst : Quiver V ] β V β V β Sort (max(u+1)v) Path a c
#align quiver.path Quiver.Path : {V : Type u} β [inst : Quiver V ] β V β V β Sort (max(u+1)v) Quiver.Path
-- See issue lean4#2049
compile_inductive% Path : {V : Type u} β [inst : Quiver V ] β V β V β Sort (max(u+1)v) Path
/-- An arrow viewed as a path of length one. -/
def Hom.toPath : {V : Type u_1} β [inst : Quiver V ] β {a b : V } β (a βΆ b ) β Path a b Hom.toPath { V } [ Quiver : Type ?u.1485 β Type (max?u.1485?u.1486) Quiver V ] { a b : V } ( e : a βΆ b ) : Path : {V : Type ?u.1508} β [inst : Quiver V ] β V β V β Sort (max(?u.1508+1)?u.1509) Path a b :=
Path.nil : {V : Type ?u.1526} β [inst : Quiver V ] β {a : V } β Path a a Path.nil. cons e
#align quiver.hom.to_path Quiver.Hom.toPath : {V : Type u_1} β [inst : Quiver V ] β {a b : V } β (a βΆ b ) β Path a b Quiver.Hom.toPath
namespace Path
variable { V : Type u } [ Quiver : Type ?u.3675 β Type (max?u.3675?u.3676) Quiver V ] { a b c d : V }
lemma nil_ne_cons ( p : Path : {V : Type ?u.1638} β [inst : Quiver V ] β V β V β Sort (max(?u.1638+1)?u.1639) Path a b ) ( e : b βΆ a ) : Path.nil : {V : Type ?u.1669} β [inst : Quiver V ] β {a : V } β Path a a Path.nil β p . cons e :=
fun h => by injection h
#align quiver.path.nil_ne_cons Quiver.Path.nil_ne_cons : β {V : Type u} [inst : Quiver V ] {a b : V } (p : Path a b ) (e : b βΆ a ), nil β cons p e Quiver.Path.nil_ne_cons
lemma cons_ne_nil ( p : Path : {V : Type ?u.1743} β [inst : Quiver V ] β V β V β Sort (max(?u.1743+1)?u.1744) Path a b ) ( e : b βΆ a ) : p . cons e β Path.nil : {V : Type ?u.1799} β [inst : Quiver V ] β {a : V } β Path a a Path.nil :=
fun h => by injection h
#align quiver.path.cons_ne_nil Quiver.Path.cons_ne_nil : β {V : Type u} [inst : Quiver V ] {a b : V } (p : Path a b ) (e : b βΆ a ), cons p e β nil Quiver.Path.cons_ne_nil
lemma obj_eq_of_cons_eq_cons { p : Path : {V : Type ?u.1844} β [inst : Quiver V ] β V β V β Sort (max(?u.1844+1)?u.1845) Path a b } { p' : Path : {V : Type ?u.1859} β [inst : Quiver V ] β V β V β Sort (max(?u.1859+1)?u.1860) Path a c }
{ e : b βΆ d } { e' : c βΆ d } ( h : p . cons e = p' . cons e' ) : b = c := by injection h
#align quiver.path.obj_eq_of_cons_eq_cons Quiver.Path.obj_eq_of_cons_eq_cons : β {V : Type u} [inst : Quiver V ] {a b c d : V } {p : Path a b } {p' : Path a c } {e : b βΆ d } {e' : c βΆ d },
cons p e = cons p' e' β b = c Quiver.Path.obj_eq_of_cons_eq_cons
lemma heq_of_cons_eq_cons { p : Path : {V : Type ?u.2015} β [inst : Quiver V ] β V β V β Sort (max(?u.2015+1)?u.2016) Path a b } { p' : Path : {V : Type ?u.2030} β [inst : Quiver V ] β V β V β Sort (max(?u.2030+1)?u.2031) Path a c }
{ e : b βΆ d } { e' : c βΆ d } ( h : p . cons e = p' . cons e' ) : HEq : {Ξ± : Sort ?u.2116} β Ξ± β {Ξ² : Sort ?u.2116} β Ξ² β Prop HEq p p' := by injection h
#align quiver.path.heq_of_cons_eq_cons Quiver.Path.heq_of_cons_eq_cons
lemma hom_heq_of_cons_eq_cons { p : Path : {V : Type ?u.2188} β [inst : Quiver V ] β V β V β Sort (max(?u.2188+1)?u.2189) Path a b } { p' : Path : {V : Type ?u.2203} β [inst : Quiver V ] β V β V β Sort (max(?u.2203+1)?u.2204) Path a c }
{ e : b βΆ d } { e' : c βΆ d } ( h : p . cons e = p' . cons e' ) : HEq : {Ξ± : Sort ?u.2289} β Ξ± β {Ξ² : Sort ?u.2289} β Ξ² β Prop HEq e e' := by injection h
#align quiver.path.hom_heq_of_cons_eq_cons Quiver.Path.hom_heq_of_cons_eq_cons : β {V : Type u} [inst : Quiver V ] {a b c d : V } {p : Path a b } {p' : Path a c } {e : b βΆ d } {e' : c βΆ d },
cons p e = cons p' e' β HEq e e' Quiver.Path.hom_heq_of_cons_eq_cons
/-- The length of a path is the number of arrows it uses. -/
def length : {a b : V } β Path a b β β length { a : V } : β { b : V }, Path : {V : Type ?u.2363} β [inst : Quiver V ] β V β V β Sort (max(?u.2363+1)?u.2364) Path a b β β
| _, nil : {V : Type ?u.2387} β [inst : Quiver V ] β {a : V } β Path a a nil => 0
| _, cons p _ => p . length : {a b : V } β Path a b β β length + 1
#align quiver.path.length Quiver.Path.length : {V : Type u} β [inst : Quiver V ] β {a b : V } β Path a b β β Quiver.Path.length
instance { a : V } : Inhabited : Sort ?u.3244 β Sort (max1?u.3244) Inhabited ( Path : {V : Type ?u.3245} β [inst : Quiver V ] β V β V β Sort (max(?u.3245+1)?u.3246) Path a a ) :=
β¨ nil : {V : Type ?u.3265} β [inst : Quiver V ] β {a : V } β Path a a nilβ©
@[ simp ]
theorem length_nil : β {a : V }, length nil = 0 length_nil { a : V } : ( nil : {V : Type ?u.3359} β [inst : Quiver V ] β {a : V } β Path a a nil : Path : {V : Type ?u.3346} β [inst : Quiver V ] β V β V β Sort (max(?u.3346+1)?u.3347) Path a a ). length = 0 :=
rfl : β {Ξ± : Sort ?u.3415} {a : Ξ± }, a = a rfl
#align quiver.path.length_nil Quiver.Path.length_nil
@[ simp ]
theorem length_cons ( a b c : V ) ( p : Path : {V : Type ?u.3472} β [inst : Quiver V ] β V β V β Sort (max(?u.3472+1)?u.3473) Path a b ) ( e : b βΆ c ) : ( p . cons e ). length = p . length + 1 :=
rfl : β {Ξ± : Sort ?u.3620} {a : Ξ± }, a = a rfl
#align quiver.path.length_cons Quiver.Path.length_cons
theorem eq_of_length_zero ( p : Path : {V : Type ?u.3687} β [inst : Quiver V ] β V β V β Sort (max(?u.3687+1)?u.3688) Path a b ) ( hzero : p . length = 0 ) : a = b := by
cases p
Β· rfl
Β· cases Nat.succ_ne_zero _ hzero
#align quiver.path.eq_of_length_zero Quiver.Path.eq_of_length_zero : β {V : Type u} [inst : Quiver V ] {a b : V } (p : Path a b ), length p = 0 β a = b Quiver.Path.eq_of_length_zero
/-- Composition of paths. -/
def comp { a b : V } : β { c }, Path : {V : Type ?u.4001} β [inst : Quiver V ] β V β V β Sort (max(?u.4001+1)?u.4002) Path a b β Path : {V : Type ?u.4016} β [inst : Quiver V ] β V β V β Sort (max(?u.4016+1)?u.4017) Path b c β Path : {V : Type ?u.4029} β [inst : Quiver V ] β V β V β Sort (max(?u.4029+1)?u.4030) Path a c
| _, p , nil : {V : Type ?u.4055} β [inst : Quiver V ] β {a : V } β Path a a nil => p
| _, p , cons q e => ( p . comp q ). cons e
#align quiver.path.comp Quiver.Path.comp
@[ simp ]
theorem comp_cons { a b c d : V } ( p : Path : {V : Type ?u.4986} β [inst : Quiver V ] β V β V β Sort (max(?u.4986+1)?u.4987) Path a b ) ( q : Path : {V : Type ?u.5001} β [inst : Quiver V ] β V β V β Sort (max(?u.5001+1)?u.5002) Path b c ) ( e : c βΆ d ) :
p . comp ( q . cons e ) = ( p . comp q ). cons e :=
rfl : β {Ξ± : Sort ?u.5109} {a : Ξ± }, a = a rfl
#align quiver.path.comp_cons Quiver.Path.comp_cons
@[ simp ]
theorem comp_nil { a b : V } ( p : Path : {V : Type ?u.5190} β [inst : Quiver V ] β V β V β Sort (max(?u.5190+1)?u.5191) Path a b ) : p . comp Path.nil : {V : Type ?u.5225} β [inst : Quiver V ] β {a : V } β Path a a Path.nil = p :=
rfl : β {Ξ± : Sort ?u.5243} {a : Ξ± }, a = a rfl
#align quiver.path.comp_nil Quiver.Path.comp_nil : β {V : Type u} [inst : Quiver V ] {a b : V } (p : Path a b ), comp p nil = p Quiver.Path.comp_nil
@[ simp ]
theorem nil_comp { a : V } : β { b } ( p : Path : {V : Type ?u.5310} β [inst : Quiver V ] β V β V β Sort (max(?u.5310+1)?u.5311) Path a b ), Path.nil : {V : Type ?u.5326} β [inst : Quiver V ] β {a : V } β Path a a Path.nil. comp p = p
| _, nil : {V : Type ?u.5377} β [inst : Quiver V ] β {a : V } β Path a a nil => rfl : β {Ξ± : Sort ?u.5414} {a : Ξ± }, a = a rfl
| _, cons p _ => by V : Type uinstβ : Quiver V aβΒΉ, b, c, d, a, xβ, bβ : V p : Path a bβ aβ : bβ βΆ xβ rw [ V : Type uinstβ : Quiver V aβΒΉ, b, c, d, a, xβ, bβ : V p : Path a bβ aβ : bβ βΆ xβ comp_cons , V : Type uinstβ : Quiver V aβΒΉ, b, c, d, a, xβ, bβ : V p : Path a bβ aβ : bβ βΆ xβ V : Type uinstβ : Quiver V aβΒΉ, b, c, d, a, xβ, bβ : V p : Path a bβ aβ : bβ βΆ xβ nil_comp : β {a b : V } (p : Path a b ), comp nil p = p nil_comp p V : Type uinstβ : Quiver V aβΒΉ, b, c, d, a, xβ, bβ : V p : Path a bβ aβ : bβ βΆ xβ ]
#align quiver.path.nil_comp Quiver.Path.nil_comp : β {V : Type u} [inst : Quiver V ] {a b : V } (p : Path a b ), comp nil p = p Quiver.Path.nil_comp
@[ simp ]
theorem comp_assoc { a b c : V } :
β { d } ( p : Path : {V : Type ?u.5925} β [inst : Quiver V ] β V β V β Sort (max(?u.5925+1)?u.5926) Path a b ) ( q : Path : {V : Type ?u.5940} β [inst : Quiver V ] β V β V β Sort (max(?u.5940+1)?u.5941) Path b c ) ( r : Path : {V : Type ?u.5954} β [inst : Quiver V ] β V β V β Sort (max(?u.5954+1)?u.5955) Path c d ), ( p . comp q ). comp r = p . comp ( q . comp r )
| _, _, _, nil : {V : Type ?u.6054} β [inst : Quiver V ] β {a : V } β Path a a nil => rfl : β {Ξ± : Sort ?u.6105} {a : Ξ± }, a = a rfl
| _, p , q , cons r _ => by V : Type uinstβ : Quiver V aβΒΉ, bβΒΉ, cβ, d, a, b, c, xβ : V p : Path a b q : Path b c bβ : V r : Path c bβ aβ : bβ βΆ xβ rw [ V : Type uinstβ : Quiver V aβΒΉ, bβΒΉ, cβ, d, a, b, c, xβ : V p : Path a b q : Path b c bβ : V r : Path c bβ aβ : bβ βΆ xβ comp_cons , V : Type uinstβ : Quiver V aβΒΉ, bβΒΉ, cβ, d, a, b, c, xβ : V p : Path a b q : Path b c bβ : V r : Path c bβ aβ : bβ βΆ xβ V : Type uinstβ : Quiver V aβΒΉ, bβΒΉ, cβ, d, a, b, c, xβ : V p : Path a b q : Path b c bβ : V r : Path c bβ aβ : bβ βΆ xβ comp_cons , V : Type uinstβ : Quiver V aβΒΉ, bβΒΉ, cβ, d, a, b, c, xβ : V p : Path a b q : Path b c bβ : V r : Path c bβ aβ : bβ βΆ xβ V : Type uinstβ : Quiver V aβΒΉ, bβΒΉ, cβ, d, a, b, c, xβ : V p : Path a b q : Path b c bβ : V r : Path c bβ aβ : bβ βΆ xβ comp_cons , V : Type uinstβ : Quiver V aβΒΉ, bβΒΉ, cβ, d, a, b, c, xβ : V p : Path a b q : Path b c bβ : V r : Path c bβ aβ : bβ βΆ xβ V : Type uinstβ : Quiver V aβΒΉ, bβΒΉ, cβ, d, a, b, c, xβ : V p : Path a b q : Path b c bβ : V r : Path c bβ aβ : bβ βΆ xβ comp_assoc p q r V : Type uinstβ : Quiver V aβΒΉ, bβΒΉ, cβ, d, a, b, c, xβ : V p : Path a b q : Path b c bβ : V r : Path c bβ aβ : bβ βΆ xβ ]
#align quiver.path.comp_assoc Quiver.Path.comp_assoc
@[ simp ]
theorem length_comp ( p : Path : {V : Type ?u.6971} β [inst : Quiver V ] β V β V β Sort (max(?u.6971+1)?u.6972) Path a b ) : β { c } ( q : Path : {V : Type ?u.6990} β [inst : Quiver V ] β V β V β Sort (max(?u.6990+1)?u.6991) Path b c ), ( p . comp q ). length = p . length + q . length
| _, nil : {V : Type ?u.7111} β [inst : Quiver V ] β {a : V } β Path a a nil => rfl : β {Ξ± : Sort ?u.7148} {a : Ξ± }, a = a rfl
| _, cons _ _ => congr_arg : β {Ξ± : Sort ?u.7285} {Ξ² : Sort ?u.7284} {aβ aβ : Ξ± } (f : Ξ± β Ξ² ), aβ = aβ β f aβ = f aβ congr_arg Nat.succ ( length_comp _ _ )
#align quiver.path.length_comp Quiver.Path.length_comp
theorem comp_inj { pβ pβ : Path : {V : Type ?u.7718} β [inst : Quiver V ] β V β V β Sort (max(?u.7718+1)?u.7719) Path a b } { qβ qβ : Path : {V : Type ?u.7761} β [inst : Quiver V ] β V β V β Sort (max(?u.7761+1)?u.7762) Path b c } ( hq : qβ . length = qβ . length ) :
pβ . comp qβ = pβ . comp qβ β pβ = pβ β§ qβ = qβ := by
refine' β¨ fun h => _ , by rintro β¨rfl, rflβ© : pβ = pβ β§ qβ = qβ β¨rfl β¨rfl, rflβ© : pβ = pβ β§ qβ = qβ , rfl β¨rfl, rflβ© : pβ = pβ β§ qβ = qβ β©; rfl β© pβ = pβ β§ qβ = qβ
induction' qβ with dβ eβ qβ fβ ih nil pβ = pβ β§ nil = qβ cons pβ = pβ β§ qβ = qβ <;> nil pβ = pβ β§ nil = qβ cons pβ = pβ β§ qβ = qβ obtain _ | β¨qβ, fββ© : Path b b _ | β¨qβ _ | β¨qβ, fββ© : Path b b , fβ _ | β¨qβ, fββ© : Path b b β© := qβ nil.nil pβ = pβ β§ nil = nil nil.cons
Β· nil.nil pβ = pβ β§ nil = nil nil.nil pβ = pβ β§ nil = nil nil.cons cons.nil cons.cons exact β¨ h , rfl : β {Ξ± : Sort ?u.8278} {a : Ξ± }, a = a rflβ©
Β· nil.cons cons.nil cons.cons cases hq
Β· cases hq
Β· simp only [ comp_cons , cons.injEq ] at h
obtain rfl := h . 1
obtain β¨rfl, rflβ© : pβ = pβ β§ qβ = qβ β¨rfl β¨rfl, rflβ© : pβ = pβ β§ qβ = qβ , rfl β¨rfl, rflβ© : pβ = pβ β§ qβ = qβ β© := ih ( Nat.succ.inj hq ) h . 2 . 1 . eq : β {Ξ± : Sort ?u.8713} {a b : Ξ± }, HEq a b β a = b eq
rw [ h . 2 . 2 . eq : β {Ξ± : Sort ?u.8787} {a b : Ξ± }, HEq a b β a = b eq ]
exact β¨ rfl : β {Ξ± : Sort ?u.8812} {a : Ξ± }, a = a rfl, rfl : β {Ξ± : Sort ?u.8815} {a : Ξ± }, a = a rflβ©
#align quiver.path.comp_inj Quiver.Path.comp_inj
theorem comp_inj' { pβ pβ : Path : {V : Type ?u.8988} β [inst : Quiver V ] β V β V β Sort (max(?u.8988+1)?u.8989) Path a b } { qβ qβ : Path : {V : Type ?u.9016} β [inst : Quiver V ] β V β V β Sort (max(?u.9016+1)?u.9017) Path b c } ( h : pβ . length = pβ . length ) :
pβ . comp qβ = pβ . comp qβ β pβ = pβ β§ qβ = qβ :=
β¨ fun h_eq => ( comp_inj <| Nat.add_left_cancel : β {n m k : β }, n + m = n + k β m = k Nat.add_left_cancel <| by simpa [ h ] using congr_arg : β {Ξ± : Sort ?u.9525} {Ξ² : Sort ?u.9524} {aβ aβ : Ξ± } (f : Ξ± β Ξ² ), aβ = aβ β f aβ = f aβ congr_arg length h_eq ). 1 : β {a b : Prop }, (a β b ) β a β b 1 h_eq ,
by rintro β¨rfl, rflβ© : pβ = pβ β§ qβ = qβ β¨rfl β¨rfl, rflβ© : pβ = pβ β§ qβ = qβ , rfl β¨rfl, rflβ© : pβ = pβ β§ qβ = qβ β©; rfl β©
#align quiver.path.comp_inj' Quiver.Path.comp_inj'
theorem comp_injective_left ( q : Path : {V : Type ?u.9798} β [inst : Quiver V ] β V β V β Sort (max(?u.9798+1)?u.9799) Path b c ) : Injective : {Ξ± : Sort ?u.9814} β {Ξ² : Sort ?u.9813} β (Ξ± β Ξ² ) β Prop Injective fun p : Path : {V : Type ?u.9818} β [inst : Quiver V ] β V β V β Sort (max(?u.9818+1)?u.9819) Path a b => p . comp q :=
fun _ _ h => (( comp_inj rfl : β {Ξ± : Sort ?u.9878} {a : Ξ± }, a = a rfl). 1 : β {a b : Prop }, (a β b ) β a β b 1 h ). 1
#align quiver.path.comp_injective_left Quiver.Path.comp_injective_left
theorem comp_injective_right ( p : Path : {V : Type ?u.9958} β [inst : Quiver V ] β V β V β Sort (max(?u.9958+1)?u.9959) Path a b ) : Injective : {Ξ± : Sort ?u.9974} β {Ξ² : Sort ?u.9973} β (Ξ± β Ξ² ) β Prop Injective ( p . comp : Path : {V : Type ?u.9979} β [inst : Quiver V ] β V β V β Sort (max(?u.9979+1)?u.9980) Path b c β Path : {V : Type ?u.9992} β [inst : Quiver V ] β V β V β Sort (max(?u.9992+1)?u.9993) Path a c ) :=
fun _ _ h => (( comp_inj' rfl : β {Ξ± : Sort ?u.10052} {a : Ξ± }, a = a rfl). 1 : β {a b : Prop }, (a β b ) β a β b 1 h ). 2
#align quiver.path.comp_injective_right Quiver.Path.comp_injective_right
@[ simp ]
theorem comp_inj_left { pβ pβ : Path : {V : Type ?u.10143} β [inst : Quiver V ] β V β V β Sort (max(?u.10143+1)?u.10144) Path a b } { q : Path : {V : Type ?u.10157} β [inst : Quiver V ] β V β V β Sort (max(?u.10157+1)?u.10158) Path b c } : pβ . comp q = pβ . comp q β pβ = pβ :=
q . comp_injective_left . eq_iff : β {Ξ± : Sort ?u.10230} {Ξ² : Sort ?u.10231} {f : Ξ± β Ξ² }, Injective f β β {a b : Ξ± }, f a = f b β a = b eq_iff
#align quiver.path.comp_inj_left Quiver.Path.comp_inj_left
@[ simp ]
theorem comp_inj_right { p : Path : {V : Type ?u.10327} β [inst : Quiver V ] β V β V β Sort (max(?u.10327+1)?u.10328) Path a b } { qβ qβ : Path : {V : Type ?u.10342} β [inst : Quiver V ] β V β V β Sort (max(?u.10342+1)?u.10343) Path b c } : p . comp qβ = p . comp qβ β qβ = qβ :=
p . comp_injective_right . eq_iff : β {Ξ± : Sort ?u.10429} {Ξ² : Sort ?u.10430} {f : Ξ± β Ξ² }, Injective f β β {a b : Ξ± }, f a = f b β a = b eq_iff
#align quiver.path.comp_inj_right Quiver.Path.comp_inj_right : β {V : Type u} [inst : Quiver V ] {a b c : V } {p : Path a b } {qβ qβ : Path b c }, comp p qβ = comp p qβ β qβ = qβ Quiver.Path.comp_inj_right
/-- Turn a path into a list. The list contains `a` at its head, but not `b` a priori. -/
@[ simp ]
def toList : β { b : V }, Path : {V : Type ?u.10528} β [inst : Quiver V ] β V β V β Sort (max(?u.10528+1)?u.10529) Path a b β List V
| _, nil : {V : Type ?u.10552} β [inst : Quiver V ] β {a : V } β Path a a nil => []
| _, @ cons _ _ _ c _ p _ => c :: p . toList
#align quiver.path.to_list Quiver.Path.toList : {V : Type u} β [inst : Quiver V ] β {a b : V } β Path a b β List V Quiver.Path.toList
/-- `Quiver.Path.toList` is a contravariant functor. The inversion comes from `Quiver.Path` and
`List` having different preferred directions for adding elements. -/
@[ simp ]
theorem toList_comp ( p : Path : {V : Type ?u.11912} β [inst : Quiver V ] β V β V β Sort (max(?u.11912+1)?u.11913) Path a b ) : β { c } ( q : Path : {V : Type ?u.11931} β [inst : Quiver V ] β V β V β Sort (max(?u.11931+1)?u.11932) Path b c ), ( p . comp q ). toList = q . toList ++ p . toList
| _, nil : {V : Type ?u.12053} β [inst : Quiver V ] β {a : V } β Path a a nil => by simp
| _, @ cons _ _ _ d _ q _ => by simp [ toList_comp ]
#align quiver.path.to_list_comp Quiver.Path.toList_comp
theorem toList_chain_nonempty :
β { b } ( p : Path : {V : Type ?u.12737} β [inst : Quiver V ] β V β V β Sort (max(?u.12737+1)?u.12738) Path a b ), p . toList . Chain : {Ξ± : Type ?u.12765} β (Ξ± β Ξ± β Prop ) β Ξ± β List Ξ± β Prop Chain ( fun x y => Nonempty ( y βΆ x )) b
| _, nil : {V : Type ?u.12821} β [inst : Quiver V ] β {a : V } β Path a a nil => List.Chain.nil : β {Ξ± : Type ?u.12862} {R : Ξ± β Ξ± β Prop } {a : Ξ± }, List.Chain R a [] List.Chain.nil
| _, cons p f => p . toList_chain_nonempty . cons β¨ f β©
#align quiver.path.to_list_chain_nonempty Quiver.Path.toList_chain_nonempty
variable [β a b : V , Subsingleton ( a βΆ b )]
theorem toList_injective : β (a b : V ), Injective toList toList_injective ( a : V ) : β b , Injective : {Ξ± : Sort ?u.13375} β {Ξ² : Sort ?u.13374} β (Ξ± β Ξ² ) β Prop Injective ( toList : Path : {V : Type ?u.13380} β [inst : Quiver V ] β V β V β Sort (max(?u.13380+1)?u.13381) Path a b β List V )
| _, nil : {V : Type ?u.13436} β [inst : Quiver V ] β {a : V } β Path a a nil, nil : {V : Type ?u.13443} β [inst : Quiver V ] β {a : V } β Path a a nil, _ => rfl : β {Ξ± : Sort ?u.13505} {a : Ξ± }, a = a rfl
| _, nil : {V : Type ?u.13513} β [inst : Quiver V ] β {a : V } β Path a a nil, @ cons _ _ _ c _ p f , h => by cases h
| _, @ cons _ _ _ c _ p f , nil : {V : Type ?u.13605} β [inst : Quiver V ] β {a : V } β Path a a nil, h => by cases h
| _, @ cons _ _ _ c _ p f , @ cons _ _ _ t _ C D , h => by
simp only [ toList , List.cons.injEq : β {Ξ± : Type ?u.14694} (head : Ξ± ) (tail : List Ξ± ) (head_1 : Ξ± ) (tail_1 : List Ξ± ),
(head :: tail = head_1 :: tail_1 ) = (head = head_1 β§ tail = tail_1 ) List.cons.injEq] at h
obtain β¨ rfl , hAC : unknown free variable '_uniq.14815'
hAC β© := h
simp [ toList_injective : β (a b : V ), Injective toList toList_injective _ _ hAC ]
#align quiver.path.to_list_injective Quiver.Path.toList_injective
@[ simp ]
theorem toList_inj { p q : Path : {V : Type ?u.15292} β [inst : Quiver V ] β V β V β Sort (max(?u.15292+1)?u.15293) Path a b } : p . toList = q . toList β p = q :=
( toList_injective _ _ ). eq_iff : β {Ξ± : Sort ?u.15380} {Ξ² : Sort ?u.15381} {f : Ξ± β Ξ² }, Injective f β β {a b : Ξ± }, f a = f b β a = b eq_iff
#align quiver.path.to_list_inj Quiver.Path.toList_inj
end Path
end Quiver
namespace Prefunctor
open Quiver
variable { V : Type uβ } [ Quiver : Type ?u.16904 β Type (max?u.16904vβ) Quiver.{vβ} V ] { W : Type uβ } [ Quiver : Type ?u.16667 β Type (max?u.16667vβ) Quiver.{vβ} W ] ( F : V β₯€q W )
/-- The image of a path under a prefunctor. -/
def mapPath : {V : Type uβ} β
[inst : Quiver V ] β
{W : Type uβ} β [inst_1 : Quiver W ] β (F : V β₯€q W ) β {a b : V } β Path a b β Path (F .obj a ) (F .obj b ) mapPath { a : V } : β { b : V }, Path : {V : Type ?u.15565} β [inst : Quiver V ] β V β V β Sort (max(?u.15565+1)?u.15566) Path a b β Path : {V : Type ?u.15579} β [inst : Quiver V ] β V β V β Sort (max(?u.15579+1)?u.15580) Path ( F . obj a ) ( F . obj b )
| _, Path.nil : {V : Type ?u.15630} β [inst : Quiver V ] β {a : V } β Path a a Path.nil => Path.nil : {V : Type ?u.15666} β [inst : Quiver V ] β {a : V } β Path a a Path.nil
| _, Path.cons : {V : Type ?u.15681} β [inst : Quiver V ] β {a b c : V } β Path a b β (b βΆ c ) β Path a c Path.cons p e => Path.cons : {V : Type ?u.15742} β [inst : Quiver V ] β {a b c : V } β Path a b β (b βΆ c ) β Path a c Path.cons ( mapPath : {a b : V } β Path a b β Path (F .obj a ) (F .obj b ) mapPath p ) ( F . map : {V : Type ?u.15764} β
[inst : Quiver V ] β
{W : Type ?u.15763} β [inst_1 : Quiver W ] β (self : V β₯€q W ) β {X Y : V } β (X βΆ Y ) β (self .obj X βΆ self .obj Y ) map e )
#align prefunctor.map_path Prefunctor.mapPath : {V : Type uβ} β
[inst : Quiver V ] β
{W : Type uβ} β [inst_1 : Quiver W ] β (F : V β₯€q W ) β {a b : V } β Path a b β Path (F .obj a ) (F .obj b ) Prefunctor.mapPath
@[ simp ]
theorem mapPath_nil : β (a : V ), mapPath F Path.nil = Path.nil mapPath_nil ( a : V ) : F . mapPath : {V : Type ?u.16496} β
[inst : Quiver V ] β
{W : Type ?u.16495} β [inst_1 : Quiver W ] β (F : V β₯€q W ) β {a b : V } β Path a b β Path (F .obj a ) (F .obj b ) mapPath ( Path.nil : {V : Type ?u.16533} β [inst : Quiver V ] β {a : V } β Path a a Path.nil : Path : {V : Type ?u.16520} β [inst : Quiver V ] β V β V β Sort (max(?u.16520+1)?u.16521) Path a a ) = Path.nil : {V : Type ?u.16553} β [inst : Quiver V ] β {a : V } β Path a a Path.nil :=
rfl : β {Ξ± : Sort ?u.16611} {a : Ξ± }, a = a rfl
#align prefunctor.map_path_nil Prefunctor.mapPath_nil
@[ simp ]
theorem mapPath_cons { a b c : V } ( p : Path : {V : Type ?u.16692} β [inst : Quiver V ] β V β V β Sort (max(?u.16692+1)?u.16693) Path a b ) ( e : b βΆ c ) :
F . mapPath : {V : Type ?u.16723} β
[inst : Quiver V ] β
{W : Type ?u.16722} β [inst_1 : Quiver W ] β (F : V β₯€q W ) β {a b : V } β Path a b β Path (F .obj a ) (F .obj b ) mapPath ( Path.cons : {V : Type ?u.16746} β [inst : Quiver V ] β {a b c : V } β Path a b β (b βΆ c ) β Path a c Path.cons p e ) = Path.cons : {V : Type ?u.16772} β [inst : Quiver V ] β {a b c : V } β Path a b β (b βΆ c ) β Path a c Path.cons ( F . mapPath : {V : Type ?u.16780} β
[inst : Quiver V ] β
{W : Type ?u.16779} β [inst_1 : Quiver W ] β (F : V β₯€q W ) β {a b : V } β Path a b β Path (F .obj a ) (F .obj b ) mapPath p ) ( F . map : {V : Type ?u.16809} β
[inst : Quiver V ] β
{W : Type ?u.16808} β [inst_1 : Quiver W ] β (self : V β₯€q W ) β {X Y : V } β (X βΆ Y ) β (self .obj X βΆ self .obj Y ) map e ) :=
rfl : β {Ξ± : Sort ?u.16837} {a : Ξ± }, a = a rfl
#align prefunctor.map_path_cons Prefunctor.mapPath_cons
@[ simp ]
theorem mapPath_comp { a b : V } ( p : Path : {V : Type ?u.16932} β [inst : Quiver V ] β V β V β Sort (max(?u.16932+1)?u.16933) Path a b ) :
β { c : V } ( q : Path : {V : Type ?u.16950} β [inst : Quiver V ] β V β V β Sort (max(?u.16950+1)?u.16951) Path b c ), F . mapPath : {V : Type ?u.16966} β
[inst : Quiver V ] β
{W : Type ?u.16965} β [inst_1 : Quiver W ] β (F : V β₯€q W ) β {a b : V } β Path a b β Path (F .obj a ) (F .obj b ) mapPath ( p . comp q ) = ( F . mapPath : {V : Type ?u.17014} β
[inst : Quiver V ] β
{W : Type ?u.17013} β [inst_1 : Quiver W ] β (F : V β₯€q W ) β {a b : V } β Path a b β Path (F .obj a ) (F .obj b ) mapPath p ). comp ( F . mapPath : {V : Type ?u.17053} β
[inst : Quiver V ] β
{W : Type ?u.17052} β [inst_1 : Quiver W ] β (F : V β₯€q W ) β {a b : V } β Path a b β Path (F .obj a ) (F .obj b ) mapPath q )
| _, Path.nil : {V : Type ?u.17091} β [inst : Quiver V ] β {a : V } β Path a a Path.nil => rfl : β {Ξ± : Sort ?u.17127} {a : Ξ± }, a = a rfl
| c , Path.cons : {V : Type ?u.17198} β [inst : Quiver V ] β {a b c : V } β Path a b β (b βΆ c ) β Path a c Path.cons q e => by dsimp ; rw [ mapPath_comp p q ]
#align prefunctor.map_path_comp Prefunctor.mapPath_comp
@[ simp ]
theorem mapPath_toPath { a b : V } ( f : a βΆ b ) : F . mapPath : {V : Type ?u.17780} β
[inst : Quiver V ] β
{W : Type ?u.17779} β [inst_1 : Quiver W ] β (F : V β₯€q W ) β {a b : V } β Path a b β Path (F .obj a ) (F .obj b ) mapPath f . toPath : {V : Type ?u.17804} β [inst : Quiver V ] β {a b : V } β (a βΆ b ) β Path a b toPath = ( F . map : {V : Type ?u.17829} β
[inst : Quiver V ] β
{W : Type ?u.17828} β [inst_1 : Quiver W ] β (self : V β₯€q W ) β {X Y : V } β (X βΆ Y ) β (self .obj X βΆ self .obj Y ) map f ). toPath : {V : Type ?u.17841} β [inst : Quiver V ] β {a b : V } β (a βΆ b ) β Path a b toPath :=
rfl : β {Ξ± : Sort ?u.17865} {a : Ξ± }, a = a rfl
#align prefunctor.map_path_to_path Prefunctor.mapPath_toPath
end Prefunctor