Theorem: Finset.Nat.antidiagonal_filter_le_snd_of_le
File: Mathlib/Data/Finset/NatAntidiagonal.lean

Proof steps:
state_before: n k : ℕ
h : k ≤ n
⊢ filter (fun a => k ≤ a.2) (antidiagonal n) =
    map ((Embedding.refl ℕ).prodMap { toFun := fun x => x + k, inj' := ⋯ }) (antidiagonal (n - k))
state_after: n k : ℕ
h : k ≤ n
aux₁ : (fun a => k ≤ a.2) = (fun a => k ≤ a.1) ∘ ⇑(Equiv.prodComm ℕ ℕ).symm
⊢ filter (fun a => k ≤ a.2) (antidiagonal n) =
    map ((Embedding.refl ℕ).prodMap { toFun := fun x => x + k, inj' := ⋯ }) (antidiagonal (n - k))
tactic: have aux₁ : fun a ↦ k ≤ a.snd = (fun a ↦ k ≤ a.fst) ∘ (Equiv.prodComm ℕ ℕ).symm := rfl
state_before: n k : ℕ
h : k ≤ n
aux₁ : (fun a => k ≤ a.2) = (fun a => k ≤ a.1) ∘ ⇑(Equiv.prodComm ℕ ℕ).symm
⊢ filter (fun a => k ≤ a.2) (antidiagonal n) =
    map ((Embedding.refl ℕ).prodMap { toFun := fun x => x + k, inj' := ⋯ }) (antidiagonal (n - k))
state_after: n k : ℕ
h : k ≤ n
aux₁ : (fun a => k ≤ a.2) = (fun a => k ≤ a.1) ∘ ⇑(Equiv.prodComm ℕ ℕ).symm
aux₂ : ∀ (i j : ℕ), (∃ a b, a + b = n - k ∧ b = i ∧ a + k = j) ↔ ∃ a b, a + b = n - k ∧ a = i ∧ b + k = j
⊢ filter (fun a => k ≤ a.2) (antidiagonal n) =
    map ((Embedding.refl ℕ).prodMap { toFun := fun x => x + k, inj' := ⋯ }) (antidiagonal (n - k))
tactic: have aux₂ : ∀ i j, (∃ a b, a + b = n - k ∧ b = i ∧ a + k = j) ↔
                      ∃ a b, a + b = n - k ∧ a = i ∧ b + k = j :=
    fun i j ↦ by rw [exists_comm]; exact exists₂_congr (fun a b ↦ by rw [add_comm])
state_before: n k : ℕ
h : k ≤ n
aux₁ : (fun a => k ≤ a.2) = (fun a => k ≤ a.1) ∘ ⇑(Equiv.prodComm ℕ ℕ).symm
aux₂ : ∀ (i j : ℕ), (∃ a b, a + b = n - k ∧ b = i ∧ a + k = j) ↔ ∃ a b, a + b = n - k ∧ a = i ∧ b + k = j
⊢ filter (fun a => k ≤ a.2) (antidiagonal n) =
    map ((Embedding.refl ℕ).prodMap { toFun := fun x => x + k, inj' := ⋯ }) (antidiagonal (n - k))
state_after: n k : ℕ
h : k ≤ n
aux₁ : (fun a => k ≤ a.2) = (fun a => k ≤ a.1) ∘ ⇑(Equiv.prodComm ℕ ℕ).symm
aux₂ : ∀ (i j : ℕ), (∃ a b, a + b = n - k ∧ b = i ∧ a + k = j) ↔ ∃ a b, a + b = n - k ∧ a = i ∧ b + k = j
⊢ filter (fun a => k ≤ a.2) (map (Equiv.prodComm ℕ ℕ).toEmbedding (antidiagonal n)) =
    map ((Embedding.refl ℕ).prodMap { toFun := fun x => x + k, inj' := ⋯ }) (antidiagonal (n - k))
tactic: rw [← map_prodComm_antidiagonal]
state_before: n k : ℕ
h : k ≤ n
aux₁ : (fun a => k ≤ a.2) = (fun a => k ≤ a.1) ∘ ⇑(Equiv.prodComm ℕ ℕ).symm
aux₂ : ∀ (i j : ℕ), (∃ a b, a + b = n - k ∧ b = i ∧ a + k = j) ↔ ∃ a b, a + b = n - k ∧ a = i ∧ b + k = j
⊢ filter (fun a => k ≤ a.2) (map (Equiv.prodComm ℕ ℕ).toEmbedding (antidiagonal n)) =
    map ((Embedding.refl ℕ).prodMap { toFun := fun x => x + k, inj' := ⋯ }) (antidiagonal (n - k))
state_after: n k : ℕ
h : k ≤ n
aux₁ : (fun a => k ≤ a.2) = (fun a => k ≤ a.1) ∘ ⇑(Equiv.prodComm ℕ ℕ).symm
aux₂ : ∀ (i j : ℕ), (∃ a b, a + b = n - k ∧ b = i ∧ a + k = j) ↔ ∃ a b, a + b = n - k ∧ a = i ∧ b + k = j
⊢ map (({ toFun := fun x => x + k, inj' := ⋯ }.prodMap (Embedding.refl ℕ)).trans (Equiv.prodComm ℕ ℕ).toEmbedding)
      (antidiagonal (n - k)) =
    map ((Embedding.refl ℕ).prodMap { toFun := fun x => x + k, inj' := ⋯ }) (antidiagonal (n - k))
tactic: simp_rw [aux₁, ← map_filter, antidiagonal_filter_le_fst_of_le h, map_map]
state_before: n k : ℕ
h : k ≤ n
aux₁ : (fun a => k ≤ a.2) = (fun a => k ≤ a.1) ∘ ⇑(Equiv.prodComm ℕ ℕ).symm
aux₂ : ∀ (i j : ℕ), (∃ a b, a + b = n - k ∧ b = i ∧ a + k = j) ↔ ∃ a b, a + b = n - k ∧ a = i ∧ b + k = j
⊢ map (({ toFun := fun x => x + k, inj' := ⋯ }.prodMap (Embedding.refl ℕ)).trans (Equiv.prodComm ℕ ℕ).toEmbedding)
      (antidiagonal (n - k)) =
    map ((Embedding.refl ℕ).prodMap { toFun := fun x => x + k, inj' := ⋯ }) (antidiagonal (n - k))
state_after: case a.mk
n k : ℕ
h : k ≤ n
aux₁ : (fun a => k ≤ a.2) = (fun a => k ≤ a.1) ∘ ⇑(Equiv.prodComm ℕ ℕ).symm
aux₂ : ∀ (i j : ℕ), (∃ a b, a + b = n - k ∧ b = i ∧ a + k = j) ↔ ∃ a b, a + b = n - k ∧ a = i ∧ b + k = j
i j : ℕ
⊢ (i, j) ∈
      map (({ toFun := fun x => x + k, inj' := ⋯ }.prodMap (Embedding.refl ℕ)).trans (Equiv.prodComm ℕ ℕ).toEmbedding)
        (antidiagonal (n - k)) ↔
    (i, j) ∈ map ((Embedding.refl ℕ).prodMap { toFun := fun x => x + k, inj' := ⋯ }) (antidiagonal (n - k))
tactic: ext ⟨i, j⟩
state_before: case a.mk
n k : ℕ
h : k ≤ n
aux₁ : (fun a => k ≤ a.2) = (fun a => k ≤ a.1) ∘ ⇑(Equiv.prodComm ℕ ℕ).symm
aux₂ : ∀ (i j : ℕ), (∃ a b, a + b = n - k ∧ b = i ∧ a + k = j) ↔ ∃ a b, a + b = n - k ∧ a = i ∧ b + k = j
i j : ℕ
⊢ (i, j) ∈
      map (({ toFun := fun x => x + k, inj' := ⋯ }.prodMap (Embedding.refl ℕ)).trans (Equiv.prodComm ℕ ℕ).toEmbedding)
        (antidiagonal (n - k)) ↔
    (i, j) ∈ map ((Embedding.refl ℕ).prodMap { toFun := fun x => x + k, inj' := ⋯ }) (antidiagonal (n - k))
state_after: no goals
tactic: simpa using aux₂ i j