Theorem: Nat.Subtype.ofNat_surjective_aux
File: Mathlib/Logic/Denumerable.lean

tactic: set t : List s :=
  ((List.range x).filter fun y => y ∈ s).pmap
    (fun (y : ℕ) (hy : y ∈ s) => ⟨y, hy⟩)
    (by intros a ha; simpa using (List.mem_filter.mp ha).2) with ht
state_before: α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
⊢ ∃ n, ofNat s n = ⟨x✝, hx⟩
state_after: α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
t : List ↑s := List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
ht : t = List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
⊢ ∃ n, ofNat s n = ⟨x✝, hx⟩

tactic: have hmt : ∀ {y : s}, y ∈ t ↔ y < ⟨x, hx⟩ := by
  simp [List.mem_filter, Subtype.ext_iff_val, ht]
state_before: α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
t : List ↑s := List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
ht : t = List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
⊢ ∃ n, ofNat s n = ⟨x✝, hx⟩
state_after: α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
t : List ↑s := List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
ht : t = List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
hmt : ∀ {y : ↑s}, y ∈ t ↔ y < ⟨x, hx⟩
⊢ ∃ n, ofNat s n = ⟨x✝, hx⟩

tactic: have wf : ∀ m : s, List.maximum t = m → ↑m < x := fun m hmax => by
  simpa using hmt.mp (List.maximum_mem hmax)
state_before: α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
t : List ↑s := List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
ht : t = List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
hmt : ∀ {y : ↑s}, y ∈ t ↔ y < ⟨x, hx⟩
⊢ ∃ n, ofNat s n = ⟨x✝, hx⟩
state_after: α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
t : List ↑s := List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
ht : t = List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
hmt : ∀ {y : ↑s}, y ∈ t ↔ y < ⟨x, hx⟩
wf : ∀ (m : ↑s), t.maximum = ↑m → ↑m < x
⊢ ∃ n, ofNat s n = ⟨x✝, hx⟩

tactic: cases' hmax : List.maximum t with m
state_before: α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
t : List ↑s := List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
ht : t = List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
hmt : ∀ {y : ↑s}, y ∈ t ↔ y < ⟨x, hx⟩
wf : ∀ (m : ↑s), t.maximum = ↑m → ↑m < x
⊢ ∃ n, ofNat s n = ⟨x✝, hx⟩
state_after: case bot
α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
t : List ↑s := List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
ht : t = List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
hmt : ∀ {y : ↑s}, y ∈ t ↔ y < ⟨x, hx⟩
wf : ∀ (m : ↑s), t.maximum = ↑m → ↑m < x
hmax : t.maximum = ⊥
⊢ ∃ n, ofNat s n = ⟨x✝, hx⟩

case coe
α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
t : List ↑s := List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
ht : t = List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
hmt : ∀ {y : ↑s}, y ∈ t ↔ y < ⟨x, hx⟩
wf : ∀ (m : ↑s), t.maximum = ↑m → ↑m < x
m : ↑s
hmax : t.maximum = ↑m
⊢ ∃ n, ofNat s n = ⟨x✝, hx⟩

tactic: cases' ofNat_surjective_aux m.2 with a ha
state_before: case coe
α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
t : List ↑s := List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
ht : t = List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
hmt : ∀ {y : ↑s}, y ∈ t ↔ y < ⟨x, hx⟩
wf : ∀ (m : ↑s), t.maximum = ↑m → ↑m < x
m : ↑s
hmax : t.maximum = ↑m
⊢ ∃ n, ofNat s n = ⟨x✝, hx⟩
state_after: case coe.intro
α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
t : List ↑s := List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
ht : t = List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
hmt : ∀ {y : ↑s}, y ∈ t ↔ y < ⟨x, hx⟩
wf : ∀ (m : ↑s), t.maximum = ↑m → ↑m < x
m : ↑s
hmax : t.maximum = ↑m
a : ℕ
ha : ofNat s a = ⟨↑m, ⋯⟩
⊢ ∃ n, ofNat s n = ⟨x✝, hx⟩

tactic: refine ⟨a + 1, le_antisymm ?_ ?_⟩ <;> rw [ofNat]
state_before: case coe.intro
α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
t : List ↑s := List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
ht : t = List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
hmt : ∀ {y : ↑s}, y ∈ t ↔ y < ⟨x, hx⟩
wf : ∀ (m : ↑s), t.maximum = ↑m → ↑m < x
m : ↑s
hmax : t.maximum = ↑m
a : ℕ
ha : ofNat s a = ⟨↑m, ⋯⟩
⊢ ∃ n, ofNat s n = ⟨x✝, hx⟩
state_after: case coe.intro.refine_1
α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
t : List ↑s := List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
ht : t = List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
hmt : ∀ {y : ↑s}, y ∈ t ↔ y < ⟨x, hx⟩
wf : ∀ (m : ↑s), t.maximum = ↑m → ↑m < x
m : ↑s
hmax : t.maximum = ↑m
a : ℕ
ha : ofNat s a = ⟨↑m, ⋯⟩
⊢ succ (ofNat s a) ≤ ⟨x✝, hx⟩

case coe.intro.refine_2
α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
t : List ↑s := List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
ht : t = List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
hmt : ∀ {y : ↑s}, y ∈ t ↔ y < ⟨x, hx⟩
wf : ∀ (m : ↑s), t.maximum = ↑m → ↑m < x
m : ↑s
hmax : t.maximum = ↑m
a : ℕ
ha : ofNat s a = ⟨↑m, ⋯⟩
⊢ ⟨x✝, hx⟩ ≤ succ (ofNat s a)

tactic: intros a ha
state_before: α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
⊢ ∀ a ∈ List.filter (fun y => decide (y ∈ s)) (List.range x), a ∈ s
state_after: α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
a : ℕ
ha : a ∈ List.filter (fun y => decide (y ∈ s)) (List.range x)
⊢ a ∈ s

tactic: simpa using (List.mem_filter.mp ha).2
state_before: α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
a : ℕ
ha : a ∈ List.filter (fun y => decide (y ∈ s)) (List.range x)
⊢ a ∈ s
state_after: no goals

tactic: simp [List.mem_filter, Subtype.ext_iff_val, ht]
state_before: α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
t : List ↑s := List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
ht : t = List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
⊢ ∀ {y : ↑s}, y ∈ t ↔ y < ⟨x, hx⟩
state_after: no goals

tactic: simpa using hmt.mp (List.maximum_mem hmax)
state_before: α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
t : List ↑s := List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
ht : t = List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
hmt : ∀ {y : ↑s}, y ∈ t ↔ y < ⟨x, hx⟩
m : ↑s
hmax : t.maximum = ↑m
⊢ ↑m < x
state_after: no goals

tactic: refine ⟨0, le_antisymm bot_le (le_of_not_gt fun h => List.not_mem_nil (⊥ : s) ?_)⟩
state_before: case bot
α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
t : List ↑s := List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
ht : t = List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
hmt : ∀ {y : ↑s}, y ∈ t ↔ y < ⟨x, hx⟩
wf : ∀ (m : ↑s), t.maximum = ↑m → ↑m < x
hmax : t.maximum = ⊥
⊢ ∃ n, ofNat s n = ⟨x✝, hx⟩
state_after: case bot
α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
t : List ↑s := List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
ht : t = List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
hmt : ∀ {y : ↑s}, y ∈ t ↔ y < ⟨x, hx⟩
wf : ∀ (m : ↑s), t.maximum = ↑m → ↑m < x
hmax : t.maximum = ⊥
h : ⟨x✝, hx⟩ > ofNat s 0
⊢ ⊥ ∈ []

tactic: rwa [← List.maximum_eq_bot.1 hmax, hmt]
state_before: case bot
α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
t : List ↑s := List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
ht : t = List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
hmt : ∀ {y : ↑s}, y ∈ t ↔ y < ⟨x, hx⟩
wf : ∀ (m : ↑s), t.maximum = ↑m → ↑m < x
hmax : t.maximum = ⊥
h : ⟨x✝, hx⟩ > ofNat s 0
⊢ ⊥ ∈ []
state_after: no goals

tactic: refine succ_le_of_lt ?_
state_before: case coe.intro.refine_1
α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
t : List ↑s := List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
ht : t = List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
hmt : ∀ {y : ↑s}, y ∈ t ↔ y < ⟨x, hx⟩
wf : ∀ (m : ↑s), t.maximum = ↑m → ↑m < x
m : ↑s
hmax : t.maximum = ↑m
a : ℕ
ha : ofNat s a = ⟨↑m, ⋯⟩
⊢ succ (ofNat s a) ≤ ⟨x✝, hx⟩
state_after: case coe.intro.refine_1
α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
t : List ↑s := List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
ht : t = List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
hmt : ∀ {y : ↑s}, y ∈ t ↔ y < ⟨x, hx⟩
wf : ∀ (m : ↑s), t.maximum = ↑m → ↑m < x
m : ↑s
hmax : t.maximum = ↑m
a : ℕ
ha : ofNat s a = ⟨↑m, ⋯⟩
⊢ ofNat s a < ⟨x✝, hx⟩

tactic: rw [ha]
state_before: case coe.intro.refine_1
α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
t : List ↑s := List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
ht : t = List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
hmt : ∀ {y : ↑s}, y ∈ t ↔ y < ⟨x, hx⟩
wf : ∀ (m : ↑s), t.maximum = ↑m → ↑m < x
m : ↑s
hmax : t.maximum = ↑m
a : ℕ
ha : ofNat s a = ⟨↑m, ⋯⟩
⊢ ofNat s a < ⟨x✝, hx⟩
state_after: case coe.intro.refine_1
α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
t : List ↑s := List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
ht : t = List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
hmt : ∀ {y : ↑s}, y ∈ t ↔ y < ⟨x, hx⟩
wf : ∀ (m : ↑s), t.maximum = ↑m → ↑m < x
m : ↑s
hmax : t.maximum = ↑m
a : ℕ
ha : ofNat s a = ⟨↑m, ⋯⟩
⊢ ⟨↑m, ⋯⟩ < ⟨x✝, hx⟩

tactic: exact wf _ hmax
state_before: case coe.intro.refine_1
α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
t : List ↑s := List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
ht : t = List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
hmt : ∀ {y : ↑s}, y ∈ t ↔ y < ⟨x, hx⟩
wf : ∀ (m : ↑s), t.maximum = ↑m → ↑m < x
m : ↑s
hmax : t.maximum = ↑m
a : ℕ
ha : ofNat s a = ⟨↑m, ⋯⟩
⊢ ⟨↑m, ⋯⟩ < ⟨x✝, hx⟩
state_after: no goals

tactic: refine le_succ_of_forall_lt_le fun z hz => ?_
state_before: case coe.intro.refine_2
α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
t : List ↑s := List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
ht : t = List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
hmt : ∀ {y : ↑s}, y ∈ t ↔ y < ⟨x, hx⟩
wf : ∀ (m : ↑s), t.maximum = ↑m → ↑m < x
m : ↑s
hmax : t.maximum = ↑m
a : ℕ
ha : ofNat s a = ⟨↑m, ⋯⟩
⊢ ⟨x✝, hx⟩ ≤ succ (ofNat s a)
state_after: case coe.intro.refine_2
α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
t : List ↑s := List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
ht : t = List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
hmt : ∀ {y : ↑s}, y ∈ t ↔ y < ⟨x, hx⟩
wf : ∀ (m : ↑s), t.maximum = ↑m → ↑m < x
m : ↑s
hmax : t.maximum = ↑m
a : ℕ
ha : ofNat s a = ⟨↑m, ⋯⟩
z : ↑s
hz : z < ⟨x✝, hx⟩
⊢ z ≤ ofNat s a

tactic: rw [ha]
state_before: case coe.intro.refine_2
α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
t : List ↑s := List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
ht : t = List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
hmt : ∀ {y : ↑s}, y ∈ t ↔ y < ⟨x, hx⟩
wf : ∀ (m : ↑s), t.maximum = ↑m → ↑m < x
m : ↑s
hmax : t.maximum = ↑m
a : ℕ
ha : ofNat s a = ⟨↑m, ⋯⟩
z : ↑s
hz : z < ⟨x✝, hx⟩
⊢ z ≤ ofNat s a
state_after: case coe.intro.refine_2
α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
t : List ↑s := List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
ht : t = List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
hmt : ∀ {y : ↑s}, y ∈ t ↔ y < ⟨x, hx⟩
wf : ∀ (m : ↑s), t.maximum = ↑m → ↑m < x
m : ↑s
hmax : t.maximum = ↑m
a : ℕ
ha : ofNat s a = ⟨↑m, ⋯⟩
z : ↑s
hz : z < ⟨x✝, hx⟩
⊢ z ≤ ⟨↑m, ⋯⟩

tactic: cases m
state_before: case coe.intro.refine_2
α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
t : List ↑s := List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
ht : t = List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
hmt : ∀ {y : ↑s}, y ∈ t ↔ y < ⟨x, hx⟩
wf : ∀ (m : ↑s), t.maximum = ↑m → ↑m < x
m : ↑s
hmax : t.maximum = ↑m
a : ℕ
ha : ofNat s a = ⟨↑m, ⋯⟩
z : ↑s
hz : z < ⟨x✝, hx⟩
⊢ z ≤ ⟨↑m, ⋯⟩
state_after: case coe.intro.refine_2.mk
α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
t : List ↑s := List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
ht : t = List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
hmt : ∀ {y : ↑s}, y ∈ t ↔ y < ⟨x, hx⟩
wf : ∀ (m : ↑s), t.maximum = ↑m → ↑m < x
a : ℕ
z : ↑s
hz : z < ⟨x✝, hx⟩
val✝ : ℕ
property✝ : val✝ ∈ s
hmax : t.maximum = ↑⟨val✝, property✝⟩
ha : ofNat s a = ⟨↑⟨val✝, property✝⟩, ⋯⟩
⊢ z ≤ ⟨↑⟨val✝, property✝⟩, ⋯⟩

tactic: exact List.le_maximum_of_mem (hmt.2 hz) hmax
state_before: case coe.intro.refine_2.mk
α : Type u_1
β : Type u_2
s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
x : ℕ := x✝
hx : x✝ ∈ s
t : List ↑s := List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
ht : t = List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
hmt : ∀ {y : ↑s}, y ∈ t ↔ y < ⟨x, hx⟩
wf : ∀ (m : ↑s), t.maximum = ↑m → ↑m < x
a : ℕ
z : ↑s
hz : z < ⟨x✝, hx⟩
val✝ : ℕ
property✝ : val✝ ∈ s
hmax : t.maximum = ↑⟨val✝, property✝⟩
ha : ofNat s a = ⟨↑⟨val✝, property✝⟩, ⋯⟩
⊢ z ≤ ⟨↑⟨val✝, property✝⟩, ⋯⟩
state_after: no goals

tactic: tauto
state_before: s : Set ℕ
inst✝¹ : Infinite ↑s
inst✝ : DecidablePred fun x => x ∈ s
x✝ : ℕ
a✝ :
  ∀ (y : ℕ), (invImage (fun x => x) instWellFoundedRelationOfSizeOf).1 y x✝ → ∀ (hx : y ∈ s), ∃ n, ofNat s n = ⟨y, hx⟩
x : ℕ := x✝
hx : x✝ ∈ s
t : List ↑s := List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
ht : t = List.pmap (fun y hy => ⟨y, hy⟩) (List.filter (fun y => decide (y ∈ s)) (List.range x)) ⋯
hmt : ∀ {y : ↑s}, y ∈ t ↔ y < ⟨x, hx⟩
wf : ∀ (m : ↑s), t.maximum = ↑m → ↑m < x
m : ↑s
h✝ hmax : t.maximum = ↑m
⊢ (invImage (fun x => x) instWellFoundedRelationOfSizeOf).1 (↑m) x✝
state_after: no goals