Theorem: List.Nat.nodup_antidiagonalTuple
File: Mathlib/Data/Fin/Tuple/NatAntidiagonal.lean

tactic: induction' k with k ih generalizing n
state_before: k n : ℕ
⊢ Nodup (antidiagonalTuple k n)

tactic: simp_rw [antidiagonalTuple, List.nodup_bind]
state_before: case succ
n✝ k : ℕ
ih : ∀ (n : ℕ), Nodup (antidiagonalTuple k n)
n : ℕ
⊢ Nodup (antidiagonalTuple (Nat.succ k) n)

tactic: constructor
state_before: case succ
n✝ k : ℕ
ih : ∀ (n : ℕ), Nodup (antidiagonalTuple k n)
n : ℕ
⊢ (∀ (x : ℕ × ℕ), x ∈ antidiagonal n → Nodup (map (fun x_1 => Fin.cons x.fst x_1) (antidiagonalTuple k x.snd))) ∧
    Pairwise
      (fun a b =>
        Disjoint (map (fun x => Fin.cons a.fst x) (antidiagonalTuple k a.snd))
          (map (fun x => Fin.cons b.fst x) (antidiagonalTuple k b.snd)))
      (antidiagonal n)

tactic: induction' n with n n_ih
state_before: case succ.right
n✝ k : ℕ
ih : ∀ (n : ℕ), Nodup (antidiagonalTuple k n)
n : ℕ
⊢ Pairwise
    (fun a b =>
      Disjoint (map (fun x => Fin.cons a.fst x) (antidiagonalTuple k a.snd))
        (map (fun x => Fin.cons b.fst x) (antidiagonalTuple k b.snd)))
    (antidiagonal n)

tactic: cases n
state_before: case zero
n✝ n : ℕ
⊢ Nodup (antidiagonalTuple Nat.zero n)

tactic: simp
state_before: case zero.zero
n : ℕ
⊢ Nodup (antidiagonalTuple Nat.zero Nat.zero)

tactic: simp [eq_comm]
state_before: case zero.succ
n n✝ : ℕ
⊢ Nodup (antidiagonalTuple Nat.zero (Nat.succ n✝))

tactic: intro i _
state_before: case succ.left
n✝ k : ℕ
ih : ∀ (n : ℕ), Nodup (antidiagonalTuple k n)
n : ℕ
⊢ ∀ (x : ℕ × ℕ), x ∈ antidiagonal n → Nodup (map (fun x_1 => Fin.cons x.fst x_1) (antidiagonalTuple k x.snd))

tactic: exact (ih i.snd).map (Fin.cons_right_injective (α := fun _ => ℕ) i.fst)
state_before: case succ.left
n✝ k : ℕ
ih : ∀ (n : ℕ), Nodup (antidiagonalTuple k n)
n : ℕ
i : ℕ × ℕ
a✝ : i ∈ antidiagonal n
⊢ Nodup (map (fun x => Fin.cons i.fst x) (antidiagonalTuple k i.snd))

tactic: exact List.pairwise_singleton _ _
state_before: case succ.right.zero
n k : ℕ
ih : ∀ (n : ℕ), Nodup (antidiagonalTuple k n)
⊢ Pairwise
    (fun a b =>
      Disjoint (map (fun x => Fin.cons a.fst x) (antidiagonalTuple k a.snd))
        (map (fun x => Fin.cons b.fst x) (antidiagonalTuple k b.snd)))
    (antidiagonal Nat.zero)

tactic: rw [List.Nat.antidiagonal_succ]
state_before: case succ.right.succ
n✝ k : ℕ
ih : ∀ (n : ℕ), Nodup (antidiagonalTuple k n)
n : ℕ
n_ih :
  Pairwise
    (fun a b =>
      Disjoint (map (fun x => Fin.cons a.fst x) (antidiagonalTuple k a.snd))
        (map (fun x => Fin.cons b.fst x) (antidiagonalTuple k b.snd)))
    (antidiagonal n)
⊢ Pairwise
    (fun a b =>
      Disjoint (map (fun x => Fin.cons a.fst x) (antidiagonalTuple k a.snd))
        (map (fun x => Fin.cons b.fst x) (antidiagonalTuple k b.snd)))
    (antidiagonal (Nat.succ n))

tactic: refine' List.Pairwise.cons (fun a ha x hx₁ hx₂ => _) (n_ih.map _ fun a b h x hx₁ hx₂ => _)
state_before: case succ.right.succ
n✝ k : ℕ
ih : ∀ (n : ℕ), Nodup (antidiagonalTuple k n)
n : ℕ
n_ih :
  Pairwise
    (fun a b =>
      Disjoint (map (fun x => Fin.cons a.fst x) (antidiagonalTuple k a.snd))
        (map (fun x => Fin.cons b.fst x) (antidiagonalTuple k b.snd)))
    (antidiagonal n)
⊢ Pairwise
    (fun a b =>
      Disjoint (map (fun x => Fin.cons a.fst x) (antidiagonalTuple k a.snd))
        (map (fun x => Fin.cons b.fst x) (antidiagonalTuple k b.snd)))
    ((0, n + 1) :: map (Prod.map Nat.succ id) (antidiagonal n))

tactic: rw [List.mem_map] at hx₁ hx₂ ha
state_before: case succ.right.succ.refine'_1
n✝ k : ℕ
ih : ∀ (n : ℕ), Nodup (antidiagonalTuple k n)
n : ℕ
n_ih :
  Pairwise
    (fun a b =>
      Disjoint (map (fun x => Fin.cons a.fst x) (antidiagonalTuple k a.snd))
        (map (fun x => Fin.cons b.fst x) (antidiagonalTuple k b.snd)))
    (antidiagonal n)
a : ℕ × ℕ
ha : a ∈ map (Prod.map Nat.succ id) (antidiagonal n)
x : Fin (Nat.succ k) → ℕ
hx₁ : x ∈ map (fun x => Fin.cons (0, n + 1).fst x) (antidiagonalTuple k (0, n + 1).snd)
hx₂ : x ∈ map (fun x => Fin.cons a.fst x) (antidiagonalTuple k a.snd)
⊢ False

tactic: obtain ⟨⟨a, -, rfl⟩, ⟨x₁, -, rfl⟩, ⟨x₂, -, h⟩⟩ := ha, hx₁, hx₂
state_before: case succ.right.succ.refine'_1
n✝ k : ℕ
ih : ∀ (n : ℕ), Nodup (antidiagonalTuple k n)
n : ℕ
n_ih :
  Pairwise
    (fun a b =>
      Disjoint (map (fun x => Fin.cons a.fst x) (antidiagonalTuple k a.snd))
        (map (fun x => Fin.cons b.fst x) (antidiagonalTuple k b.snd)))
    (antidiagonal n)
a : ℕ × ℕ
ha : ∃ a_1, a_1 ∈ antidiagonal n ∧ Prod.map Nat.succ id a_1 = a
x : Fin (Nat.succ k) → ℕ
hx₁ : ∃ a, a ∈ antidiagonalTuple k (0, n + 1).snd ∧ Fin.cons (0, n + 1).fst a = x
hx₂ : ∃ a_1, a_1 ∈ antidiagonalTuple k a.snd ∧ Fin.cons a.fst a_1 = x
⊢ False

tactic: rw [Fin.cons_eq_cons] at h
state_before: case succ.right.succ.refine'_1.intro.intro.intro.intro.intro.intro
n✝ k : ℕ
ih : ∀ (n : ℕ), Nodup (antidiagonalTuple k n)
n : ℕ
n_ih :
  Pairwise
    (fun a b =>
      Disjoint (map (fun x => Fin.cons a.fst x) (antidiagonalTuple k a.snd))
        (map (fun x => Fin.cons b.fst x) (antidiagonalTuple k b.snd)))
    (antidiagonal n)
a : ℕ × ℕ
x₁ x₂ : Fin k → ℕ
h : Fin.cons (Prod.map Nat.succ id a).fst x₂ = Fin.cons (0, n + 1).fst x₁
⊢ False

tactic: injection h.1
state_before: case succ.right.succ.refine'_1.intro.intro.intro.intro.intro.intro
n✝ k : ℕ
ih : ∀ (n : ℕ), Nodup (antidiagonalTuple k n)
n : ℕ
n_ih :
  Pairwise
    (fun a b =>
      Disjoint (map (fun x => Fin.cons a.fst x) (antidiagonalTuple k a.snd))
        (map (fun x => Fin.cons b.fst x) (antidiagonalTuple k b.snd)))
    (antidiagonal n)
a : ℕ × ℕ
x₁ x₂ : Fin k → ℕ
h : (Prod.map Nat.succ id a).fst = (0, n + 1).fst ∧ x₂ = x₁
⊢ False

tactic: rw [List.mem_map] at hx₁ hx₂
state_before: case succ.right.succ.refine'_2
n✝ k : ℕ
ih : ∀ (n : ℕ), Nodup (antidiagonalTuple k n)
n : ℕ
n_ih :
  Pairwise
    (fun a b =>
      Disjoint (map (fun x => Fin.cons a.fst x) (antidiagonalTuple k a.snd))
        (map (fun x => Fin.cons b.fst x) (antidiagonalTuple k b.snd)))
    (antidiagonal n)
a b : ℕ × ℕ
h :
  Disjoint (map (fun x => Fin.cons a.fst x) (antidiagonalTuple k a.snd))
    (map (fun x => Fin.cons b.fst x) (antidiagonalTuple k b.snd))
x : Fin (Nat.succ k) → ℕ
hx₁ : x ∈ map (fun x => Fin.cons (Prod.map Nat.succ id a).fst x) (antidiagonalTuple k (Prod.map Nat.succ id a).snd)
hx₂ : x ∈ map (fun x => Fin.cons (Prod.map Nat.succ id b).fst x) (antidiagonalTuple k (Prod.map Nat.succ id b).snd)
⊢ False

tactic: obtain ⟨⟨x₁, hx₁, rfl⟩, ⟨x₂, hx₂, h₁₂⟩⟩ := hx₁, hx₂
state_before: case succ.right.succ.refine'_2
n✝ k : ℕ
ih : ∀ (n : ℕ), Nodup (antidiagonalTuple k n)
n : ℕ
n_ih :
  Pairwise
    (fun a b =>
      Disjoint (map (fun x => Fin.cons a.fst x) (antidiagonalTuple k a.snd))
        (map (fun x => Fin.cons b.fst x) (antidiagonalTuple k b.snd)))
    (antidiagonal n)
a b : ℕ × ℕ
h :
  Disjoint (map (fun x => Fin.cons a.fst x) (antidiagonalTuple k a.snd))
    (map (fun x => Fin.cons b.fst x) (antidiagonalTuple k b.snd))
x : Fin (Nat.succ k) → ℕ
hx₁ : ∃ a_1, a_1 ∈ antidiagonalTuple k (Prod.map Nat.succ id a).snd ∧ Fin.cons (Prod.map Nat.succ id a).fst a_1 = x
hx₂ : ∃ a, a ∈ antidiagonalTuple k (Prod.map Nat.succ id b).snd ∧ Fin.cons (Prod.map Nat.succ id b).fst a = x
⊢ False

tactic: dsimp at h₁₂
state_before: case succ.right.succ.refine'_2.intro.intro.intro.intro
n✝ k : ℕ
ih : ∀ (n : ℕ), Nodup (antidiagonalTuple k n)
n : ℕ
n_ih :
  Pairwise
    (fun a b =>
      Disjoint (map (fun x => Fin.cons a.fst x) (antidiagonalTuple k a.snd))
        (map (fun x => Fin.cons b.fst x) (antidiagonalTuple k b.snd)))
    (antidiagonal n)
a b : ℕ × ℕ
h :
  Disjoint (map (fun x => Fin.cons a.fst x) (antidiagonalTuple k a.snd))
    (map (fun x => Fin.cons b.fst x) (antidiagonalTuple k b.snd))
x₁ : Fin k → ℕ
hx₁ : x₁ ∈ antidiagonalTuple k (Prod.map Nat.succ id a).snd
x₂ : Fin k → ℕ
hx₂ : x₂ ∈ antidiagonalTuple k (Prod.map Nat.succ id b).snd
h₁₂ : Fin.cons (Prod.map Nat.succ id b).fst x₂ = Fin.cons (Prod.map Nat.succ id a).fst x₁
⊢ False

tactic: rw [Fin.cons_eq_cons, Nat.succ_inj'] at h₁₂
state_before: case succ.right.succ.refine'_2.intro.intro.intro.intro
n✝ k : ℕ
ih : ∀ (n : ℕ), Nodup (antidiagonalTuple k n)
n : ℕ
n_ih :
  Pairwise
    (fun a b =>
      Disjoint (map (fun x => Fin.cons a.fst x) (antidiagonalTuple k a.snd))
        (map (fun x => Fin.cons b.fst x) (antidiagonalTuple k b.snd)))
    (antidiagonal n)
a b : ℕ × ℕ
h :
  Disjoint (map (fun x => Fin.cons a.fst x) (antidiagonalTuple k a.snd))
    (map (fun x => Fin.cons b.fst x) (antidiagonalTuple k b.snd))
x₁ : Fin k → ℕ
hx₁ : x₁ ∈ antidiagonalTuple k (Prod.map Nat.succ id a).snd
x₂ : Fin k → ℕ
hx₂ : x₂ ∈ antidiagonalTuple k (Prod.map Nat.succ id b).snd
h₁₂ : Fin.cons (Nat.succ b.fst) x₂ = Fin.cons (Nat.succ a.fst) x₁
⊢ False

tactic: obtain ⟨h₁₂, rfl⟩ := h₁₂
state_before: case succ.right.succ.refine'_2.intro.intro.intro.intro
n✝ k : ℕ
ih : ∀ (n : ℕ), Nodup (antidiagonalTuple k n)
n : ℕ
n_ih :
  Pairwise
    (fun a b =>
      Disjoint (map (fun x => Fin.cons a.fst x) (antidiagonalTuple k a.snd))
        (map (fun x => Fin.cons b.fst x) (antidiagonalTuple k b.snd)))
    (antidiagonal n)
a b : ℕ × ℕ
h :
  Disjoint (map (fun x => Fin.cons a.fst x) (antidiagonalTuple k a.snd))
    (map (fun x => Fin.cons b.fst x) (antidiagonalTuple k b.snd))
x₁ : Fin k → ℕ
hx₁ : x₁ ∈ antidiagonalTuple k (Prod.map Nat.succ id a).snd
x₂ : Fin k → ℕ
hx₂ : x₂ ∈ antidiagonalTuple k (Prod.map Nat.succ id b).snd
h₁₂ : b.fst = a.fst ∧ x₂ = x₁
⊢ False

tactic: rw [h₁₂] at h
state_before: case succ.right.succ.refine'_2.intro.intro.intro.intro.intro
n✝ k : ℕ
ih : ∀ (n : ℕ), Nodup (antidiagonalTuple k n)
n : ℕ
n_ih :
  Pairwise
    (fun a b =>
      Disjoint (map (fun x => Fin.cons a.fst x) (antidiagonalTuple k a.snd))
        (map (fun x => Fin.cons b.fst x) (antidiagonalTuple k b.snd)))
    (antidiagonal n)
a b : ℕ × ℕ
h :
  Disjoint (map (fun x => Fin.cons a.fst x) (antidiagonalTuple k a.snd))
    (map (fun x => Fin.cons b.fst x) (antidiagonalTuple k b.snd))
x₂ : Fin k → ℕ
hx₂ : x₂ ∈ antidiagonalTuple k (Prod.map Nat.succ id b).snd
h₁₂ : b.fst = a.fst
hx₁ : x₂ ∈ antidiagonalTuple k (Prod.map Nat.succ id a).snd
⊢ False

tactic: exact h (List.mem_map_of_mem _ hx₁) (List.mem_map_of_mem _ hx₂)
state_before: case succ.right.succ.refine'_2.intro.intro.intro.intro.intro
n✝ k : ℕ
ih : ∀ (n : ℕ), Nodup (antidiagonalTuple k n)
n : ℕ
n_ih :
  Pairwise
    (fun a b =>
      Disjoint (map (fun x => Fin.cons a.fst x) (antidiagonalTuple k a.snd))
        (map (fun x => Fin.cons b.fst x) (antidiagonalTuple k b.snd)))
    (antidiagonal n)
a b : ℕ × ℕ
h :
  Disjoint (map (fun x => Fin.cons a.fst x) (antidiagonalTuple k a.snd))
    (map (fun x => Fin.cons a.fst x) (antidiagonalTuple k b.snd))
x₂ : Fin k → ℕ
hx₂ : x₂ ∈ antidiagonalTuple k (Prod.map Nat.succ id b).snd
h₁₂ : b.fst = a.fst
hx₁ : x₂ ∈ antidiagonalTuple k (Prod.map Nat.succ id a).snd
⊢ False