Theorem: Finite.wellFounded_of_trans_of_irrefl
File: Mathlib/Data/Fintype/Card.lean

tactic: classical
cases nonempty_fintype α
have :
  ∀ x y, r x y → (univ.filter fun z => r z x).card < (univ.filter fun z => r z y).card :=
  fun x y hxy =>
  Finset.card_lt_card <| by
    simp only [Finset.lt_iff_ssubset.symm, lt_iff_le_not_le, Finset.le_iff_subset,
        Finset.subset_iff, mem_filter, true_and_iff, mem_univ, hxy];
    exact
      ⟨fun z hzx => _root_.trans hzx hxy,
        not_forall_of_exists_not ⟨x, Classical.not_imp.2 ⟨hxy, irrefl x⟩⟩⟩
exact Subrelation.wf (this _ _) (measure _).wf
state_before: α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : Finite α
r : α → α → Prop
inst✝¹ : IsTrans α r
inst✝ : IsIrrefl α r
⊢ WellFounded r
state_after: no goals

tactic: cases nonempty_fintype α
state_before: α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : Finite α
r : α → α → Prop
inst✝¹ : IsTrans α r
inst✝ : IsIrrefl α r
⊢ WellFounded r
state_after: case intro
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : Finite α
r : α → α → Prop
inst✝¹ : IsTrans α r
inst✝ : IsIrrefl α r
val✝ : Fintype α
⊢ WellFounded r

tactic: have :
  ∀ x y, r x y → (univ.filter fun z => r z x).card < (univ.filter fun z => r z y).card :=
  fun x y hxy =>
  Finset.card_lt_card <| by
    simp only [Finset.lt_iff_ssubset.symm, lt_iff_le_not_le, Finset.le_iff_subset,
        Finset.subset_iff, mem_filter, true_and_iff, mem_univ, hxy];
    exact
      ⟨fun z hzx => _root_.trans hzx hxy,
        not_forall_of_exists_not ⟨x, Classical.not_imp.2 ⟨hxy, irrefl x⟩⟩⟩
state_before: case intro
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : Finite α
r : α → α → Prop
inst✝¹ : IsTrans α r
inst✝ : IsIrrefl α r
val✝ : Fintype α
⊢ WellFounded r
state_after: case intro
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : Finite α
r : α → α → Prop
inst✝¹ : IsTrans α r
inst✝ : IsIrrefl α r
val✝ : Fintype α
this : ∀ (x y : α), r x y → (filter (fun z => r z x) univ).card < (filter (fun z => r z y) univ).card
⊢ WellFounded r

tactic: exact Subrelation.wf (this _ _) (measure _).wf
state_before: case intro
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : Finite α
r : α → α → Prop
inst✝¹ : IsTrans α r
inst✝ : IsIrrefl α r
val✝ : Fintype α
this : ∀ (x y : α), r x y → (filter (fun z => r z x) univ).card < (filter (fun z => r z y) univ).card
⊢ WellFounded r
state_after: no goals

tactic: simp only [Finset.lt_iff_ssubset.symm, lt_iff_le_not_le, Finset.le_iff_subset,
    Finset.subset_iff, mem_filter, true_and_iff, mem_univ, hxy]
state_before: α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : Finite α
r : α → α → Prop
inst✝¹ : IsTrans α r
inst✝ : IsIrrefl α r
val✝ : Fintype α
x y : α
hxy : r x y
⊢ filter (fun z => r z x) univ ⊂ filter (fun z => r z y) univ
state_after: α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : Finite α
r : α → α → Prop
inst✝¹ : IsTrans α r
inst✝ : IsIrrefl α r
val✝ : Fintype α
x y : α
hxy : r x y
⊢ (∀ ⦃x_1 : α⦄, r x_1 x → r x_1 y) ∧ ¬∀ ⦃x_1 : α⦄, r x_1 y → r x_1 x

tactic: exact
  ⟨fun z hzx => _root_.trans hzx hxy,
    not_forall_of_exists_not ⟨x, Classical.not_imp.2 ⟨hxy, irrefl x⟩⟩⟩
state_before: α : Type u_1
β : Type u_2
γ : Type u_3
inst✝² : Finite α
r : α → α → Prop
inst✝¹ : IsTrans α r
inst✝ : IsIrrefl α r
val✝ : Fintype α
x y : α
hxy : r x y
⊢ (∀ ⦃x_1 : α⦄, r x_1 x → r x_1 y) ∧ ¬∀ ⦃x_1 : α⦄, r x_1 y → r x_1 x
state_after: no goals