-- Mathlib/Order/Atoms.lean
theorem isAtom_iff {f : ∀ i, π i} [∀ i, PartialOrder (π i)] [∀ i, OrderBot (π i)] :
    IsAtom f ↔ ∃ i, IsAtom (f i) ∧ ∀ j, j ≠ i → f j = ⊥

Proof state:
case intro
ι : Type u_4
π : ι → Type u
f : (i : ι) → π i
inst✝¹ : (i : ι) → PartialOrder (π i)
inst✝ : (i : ι) → OrderBot (π i)
hbot : f ≠ ⊥
h : ∀ b < f, b = ⊥
⊢ ∃ i, IsAtom (f i) ∧ ∀ (j : ι), j ≠ i → f j = ⊥

Tactic:
have ⟨i, hbot⟩ : ∃ i, f i ≠ ⊥ := by rw [ne_eq, Pi.eq_bot_iff, not_forall] at hbot; exact hbot

Result:
case intro
ι : Type u_4
π : ι → Type u
f : (i : ι) → π i
inst✝¹ : (i : ι) → PartialOrder (π i)
inst✝ : (i : ι) → OrderBot (π i)
hbot✝ : f ≠ ⊥
h : ∀ b < f, b = ⊥
i : ι
hbot : f i ≠ ⊥
⊢ ∃ i, IsAtom (f i) ∧ ∀ (j : ι), j ≠ i → f j = ⊥

Proof state:
ι : Type u_4
π : ι → Type u
f : (i : ι) → π i
inst✝¹ : (i : ι) → PartialOrder (π i)
inst✝ : (i : ι) → OrderBot (π i)
hbot✝ : f ≠ ⊥
h : ∀ b < f, b = ⊥
i : ι
hbot : f i ≠ ⊥
⊢ ∀ (j : ι), j ≠ i → f j = ⊥

Tactic:
intro j hj

Result:
ι : Type u_4
π : ι → Type u
f : (i : ι) → π i
inst✝¹ : (i : ι) → PartialOrder (π i)
inst✝ : (i : ι) → OrderBot (π i)
hbot✝ : f ≠ ⊥
h : ∀ b < f, b = ⊥
i : ι
hbot : f i ≠ ⊥
j : ι
hj : j ≠ i
⊢ f j = ⊥

Proof state:
ι : Type u_4
π : ι → Type u
f : (i : ι) → π i
inst✝¹ : (i : ι) → PartialOrder (π i)
inst✝ : (i : ι) → OrderBot (π i)
⊢ IsAtom f ↔ ∃ i, IsAtom (f i) ∧ ∀ (j : ι), j ≠ i → f j = ⊥

Tactic:
classical
constructor
case mpr =>
  rintro ⟨i, ⟨hfi, hlt⟩, hbot⟩
  refine ⟨fun h => hfi ((Pi.eq_bot_iff.1 h) _), fun g hgf => Pi.eq_bot_iff.2 fun j => ?_⟩
  have ⟨hgf, k, hgfk⟩ := Pi.lt_def.1 hgf
  obtain rfl : i = k := of_not_not fun hki => by rw [hbot _ (Ne.symm hki)] at hgfk; simp at hgfk
  if hij : j = i then subst hij; refine hlt _ hgfk else
  exact eq_bot_iff.2 <| le_trans (hgf _) (eq_bot_iff.1 (hbot _ hij))
case mp =>
  rintro ⟨hbot, h⟩
  have ⟨i, hbot⟩ : ∃ i, f i ≠ ⊥ := by rw [ne_eq, Pi.eq_bot_iff, not_forall] at hbot; exact hbot
  refine ⟨i, ⟨hbot, ?c⟩, ?d⟩
  case c =>
    intro b hb
    have := h (Function.update ⊥ i b)
    simp only [lt_def, le_def, Pi.eq_bot_iff, and_imp, forall_exists_index] at this
    simpa using this
      (fun j => by by_cases h : j = i; { subst h; simpa using le_of_lt hb }; simp [h])
      i (by simpa using hb) i
  case d =>
    intro j hj
    have := h (Function.update ⊥ j (f j))
    simp only [lt_def, le_def, Pi.eq_bot_iff, and_imp, forall_exists_index] at this
    simpa using this (fun k => by by_cases h : k = j; { subst h; simp }; simp [h]) i
      (by rwa [Function.update_of_ne (Ne.symm hj), bot_apply, bot_lt_iff_ne_bot]) j

Result:
no goals

Proof state:
ι : Type u_4
π : ι → Type u
f : (i : ι) → π i
inst✝¹ : (i : ι) → PartialOrder (π i)
inst✝ : (i : ι) → OrderBot (π i)
⊢ (∃ i, IsAtom (f i) ∧ ∀ (j : ι), j ≠ i → f j = ⊥) → IsAtom f

Tactic:
rintro ⟨i, ⟨hfi, hlt⟩, hbot⟩

Result:
case intro.intro.intro
ι : Type u_4
π : ι → Type u
f : (i : ι) → π i
inst✝¹ : (i : ι) → PartialOrder (π i)
inst✝ : (i : ι) → OrderBot (π i)
i : ι
hbot : ∀ (j : ι), j ≠ i → f j = ⊥
hfi : f i ≠ ⊥
hlt : ∀ b < f i, b = ⊥
⊢ IsAtom f

Proof state:
ι : Type u_4
π : ι → Type u
f : (i : ι) → π i
inst✝¹ : (i : ι) → PartialOrder (π i)
inst✝ : (i : ι) → OrderBot (π i)
i : ι
hbot : ∀ (j : ι), j ≠ i → f j = ⊥
hfi : f i ≠ ⊥
hlt : ∀ b < f i, b = ⊥
g : (i : ι) → π i
hgf✝ : g < f
j : ι
hgf : g ≤ f
k : ι
hgfk : g k < ⊥
hki : ¬i = k
⊢ False

Tactic:
simp at hgfk

Result:
no goals

Proof state:
case c
ι : Type u_4
π : ι → Type u
f : (i : ι) → π i
inst✝¹ : (i : ι) → PartialOrder (π i)
inst✝ : (i : ι) → OrderBot (π i)
hbot✝ : f ≠ ⊥
h : ∀ b < f, b = ⊥
i : ι
hbot : f i ≠ ⊥
⊢ ∀ b < f i, b = ⊥

case d
ι : Type u_4
π : ι → Type u
f : (i : ι) → π i
inst✝¹ : (i : ι) → PartialOrder (π i)
inst✝ : (i : ι) → OrderBot (π i)
hbot✝ : f ≠ ⊥
h : ∀ b < f, b = ⊥
i : ι
hbot : f i ≠ ⊥
⊢ ∀ (j : ι), j ≠ i → f j = ⊥

Tactic:
case c =>
  intro b hb
  have := h (Function.update ⊥ i b)
  simp only [lt_def, le_def, Pi.eq_bot_iff, and_imp, forall_exists_index] at this
  simpa using this
    (fun j => by by_cases h : j = i; { subst h; simpa using le_of_lt hb }; simp [h])
    i (by simpa using hb) i

Result:
case d
ι : Type u_4
π : ι → Type u
f : (i : ι) → π i
inst✝¹ : (i : ι) → PartialOrder (π i)
inst✝ : (i : ι) → OrderBot (π i)
hbot✝ : f ≠ ⊥
h : ∀ b < f, b = ⊥
i : ι
hbot : f i ≠ ⊥
⊢ ∀ (j : ι), j ≠ i → f j = ⊥