Theorem: NonemptyFinLinOrdCat.epi_iff_surjective
File: Mathlib/Order/Category/NonemptyFinLinOrdCat.lean

tactic: constructor
state_before: A B : NonemptyFinLinOrdCat
f : A ⟶ B
⊢ Epi f ↔ Function.Surjective ↑f

tactic: intro
state_before: case mp
A B : NonemptyFinLinOrdCat
f : A ⟶ B
⊢ Epi f → Function.Surjective ↑f

tactic: dsimp only [Function.Surjective]
state_before: case mp
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
⊢ Function.Surjective ↑f

tactic: by_contra' hf'
state_before: case mp
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
⊢ ∀ (b : ↑B), ∃ a, ↑f a = b

tactic: rcases hf' with ⟨m, hm⟩
state_before: case mp
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
hf' : ∃ b, ∀ (a : ↑A), ↑f a ≠ b
⊢ False

tactic: let Y := NonemptyFinLinOrdCat.of (ULift (Fin 2))
state_before: case mp.intro
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
⊢ False

tactic: simp [FunLike.coe] at h
state_before: case mp.intro
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
p₁ : B ⟶ Y :=
  { toFun := fun b => if b < m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b < m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b < m then { down := 0 } else { down := 1 }) x₂) }
p₂ : B ⟶ Y :=
  { toFun := fun b => if b ≤ m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₂) }
h : ↑p₁ m = ↑p₂ m
⊢ False

tactic: simp only
state_before: A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
x₁ x₂ : ↑B
h : x₁ ≤ x₂
⊢ (fun b => if b < m then { down := 0 } else { down := 1 }) x₁ ≤
    (fun b => if b < m then { down := 0 } else { down := 1 }) x₂

tactic: split_ifs with h₁ h₂ h₂
state_before: A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
x₁ x₂ : ↑B
h : x₁ ≤ x₂
⊢ (if x₁ < m then { down := 0 } else { down := 1 }) ≤ if x₂ < m then { down := 0 } else { down := 1 }

tactic: any_goals apply Fin.zero_le
state_before: case inl.inl
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
x₁ x₂ : ↑B
h : x₁ ≤ x₂
h₁ : x₁ < m
h₂ : x₂ < m
⊢ { down := 0 } ≤ { down := 0 }

case inl.inr
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
x₁ x₂ : ↑B
h : x₁ ≤ x₂
h₁ : x₁ < m
h₂ : ¬x₂ < m
⊢ { down := 0 } ≤ { down := 1 }

case inr.inl
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
x₁ x₂ : ↑B
h : x₁ ≤ x₂
h₁ : ¬x₁ < m
h₂ : x₂ < m
⊢ { down := 1 } ≤ { down := 0 }

case inr.inr
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
x₁ x₂ : ↑B
h : x₁ ≤ x₂
h₁ : ¬x₁ < m
h₂ : ¬x₂ < m
⊢ { down := 1 } ≤ { down := 1 }

tactic: apply Fin.zero_le
state_before: case inr.inr
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
x₁ x₂ : ↑B
h : x₁ ≤ x₂
h₁ : ¬x₁ < m
h₂ : ¬x₂ < m
⊢ { down := 1 } ≤ { down := 1 }

tactic: exfalso
state_before: case inr.inl
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
x₁ x₂ : ↑B
h : x₁ ≤ x₂
h₁ : ¬x₁ < m
h₂ : x₂ < m
⊢ { down := 1 } ≤ { down := 0 }

tactic: exact h₁ (lt_of_le_of_lt h h₂)
state_before: case inr.inl.h
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
x₁ x₂ : ↑B
h : x₁ ≤ x₂
h₁ : ¬x₁ < m
h₂ : x₂ < m
⊢ False

tactic: rfl
state_before: case inr.inr
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
x₁ x₂ : ↑B
h : x₁ ≤ x₂
h₁ : ¬x₁ < m
h₂ : ¬x₂ < m
⊢ { down := 1 } ≤ { down := 1 }

tactic: simp only
state_before: A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
p₁ : B ⟶ Y :=
  { toFun := fun b => if b < m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b < m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b < m then { down := 0 } else { down := 1 }) x₂) }
x₁ x₂ : ↑B
h : x₁ ≤ x₂
⊢ (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₁ ≤
    (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₂

tactic: split_ifs with h₁ h₂ h₂
state_before: A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
p₁ : B ⟶ Y :=
  { toFun := fun b => if b < m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b < m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b < m then { down := 0 } else { down := 1 }) x₂) }
x₁ x₂ : ↑B
h : x₁ ≤ x₂
⊢ (if x₁ ≤ m then { down := 0 } else { down := 1 }) ≤ if x₂ ≤ m then { down := 0 } else { down := 1 }

tactic: any_goals apply Fin.zero_le
state_before: case inl.inl
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
p₁ : B ⟶ Y :=
  { toFun := fun b => if b < m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b < m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b < m then { down := 0 } else { down := 1 }) x₂) }
x₁ x₂ : ↑B
h : x₁ ≤ x₂
h₁ : x₁ ≤ m
h₂ : x₂ ≤ m
⊢ { down := 0 } ≤ { down := 0 }

case inl.inr
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
p₁ : B ⟶ Y :=
  { toFun := fun b => if b < m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b < m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b < m then { down := 0 } else { down := 1 }) x₂) }
x₁ x₂ : ↑B
h : x₁ ≤ x₂
h₁ : x₁ ≤ m
h₂ : ¬x₂ ≤ m
⊢ { down := 0 } ≤ { down := 1 }

case inr.inl
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
p₁ : B ⟶ Y :=
  { toFun := fun b => if b < m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b < m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b < m then { down := 0 } else { down := 1 }) x₂) }
x₁ x₂ : ↑B
h : x₁ ≤ x₂
h₁ : ¬x₁ ≤ m
h₂ : x₂ ≤ m
⊢ { down := 1 } ≤ { down := 0 }

case inr.inr
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
p₁ : B ⟶ Y :=
  { toFun := fun b => if b < m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b < m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b < m then { down := 0 } else { down := 1 }) x₂) }
x₁ x₂ : ↑B
h : x₁ ≤ x₂
h₁ : ¬x₁ ≤ m
h₂ : ¬x₂ ≤ m
⊢ { down := 1 } ≤ { down := 1 }

tactic: apply Fin.zero_le
state_before: case inr.inr
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
p₁ : B ⟶ Y :=
  { toFun := fun b => if b < m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b < m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b < m then { down := 0 } else { down := 1 }) x₂) }
x₁ x₂ : ↑B
h : x₁ ≤ x₂
h₁ : ¬x₁ ≤ m
h₂ : ¬x₂ ≤ m
⊢ { down := 1 } ≤ { down := 1 }

tactic: exfalso
state_before: case inr.inl
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
p₁ : B ⟶ Y :=
  { toFun := fun b => if b < m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b < m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b < m then { down := 0 } else { down := 1 }) x₂) }
x₁ x₂ : ↑B
h : x₁ ≤ x₂
h₁ : ¬x₁ ≤ m
h₂ : x₂ ≤ m
⊢ { down := 1 } ≤ { down := 0 }

tactic: exact h₁ (h.trans h₂)
state_before: case inr.inl.h
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
p₁ : B ⟶ Y :=
  { toFun := fun b => if b < m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b < m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b < m then { down := 0 } else { down := 1 }) x₂) }
x₁ x₂ : ↑B
h : x₁ ≤ x₂
h₁ : ¬x₁ ≤ m
h₂ : x₂ ≤ m
⊢ False

tactic: rfl
state_before: case inr.inr
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
p₁ : B ⟶ Y :=
  { toFun := fun b => if b < m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b < m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b < m then { down := 0 } else { down := 1 }) x₂) }
x₁ x₂ : ↑B
h : x₁ ≤ x₂
h₁ : ¬x₁ ≤ m
h₂ : ¬x₂ ≤ m
⊢ { down := 1 } ≤ { down := 1 }

tactic: congr
state_before: A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
p₁ : B ⟶ Y :=
  { toFun := fun b => if b < m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b < m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b < m then { down := 0 } else { down := 1 }) x₂) }
p₂ : B ⟶ Y :=
  { toFun := fun b => if b ≤ m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₂) }
⊢ ↑p₁ m = ↑p₂ m

tactic: rw [← cancel_epi f]
state_before: case e_a
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
p₁ : B ⟶ Y :=
  { toFun := fun b => if b < m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b < m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b < m then { down := 0 } else { down := 1 }) x₂) }
p₂ : B ⟶ Y :=
  { toFun := fun b => if b ≤ m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₂) }
⊢ p₁ = p₂

tactic: ext a
state_before: case e_a
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
p₁ : B ⟶ Y :=
  { toFun := fun b => if b < m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b < m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b < m then { down := 0 } else { down := 1 }) x₂) }
p₂ : B ⟶ Y :=
  { toFun := fun b => if b ≤ m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₂) }
⊢ f ≫ p₁ = f ≫ p₂

tactic: simp only [coe_of, FunctorToTypes.map_comp_apply]
state_before: case e_a.w
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
p₁ : B ⟶ Y :=
  { toFun := fun b => if b < m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b < m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b < m then { down := 0 } else { down := 1 }) x₂) }
p₂ : B ⟶ Y :=
  { toFun := fun b => if b ≤ m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₂) }
a : (forget NonemptyFinLinOrdCat).obj A
⊢ (forget NonemptyFinLinOrdCat).map (f ≫ p₁) a = (forget NonemptyFinLinOrdCat).map (f ≫ p₂) a

tactic: simp only [forget_map_apply]
state_before: case e_a.w
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
p₁ : B ⟶ Y :=
  { toFun := fun b => if b < m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b < m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b < m then { down := 0 } else { down := 1 }) x₂) }
p₂ : B ⟶ Y :=
  { toFun := fun b => if b ≤ m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₂) }
a : (forget NonemptyFinLinOrdCat).obj A
⊢ (forget NonemptyFinLinOrdCat).map
      { toFun := fun b => if b < m then { down := 0 } else { down := 1 },
        monotone' :=
          (_ :
            ∀ (x₁ x₂ : ↑B),
              x₁ ≤ x₂ →
                (fun b => if b < m then { down := 0 } else { down := 1 }) x₁ ≤
                  (fun b => if b < m then { down := 0 } else { down := 1 }) x₂) }
      ((forget NonemptyFinLinOrdCat).map f a) =
    (forget NonemptyFinLinOrdCat).map
      { toFun := fun b => if b ≤ m then { down := 0 } else { down := 1 },
        monotone' :=
          (_ :
            ∀ (x₁ x₂ : ↑B),
              x₁ ≤ x₂ →
                (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₁ ≤
                  (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₂) }
      ((forget NonemptyFinLinOrdCat).map f a)

tactic: split_ifs with h₁ h₂ h₂
state_before: case e_a.w
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
p₁ : B ⟶ Y :=
  { toFun := fun b => if b < m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b < m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b < m then { down := 0 } else { down := 1 }) x₂) }
p₂ : B ⟶ Y :=
  { toFun := fun b => if b ≤ m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₂) }
a : (forget NonemptyFinLinOrdCat).obj A
⊢ (if ↑f a < m then { down := 0 } else { down := 1 }) = if ↑f a ≤ m then { down := 0 } else { down := 1 }

tactic: any_goals rfl
state_before: case e_a.w.inl.inl
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
p₁ : B ⟶ Y :=
  { toFun := fun b => if b < m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b < m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b < m then { down := 0 } else { down := 1 }) x₂) }
p₂ : B ⟶ Y :=
  { toFun := fun b => if b ≤ m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₂) }
a : (forget NonemptyFinLinOrdCat).obj A
h₁ : ↑f a < m
h₂ : ↑f a ≤ m
⊢ { down := 0 } = { down := 0 }

case e_a.w.inl.inr
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
p₁ : B ⟶ Y :=
  { toFun := fun b => if b < m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b < m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b < m then { down := 0 } else { down := 1 }) x₂) }
p₂ : B ⟶ Y :=
  { toFun := fun b => if b ≤ m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₂) }
a : (forget NonemptyFinLinOrdCat).obj A
h₁ : ↑f a < m
h₂ : ¬↑f a ≤ m
⊢ { down := 0 } = { down := 1 }

case e_a.w.inr.inl
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
p₁ : B ⟶ Y :=
  { toFun := fun b => if b < m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b < m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b < m then { down := 0 } else { down := 1 }) x₂) }
p₂ : B ⟶ Y :=
  { toFun := fun b => if b ≤ m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₂) }
a : (forget NonemptyFinLinOrdCat).obj A
h₁ : ¬↑f a < m
h₂ : ↑f a ≤ m
⊢ { down := 1 } = { down := 0 }

case e_a.w.inr.inr
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
p₁ : B ⟶ Y :=
  { toFun := fun b => if b < m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b < m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b < m then { down := 0 } else { down := 1 }) x₂) }
p₂ : B ⟶ Y :=
  { toFun := fun b => if b ≤ m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₂) }
a : (forget NonemptyFinLinOrdCat).obj A
h₁ : ¬↑f a < m
h₂ : ¬↑f a ≤ m
⊢ { down := 1 } = { down := 1 }

tactic: rfl
state_before: case e_a.w.inr.inr
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
p₁ : B ⟶ Y :=
  { toFun := fun b => if b < m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b < m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b < m then { down := 0 } else { down := 1 }) x₂) }
p₂ : B ⟶ Y :=
  { toFun := fun b => if b ≤ m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₂) }
a : (forget NonemptyFinLinOrdCat).obj A
h₁ : ¬↑f a < m
h₂ : ¬↑f a ≤ m
⊢ { down := 1 } = { down := 1 }

tactic: exfalso
state_before: case e_a.w.inl.inr
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
p₁ : B ⟶ Y :=
  { toFun := fun b => if b < m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b < m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b < m then { down := 0 } else { down := 1 }) x₂) }
p₂ : B ⟶ Y :=
  { toFun := fun b => if b ≤ m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₂) }
a : (forget NonemptyFinLinOrdCat).obj A
h₁ : ↑f a < m
h₂ : ¬↑f a ≤ m
⊢ { down := 0 } = { down := 1 }

tactic: exact h₂ (le_of_lt h₁)
state_before: case e_a.w.inl.inr.h
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
p₁ : B ⟶ Y :=
  { toFun := fun b => if b < m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b < m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b < m then { down := 0 } else { down := 1 }) x₂) }
p₂ : B ⟶ Y :=
  { toFun := fun b => if b ≤ m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₂) }
a : (forget NonemptyFinLinOrdCat).obj A
h₁ : ↑f a < m
h₂ : ¬↑f a ≤ m
⊢ False

tactic: exfalso
state_before: case e_a.w.inr.inl
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
p₁ : B ⟶ Y :=
  { toFun := fun b => if b < m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b < m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b < m then { down := 0 } else { down := 1 }) x₂) }
p₂ : B ⟶ Y :=
  { toFun := fun b => if b ≤ m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₂) }
a : (forget NonemptyFinLinOrdCat).obj A
h₁ : ¬↑f a < m
h₂ : ↑f a ≤ m
⊢ { down := 1 } = { down := 0 }

tactic: exact hm a (eq_of_le_of_not_lt h₂ h₁)
state_before: case e_a.w.inr.inl.h
A B : NonemptyFinLinOrdCat
f : A ⟶ B
a✝ : Epi f
m : ↑B
hm : ∀ (a : ↑A), ↑f a ≠ m
Y : NonemptyFinLinOrdCat := of (ULift (Fin 2))
p₁ : B ⟶ Y :=
  { toFun := fun b => if b < m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b < m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b < m then { down := 0 } else { down := 1 }) x₂) }
p₂ : B ⟶ Y :=
  { toFun := fun b => if b ≤ m then { down := 0 } else { down := 1 },
    monotone' :=
      (_ :
        ∀ (x₁ x₂ : ↑B),
          x₁ ≤ x₂ →
            (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₁ ≤
              (fun b => if b ≤ m then { down := 0 } else { down := 1 }) x₂) }
a : (forget NonemptyFinLinOrdCat).obj A
h₁ : ¬↑f a < m
h₂ : ↑f a ≤ m
⊢ False

tactic: intro h
state_before: case mpr
A B : NonemptyFinLinOrdCat
f : A ⟶ B
⊢ Function.Surjective ↑f → Epi f

tactic: exact ConcreteCategory.epi_of_surjective f h
state_before: case mpr
A B : NonemptyFinLinOrdCat
f : A ⟶ B
h : Function.Surjective ↑f
⊢ Epi f