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

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