l3lab/ntp-mathlib huggingface dataset:
theorem two_lt_card_iff : 2 < s.card ↔ ∃ a b c, a ∈ s ∧ b ∈ s ∧ c ∈ s ∧ a ≠ b ∧ a ≠ c ∧ b ≠ c := by
  classical
    refine' ⟨fun h => _, _⟩
    · obtain ⟨c, hc⟩ := card_pos.mp (pos_of_gt h)
      have : 1 < (s.erase c).card := by rwa [← add_lt_add_iff_right 1, card_erase_add_one hc]
      obtain ⟨a, b, ha, hb, hab⟩ := one_lt_card_iff.mp this
      

Proof state:
case refine'_1.intro.intro.intro.intro.intro
α : Type u_1
β : Type u_2
s t : Finset α
f : α → β
n : ℕ
h : 2 < card s
c : α
hc : c ∈ s
this : 1 < card (erase s c)
a b : α
ha : a ∈ erase s c
hb : b ∈ erase s c
hab : a ≠ b
⊢ ∃ a b c, a ∈ s ∧ b ∈ s ∧ c ∈ s ∧ a ≠ b ∧ a ≠ c ∧ b ≠ c

Next tactic:
exact
        ⟨a, b, c, mem_of_mem_erase ha, mem_of_mem_erase hb, hc, hab, ne_of_mem_erase ha,
          ne_of_mem_erase hb⟩
theorem two_lt_card_iff : 2 < s.card ↔ ∃ a b c, a ∈ s ∧ b ∈ s ∧ c ∈ s ∧ a ≠ b ∧ a ≠ c ∧ b ≠ c := by
  classical
    refine' ⟨fun h => _, _⟩
    · obtain ⟨c, hc⟩ := card_pos.mp (pos_of_gt h)
      have : 1 < (s.erase c).card := by rwa [← add_lt_add_iff_right 1, card_erase_add_one hc]
      obtain ⟨a, b, ha, hb, hab⟩ := one_lt_card_iff.mp this
      exact
        ⟨a, b, c, mem_of_mem_erase ha, mem_of_mem_erase hb, hc, hab, ne_of_mem_erase ha,
          ne_of_mem_erase hb⟩
    · 

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
s t : Finset α
f : α → β
n : ℕ
⊢ (∃ a b c, a ∈ s ∧ b ∈ s ∧ c ∈ s ∧ a ≠ b ∧ a ≠ c ∧ b ≠ c) → 2 < card s

Next tactic:
rintro ⟨a, b, c, ha, hb, hc, hab, hac, hbc⟩
theorem two_lt_card_iff : 2 < s.card ↔ ∃ a b c, a ∈ s ∧ b ∈ s ∧ c ∈ s ∧ a ≠ b ∧ a ≠ c ∧ b ≠ c := by
  classical
    refine' ⟨fun h => _, _⟩
    · obtain ⟨c, hc⟩ := card_pos.mp (pos_of_gt h)
      have : 1 < (s.erase c).card := by rwa [← add_lt_add_iff_right 1, card_erase_add_one hc]
      obtain ⟨a, b, ha, hb, hab⟩ := one_lt_card_iff.mp this
      exact
        ⟨a, b, c, mem_of_mem_erase ha, mem_of_mem_erase hb, hc, hab, ne_of_mem_erase ha,
          ne_of_mem_erase hb⟩
    · rintro ⟨a, b, c, ha, hb, hc, hab, hac, hbc⟩
      

Proof state:
case refine'_2.intro.intro.intro.intro.intro.intro.intro.intro
α : Type u_1
β : Type u_2
s t : Finset α
f : α → β
n : ℕ
a b c : α
ha : a ∈ s
hb : b ∈ s
hc : c ∈ s
hab : a ≠ b
hac : a ≠ c
hbc : b ≠ c
⊢ 2 < card s

Next tactic:
rw [← card_erase_add_one hc, ← card_erase_add_one (mem_erase_of_ne_of_mem hbc hb), ←
        card_erase_add_one (mem_erase_of_ne_of_mem hab (mem_erase_of_ne_of_mem hac ha))]
theorem two_lt_card_iff : 2 < s.card ↔ ∃ a b c, a ∈ s ∧ b ∈ s ∧ c ∈ s ∧ a ≠ b ∧ a ≠ c ∧ b ≠ c := by
  classical
    refine' ⟨fun h => _, _⟩
    · obtain ⟨c, hc⟩ := card_pos.mp (pos_of_gt h)
      have : 1 < (s.erase c).card := by rwa [← add_lt_add_iff_right 1, card_erase_add_one hc]
      obtain ⟨a, b, ha, hb, hab⟩ := one_lt_card_iff.mp this
      exact
        ⟨a, b, c, mem_of_mem_erase ha, mem_of_mem_erase hb, hc, hab, ne_of_mem_erase ha,
          ne_of_mem_erase hb⟩
    · rintro ⟨a, b, c, ha, hb, hc, hab, hac, hbc⟩
      rw [← card_erase_add_one hc, ← card_erase_add_one (mem_erase_of_ne_of_mem hbc hb), ←
        card_erase_add_one (mem_erase_of_ne_of_mem hab (mem_erase_of_ne_of_mem hac ha))]
      

Proof state:
case refine'_2.intro.intro.intro.intro.intro.intro.intro.intro
α : Type u_1
β : Type u_2
s t : Finset α
f : α → β
n : ℕ
a b c : α
ha : a ∈ s
hb : b ∈ s
hc : c ∈ s
hab : a ≠ b
hac : a ≠ c
hbc : b ≠ c
⊢ 2 < card (erase (erase (erase s c) b) a) + 1 + 1 + 1

Next tactic:
apply Nat.le_add_left
theorem two_lt_card : 2 < s.card ↔ ∃ a ∈ s, ∃ b ∈ s, ∃ c ∈ s, a ≠ b ∧ a ≠ c ∧ b ≠ c := by
  

Proof state:
α : Type u_1
β : Type u_2
s t : Finset α
f : α → β
n : ℕ
⊢ 2 < card s ↔ ∃ a ∈ s, ∃ b ∈ s, ∃ c ∈ s, a ≠ b ∧ a ≠ c ∧ b ≠ c

Next tactic:
simp_rw [two_lt_card_iff, exists_and_left]
theorem exists_ne_of_one_lt_card (hs : 1 < s.card) (a : α) : ∃ b, b ∈ s ∧ b ≠ a := by
  

Proof state:
α : Type u_1
β : Type u_2
s t : Finset α
f : α → β
n : ℕ
hs : 1 < card s
a : α
⊢ ∃ b ∈ s, b ≠ a

Next tactic:
obtain ⟨x, hx, y, hy, hxy⟩ := Finset.one_lt_card.mp hs
theorem exists_ne_of_one_lt_card (hs : 1 < s.card) (a : α) : ∃ b, b ∈ s ∧ b ≠ a := by
  obtain ⟨x, hx, y, hy, hxy⟩ := Finset.one_lt_card.mp hs
  

Proof state:
case intro.intro.intro.intro
α : Type u_1
β : Type u_2
s t : Finset α
f : α → β
n : ℕ
hs : 1 < card s
a x : α
hx : x ∈ s
y : α
hy : y ∈ s
hxy : x ≠ y
⊢ ∃ b ∈ s, b ≠ a

Next tactic:
by_cases ha : y = a
theorem exists_ne_of_one_lt_card (hs : 1 < s.card) (a : α) : ∃ b, b ∈ s ∧ b ≠ a := by
  obtain ⟨x, hx, y, hy, hxy⟩ := Finset.one_lt_card.mp hs
  by_cases ha : y = a
  · 

Proof state:
case pos
α : Type u_1
β : Type u_2
s t : Finset α
f : α → β
n : ℕ
hs : 1 < card s
a x : α
hx : x ∈ s
y : α
hy : y ∈ s
hxy : x ≠ y
ha : y = a
⊢ ∃ b ∈ s, b ≠ a

Next tactic:
exact ⟨x, hx, ne_of_ne_of_eq hxy ha⟩
theorem exists_ne_of_one_lt_card (hs : 1 < s.card) (a : α) : ∃ b, b ∈ s ∧ b ≠ a := by
  obtain ⟨x, hx, y, hy, hxy⟩ := Finset.one_lt_card.mp hs
  by_cases ha : y = a
  · exact ⟨x, hx, ne_of_ne_of_eq hxy ha⟩
  · 

Proof state:
case neg
α : Type u_1
β : Type u_2
s t : Finset α
f : α → β
n : ℕ
hs : 1 < card s
a x : α
hx : x ∈ s
y : α
hy : y ∈ s
hxy : x ≠ y
ha : ¬y = a
⊢ ∃ b ∈ s, b ≠ a

Next tactic:
exact ⟨y, hy, ha⟩
/-- If a Finset in a Pi type is nontrivial (has at least two elements), then
  its projection to some factor is nontrivial, and the fibers of the projection
  are proper subsets. -/
lemma exists_of_one_lt_card_pi {ι : Type*} {α : ι → Type*} [∀ i, DecidableEq (α i)]
    {s : Finset (∀ i, α i)} (h : 1 < s.card) :
    ∃ i, 1 < (s.image (· i)).card ∧ ∀ ai, s.filter (· i = ai) ⊂ s := by
  

Proof state:
α✝ : Type u_1
β : Type u_2
s✝ t : Finset α✝
f : α✝ → β
n : ℕ
ι : Type u_3
α : ι → Type u_4
inst✝ : (i : ι) → DecidableEq (α i)
s : Finset ((i : ι) → α i)
h : 1 < card s
⊢ ∃ i, 1 < card (image (fun x => x i) s) ∧ ∀ (ai : α i), filter (fun x => x i = ai) s ⊂ s

Next tactic:
simp_rw [one_lt_card_iff, Function.ne_iff] at h ⊢
/-- If a Finset in a Pi type is nontrivial (has at least two elements), then
  its projection to some factor is nontrivial, and the fibers of the projection
  are proper subsets. -/
lemma exists_of_one_lt_card_pi {ι : Type*} {α : ι → Type*} [∀ i, DecidableEq (α i)]
    {s : Finset (∀ i, α i)} (h : 1 < s.card) :
    ∃ i, 1 < (s.image (· i)).card ∧ ∀ ai, s.filter (· i = ai) ⊂ s := by
  simp_rw [one_lt_card_iff, Function.ne_iff] at h ⊢
  

Proof state:
α✝ : Type u_1
β : Type u_2
s✝ t : Finset α✝
f : α✝ → β
n : ℕ
ι : Type u_3
α : ι → Type u_4
inst✝ : (i : ι) → DecidableEq (α i)
s : Finset ((i : ι) → α i)
h : ∃ a b, a ∈ s ∧ b ∈ s ∧ ∃ a_1, a a_1 ≠ b a_1
⊢ ∃ i,
    (∃ a b, a ∈ image (fun x => x i) s ∧ b ∈ image (fun x => x i) s ∧ a ≠ b) ∧
      ∀ (ai : α i), filter (fun x => x i = ai) s ⊂ s

Next tactic:
obtain ⟨a1, a2, h1, h2, i, hne⟩ := h
/-- If a Finset in a Pi type is nontrivial (has at least two elements), then
  its projection to some factor is nontrivial, and the fibers of the projection
  are proper subsets. -/
lemma exists_of_one_lt_card_pi {ι : Type*} {α : ι → Type*} [∀ i, DecidableEq (α i)]
    {s : Finset (∀ i, α i)} (h : 1 < s.card) :
    ∃ i, 1 < (s.image (· i)).card ∧ ∀ ai, s.filter (· i = ai) ⊂ s := by
  simp_rw [one_lt_card_iff, Function.ne_iff] at h ⊢
  obtain ⟨a1, a2, h1, h2, i, hne⟩ := h
  

Proof state:
case intro.intro.intro.intro.intro
α✝ : Type u_1
β : Type u_2
s✝ t : Finset α✝
f : α✝ → β
n : ℕ
ι : Type u_3
α : ι → Type u_4
inst✝ : (i : ι) → DecidableEq (α i)
s : Finset ((i : ι) → α i)
a1 a2 : (i : ι) → α i
h1 : a1 ∈ s
h2 : a2 ∈ s
i : ι
hne : a1 i ≠ a2 i
⊢ ∃ i,
    (∃ a b, a ∈ image (fun x => x i) s ∧ b ∈ image (fun x => x i) s ∧ a ≠ b) ∧
      ∀ (ai : α i), filter (fun x => x i = ai) s ⊂ s

Next tactic:
refine ⟨i, ⟨_, _, mem_image_of_mem _ h1, mem_image_of_mem _ h2, hne⟩, fun ai => ?_⟩
/-- If a Finset in a Pi type is nontrivial (has at least two elements), then
  its projection to some factor is nontrivial, and the fibers of the projection
  are proper subsets. -/
lemma exists_of_one_lt_card_pi {ι : Type*} {α : ι → Type*} [∀ i, DecidableEq (α i)]
    {s : Finset (∀ i, α i)} (h : 1 < s.card) :
    ∃ i, 1 < (s.image (· i)).card ∧ ∀ ai, s.filter (· i = ai) ⊂ s := by
  simp_rw [one_lt_card_iff, Function.ne_iff] at h ⊢
  obtain ⟨a1, a2, h1, h2, i, hne⟩ := h
  refine ⟨i, ⟨_, _, mem_image_of_mem _ h1, mem_image_of_mem _ h2, hne⟩, fun ai => ?_⟩
  

Proof state:
case intro.intro.intro.intro.intro
α✝ : Type u_1
β : Type u_2
s✝ t : Finset α✝
f : α✝ → β
n : ℕ
ι : Type u_3
α : ι → Type u_4
inst✝ : (i : ι) → DecidableEq (α i)
s : Finset ((i : ι) → α i)
a1 a2 : (i : ι) → α i
h1 : a1 ∈ s
h2 : a2 ∈ s
i : ι
hne : a1 i ≠ a2 i
ai : α i
⊢ filter (fun x => x i = ai) s ⊂ s

Next tactic:
rw [filter_ssubset]
/-- If a Finset in a Pi type is nontrivial (has at least two elements), then
  its projection to some factor is nontrivial, and the fibers of the projection
  are proper subsets. -/
lemma exists_of_one_lt_card_pi {ι : Type*} {α : ι → Type*} [∀ i, DecidableEq (α i)]
    {s : Finset (∀ i, α i)} (h : 1 < s.card) :
    ∃ i, 1 < (s.image (· i)).card ∧ ∀ ai, s.filter (· i = ai) ⊂ s := by
  simp_rw [one_lt_card_iff, Function.ne_iff] at h ⊢
  obtain ⟨a1, a2, h1, h2, i, hne⟩ := h
  refine ⟨i, ⟨_, _, mem_image_of_mem _ h1, mem_image_of_mem _ h2, hne⟩, fun ai => ?_⟩
  rw [filter_ssubset]
  

Proof state:
case intro.intro.intro.intro.intro
α✝ : Type u_1
β : Type u_2
s✝ t : Finset α✝
f : α✝ → β
n : ℕ
ι : Type u_3
α : ι → Type u_4
inst✝ : (i : ι) → DecidableEq (α i)
s : Finset ((i : ι) → α i)
a1 a2 : (i : ι) → α i
h1 : a1 ∈ s
h2 : a2 ∈ s
i : ι
hne : a1 i ≠ a2 i
ai : α i
⊢ ∃ x ∈ s, ¬x i = ai

Next tactic:
obtain rfl | hne := eq_or_ne (a2 i) ai
/-- If a Finset in a Pi type is nontrivial (has at least two elements), then
  its projection to some factor is nontrivial, and the fibers of the projection
  are proper subsets. -/
lemma exists_of_one_lt_card_pi {ι : Type*} {α : ι → Type*} [∀ i, DecidableEq (α i)]
    {s : Finset (∀ i, α i)} (h : 1 < s.card) :
    ∃ i, 1 < (s.image (· i)).card ∧ ∀ ai, s.filter (· i = ai) ⊂ s := by
  simp_rw [one_lt_card_iff, Function.ne_iff] at h ⊢
  obtain ⟨a1, a2, h1, h2, i, hne⟩ := h
  refine ⟨i, ⟨_, _, mem_image_of_mem _ h1, mem_image_of_mem _ h2, hne⟩, fun ai => ?_⟩
  rw [filter_ssubset]
  obtain rfl | hne := eq_or_ne (a2 i) ai
  

Proof state:
case intro.intro.intro.intro.intro.inl
α✝ : Type u_1
β : Type u_2
s✝ t : Finset α✝
f : α✝ → β
n : ℕ
ι : Type u_3
α : ι → Type u_4
inst✝ : (i : ι) → DecidableEq (α i)
s : Finset ((i : ι) → α i)
a1 a2 : (i : ι) → α i
h1 : a1 ∈ s
h2 : a2 ∈ s
i : ι
hne : a1 i ≠ a2 i
⊢ ∃ x ∈ s, ¬x i = a2 i
case intro.intro.intro.intro.intro.inr
α✝ : Type u_1
β : Type u_2
s✝ t : Finset α✝
f : α✝ → β
n : ℕ
ι : Type u_3
α : ι → Type u_4
inst✝ : (i : ι) → DecidableEq (α i)
s : Finset ((i : ι) → α i)
a1 a2 : (i : ι) → α i
h1 : a1 ∈ s
h2 : a2 ∈ s
i : ι
hne✝ : a1 i ≠ a2 i
ai : α i
hne : a2 i ≠ ai
⊢ ∃ x ∈ s, ¬x i = ai

Next tactic:
exacts [⟨a1, h1, hne⟩, ⟨a2, h2, hne⟩]
theorem card_eq_succ : s.card = n + 1 ↔ ∃ a t, a ∉ t ∧ insert a t = s ∧ t.card = n :=
  ⟨fun h =>
    let ⟨a, has⟩ := card_pos.mp (h.symm ▸ Nat.zero_lt_succ _ : 0 < s.card)
    ⟨a, s.erase a, s.not_mem_erase a, insert_erase has, by
      

Proof state:
α : Type u_1
β : Type u_2
s t : Finset α
f : α → β
n : ℕ
inst✝ : DecidableEq α
h : card s = n + 1
a : α
has : a ∈ s
⊢ card (erase s a) = n

Next tactic:
simp only [h, card_erase_of_mem has, add_tsub_cancel_right]
theorem card_eq_two : s.card = 2 ↔ ∃ x y, x ≠ y ∧ s = {x, y} := by
  

Proof state:
α : Type u_1
β : Type u_2
s t : Finset α
f : α → β
n : ℕ
inst✝ : DecidableEq α
⊢ card s = 2 ↔ ∃ x y, x ≠ y ∧ s = {x, y}

Next tactic:
constructor
theorem card_eq_two : s.card = 2 ↔ ∃ x y, x ≠ y ∧ s = {x, y} := by
  constructor
  · 

Proof state:
case mp
α : Type u_1
β : Type u_2
s t : Finset α
f : α → β
n : ℕ
inst✝ : DecidableEq α
⊢ card s = 2 → ∃ x y, x ≠ y ∧ s = {x, y}

Next tactic:
rw [card_eq_succ]
theorem card_eq_two : s.card = 2 ↔ ∃ x y, x ≠ y ∧ s = {x, y} := by
  constructor
  · rw [card_eq_succ]
    

Proof state:
case mp
α : Type u_1
β : Type u_2
s t : Finset α
f : α → β
n : ℕ
inst✝ : DecidableEq α
⊢ (∃ a t, a ∉ t ∧ insert a t = s ∧ card t = 1) → ∃ x y, x ≠ y ∧ s = {x, y}

Next tactic:
simp_rw [card_eq_one]
theorem card_eq_two : s.card = 2 ↔ ∃ x y, x ≠ y ∧ s = {x, y} := by
  constructor
  · rw [card_eq_succ]
    simp_rw [card_eq_one]
    

Proof state:
case mp
α : Type u_1
β : Type u_2
s t : Finset α
f : α → β
n : ℕ
inst✝ : DecidableEq α
⊢ (∃ a t, a ∉ t ∧ insert a t = s ∧ ∃ a, t = {a}) → ∃ x y, x ≠ y ∧ s = {x, y}

Next tactic:
rintro ⟨a, _, hab, rfl, b, rfl⟩
theorem card_eq_two : s.card = 2 ↔ ∃ x y, x ≠ y ∧ s = {x, y} := by
  constructor
  · rw [card_eq_succ]
    simp_rw [card_eq_one]
    rintro ⟨a, _, hab, rfl, b, rfl⟩
    

Proof state:
case mp.intro.intro.intro.intro.intro
α : Type u_1
β : Type u_2
t : Finset α
f : α → β
n : ℕ
inst✝ : DecidableEq α
a b : α
hab : a ∉ {b}
⊢ ∃ x y, x ≠ y ∧ {a, b} = {x, y}

Next tactic:
exact ⟨a, b, not_mem_singleton.1 hab, rfl⟩
theorem card_eq_two : s.card = 2 ↔ ∃ x y, x ≠ y ∧ s = {x, y} := by
  constructor
  · rw [card_eq_succ]
    simp_rw [card_eq_one]
    rintro ⟨a, _, hab, rfl, b, rfl⟩
    exact ⟨a, b, not_mem_singleton.1 hab, rfl⟩
  · 

Proof state:
case mpr
α : Type u_1
β : Type u_2
s t : Finset α
f : α → β
n : ℕ
inst✝ : DecidableEq α
⊢ (∃ x y, x ≠ y ∧ s = {x, y}) → card s = 2

Next tactic:
rintro ⟨x, y, h, rfl⟩
theorem card_eq_two : s.card = 2 ↔ ∃ x y, x ≠ y ∧ s = {x, y} := by
  constructor
  · rw [card_eq_succ]
    simp_rw [card_eq_one]
    rintro ⟨a, _, hab, rfl, b, rfl⟩
    exact ⟨a, b, not_mem_singleton.1 hab, rfl⟩
  · rintro ⟨x, y, h, rfl⟩
    

Proof state:
case mpr.intro.intro.intro
α : Type u_1
β : Type u_2
t : Finset α
f : α → β
n : ℕ
inst✝ : DecidableEq α
x y : α
h : x ≠ y
⊢ card {x, y} = 2

Next tactic:
exact card_doubleton h
theorem card_eq_three : s.card = 3 ↔ ∃ x y z, x ≠ y ∧ x ≠ z ∧ y ≠ z ∧ s = {x, y, z} := by
  

Proof state:
α : Type u_1
β : Type u_2
s t : Finset α
f : α → β
n : ℕ
inst✝ : DecidableEq α
⊢ card s = 3 ↔ ∃ x y z, x ≠ y ∧ x ≠ z ∧ y ≠ z ∧ s = {x, y, z}

Next tactic:
constructor
theorem card_eq_three : s.card = 3 ↔ ∃ x y z, x ≠ y ∧ x ≠ z ∧ y ≠ z ∧ s = {x, y, z} := by
  constructor
  · 

Proof state:
case mp
α : Type u_1
β : Type u_2
s t : Finset α
f : α → β
n : ℕ
inst✝ : DecidableEq α
⊢ card s = 3 → ∃ x y z, x ≠ y ∧ x ≠ z ∧ y ≠ z ∧ s = {x, y, z}

Next tactic:
rw [card_eq_succ]
theorem card_eq_three : s.card = 3 ↔ ∃ x y z, x ≠ y ∧ x ≠ z ∧ y ≠ z ∧ s = {x, y, z} := by
  constructor
  · rw [card_eq_succ]
    

Proof state:
case mp
α : Type u_1
β : Type u_2
s t : Finset α
f : α → β
n : ℕ
inst✝ : DecidableEq α
⊢ (∃ a t, a ∉ t ∧ insert a t = s ∧ card t = 2) → ∃ x y z, x ≠ y ∧ x ≠ z ∧ y ≠ z ∧ s = {x, y, z}

Next tactic:
simp_rw [card_eq_two]
theorem card_eq_three : s.card = 3 ↔ ∃ x y z, x ≠ y ∧ x ≠ z ∧ y ≠ z ∧ s = {x, y, z} := by
  constructor
  · rw [card_eq_succ]
    simp_rw [card_eq_two]
    

Proof state:
case mp
α : Type u_1
β : Type u_2
s t : Finset α
f : α → β
n : ℕ
inst✝ : DecidableEq α
⊢ (∃ a t, a ∉ t ∧ insert a t = s ∧ ∃ x y, x ≠ y ∧ t = {x, y}) → ∃ x y z, x ≠ y ∧ x ≠ z ∧ y ≠ z ∧ s = {x, y, z}

Next tactic:
rintro ⟨a, _, abc, rfl, b, c, bc, rfl⟩
theorem card_eq_three : s.card = 3 ↔ ∃ x y z, x ≠ y ∧ x ≠ z ∧ y ≠ z ∧ s = {x, y, z} := by
  constructor
  · rw [card_eq_succ]
    simp_rw [card_eq_two]
    rintro ⟨a, _, abc, rfl, b, c, bc, rfl⟩
    

Proof state:
case mp.intro.intro.intro.intro.intro.intro.intro
α : Type u_1
β : Type u_2
t : Finset α
f : α → β
n : ℕ
inst✝ : DecidableEq α
a b c : α
bc : b ≠ c
abc : a ∉ {b, c}
⊢ ∃ x y z, x ≠ y ∧ x ≠ z ∧ y ≠ z ∧ {a, b, c} = {x, y, z}

Next tactic:
rw [mem_insert, mem_singleton, not_or] at abc
theorem card_eq_three : s.card = 3 ↔ ∃ x y z, x ≠ y ∧ x ≠ z ∧ y ≠ z ∧ s = {x, y, z} := by
  constructor
  · rw [card_eq_succ]
    simp_rw [card_eq_two]
    rintro ⟨a, _, abc, rfl, b, c, bc, rfl⟩
    rw [mem_insert, mem_singleton, not_or] at abc
    

Proof state:
case mp.intro.intro.intro.intro.intro.intro.intro
α : Type u_1
β : Type u_2
t : Finset α
f : α → β
n : ℕ
inst✝ : DecidableEq α
a b c : α
bc : b ≠ c
abc : ¬a = b ∧ ¬a = c
⊢ ∃ x y z, x ≠ y ∧ x ≠ z ∧ y ≠ z ∧ {a, b, c} = {x, y, z}

Next tactic:
exact ⟨a, b, c, abc.1, abc.2, bc, rfl⟩
theorem card_eq_three : s.card = 3 ↔ ∃ x y z, x ≠ y ∧ x ≠ z ∧ y ≠ z ∧ s = {x, y, z} := by
  constructor
  · rw [card_eq_succ]
    simp_rw [card_eq_two]
    rintro ⟨a, _, abc, rfl, b, c, bc, rfl⟩
    rw [mem_insert, mem_singleton, not_or] at abc
    exact ⟨a, b, c, abc.1, abc.2, bc, rfl⟩
  · 

Proof state:
case mpr
α : Type u_1
β : Type u_2
s t : Finset α
f : α → β
n : ℕ
inst✝ : DecidableEq α
⊢ (∃ x y z, x ≠ y ∧ x ≠ z ∧ y ≠ z ∧ s = {x, y, z}) → card s = 3

Next tactic:
rintro ⟨x, y, z, xy, xz, yz, rfl⟩
theorem card_eq_three : s.card = 3 ↔ ∃ x y z, x ≠ y ∧ x ≠ z ∧ y ≠ z ∧ s = {x, y, z} := by
  constructor
  · rw [card_eq_succ]
    simp_rw [card_eq_two]
    rintro ⟨a, _, abc, rfl, b, c, bc, rfl⟩
    rw [mem_insert, mem_singleton, not_or] at abc
    exact ⟨a, b, c, abc.1, abc.2, bc, rfl⟩
  · rintro ⟨x, y, z, xy, xz, yz, rfl⟩
    

Proof state:
case mpr.intro.intro.intro.intro.intro.intro
α : Type u_1
β : Type u_2
t : Finset α
f : α → β
n : ℕ
inst✝ : DecidableEq α
x y z : α
xy : x ≠ y
xz : x ≠ z
yz : y ≠ z
⊢ card {x, y, z} = 3

Next tactic:
simp only [xy, xz, yz, mem_insert, card_insert_of_not_mem, not_false_iff, mem_singleton,
      or_self_iff, card_singleton]
@[nolint unusedHavesSuffices] --Porting note: false positive
theorem strongInduction_eq {p : Finset α → Sort*} (H : ∀ s, (∀ t ⊂ s, p t) → p s)
    (s : Finset α) : strongInduction H s = H s fun t _ => strongInduction H t := by
  

Proof state:
α : Type u_1
β : Type u_2
s✝ t : Finset α
f : α → β
n : ℕ
p : Finset α → Sort u_3
H : (s : Finset α) → ((t : Finset α) → t ⊂ s → p t) → p s
s : Finset α
⊢ strongInduction H s = H s fun t x => strongInduction H t

Next tactic:
rw [strongInduction]
@[nolint unusedHavesSuffices] --Porting note: false positive
theorem strongInductionOn_eq {p : Finset α → Sort*} (s : Finset α)
    (H : ∀ s, (∀ t ⊂ s, p t) → p s) :
    s.strongInductionOn H = H s fun t _ => t.strongInductionOn H := by
  

Proof state:
α : Type u_1
β : Type u_2
s✝ t : Finset α
f : α → β
n : ℕ
p : Finset α → Sort u_3
s : Finset α
H : (s : Finset α) → ((t : Finset α) → t ⊂ s → p t) → p s
⊢ strongInductionOn s H = H s fun t x => strongInductionOn t H

Next tactic:
dsimp only [strongInductionOn]
@[nolint unusedHavesSuffices] --Porting note: false positive
theorem strongInductionOn_eq {p : Finset α → Sort*} (s : Finset α)
    (H : ∀ s, (∀ t ⊂ s, p t) → p s) :
    s.strongInductionOn H = H s fun t _ => t.strongInductionOn H := by
  dsimp only [strongInductionOn]
  

Proof state:
α : Type u_1
β : Type u_2
s✝ t : Finset α
f : α → β
n : ℕ
p : Finset α → Sort u_3
s : Finset α
H : (s : Finset α) → ((t : Finset α) → t ⊂ s → p t) → p s
⊢ strongInduction H s = H s fun t x => strongInduction H t

Next tactic:
rw [strongInduction]
@[nolint unusedHavesSuffices] --Porting note: false positive
theorem strongDownwardInduction_eq {p : Finset α → Sort*}
    (H : ∀ t₁, (∀ {t₂ : Finset α}, t₂.card ≤ n → t₁ ⊂ t₂ → p t₂) → t₁.card ≤ n → p t₁)
    (s : Finset α) :
    strongDownwardInduction H s = H s fun {t} ht _ => strongDownwardInduction H t ht := by
  

Proof state:
α : Type u_1
β : Type u_2
s✝ t : Finset α
f : α → β
n : ℕ
p : Finset α → Sort u_3
H : (t₁ : Finset α) → ({t₂ : Finset α} → card t₂ ≤ n → t₁ ⊂ t₂ → p t₂) → card t₁ ≤ n → p t₁
s : Finset α
⊢ strongDownwardInduction H s = H s fun {t} ht x => strongDownwardInduction H t ht

Next tactic:
rw [strongDownwardInduction]
@[nolint unusedHavesSuffices] --Porting note: false positive
theorem strongDownwardInductionOn_eq {p : Finset α → Sort*} (s : Finset α)
    (H : ∀ t₁, (∀ {t₂ : Finset α}, t₂.card ≤ n → t₁ ⊂ t₂ → p t₂) → t₁.card ≤ n → p t₁) :
    s.strongDownwardInductionOn H = H s fun {t} ht _ => t.strongDownwardInductionOn H ht := by
  

Proof state:
α : Type u_1
β : Type u_2
s✝ t : Finset α
f : α → β
n : ℕ
p : Finset α → Sort u_3
s : Finset α
H : (t₁ : Finset α) → ({t₂ : Finset α} → card t₂ ≤ n → t₁ ⊂ t₂ → p t₂) → card t₁ ≤ n → p t₁
⊢ (fun a => strongDownwardInductionOn s H a) = H s fun {t} ht x => strongDownwardInductionOn t H ht

Next tactic:
dsimp only [strongDownwardInductionOn]
@[nolint unusedHavesSuffices] --Porting note: false positive
theorem strongDownwardInductionOn_eq {p : Finset α → Sort*} (s : Finset α)
    (H : ∀ t₁, (∀ {t₂ : Finset α}, t₂.card ≤ n → t₁ ⊂ t₂ → p t₂) → t₁.card ≤ n → p t₁) :
    s.strongDownwardInductionOn H = H s fun {t} ht _ => t.strongDownwardInductionOn H ht := by
  dsimp only [strongDownwardInductionOn]
  

Proof state:
α : Type u_1
β : Type u_2
s✝ t : Finset α
f : α → β
n : ℕ
p : Finset α → Sort u_3
s : Finset α
H : (t₁ : Finset α) → ({t₂ : Finset α} → card t₂ ≤ n → t₁ ⊂ t₂ → p t₂) → card t₁ ≤ n → p t₁
⊢ (fun a => strongDownwardInduction H s a) = H s fun {t} ht x => strongDownwardInduction H t ht

Next tactic:
rw [strongDownwardInduction]
@[to_additive (attr := simp)]
protected theorem SemiconjBy.map [MulHomClass F M N] (h : SemiconjBy a x y) (f : F) :
    SemiconjBy (f a) (f x) (f y) := by 

Proof state:
F : Type u_1
M : Type u_2
N : Type u_3
inst✝² : Mul M
inst✝¹ : Mul N
a x y : M
inst✝ : MulHomClass F M N
h : SemiconjBy a x y
f : F
⊢ SemiconjBy (f a) (f x) (f y)

Next tactic:
simpa only [SemiconjBy, map_mul] using congr_arg f h
@[to_additive (attr := simp)]
protected theorem SemiconjBy.of_map [MulHomClass F M N] (f : F) (hf : Function.Injective f)
    (h : SemiconjBy (f a) (f x) (f y)) : SemiconjBy a x y :=
  hf (by 

Proof state:
F : Type u_1
M : Type u_2
N : Type u_3
inst✝² : Mul M
inst✝¹ : Mul N
a x y : M
inst✝ : MulHomClass F M N
f : F
hf : Function.Injective ⇑f
h : SemiconjBy (f a) (f x) (f y)
⊢ f (a * x) = f (y * a)

Next tactic:
simpa only [SemiconjBy, map_mul] using h
@[to_additive (attr := simp)]
theorem Commute.of_map [MulHomClass F M N] {f : F} (hf : Function.Injective f)
    (h : Commute (f x) (f y)) : Commute x y :=
  hf (by 

Proof state:
F : Type u_1
M : Type u_2
N : Type u_3
inst✝² : Mul M
inst✝¹ : Mul N
a x y : M
inst✝ : MulHomClass F M N
f : F
hf : Function.Injective ⇑f
h : Commute (f x) (f y)
⊢ f (x * y) = f (y * x)

Next tactic:
simpa only [map_mul] using h.eq
/-- There is exactly one tuple of size zero. -/
example (α : Fin 0 → Sort u) : Unique (∀ i : Fin 0, α i) := by 

Proof state:
m n : ℕ
α : Fin 0 → Sort u
⊢ Unique ((i : Fin 0) → α i)

Next tactic:
infer_instance
@[simp]
theorem tail_cons : tail (cons x p) = p := by
  

Proof state:
m n : ℕ
α : Fin (n + 1) → Type u
x : α 0
q : (i : Fin (n + 1)) → α i
p : (i : Fin n) → α (succ i)
i : Fin n
y : α (succ i)
z : α 0
⊢ tail (cons x p) = p

Next tactic:
simp (config := { unfoldPartialApp := true }) [tail, cons]
@[simp]
theorem cons_succ : cons x p i.succ = p i := by 

Proof state:
m n : ℕ
α : Fin (n + 1) → Type u
x : α 0
q : (i : Fin (n + 1)) → α i
p : (i : Fin n) → α (succ i)
i : Fin n
y : α (succ i)
z : α 0
⊢ cons x p (succ i) = p i

Next tactic:
simp [cons]
@[simp]
theorem cons_zero : cons x p 0 = x := by 

Proof state:
m n : ℕ
α : Fin (n + 1) → Type u
x : α 0
q : (i : Fin (n + 1)) → α i
p : (i : Fin n) → α (succ i)
i : Fin n
y : α (succ i)
z : α 0
⊢ cons x p 0 = x

Next tactic:
simp [cons]
@[simp]
theorem cons_one {α : Fin (n + 2) → Type*} (x : α 0) (p : ∀ i : Fin n.succ, α i.succ) :
    cons x p 1 = p 0 := by
  

Proof state:
m n : ℕ
α✝ : Fin (n + 1) → Type u
x✝ : α✝ 0
q : (i : Fin (n + 1)) → α✝ i
p✝ : (i : Fin n) → α✝ (succ i)
i : Fin n
y : α✝ (succ i)
z : α✝ 0
α : Fin (n + 2) → Type u_1
x : α 0
p : (i : Fin (Nat.succ n)) → α (succ i)
⊢ cons x p 1 = p 0

Next tactic:
rw [← cons_succ x p]
@[simp]
theorem cons_one {α : Fin (n + 2) → Type*} (x : α 0) (p : ∀ i : Fin n.succ, α i.succ) :
    cons x p 1 = p 0 := by
  rw [← cons_succ x p]; 

Proof state:
m n : ℕ
α✝ : Fin (n + 1) → Type u
x✝ : α✝ 0
q : (i : Fin (n + 1)) → α✝ i
p✝ : (i : Fin n) → α✝ (succ i)
i : Fin n
y : α✝ (succ i)
z : α✝ 0
α : Fin (n + 2) → Type u_1
x : α 0
p : (i : Fin (Nat.succ n)) → α (succ i)
⊢ cons x p 1 = cons x p (succ 0)

Next tactic:
rfl
/-- Updating a tuple and adding an element at the beginning commute. -/
@[simp]
theorem cons_update : cons x (update p i y) = update (cons x p) i.succ y := by
  

Proof state:
m n : ℕ
α : Fin (n + 1) → Type u
x : α 0
q : (i : Fin (n + 1)) → α i
p : (i : Fin n) → α (succ i)
i : Fin n
y : α (succ i)
z : α 0
⊢ cons x (update p i y) = update (cons x p) (succ i) y

Next tactic:
ext j