Skip to content

Commit 02065d2

Browse files
committed
feat: minimal elements exist in well-founded orders (#24766)
From Toric
1 parent 179655b commit 02065d2

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

Mathlib/Order/Minimal.lean

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,37 @@ theorem not_maximal_iff_exists_gt (hx : P x) : ¬ Maximal P x ↔ ∃ y, x < y
216216

217217
alias ⟨exists_gt_of_not_maximal, _⟩ := not_maximal_iff_exists_gt
218218

219+
section WellFoundedLT
220+
variable [WellFoundedLT α]
221+
222+
lemma exists_minimalFor_of_wellFoundedLT (P : ι → Prop) (f : ι → α) (hP : ∃ i, P i) :
223+
∃ i, MinimalFor P f i := by
224+
simpa [not_lt_iff_le_imp_le, InvImage] using (instIsWellFoundedInvImage (· < ·) f).wf.has_min _ hP
225+
226+
lemma exists_minimal_of_wellFoundedLT (P : α → Prop) (hP : ∃ a, P a) : ∃ a, Minimal P a :=
227+
exists_minimalFor_of_wellFoundedLT P id hP
228+
229+
lemma exists_minimal_le_of_wellFoundedLT (P : α → Prop) (a : α) (ha : P a) :
230+
∃ b ≤ a, Minimal P b := by
231+
obtain ⟨b, ⟨hba, hb⟩, hbmin⟩ :=
232+
exists_minimal_of_wellFoundedLT (fun b ↦ b ≤ a ∧ P b) ⟨a, le_rfl, ha⟩
233+
exact ⟨b, hba, hb, fun c hc hcb ↦ hbmin ⟨hcb.trans hba, hc⟩ hcb⟩
234+
235+
end WellFoundedLT
236+
237+
section WellFoundedGT
238+
variable [WellFoundedGT α]
239+
240+
lemma exists_maximalFor_of_wellFoundedGT (P : ι → Prop) (f : ι → α) (hP : ∃ i, P i) :
241+
∃ i, MaximalFor P f i := exists_minimalFor_of_wellFoundedLT (α := αᵒᵈ) P f hP
242+
243+
lemma exists_maximal_of_wellFoundedGT (P : α → Prop) (hP : ∃ a, P a) : ∃ a, Maximal P a :=
244+
exists_minimal_of_wellFoundedLT (α := αᵒᵈ) P hP
245+
246+
lemma exists_maximal_ge_of_wellFoundedGT (P : α → Prop) (a : α) (ha : P a) :
247+
∃ b, a ≤ b ∧ Maximal P b := exists_minimal_le_of_wellFoundedLT (α := αᵒᵈ) P a ha
248+
249+
end WellFoundedGT
219250
end Preorder
220251

221252
section PartialOrder

0 commit comments

Comments
 (0)