File: Mathlib/Data/Rel.lean

full_name: Rel
code: /-- A relation on `α` and `β`, aka a set-valued function, aka a partial multifunction -/
def Rel (α β : Type*) 
goal: Type (max u_4 u_5)

full_name: instCompleteLatticeRel
code: instance : CompleteLattice (Rel α β) 
goal: CompleteLattice (Rel α β)

full_name: instInhabitedRel
code: instance : Inhabited (Rel α β) 
goal: Inhabited (Rel α β)

full_name: Rel.ext
code: @[ext] theorem ext {r s : Rel α β} : (∀ a, r a = s a) → r = s 
goal: (∀ (a : α), r a = s a) → r = s

full_name: Rel.inv
code: /-- The inverse relation : `r.inv x y ↔ r y x`. Note that this is *not* a groupoid inverse. -/
def inv : Rel β α 
goal: Rel β α

full_name: Rel.inv_def
code: theorem inv_def (x : α) (y : β) : r.inv y x ↔ r x y 
goal: r.inv y x ↔ r x y

full_name: Rel.inv_inv
code: theorem inv_inv : inv (inv r) = r 
goal: r.inv.inv = r

full_name: Rel.dom
code: /-- Domain of a relation -/
def dom 
goal: Set α

full_name: Rel.dom_mono
code: theorem dom_mono {r s : Rel α β} (h : r ≤ s) : dom r ⊆ dom s 
goal: r.dom ⊆ s.dom

full_name: Rel.codom
code: /-- Codomain aka range of a relation -/
def codom 
goal: Set β

full_name: Rel.codom_inv
code: theorem codom_inv : r.inv.codom = r.dom 
goal: r.inv.codom = r.dom

full_name: Rel.dom_inv
code: theorem dom_inv : r.inv.dom = r.codom 
goal: r.inv.dom = r.codom

full_name: Rel.comp
code: /-- Composition of relation; note that it follows the `CategoryTheory/` order of arguments. -/
def comp (r : Rel α β) (s : Rel β γ) : Rel α γ 
goal: Rel α γ

full_name: Rel.«_aux_Mathlib_Data_Rel___macroRules_Rel_term_•__1»
code: /-- Local syntax for composition of relations. -/
local infixr:90 " • " => Rel.comp
goal: Lean.Macro

full_name: Rel._aux_Mathlib_Data_Rel___unexpand_Rel_comp_1
code: /-- Local syntax for composition of relations. -/
local infixr:90 " • " => Rel.comp
goal: Lean.PrettyPrinter.Unexpander

full_name: Rel.comp_assoc
code: theorem comp_assoc {δ : Type*} (r : Rel α β) (s : Rel β γ) (t : Rel γ δ) :
    (r • s) • t = r • (s • t) 
goal: (r.comp s).comp t = r.comp (s.comp t)

full_name: Rel.comp_right_id
code: @[simp]
theorem comp_right_id (r : Rel α β) : r • @Eq β = r 
goal: r.comp Eq = r

full_name: Rel.comp_left_id
code: @[simp]
theorem comp_left_id (r : Rel α β) : @Eq α • r = r 
goal: Rel.comp Eq r = r

full_name: Rel.comp_right_bot
code: @[simp]
theorem comp_right_bot (r : Rel α β) : r • (⊥ : Rel β γ) = ⊥ 
goal: r.comp ⊥ = ⊥

full_name: Rel.comp_left_bot
code: @[simp]
theorem comp_left_bot (r : Rel α β) : (⊥ : Rel γ α) • r = ⊥ 
goal: ⊥.comp r = ⊥

full_name: Rel.comp_right_top
code: @[simp]
theorem comp_right_top (r : Rel α β) : r • (⊤ : Rel β γ) = fun x _ ↦ x ∈ r.dom 
goal: r.comp ⊤ = fun x x_1 => x ∈ r.dom

full_name: Rel.comp_left_top
code: @[simp]
theorem comp_left_top (r : Rel α β) : (⊤ : Rel γ α) • r = fun _ y ↦ y ∈ r.codom 
goal: ⊤.comp r = fun x y => y ∈ r.codom

full_name: Rel.inv_id
code: theorem inv_id : inv (@Eq α) = @Eq α 
goal: Rel.inv Eq = Eq

full_name: Rel.inv_comp
code: theorem inv_comp (r : Rel α β) (s : Rel β γ) : inv (r • s) = inv s • inv r 
goal: (r.comp s).inv = s.inv.comp r.inv

full_name: Rel.inv_bot
code: @[simp]
theorem inv_bot : (⊥ : Rel α β).inv = (⊥ : Rel β α) 
goal: ⊥.inv = ⊥

full_name: Rel.inv_top
code: @[simp]
theorem inv_top : (⊤ : Rel α β).inv = (⊤ : Rel β α) 
goal: ⊤.inv = ⊤

full_name: Rel.image
code: /-- Image of a set under a relation -/
def image (s : Set α) : Set β 
goal: Set β

full_name: Rel.mem_image
code: theorem mem_image (y : β) (s : Set α) : y ∈ image r s ↔ ∃ x ∈ s, r x y 
goal: y ∈ r.image s ↔ ∃ x ∈ s, r x y

full_name: Rel.image_subset
code: theorem image_subset : ((· ⊆ ·) ⇒ (· ⊆ ·)) r.image r.image 
goal: ((fun x x_1 => x ⊆ x_1) ⇒ fun x x_1 => x ⊆ x_1) r.image r.image

full_name: Rel.image_mono
code: theorem image_mono : Monotone r.image 
goal: Monotone r.image

full_name: Rel.image_inter
code: theorem image_inter (s t : Set α) : r.image (s ∩ t) ⊆ r.image s ∩ r.image t 
goal: r.image (s ∩ t) ⊆ r.image s ∩ r.image t

full_name: Rel.image_union
code: theorem image_union (s t : Set α) : r.image (s ∪ t) = r.image s ∪ r.image t 
goal: r.image (s ∪ t) = r.image s ∪ r.image t

full_name: Rel.image_id
code: @[simp]
theorem image_id (s : Set α) : image (@Eq α) s = s 
goal: Rel.image Eq s = s

full_name: Rel.image_comp
code: theorem image_comp (s : Rel β γ) (t : Set α) : image (r • s) t = image s (image r t) 
goal: (r.comp s).image t = s.image (r.image t)

full_name: Rel.image_univ
code: theorem image_univ : r.image Set.univ = r.codom 
goal: r.image Set.univ = r.codom

full_name: Rel.image_empty
code: @[simp]
theorem image_empty : r.image ∅ = ∅ 
goal: r.image ∅ = ∅

full_name: Rel.image_bot
code: @[simp]
theorem image_bot (s : Set α) : (⊥ : Rel α β).image s = ∅ 
goal: ⊥.image s = ∅

full_name: Rel.image_top
code: @[simp]
theorem image_top {s : Set α} (h : Set.Nonempty s) :
    (⊤ : Rel α β).image s = Set.univ 
goal: ⊤.image s = Set.univ

full_name: Rel.preimage
code: /-- Preimage of a set under a relation `r`. Same as the image of `s` under `r.inv` -/
def preimage (s : Set β) : Set α 
goal: Set α

full_name: Rel.mem_preimage
code: theorem mem_preimage (x : α) (s : Set β) : x ∈ r.preimage s ↔ ∃ y ∈ s, r x y 
goal: x ∈ r.preimage s ↔ ∃ y ∈ s, r x y

full_name: Rel.preimage_def
code: theorem preimage_def (s : Set β) : preimage r s = { x | ∃ y ∈ s, r x y } 
goal: r.preimage s = {x | ∃ y ∈ s, r x y}

full_name: Rel.preimage_mono
code: theorem preimage_mono {s t : Set β} (h : s ⊆ t) : r.preimage s ⊆ r.preimage t 
goal: r.preimage s ⊆ r.preimage t

full_name: Rel.preimage_inter
code: theorem preimage_inter (s t : Set β) : r.preimage (s ∩ t) ⊆ r.preimage s ∩ r.preimage t 
goal: r.preimage (s ∩ t) ⊆ r.preimage s ∩ r.preimage t

full_name: Rel.preimage_union
code: theorem preimage_union (s t : Set β) : r.preimage (s ∪ t) = r.preimage s ∪ r.preimage t 
goal: r.preimage (s ∪ t) = r.preimage s ∪ r.preimage t

full_name: Rel.preimage_id
code: theorem preimage_id (s : Set α) : preimage (@Eq α) s = s 
goal: Rel.preimage Eq s = s

full_name: Rel.preimage_comp
code: theorem preimage_comp (s : Rel β γ) (t : Set γ) :
    preimage (r • s) t = preimage r (preimage s t) 
goal: (r.comp s).preimage t = r.preimage (s.preimage t)

full_name: Rel.preimage_univ
code: theorem preimage_univ : r.preimage Set.univ = r.dom 
goal: r.preimage Set.univ = r.dom

full_name: Rel.preimage_empty
code: @[simp]
theorem preimage_empty : r.preimage ∅ = ∅ 
goal: r.preimage ∅ = ∅

full_name: Rel.preimage_inv
code: @[simp]
theorem preimage_inv (s : Set α) : r.inv.preimage s = r.image s 
goal: r.inv.preimage s = r.image s

full_name: Rel.preimage_bot
code: @[simp]
theorem preimage_bot (s : Set β) : (⊥ : Rel α β).preimage s = ∅ 
goal: ⊥.preimage s = ∅

full_name: Rel.preimage_top
code: @[simp]
theorem preimage_top {s : Set β} (h : Set.Nonempty s) :
    (⊤ : Rel α β).preimage s = Set.univ 
goal: ⊤.preimage s = Set.univ

full_name: Rel.image_eq_dom_of_codomain_subset
code: theorem image_eq_dom_of_codomain_subset {s : Set β} (h : r.codom ⊆ s) : r.preimage s = r.dom 
goal: r.preimage s = r.dom

full_name: Rel.preimage_eq_codom_of_domain_subset
code: theorem preimage_eq_codom_of_domain_subset {s : Set α} (h : r.dom ⊆ s) : r.image s = r.codom 
goal: r.image s = r.codom

full_name: Rel.image_inter_dom_eq
code: theorem image_inter_dom_eq (s : Set α) : r.image (s ∩ r.dom) = r.image s 
goal: r.image (s ∩ r.dom) = r.image s

full_name: Rel.preimage_inter_codom_eq
code: @[simp]
theorem preimage_inter_codom_eq (s : Set β) : r.preimage (s ∩ r.codom) = r.preimage s 
goal: r.preimage (s ∩ r.codom) = r.preimage s

full_name: Rel.inter_dom_subset_preimage_image
code: theorem inter_dom_subset_preimage_image (s : Set α) : s ∩ r.dom ⊆ r.preimage (r.image s) 
goal: s ∩ r.dom ⊆ r.preimage (r.image s)

full_name: Rel.image_preimage_subset_inter_codom
code: theorem image_preimage_subset_inter_codom (s : Set β) : s ∩ r.codom ⊆ r.image (r.preimage s) 
goal: s ∩ r.codom ⊆ r.image (r.preimage s)

full_name: Rel.core
code: /-- Core of a set `s : Set β` w.r.t `r : Rel α β` is the set of `x : α` that are related *only*
to elements of `s`. Other generalization of `Function.preimage`. -/
def core (s : Set β) 
goal: Set α

full_name: Rel.mem_core
code: theorem mem_core (x : α) (s : Set β) : x ∈ r.core s ↔ ∀ y, r x y → y ∈ s 
goal: x ∈ r.core s ↔ ∀ (y : β), r x y → y ∈ s

full_name: Rel.core_subset
code: theorem core_subset : ((· ⊆ ·) ⇒ (· ⊆ ·)) r.core r.core 
goal: ((fun x x_1 => x ⊆ x_1) ⇒ fun x x_1 => x ⊆ x_1) r.core r.core

full_name: Rel.core_mono
code: theorem core_mono : Monotone r.core 
goal: Monotone r.core

full_name: Rel.core_inter
code: theorem core_inter (s t : Set β) : r.core (s ∩ t) = r.core s ∩ r.core t 
goal: r.core (s ∩ t) = r.core s ∩ r.core t

full_name: Rel.core_union
code: theorem core_union (s t : Set β) : r.core s ∪ r.core t ⊆ r.core (s ∪ t) 
goal: r.core s ∪ r.core t ⊆ r.core (s ∪ t)

full_name: Rel.core_univ
code: @[simp]
theorem core_univ : r.core Set.univ = Set.univ 
goal: r.core Set.univ = Set.univ

full_name: Rel.core_id
code: theorem core_id (s : Set α) : core (@Eq α) s = s 
goal: Rel.core Eq s = s

full_name: Rel.core_comp
code: theorem core_comp (s : Rel β γ) (t : Set γ) : core (r • s) t = core r (core s t) 
goal: (r.comp s).core t = r.core (s.core t)

full_name: Rel.restrictDomain
code: /-- Restrict the domain of a relation to a subtype. -/
def restrictDomain (s : Set α) : Rel { x // x ∈ s } β 
goal: Rel { x // x ∈ s } β

full_name: Rel.image_subset_iff
code: theorem image_subset_iff (s : Set α) (t : Set β) : image r s ⊆ t ↔ s ⊆ core r t 
goal: r.image s ⊆ t ↔ s ⊆ r.core t

full_name: Rel.image_core_gc
code: theorem image_core_gc : GaloisConnection r.image r.core 
goal: GaloisConnection r.image r.core

full_name: Function.graph
code: /-- The graph of a function as a relation. -/
def graph (f : α → β) : Rel α β 
goal: Rel α β

full_name: Function.graph_def
code: @[simp] lemma graph_def (f : α → β) (x y) : f.graph x y ↔ (f x = y) 
goal: Function.graph f x y ↔ f x = y

full_name: Function.graph_injective
code: theorem graph_injective : Injective (graph : (α → β) → Rel α β) 
goal: Function.Injective Function.graph

full_name: Function.graph_inj
code: @[simp] lemma graph_inj {f g : α → β} : f.graph = g.graph ↔ f = g 
goal: Function.graph f = Function.graph g ↔ f = g

full_name: Function.graph_id
code: theorem graph_id : graph id = @Eq α 
goal: Function.graph id = Eq

full_name: Function.graph_comp
code: theorem graph_comp {f : β → γ} {g : α → β} : graph (f ∘ g) = Rel.comp (graph g) (graph f) 
goal: Function.graph (f ∘ g) = (Function.graph g).comp (Function.graph f)

full_name: Equiv.graph_inv
code: theorem Equiv.graph_inv (f : α ≃ β) : (f.symm : β → α).graph = Rel.inv (f : α → β).graph 
goal: Function.graph ⇑f.symm = (Function.graph ⇑f).inv

full_name: Relation.is_graph_iff
code: theorem Relation.is_graph_iff (r : Rel α β) : (∃! f, Function.graph f = r) ↔ ∀ x, ∃! y, r x y 
goal: (∃! f, Function.graph f = r) ↔ ∀ (x : α), ∃! y, r x y

full_name: Set.image_eq
code: theorem image_eq (f : α → β) (s : Set α) : f '' s = (Function.graph f).image s 
goal: f '' s = (Function.graph f).image s

full_name: Set.preimage_eq
code: theorem preimage_eq (f : α → β) (s : Set β) : f ⁻¹' s = (Function.graph f).preimage s 
goal: f ⁻¹' s = (Function.graph f).preimage s

full_name: Set.preimage_eq_core
code: theorem preimage_eq_core (f : α → β) (s : Set β) : f ⁻¹' s = (Function.graph f).core s 
goal: f ⁻¹' s = (Function.graph f).core s