Skip to content

Commit b2bd93a

Browse files
committed
feat: relation-separated sets (#23920)
Define a notion of separation of a set relative to a relation. This will be used to unify metric and dynamical separation. From MiscYD and LeanAPAP
1 parent c1f6461 commit b2bd93a

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3694,6 +3694,7 @@ import Mathlib.Data.Real.Sqrt
36943694
import Mathlib.Data.Real.Star
36953695
import Mathlib.Data.Real.StarOrdered
36963696
import Mathlib.Data.Rel
3697+
import Mathlib.Data.Rel.Separated
36973698
import Mathlib.Data.SProd
36983699
import Mathlib.Data.Semiquot
36993700
import Mathlib.Data.Seq.Basic

Mathlib/Data/Rel/Separated.lean

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/-
2+
Copyright (c) 2025 Yaël Dillies. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Yaël Dillies
5+
-/
6+
import Mathlib.Data.Set.Pairwise.Basic
7+
import Mathlib.Data.Rel
8+
9+
/-!
10+
# Uniform separation
11+
12+
This file defines a notion of separation of a set relative to an relation.
13+
14+
For a relation `R`, a `R`-separated set `s` is a set such that every pair of elements of `s` is
15+
`R`-unrelated.
16+
17+
The concept of uniformly separated sets is used to define two further notions of separation:
18+
* Metric separation: `Metric.IsSeparated`, defined using the small distance relation.
19+
* Dynamical nets: `Dynamics.IsDynNetIn`, defined using the dynamical relation.
20+
21+
## TODO
22+
23+
* Actually use `SetRel.IsSeparated` to define the above two notions.
24+
* Link to the notion of separation given by pairwise disjoint balls.
25+
-/
26+
27+
open Set
28+
29+
namespace SetRel
30+
variable {X : Type*} {R S : SetRel X X} {s t : Set X} {x : X}
31+
32+
/-- Given a relation `R`, a set `s` is `R`-separated if its elements are pairwise `R`-unrelated from
33+
each other. -/
34+
def IsSeparated (R : SetRel X X) (s : Set X) : Prop := s.Pairwise fun x y ↦ ¬ x ~[R] y
35+
36+
protected lemma IsSeparated.empty : IsSeparated R (∅ : Set X) := pairwise_empty _
37+
protected lemma IsSeparated.singleton : IsSeparated R {x} := pairwise_singleton ..
38+
39+
@[simp] lemma IsSeparated.of_subsingleton (hs : s.Subsingleton) : IsSeparated R s := hs.pairwise _
40+
41+
alias _root_.Set.Subsingleton.relIsSeparated := IsSeparated.of_subsingleton
42+
43+
nonrec lemma IsSeparated.mono_left (hUV : R ⊆ S) (hs : IsSeparated S s) : IsSeparated R s :=
44+
hs.mono' fun _x _y hxy h ↦ hxy <| hUV h
45+
46+
lemma IsSeparated.mono_right (hst : s ⊆ t) (ht : IsSeparated R t) : IsSeparated R s := ht.mono hst
47+
48+
lemma isSeparated_insert' :
49+
IsSeparated R (insert x s) ↔ IsSeparated R s ∧ (∀ y ∈ s, x ~[R] y → x = y) ∧
50+
∀ y ∈ s, y ~[R] x → x = y := by
51+
simp [IsSeparated, pairwise_insert, not_imp_comm (a := _ = _), -not_and, forall_and]
52+
53+
lemma isSeparated_insert [R.IsSymm] :
54+
IsSeparated R (insert x s) ↔ IsSeparated R s ∧ ∀ y ∈ s, x ~[R] y → x = y := by
55+
simpa [not_imp_not, IsSeparated] using pairwise_insert_of_symmetric fun _ _ ↦ mt R.symm
56+
57+
lemma isSeparated_insert_of_notMem [R.IsSymm] (hx : x ∉ s) :
58+
IsSeparated R (insert x s) ↔ IsSeparated R s ∧ ∀ y ∈ s, ¬ x ~[R] y :=
59+
pairwise_insert_of_symmetric_of_notMem (fun _ _ ↦ mt R.symm) hx
60+
61+
protected lemma IsSeparated.insert [R.IsSymm] (hs : IsSeparated R s)
62+
(h : ∀ y ∈ s, x ~[R] y → x = y) : IsSeparated R (insert x s) :=
63+
isSeparated_insert.2 ⟨hs, h⟩
64+
65+
end SetRel

0 commit comments

Comments
 (0)