Relations #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
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 thecategory_theory/
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.
@[protected, instance]
The graph of a function as a relation.
Equations
- function.graph f = λ (x : α) (y : β), f x = y
theorem
set.image_eq
{α : Type u_1}
{β : Type u_2}
(f : α → β)
(s : set α) :
f '' s = (function.graph f).image s
theorem
set.preimage_eq
{α : Type u_1}
{β : Type u_2}
(f : α → β)
(s : set β) :
f ⁻¹' s = (function.graph f).preimage s
theorem
set.preimage_eq_core
{α : Type u_1}
{β : Type u_2}
(f : α → β)
(s : set β) :
f ⁻¹' s = (function.graph f).core s