Theorem: Finset.filter_fst_eq_antidiagonal
File: Mathlib/Algebra/Order/Antidiag/Prod.lean

Proof steps:
state_before: A : Type u_1
inst✝⁶ : CanonicallyOrderedAddCommMonoid A
inst✝⁵ : Sub A
inst✝⁴ : OrderedSub A
inst✝³ : ContravariantClass A A (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
inst✝² : HasAntidiagonal A
n m : A
inst✝¹ : DecidablePred fun x => x = m
inst✝ : Decidable (m ≤ n)
⊢ filter (fun x => x.1 = m) (antidiagonal n) = if m ≤ n then {(m, n - m)} else ∅
state_after: case a.mk
A : Type u_1
inst✝⁶ : CanonicallyOrderedAddCommMonoid A
inst✝⁵ : Sub A
inst✝⁴ : OrderedSub A
inst✝³ : ContravariantClass A A (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
inst✝² : HasAntidiagonal A
n m : A
inst✝¹ : DecidablePred fun x => x = m
inst✝ : Decidable (m ≤ n)
a b : A
⊢ (a, b) ∈ filter (fun x => x.1 = m) (antidiagonal n) ↔ (a, b) ∈ if m ≤ n then {(m, n - m)} else ∅
tactic: ext ⟨a, b⟩
state_before: case a.mk
A : Type u_1
inst✝⁶ : CanonicallyOrderedAddCommMonoid A
inst✝⁵ : Sub A
inst✝⁴ : OrderedSub A
inst✝³ : ContravariantClass A A (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
inst✝² : HasAntidiagonal A
n m : A
inst✝¹ : DecidablePred fun x => x = m
inst✝ : Decidable (m ≤ n)
a b : A
⊢ (a, b) ∈ filter (fun x => x.1 = m) (antidiagonal n) ↔ (a, b) ∈ if m ≤ n then {(m, n - m)} else ∅
state_after: case a.mk
A : Type u_1
inst✝⁶ : CanonicallyOrderedAddCommMonoid A
inst✝⁵ : Sub A
inst✝⁴ : OrderedSub A
inst✝³ : ContravariantClass A A (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
inst✝² : HasAntidiagonal A
n m : A
inst✝¹ : DecidablePred fun x => x = m
inst✝ : Decidable (m ≤ n)
a b : A
⊢ a = m → (a + b = n ↔ m ≤ n ∧ b = n - m)
tactic: suffices a = m → (a + b = n ↔ m ≤ n ∧ b = n - m) by
    rw [mem_filter, mem_antidiagonal, apply_ite (fun n ↦ (a, b) ∈ n), mem_singleton,
      Prod.mk.inj_iff, ite_prop_iff_or]
    simpa [← and_assoc, @and_right_comm _ (a = _), and_congr_left_iff]
state_before: case a.mk
A : Type u_1
inst✝⁶ : CanonicallyOrderedAddCommMonoid A
inst✝⁵ : Sub A
inst✝⁴ : OrderedSub A
inst✝³ : ContravariantClass A A (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
inst✝² : HasAntidiagonal A
n m : A
inst✝¹ : DecidablePred fun x => x = m
inst✝ : Decidable (m ≤ n)
a b : A
⊢ a = m → (a + b = n ↔ m ≤ n ∧ b = n - m)
state_after: case a.mk
A : Type u_1
inst✝⁶ : CanonicallyOrderedAddCommMonoid A
inst✝⁵ : Sub A
inst✝⁴ : OrderedSub A
inst✝³ : ContravariantClass A A (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
inst✝² : HasAntidiagonal A
n a b : A
inst✝¹ : DecidablePred fun x => x = a
inst✝ : Decidable (a ≤ n)
⊢ a + b = n ↔ a ≤ n ∧ b = n - a
tactic: rintro rfl
state_before: case a.mk
A : Type u_1
inst✝⁶ : CanonicallyOrderedAddCommMonoid A
inst✝⁵ : Sub A
inst✝⁴ : OrderedSub A
inst✝³ : ContravariantClass A A (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
inst✝² : HasAntidiagonal A
n a b : A
inst✝¹ : DecidablePred fun x => x = a
inst✝ : Decidable (a ≤ n)
⊢ a + b = n ↔ a ≤ n ∧ b = n - a
state_after: case a.mk.mp
A : Type u_1
inst✝⁶ : CanonicallyOrderedAddCommMonoid A
inst✝⁵ : Sub A
inst✝⁴ : OrderedSub A
inst✝³ : ContravariantClass A A (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
inst✝² : HasAntidiagonal A
n a b : A
inst✝¹ : DecidablePred fun x => x = a
inst✝ : Decidable (a ≤ n)
⊢ a + b = n → a ≤ n ∧ b = n - a

case a.mk.mpr
A : Type u_1
inst✝⁶ : CanonicallyOrderedAddCommMonoid A
inst✝⁵ : Sub A
inst✝⁴ : OrderedSub A
inst✝³ : ContravariantClass A A (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
inst✝² : HasAntidiagonal A
n a b : A
inst✝¹ : DecidablePred fun x => x = a
inst✝ : Decidable (a ≤ n)
⊢ a ≤ n ∧ b = n - a → a + b = n
tactic: constructor