Theorem: RelEmbedding.acc_iff_no_decreasing_seq
File: Mathlib/Order/OrderIsoNat.lean

tactic: constructor
state_before: α : Type u_1
r : α → α → Prop
inst✝ : IsStrictOrder α r
x : α
⊢ Acc r x ↔ IsEmpty { f // x ∈ Set.range ↑f }

tactic: refine' fun h => h.recOn fun x _ IH => _
state_before: case mp
α : Type u_1
r : α → α → Prop
inst✝ : IsStrictOrder α r
x : α
⊢ Acc r x → IsEmpty { f // x ∈ Set.range ↑f }

tactic: constructor
state_before: case mp
α : Type u_1
r : α → α → Prop
inst✝ : IsStrictOrder α r
x✝¹ : α
h : Acc r x✝¹
x : α
x✝ : ∀ (y : α), r y x → Acc r y
IH : ∀ (y : α), r y x → IsEmpty { f // y ∈ Set.range ↑f }
⊢ IsEmpty { f // x ∈ Set.range ↑f }

tactic: rintro ⟨f, k, hf⟩
state_before: case mp.false
α : Type u_1
r : α → α → Prop
inst✝ : IsStrictOrder α r
x✝¹ : α
h : Acc r x✝¹
x : α
x✝ : ∀ (y : α), r y x → Acc r y
IH : ∀ (y : α), r y x → IsEmpty { f // y ∈ Set.range ↑f }
⊢ { f // x ∈ Set.range ↑f } → False

tactic: exact IsEmpty.elim' (IH (f (k + 1)) (hf ▸ f.map_rel_iff.2 (lt_add_one k))) ⟨f, _, rfl⟩
state_before: case mp.false.mk.intro
α : Type u_1
r : α → α → Prop
inst✝ : IsStrictOrder α r
x✝¹ : α
h : Acc r x✝¹
x : α
x✝ : ∀ (y : α), r y x → Acc r y
IH : ∀ (y : α), r y x → IsEmpty { f // y ∈ Set.range ↑f }
f : (fun x x_1 => x > x_1) ↪r r
k : ℕ
hf : ↑f k = x
⊢ False

tactic: have : ∀ x : { a // ¬Acc r a }, ∃ y : { a // ¬Acc r a }, r y.1 x.1 := by
  rintro ⟨x, hx⟩
  cases exists_not_acc_lt_of_not_acc hx with
  | intro w h => exact ⟨⟨w, h.1⟩, h.2⟩
state_before: case mpr
α : Type u_1
r : α → α → Prop
inst✝ : IsStrictOrder α r
x : α
⊢ IsEmpty { f // x ∈ Set.range ↑f } → Acc r x

tactic: obtain ⟨f, h⟩ := Classical.axiom_of_choice this
state_before: case mpr
α : Type u_1
r : α → α → Prop
inst✝ : IsStrictOrder α r
x : α
this : ∀ (x : { a // ¬Acc r a }), ∃ y, r ↑y ↑x
⊢ IsEmpty { f // x ∈ Set.range ↑f } → Acc r x

tactic: refine' fun E =>
  by_contradiction fun hx => E.elim' ⟨natGt (fun n => ((f^[n]) ⟨x, hx⟩).1) fun n => _, 0, rfl⟩
state_before: case mpr.intro
α : Type u_1
r : α → α → Prop
inst✝ : IsStrictOrder α r
x : α
this : ∀ (x : { a // ¬Acc r a }), ∃ y, r ↑y ↑x
f : { a // ¬Acc r a } → { a // ¬Acc r a }
h : ∀ (x : { a // ¬Acc r a }), r ↑(f x) ↑x
⊢ IsEmpty { f // x ∈ Set.range ↑f } → Acc r x

tactic: simp only [Function.iterate_succ']
state_before: case mpr.intro
α : Type u_1
r : α → α → Prop
inst✝ : IsStrictOrder α r
x : α
this : ∀ (x : { a // ¬Acc r a }), ∃ y, r ↑y ↑x
f : { a // ¬Acc r a } → { a // ¬Acc r a }
h : ∀ (x : { a // ¬Acc r a }), r ↑(f x) ↑x
E : IsEmpty { f // x ∈ Set.range ↑f }
hx : ¬Acc r x
n : ℕ
⊢ r ((fun n => ↑((f^[n]) { val := x, property := hx })) (n + 1)) ((fun n => ↑((f^[n]) { val := x, property := hx })) n)

tactic: apply h
state_before: case mpr.intro
α : Type u_1
r : α → α → Prop
inst✝ : IsStrictOrder α r
x : α
this : ∀ (x : { a // ¬Acc r a }), ∃ y, r ↑y ↑x
f : { a // ¬Acc r a } → { a // ¬Acc r a }
h : ∀ (x : { a // ¬Acc r a }), r ↑(f x) ↑x
E : IsEmpty { f // x ∈ Set.range ↑f }
hx : ¬Acc r x
n : ℕ
⊢ r ↑((f ∘ f^[n]) { val := x, property := hx }) ↑((f^[n]) { val := x, property := hx })

tactic: rintro ⟨x, hx⟩
state_before: α : Type u_1
r : α → α → Prop
inst✝ : IsStrictOrder α r
x : α
⊢ ∀ (x : { a // ¬Acc r a }), ∃ y, r ↑y ↑x

tactic: cases exists_not_acc_lt_of_not_acc hx with
| intro w h => exact ⟨⟨w, h.1⟩, h.2⟩
state_before: case mk
α : Type u_1
r : α → α → Prop
inst✝ : IsStrictOrder α r
x✝ x : α
hx : ¬Acc r x
⊢ ∃ y, r ↑y ↑{ val := x, property := hx }

tactic: exact ⟨⟨w, h.1⟩, h.2⟩
state_before: case mk.intro
α : Type u_1
r : α → α → Prop
inst✝ : IsStrictOrder α r
x✝ x : α
hx : ¬Acc r x
w : α
h : ¬Acc r w ∧ r w x
⊢ ∃ y, r ↑y ↑{ val := x, property := hx }