@@ -12,12 +12,12 @@ import data.nat.basic
12
12
This file defines equitable functions.
13
13
14
14
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).
16
16
17
17
## TODO
18
18
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.
21
21
-/
22
22
23
23
open_locale big_operators
@@ -28,11 +28,10 @@ namespace set
28
28
29
29
/-- A set is equitable if no element value is more than one bigger than another. -/
30
30
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
32
32
33
33
@[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 :=
36
35
λ a _ ha, (set.not_mem_empty _ ha).elim
37
36
38
37
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 : α → ℕ} :
59
58
s.equitable_on f ↔ ∃ b, ∀ a ∈ s, f a = b ∨ f a = b + 1 :=
60
59
by simp_rw [equitable_on_iff_exists_le_le_add_one, nat.le_and_le_add_one_iff]
61
60
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
62
71
end set
63
72
64
73
open set
0 commit comments