Theorem: WType.infinite_of_nonempty_of_isEmpty
File: Mathlib/Data/W/Basic.lean

tactic: intro hf
state_before: α : Type u_1
β : α → Type u_2
a b : α
ha : Nonempty (β a)
he : IsEmpty (β b)
⊢ ¬Finite (WType β)
state_after: α : Type u_1
β : α → Type u_2
a b : α
ha : Nonempty (β a)
he : IsEmpty (β b)
hf : Finite (WType β)
⊢ False

tactic: have hba : b ≠ a := fun h => ha.elim (IsEmpty.elim' (show IsEmpty (β a) from h ▸ he))
state_before: α : Type u_1
β : α → Type u_2
a b : α
ha : Nonempty (β a)
he : IsEmpty (β b)
hf : Finite (WType β)
⊢ False
state_after: α : Type u_1
β : α → Type u_2
a b : α
ha : Nonempty (β a)
he : IsEmpty (β b)
hf : Finite (WType β)
hba : b ≠ a
⊢ False

tactic: refine
  not_injective_infinite_finite
    (fun n : ℕ =>
      show WType β from Nat.recOn n ⟨b, IsEmpty.elim' he⟩ fun _ ih => ⟨a, fun _ => ih⟩)
    ?_
state_before: α : Type u_1
β : α → Type u_2
a b : α
ha : Nonempty (β a)
he : IsEmpty (β b)
hf : Finite (WType β)
hba : b ≠ a
⊢ False
state_after: α : Type u_1
β : α → Type u_2
a b : α
ha : Nonempty (β a)
he : IsEmpty (β b)
hf : Finite (WType β)
hba : b ≠ a
⊢ Function.Injective fun n =>
    let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
    this

tactic: intro n m h
state_before: α : Type u_1
β : α → Type u_2
a b : α
ha : Nonempty (β a)
he : IsEmpty (β b)
hf : Finite (WType β)
hba : b ≠ a
⊢ Function.Injective fun n =>
    let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
    this
state_after: α : Type u_1
β : α → Type u_2
a b : α
ha : Nonempty (β a)
he : IsEmpty (β b)
hf : Finite (WType β)
hba : b ≠ a
n m : ℕ
h :
  (fun n =>
        let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
        this)
      n =
    (fun n =>
        let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
        this)
      m
⊢ n = m

tactic: induction' n with n ih generalizing m
state_before: α : Type u_1
β : α → Type u_2
a b : α
ha : Nonempty (β a)
he : IsEmpty (β b)
hf : Finite (WType β)
hba : b ≠ a
n m : ℕ
h :
  (fun n =>
        let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
        this)
      n =
    (fun n =>
        let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
        this)
      m
⊢ n = m
state_after: case zero
α : Type u_1
β : α → Type u_2
a b : α
ha : Nonempty (β a)
he : IsEmpty (β b)
hf : Finite (WType β)
hba : b ≠ a
m : ℕ
h :
  (fun n =>
        let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
        this)
      0 =
    (fun n =>
        let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
        this)
      m
⊢ 0 = m

case succ
α : Type u_1
β : α → Type u_2
a b : α
ha : Nonempty (β a)
he : IsEmpty (β b)
hf : Finite (WType β)
hba : b ≠ a
n : ℕ
ih :
  ∀ ⦃m : ℕ⦄,
    (fun n =>
            let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
            this)
          n =
        (fun n =>
            let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
            this)
          m →
      n = m
m : ℕ
h :
  (fun n =>
        let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
        this)
      (n + 1) =
    (fun n =>
        let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
        this)
      m
⊢ n + 1 = m

tactic: cases' m with m <;> simp_all
state_before: case zero
α : Type u_1
β : α → Type u_2
a b : α
ha : Nonempty (β a)
he : IsEmpty (β b)
hf : Finite (WType β)
hba : b ≠ a
m : ℕ
h :
  (fun n =>
        let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
        this)
      0 =
    (fun n =>
        let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
        this)
      m
⊢ 0 = m
state_after: no goals

tactic: cases' m with m
state_before: case succ
α : Type u_1
β : α → Type u_2
a b : α
ha : Nonempty (β a)
he : IsEmpty (β b)
hf : Finite (WType β)
hba : b ≠ a
n : ℕ
ih :
  ∀ ⦃m : ℕ⦄,
    (fun n =>
            let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
            this)
          n =
        (fun n =>
            let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
            this)
          m →
      n = m
m : ℕ
h :
  (fun n =>
        let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
        this)
      (n + 1) =
    (fun n =>
        let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
        this)
      m
⊢ n + 1 = m
state_after: case succ.zero
α : Type u_1
β : α → Type u_2
a b : α
ha : Nonempty (β a)
he : IsEmpty (β b)
hf : Finite (WType β)
hba : b ≠ a
n : ℕ
ih :
  ∀ ⦃m : ℕ⦄,
    (fun n =>
            let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
            this)
          n =
        (fun n =>
            let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
            this)
          m →
      n = m
h :
  (fun n =>
        let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
        this)
      (n + 1) =
    (fun n =>
        let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
        this)
      0
⊢ n + 1 = 0

case succ.succ
α : Type u_1
β : α → Type u_2
a b : α
ha : Nonempty (β a)
he : IsEmpty (β b)
hf : Finite (WType β)
hba : b ≠ a
n : ℕ
ih :
  ∀ ⦃m : ℕ⦄,
    (fun n =>
            let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
            this)
          n =
        (fun n =>
            let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
            this)
          m →
      n = m
m : ℕ
h :
  (fun n =>
        let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
        this)
      (n + 1) =
    (fun n =>
        let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
        this)
      (m + 1)
⊢ n + 1 = m + 1

tactic: simp_all
state_before: case succ.zero
α : Type u_1
β : α → Type u_2
a b : α
ha : Nonempty (β a)
he : IsEmpty (β b)
hf : Finite (WType β)
hba : b ≠ a
n : ℕ
ih :
  ∀ ⦃m : ℕ⦄,
    (fun n =>
            let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
            this)
          n =
        (fun n =>
            let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
            this)
          m →
      n = m
h :
  (fun n =>
        let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
        this)
      (n + 1) =
    (fun n =>
        let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
        this)
      0
⊢ n + 1 = 0
state_after: no goals

tactic: refine congr_arg Nat.succ (ih ?_)
state_before: case succ.succ
α : Type u_1
β : α → Type u_2
a b : α
ha : Nonempty (β a)
he : IsEmpty (β b)
hf : Finite (WType β)
hba : b ≠ a
n : ℕ
ih :
  ∀ ⦃m : ℕ⦄,
    (fun n =>
            let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
            this)
          n =
        (fun n =>
            let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
            this)
          m →
      n = m
m : ℕ
h :
  (fun n =>
        let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
        this)
      (n + 1) =
    (fun n =>
        let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
        this)
      (m + 1)
⊢ n + 1 = m + 1
state_after: case succ.succ
α : Type u_1
β : α → Type u_2
a b : α
ha : Nonempty (β a)
he : IsEmpty (β b)
hf : Finite (WType β)
hba : b ≠ a
n : ℕ
ih :
  ∀ ⦃m : ℕ⦄,
    (fun n =>
            let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
            this)
          n =
        (fun n =>
            let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
            this)
          m →
      n = m
m : ℕ
h :
  (fun n =>
        let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
        this)
      (n + 1) =
    (fun n =>
        let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
        this)
      (m + 1)
⊢ (fun n =>
        let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
        this)
      n =
    (fun n =>
        let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
        this)
      m

tactic: simp_all [Function.funext_iff]
state_before: case succ.succ
α : Type u_1
β : α → Type u_2
a b : α
ha : Nonempty (β a)
he : IsEmpty (β b)
hf : Finite (WType β)
hba : b ≠ a
n : ℕ
ih :
  ∀ ⦃m : ℕ⦄,
    (fun n =>
            let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
            this)
          n =
        (fun n =>
            let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
            this)
          m →
      n = m
m : ℕ
h :
  (fun n =>
        let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
        this)
      (n + 1) =
    (fun n =>
        let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
        this)
      (m + 1)
⊢ (fun n =>
        let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
        this)
      n =
    (fun n =>
        let_fun this := Nat.recOn n (mk b he.elim') fun x ih => mk a fun x => ih;
        this)
      m
state_after: no goals