The areas / V01. The language of Mathlib
Mathlib.Basic.Rel
183 declarations. Mathlib docs · Source
Relations as sets of pairs
This file provides API to regard relations between α and β as sets of pairs Set (α × β).
This is in particular useful in the study of uniform spaces, which are topological spaces equipped
with a uniformity, namely a filter of pairs α × α whose elements can be viewed as "proximity"
relations.
Main declarations
SetRel α β: Type of relations betweenαandβ.SetRel.inv: TurnR : SetRel α βintoR.inv : SetRel β αby swapping the arguments.SetRel.dom: Domain of a relation.a ∈ R.domiff there existsbsuch thata ~[R] b.SetRel.cod: Codomain of a relation.b ∈ R.codiff there existsasuch thata ~[R] b.SetRel.id: The identity relationSetRel α α.SetRel.comp: SetRel composition. Note that the arguments order follows the category theory convention, namely(R ○ S) a c ↔ ∃ b, a ~[R] b ∧ b ~[S] c.SetRel.image: Image of a set under a relation.b ∈ image R siff there existsa ∈ ssuch thata ~[R] b. IfRis the graph off(a ~[R] b ↔ f a = b), thenR.image = Set.image f.SetRel.preimage: Preimage of a set under a relation.a ∈ preimage R tiff there existsb ∈ tsuch thata ~[R] b. IfRis the graph off(a ~[R] b ↔ f a = b), thenR.preimage = Set.preimage f.SetRel.core: Core of a set. Fort : Set β,a ∈ R.core tiff allbrelated toaare int.SetRel.restrictDomain: Domain-restriction of a relation to a subtype.Function.graph: Graph of a function as a relation.
Implementation notes
There is tension throughout the library between considering relations between α and β simply as
α → β → Prop, or as a set of pairs SetRel α β with dedicated operations and API.
The function representation is lightweight and has native support from core Lean features. It is a
good fit when a relation is primarily applied to two arguments. The set-of-pairs representation is
useful when the relation itself is manipulated as a mathematical object, as R is in the examples
below, because the standard Set API applies directly. For example:
- the inverse relation is the preimage
Prod.swap ⁻¹' R; - transporting a relation along
f : α → γandg : β → δis the image(Prod.map f g) '' R; - unions, intersections, complements, and the subset order are inherited from
Set.
These operations can also be defined for α → β → Prop; the advantage of SetRel is reuse of the
existing set API and direct interoperability with objects such as filters on α × α, rather than
additional expressive power. SetRel also provides dedicated relational operations, including the
notation ○ for composition. (Note that ○ is not function composition ∘.)
Previously, SetRel suffered from the leakage of its definition as
def SetRel (α β : Type*) := α → β → Prop
The fact that SetRel wasn't an abbrev confuses automation.
But simply making it an abbrev would have killed the point of having a separate less see-through
type to perform relation operations on, so we instead redefined
abbrev SetRel (α β : Type*) := Set (α × β)
This extra level of indirection guides automation correctly and prevents (some kinds of) leakage.
Simultaneously, uniform spaces need a theory of relations on a type α as elements of
Set (α × α), and the new definition of SetRel fulfills this role quite well.
Reflexive relations
Symmetric relations
Transitive relations
abbrev SetRel E1 #
Type u_6 → Type u_7 → Type (max u_7 u_6)
A relation on α and β, aka a set-valued function, aka a partial multifunction.
We represent them as sets due to how relations are used in the context of uniform spaces.
def SetRel.«term_~[_]_» E1 #
Lean.TrailingParserDescr
Notation for apply a relation R : SetRel α β to a : α, b : β,
scoped to the SetRel namespace.
Since SetRel α β := Set (α × β), a ~[R] b is simply notation for (a, b) ∈ R, but this should
be considered an implementation detail.
def SetRel.inv E3 #
{α : Type u_1} → {β : Type u_2} → SetRel α β → SetRel β α
The inverse relation : R.inv x y ↔ R y x. Note that this is not a groupoid inverse.
theorem SetRel.mem_inv E0 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α β} {a : α} {b : β}, (b, a) ∈ R.inv ↔ (a, b) ∈ R
theorem SetRel.inv_inv E0 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α β}, R.inv.inv = R
theorem SetRel.inv_mono E1 #
∀ {α : Type u_1} {β : Type u_2} {R₁ R₂ : SetRel α β}, R₁ ⊆ R₂ → R₁.inv ⊆ R₂.inv
theorem SetRel.inv_empty E0 #
∀ {α : Type u_1} {β : Type u_2}, ∅.inv = ∅
theorem SetRel.inv_univ E0 #
∀ {α : Type u_1} {β : Type u_2}, SetRel.inv Set.univ = Set.univ
def SetRel.dom E3 #
{α : Type u_1} → {β : Type u_2} → SetRel α β → Set α
Domain of a relation.
def SetRel.cod E3 #
{α : Type u_1} → {β : Type u_2} → SetRel α β → Set β
Codomain of a relation, aka range.
theorem SetRel.mem_dom E0 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α β} {a : α}, a ∈ R.dom ↔ ∃ b, (a, b) ∈ R
theorem SetRel.mem_cod E0 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α β} {b : β}, b ∈ R.cod ↔ ∃ a, (a, b) ∈ R
theorem SetRel.dom_mono E1 #
∀ {α : Type u_1} {β : Type u_2} {R₁ R₂ : SetRel α β}, R₁ ⊆ R₂ → R₁.dom ⊆ R₂.dom
theorem SetRel.cod_mono E1 #
∀ {α : Type u_1} {β : Type u_2} {R₁ R₂ : SetRel α β}, R₁ ⊆ R₂ → R₁.cod ⊆ R₂.cod
theorem SetRel.dom_empty E0 #
∀ {α : Type u_1} {β : Type u_2}, ∅.dom = ∅
theorem SetRel.cod_empty E0 #
∀ {α : Type u_1} {β : Type u_2}, ∅.cod = ∅
theorem SetRel.dom_eq_empty_iff E0 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α β}, R.dom = ∅ ↔ R = ∅
theorem SetRel.cod_eq_empty_iff E0 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α β}, R.cod = ∅ ↔ R = ∅
theorem SetRel.dom_univ E0 #
∀ {α : Type u_1} {β : Type u_2} [Nonempty β], SetRel.dom Set.univ = Set.univ
theorem SetRel.cod_univ E0 #
∀ {α : Type u_1} {β : Type u_2} [Nonempty α], SetRel.cod Set.univ = Set.univ
theorem SetRel.cod_inv E0 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α β}, R.inv.cod = R.dom
theorem SetRel.dom_inv E0 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α β}, R.inv.dom = R.cod
def SetRel.id E3 #
{α : Type u_1} → SetRel α α
The identity relation.
theorem SetRel.mem_id E0 #
∀ {α : Type u_1} {a₁ a₂ : α}, (a₁, a₂) ∈ SetRel.id ↔ a₁ = a₂
theorem SetRel.inv_id E1 #
∀ {α : Type u_1}, SetRel.id.inv = SetRel.id
def SetRel.comp E3 #
{α : Type u_1} → {β : Type u_2} → {γ : Type u_3} → SetRel α β → SetRel β γ → SetRel α γ
Composition of relation.
Note that this follows the CategoryTheory order of arguments.
def SetRel.«term_○_» E1 #
Lean.TrailingParserDescr
Composition of relation.
Note that this follows the CategoryTheory order of arguments.
theorem SetRel.mem_comp E0 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {R : SetRel α β} {S : SetRel β γ} {a : α} {c : γ},
(a, c) ∈ R.comp S ↔ ∃ b, (a, b) ∈ R ∧ (b, c) ∈ S
theorem SetRel.prodMk_mem_comp E1 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {R : SetRel α β} {S : SetRel β γ} {a : α} {b : β} {c : γ},
(a, b) ∈ R → (b, c) ∈ S → (a, c) ∈ R.comp S
theorem SetRel.comp_assoc E1 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {δ : Type u_4} (R : SetRel α β) (S : SetRel β γ) (t : SetRel γ δ),
(R.comp S).comp t = R.comp (S.comp t)
theorem SetRel.comp_id E0 #
∀ {α : Type u_1} {β : Type u_2} (R : SetRel α β), R.comp SetRel.id = R
theorem SetRel.id_comp E0 #
∀ {α : Type u_1} {β : Type u_2} (R : SetRel α β), SetRel.id.comp R = R
theorem SetRel.inv_comp E0 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} (R : SetRel α β) (S : SetRel β γ), (R.comp S).inv = S.inv.comp R.inv
theorem SetRel.comp_empty E0 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} (R : SetRel α β), R.comp ∅ = ∅
theorem SetRel.empty_comp E0 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} (S : SetRel β γ), ∅.comp S = ∅
theorem SetRel.comp_univ E0 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} (R : SetRel α β), R.comp Set.univ = {(a, _c) | a ∈ R.dom}
theorem SetRel.univ_comp E0 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} (S : SetRel β γ), SetRel.comp Set.univ S = {(_b, c) | c ∈ S.cod}
theorem SetRel.comp_iUnion E1 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {ι : Sort u_5} (R : SetRel α β) (S : ι → SetRel β γ),
R.comp (⋃ i, S i) = ⋃ i, R.comp (S i)
theorem SetRel.iUnion_comp E1 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {ι : Sort u_5} (R : ι → SetRel α β) (S : SetRel β γ),
SetRel.comp (⋃ i, R i) S = ⋃ i, (R i).comp S
theorem SetRel.comp_sUnion E1 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} (R : SetRel α β) (𝒮 : Set (SetRel β γ)),
R.comp (⋃₀ 𝒮) = ⋃ S ∈ 𝒮, R.comp S
theorem SetRel.sUnion_comp E1 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} (ℛ : Set (SetRel α β)) (S : SetRel β γ),
SetRel.comp (⋃₀ ℛ) S = ⋃ R ∈ ℛ, R.comp S
theorem SetRel.comp_subset_comp E1 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {R₁ R₂ : SetRel α β} {S₁ S₂ : SetRel β γ},
R₁ ⊆ R₂ → S₁ ⊆ S₂ → R₁.comp S₁ ⊆ R₂.comp S₂
theorem SetRel.comp_subset_comp_left E1 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {R₁ R₂ : SetRel α β} {S : SetRel β γ}, R₁ ⊆ R₂ → R₁.comp S ⊆ R₂.comp S
theorem SetRel.comp_subset_comp_right E1 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {R : SetRel α β} {S₁ S₂ : SetRel β γ}, S₁ ⊆ S₂ → R.comp S₁ ⊆ R.comp S₂
theorem Monotone.relComp E1 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {ι : Type u_6} [inst : Preorder ι] {f : ι → SetRel α β}
{g : ι → SetRel β γ}, Monotone f → Monotone g → Monotone fun x ↦ (f x).comp (g x)
theorem SetRel.prod_comp_prod_of_inter_nonempty E1 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {t₁ t₂ : Set β},
(t₁ ∩ t₂).Nonempty → ∀ (s : Set α) (u : Set γ), SetRel.comp (s ×ˢ t₁) (t₂ ×ˢ u) = s ×ˢ u
theorem SetRel.prod_comp_prod_of_disjoint E1 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {t₁ t₂ : Set β},
Disjoint t₁ t₂ → ∀ (s : Set α) (u : Set γ), SetRel.comp (s ×ˢ t₁) (t₂ ×ˢ u) = ∅
theorem SetRel.prod_comp_prod E1 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} (s : Set α) (t₁ t₂ : Set β) (u : Set γ)
[inst : Decidable (Disjoint t₁ t₂)], SetRel.comp (s ×ˢ t₁) (t₂ ×ˢ u) = if Disjoint t₁ t₂ then ∅ else s ×ˢ u
def SetRel.image E3 #
{α : Type u_1} → {β : Type u_2} → SetRel α β → Set α → Set β
Image of a set under a relation.
def SetRel.preimage E3 #
{α : Type u_1} → {β : Type u_2} → SetRel α β → Set β → Set α
Preimage of a set t under a relation R. Same as the image of t under R.inv.
theorem SetRel.mem_image E0 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α β} {s : Set α} {b : β}, b ∈ R.image s ↔ ∃ a ∈ s, (a, b) ∈ R
theorem SetRel.mem_preimage E0 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α β} {t : Set β} {a : α}, a ∈ R.preimage t ↔ ∃ b ∈ t, (a, b) ∈ R
theorem SetRel.image_subset_image E1 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α β} {s₁ s₂ : Set α}, s₁ ⊆ s₂ → R.image s₁ ⊆ R.image s₂
theorem SetRel.image_subset_image_left E1 #
∀ {α : Type u_1} {β : Type u_2} {R₁ R₂ : SetRel α β} {s : Set α}, R₁ ⊆ R₂ → R₁.image s ⊆ R₂.image s
theorem SetRel.preimage_subset_preimage E1 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α β} {t₁ t₂ : Set β}, t₁ ⊆ t₂ → R.preimage t₁ ⊆ R.preimage t₂
theorem SetRel.preimage_subset_preimage_left E1 #
∀ {α : Type u_1} {β : Type u_2} {R₁ R₂ : SetRel α β} {t : Set β}, R₁ ⊆ R₂ → R₁.preimage t ⊆ R₂.preimage t
theorem SetRel.image_inv E0 #
∀ {α : Type u_1} {β : Type u_2} (R : SetRel α β) (t : Set β), R.inv.image t = R.preimage t
theorem SetRel.preimage_inv E0 #
∀ {α : Type u_1} {β : Type u_2} (R : SetRel α β) (s : Set α), R.inv.preimage s = R.image s
theorem SetRel.image_mono E1 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α β}, Monotone R.image
theorem SetRel.preimage_mono E1 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α β}, Monotone R.preimage
theorem SetRel.image_empty_right E0 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α β}, R.image ∅ = ∅
theorem SetRel.preimage_empty_right E0 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α β}, R.preimage ∅ = ∅
theorem SetRel.image_univ_right E0 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α β}, R.image Set.univ = R.cod
theorem SetRel.preimage_univ_right E0 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α β}, R.preimage Set.univ = R.dom
theorem SetRel.image_inter_subset E1 #
∀ {α : Type u_1} {β : Type u_2} (R : SetRel α β) {s₁ s₂ : Set α}, R.image (s₁ ∩ s₂) ⊆ R.image s₁ ∩ R.image s₂
theorem SetRel.preimage_inter_subset E1 #
∀ {α : Type u_1} {β : Type u_2} (R : SetRel α β) {t₁ t₂ : Set β}, R.preimage (t₁ ∩ t₂) ⊆ R.preimage t₁ ∩ R.preimage t₂
theorem SetRel.image_union E1 #
∀ {α : Type u_1} {β : Type u_2} (R : SetRel α β) (s₁ s₂ : Set α), R.image (s₁ ∪ s₂) = R.image s₁ ∪ R.image s₂
theorem SetRel.image_iUnion E1 #
∀ {α : Type u_1} {β : Type u_2} {ι : Sort u_5} (R : SetRel α β) (s : ι → Set α), R.image (⋃ i, s i) = ⋃ i, R.image (s i)
theorem SetRel.image_sUnion E1 #
∀ {α : Type u_1} {β : Type u_2} (R : SetRel α β) (S : Set (Set α)), R.image (⋃₀ S) = ⋃ s ∈ S, R.image s
theorem SetRel.preimage_union E1 #
∀ {α : Type u_1} {β : Type u_2} (R : SetRel α β) (t₁ t₂ : Set β), R.preimage (t₁ ∪ t₂) = R.preimage t₁ ∪ R.preimage t₂
theorem SetRel.preimage_iUnion E1 #
∀ {α : Type u_1} {β : Type u_2} {ι : Sort u_5} (R : SetRel α β) (t : ι → Set β),
R.preimage (⋃ i, t i) = ⋃ i, R.preimage (t i)
theorem SetRel.preimage_sUnion E1 #
∀ {α : Type u_1} {β : Type u_2} (R : SetRel α β) (T : Set (Set β)), R.preimage (⋃₀ T) = ⋃ t ∈ T, R.preimage t
theorem SetRel.image_id E0 #
∀ {α : Type u_1} (s : Set α), SetRel.id.image s = s
theorem SetRel.preimage_id E0 #
∀ {α : Type u_1} (s : Set α), SetRel.id.preimage s = s
theorem SetRel.image_comp E1 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} (R : SetRel α β) (S : SetRel β γ) (s : Set α),
(R.comp S).image s = S.image (R.image s)
theorem SetRel.preimage_comp E1 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} (R : SetRel α β) (S : SetRel β γ) (u : Set γ),
(R.comp S).preimage u = R.preimage (S.preimage u)
theorem SetRel.image_empty_left E0 #
∀ {α : Type u_1} {β : Type u_2} (s : Set α), ∅.image s = ∅
theorem SetRel.preimage_empty_left E0 #
∀ {α : Type u_1} {β : Type u_2} (t : Set β), ∅.preimage t = ∅
theorem SetRel.image_univ_left E0 #
∀ {α : Type u_1} {β : Type u_2} {s : Set α}, s.Nonempty → SetRel.image Set.univ s = Set.univ
theorem SetRel.preimage_univ_left E0 #
∀ {α : Type u_1} {β : Type u_2} {t : Set β}, t.Nonempty → SetRel.preimage Set.univ t = Set.univ
theorem SetRel.image_eq_cod_of_dom_subset E1 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α β} {s : Set α}, R.dom ⊆ s → R.image s = R.cod
theorem SetRel.preimage_eq_dom_of_cod_subset E1 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α β} {t : Set β}, R.cod ⊆ t → R.preimage t = R.dom
theorem SetRel.image_inter_dom E0 #
∀ {α : Type u_1} {β : Type u_2} (R : SetRel α β) (s : Set α), R.image (s ∩ R.dom) = R.image s
theorem SetRel.preimage_inter_cod E0 #
∀ {α : Type u_1} {β : Type u_2} (R : SetRel α β) (t : Set β), R.preimage (t ∩ R.cod) = R.preimage t
theorem SetRel.inter_dom_subset_preimage_image E1 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α β} {s : Set α}, s ∩ R.dom ⊆ R.preimage (R.image s)
theorem SetRel.inter_cod_subset_image_preimage E1 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α β} {t : Set β}, t ∩ R.cod ⊆ R.image (R.preimage t)
theorem SetRel.image_eq_biUnion E1 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α β} {s : Set α}, R.image s = ⋃ x ∈ s, {y | (x, y) ∈ R}
theorem SetRel.preimage_eq_biUnion E1 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α β} {t : Set β}, R.preimage t = ⋃ y ∈ t, {x | (x, y) ∈ R}
def SetRel.core E3 #
{α : Type u_1} → {β : Type u_2} → SetRel α β → Set β → Set α
Core of a set S : Set β w.R.t R : SetRel α β is the set of x : α that are related only
to elements of S. Other generalization of Function.preimage.
theorem SetRel.mem_core E0 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α β} {t : Set β} {a : α}, a ∈ R.core t ↔ ∀ ⦃b : β⦄, (a, b) ∈ R → b ∈ t
theorem SetRel.core_subset_core E1 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α β} {t₁ t₂ : Set β}, t₁ ⊆ t₂ → R.core t₁ ⊆ R.core t₂
theorem SetRel.core_mono E1 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α β}, Monotone R.core
theorem SetRel.core_inter E1 #
∀ {α : Type u_1} {β : Type u_2} (R : SetRel α β) (t₁ t₂ : Set β), R.core (t₁ ∩ t₂) = R.core t₁ ∩ R.core t₂
theorem SetRel.core_union_subset E1 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α β} {t₁ t₂ : Set β}, R.core t₁ ∪ R.core t₂ ⊆ R.core (t₁ ∪ t₂)
theorem SetRel.core_univ E0 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α β}, R.core Set.univ = Set.univ
theorem SetRel.core_id E0 #
∀ {β : Type u_2} (t : Set β), SetRel.id.core t = t
theorem SetRel.core_comp E1 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} (R : SetRel α β) (S : SetRel β γ) (u : Set γ),
(R.comp S).core u = R.core (S.core u)
theorem SetRel.image_subset_iff E0 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α β} {s : Set α} {t : Set β}, R.image s ⊆ t ↔ s ⊆ R.core t
theorem SetRel.image_core_gc E1 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α β}, GaloisConnection R.image R.core
def SetRel.restrictDomain E3 #
{α : Type u_1} → {β : Type u_2} → SetRel α β → (s : Set α) → SetRel (↑s) β
Restrict the domain of a relation to a subtype.
def SetRel.ball E1 #
{α : Type u_1} → {β : Type u_2} → SetRel α β → β → Set α
The ball of b : β with respect to a relation between α and β is the set of a : α related
to b.
theorem SetRel.mem_ball E0 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α β} {a : α} {b : β}, a ∈ R.ball b ↔ (a, b) ∈ R
theorem SetRel.ball_mono E1 #
∀ {α : Type u_1} {β : Type u_2} {R₁ R₂ : SetRel α β}, R₁ ⊆ R₂ → ∀ (b : β), R₁.ball b ⊆ R₂.ball b
theorem SetRel.ball_inter E1 #
∀ {α : Type u_1} {β : Type u_2} (R₁ R₂ : SetRel α β) (b : β), (R₁ ∩ R₂).ball b = R₁.ball b ∩ R₂.ball b
theorem SetRel.ball_iInter E1 #
∀ {α : Type u_1} {β : Type u_2} {ι : Sort u_5} (R : ι → Set (α × β)) (b : β),
SetRel.ball (⋂ i, R i) b = ⋂ i, SetRel.ball (R i) b
theorem SetRel.ball_subset_ball_of_comp_subset E1 #
∀ {α : Type u_1} {R₁ R₂ : SetRel α α} {a b : α}, (a, b) ∈ R₁ → R₁.comp R₁ ⊆ R₂ → R₁.ball a ⊆ R₂.ball b
abbrev SetRel.IsRefl E1 #
{α : Type u_1} → SetRel α α → Prop
A relation R is reflexive if a ~[R] a.
theorem SetRel.refl E1 #
∀ {α : Type u_1} (R : SetRel α α) [R.IsRefl] (a : α), (a, a) ∈ R
theorem SetRel.rfl E1 #
∀ {α : Type u_1} (R : SetRel α α) {a : α} [R.IsRefl], (a, a) ∈ R
theorem SetRel.id_subset E1 #
∀ {α : Type u_1} {R : SetRel α α} [R.IsRefl], SetRel.id ⊆ R
theorem SetRel.id_subset_iff E0 #
∀ {α : Type u_1} {R : SetRel α α}, SetRel.id ⊆ R ↔ R.IsRefl
instance SetRel.isRefl_univ E0 #
∀ {α : Type u_1}, SetRel.IsRefl Set.univ
instance SetRel.isRefl_inter E0 #
∀ {α : Type u_1} {R₁ R₂ : SetRel α α} [R₁.IsRefl] [R₂.IsRefl], (R₁ ∩ R₂).IsRefl
instance SetRel.IsRefl.comp E0 #
∀ {α : Type u_1} {R₁ R₂ : SetRel α α} [R₁.IsRefl] [R₂.IsRefl], (R₁.comp R₂).IsRefl
theorem SetRel.IsRefl.sInter E1 #
∀ {α : Type u_1} {ℛ : Set (SetRel α α)}, (∀ R ∈ ℛ, R.IsRefl) → SetRel.IsRefl (⋂₀ ℛ)
instance SetRel.isRefl_iInter E0 #
∀ {α : Type u_1} {ι : Sort u_5} {R : ι → SetRel α α} [∀ (i : ι), (R i).IsRefl], SetRel.IsRefl (⋂ i, R i)
instance SetRel.isRefl_preimage E0 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α α} {f : β → α} [R.IsRefl], SetRel.IsRefl (Prod.map f f ⁻¹' R)
theorem SetRel.isRefl_mono E1 #
∀ {α : Type u_1} {R₁ R₂ : SetRel α α} [R₁.IsRefl], R₁ ⊆ R₂ → R₂.IsRefl
theorem SetRel.left_subset_comp E1 #
∀ {α : Type u_1} {β : Type u_2} {S : SetRel β β} {R : SetRel α β} [S.IsRefl], R ⊆ R.comp S
theorem SetRel.right_subset_comp E1 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α α} [R.IsRefl] {S : SetRel α β}, S ⊆ R.comp S
theorem SetRel.subset_iterate_comp E1 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α α} [R.IsRefl] {S : SetRel α β} {n : ℕ}, S ⊆ (fun x ↦ R.comp x)^[n] S
theorem SetRel.self_subset_image E1 #
∀ {α : Type u_1} {R : SetRel α α} [R.IsRefl] (s : Set α), s ⊆ R.image s
theorem SetRel.self_subset_preimage E1 #
∀ {α : Type u_1} {R : SetRel α α} [R.IsRefl] (s : Set α), s ⊆ R.preimage s
theorem SetRel.exists_eq_singleton_of_prod_subset_id E1 #
∀ {α : Type u_1} {s t : Set α}, s.Nonempty → t.Nonempty → s ×ˢ t ⊆ SetRel.id → ∃ x, s = {x} ∧ t = {x}
abbrev SetRel.IsSymm E1 #
{α : Type u_1} → SetRel α α → Prop
A relation R is symmetric if a ~[R] b ↔ b ~[R] a.
theorem SetRel.symm E1 #
∀ {α : Type u_1} (R : SetRel α α) {a b : α} [R.IsSymm], (a, b) ∈ R → (b, a) ∈ R
theorem SetRel.comm E1 #
∀ {α : Type u_1} (R : SetRel α α) {a b : α} [R.IsSymm], (a, b) ∈ R ↔ (b, a) ∈ R
theorem SetRel.inv_eq_self E0 #
∀ {α : Type u_1} (R : SetRel α α) [R.IsSymm], R.inv = R
theorem SetRel.inv_eq_self_iff E0 #
∀ {α : Type u_1} {R : SetRel α α}, R.inv = R ↔ R.IsSymm
instance SetRel.instIsSymmInv E0 #
∀ {α : Type u_1} {R : SetRel α α} [R.IsSymm], R.inv.IsSymm
instance SetRel.isSymm_empty E0 #
∀ {α : Type u_1}, ∅.IsSymm
instance SetRel.isSymm_univ E0 #
∀ {α : Type u_1}, SetRel.IsSymm Set.univ
instance SetRel.isSymm_inter E0 #
∀ {α : Type u_1} {R₁ R₂ : SetRel α α} [R₁.IsSymm] [R₂.IsSymm], (R₁ ∩ R₂).IsSymm
theorem SetRel.IsSymm.sInter E1 #
∀ {α : Type u_1} {ℛ : Set (SetRel α α)}, (∀ R ∈ ℛ, R.IsSymm) → SetRel.IsSymm (⋂₀ ℛ)
instance SetRel.isSymm_iInter E0 #
∀ {α : Type u_1} {ι : Sort u_5} {R : ι → SetRel α α} [∀ (i : ι), (R i).IsSymm], SetRel.IsSymm (⋂ i, R i)
instance SetRel.isSymm_id E0 #
∀ {α : Type u_1}, SetRel.id.IsSymm
instance SetRel.isSymm_preimage E0 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α α} {f : β → α} [R.IsSymm], SetRel.IsSymm (Prod.map f f ⁻¹' R)
instance SetRel.isSymm_image E0 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α α} {f : α → β} [R.IsSymm], SetRel.IsSymm (Prod.map f f '' R)
instance SetRel.isSymm_comp_inv E0 #
∀ {α : Type u_1} {R : SetRel α α}, (R.comp R.inv).IsSymm
instance SetRel.isSymm_inv_comp E0 #
∀ {α : Type u_1} {R : SetRel α α}, (R.inv.comp R).IsSymm
instance SetRel.isSymm_comp_self E0 #
∀ {α : Type u_1} {R : SetRel α α} [R.IsSymm], (R.comp R).IsSymm
theorem SetRel.mem_comp_comp E0 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} {δ : Type u_4} {U : SetRel α β} {V : SetRel β γ} {W : SetRel γ δ}
{p : α × δ}, p ∈ (U.comp V).comp W ↔ (U.inv.ball p.1 ×ˢ W.ball p.2 ∩ V).Nonempty
theorem SetRel.prod_subset_comm E1 #
∀ {α : Type u_1} {s₁ s₂ : Set α} {R : SetRel α α} [R.IsSymm], s₁ ×ˢ s₂ ⊆ R ↔ s₂ ×ˢ s₁ ⊆ R
theorem SetRel.preimage_eq_image E1 #
∀ {α : Type u_1} {s : Set α} {R : SetRel α α} [R.IsSymm], R.preimage s = R.image s
def SetRel.symmetrize E1 #
{α : Type u_1} → SetRel α α → SetRel α α
The maximal symmetric relation contained in a given relation.
instance SetRel.isSymm_symmetrize E0 #
∀ {α : Type u_1} {R : SetRel α α}, R.symmetrize.IsSymm
theorem SetRel.symmetrize_subset_self E1 #
∀ {α : Type u_1} {R : SetRel α α}, R.symmetrize ⊆ R
theorem SetRel.symmetrize_subset_inv E1 #
∀ {α : Type u_1} {R : SetRel α α}, R.symmetrize ⊆ R.inv
theorem SetRel.subset_symmetrize E1 #
∀ {α : Type u_1} {R S : SetRel α α}, S ⊆ R.symmetrize ↔ S ⊆ R ∧ S ⊆ R.inv
theorem SetRel.symmetrize_mono E1 #
∀ {α : Type u_1} {R₁ R₂ : SetRel α α}, R₁ ⊆ R₂ → R₁.symmetrize ⊆ R₂.symmetrize
abbrev SetRel.IsTrans E1 #
{α : Type u_1} → SetRel α α → Prop
A relation R is transitive if a ~[R] b and b ~[R] c together imply a ~[R] c.
theorem SetRel.trans E1 #
∀ {α : Type u_1} (R : SetRel α α) {a b c : α} [R.IsTrans], (a, b) ∈ R → (b, c) ∈ R → (a, c) ∈ R
instance SetRel.instIsTransOfPredProdMatch_1PropOfIsTrans E0 #
∀ {α : Type u_1} {R : α → α → Prop} [IsTrans α R], SetRel.IsTrans {(a, b) | R a b}
theorem SetRel.comp_subset_self E1 #
∀ {α : Type u_1} {R : SetRel α α} [R.IsTrans], R.comp R ⊆ R
theorem SetRel.comp_eq_self E1 #
∀ {α : Type u_1} {R : SetRel α α} [R.IsRefl] [R.IsTrans], R.comp R = R
theorem SetRel.isTrans_iff_comp_subset_self E1 #
∀ {α : Type u_1} {R : SetRel α α}, R.IsTrans ↔ R.comp R ⊆ R
instance SetRel.isTrans_empty E0 #
∀ {α : Type u_1}, ∅.IsTrans
instance SetRel.isTrans_univ E0 #
∀ {α : Type u_1}, SetRel.IsTrans Set.univ
instance SetRel.isTrans_singleton E0 #
∀ {α : Type u_1} (x : α × α), {x}.IsTrans
instance SetRel.isTrans_inter E0 #
∀ {α : Type u_1} {R₁ R₂ : SetRel α α} [R₁.IsTrans] [R₂.IsTrans], (R₁ ∩ R₂).IsTrans
theorem SetRel.IsTrans.sInter E1 #
∀ {α : Type u_1} {ℛ : Set (SetRel α α)}, (∀ R ∈ ℛ, R.IsTrans) → SetRel.IsTrans (⋂₀ ℛ)
instance SetRel.isTrans_iInter E0 #
∀ {α : Type u_1} {ι : Sort u_5} {R : ι → SetRel α α} [∀ (i : ι), (R i).IsTrans], SetRel.IsTrans (⋂ i, R i)
instance SetRel.isTrans_id E0 #
∀ {α : Type u_1}, SetRel.id.IsTrans
instance SetRel.isTrans_preimage E0 #
∀ {α : Type u_1} {β : Type u_2} {R : SetRel α α} {f : β → α} [R.IsTrans], SetRel.IsTrans (Prod.map f f ⁻¹' R)
instance SetRel.isTrans_symmetrize E0 #
∀ {α : Type u_1} {R : SetRel α α} [R.IsTrans], R.symmetrize.IsTrans
abbrev SetRel.IsIrrefl E1 #
{α : Type u_1} → SetRel α α → Prop
A relation R is irreflexive if ¬ a ~[R] a.
theorem SetRel.irrefl E1 #
∀ {α : Type u_1} (R : SetRel α α) (a : α) [R.IsIrrefl], (a, a) ∉ R
instance SetRel.instIsIrreflOfPredProdMatch_1PropOfIrrefl E0 #
∀ {α : Type u_1} {R : α → α → Prop} [Std.Irrefl R], SetRel.IsIrrefl {(a, b) | R a b}
abbrev SetRel.IsWellFounded E1 #
{α : Type u_1} → SetRel α α → Prop
A relation R on a type α is well-founded if all elements of α are accessible within R.
abbrev SetRel.Hom E1 #
{α : Type u_1} → {β : Type u_2} → SetRel α α → SetRel β β → Type (max u_1 u_2)
A relation homomorphism with respect to a given pair of relations R and S is a function
f : α → β such that a ~[R] b → f a ~[S] f b.
def Function.graph E3 #
{α : Type u_1} → {β : Type u_2} → (α → β) → SetRel α β
The graph of a function as a relation.
theorem Function.mem_graph E0 #
∀ {α : Type u_1} {β : Type u_2} {f : α → β} {a : α} {b : β}, (a, b) ∈ Function.graph f ↔ f a = b
theorem Function.graph_injective E1 #
∀ {α : Type u_1} {β : Type u_2}, Function.Injective Function.graph
theorem Function.graph_inj E0 #
∀ {α : Type u_1} {β : Type u_2} {f g : α → β}, Function.graph f = Function.graph g ↔ f = g
theorem Function.graph_id E0 #
∀ {α : Type u_1}, Function.graph id = SetRel.id
theorem Function.graph_comp E1 #
∀ {α : Type u_1} {β : Type u_2} {γ : Type u_3} (f : β → γ) (g : α → β),
Function.graph (f ∘ g) = (Function.graph g).comp (Function.graph f)
def Function.tupleGraph E1 #
{α : Type u_1} → {β : Type u_2} → ((α → β) → β) → Set (Option α → β)
The higher-arity graph of a function. Describes α-argument functions from β to β.
theorem Equiv.graph_inv E1 #
∀ {α : Type u_1} {β : Type u_2} (f : α ≃ β), Function.graph ⇑f.symm = (Function.graph ⇑f).inv
theorem SetRel.exists_graph_eq_iff E0 #
∀ {α : Type u_1} {β : Type u_2} (R : SetRel α β), (∃! f, Function.graph f = R) ↔ ∀ (a : α), ∃! b, (a, b) ∈ R
theorem Set.image_eq E0 #
∀ {α : Type u_1} {β : Type u_2} (f : α → β) (s : Set α), f '' s = (Function.graph f).image s
theorem Set.preimage_eq E0 #
∀ {α : Type u_1} {β : Type u_2} (f : α → β) (s : Set β), f ⁻¹' s = (Function.graph f).preimage s
theorem Set.preimage_eq_core E1 #
∀ {α : Type u_1} {β : Type u_2} (f : α → β) (s : Set β), f ⁻¹' s = (Function.graph f).core s
abbrev Rel E3 #
Sort u_6 → Sort u_7 → Sort (max (max 1 u_6) u_7)
A shorthand for α → β → Prop.
Consider using SetRel instead if you want extra API for relations.