Skip to content

Commit af881a9

Browse files
committed
feat: minimality with respect to a function (#23706)
Introduce `MinimalFor`/`MaximalFor`, which generalise `Minimal` and `Maximal` to the case where the predicate `P : ι → Prop` doesn't have an ordered domain, but where instead we have a function `f : ι → α` to an order. Typical examples include extremal properties of graphs, such as `Simple.IsTuran.Maximal`, where we don't just care about having a maximal clique-free graph, but we also want it to have the maximal number of edges.
1 parent e08d896 commit af881a9

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

Mathlib/Order/Defs/Unbundled.lean

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,26 @@ lemma Maximal.le_of_ge (h : Maximal P x) (hy : P y) (hge : x ≤ y) : y ≤ x :=
242242

243243
end LE
244244

245+
section LE
246+
variable {ι : Sort*} {α : Type*} [LE α] {P : ι → Prop} {f : ι → α} {i j : ι}
247+
248+
/-- `Minimal P i` means that `i` is an element with minimal image along `f` satisfying `P`. -/
249+
def MinimalFor (P : ι → Prop) (f : ι → α) (i : ι) : Prop := P i ∧ ∀ ⦃j⦄, P j → f j ≤ f i → f i ≤ f j
250+
251+
/-- `Maximal P i` means that `i` is an element with minimal image along `f` satisfying `P`. -/
252+
def MaximalFor (P : ι → Prop) (f : ι → α) (i : ι) : Prop := P i ∧ ∀ ⦃j⦄, P j → f i ≤ f j → f j ≤ f i
253+
254+
lemma MinimalFor.prop (h : MinimalFor P f i) : P i := h.1
255+
lemma MaximalFor.prop (h : MaximalFor P f i) : P i := h.1
256+
257+
lemma MinimalFor.le_of_le (h : MinimalFor P f i) (hj : P j) (hji : f j ≤ f i) : f i ≤ f j :=
258+
h.2 hj hji
259+
260+
lemma MaximalFor.le_of_le (h : MaximalFor P f i) (hj : P j) (hij : f i ≤ f j) : f j ≤ f i :=
261+
h.2 hj hij
262+
263+
end LE
264+
245265
/-! ### Upper and lower sets -/
246266

247267
/-- An upper set in an order `α` is a set such that any element greater than one of its members is

Mathlib/Order/Minimal.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ but it may be worth re-examining this to make it easier in the future; see the T
3434
* `Finset` versions of the lemmas about sets.
3535
3636
* API to allow for easily expressing min/maximality with respect to an arbitrary non-`LE` relation.
37-
37+
* API for `MinimalFor`/`MaximalFor`
3838
-/
3939

4040
assert_not_exists CompleteLattice

0 commit comments

Comments
 (0)