l3lab/ntp-mathlib huggingface dataset:
/-- If two subtypes of a fintype have equal cardinality, so do their complements. -/
theorem Fintype.card_compl_eq_card_compl [Finite α] (p q : α → Prop) [Fintype { x // p x }]
    [Fintype { x // ¬p x }] [Fintype { x // q x }] [Fintype { x // ¬q x }]
    (h : Fintype.card { x // p x } = Fintype.card { x // q x }) :
    Fintype.card { x // ¬p x } = Fintype.card { x // ¬q x } := by
  cases nonempty_fintype α
  

Proof state:
case intro
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝⁴ : Finite α
p q : α → Prop
inst✝³ : Fintype { x // p x }
inst✝² : Fintype { x // ¬p x }
inst✝¹ : Fintype { x // q x }
inst✝ : Fintype { x // ¬q x }
h : card { x // p x } = card { x // q x }
val✝ : Fintype α
⊢ card { x // ¬p x } = card { x // ¬q x }

Next tactic:
simp only [Fintype.card_subtype_compl, h]
theorem univ_eq_singleton_of_card_one {α} [Fintype α] (x : α) (h : Fintype.card α = 1) :
    (univ : Finset α) = {x} := by
  

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_4
inst✝ : Fintype α
x : α
h : Fintype.card α = 1
⊢ univ = {x}

Next tactic:
symm
theorem univ_eq_singleton_of_card_one {α} [Fintype α] (x : α) (h : Fintype.card α = 1) :
    (univ : Finset α) = {x} := by
  symm
  

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_4
inst✝ : Fintype α
x : α
h : Fintype.card α = 1
⊢ {x} = univ

Next tactic:
apply eq_of_subset_of_card_le (subset_univ {x})
theorem univ_eq_singleton_of_card_one {α} [Fintype α] (x : α) (h : Fintype.card α = 1) :
    (univ : Finset α) = {x} := by
  symm
  apply eq_of_subset_of_card_le (subset_univ {x})
  

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_4
inst✝ : Fintype α
x : α
h : Fintype.card α = 1
⊢ card univ ≤ card {x}

Next tactic:
apply le_of_eq
theorem univ_eq_singleton_of_card_one {α} [Fintype α] (x : α) (h : Fintype.card α = 1) :
    (univ : Finset α) = {x} := by
  symm
  apply eq_of_subset_of_card_le (subset_univ {x})
  apply le_of_eq
  

Proof state:
case a
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_4
inst✝ : Fintype α
x : α
h : Fintype.card α = 1
⊢ card univ = card {x}

Next tactic:
simp [h, Finset.card_univ]
theorem wellFounded_of_trans_of_irrefl (r : α → α → Prop) [IsTrans α r] [IsIrrefl α r] :
    WellFounded r := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : Finite α
r : α → α → Prop
inst✝¹ : IsTrans α r
inst✝ : IsIrrefl α r
⊢ WellFounded r

Next tactic:
classical
  cases nonempty_fintype α
  have :
    ∀ x y, r x y → (univ.filter fun z => r z x).card < (univ.filter fun z => r z y).card :=
    fun x y hxy =>
    Finset.card_lt_card <| by
      simp only [Finset.lt_iff_ssubset.symm, lt_iff_le_not_le, Finset.le_iff_subset,
          Finset.subset_iff, mem_filter, true_and_iff, mem_univ, hxy];
      exact
        ⟨fun z hzx => _root_.trans hzx hxy,
          not_forall_of_exists_not ⟨x, not_imp.2 ⟨hxy, irrefl x⟩⟩⟩
  exact Subrelation.wf (this _ _) (measure _).wf
theorem wellFounded_of_trans_of_irrefl (r : α → α → Prop) [IsTrans α r] [IsIrrefl α r] :
    WellFounded r := by
  classical
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : Finite α
r : α → α → Prop
inst✝¹ : IsTrans α r
inst✝ : IsIrrefl α r
⊢ WellFounded r

Next tactic:
cases nonempty_fintype α
theorem wellFounded_of_trans_of_irrefl (r : α → α → Prop) [IsTrans α r] [IsIrrefl α r] :
    WellFounded r := by
  classical
  cases nonempty_fintype α
  

Proof state:
case intro
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : Finite α
r : α → α → Prop
inst✝¹ : IsTrans α r
inst✝ : IsIrrefl α r
val✝ : Fintype α
⊢ WellFounded r

Next tactic:
have :
    ∀ x y, r x y → (univ.filter fun z => r z x).card < (univ.filter fun z => r z y).card :=
    fun x y hxy =>
    Finset.card_lt_card <| by
      simp only [Finset.lt_iff_ssubset.symm, lt_iff_le_not_le, Finset.le_iff_subset,
          Finset.subset_iff, mem_filter, true_and_iff, mem_univ, hxy];
      exact
        ⟨fun z hzx => _root_.trans hzx hxy,
          not_forall_of_exists_not ⟨x, not_imp.2 ⟨hxy, irrefl x⟩⟩⟩
theorem wellFounded_of_trans_of_irrefl (r : α → α → Prop) [IsTrans α r] [IsIrrefl α r] :
    WellFounded r := by
  classical
  cases nonempty_fintype α
  have :
    ∀ x y, r x y → (univ.filter fun z => r z x).card < (univ.filter fun z => r z y).card :=
    fun x y hxy =>
    Finset.card_lt_card <| by
      

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : Finite α
r : α → α → Prop
inst✝¹ : IsTrans α r
inst✝ : IsIrrefl α r
val✝ : Fintype α
x y : α
hxy : r x y
⊢ filter (fun z => r z x) univ ⊂ filter (fun z => r z y) univ

Next tactic:
simp only [Finset.lt_iff_ssubset.symm, lt_iff_le_not_le, Finset.le_iff_subset,
          Finset.subset_iff, mem_filter, true_and_iff, mem_univ, hxy]
theorem wellFounded_of_trans_of_irrefl (r : α → α → Prop) [IsTrans α r] [IsIrrefl α r] :
    WellFounded r := by
  classical
  cases nonempty_fintype α
  have :
    ∀ x y, r x y → (univ.filter fun z => r z x).card < (univ.filter fun z => r z y).card :=
    fun x y hxy =>
    Finset.card_lt_card <| by
      simp only [Finset.lt_iff_ssubset.symm, lt_iff_le_not_le, Finset.le_iff_subset,
          Finset.subset_iff, mem_filter, true_and_iff, mem_univ, hxy];
      

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : Finite α
r : α → α → Prop
inst✝¹ : IsTrans α r
inst✝ : IsIrrefl α r
val✝ : Fintype α
x y : α
hxy : r x y
⊢ (∀ ⦃x_1 : α⦄, r x_1 x → r x_1 y) ∧ ¬∀ ⦃x_1 : α⦄, r x_1 y → r x_1 x

Next tactic:
exact
        ⟨fun z hzx => _root_.trans hzx hxy,
          not_forall_of_exists_not ⟨x, not_imp.2 ⟨hxy, irrefl x⟩⟩⟩
theorem wellFounded_of_trans_of_irrefl (r : α → α → Prop) [IsTrans α r] [IsIrrefl α r] :
    WellFounded r := by
  classical
  cases nonempty_fintype α
  have :
    ∀ x y, r x y → (univ.filter fun z => r z x).card < (univ.filter fun z => r z y).card :=
    fun x y hxy =>
    Finset.card_lt_card <| by
      simp only [Finset.lt_iff_ssubset.symm, lt_iff_le_not_le, Finset.le_iff_subset,
          Finset.subset_iff, mem_filter, true_and_iff, mem_univ, hxy];
      exact
        ⟨fun z hzx => _root_.trans hzx hxy,
          not_forall_of_exists_not ⟨x, not_imp.2 ⟨hxy, irrefl x⟩⟩⟩
  

Proof state:
case intro
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : Finite α
r : α → α → Prop
inst✝¹ : IsTrans α r
inst✝ : IsIrrefl α r
val✝ : Fintype α
this : ∀ (x y : α), r x y → card (filter (fun z => r z x) univ) < card (filter (fun z => r z y) univ)
⊢ WellFounded r

Next tactic:
exact Subrelation.wf (this _ _) (measure _).wf
theorem Finset.exists_minimal {α : Type*} [Preorder α] (s : Finset α) (h : s.Nonempty) :
    ∃ m ∈ s, ∀ x ∈ s, ¬x < m := by
  

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_4
inst✝ : Preorder α
s : Finset α
h : Finset.Nonempty s
⊢ ∃ m ∈ s, ∀ x ∈ s, ¬x < m

Next tactic:
obtain ⟨c, hcs : c ∈ s⟩ := h
theorem Finset.exists_minimal {α : Type*} [Preorder α] (s : Finset α) (h : s.Nonempty) :
    ∃ m ∈ s, ∀ x ∈ s, ¬x < m := by
  obtain ⟨c, hcs : c ∈ s⟩ := h
  

Proof state:
case intro
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_4
inst✝ : Preorder α
s : Finset α
c : α
hcs : c ∈ s
⊢ ∃ m ∈ s, ∀ x ∈ s, ¬x < m

Next tactic:
have : WellFounded (@LT.lt { x // x ∈ s } _) := Finite.wellFounded_of_trans_of_irrefl _
theorem Finset.exists_minimal {α : Type*} [Preorder α] (s : Finset α) (h : s.Nonempty) :
    ∃ m ∈ s, ∀ x ∈ s, ¬x < m := by
  obtain ⟨c, hcs : c ∈ s⟩ := h
  have : WellFounded (@LT.lt { x // x ∈ s } _) := Finite.wellFounded_of_trans_of_irrefl _
  

Proof state:
case intro
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_4
inst✝ : Preorder α
s : Finset α
c : α
hcs : c ∈ s
this : WellFounded LT.lt
⊢ ∃ m ∈ s, ∀ x ∈ s, ¬x < m

Next tactic:
obtain ⟨⟨m, hms : m ∈ s⟩, -, H⟩ := this.has_min Set.univ ⟨⟨c, hcs⟩, trivial⟩
theorem Finset.exists_minimal {α : Type*} [Preorder α] (s : Finset α) (h : s.Nonempty) :
    ∃ m ∈ s, ∀ x ∈ s, ¬x < m := by
  obtain ⟨c, hcs : c ∈ s⟩ := h
  have : WellFounded (@LT.lt { x // x ∈ s } _) := Finite.wellFounded_of_trans_of_irrefl _
  obtain ⟨⟨m, hms : m ∈ s⟩, -, H⟩ := this.has_min Set.univ ⟨⟨c, hcs⟩, trivial⟩
  

Proof state:
case intro.intro.mk.intro
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_4
inst✝ : Preorder α
s : Finset α
c : α
hcs : c ∈ s
this : WellFounded LT.lt
m : α
hms : m ∈ s
H : ∀ x ∈ Set.univ, ¬x < { val := m, property := hms }
⊢ ∃ m ∈ s, ∀ x ∈ s, ¬x < m

Next tactic:
exact ⟨m, hms, fun x hx hxm => H ⟨x, hx⟩ trivial hxm⟩
/-- If `s : Set α` is a proper subset of `α` and `f : α → s` is injective, then `α` is infinite. -/
theorem of_injective_to_set {s : Set α} (hs : s ≠ Set.univ) {f : α → s} (hf : Injective f) :
    Infinite α :=
  of_not_fintype fun h => by
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
s : Set α
hs : s ≠ Set.univ
f : α → ↑s
hf : Injective f
h : Fintype α
⊢ False

Next tactic:
classical
      refine' lt_irrefl (Fintype.card α) _
      calc
        Fintype.card α ≤ Fintype.card s := Fintype.card_le_of_injective f hf
        _ = s.toFinset.card := s.toFinset_card.symm
        _ < Fintype.card α :=
          Finset.card_lt_card <| by rwa [Set.toFinset_ssubset_univ, Set.ssubset_univ_iff]
/-- If `s : Set α` is a proper subset of `α` and `f : α → s` is injective, then `α` is infinite. -/
theorem of_injective_to_set {s : Set α} (hs : s ≠ Set.univ) {f : α → s} (hf : Injective f) :
    Infinite α :=
  of_not_fintype fun h => by
    classical
      

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
s : Set α
hs : s ≠ Set.univ
f : α → ↑s
hf : Injective f
h : Fintype α
⊢ False

Next tactic:
refine' lt_irrefl (Fintype.card α) _
/-- If `s : Set α` is a proper subset of `α` and `f : α → s` is injective, then `α` is infinite. -/
theorem of_injective_to_set {s : Set α} (hs : s ≠ Set.univ) {f : α → s} (hf : Injective f) :
    Infinite α :=
  of_not_fintype fun h => by
    classical
      refine' lt_irrefl (Fintype.card α) _
      

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
s : Set α
hs : s ≠ Set.univ
f : α → ↑s
hf : Injective f
h : Fintype α
⊢ Fintype.card α < Fintype.card α

Next tactic:
calc
        Fintype.card α ≤ Fintype.card s := Fintype.card_le_of_injective f hf
        _ = s.toFinset.card := s.toFinset_card.symm
        _ < Fintype.card α :=
          Finset.card_lt_card <| by rwa [Set.toFinset_ssubset_univ, Set.ssubset_univ_iff]
/-- If `s : Set α` is a proper subset of `α` and `f : α → s` is injective, then `α` is infinite. -/
theorem of_injective_to_set {s : Set α} (hs : s ≠ Set.univ) {f : α → s} (hf : Injective f) :
    Infinite α :=
  of_not_fintype fun h => by
    classical
      refine' lt_irrefl (Fintype.card α) _
      calc
        Fintype.card α ≤ Fintype.card s := Fintype.card_le_of_injective f hf
        _ = s.toFinset.card := s.toFinset_card.symm
        _ < Fintype.card α :=
          Finset.card_lt_card <| by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
s : Set α
hs : s ≠ Set.univ
f : α → ↑s
hf : Injective f
h : Fintype α
⊢ Set.toFinset s ⊂ univ

Next tactic:
rwa [Set.toFinset_ssubset_univ, Set.ssubset_univ_iff]
instance (priority := 100) (α : Type*) [H : Infinite α] : Nontrivial α :=
  ⟨let ⟨x, _hx⟩ := exists_not_mem_finset (∅ : Finset α)
    let ⟨y, hy⟩ := exists_not_mem_finset ({x} : Finset α)
    ⟨y, x, by 

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_4
H : Infinite α
x : α
_hx : x ∉ ∅
y : α
hy : y ∉ {x}
⊢ y ≠ x

Next tactic:
simpa only [mem_singleton] using hy
protected theorem nonempty (α : Type*) [Infinite α] : Nonempty α := by 

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_4
inst✝ : Infinite α
⊢ Nonempty α

Next tactic:
infer_instance
instance : Infinite ℕ :=
  Infinite.of_not_fintype <| by
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
⊢ Fintype ℕ → False

Next tactic:
intro h
instance : Infinite ℕ :=
  Infinite.of_not_fintype <| by
    intro h
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
h : Fintype ℕ
⊢ False

Next tactic:
exact (Finset.range _).card_le_univ.not_lt ((Nat.lt_succ_self _).trans_eq (card_range _).symm)
instance String.infinite : Infinite String :=
  Infinite.of_injective (String.mk) <| by
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
⊢ Injective mk

Next tactic:
intro _ _ h
instance String.infinite : Infinite String :=
  Infinite.of_injective (String.mk) <| by
    intro _ _ h
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
a₁✝ a₂✝ : List Char
h : { data := a₁✝ } = { data := a₂✝ }
⊢ a₁✝ = a₂✝

Next tactic:
cases h with
    | refl => rfl
instance String.infinite : Infinite String :=
  Infinite.of_injective (String.mk) <| by
    intro _ _ h
    cases h with
    

Proof state:
case refl
α : Type u_1
β : Type u_2
γ : Type u_3
a₁✝ : List Char
⊢ a₁✝ = a₁✝

Next tactic:
| refl => rfl
instance String.infinite : Infinite String :=
  Infinite.of_injective (String.mk) <| by
    intro _ _ h
    cases h with
    | refl => 

Proof state:
case refl
α : Type u_1
β : Type u_2
γ : Type u_3
a₁✝ : List Char
⊢ a₁✝ = a₁✝

Next tactic:
rfl
instance instInfiniteProdSubtypeCommute [Mul α] [Infinite α] :
    Infinite { p : α × α // Commute p.1 p.2 } :=
  Infinite.of_injective (fun a => ⟨⟨a, a⟩, rfl⟩) (by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : Mul α
inst✝ : Infinite α
⊢ Injective fun a => { val := (a, a), property := (_ : (a, a).1 * (a, a).2 = (a, a).1 * (a, a).2) }

Next tactic:
intro
instance instInfiniteProdSubtypeCommute [Mul α] [Infinite α] :
    Infinite { p : α × α // Commute p.1 p.2 } :=
  Infinite.of_injective (fun a => ⟨⟨a, a⟩, rfl⟩) (by intro; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : Mul α
inst✝ : Infinite α
a₁✝ : α
⊢ ∀ ⦃a₂ : α⦄,
    (fun a => { val := (a, a), property := (_ : (a, a).1 * (a, a).2 = (a, a).1 * (a, a).2) }) a₁✝ =
        (fun a => { val := (a, a), property := (_ : (a, a).1 * (a, a).2 = (a, a).1 * (a, a).2) }) a₂ →
      a₁✝ = a₂

Next tactic:
simp
private theorem natEmbeddingAux_injective (α : Type*) [Infinite α] :
    Function.Injective (natEmbeddingAux α) := by
  

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_4
inst✝ : Infinite α
⊢ Injective (Infinite.natEmbeddingAux α)

Next tactic:
rintro m n h
private theorem natEmbeddingAux_injective (α : Type*) [Infinite α] :
    Function.Injective (natEmbeddingAux α) := by
  rintro m n h
  

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_4
inst✝ : Infinite α
m n : ℕ
h : Infinite.natEmbeddingAux α m = Infinite.natEmbeddingAux α n
⊢ m = n

Next tactic:
letI := Classical.decEq α
private theorem natEmbeddingAux_injective (α : Type*) [Infinite α] :
    Function.Injective (natEmbeddingAux α) := by
  rintro m n h
  letI := Classical.decEq α
  

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_4
inst✝ : Infinite α
m n : ℕ
h : Infinite.natEmbeddingAux α m = Infinite.natEmbeddingAux α n
this : DecidableEq α := Classical.decEq α
⊢ m = n

Next tactic:
wlog hmlen : m ≤ n generalizing m n
private theorem natEmbeddingAux_injective (α : Type*) [Infinite α] :
    Function.Injective (natEmbeddingAux α) := by
  rintro m n h
  letI := Classical.decEq α
  wlog hmlen : m ≤ n generalizing m n
  · 

Proof state:
case inr
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_4
inst✝ : Infinite α
m n : ℕ
h : Infinite.natEmbeddingAux α m = Infinite.natEmbeddingAux α n
this✝ : DecidableEq α := Classical.decEq α
this : ∀ ⦃m n : ℕ⦄, Infinite.natEmbeddingAux α m = Infinite.natEmbeddingAux α n → m ≤ n → m = n
hmlen : ¬m ≤ n
⊢ m = n

Next tactic:
exact (this h.symm $ le_of_not_le hmlen).symm
private theorem natEmbeddingAux_injective (α : Type*) [Infinite α] :
    Function.Injective (natEmbeddingAux α) := by
  rintro m n h
  letI := Classical.decEq α
  wlog hmlen : m ≤ n generalizing m n
  · exact (this h.symm $ le_of_not_le hmlen).symm
  

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_4
inst✝ : Infinite α
this : DecidableEq α := Classical.decEq α
m n : ℕ
h : Infinite.natEmbeddingAux α m = Infinite.natEmbeddingAux α n
hmlen : m ≤ n
⊢ m = n

Next tactic:
by_contra hmn
private theorem natEmbeddingAux_injective (α : Type*) [Infinite α] :
    Function.Injective (natEmbeddingAux α) := by
  rintro m n h
  letI := Classical.decEq α
  wlog hmlen : m ≤ n generalizing m n
  · exact (this h.symm $ le_of_not_le hmlen).symm
  by_contra hmn
  

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_4
inst✝ : Infinite α
this : DecidableEq α := Classical.decEq α
m n : ℕ
h : Infinite.natEmbeddingAux α m = Infinite.natEmbeddingAux α n
hmlen : m ≤ n
hmn : ¬m = n
⊢ False

Next tactic:
have hmn : m < n := lt_of_le_of_ne hmlen hmn
private theorem natEmbeddingAux_injective (α : Type*) [Infinite α] :
    Function.Injective (natEmbeddingAux α) := by
  rintro m n h
  letI := Classical.decEq α
  wlog hmlen : m ≤ n generalizing m n
  · exact (this h.symm $ le_of_not_le hmlen).symm
  by_contra hmn
  have hmn : m < n := lt_of_le_of_ne hmlen hmn
  

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_4
inst✝ : Infinite α
this : DecidableEq α := Classical.decEq α
m n : ℕ
h : Infinite.natEmbeddingAux α m = Infinite.natEmbeddingAux α n
hmlen : m ≤ n
hmn✝ : ¬m = n
hmn : m < n
⊢ False

Next tactic:
refine (Classical.choose_spec (exists_not_mem_finset
    ((Multiset.range n).pmap (λ m (_ : m < n) => natEmbeddingAux α m)
      (fun _ => Multiset.mem_range.1)).toFinset)) ?_
private theorem natEmbeddingAux_injective (α : Type*) [Infinite α] :
    Function.Injective (natEmbeddingAux α) := by
  rintro m n h
  letI := Classical.decEq α
  wlog hmlen : m ≤ n generalizing m n
  · exact (this h.symm $ le_of_not_le hmlen).symm
  by_contra hmn
  have hmn : m < n := lt_of_le_of_ne hmlen hmn
  refine (Classical.choose_spec (exists_not_mem_finset
    ((Multiset.range n).pmap (λ m (_ : m < n) => natEmbeddingAux α m)
      (fun _ => Multiset.mem_range.1)).toFinset)) ?_
  

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_4
inst✝ : Infinite α
this : DecidableEq α := Classical.decEq α
m n : ℕ
h : Infinite.natEmbeddingAux α m = Infinite.natEmbeddingAux α n
hmlen : m ≤ n
hmn✝ : ¬m = n
hmn : m < n
⊢ Classical.choose
      (_ :
        ∃ x,
          x ∉
            Multiset.toFinset
              (Multiset.pmap (fun m x => Infinite.natEmbeddingAux α m) (Multiset.range n)
                (_ : ∀ x ∈ Multiset.range n, x < n))) ∈
    Multiset.toFinset
      (Multiset.pmap (fun m x => Infinite.natEmbeddingAux α m) (Multiset.range n) (_ : ∀ x ∈ Multiset.range n, x < n))

Next tactic:
refine Multiset.mem_toFinset.2 (Multiset.mem_pmap.2 ⟨m, Multiset.mem_range.2 hmn, ?_⟩)
private theorem natEmbeddingAux_injective (α : Type*) [Infinite α] :
    Function.Injective (natEmbeddingAux α) := by
  rintro m n h
  letI := Classical.decEq α
  wlog hmlen : m ≤ n generalizing m n
  · exact (this h.symm $ le_of_not_le hmlen).symm
  by_contra hmn
  have hmn : m < n := lt_of_le_of_ne hmlen hmn
  refine (Classical.choose_spec (exists_not_mem_finset
    ((Multiset.range n).pmap (λ m (_ : m < n) => natEmbeddingAux α m)
      (fun _ => Multiset.mem_range.1)).toFinset)) ?_
  refine Multiset.mem_toFinset.2 (Multiset.mem_pmap.2 ⟨m, Multiset.mem_range.2 hmn, ?_⟩)
  

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_4
inst✝ : Infinite α
this : DecidableEq α := Classical.decEq α
m n : ℕ
h : Infinite.natEmbeddingAux α m = Infinite.natEmbeddingAux α n
hmlen : m ≤ n
hmn✝ : ¬m = n
hmn : m < n
⊢ Infinite.natEmbeddingAux α m =
    Classical.choose
      (_ :
        ∃ x,
          x ∉
            Multiset.toFinset
              (Multiset.pmap (fun m x => Infinite.natEmbeddingAux α m) (Multiset.range n)
                (_ : ∀ x ∈ Multiset.range n, x < n)))

Next tactic:
rw [h, natEmbeddingAux]
/-- See `Infinite.exists_superset_card_eq` for a version that, for an `s : Finset α`,
provides a superset `t : Finset α`, `s ⊆ t` such that `t.card` is fixed. -/
theorem exists_subset_card_eq (α : Type*) [Infinite α] (n : ℕ) : ∃ s : Finset α, s.card = n :=
  ⟨(range n).map (natEmbedding α), by 

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u_4
inst✝ : Infinite α
n : ℕ
⊢ card (map (natEmbedding α) (range n)) = n

Next tactic:
rw [card_map, card_range]
/-- See `Infinite.exists_subset_card_eq` for a version that provides an arbitrary
`s : Finset α` for any cardinality. -/
theorem exists_superset_card_eq [Infinite α] (s : Finset α) (n : ℕ) (hn : s.card ≤ n) :
    ∃ t : Finset α, s ⊆ t ∧ t.card = n := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Infinite α
s : Finset α
n : ℕ
hn : card s ≤ n
⊢ ∃ t, s ⊆ t ∧ card t = n

Next tactic:
induction' n with n IH generalizing s
/-- See `Infinite.exists_subset_card_eq` for a version that provides an arbitrary
`s : Finset α` for any cardinality. -/
theorem exists_superset_card_eq [Infinite α] (s : Finset α) (n : ℕ) (hn : s.card ≤ n) :
    ∃ t : Finset α, s ⊆ t ∧ t.card = n := by
  induction' n with n IH generalizing s
  · 

Proof state:
case zero
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Infinite α
s : Finset α
hn : card s ≤ zero
⊢ ∃ t, s ⊆ t ∧ card t = zero

Next tactic:
exact ⟨s, subset_refl _, Nat.eq_zero_of_le_zero hn⟩
/-- See `Infinite.exists_subset_card_eq` for a version that provides an arbitrary
`s : Finset α` for any cardinality. -/
theorem exists_superset_card_eq [Infinite α] (s : Finset α) (n : ℕ) (hn : s.card ≤ n) :
    ∃ t : Finset α, s ⊆ t ∧ t.card = n := by
  induction' n with n IH generalizing s
  · exact ⟨s, subset_refl _, Nat.eq_zero_of_le_zero hn⟩
  · 

Proof state:
case succ
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Infinite α
n : ℕ
IH : ∀ (s : Finset α), card s ≤ n → ∃ t, s ⊆ t ∧ card t = n
s : Finset α
hn : card s ≤ succ n
⊢ ∃ t, s ⊆ t ∧ card t = succ n

Next tactic:
rcases hn.eq_or_lt with hn' | hn'
/-- See `Infinite.exists_subset_card_eq` for a version that provides an arbitrary
`s : Finset α` for any cardinality. -/
theorem exists_superset_card_eq [Infinite α] (s : Finset α) (n : ℕ) (hn : s.card ≤ n) :
    ∃ t : Finset α, s ⊆ t ∧ t.card = n := by
  induction' n with n IH generalizing s
  · exact ⟨s, subset_refl _, Nat.eq_zero_of_le_zero hn⟩
  · rcases hn.eq_or_lt with hn' | hn'
    · 

Proof state:
case succ.inl
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Infinite α
n : ℕ
IH : ∀ (s : Finset α), card s ≤ n → ∃ t, s ⊆ t ∧ card t = n
s : Finset α
hn : card s ≤ succ n
hn' : card s = succ n
⊢ ∃ t, s ⊆ t ∧ card t = succ n

Next tactic:
exact ⟨s, subset_refl _, hn'⟩
/-- See `Infinite.exists_subset_card_eq` for a version that provides an arbitrary
`s : Finset α` for any cardinality. -/
theorem exists_superset_card_eq [Infinite α] (s : Finset α) (n : ℕ) (hn : s.card ≤ n) :
    ∃ t : Finset α, s ⊆ t ∧ t.card = n := by
  induction' n with n IH generalizing s
  · exact ⟨s, subset_refl _, Nat.eq_zero_of_le_zero hn⟩
  · rcases hn.eq_or_lt with hn' | hn'
    · exact ⟨s, subset_refl _, hn'⟩
    

Proof state:
case succ.inr
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Infinite α
n : ℕ
IH : ∀ (s : Finset α), card s ≤ n → ∃ t, s ⊆ t ∧ card t = n
s : Finset α
hn : card s ≤ succ n
hn' : card s < succ n
⊢ ∃ t, s ⊆ t ∧ card t = succ n

Next tactic:
obtain ⟨t, hs, ht⟩ := IH _ (Nat.le_of_lt_succ hn')
/-- See `Infinite.exists_subset_card_eq` for a version that provides an arbitrary
`s : Finset α` for any cardinality. -/
theorem exists_superset_card_eq [Infinite α] (s : Finset α) (n : ℕ) (hn : s.card ≤ n) :
    ∃ t : Finset α, s ⊆ t ∧ t.card = n := by
  induction' n with n IH generalizing s
  · exact ⟨s, subset_refl _, Nat.eq_zero_of_le_zero hn⟩
  · rcases hn.eq_or_lt with hn' | hn'
    · exact ⟨s, subset_refl _, hn'⟩
    obtain ⟨t, hs, ht⟩ := IH _ (Nat.le_of_lt_succ hn')
    

Proof state:
case succ.inr.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Infinite α
n : ℕ
IH : ∀ (s : Finset α), card s ≤ n → ∃ t, s ⊆ t ∧ card t = n
s : Finset α
hn : card s ≤ succ n
hn' : card s < succ n
t : Finset α
hs : s ⊆ t
ht : card t = n
⊢ ∃ t, s ⊆ t ∧ card t = succ n

Next tactic:
obtain ⟨x, hx⟩ := exists_not_mem_finset t