Relations #
This file defines bundled relations. A relation between α
and β
is a function α → β → Prop
.
Relations are also known as set-valued functions, or partial multifunctions.
Main declarations #
Rel α β
: Relation betweenα
andβ
.Rel.inv
:r.inv
is theRel β α
obtained by swapping the arguments ofr
.Rel.dom
: Domain of a relation.x ∈ r.dom
iff there existsy
such thatr x y
.Rel.codom
: Codomain, aka range, of a relation.y ∈ r.codom
iff there existsx
such thatr x y
.Rel.comp
: Relation composition. Note that the arguments order follows theCategoryTheory/
one, sor.comp s x z ↔ ∃ y, r x y ∧ s y z
.Rel.image
: Image of a set under a relation.r.image s
is the set off x
over allx ∈ s
.Rel.preimage
: Preimage of a set under a relation. Note thatr.preimage = r.inv.image
.Rel.core
: Core of a set. Fors : Set β
,r.core s
is the set ofx : α
such that ally
related tox
are ins
.Rel.restrict_domain
: Domain-restriction of a relation to a subtype.Function.graph
: Graph of a function as a relation.
Equations
- instCompleteLatticeRel = let_fun this := inferInstance; this
@[simp]
theorem
Rel.mem_preimage
{α : Type u_1}
{β : Type u_2}
(r : Rel α β)
(x : α)
(s : Set β)
:
x ∈ Rel.preimage r s ↔ ∃ y ∈ s, r x y
theorem
Rel.preimage_def
{α : Type u_1}
{β : Type u_2}
(r : Rel α β)
(s : Set β)
:
Rel.preimage r s = {x : α | ∃ y ∈ s, r x y}
theorem
Rel.preimage_mono
{α : Type u_1}
{β : Type u_2}
(r : Rel α β)
{s : Set β}
{t : Set β}
(h : s ⊆ t)
:
Rel.preimage r s ⊆ Rel.preimage r t
theorem
Rel.preimage_inter
{α : Type u_1}
{β : Type u_2}
(r : Rel α β)
(s : Set β)
(t : Set β)
:
Rel.preimage r (s ∩ t) ⊆ Rel.preimage r s ∩ Rel.preimage r t
theorem
Rel.preimage_union
{α : Type u_1}
{β : Type u_2}
(r : Rel α β)
(s : Set β)
(t : Set β)
:
Rel.preimage r (s ∪ t) = Rel.preimage r s ∪ Rel.preimage r t
theorem
Rel.preimage_comp
{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
(r : Rel α β)
(s : Rel β γ)
(t : Set γ)
:
Rel.preimage (Rel.comp r s) t = Rel.preimage r (Rel.preimage s t)
theorem
Rel.preimage_univ
{α : Type u_1}
{β : Type u_2}
(r : Rel α β)
:
Rel.preimage r Set.univ = Rel.dom r
@[simp]
@[simp]
theorem
Rel.preimage_inv
{α : Type u_1}
{β : Type u_2}
(r : Rel α β)
(s : Set α)
:
Rel.preimage (Rel.inv r) s = Rel.image r s
@[simp]
@[simp]
theorem
Rel.preimage_top
{α : Type u_1}
{β : Type u_2}
{s : Set β}
(h : Set.Nonempty s)
:
Rel.preimage ⊤ s = Set.univ
@[simp]
theorem
Rel.preimage_inter_codom_eq
{α : Type u_1}
{β : Type u_2}
(r : Rel α β)
(s : Set β)
:
Rel.preimage r (s ∩ Rel.codom r) = Rel.preimage r s
Restrict the domain of a relation to a subtype.
Equations
- Rel.restrictDomain r s x y = r (↑x) y
Instances For
theorem
Rel.image_core_gc
{α : Type u_1}
{β : Type u_2}
(r : Rel α β)
:
GaloisConnection (Rel.image r) (Rel.core r)
@[simp]
theorem
Function.graph_def
{α : Type u_1}
{β : Type u_2}
(f : α → β)
(x : α)
(y : β)
:
Function.graph f x y ↔ f x = y
theorem
Function.graph_comp
{α : Type u_1}
{β : Type u_2}
{γ : Type u_3}
{f : β → γ}
{g : α → β}
:
Function.graph (f ∘ g) = Rel.comp (Function.graph g) (Function.graph f)
theorem
Equiv.graph_inv
{α : Type u_1}
{β : Type u_2}
(f : α ≃ β)
:
Function.graph ⇑f.symm = Rel.inv (Function.graph ⇑f)
theorem
Relation.is_graph_iff
{α : Type u_1}
{β : Type u_2}
(r : Rel α β)
:
(∃! (f : α → β), Function.graph f = r) ↔ ∀ (x : α), ∃! (y : β), r x y
theorem
Set.image_eq
{α : Type u_1}
{β : Type u_2}
(f : α → β)
(s : Set α)
:
f '' s = Rel.image (Function.graph f) s
theorem
Set.preimage_eq
{α : Type u_1}
{β : Type u_2}
(f : α → β)
(s : Set β)
:
f ⁻¹' s = Rel.preimage (Function.graph f) s
theorem
Set.preimage_eq_core
{α : Type u_1}
{β : Type u_2}
(f : α → β)
(s : Set β)
:
f ⁻¹' s = Rel.core (Function.graph f) s