Theorem: SimpleGraph.nonempty_hom_of_forall_finite_subgraph_hom
File: Mathlib/Combinatorics/SimpleGraph/Finsubgraph.lean

tactic: cases nonempty_fintype W
state_before: V : Type u
W : Type v
G : SimpleGraph V
F : SimpleGraph W
inst✝ : Finite W
h : (G' : Subgraph G) → Set.Finite G'.verts → Subgraph.coe G' →g F
⊢ Nonempty (G →g F)

tactic: haveI : ∀ G' : G.Finsubgraphᵒᵖ, Nonempty ((finsubgraphHomFunctor G F).obj G') := fun G' =>
  ⟨h G'.unop G'.unop.property⟩
state_before: case intro
V : Type u
W : Type v
G : SimpleGraph V
F : SimpleGraph W
inst✝ : Finite W
h : (G' : Subgraph G) → Set.Finite G'.verts → Subgraph.coe G' →g F
val✝ : Fintype W
⊢ Nonempty (G →g F)

tactic: haveI : ∀ G' : G.Finsubgraphᵒᵖ, Fintype ((finsubgraphHomFunctor G F).obj G') := by
  intro G'
  haveI : Fintype (G'.unop.val.verts : Type u) := G'.unop.property.fintype
  haveI : Fintype (↥G'.unop.val.verts → W) := by classical exact Pi.fintype
  exact Fintype.ofInjective (fun f => f.toFun) RelHom.coe_fn_injective
state_before: case intro
V : Type u
W : Type v
G : SimpleGraph V
F : SimpleGraph W
inst✝ : Finite W
h : (G' : Subgraph G) → Set.Finite G'.verts → Subgraph.coe G' →g F
val✝ : Fintype W
this : ∀ (G' : (Finsubgraph G)ᵒᵖ), Nonempty ((finsubgraphHomFunctor G F).obj G')
⊢ Nonempty (G →g F)

tactic: obtain ⟨u, hu⟩ := nonempty_sections_of_finite_inverse_system (finsubgraphHomFunctor G F)
state_before: case intro
V : Type u
W : Type v
G : SimpleGraph V
F : SimpleGraph W
inst✝ : Finite W
h : (G' : Subgraph G) → Set.Finite G'.verts → Subgraph.coe G' →g F
val✝ : Fintype W
this✝ : ∀ (G' : (Finsubgraph G)ᵒᵖ), Nonempty ((finsubgraphHomFunctor G F).obj G')
this : (G' : (Finsubgraph G)ᵒᵖ) → Fintype ((finsubgraphHomFunctor G F).obj G')
⊢ Nonempty (G →g F)

tactic: refine' ⟨⟨fun v => _, _⟩⟩
state_before: case intro.intro
V : Type u
W : Type v
G : SimpleGraph V
F : SimpleGraph W
inst✝ : Finite W
h : (G' : Subgraph G) → Set.Finite G'.verts → Subgraph.coe G' →g F
val✝ : Fintype W
this✝ : ∀ (G' : (Finsubgraph G)ᵒᵖ), Nonempty ((finsubgraphHomFunctor G F).obj G')
this : (G' : (Finsubgraph G)ᵒᵖ) → Fintype ((finsubgraphHomFunctor G F).obj G')
u : (j : (Finsubgraph G)ᵒᵖ) → (finsubgraphHomFunctor G F).obj j
hu : u ∈ CategoryTheory.Functor.sections (finsubgraphHomFunctor G F)
⊢ Nonempty (G →g F)

tactic: intro G'
state_before: V : Type u
W : Type v
G : SimpleGraph V
F : SimpleGraph W
inst✝ : Finite W
h : (G' : Subgraph G) → Set.Finite G'.verts → Subgraph.coe G' →g F
val✝ : Fintype W
this : ∀ (G' : (Finsubgraph G)ᵒᵖ), Nonempty ((finsubgraphHomFunctor G F).obj G')
⊢ (G' : (Finsubgraph G)ᵒᵖ) → Fintype ((finsubgraphHomFunctor G F).obj G')

tactic: haveI : Fintype (G'.unop.val.verts : Type u) := G'.unop.property.fintype
state_before: V : Type u
W : Type v
G : SimpleGraph V
F : SimpleGraph W
inst✝ : Finite W
h : (G' : Subgraph G) → Set.Finite G'.verts → Subgraph.coe G' →g F
val✝ : Fintype W
this : ∀ (G' : (Finsubgraph G)ᵒᵖ), Nonempty ((finsubgraphHomFunctor G F).obj G')
G' : (Finsubgraph G)ᵒᵖ
⊢ Fintype ((finsubgraphHomFunctor G F).obj G')

tactic: haveI : Fintype (↥G'.unop.val.verts → W) := by classical exact Pi.fintype
state_before: V : Type u
W : Type v
G : SimpleGraph V
F : SimpleGraph W
inst✝ : Finite W
h : (G' : Subgraph G) → Set.Finite G'.verts → Subgraph.coe G' →g F
val✝ : Fintype W
this✝ : ∀ (G' : (Finsubgraph G)ᵒᵖ), Nonempty ((finsubgraphHomFunctor G F).obj G')
G' : (Finsubgraph G)ᵒᵖ
this : Fintype ↑(↑G'.unop).verts
⊢ Fintype ((finsubgraphHomFunctor G F).obj G')

tactic: exact Fintype.ofInjective (fun f => f.toFun) RelHom.coe_fn_injective
state_before: V : Type u
W : Type v
G : SimpleGraph V
F : SimpleGraph W
inst✝ : Finite W
h : (G' : Subgraph G) → Set.Finite G'.verts → Subgraph.coe G' →g F
val✝ : Fintype W
this✝¹ : ∀ (G' : (Finsubgraph G)ᵒᵖ), Nonempty ((finsubgraphHomFunctor G F).obj G')
G' : (Finsubgraph G)ᵒᵖ
this✝ : Fintype ↑(↑G'.unop).verts
this : Fintype (↑(↑G'.unop).verts → W)
⊢ Fintype ((finsubgraphHomFunctor G F).obj G')

tactic: classical exact Pi.fintype
state_before: V : Type u
W : Type v
G : SimpleGraph V
F : SimpleGraph W
inst✝ : Finite W
h : (G' : Subgraph G) → Set.Finite G'.verts → Subgraph.coe G' →g F
val✝ : Fintype W
this✝ : ∀ (G' : (Finsubgraph G)ᵒᵖ), Nonempty ((finsubgraphHomFunctor G F).obj G')
G' : (Finsubgraph G)ᵒᵖ
this : Fintype ↑(↑G'.unop).verts
⊢ Fintype (↑(↑G'.unop).verts → W)

tactic: exact Pi.fintype
state_before: V : Type u
W : Type v
G : SimpleGraph V
F : SimpleGraph W
inst✝ : Finite W
h : (G' : Subgraph G) → Set.Finite G'.verts → Subgraph.coe G' →g F
val✝ : Fintype W
this✝ : ∀ (G' : (Finsubgraph G)ᵒᵖ), Nonempty ((finsubgraphHomFunctor G F).obj G')
G' : (Finsubgraph G)ᵒᵖ
this : Fintype ↑(↑G'.unop).verts
⊢ Fintype (↑(↑G'.unop).verts → W)

tactic: exact
  (u (Opposite.op (singletonFinsubgraph v))).toFun
    ⟨v, by
      unfold singletonFinsubgraph
      simp⟩
state_before: case intro.intro.refine'_1
V : Type u
W : Type v
G : SimpleGraph V
F : SimpleGraph W
inst✝ : Finite W
h : (G' : Subgraph G) → Set.Finite G'.verts → Subgraph.coe G' →g F
val✝ : Fintype W
this✝ : ∀ (G' : (Finsubgraph G)ᵒᵖ), Nonempty ((finsubgraphHomFunctor G F).obj G')
this : (G' : (Finsubgraph G)ᵒᵖ) → Fintype ((finsubgraphHomFunctor G F).obj G')
u : (j : (Finsubgraph G)ᵒᵖ) → (finsubgraphHomFunctor G F).obj j
hu : u ∈ CategoryTheory.Functor.sections (finsubgraphHomFunctor G F)
v : V
⊢ W

tactic: unfold singletonFinsubgraph
state_before: V : Type u
W : Type v
G : SimpleGraph V
F : SimpleGraph W
inst✝ : Finite W
h : (G' : Subgraph G) → Set.Finite G'.verts → Subgraph.coe G' →g F
val✝ : Fintype W
this✝ : ∀ (G' : (Finsubgraph G)ᵒᵖ), Nonempty ((finsubgraphHomFunctor G F).obj G')
this : (G' : (Finsubgraph G)ᵒᵖ) → Fintype ((finsubgraphHomFunctor G F).obj G')
u : (j : (Finsubgraph G)ᵒᵖ) → (finsubgraphHomFunctor G F).obj j
hu : u ∈ CategoryTheory.Functor.sections (finsubgraphHomFunctor G F)
v : V
⊢ v ∈ (↑(singletonFinsubgraph v).op.unop).verts

tactic: simp
state_before: V : Type u
W : Type v
G : SimpleGraph V
F : SimpleGraph W
inst✝ : Finite W
h : (G' : Subgraph G) → Set.Finite G'.verts → Subgraph.coe G' →g F
val✝ : Fintype W
this✝ : ∀ (G' : (Finsubgraph G)ᵒᵖ), Nonempty ((finsubgraphHomFunctor G F).obj G')
this : (G' : (Finsubgraph G)ᵒᵖ) → Fintype ((finsubgraphHomFunctor G F).obj G')
u : (j : (Finsubgraph G)ᵒᵖ) → (finsubgraphHomFunctor G F).obj j
hu : u ∈ CategoryTheory.Functor.sections (finsubgraphHomFunctor G F)
v : V
⊢ v ∈ (↑{ val := SimpleGraph.singletonSubgraph G v, property := (_ : Set.Finite {v}) }.op.unop).verts

tactic: intro v v' e
state_before: case intro.intro.refine'_2
V : Type u
W : Type v
G : SimpleGraph V
F : SimpleGraph W
inst✝ : Finite W
h : (G' : Subgraph G) → Set.Finite G'.verts → Subgraph.coe G' →g F
val✝ : Fintype W
this✝ : ∀ (G' : (Finsubgraph G)ᵒᵖ), Nonempty ((finsubgraphHomFunctor G F).obj G')
this : (G' : (Finsubgraph G)ᵒᵖ) → Fintype ((finsubgraphHomFunctor G F).obj G')
u : (j : (Finsubgraph G)ᵒᵖ) → (finsubgraphHomFunctor G F).obj j
hu : u ∈ CategoryTheory.Functor.sections (finsubgraphHomFunctor G F)
⊢ ∀ {a b : V},
    Adj G a b →
      Adj F
        ((fun v =>
            RelHom.toFun (u (singletonFinsubgraph v).op)
              { val := v, property := (_ : v ∈ (↑(singletonFinsubgraph v).op.unop).verts) })
          a)
        ((fun v =>
            RelHom.toFun (u (singletonFinsubgraph v).op)
              { val := v, property := (_ : v ∈ (↑(singletonFinsubgraph v).op.unop).verts) })
          b)

tactic: simp only
state_before: case intro.intro.refine'_2
V : Type u
W : Type v
G : SimpleGraph V
F : SimpleGraph W
inst✝ : Finite W
h : (G' : Subgraph G) → Set.Finite G'.verts → Subgraph.coe G' →g F
val✝ : Fintype W
this✝ : ∀ (G' : (Finsubgraph G)ᵒᵖ), Nonempty ((finsubgraphHomFunctor G F).obj G')
this : (G' : (Finsubgraph G)ᵒᵖ) → Fintype ((finsubgraphHomFunctor G F).obj G')
u : (j : (Finsubgraph G)ᵒᵖ) → (finsubgraphHomFunctor G F).obj j
hu : u ∈ CategoryTheory.Functor.sections (finsubgraphHomFunctor G F)
v v' : V
e : Adj G v v'
⊢ Adj F
    ((fun v =>
        RelHom.toFun (u (singletonFinsubgraph v).op)
          { val := v, property := (_ : v ∈ (↑(singletonFinsubgraph v).op.unop).verts) })
      v)
    ((fun v =>
        RelHom.toFun (u (singletonFinsubgraph v).op)
          { val := v, property := (_ : v ∈ (↑(singletonFinsubgraph v).op.unop).verts) })
      v')

tactic: have hv : Opposite.op (finsubgraphOfAdj e) ⟶ Opposite.op (singletonFinsubgraph v) :=
  Quiver.Hom.op (CategoryTheory.homOfLE singletonFinsubgraph_le_adj_left)
state_before: case intro.intro.refine'_2
V : Type u
W : Type v
G : SimpleGraph V
F : SimpleGraph W
inst✝ : Finite W
h : (G' : Subgraph G) → Set.Finite G'.verts → Subgraph.coe G' →g F
val✝ : Fintype W
this✝ : ∀ (G' : (Finsubgraph G)ᵒᵖ), Nonempty ((finsubgraphHomFunctor G F).obj G')
this : (G' : (Finsubgraph G)ᵒᵖ) → Fintype ((finsubgraphHomFunctor G F).obj G')
u : (j : (Finsubgraph G)ᵒᵖ) → (finsubgraphHomFunctor G F).obj j
hu : u ∈ CategoryTheory.Functor.sections (finsubgraphHomFunctor G F)
v v' : V
e : Adj G v v'
⊢ Adj F
    (RelHom.toFun (u (singletonFinsubgraph v).op)
      { val := v, property := (_ : v ∈ (↑(singletonFinsubgraph v).op.unop).verts) })
    (RelHom.toFun (u (singletonFinsubgraph v').op)
      { val := v', property := (_ : v' ∈ (↑(singletonFinsubgraph v').op.unop).verts) })

tactic: have hv' : Opposite.op (finsubgraphOfAdj e) ⟶ Opposite.op (singletonFinsubgraph v') :=
  Quiver.Hom.op (CategoryTheory.homOfLE singletonFinsubgraph_le_adj_right)
state_before: case intro.intro.refine'_2
V : Type u
W : Type v
G : SimpleGraph V
F : SimpleGraph W
inst✝ : Finite W
h : (G' : Subgraph G) → Set.Finite G'.verts → Subgraph.coe G' →g F
val✝ : Fintype W
this✝ : ∀ (G' : (Finsubgraph G)ᵒᵖ), Nonempty ((finsubgraphHomFunctor G F).obj G')
this : (G' : (Finsubgraph G)ᵒᵖ) → Fintype ((finsubgraphHomFunctor G F).obj G')
u : (j : (Finsubgraph G)ᵒᵖ) → (finsubgraphHomFunctor G F).obj j
hu : u ∈ CategoryTheory.Functor.sections (finsubgraphHomFunctor G F)
v v' : V
e : Adj G v v'
hv : (finsubgraphOfAdj e).op ⟶ (singletonFinsubgraph v).op
⊢ Adj F
    (RelHom.toFun (u (singletonFinsubgraph v).op)
      { val := v, property := (_ : v ∈ (↑(singletonFinsubgraph v).op.unop).verts) })
    (RelHom.toFun (u (singletonFinsubgraph v').op)
      { val := v', property := (_ : v' ∈ (↑(singletonFinsubgraph v').op.unop).verts) })

tactic: rw [← hu hv, ← hu hv']
state_before: case intro.intro.refine'_2
V : Type u
W : Type v
G : SimpleGraph V
F : SimpleGraph W
inst✝ : Finite W
h : (G' : Subgraph G) → Set.Finite G'.verts → Subgraph.coe G' →g F
val✝ : Fintype W
this✝ : ∀ (G' : (Finsubgraph G)ᵒᵖ), Nonempty ((finsubgraphHomFunctor G F).obj G')
this : (G' : (Finsubgraph G)ᵒᵖ) → Fintype ((finsubgraphHomFunctor G F).obj G')
u : (j : (Finsubgraph G)ᵒᵖ) → (finsubgraphHomFunctor G F).obj j
hu : u ∈ CategoryTheory.Functor.sections (finsubgraphHomFunctor G F)
v v' : V
e : Adj G v v'
hv : (finsubgraphOfAdj e).op ⟶ (singletonFinsubgraph v).op
hv' : (finsubgraphOfAdj e).op ⟶ (singletonFinsubgraph v').op
⊢ Adj F
    (RelHom.toFun (u (singletonFinsubgraph v).op)
      { val := v, property := (_ : v ∈ (↑(singletonFinsubgraph v).op.unop).verts) })
    (RelHom.toFun (u (singletonFinsubgraph v').op)
      { val := v', property := (_ : v' ∈ (↑(singletonFinsubgraph v').op.unop).verts) })

tactic: refine' Hom.map_adj (u (Opposite.op (finsubgraphOfAdj e))) _
state_before: case intro.intro.refine'_2
V : Type u
W : Type v
G : SimpleGraph V
F : SimpleGraph W
inst✝ : Finite W
h : (G' : Subgraph G) → Set.Finite G'.verts → Subgraph.coe G' →g F
val✝ : Fintype W
this✝ : ∀ (G' : (Finsubgraph G)ᵒᵖ), Nonempty ((finsubgraphHomFunctor G F).obj G')
this : (G' : (Finsubgraph G)ᵒᵖ) → Fintype ((finsubgraphHomFunctor G F).obj G')
u : (j : (Finsubgraph G)ᵒᵖ) → (finsubgraphHomFunctor G F).obj j
hu : u ∈ CategoryTheory.Functor.sections (finsubgraphHomFunctor G F)
v v' : V
e : Adj G v v'
hv : (finsubgraphOfAdj e).op ⟶ (singletonFinsubgraph v).op
hv' : (finsubgraphOfAdj e).op ⟶ (singletonFinsubgraph v').op
⊢ Adj F
    (RelHom.toFun ((finsubgraphHomFunctor G F).map hv (u (finsubgraphOfAdj e).op))
      { val := v, property := (_ : v ∈ (↑(singletonFinsubgraph v).op.unop).verts) })
    (RelHom.toFun ((finsubgraphHomFunctor G F).map hv' (u (finsubgraphOfAdj e).op))
      { val := v', property := (_ : v' ∈ (↑(singletonFinsubgraph v').op.unop).verts) })

tactic: simp [finsubgraphOfAdj]
state_before: case intro.intro.refine'_2
V : Type u
W : Type v
G : SimpleGraph V
F : SimpleGraph W
inst✝ : Finite W
h : (G' : Subgraph G) → Set.Finite G'.verts → Subgraph.coe G' →g F
val✝ : Fintype W
this✝ : ∀ (G' : (Finsubgraph G)ᵒᵖ), Nonempty ((finsubgraphHomFunctor G F).obj G')
this : (G' : (Finsubgraph G)ᵒᵖ) → Fintype ((finsubgraphHomFunctor G F).obj G')
u : (j : (Finsubgraph G)ᵒᵖ) → (finsubgraphHomFunctor G F).obj j
hu : u ∈ CategoryTheory.Functor.sections (finsubgraphHomFunctor G F)
v v' : V
e : Adj G v v'
hv : (finsubgraphOfAdj e).op ⟶ (singletonFinsubgraph v).op
hv' : (finsubgraphOfAdj e).op ⟶ (singletonFinsubgraph v').op
⊢ Adj (Subgraph.coe ↑(finsubgraphOfAdj e).op.unop)
    { val := v, property := (_ : v ∈ (↑(finsubgraphOfAdj e).op.unop).verts) }
    { val := v', property := (_ : v' ∈ (↑(finsubgraphOfAdj e).op.unop).verts) }