Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 0c54c57

Browse files
committed
feat(data/set/equitable): A singleton is equitable (#10192)
Prove `set.subsingleton.equitable_on` and `set.equitable_on_singleton`.
1 parent af36f1a commit 0c54c57

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/data/set/equitable.lean

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ import data.nat.basic
1212
This file defines equitable functions.
1313
1414
A function `f` is equitable on a set `s` if `f a₁ ≤ f a₂ + 1` for all `a₁, a₂ ∈ s`. This is mostly
15-
useful when the domain of `f` is `ℕ` or `ℤ` (or more generally a successor order).
15+
useful when the codomain of `f` is `ℕ` or `ℤ` (or more generally a successor order).
1616
1717
## TODO
1818
19-
`ℕ` can be replaced by any `succ_order` + `conditionally_complete_monoid`, but we don't have either
20-
of those yet.
19+
`ℕ` can be replaced by any `succ_order` + `conditionally_complete_monoid`, but we don't have the
20+
latter yet.
2121
-/
2222

2323
open_locale big_operators
@@ -28,11 +28,10 @@ namespace set
2828

2929
/-- A set is equitable if no element value is more than one bigger than another. -/
3030
def equitable_on [has_le β] [has_add β] [has_one β] (s : set α) (f : α → β) : Prop :=
31-
∀ ⦃a₁ a₂⦄, a₁ ∈ s → a₂ ∈ s → f a₁ ≤ f a₂ + 1
31+
∀ ⦃a₁ a₂⦄, a₁ ∈ s → a₂ ∈ s → f a₁ ≤ f a₂ + 1
3232

3333
@[simp]
34-
lemma equitable_on_empty [has_le β] [has_add β] [has_one β] (f : α → β) :
35-
equitable_on ∅ f :=
34+
lemma equitable_on_empty [has_le β] [has_add β] [has_one β] (f : α → β) : equitable_on ∅ f :=
3635
λ a _ ha, (set.not_mem_empty _ ha).elim
3736

3837
lemma equitable_on_iff_exists_le_le_add_one {s : set α} {f : α → ℕ} :
@@ -59,6 +58,16 @@ lemma equitable_on_iff_exists_eq_eq_add_one {s : set α} {f : α → ℕ} :
5958
s.equitable_on f ↔ ∃ b, ∀ a ∈ s, f a = b ∨ f a = b + 1 :=
6059
by simp_rw [equitable_on_iff_exists_le_le_add_one, nat.le_and_le_add_one_iff]
6160

61+
section ordered_semiring
62+
variables [ordered_semiring β]
63+
64+
lemma subsingleton.equitable_on {s : set α} (hs : s.subsingleton) (f : α → β) : s.equitable_on f :=
65+
λ i j hi hj, by { rw hs hi hj, exact le_add_of_nonneg_right zero_le_one }
66+
67+
lemma equitable_on_singleton (a : α) (f : α → β) : set.equitable_on {a} f :=
68+
set.subsingleton_singleton.equitable_on f
69+
70+
end ordered_semiring
6271
end set
6372

6473
open set

0 commit comments

Comments
 (0)